* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #374151;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Main Wrapper - Centers Tool Content */
.main-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    box-sizing: border-box;
}

.analyzer-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: block;
    clear: both;
}

/* Content Wrapper - Centers Supporting Content */
.content-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    box-sizing: border-box;
    background: #f8fafc;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
    width: 100%;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Upload Section Styles */
.upload-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    margin: 0 auto;
    display: block;
    box-sizing: border-box;
}

.main-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 12px;
    word-wrap: break-word;
    hyphens: auto;
}

.subtitle {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 40px;
    font-weight: 400;
    word-wrap: break-word;
    hyphens: auto;
}

.upload-area {
    border: 3px dashed #cbd5e1;
    border-radius: 12px;
    padding: 60px 40px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f8fafc;
    box-sizing: border-box;
}

.upload-area:hover {
    border-color: #1e40af;
    background: #eff6ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #ec4899;
    background: #fdf2f8;
}

.upload-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 20px 0 10px;
    word-wrap: break-word;
    hyphens: auto;
}

.upload-content p {
    color: #6b7280;
    margin-bottom: 25px;
    word-wrap: break-word;
    hyphens: auto;
}

.upload-icon {
    color: #1e40af;
    margin-bottom: 10px;
}

.upload-btn {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 64, 175, 0.3);
}

.guidelines {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 25px;
    text-align: left;
    box-sizing: border-box;
}

.guidelines h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
    word-wrap: break-word;
    hyphens: auto;
}

.guidelines ul {
    list-style: none;
}

.guidelines li {
    padding: 5px 0;
    position: relative;
    padding-left: 20px;
    color: #4b5563;
    word-wrap: break-word;
    hyphens: auto;
}

.guidelines li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

/* Processing Section Styles */
.processing-card {
    background: white;
    border-radius: 16px;
    padding: 60px 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    margin: 0 auto;
    display: block;
    box-sizing: border-box;
}

.processing-animation {
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
}

.face-outline {
    width: 120px;
    height: 150px;
    border: 3px solid #e5e7eb;
    border-radius: 60px 60px 80px 80px;
    position: relative;
    margin: 0 auto;
    overflow: hidden;
}

.scanning-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ec4899, transparent);
    animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
    0% { transform: translateY(0); }
    100% { transform: translateY(147px); }
}

.processing-card h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
    word-wrap: break-word;
    hyphens: auto;
}

.processing-card p {
    color: #6b7280;
    margin-bottom: 30px;
    word-wrap: break-word;
    hyphens: auto;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
    max-width: 300px;
    margin: 0 auto;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e40af, #ec4899);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-weight: 600;
    color: #1e40af;
    min-width: 40px;
}

/* Results Section Styles */
.results-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin: 0 auto;
    display: block;
    box-sizing: border-box;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f1f5f9;
}

.face-shape-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    flex-shrink: 0;
}

.result-info h2 {
    font-size: 1.2rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 5px;
    word-wrap: break-word;
    hyphens: auto;
}

.face-shape-result {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
    word-wrap: break-word;
    hyphens: auto;
}

.confidence {
    color: #10b981;
    font-weight: 600;
    font-size: 1rem;
}

.shape-description {
    background: #f8fafc;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-sizing: border-box;
}

.shape-description h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
    word-wrap: break-word;
    hyphens: auto;
}

.shape-description p {
    color: #4b5563;
    line-height: 1.7;
    word-wrap: break-word;
    hyphens: auto;
}

/* All Shapes Results Section */
.all-shapes-section {
    background: #f1f5f9;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-sizing: border-box;
}

.all-shapes-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    text-align: center;
    word-wrap: break-word;
    hyphens: auto;
}

.shapes-grid {
    display: grid;
    gap: 12px;
}

.shape-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.shape-result-item.top-match {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 2px solid #3b82f6;
    transform: scale(1.02);
}

.shape-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0; /* Allow text to shrink */
}

.shape-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.shape-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
    word-wrap: break-word;
    hyphens: auto;
}

.shape-percentage {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 120px;
    flex-shrink: 0;
}

.percentage-bar {
    width: 60px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.percentage-fill {
    height: 100%;
    background: linear-gradient(90deg, #1e40af, #ec4899);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.percentage-text {
    font-weight: 600;
    color: #1e40af;
    font-size: 0.9rem;
    min-width: 35px;
}

.recommendations {
    margin-bottom: 30px;
}

.recommendations h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    word-wrap: break-word;
    hyphens: auto;
}

.recommendation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.recommendation-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
    box-sizing: border-box;
}

.recommendation-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 10px;
    word-wrap: break-word;
    hyphens: auto;
}

.recommendation-item ul {
    list-style: none;
}

.recommendation-item li {
    padding: 3px 0;
    color: #4b5563;
    position: relative;
    padding-left: 15px;
    word-wrap: break-word;
    hyphens: auto;
}

.recommendation-item li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #ec4899;
    font-weight: bold;
}

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3);
}

.btn-secondary {
    background: #f8fafc;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #d1d5db;
    transform: translateY(-2px);
}

/* Content Section Styles */
.content-section {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: block;
    clear: both;
}

.content-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    line-height: 1.8;
    width: 100%;
    display: block;
    box-sizing: border-box;
    word-wrap: break-word;
    hyphens: auto;
}

.content-card h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1f2937;
    margin: 30px 0 15px 0;
    word-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

.content-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1e40af;
    margin: 25px 0 10px 0;
    word-wrap: break-word;
    hyphens: auto;
    line-height: 1.3;
}

.content-card p {
    color: #4b5563;
    margin-bottom: 15px;
    font-size: 1rem;
    word-wrap: break-word;
    hyphens: auto;
}

.content-card ul {
    margin: 15px 0;
    padding-left: 0;
    list-style: none;
}

.content-card li {
    padding: 5px 0;
    position: relative;
    padding-left: 25px;
    color: #4b5563;
    word-wrap: break-word;
    hyphens: auto;
}

.content-card li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-wrapper {
        padding: 20px 15px;
        min-height: auto;
    }
    
    .content-wrapper {
        padding: 20px 15px;
    }
    
    .upload-card, .processing-card, .results-card, .content-card {
        padding: 30px 20px;
    }
    
    .main-title {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .result-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
    }

    .shape-percentage {
        min-width: 100px;
    }

    .percentage-bar {
        width: 50px;
    }

    .content-card h2 {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    .content-card h3 {
        font-size: 1.2rem;
        line-height: 1.3;
    }

    .recommendation-grid {
        grid-template-columns: 1fr;
    }

    .shape-result-item {
        padding: 12px 15px;
    }

    .shape-info {
        gap: 8px;
    }

    .shape-icon {
        font-size: 1.2rem;
        width: 30px;
    }

    .shape-name {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .main-wrapper {
        padding: 15px 10px;
    }

    .content-wrapper {
        padding: 15px 10px;
    }

    .upload-card, .processing-card, .results-card, .content-card {
        padding: 20px 15px;
    }
    
    .main-title {
        font-size: 1.6rem;
        line-height: 1.2;
    }
    
    .face-shape-result {
        font-size: 1.6rem;
        line-height: 1.2;
    }

    .content-card h2 {
        font-size: 1.2rem;
        line-height: 1.3;
        margin: 20px 0 10px 0;
    }

    .content-card h3 {
        font-size: 1.1rem;
        line-height: 1.3;
        margin: 15px 0 8px 0;
    }

    .content-card p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .upload-area {
        padding: 30px 15px;
    }

    .upload-content h3 {
        font-size: 1.2rem;
    }

    .guidelines {
        padding: 20px 15px;
    }

    .shape-description {
        padding: 20px 15px;
    }

    .all-shapes-section {
        padding: 20px 15px;
    }

    .recommendation-item {
        padding: 15px;
    }

    /* Ensure text never overflows */
    * {
        word-wrap: break-word !important;
        hyphens: auto !important;
        overflow-wrap: break-word !important;
    }
}

/* Extra small screens */
@media (max-width: 320px) {
    .main-wrapper {
        padding: 10px 8px;
    }

    .content-wrapper {
        padding: 10px 8px;
    }

    .upload-card, .processing-card, .results-card, .content-card {
        padding: 15px 10px;
    }

    .main-title {
        font-size: 1.4rem;
    }

    .content-card h2 {
        font-size: 1.1rem;
    }

    .content-card h3 {
        font-size: 1rem;
    }

    .content-card p {
        font-size: 0.9rem;
    }
}