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

html, body {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    cursor: none;
    background: #FFF0F5;
    font-family: 'IBM Plex Mono', monospace;
    color: #0D1F22;
}

/* === PROGRESS BAR === */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 9999;
    background: rgba(13, 31, 34, 0.1);
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #FF6F91, #C7F464, #00E5FF, #FF2D95, #FFD700);
    background-size: 500% 100%;
    transition: width 0.1s ease-out;
}

.zone-dot {
    position: absolute;
    top: -3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #FFD700;
    transform: translateX(-50%);
    opacity: 0.7;
}

/* === CURSOR === */
#cursor-blob {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle, #FFD700, #FF2D95);
    pointer-events: none;
    z-index: 10000;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
}

#cursor-blob.cyan {
    background: radial-gradient(circle, #00E5FF, #C7F464);
}

.trail-dot {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle, #FFD700, #FF2D95);
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    mix-blend-mode: screen;
}

.trail-dot.cyan {
    background: radial-gradient(circle, #00E5FF, #C7F464);
}

/* === SPORES === */
.spore {
    position: fixed;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.4);
    pointer-events: none;
    z-index: 9990;
    animation: drift var(--drift-duration) ease-in-out infinite;
    animation-delay: var(--drift-delay);
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(var(--dx1), var(--dy1)); }
    50% { transform: translate(var(--dx2), var(--dy2)); }
    75% { transform: translate(var(--dx3), var(--dy3)); }
}

/* === MAIN CANVAS === */
#canvas {
    display: flex;
    flex-direction: row;
    width: 500vw;
    height: 100vh;
    will-change: transform;
}

.zone {
    position: relative;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zone-label {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.4;
    color: #0D1F22;
}

/* === BACKGROUND KOREAN CHARACTER === */
.namu-bg-char {
    position: absolute;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(8rem, 20vw, 18rem);
    opacity: 0.08;
    color: #0D1F22;
    user-select: none;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.vista-char {
    opacity: 0.12;
    font-size: clamp(10rem, 25vw, 22rem);
}

/* === ZONE 1: SEEDBED === */
#zone-seedbed {
    background: #FFF0F5;
    flex-direction: column;
}

.domain-title {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.08em;
    text-transform: lowercase;
    color: #0D1F22;
    z-index: 2;
    margin-bottom: 2rem;
}

#seed-container {
    position: relative;
    width: clamp(150px, 20vw, 300px);
    height: clamp(200px, 25vw, 400px);
    z-index: 2;
    margin-bottom: 2rem;
}

.seed-half {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #FF6F91, #C7F464);
    border-radius: 42% 58% 63% 37% / 45% 55% 50% 50%;
    animation: blob-breathe 8s ease-in-out infinite;
    transition: transform 0.6s ease-out, clip-path 0.6s ease-out;
}

#seed-left {
    clip-path: polygon(0% 0%, 50% 0%, 50% 100%, 0% 100%);
}

#seed-right {
    clip-path: polygon(50% 0%, 100% 0%, 100% 100%, 50% 100%);
}

#seed-left.cracked {
    transform: translateX(-20px);
    clip-path: polygon(0% 0%, 48% 0%, 45% 100%, 0% 100%);
}

#seed-right.cracked {
    transform: translateX(20px);
    clip-path: polygon(52% 0%, 100% 0%, 100% 100%, 55% 100%);
}

#seed-glow {
    position: absolute;
    top: 10%;
    left: 20%;
    width: 60%;
    height: 80%;
    border-radius: 50%;
    background: radial-gradient(circle, #C7F464, transparent);
    opacity: 0;
    transition: opacity 0.6s ease-out;
    z-index: -1;
}

#seed-glow.visible {
    opacity: 0.8;
}

/* === ZONE 2: ROOT NETWORK === */
#zone-roots {
    background: #5B2C6F;
}

#zone-roots .zone-label {
    color: #FFDAB9;
}

.root-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.root-nodes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 2;
}

.root-node {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: radial-gradient(circle, #FF2D95, #5B2C6F);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.65rem, 0.9vw, 0.85rem);
    color: #FFF0F5;
    text-align: center;
    will-change: transform;
    transition: background 0.2s ease-out;
    cursor: none;
}

/* === ZONE 3: TRUNK RISE === */
#zone-trunk {
    background: linear-gradient(180deg, #FFF0F5 0%, #FFDAB9 100%);
    flex-direction: column;
}

.mountain {
    position: absolute;
    width: 100%;
    bottom: 0;
    z-index: 0;
    will-change: transform;
}

.mountain svg {
    width: 100%;
    height: auto;
    display: block;
}

.mountain-back { z-index: 0; }
.mountain-mid { z-index: 1; }

#trunk {
    position: relative;
    width: clamp(180px, 22vw, 350px);
    height: 60vh;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.growth-ring {
    border-radius: 48% 52% 45% 55% / 50% 46% 54% 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    animation: blob-breathe 10s ease-in-out infinite;
}

.ring-1 {
    width: 100%;
    height: 100%;
    background: #5B2C6F;
    animation-delay: -2s;
}

.ring-2 {
    width: 82%;
    height: 82%;
    background: #FF6F91;
    animation-delay: -4s;
}

.ring-3 {
    width: 78%;
    height: 78%;
    background: #FF6F91;
    background: linear-gradient(135deg, #FF6F91, #FFDAB9);
    animation-delay: -6s;
}

.ring-4 {
    width: 75%;
    height: 75%;
    background: #FFDAB9;
    animation-delay: -1s;
}

.ring-5 {
    width: 70%;
    height: 70%;
    background: #FFF0F5;
    animation-delay: -3s;
}

.vertical-text {
    position: absolute;
    right: 12%;
    top: 15%;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 900;
    font-size: clamp(1.2rem, 2.5vw, 2.2rem);
    color: #5B2C6F;
    opacity: 0.6;
    z-index: 3;
    letter-spacing: 0.15em;
}

/* === ZONE 4: CANOPY BLOOM === */
#zone-canopy {
    background: linear-gradient(135deg, #FFF0F5, #E0BBE4);
}

#canopy-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 2;
}

.canopy-blob {
    position: absolute;
    border-radius: 42% 58% 63% 37% / 45% 55% 50% 50%;
    mix-blend-mode: screen;
    will-change: transform, border-radius;
    animation: blob-breathe var(--breathe-dur) ease-in-out infinite;
    animation-delay: var(--breathe-delay);
}

#canopy-hidden-text {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.hidden-fragment {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.03em;
    color: #5B2C6F;
    opacity: 0.7;
    white-space: nowrap;
}

/* === ZONE 5: VISTA === */
#zone-vista {
    background: linear-gradient(90deg, #FFF0F5 0%, #87CEEB 50%, #E0BBE4 100%);
    flex-direction: column;
}

.vista-mountains {
    position: absolute;
    width: 100%;
    bottom: 0;
    z-index: 1;
}

.vista-mt {
    width: 100%;
    height: auto;
    display: block;
}

#vista-tree {
    position: absolute;
    bottom: 22%;
    left: 55%;
    z-index: 2;
}

.vista-blob {
    width: clamp(100px, 12vw, 200px);
    height: clamp(140px, 16vw, 280px);
    background: linear-gradient(135deg, #FF6F91, #C7F464);
    border-radius: 45% 55% 60% 40% / 48% 52% 48% 52%;
    animation: blob-breathe 9s ease-in-out infinite;
    opacity: 0.8;
}

.vista-title {
    z-index: 3;
    color: #0D1F22;
    margin-bottom: 0;
}

#zone-vista .zone-label {
    color: #5B2C6F;
}

/* === BLOB BREATHING === */
@keyframes blob-breathe {
    0% { border-radius: 42% 58% 63% 37% / 45% 55% 50% 50%; }
    25% { border-radius: 55% 45% 40% 60% / 52% 48% 58% 42%; }
    50% { border-radius: 38% 62% 55% 45% / 60% 40% 45% 55%; }
    75% { border-radius: 60% 40% 48% 52% / 42% 58% 55% 45%; }
    100% { border-radius: 42% 58% 63% 37% / 45% 55% 50% 50%; }
}

/* === RESPONSIVE: VERTICAL FALLBACK === */
@media (max-width: 768px) {
    #canvas {
        flex-direction: column;
        width: 100vw;
        height: 500vh;
    }

    html, body {
        overflow-y: auto;
        overflow-x: hidden;
        cursor: auto;
    }

    .zone {
        width: 100vw;
        height: 100vh;
    }

    #cursor-blob, .trail-dot {
        display: none;
    }

    .domain-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }

    .vertical-text {
        writing-mode: horizontal-tb;
        text-orientation: initial;
        right: auto;
        top: auto;
        bottom: 25%;
        left: 50%;
        transform: translateX(-50%);
        font-size: clamp(1rem, 3vw, 1.4rem);
    }
}
