/* lovebot.quest -- blobitecture AI romance adventure
   Translucent-frost palette, parallax sections, serif-revival type, blob morphology. */

:root {
    --frost-lavender: #f0e4f4;
    --frost-blue: #d4e8f0;
    --frost-pink: #f0d4e0;
    --frost-white: #faf4fc;
    --blob-fill-1: rgba(232, 212, 240, 0.6);  /* lavender */
    --blob-fill-2: rgba(212, 240, 232, 0.6);  /* mint */
    --blob-fill-3: rgba(240, 224, 212, 0.6);  /* peach #F0E0D4 */
    --frost-peach: #F0E0D4;
    --text-primary: #2a1a30;
    --text-secondary: #6a4a70;
    --eye-color: #2a1a30;
    --mouth-color: #d46a80;

    --serif-headline: "Playfair Display", "Lora", Georgia, serif;
    --serif-body: "Lora", Georgia, "Times New Roman", serif;
    --rounded-sans: "Quicksand", "Inter", system-ui, sans-serif;

    --content-pad: clamp(32px, 6vw, 80px);
}

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

html {
    scroll-behavior: smooth;
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: var(--serif-body);
    color: var(--text-primary);
    background: var(--frost-lavender);
    line-height: 1.75;
    min-height: 100vh;
    cursor: none;
}

/* ========== ANIMATED GRADIENT UNDERLAYER ========== */
.gradient-underlayer {
    position: fixed;
    inset: 0;
    z-index: -3;
    background:
        radial-gradient(circle at 20% 30%, var(--frost-pink) 0%, transparent 55%),
        radial-gradient(circle at 80% 20%, var(--frost-blue) 0%, transparent 55%),
        radial-gradient(circle at 60% 80%, var(--frost-lavender) 0%, transparent 60%),
        linear-gradient(135deg, var(--frost-lavender) 0%, var(--frost-blue) 50%, var(--frost-pink) 100%);
    background-size: 200% 200%, 220% 220%, 240% 240%, 100% 100%;
    animation: gradient-drift 28s ease-in-out infinite;
    transition: filter 1.6s ease;
}

@keyframes gradient-drift {
    0%, 100% { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%; }
    33% { background-position: 30% 40%, 70% 30%, 60% 70%, 0% 0%; }
    66% { background-position: 70% 60%, 30% 70%, 40% 50%, 0% 0%; }
}

/* Section-tinted gradient layer states */
body[data-active="opening"] .gradient-underlayer { filter: hue-rotate(0deg) saturate(1); }
body[data-active="awakening"] .gradient-underlayer { filter: hue-rotate(-10deg) saturate(1.1); }
body[data-active="learning"] .gradient-underlayer { filter: hue-rotate(15deg) saturate(1.05); }
body[data-active="connection"] .gradient-underlayer { filter: hue-rotate(-25deg) saturate(1.15); }

/* ========== PARALLAX LAYERS ========== */
.parallax-bg, .parallax-mid {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    will-change: transform;
}
.parallax-mid { z-index: -1; }

.bg-blob {
    position: absolute;
    background: var(--blob-fill-1);
    filter: blur(2px);
    opacity: 0.7;
    animation: blob-drift 16s ease-in-out infinite;
}
.bg-blob-1 { top: 8%; left: 5%; width: 320px; height: 280px;
    border-radius: 58% 42% 60% 40% / 50% 60% 40% 50%;
    background: var(--blob-fill-2); animation-duration: 18s; }
.bg-blob-2 { top: 35%; left: 78%; width: 380px; height: 340px;
    border-radius: 38% 62% 45% 55% / 60% 40% 60% 40%;
    background: var(--blob-fill-3); animation-duration: 22s; animation-delay: -4s; }
.bg-blob-3 { top: 62%; left: 12%; width: 260px; height: 300px;
    border-radius: 65% 35% 55% 45% / 40% 55% 45% 60%;
    background: var(--blob-fill-1); animation-duration: 20s; animation-delay: -8s; }
.bg-blob-4 { top: 80%; left: 60%; width: 420px; height: 360px;
    border-radius: 45% 55% 35% 65% / 55% 45% 65% 35%;
    background: var(--blob-fill-2); animation-duration: 24s; animation-delay: -12s; }
.bg-blob-5 { top: 18%; left: 45%; width: 200px; height: 220px;
    border-radius: 50% 50% 60% 40% / 60% 40% 50% 50%;
    background: var(--blob-fill-3); animation-duration: 17s; animation-delay: -2s; }
.bg-blob-6 { top: 50%; left: 30%; width: 240px; height: 200px;
    border-radius: 40% 60% 55% 45% / 50% 50% 60% 40%;
    background: var(--blob-fill-1); animation-duration: 19s; animation-delay: -10s; }

@keyframes blob-drift {
    0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
    33% { transform: translate(30px, -20px) rotate(8deg) scale(1.05); }
    66% { transform: translate(-20px, 25px) rotate(-6deg) scale(0.97); }
}

.mid-blob {
    position: absolute;
    background: var(--blob-fill-2);
    filter: blur(1px);
    opacity: 0.55;
    animation: blob-float 14s ease-in-out infinite;
}
.mid-blob-1 { top: 20%; left: 15%; width: 180px; height: 200px;
    border-radius: 55% 45% 65% 35% / 45% 60% 40% 55%; }
.mid-blob-2 { top: 60%; left: 70%; width: 220px; height: 180px;
    border-radius: 40% 60% 50% 50% / 60% 40% 55% 45%;
    background: var(--blob-fill-3); animation-delay: -5s; }
.mid-blob-3 { top: 35%; left: 50%; width: 150px; height: 170px;
    border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
    background: var(--blob-fill-1); animation-delay: -9s; }
.mid-blob-4 { top: 75%; left: 25%; width: 200px; height: 160px;
    border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%;
    background: var(--blob-fill-2); animation-delay: -3s; }

@keyframes blob-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.04); }
}

/* ========== MAIN STRUCTURE ========== */
.quest-main {
    position: relative;
    z-index: 1;
}

.section {
    min-height: 100vh;
    padding: clamp(80px, 12vh, 140px) var(--content-pad);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ========== CHAPTER LABELS ========== */
.chapter-label {
    display: inline-block;
    font-family: var(--rounded-sans);
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 6px 16px;
    background: rgba(250, 244, 252, 0.55);
    border-radius: 30px 24px 28px 32px / 28px 32px 30px 28px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
}

.chapter-title {
    font-family: var(--serif-headline);
    font-weight: 700;
    font-size: clamp(40px, 7vw, 88px);
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 28px;
    text-align: center;
    letter-spacing: -0.01em;
}

/* ========== SECTION 1: OPENING ========== */
.section-opening {
    background: linear-gradient(180deg, rgba(240, 228, 244, 0.4) 0%, rgba(240, 228, 244, 0) 100%);
}

.frost-layer {
    position: absolute;
    inset: 0;
    background: rgba(240, 228, 244, 0.35);
    pointer-events: none;
}

.title-blob {
    position: relative;
    z-index: 2;
    width: min(680px, 88vw);
    aspect-ratio: 1.15 / 1;
    background: linear-gradient(135deg, rgba(232, 212, 240, 0.85), rgba(212, 232, 240, 0.85));
    border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow:
        0 30px 80px rgba(106, 74, 112, 0.18),
        inset 0 0 60px rgba(250, 244, 252, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: clamp(32px, 6vw, 64px);
    opacity: 0;
    transform: scale(0.92);
    animation: title-appear 1.4s 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards,
               title-pulse 7s 1.6s ease-in-out infinite;
}

@keyframes title-appear {
    0% { opacity: 0; transform: scale(0.92); }
    60% { opacity: 1; transform: scale(1.04); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes title-pulse {
    0%, 100% { transform: scale(1); border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%; }
    50% { transform: scale(1.02); border-radius: 50% 50% 40% 60% / 60% 50% 50% 40%; }
}

.title-blob .chapter-label {
    background: rgba(255, 255, 255, 0.55);
    margin-bottom: 24px;
    opacity: 0;
    animation: fade-up 0.7s 0.9s ease-out forwards;
}

.title-main {
    font-family: var(--serif-headline);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(54px, 11vw, 132px);
    line-height: 0.95;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    opacity: 0;
    animation: fade-up 0.8s 1.05s ease-out forwards;
}

.title-sub {
    font-family: var(--serif-headline);
    font-weight: 400;
    font-size: clamp(34px, 6vw, 72px);
    color: var(--text-secondary);
    line-height: 1;
    letter-spacing: 0.02em;
    margin-top: 4px;
    opacity: 0;
    animation: fade-up 0.8s 1.25s ease-out forwards;
}

.title-tagline {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: clamp(15px, 1.6vw, 19px);
    color: var(--text-secondary);
    margin-top: 22px;
    max-width: 320px;
    opacity: 0;
    animation: fade-up 0.8s 1.5s ease-out forwards;
}

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

.floating-thought {
    position: absolute;
    background: rgba(250, 244, 252, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 12px 22px;
    font-family: var(--rounded-sans);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-secondary);
    z-index: 1;
}

.thought-a {
    top: 12%; left: 6%;
    border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
    animation: thought-drift-1 9s ease-in-out infinite;
}
.thought-b {
    top: 70%; right: 7%;
    border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%;
    animation: thought-drift-2 11s ease-in-out infinite;
}
.thought-c {
    bottom: 18%; left: 8%;
    border-radius: 50% 50% 60% 40% / 40% 60% 50% 50%;
    animation: thought-drift-3 10s ease-in-out infinite;
}

@keyframes thought-drift-1 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, -16px); }
}
@keyframes thought-drift-2 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-18px, 12px); }
}
@keyframes thought-drift-3 {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(14px, -22px); }
}

.scroll-cue {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    font-family: var(--rounded-sans);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0;
    animation: fade-up 0.8s 2s ease-out forwards;
}

.scroll-blob {
    width: 18px; height: 24px;
    border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
    background: var(--blob-fill-1);
    border: 1px solid rgba(106, 74, 112, 0.25);
    animation: scroll-bob 1.8s ease-in-out infinite;
}

@keyframes scroll-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ========== SECTION 2: AWAKENING ========== */
.section-awakening {
    background: linear-gradient(180deg, rgba(212, 232, 240, 0) 0%, rgba(212, 232, 240, 0.45) 50%, rgba(240, 212, 224, 0) 100%);
    overflow: hidden;
}

.landscape-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.hill {
    position: absolute;
    bottom: 0;
    background: var(--blob-fill-2);
    opacity: 0.7;
}
.hill-1 { left: -8%; width: 50%; height: 38vh;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background: var(--blob-fill-1); }
.hill-2 { left: 22%; width: 45%; height: 28vh;
    border-radius: 60% 60% 0 0 / 100% 100% 0 0;
    background: var(--blob-fill-2); opacity: 0.55; }
.hill-3 { right: 5%; width: 55%; height: 44vh;
    border-radius: 55% 45% 0 0 / 100% 100% 0 0;
    background: var(--blob-fill-3); opacity: 0.6; }
.hill-4 { right: -10%; width: 40%; height: 32vh;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background: var(--blob-fill-1); opacity: 0.5; }

.awakening-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1100px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 36px;
    justify-items: center;
    text-align: center;
}

.frost-panel {
    background: rgba(250, 244, 252, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.45);
    padding: 32px 40px;
    box-shadow: 0 12px 40px rgba(106, 74, 112, 0.08);
    max-width: 620px;
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.frost-panel.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-a { border-radius: 55% 45% 60% 40% / 50% 60% 40% 50%; }
.panel-b { border-radius: 40% 60% 50% 50% / 60% 40% 55% 45%; align-self: end; margin-right: 8%; }
.panel-c { border-radius: 50% 50% 45% 55% / 55% 45% 50% 50%; align-self: start; margin-left: 8%; }

.narrative {
    font-family: var(--serif-body);
    font-size: clamp(17px, 1.8vw, 22px);
    line-height: 1.7;
    color: var(--text-primary);
}

.narrative.italic {
    font-style: italic;
    color: var(--text-secondary);
}

/* ========== LOVEBOT CHARACTER ========== */
.character-stage {
    position: relative;
    width: 100%;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.lovebot-character {
    position: relative;
    width: 120px;
    height: 120px;
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
    will-change: transform;
}

.lovebot-character.is-visible {
    opacity: 1;
}

.lovebot-character.lovebot-small {
    width: 80px;
    height: 80px;
}

.lovebot-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(140deg, #f0d4e0 0%, #e8d4f0 50%, #d4e8f0 100%);
    border-radius: 55% 45% 60% 40% / 50% 60% 40% 50%;
    position: relative;
    box-shadow:
        0 14px 32px rgba(106, 74, 112, 0.18),
        inset 0 -8px 18px rgba(212, 106, 128, 0.08),
        inset 0 8px 18px rgba(255, 255, 255, 0.5);
    animation: bot-bob 3.4s ease-in-out infinite, bot-morph 9s ease-in-out infinite;
}

.lovebot-eye {
    position: absolute;
    top: 38%;
    width: 12%;
    height: 12%;
    background: var(--eye-color);
    border-radius: 50%;
    transition: transform 0.3s ease, width 0.4s ease, height 0.4s ease;
}
.lovebot-eye-left { left: 28%; }
.lovebot-eye-right { right: 28%; }

.lovebot-character.is-wide .lovebot-eye {
    width: 16%;
    height: 16%;
}

.lovebot-mouth {
    position: absolute;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%);
    width: 44%;
    height: 22%;
    overflow: visible;
}
.lovebot-mouth path {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: mouth-draw 1.2s 0.4s ease-out forwards;
}

@keyframes mouth-draw {
    to { stroke-dashoffset: 0; }
}

.lovebot-shadow {
    position: absolute;
    bottom: -22px;
    left: 50%;
    width: 75%;
    height: 14px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(106, 74, 112, 0.18) 0%, transparent 70%);
    border-radius: 50%;
    animation: shadow-pulse 3.4s ease-in-out infinite;
}

@keyframes bot-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes bot-morph {
    0%, 100% { border-radius: 55% 45% 60% 40% / 50% 60% 40% 50%; }
    33% { border-radius: 45% 55% 50% 50% / 60% 40% 55% 45%; }
    66% { border-radius: 60% 40% 45% 55% / 45% 55% 60% 40%; }
}

@keyframes shadow-pulse {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.7; }
    50% { transform: translateX(-50%) scale(0.85); opacity: 0.5; }
}

/* ========== SECTION 3: LEARNING ========== */
.section-learning {
    background: linear-gradient(180deg, rgba(240, 212, 224, 0) 0%, rgba(240, 212, 224, 0.4) 50%, rgba(232, 212, 240, 0) 100%);
}

.learning-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    text-align: center;
}

.learning-intro {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: clamp(17px, 1.9vw, 22px);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 56px;
    line-height: 1.7;
}

.bubbles-stage {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 32px;
    margin: 60px 0;
    perspective: 1000px;
}

.thought-bubble {
    position: relative;
    background: rgba(250, 244, 252, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 36px 32px;
    box-shadow: 0 16px 50px rgba(106, 74, 112, 0.1);
    opacity: 0;
    transform: translateY(60px) scale(0.92);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.thought-bubble.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.bubble-1 { border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%; transition-delay: 0.05s;
    background: linear-gradient(135deg, rgba(232, 212, 240, 0.65), rgba(250, 244, 252, 0.55)); }
.bubble-2 { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; transition-delay: 0.18s;
    background: linear-gradient(135deg, rgba(212, 240, 232, 0.65), rgba(250, 244, 252, 0.55)); }
.bubble-3 { border-radius: 50% 50% 60% 40% / 60% 40% 55% 45%; transition-delay: 0.32s;
    background: linear-gradient(135deg, rgba(240, 224, 212, 0.6), rgba(250, 244, 252, 0.55)); }
.bubble-4 { border-radius: 40% 60% 45% 55% / 45% 55% 50% 50%; transition-delay: 0.46s;
    background: linear-gradient(135deg, rgba(240, 212, 224, 0.65), rgba(250, 244, 252, 0.55)); }
.bubble-5 { border-radius: 55% 45% 50% 50% / 50% 50% 60% 40%; transition-delay: 0.6s;
    background: linear-gradient(135deg, rgba(232, 212, 240, 0.6), rgba(212, 240, 232, 0.55)); }
.bubble-6 { border-radius: 50% 50% 45% 55% / 60% 40% 50% 50%; transition-delay: 0.74s;
    background: linear-gradient(135deg, rgba(212, 232, 240, 0.65), rgba(250, 244, 252, 0.55)); }

.thought-bubble h4 {
    font-family: var(--serif-headline);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(26px, 3vw, 36px);
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -0.005em;
}

.thought-bubble p {
    font-family: var(--serif-body);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    font-style: italic;
}

.thought-bubble::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 16px;
    width: 14px;
    height: 14px;
    border-radius: 50% 50% 60% 40% / 60% 40% 50% 50%;
    background: inherit;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    opacity: 0.7;
}

.learning-character {
    margin-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.character-caption {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: 17px;
    color: var(--text-secondary);
    margin-top: 24px;
    max-width: 380px;
    text-align: center;
}

/* ========== SECTION 4: CONNECTION ========== */
.section-connection {
    background: linear-gradient(180deg, rgba(232, 212, 240, 0) 0%, rgba(240, 212, 224, 0.55) 50%, rgba(240, 212, 224, 0.7) 100%);
    overflow: hidden;
}

.connection-content {
    position: relative;
    width: 100%;
    max-width: 1100px;
    text-align: center;
}

.connection-intro {
    font-family: var(--serif-body);
    font-style: italic;
    font-size: clamp(17px, 1.9vw, 22px);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 40px;
}

.merge-stage {
    position: relative;
    width: 100%;
    height: clamp(280px, 40vh, 420px);
    margin: 30px auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.merge-blob {
    position: absolute;
    width: clamp(140px, 18vw, 200px);
    height: clamp(140px, 18vw, 200px);
    border-radius: 55% 45% 60% 40% / 50% 60% 40% 50%;
    box-shadow: 0 24px 60px rgba(106, 74, 112, 0.2);
    transition: transform 1.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 1.2s ease,
                opacity 0.6s ease,
                width 0.8s ease,
                height 0.8s ease;
    will-change: transform, border-radius;
}

.merge-blob-left {
    left: 8%;
    background: linear-gradient(135deg, #f0d4e0 0%, #e8d4f0 100%);
    transform: translate(-20px, 0);
}

.merge-blob-right {
    right: 8%;
    background: linear-gradient(135deg, #d4e8f0 0%, #d4f0e8 100%);
    border-radius: 45% 55% 40% 60% / 60% 40% 55% 45%;
    transform: translate(20px, 0);
}

/* Approaching state -- driven by scroll progress via JS */
.merge-stage.is-approaching .merge-blob-left {
    transform: translate(0, 0);
}
.merge-stage.is-approaching .merge-blob-right {
    transform: translate(0, 0);
}

/* Merged state */
.merge-stage.is-merged .merge-blob-left {
    transform: translate(calc(50% - 8%), 0) scale(1.05);
    border-radius: 50% 50% 55% 45% / 55% 45% 50% 50%;
    opacity: 0;
}
.merge-stage.is-merged .merge-blob-right {
    transform: translate(calc(-50% + 8%), 0) scale(1.25);
    width: clamp(200px, 26vw, 300px);
    height: clamp(180px, 24vw, 270px);
    border-radius: 48% 52% 55% 45% / 52% 48% 55% 45%;
    background: linear-gradient(135deg, #f0d4e0 0%, #e8d4f0 35%, #d4e8f0 70%, #d4f0e8 100%);
    box-shadow: 0 30px 80px rgba(212, 106, 128, 0.32);
}

.merge-eye {
    position: absolute;
    top: 38%;
    width: 12%;
    height: 12%;
    background: var(--eye-color);
    border-radius: 50%;
    transition: opacity 0.4s ease;
}
.merge-eye-left { left: 28%; }
.merge-eye-right { right: 28%; }

.merge-mouth {
    position: absolute;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%);
    width: 44%;
    height: 22%;
    overflow: visible;
}

.merge-glow {
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 106, 128, 0.45) 0%, rgba(212, 106, 128, 0) 70%);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 1s ease, transform 1.2s ease;
}

.merge-stage.is-merged .merge-glow {
    opacity: 1;
    transform: scale(1.3);
    animation: glow-pulse 2.4s ease-in-out infinite 0.6s;
}

@keyframes glow-pulse {
    0%, 100% { transform: scale(1.25); opacity: 0.85; }
    50% { transform: scale(1.45); opacity: 1; }
}

.hearts-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.merge-stage.is-merged .hearts-overlay {
    opacity: 0;
}

.heart-shape {
    transform-origin: center;
    transform: scale(0.6);
    opacity: 0;
}

/* ========== CLIMAX TEXT ========== */
.climax-text {
    margin: 50px auto 24px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.climax-text.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.climax-line {
    font-family: var(--serif-headline);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(28px, 4vw, 44px);
    color: var(--text-secondary);
    line-height: 1.2;
}

.climax-quest {
    font-family: var(--serif-headline);
    font-weight: 700;
    font-style: italic;
    font-size: clamp(56px, 9vw, 120px);
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
    margin-top: 4px;
    background: linear-gradient(135deg, #2a1a30 0%, #d46a80 65%, #6a4a70 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.closing-bubble {
    margin: 60px auto 0;
    max-width: 540px;
    padding: 36px 40px;
    background: rgba(250, 244, 252, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 60% 40% 50% 50% / 45% 55% 50% 50%;
    box-shadow: 0 18px 50px rgba(106, 74, 112, 0.12);
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}

.closing-bubble.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.closing-bubble p {
    font-family: var(--serif-body);
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-primary);
}

.closing-mark {
    display: inline-block;
    margin-top: 14px;
    color: var(--mouth-color);
    font-size: 22px;
}

/* ========== CHAPTER NAV ========== */
.chapter-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 50;
    padding: 14px 10px;
    background: rgba(250, 244, 252, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 30% 70% 30% 70% / 50% 50% 50% 50%;
}

.nav-dot {
    display: block;
    width: 22px;
    height: 22px;
    text-decoration: none;
    cursor: none;
}

.nav-blob {
    display: block;
    width: 100%;
    height: 100%;
    background: rgba(106, 74, 112, 0.3);
    border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
    transition: background 0.3s ease, transform 0.3s ease;
}

.nav-dot:hover .nav-blob {
    background: var(--mouth-color);
    transform: scale(1.18);
}

.nav-dot.is-active .nav-blob {
    background: var(--mouth-color);
    transform: scale(1.25);
    box-shadow: 0 0 14px rgba(212, 106, 128, 0.5);
}

/* ========== CURSOR BLOB ========== */
.cursor-blob {
    position: fixed;
    width: 28px;
    height: 28px;
    background: rgba(212, 106, 128, 0.55);
    border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: multiply;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease, background 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.cursor-blob.is-active {
    opacity: 1;
}

.cursor-blob.is-hover {
    width: 44px;
    height: 44px;
    background: rgba(212, 106, 128, 0.35);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    body {
        cursor: auto;
    }
    .cursor-blob {
        display: none;
    }
    .chapter-nav {
        right: 12px;
        padding: 10px 8px;
        gap: 10px;
    }
    .nav-dot {
        width: 16px;
        height: 16px;
    }
    .floating-thought {
        font-size: 10px;
        padding: 8px 14px;
    }
    .thought-c {
        display: none;
    }
    .panel-b, .panel-c {
        margin-left: 0;
        margin-right: 0;
    }
    .merge-blob {
        width: 120px;
        height: 120px;
    }
    .merge-stage.is-merged .merge-blob-right {
        width: 200px;
        height: 180px;
    }
}

@media (max-width: 480px) {
    .bg-blob-2, .bg-blob-4, .bg-blob-6 {
        opacity: 0.45;
    }
    .closing-bubble {
        padding: 26px 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
