:root {
    --bg: #f4f4f0;
    --charcoal: #1a1a1a;
    --accent: #666666;
}

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

body {
    background-color: var(--bg);
    color: var(--charcoal);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* 3D Canvas Background */
#webgl-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ===== POST-PROCESSING OVERLAYS ===== */

.canvas-overlay {
    position: fixed;
    bottom: 3rem;
    left: 3rem;
    max-width: 38%;
    z-index: 10;
    padding: 2rem;
    opacity: 0;
    color: var(--charcoal);
    background: rgba(244, 244, 240, 0.55);
    backdrop-filter: blur(10px);
    border-left: 2px solid rgba(26, 26, 26, 0.15);
}

#grain-overlay {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: grainDrift 0.5s steps(4) infinite;
}

@keyframes grainDrift {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-2%, -3%); }
    50%  { transform: translate(3%, 1%); }
    75%  { transform: translate(-1%, 3%); }
    100% { transform: translate(2%, -2%); }
}

#vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.15) 100%);
}

/* ===== PROGRESS BAR ===== */

#progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 100;
    background: transparent;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#progress-bar-container.visible {
    opacity: 1;
}

#progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--charcoal);
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#progress-counter {
    position: fixed;
    bottom: 2.5rem;
    right: 3rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--accent);
    opacity: 0;
    z-index: 100;
    transition: opacity 0.8s ease;
}

#progress-counter.visible {
    opacity: 1;
}

/* ===== SOUND TOGGLE ===== */

.sound-toggle {
    position: fixed;
    bottom: 2.5rem;
    left: 3rem;
    z-index: 100;
    background: transparent;
    border: 1px solid rgba(26, 26, 26, 0.2);
    color: var(--accent);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.4s ease;
    opacity: 0;
    pointer-events: none;
}

.sound-toggle.visible {
    opacity: 1;
    pointer-events: auto;
}

.sound-toggle:hover {
    background: var(--charcoal);
    color: var(--bg);
    border-color: var(--charcoal);
}

.sound-toggle.muted {
    opacity: 0.3;
}

/* ===== UI PHASES ===== */

.phase {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    /* Transitions handled by GSAP now */
}

.phase.active {
    opacity: 1;
    pointer-events: auto;
}

/* Landing Phase */
.landing-content {
    text-align: center;
    background: rgba(244, 244, 240, 0.75);
    backdrop-filter: blur(12px);
    padding: 4rem 6rem;
    border: 1px solid rgba(26, 26, 26, 0.08);
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}

.landing-content h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 5rem;
    font-weight: 300;
    letter-spacing: 4px;
    margin-bottom: 1rem;
    color: var(--charcoal);
}

.landing-content .subtitle {
    font-size: 0.85rem;
    letter-spacing: 3px;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 3rem;
}

/* Buttons */
.elegant-btn {
    background: transparent;
    border: 1px solid rgba(26, 26, 26, 0.3);
    color: var(--charcoal);
    padding: 1rem 3rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s ease;
    backdrop-filter: blur(4px);
}

.elegant-btn:hover {
    background: var(--charcoal);
    color: var(--bg);
    border-color: var(--charcoal);
}

/* Interview Phase */
.question-container {
    text-align: center;
    max-width: 520px;
    padding: 2rem 2.5rem;
    background: rgba(244, 244, 240, 0.65);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(26, 26, 26, 0.05);
    border-left: 2px solid rgba(26, 26, 26, 0.1);
    transition: border-left-color 2s ease;
}

.question-number {
    font-family: 'Inter', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 5px;
    color: var(--accent);
    opacity: 0.5;
    margin-bottom: 0.8rem;
}

.question-line {
    width: 30px;
    height: 1px;
    background: var(--charcoal);
    margin: 0 auto 2rem;
    opacity: 0.2;
}

#questionText {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 300;
    line-height: 1.5;
    margin-bottom: 2rem;
    color: var(--charcoal);
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.options-grid .elegant-btn {
    width: 100%;
    max-width: 340px;
    font-size: 0.7rem;
    padding: 0.7rem 1.5rem;
}

/* Analysis Phase */
.terminal {
    font-family: 'Courier New', Courier, monospace;
    color: var(--accent);
    font-size: 0.9rem;
    max-width: 600px;
    line-height: 1.8;
    background: rgba(244, 244, 240, 0.8);
    padding: 2rem;
    backdrop-filter: blur(10px);
}

/* Canvas Phase Reveal */

.canvas-overlay h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.2rem;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    color: inherit;
}

.canvas-overlay #artDescription {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: inherit;
    opacity: 0.7;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.canvas-overlay #artInsight {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: inherit;
    max-width: 450px;
    font-style: italic;
    margin-bottom: 1rem;
}

#soulSignature {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.3rem;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 1px;
    color: inherit;
    opacity: 0;
    margin-bottom: 2rem;
    max-width: 400px;
    border-top: 1px solid currentColor;
    padding-top: 1rem;
}

.share-btn {
    font-size: 0.7rem;
    padding: 0.8rem 2rem;
    border-color: currentColor;
    color: inherit;
    margin-right: 0.8rem;
}
.share-btn:hover {
    background: currentColor;
    color: var(--bg);
}

.restart-btn {
    font-size: 0.65rem;
    padding: 0.7rem 1.5rem;
    border-color: transparent;
    color: inherit;
    opacity: 0.4;
    transition: opacity 0.5s ease;
}
.restart-btn:hover {
    opacity: 0.8;
    border-color: currentColor;
}

.word-anim {
    display: inline-block;
    opacity: 0;
    filter: blur(8px);
    transform: translateY(10px);
    animation: artisticWordFade 2s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
    white-space: pre;
}

@keyframes artisticWordFade {
    to {
        opacity: 0.9;
        filter: blur(0px);
        transform: translateY(0);
    }
}

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

/* ===== MOBILE RESPONSIVE ===== */

@media (max-width: 768px) {
    .landing-content {
        padding: 2.5rem 2rem;
        margin: 1rem;
    }

    .landing-content h1 {
        font-size: 3rem;
        letter-spacing: 2px;
    }

    .landing-content .subtitle {
        font-size: 0.65rem;
        letter-spacing: 2px;
        margin-bottom: 2rem;
    }

    .elegant-btn {
        padding: 0.8rem 2rem;
        font-size: 0.75rem;
    }

    .question-container {
        max-width: 95%;
        padding: 1.5rem;
    }

    #questionText {
        font-size: 1.6rem;
        margin-bottom: 2rem;
    }

    .options-grid .elegant-btn {
        max-width: 100%;
    }

    .terminal {
        max-width: 90%;
        font-size: 0.75rem;
        padding: 1.5rem;
    }

    .canvas-overlay {
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        max-width: calc(100% - 2rem);
        padding: 1.2rem;
    }

    .canvas-overlay h2 {
        font-size: 1.3rem;
    }

    .canvas-overlay #artDescription {
        font-size: 0.65rem;
        margin-bottom: 0.8rem;
    }

    .canvas-overlay #artInsight {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-bottom: 0.8rem;
        max-width: 100%;
    }

    .share-btn, .restart-btn {
        display: block;
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
        padding: 0.7rem 1.5rem;
        text-align: center;
    }

    #progress-counter {
        right: 1.5rem;
        bottom: 1.5rem;
    }

    .sound-toggle {
        left: 1.5rem;
        bottom: 1.5rem;
    }
}
