/* ============================================================
   StyleGenie — Face Shape & Analysis Pages v8.0
   Cohesive Y2K Blob Poster Vibe · Double-Bezel Architecture
   ============================================================ */

/* ── 1. BASE LAYOUT & BODY ── */
body {
    font-family: var(--f-body, 'Space Grotesk', sans-serif);
    background: var(--sg-canvas, #C5DEB0);
    color: var(--sg-ink, #0D0D0D);
    min-height: 100dvh;
    overflow-x: hidden;
    margin: 0; padding: 0;
}


/* Custom cursor follow override (home layout) */
#sg-cursor, #sg-cursor-ring {
    display: none;
}
@media (pointer: fine) and (min-width: 769px) {
    body { cursor: none; }
    #sg-cursor {
        display: block; position: fixed; top: 0; left: 0;
        width: 10px; height: 10px; background: var(--c-ink, #0D0D0D);
        border-radius: 50%; pointer-events: none; z-index: 99999;
        transform: translate(-50%, -50%); mix-blend-mode: multiply;
        transition: width .3s var(--ease-out), height .3s var(--ease-out), background .3s var(--ease-out);
    }
    #sg-cursor-ring {
        display: block; position: fixed; top: 0; left: 0;
        width: 36px; height: 36px; border: 1.5px solid var(--c-ink, #0D0D0D);
        border-radius: 50%; pointer-events: none; z-index: 99998;
        transform: translate(-50%, -50%); opacity: 0.4;
        transition: width .5s var(--ease-out), height .5s var(--ease-out), border-color .3s;
    }
    #sg-cursor.hovering { width: 6px; height: 6px; background: var(--c-pink, #FF4FA3); }
    #sg-cursor-ring.hovering { width: 52px; height: 52px; border-color: var(--c-pink, #FF4FA3); opacity: 0.25; }
}

/* Film grain fixed overlay */
.sg-grain {
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.038'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    pointer-events: none; z-index: 9998;
}

/* Animated mesh orbs background */
.sg-mesh-bg {
    position: fixed; inset: 0; z-index: 0;
    background: var(--c-bg, #AACF90);
    overflow: hidden; pointer-events: none;
}
.sg-mesh-bg .mesh-orb {
    position: absolute; border-radius: 50%; filter: blur(90px);
}
.mesh-orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255, 79, 163, 0.24) 0%, transparent 65%);
    top: -150px; left: -100px;
    animation: orb-drift-1 25s ease-in-out infinite alternate;
}
.mesh-orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(140, 220, 80, 0.20) 0%, transparent 65%);
    bottom: -100px; right: -50px;
    animation: orb-drift-2 30s ease-in-out infinite alternate;
}
@keyframes orb-drift-1 { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(40px, -30px) scale(1.08); } }
@keyframes orb-drift-2 { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(-30px, 30px) scale(1.05); } }

@keyframes face-fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* ── 2. GLOBAL STYLING COMPONENTS ── */
.content-wrapper {
    position: relative;
    z-index: 2;
    padding-top: 86px;
    min-height: 100dvh;
    padding-bottom: 4rem;
}

/* Nav */
.top-nav {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 1000; display: flex;
    justify-content: space-between; align-items: center;
    padding: 0 2rem; height: 68px;
    background: rgba(255, 255, 255, 0.80);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1.5px solid rgba(0, 0, 0, 0.08);
}

.back_home_button {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--c-ink-2, #444); text-decoration: none;
    font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    font-family: var(--f-mono, monospace);
    padding: 8px 18px; border-radius: var(--r-pill, 9999px);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    background: var(--c-white, #fff);
    transition: all 0.22s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
.back_home_button:hover {
    color: var(--c-ink, #0D0D0D);
    background: #F8FAF5;
    border-color: rgba(0, 0, 0, 0.20);
    transform: translateX(-3px);
}

.nav-actions .nav-title {
    font-family: var(--f-display, sans-serif);
    font-weight: 800; font-size: 1.05rem;
    letter-spacing: -0.02em; color: var(--c-ink, #0D0D0D);
}

/* ── 3. HEADER & INTRO ── */
.header {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    display: flex; flex-direction: column;
    align-items: center; gap: 0.6rem;
    animation: face-fade-up 0.75s var(--ease-cinema, cubic-bezier(0.32, 0.72, 0, 1)) forwards;
}

.logo-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255, 255, 255, 0.70);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: var(--r-pill, 9999px);
    padding: 5px 14px;
    font-family: var(--f-mono, monospace);
    font-size: 0.62rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.18em;
    color: var(--c-ink-3, #888);
}
.badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--c-pink, #FF4FA3);
}

.main-title {
    font-family: var(--f-display, sans-serif);
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800; line-height: 1.05;
    letter-spacing: -0.04em; color: var(--c-ink, #0D0D0D);
    margin: 0;
}
.serif-editorial {
    font-style: italic; color: var(--c-pink, #FF4FA3);
}

.subtitle {
    font-size: 0.95rem; color: var(--c-ink-3, #888);
    line-height: 1.7; max-width: 52ch; margin: 0;
}

/* ── 4. TWO-COLUMN SHELL & DOUBLE-BEZEL CARDS ── */
.analysis-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative; z-index: 2;
}

/* Bezel wrap helper */
.sg-bezel-outer-card {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.40);
    border-radius: calc(var(--r-2xl, 28px) + 4px);
    padding: 5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), var(--sg-shadow-sm);
    transition: transform 0.4s var(--ease-spring), box-shadow 0.4s;
    height: fit-content;
}

.analysis-intro {
    background: var(--c-white, #fff);
    border-radius: var(--r-2xl, 28px);
    border: 1px solid rgba(255, 255, 255, 0.80);
    box-shadow: var(--shadow-inset);
    padding: 1.6rem;
    animation: face-fade-up 0.75s var(--ease-cinema) 0.1s forwards;
    opacity: 1;
}


.intro-kicker {
    font-family: var(--f-mono, monospace);
    font-size: 0.65rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--c-pink, #FF4FA3);
    margin-bottom: 1.2rem; display: flex; align-items: center; gap: 8px;
}
.intro-kicker::before {
    content: ''; display: block; width: 14px; height: 1.5px;
    background: var(--c-pink, #FF4FA3);
}

.intro-list {
    list-style: none; display: flex; flex-direction: column; gap: 1rem;
}
.intro-list li {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.82rem; color: var(--c-ink-2, #444); line-height: 1.65;
}
.intro-list li i {
    color: var(--c-pink, #FF4FA3); font-size: 0.82rem;
    flex-shrink: 0; margin-top: 3px; width: 14px;
}

/* ── 5. RIGHT PANEL ── */
.analysis-panel {
    animation: face-fade-up 0.75s var(--ease-cinema) 0.18s forwards;
    opacity: 1; display: flex; flex-direction: column; gap: 1.25rem;
}


.panel-heading {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; padding-bottom: 1.2rem;
    border-bottom: 1.5px solid rgba(0,0,0,0.06); flex-wrap: wrap;
}
.panel-heading h2 {
    font-family: var(--f-display, sans-serif);
    font-size: 1.2rem; font-weight: 800;
    letter-spacing: -0.02em; color: var(--c-ink, #0D0D0D); margin: 0;
}
.panel-heading p {
    font-size: 0.82rem; color: var(--c-ink-3, #888); margin: 3px 0 0 0;
}

/* Gender toggle switch */
.gender-toggle {
    display: inline-flex; background: var(--c-white, #fff);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--r-pill, 9999px); padding: 3px;
}
.gender-toggle label {
    padding: 6px 18px; border-radius: var(--r-pill, 9999px);
    font-size: 0.8rem; font-weight: 700; cursor: pointer;
    transition: all 0.22s var(--ease-out); color: var(--c-ink-3, #888);
}
.gender-toggle input[type="radio"] { display: none; }
.gender-toggle input[type="radio"]:checked + label {
    background: var(--c-ink, #0D0D0D); color: #fff;
}

/* ── 6. ACTIONS & CHOOSE SOURCE ── */
.source-actions {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

.source-action {
    display: flex; align-items: center; gap: 14px;
    padding: 1.2rem; background: var(--c-white, #fff);
    border: 1px solid rgba(255,255,255,0.80);
    border-radius: var(--r-xl, 22px);
    color: var(--c-ink, #0D0D0D);
    font-family: var(--f-body, sans-serif);
    cursor: pointer; text-align: left;
    transition: all 0.3s var(--ease-spring);
    box-shadow: var(--shadow-inset), var(--sg-shadow-sm);
    position: relative; overflow: hidden;
}
.source-action:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-inset), var(--sg-shadow-md);
    border-color: rgba(255, 79, 163, 0.25);
}
.source-action:active { transform: scale(0.98); }

.source-icon {
    width: 44px; height: 44px; border-radius: var(--r-md, 10px);
    background: rgba(130, 200, 80, 0.12);
    border: 1px solid rgba(130, 200, 80, 0.20);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: #4a8f28; flex-shrink: 0;
    transition: transform 0.3s var(--ease-spring), color .2s, background .2s;
}
.source-action:hover .source-icon {
    transform: scale(1.08) rotate(5deg);
    background: rgba(255, 79, 163, 0.10);
    border-color: rgba(255, 79, 163, 0.20);
    color: var(--c-pink, #FF4FA3);
}

.source-copy {
    display: flex; flex-direction: column; flex: 1; min-width: 0;
}
.source-copy strong {
    font-size: 0.9rem; font-weight: 700; color: var(--c-ink, #0D0D0D);
    letter-spacing: -0.015em;
}
.source-copy span {
    font-size: 0.76rem; color: var(--c-ink-3, #888); margin-top: 3px; line-height: 1.4;
}

.source-arrow {
    color: var(--c-pink, #FF4FA3); font-size: 0.72rem;
    opacity: 0; transform: translateX(-6px);
    transition: opacity 0.22s, transform 0.22s var(--ease-out);
}
.source-action:hover .source-arrow {
    opacity: 1; transform: translateX(0);
}

/* ── 7. SAVED PHOTO ── */
.saved-photo-card {
    background: var(--c-white, #fff);
    border: 1.5px solid rgba(0,0,0,0.06);
    border-radius: var(--r-2xl, 28px);
    padding: 1.5rem; margin-bottom: 12px;
    box-shadow: var(--shadow-inset), var(--sg-shadow-sm);
    position: relative; overflow: hidden;
}
.saved-photo-card::before {
    content:''; position:absolute; width:150px; height:150px;
    background:radial-gradient(circle, rgba(255,79,163,0.12) 0%, transparent 65%);
    top:-40px; right:-30px; border-radius:50%; pointer-events:none;
}

.saved-photo-header {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.85rem; font-weight: 700; color: var(--c-ink, #0D0D0D);
    margin-bottom: 1rem;
}
.saved-photo-header i { color: var(--c-pink, #FF4FA3); }

.saved-photo-body {
    display: flex; gap: 1.25rem; align-items: center; margin-bottom: 1.2rem;
}
.saved-photo-preview {
    width: 84px; height: 84px; border-radius: var(--r-md, 10px);
    object-fit: cover; border: 1.5px solid rgba(0,0,0,0.08); flex-shrink: 0;
}
.saved-photo-body p {
    font-size: 0.8rem; color: var(--c-ink-3, #888); line-height: 1.6; margin: 0;
}

.saved-photo-actions { display: flex; width: 100%; }

/* ── 8. CAMERA PREVIEW ── */
#camera-section {
    margin-top: 1rem;
    background: var(--c-white, #fff);
    border: 1.5px solid rgba(0,0,0,0.06);
    border-radius: var(--r-2xl, 28px);
    padding: 1.2rem;
    box-shadow: var(--sg-shadow-sm);
}

.camera-hint {
    font-size: 0.8rem; color: var(--c-ink-3, #888); text-align: center;
    margin-bottom: 10px; font-weight: 500;
}

#video-stream {
    width: 100%; border-radius: var(--r-xl, 22px);
    border: 1.5px solid rgba(0,0,0,0.08); display: block;
    background: #000;
}

#canvas-snap {
    display: none !important;
}


.camera-controls {
    display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap;
}

.camera-controls button {
    flex: 1; display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 12px 20px; border-radius: var(--r-pill, 9999px);
    font-size: 0.82rem; font-weight: 700; font-family: var(--f-body, sans-serif);
    cursor: pointer; border: none; transition: all 0.22s var(--ease-out);
    min-width: 130px;
}
.camera-controls button.snap-btn {
    background: var(--c-ink, #0D0D0D); color: #fff;
}
.camera-controls button.snap-btn:hover {
    background: var(--c-pink, #FF4FA3);
    transform: translateY(-2px);
    box-shadow: var(--shadow-pink);
}
.camera-controls button.stop-btn {
    background: rgba(0,0,0,0.05); color: var(--c-ink-2, #444);
    border: 1.5px solid rgba(0,0,0,0.1);
}
.camera-controls button.stop-btn:hover {
    background: rgba(224, 80, 112, 0.08); border-color: rgba(224, 80, 112, 0.20);
    color: #E05070;
}

/* ── 9. RESULT INTERFACE ── */
.modern-result-card {
    background: var(--c-white, #fff);
    border: 1px solid rgba(255,255,255,0.70);
    border-radius: var(--r-2xl, 28px);
    padding: 1.8rem;
    animation: face-scale-in 0.5s var(--ease-out) forwards;
    box-shadow: var(--shadow-inset), var(--sg-shadow-md);
    position: relative; overflow: hidden;
}
.modern-result-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: linear-gradient(90deg, var(--c-pink), var(--c-yellow));
}

.result-card-header {
    display: flex; align-items: center; gap: 1.15rem; margin-bottom: 1.4rem;
}

.result-icon-wrapper {
    width: 44px; height: 44px; border-radius: var(--r-md, 10px);
    background: rgba(255, 79, 163, 0.08);
    border: 1px solid rgba(255, 79, 163, 0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--c-pink, #FF4FA3); flex-shrink: 0;
}

.result-card-title h3 {
    font-family: var(--f-display, sans-serif);
    font-size: 1.05rem; font-weight: 800;
    letter-spacing: -0.02em; color: var(--c-ink, #0D0D0D); margin: 0 0 3px 0;
}
.result-card-title p {
    font-size: 0.8rem; color: var(--c-ink-3, #888); margin: 0;
}

.result-card-body {
    padding: 1.4rem; background: rgba(0,0,0,0.03);
    border-radius: var(--r-xl, 22px);
    border: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 1.4rem;
}

.result-badge-label {
    font-family: var(--f-mono, monospace);
    font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.14em; color: var(--c-pink, #FF4FA3);
    margin-bottom: 8px; font-weight: 600;
}

.result-value {
    font-family: var(--f-display, sans-serif);
    font-size: 2.1rem; font-weight: 800;
    letter-spacing: -0.03em; color: var(--c-ink, #0D0D0D);
    margin-bottom: 8px; line-height: 1.05;
}

.result-description {
    font-size: 0.84rem; color: var(--c-ink-2, #444);
    line-height: 1.7; margin: 0;
}

.modern-result-btn {
    display: inline-flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 12px 12px 12px 24px;
    background: var(--c-ink, #0D0D0D); color: #fff;
    border: none; border-radius: var(--r-pill, 9999px);
    font-size: 0.85rem; font-weight: 700; font-family: var(--f-body, sans-serif);
    cursor: pointer; transition: all 0.22s var(--ease-out);
}
.modern-result-btn:hover {
    background: var(--c-pink, #FF4FA3);
    transform: translateY(-1px);
    box-shadow: var(--shadow-pink);
}
.modern-result-btn i {
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; flex-shrink: 0;
    transition: transform 0.28s var(--ease-spring);
}
.modern-result-btn:hover i {
    transform: translateX(3px) scale(1.08);
}

/* ── 10. ANIMATIONS & EFFECTS ── */
@keyframes face-fade-up {
    from { opacity: 0; transform: translateY(22px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes face-scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* ── RESPONSIVE OVERRIDES ── */
@media (max-width: 860px) {
    .analysis-shell {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .analysis-intro {
        order: 2;
    }
    .analysis-panel {
        order: 1;
    }
    .sg-bezel-outer-card {
        width: 100%;
    }
}

@media (max-width: 580px) {
    .source-actions {
        grid-template-columns: 1fr;
    }
    .header {
        padding: 2.2rem 1.2rem 1.2rem;
    }
    .panel-heading {
        flex-direction: column; align-items: flex-start; gap: 0.8rem;
    }
}
