/* ==========================================================================
   FACE EXPRESSION DETECTOR - STYLESHEET
   Kombinasi Warna: Biru, Putih, Ungu Muda
   Desain Modern, Responsif, Interaktif & Elegan
   ========================================================================== */

/* --- ROOT VARIABLES & COLOR PALETTE --- */
:root {
    /* Primary Blues */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #3b82f6;
    --color-primary-subtle: #eff6ff;

    /* Secondary & Soft Purples */
    --color-purple: #8b5cf6;
    --color-purple-hover: #7c3aed;
    --color-purple-light: #a78bfa;
    --color-purple-subtle: #f5f3ff;
    --color-lilac: #ddd6fe;

    /* Neutral & Backgrounds */
    --color-bg: #f8fafc;
    --color-bg-card: #ffffff;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;

    /* Typography */
    --color-text-main: #0f172a;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;

    /* Semantic States */
    --color-success: #10b981;
    --color-success-subtle: #ecfdf5;
    --color-warning: #f59e0b;
    --color-warning-subtle: #fffbeb;
    --color-danger: #ef4444;
    --color-danger-subtle: #fef2f2;

    /* Category Specific Colors */
    --color-happy: #10b981;
    --color-happy-gradient: linear-gradient(135deg, #34d399, #059669);
    --color-sad: #3b82f6;
    --color-sad-gradient: linear-gradient(135deg, #60a5fa, #2563eb);
    --color-neutral: #8b5cf6;
    --color-neutral-gradient: linear-gradient(135deg, #a78bfa, #7c3aed);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -3px rgba(37, 99, 235, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 35px -5px rgba(37, 99, 235, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Typography */
    --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- RESET & GLOBAL STYLES --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Background Ambient Glows */
.blob-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    animation: blobFloat 18s infinite alternate ease-in-out;
}

.blob-blue {
    top: -100px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: #93c5fd;
}

.blob-purple {
    top: 40%;
    right: -150px;
    width: 550px;
    height: 550px;
    background: #ddd6fe;
    animation-delay: -5s;
}

.blob-light-blue {
    bottom: -100px;
    left: 20%;
    width: 450px;
    height: 450px;
    background: #c7d2fe;
    animation-delay: -9s;
}

@keyframes blobFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 40px) scale(1.08); }
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.text-center { text-align: center; }
.mt-4 { margin-top: 2rem; }
.mb-4 { margin-bottom: 2rem; }

/* --- HEADER & NAVBAR --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    transition: var(--transition-base);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-text-main);
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.brand-icon svg {
    width: 24px;
    height: 24px;
}

.ai-sparkle {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 14px;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(90deg, var(--color-primary), var(--color-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-subtle);
}

.btn-config {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--color-purple-subtle);
    color: var(--color-purple);
    border: 1px solid var(--color-lilac);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-config:hover {
    background: #ede9fe;
    color: var(--color-purple-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

/* --- HERO SECTION --- */
.hero-section {
    padding: 4rem 0 2.5rem 0;
    text-align: center;
}

.hero-content {
    max-width: 820px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(239, 246, 255, 0.9);
    border: 1px solid #bfdbfe;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 1.25rem;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-primary);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 40%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.hero-highlights {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.25rem;
}

.highlight-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border);
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text-main);
    box-shadow: var(--shadow-sm);
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.6rem;
    font-family: var(--font-body);
    font-size: 0.98rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-hover), var(--color-purple-hover));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: #ffffff;
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-border-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-outline:hover {
    background: var(--color-bg);
    color: var(--color-text-main);
}

/* Model Status Strip */
.model-status-strip {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.status-indicator-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--color-warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    transition: var(--transition-base);
    flex-shrink: 0;
}

.status-indicator-circle.ready {
    background-color: var(--color-success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-indicator-circle.error {
    background-color: var(--color-danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.status-text-wrap {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--color-text-main);
}

.status-url-sub {
    font-size: 0.78rem;
    color: var(--color-text-light);
    word-break: break-all;
}

.btn-xs {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    border: 1px solid #bfdbfe;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-xs:hover {
    background: #dbeafe;
}

/* --- MAIN DETECTION LAYOUT (GRID) --- */
.detection-section {
    padding: 1.5rem 0 3.5rem 0;
}

.detection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Card Common */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: var(--transition-base);
}

.card:hover {
    border-color: rgba(147, 197, 253, 0.8);
}

.card-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
}

.card-header.border-none {
    border-bottom: none;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.card-icon-bubble {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-icon-bubble.icon-purple {
    background: var(--color-purple-subtle);
    color: var(--color-purple);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.card-subtitle {
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

/* Camera Status Pill */
.camera-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.camera-status-pill.active {
    background: #fef2f2;
    color: #ef4444;
}

.camera-status-pill .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.camera-status-pill.active .status-dot {
    background: #ef4444;
    animation: liveBlink 1.2s infinite;
}

@keyframes liveBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Video Container */
.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0f172a;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#webcamVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Default mirrored */
    transition: transform 0.2s ease;
}

#webcamVideo.unmirrored {
    transform: scaleX(1);
}

/* Futuristic Scan Overlay */
.scan-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: none;
    z-index: 5;
}

.scan-overlay.active {
    display: block;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.9), rgba(139, 92, 246, 0.9), transparent);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.8);
    animation: scanMoving 2.4s infinite alternate ease-in-out;
}

@keyframes scanMoving {
    0% { top: 5%; }
    100% { top: 92%; }
}

.face-target-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 70%;
    border-radius: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.25);
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #60a5fa;
    border-style: solid;
}

.corner-tl { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-top-left-radius: 12px; }
.corner-tr { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-top-right-radius: 12px; }
.corner-bl { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-bottom-left-radius: 12px; }
.corner-br { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-bottom-right-radius: 12px; }

/* Camera Placeholder */
.camera-placeholder {
    position: absolute;
    inset: 0;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    z-index: 10;
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: #94a3b8;
}

.placeholder-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #f8fafc;
}

.placeholder-desc {
    font-size: 0.88rem;
    color: #94a3b8;
    max-width: 340px;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.placeholder-desc strong {
    color: #60a5fa;
}

.placeholder-privacy-note {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.07);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
}

/* Loading Overlay */
.camera-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    z-index: 12;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--color-primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.sub-tip {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 0.4rem;
}

/* Camera Controls */
.camera-controls {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    flex-wrap: wrap;
}

.btn-start {
    flex: 1;
    background: linear-gradient(135deg, var(--color-primary), #1d4ed8);
    color: white;
}

.btn-start:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-hover), #1e40af);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-stop {
    flex: 1;
    background: #f8fafc;
    color: var(--color-danger);
    border: 1px solid #fecaca;
}

.btn-stop:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #f87171;
}

.btn-start:disabled, .btn-stop:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-icon-only {
    padding: 0.8rem;
    border-radius: var(--radius-md);
    background: #f1f5f9;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon-only:hover {
    background: #e2e8f0;
    color: var(--color-text-main);
}

/* Alert Box */
.alert-box {
    margin: 0 1.5rem 1.25rem 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.86rem;
}

.alert-box.error {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
}

.alert-box.error .alert-icon {
    color: #ef4444;
    flex-shrink: 0;
}

.alert-content strong {
    display: block;
    margin-bottom: 0.2rem;
}

/* --- RIGHT COLUMN: RESULTS & PROBABILITIES --- */
.right-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Result Card */
.result-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.result-card.mood-happy {
    border-color: #a7f3d0;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.12);
}

.result-card.mood-sad {
    border-color: #bfdbfe;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.12);
}

.result-card.mood-neutral {
    border-color: #ddd6fe;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.12);
}

.result-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    background: var(--color-purple-subtle);
    color: var(--color-purple);
    font-size: 0.82rem;
    font-weight: 600;
}

.pulse-ring {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-purple);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7);
    animation: pulseRing 2s infinite;
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.confidence-tag {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#mainConfidenceValue {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
}

.confidence-tag .sub-text {
    font-size: 0.72rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.result-body {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.expression-avatar {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: 3px solid #ffffff;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.avatar-emoji {
    font-size: 3.2rem;
    line-height: 1;
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-emoji.pop {
    animation: emojiPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes emojiPop {
    0% { transform: scale(0.6); }
    70% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.expression-info {
    flex: 1;
}

.expression-lead-label {
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    display: block;
    margin-bottom: 0.2rem;
}

.expression-name {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.4rem;
    color: var(--color-text-main);
}

.expression-description {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Result Footer Metrics */
.result-footer-metrics {
    padding: 0.85rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0.5rem;
}

.metric-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.metric-label {
    font-size: 0.72rem;
    color: var(--color-text-light);
    font-weight: 500;
}

.metric-val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-main);
}

.metric-divider {
    width: 1px;
    height: 24px;
    background: var(--color-border);
}

/* Probability Bars Card */
.probability-card {
    padding-bottom: 0.5rem;
}

.probability-bars-wrapper {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.prob-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.prob-item.highlight-leader {
    background: rgba(239, 246, 255, 0.7);
    border-left: 3px solid var(--color-primary);
}

.prob-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prob-identity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prob-emoji {
    font-size: 1.2rem;
}

.prob-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-main);
}

.prob-name small {
    color: var(--color-text-muted);
    font-weight: 400;
    font-size: 0.82rem;
}

.prob-percent {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--color-text-main);
}

.progress-track {
    width: 100%;
    height: 12px;
    background: #f1f5f9;
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.28s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.fill-happy {
    background: linear-gradient(90deg, #34d399, #10b981);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.fill-sad {
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

.fill-neutral {
    background: linear-gradient(90deg, #a78bfa, #8b5cf6);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.fill-custom {
    background: linear-gradient(90deg, #f472b6, #ec4899);
}

/* Extra Classes Container */
.extra-classes-container {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    margin-top: 0.5rem;
}

/* --- PRIVACY SECTION --- */
.privacy-section {
    padding: 1.5rem 0 3rem 0;
}

.privacy-card {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.8), rgba(245, 243, 255, 0.8));
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.privacy-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.privacy-text h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--color-text-main);
}

.privacy-text p {
    font-size: 0.92rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* --- ABOUT SECTION --- */
.about-section {
    padding: 3.5rem 0 5rem 0;
    border-top: 1px solid var(--color-border);
}

.section-tag {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-purple);
    margin-bottom: 0.5rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.section-desc {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    max-width: 680px;
    margin: 0 auto 3rem auto;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.about-card {
    padding: 1.75rem;
}

.about-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.bg-blue-subtle { background: #dbeafe; }
.bg-purple-subtle { background: #ede9fe; }
.bg-indigo-subtle { background: #e0e7ff; }

.about-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.about-card-desc {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* Steps Card */
.steps-card {
    padding: 2.25rem;
    margin-top: 2.5rem;
    background: #ffffff;
}

.steps-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
    text-align: center;
}

.steps-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.steps-timeline::before {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 21px;
    width: 2px;
    background: #e2e8f0;
    z-index: 1;
}

.step-item {
    display: flex;
    gap: 1.25rem;
    position: relative;
    z-index: 2;
}

.step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-purple));
    color: white;
    font-family: var(--font-heading);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.step-content {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    flex: 1;
}

.step-content h4 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    color: var(--color-text-main);
}

.step-content p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.step-content code {
    background: #e2e8f0;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--color-primary-hover);
    font-family: monospace;
}

.step-content a {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 500;
}

/* --- FOOTER --- */
.footer {
    background: #ffffff;
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: 2rem;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text-main);
}

.footer-left p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.footer-right p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* --- MODAL (CONFIG POPUP) --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: #ffffff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--color-purple-subtle);
    color: var(--color-purple);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--color-text-light);
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    color: var(--color-text-main);
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-main);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--color-text-main);
    outline: none;
    transition: var(--transition-fast);
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-help {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.form-help code {
    background: #f1f5f9;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: monospace;
}

.modal-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.modal-alert.error {
    background: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
}

.modal-alert.success {
    background: #ecfdf5;
    border: 1px solid #d1fae5;
    color: #065f46;
}

.model-info-preview {
    background: #f8fafc;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.info-k {
    color: var(--color-text-muted);
}

.info-v {
    font-weight: 600;
    color: var(--color-text-main);
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.modal-footer-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* --- RESPONSIVE MEDIA QUERIES --- */
@media (max-width: 1024px) {
    .detection-grid {
        grid-template-columns: 1fr;
        max-width: 720px;
        margin: 0 auto;
    }

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

@media (max-width: 768px) {
    .nav-menu {
        display: none; /* simple compact mobile header */
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .result-body {
        flex-direction: column;
        text-align: center;
    }

    .confidence-tag {
        align-items: center;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .steps-timeline::before {
        left: 17px;
    }

    .step-number {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .camera-controls {
        flex-direction: column;
    }

    .btn-start, .btn-stop {
        width: 100%;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-footer-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
