:root {
    --abyssal-dark: #060D08;
    --forest-floor: #0B1A0F;
    --undergrowth: #132B1A;
    --moss-shadow: #1E3F26;
    --lichen-green: #A8C5A0;
    --phosphor-green: #D4EDCF;
    --bioluminescent: #5FBF6E;
    --spore-gold: #C9B44E;
    --fungal-violet: #7B6FA0;
    color-scheme: dark;
}

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

body {
    background-color: var(--abyssal-dark);
    color: var(--lichen-green);
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.85;
    overflow-x: hidden;
    letter-spacing: 0.02em;
}

/* Progress Line */
.progress-line {
    position: fixed;
    left: 8px;
    top: 0;
    width: 1px;
    height: 0%;
    background: var(--bioluminescent);
    opacity: 0.4;
    z-index: 50;
    transition: height 0.1s linear;
    box-shadow: 0 0 6px rgba(95, 191, 110, 0.3);
}

/* Chambers */
.chamber {
    position: relative;
    min-height: 120vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12rem 24px;
    background: var(--forest-floor);
    mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
}

.chamber-mycelium { min-height: 140vh; }
.chamber-canopy { min-height: 130vh; }
.chamber-clearing { min-height: 100vh; }

.chamber-column {
    width: clamp(32.5rem, 52vw, 48.75rem);
    max-width: 100%;
    position: relative;
    z-index: 2;
}

.chamber-column-narrow {
    max-width: 580px;
    width: 50%;
}

/* Void Passages */
.void-passage {
    height: 40vh;
    background: var(--abyssal-dark);
}

/* Opening Word */
.opening-word {
    font-family: 'Commissioner', sans-serif;
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 9rem);
    color: var(--bioluminescent);
    opacity: 0;
    text-shadow: 0 0 40px rgba(95, 191, 110, 0.3);
    margin-bottom: 64px;
    transform: scale(0.85);
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1), transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.opening-word.revealed {
    opacity: 0.6;
    transform: scale(1);
}

/* Chamber Titles */
.chamber-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5.5vw, 4rem);
    letter-spacing: 0.06em;
    line-height: 1.1;
    color: var(--phosphor-green);
    margin-bottom: 48px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1), transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.chamber-title.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Body Text */
.body-text {
    margin-bottom: 32px;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1), transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.body-text.revealed {
    opacity: 1;
    transform: scale(1);
}

.weight-500 {
    font-weight: 500;
    font-size: clamp(1.15rem, 2.2vw, 1.5rem);
    line-height: 1.6;
}

/* Whisper Text */
.whisper-text {
    font-weight: 100;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--lichen-green);
    opacity: 0;
    margin-top: 48px;
    transition: opacity 1.8s ease;
}

.whisper-text.revealed {
    opacity: 0.4;
}

/* Seedbed Bloom */
.seedbed-bloom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    z-index: 1;
}

.bloom-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: bloomPulse 4s ease-in-out infinite;
}

.bloom-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 0.5px solid var(--bioluminescent);
    transform: translate(-50%, -50%);
    animation: ringExpand 8s ease-in-out infinite;
}

.bloom-ring-1 {
    width: 80px;
    height: 80px;
    opacity: 0.3;
    animation-delay: 0s;
}

.bloom-ring-2 {
    width: 150px;
    height: 150px;
    opacity: 0.2;
    animation-delay: -2.5s;
}

.bloom-ring-3 {
    width: 240px;
    height: 240px;
    opacity: 0.1;
    animation-delay: -5s;
}

@keyframes bloomPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.4; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 0.7; }
}

@keyframes ringExpand {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.3; }
}

/* Mycelium Grid */
.mycelium-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin: 48px 0;
}

.mycelium-thread {
    width: 100%;
    max-width: 400px;
    height: 20px;
    filter: drop-shadow(0 0 4px rgba(95, 191, 110, 0.4));
}

.thread-line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 2s ease;
}

.chamber-mycelium.in-view .thread-line {
    stroke-dashoffset: 0;
}

/* Card Flip / Fruiting Bodies */
.fruiting-body {
    perspective: 800px;
    width: 160px;
    height: 160px;
    cursor: pointer;
}

.fruiting-large {
    width: 200px;
    height: 200px;
    margin: 48px auto;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-front {
    background: transparent;
}

.card-back {
    transform: rotateY(180deg);
    background: var(--undergrowth);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid rgba(95, 191, 110, 0.1);
}

.card-back p {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--lichen-green);
    text-align: center;
}

.card-text-gold {
    color: var(--spore-gold) !important;
}

/* Glowing Shapes */
.shape-glow {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.15) 0%, transparent 70%);
    box-shadow: 0 0 20px rgba(95, 191, 110, 0.2), 0 0 40px rgba(95, 191, 110, 0.1);
    animation: shapeGlow 4s ease-in-out infinite;
}

.shape-oval {
    border-radius: 50% / 40%;
}

.shape-compound {
    border-radius: 30% 70% 50% 50%;
}

.shape-canopy-bloom {
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.2) 0%, rgba(123, 111, 160, 0.1) 50%, transparent 70%);
}

.shape-canopy-cluster {
    background: radial-gradient(ellipse at 40% 40%, rgba(201, 180, 78, 0.15) 0%, rgba(95, 191, 110, 0.1) 50%, transparent 70%);
}

@keyframes shapeGlow {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Spore Field */
.spore-field {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.spore {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.3) 0%, transparent 70%);
    animation: sporeDrift linear infinite;
}

@keyframes sporeDrift {
    0% { transform: translateY(0); opacity: 0; }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { transform: translateY(-120vh); opacity: 0; }
}

/* Canopy Layers */
.canopy-layers {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.canopy-form {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: screen;
    animation: canopyPulse 8s ease-in-out infinite;
}

.canopy-form-1 {
    width: 400px;
    height: 300px;
    top: 20%;
    left: 10%;
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.08) 0%, transparent 70%);
}

.canopy-form-2 {
    width: 350px;
    height: 350px;
    top: 40%;
    right: 10%;
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.06) 0%, transparent 70%);
    animation-delay: -3s;
}

.canopy-form-3 {
    width: 300px;
    height: 250px;
    bottom: 20%;
    left: 30%;
    background: radial-gradient(ellipse at center, rgba(95, 191, 110, 0.07) 0%, transparent 70%);
    animation-delay: -5s;
}

.canopy-form-violet {
    width: 280px;
    height: 280px;
    top: 35%;
    left: 45%;
    background: radial-gradient(ellipse at center, rgba(123, 111, 160, 0.1) 0%, transparent 70%);
    animation-delay: -2s;
}

@keyframes canopyPulse {
    0%, 100% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* Clearing */
.clearing-form {
    width: 200px;
    height: 200px;
    margin-bottom: 64px;
    position: relative;
    z-index: 2;
}

.clearing-shape {
    width: 100%;
    height: 100%;
    animation: clearingRotate 30s linear infinite;
}

@keyframes clearingRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .chamber {
        padding: 6rem 24px;
    }

    .chamber-column {
        width: 100%;
    }

    .chamber-column-narrow {
        width: 100%;
    }

    .progress-line {
        left: auto;
        right: 8px;
    }

    .fruiting-body {
        width: 120px;
        height: 120px;
    }

    .fruiting-large {
        width: 150px;
        height: 150px;
    }

    .canopy-form {
        width: 200px !important;
        height: 200px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bloom-core, .bloom-ring {
        animation: none;
    }

    .bloom-ring { opacity: 0.15; }

    .shape-glow {
        animation: none;
    }

    .spore {
        animation: none;
        display: none;
    }

    .canopy-form {
        animation: none;
    }

    .clearing-shape {
        animation: none;
    }

    .opening-word, .chamber-title, .body-text, .whisper-text {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .opening-word { opacity: 0.6; }
    .whisper-text { opacity: 0.4; }
}
