/* Wanda's Story Cauldron — styles. Loads after gamekit.css. */

:root {
    --indigo: #2B2350;
    --indigo-2: #1C1738;
    --plum: #B565D8;
    --pink: #FF7BAC;
    --amber: #FCBF49;
    --parch: #FFF6E3;
    --brew: #7CB518;
    --sf-font: 'Comic Sans MS', 'Chalkboard SE', 'Baloo 2', 'Segoe UI', Arial, sans-serif;
}

body { font-family: var(--sf-font); background: var(--indigo-2); overflow: hidden; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#app { position: fixed; inset: 0; overflow: hidden; }
#app > section { position: absolute; inset: 0; overflow: hidden; }

.depth { position: absolute; inset: 0; pointer-events: none; }
#sky { z-index: 0; }
#kitchen { z-index: 1; }
#particles { z-index: 2; }
#app > section { z-index: 5; }
.gk-hidden { display: none !important; }

/* ── persistent sky ─────────────────────────────────────── */

#sky .sky-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky-star { animation: twinkle 3.4s ease-in-out infinite; transform-origin: center; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.moon {
    position: absolute; top: 2%; right: 22%;
    width: clamp(58px, 7.5vw, 96px); height: auto;
    animation: moon-bob 7s ease-in-out infinite;
}
@keyframes moon-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }

/* ── persistent kitchen mid-layer ───────────────────────── */

.k-wall {
    position: absolute; left: 0; right: 0; top: 17%; bottom: 0;
    background: linear-gradient(180deg, #4A3B6E 0%, #3A2E58 60%, #2E2447 100%);
    box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.06);
}
.k-window {
    position: absolute; left: 7%; top: 8%;
    width: clamp(70px, 10vw, 120px); animation: moon-bob 9s ease-in-out infinite;
}
.k-window svg { width: 100%; height: auto; display: block; }
.k-bunting {
    position: absolute; left: -2%; right: -2%; top: 13%; width: 104%; height: 28px;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.25));
    animation: sway-bunt 6s ease-in-out infinite;
}
@keyframes sway-bunt { 0%, 100% { transform: rotate(-0.6deg); } 50% { transform: rotate(0.6deg); } }
.k-shelf {
    position: absolute; left: 0; right: 0; top: 20%; height: 15px;
    background: linear-gradient(180deg, #8A5A2B, #6B4522);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.k-table {
    position: absolute; left: 0; right: 0; bottom: 0; height: 20%;
    background: linear-gradient(180deg, #7A4E24 0%, #5E3B1B 100%);
    box-shadow: inset 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* ── Wanda ──────────────────────────────────────────────── */

.wanda-slot { position: absolute; z-index: 20; pointer-events: none; }
.wanda { width: 100%; height: 100%; overflow: visible; display: block;
    transform-origin: 50% 92%; animation: wanda-wobble 2.6s ease-in-out infinite; }
@keyframes wanda-wobble { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

.w-sway { transform-origin: 50% 60%; }
.w-hat-tip { transform-origin: 64px 62px; animation: hat-sway 3.2s ease-in-out infinite; }
@keyframes hat-sway { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(7deg); } }
.w-wand { transform-origin: 204px 128px; animation: wand-idle 4s ease-in-out infinite; }
@keyframes wand-idle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(6deg); } }
.w-sparkles polygon { animation: spk 2.4s ease-in-out infinite; transform-origin: center; }
.w-sparkles polygon:nth-child(2) { animation-delay: 0.5s; }
.w-sparkles polygon:nth-child(3) { animation-delay: 1s; }
@keyframes spk { 0%, 100% { opacity: 0.2; transform: scale(0.6); } 50% { opacity: 1; transform: scale(1.1); } }
.w-rstar { animation: spk 3s ease-in-out infinite; }

.w-lid { transform: scaleY(0); transform-origin: center; transition: transform 0.09s; }
.w-blink .w-lid { transform: scaleY(1); }

/* reactions */
.w-happy { animation: w-bounce 0.5s ease; }
@keyframes w-bounce { 0% { transform: translateY(0); } 30% { transform: translateY(-16px) scale(1.05); } 60% { transform: translateY(0) scale(0.98); } 100% { transform: translateY(0); } }
.w-happy .w-hat-tip { animation: hat-pop 0.5s ease; }
@keyframes hat-pop { 0% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-14px) rotate(-14deg); } 100% { transform: translateY(0) rotate(-6deg); } }
.w-gentle { animation: w-tilt 1s ease; }
@keyframes w-tilt { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(-9deg) translateY(-4px); } }
.w-wave .w-arm-r { animation: w-wave 0.8s ease; transform-origin: 160px 156px; }
@keyframes w-wave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-22deg); } 75% { transform: rotate(-6deg); } }
.w-hatflop .w-hat-tip { animation: hat-flop 1.2s ease; }
@keyframes hat-flop { 0% { transform: rotate(-6deg); } 25% { transform: rotate(46deg) translate(6px, 22px); } 55% { transform: rotate(46deg) translate(6px, 22px); } 100% { transform: rotate(-6deg); } }
.w-win { animation: w-spin 1.3s cubic-bezier(.3,1.4,.5,1); }
@keyframes w-spin { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(360deg) scale(1.1); } 100% { transform: rotate(360deg) scale(1); } }

/* entrance (title) */
.entering .wanda { animation: none; transform: translateX(-160%) rotate(-3deg); }
.wanda-slot:not(.entering) .wanda { transition: transform 2.2s cubic-bezier(.3,.9,.4,1); }

/* ══ TITLE ═════════════════════════════════════════════════ */

#screen-title { display: flex; align-items: center; justify-content: center; }
#title-shelf { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); width: min(86%, 760px); }
.shelf-books { display: flex; gap: 5px; justify-content: center; align-items: flex-end; height: 62px; padding: 0 12px; }
.spine {
    width: 20px; height: 100%; border-radius: 3px 3px 0 0; position: relative;
    box-shadow: inset -3px 0 0 rgba(0, 0, 0, 0.18), 0 3px 6px rgba(0, 0, 0, 0.3);
    display: flex; align-items: center; justify-content: center;
}
.spine span { color: #fff; font-size: 0.62rem; font-weight: bold; writing-mode: vertical-rl; opacity: 0.9; }
.shelf-empty { color: #E9D8FF; font-size: 0.95rem; opacity: 0.85; text-align: center; width: 100%; }
.shelf-board { height: 12px; background: linear-gradient(180deg, #8A5A2B, #5E3B1B); border-radius: 3px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35); }

#title-center { text-align: center; z-index: 10; display: flex; flex-direction: column; align-items: center; margin-top: 12vh; }
#title-logo { margin-bottom: 6px; }
.logo-wobble {
    font-size: clamp(1.5rem, 5.5vw, 2.9rem); color: #fff; line-height: 1.05;
    text-shadow: 0 3px 0 #8E44AD, 0 6px 14px rgba(0, 0, 0, 0.4);
    animation: wanda-wobble 4s ease-in-out infinite;
}
.logo-wobble b { color: var(--amber); font-size: 1.16em; }

#cauldron-start {
    background: none; border: none; cursor: pointer; padding: 0; position: relative;
    width: clamp(220px, 34vw, 300px); filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.45));
    animation: pulse-glow 1.8s ease-in-out infinite;
}
#cauldron-start-art { display: block; position: relative; }
#cauldron-start .cauldron { width: 100%; height: auto; display: block; }
#cauldron-start::after {
    content: ''; position: absolute; inset: 20% 8% 0 8%; border-radius: 50%;
    background: radial-gradient(circle, rgba(159, 224, 74, 0.55), transparent 70%);
    filter: blur(12px); z-index: -1; animation: pulse-glow 1.8s ease-in-out infinite;
}
@keyframes pulse-glow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.start-badge {
    position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%);
    width: 66px; height: 66px; border-radius: 50%; background: #fff; color: var(--pink);
    font-size: 2rem; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); animation: badge-bob 1.2s ease-in-out infinite;
}
@keyframes badge-bob { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -62%) scale(1.08); } }
#cauldron-start.launch { animation: launch 0.5s ease forwards; }
@keyframes launch { to { transform: scale(1.12) translateY(-8px); } }

#level-bottles { display: flex; gap: 14px; margin-top: 16px; }
.bottle { width: 40px; text-align: center; opacity: 0.5; transition: 0.3s; }
.bottle svg { width: 34px; height: auto; display: block; margin: 0 auto; }
.bottle span { color: #fff; font-size: 0.85rem; font-weight: bold; }
.bottle.on { opacity: 1; filter: drop-shadow(0 0 8px var(--amber)); transform: scale(1.14); }
.bottle.done { opacity: 0.8; }

#title-wanda { left: 4%; bottom: 4%; width: clamp(140px, 20vw, 210px); height: clamp(170px, 26vh, 260px); }

#info-btn {
    position: absolute; left: 14px; bottom: 12px; z-index: 30;
    min-height: 48px; min-width: 48px; padding: 12px 18px;
    background: rgba(255, 255, 255, 0.14); color: #E9D8FF; border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 14px; font-size: 0.92rem; cursor: pointer; font-family: inherit;
}
#info-btn:active { transform: scale(0.95); }

/* ══ KITCHEN (pick flow) ═══════════════════════════════════ */

#pot-slot {
    position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%);
    width: clamp(250px, 36vw, 360px); z-index: 8; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4));
}
#pot-slot .cauldron { width: 100%; height: auto; display: block; }
#pot-slot::before, #pot-slot::after {
    content: ''; position: absolute; top: -46px; width: 26px; height: 58px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.32), transparent 70%);
    filter: blur(4px); pointer-events: none;
}
#pot-slot::before { left: 34%; animation: steam 3.4s ease-in-out infinite; }
#pot-slot::after { left: 56%; animation: steam 3.4s ease-in-out infinite 1.2s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(10px) scale(0.7); } 40% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(-40px) scale(1.2); } }
#kitchen-wanda { left: 2%; bottom: 2%; width: clamp(130px, 18vw, 190px); height: clamp(160px, 25vh, 240px); z-index: 12; }

#shelf-wrap { position: absolute; left: 50%; top: 5%; transform: translateX(-50%); width: min(94%, 720px); text-align: center; z-index: 15; }
#shelf-wrap.drop { animation: shelf-drop 0.6s cubic-bezier(.3,1.3,.5,1); }
@keyframes shelf-drop { 0% { transform: translate(-50%, -120%); } 100% { transform: translate(-50%, 0); } }
#shelf-label {
    font-size: clamp(1.15rem, 3.6vw, 1.7rem); color: #fff; font-weight: bold; margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4); background: rgba(43, 35, 80, 0.5);
    display: inline-block; padding: 8px 22px; border-radius: 40px;
}
#shelf { display: flex; gap: clamp(12px, 3vw, 30px); justify-content: center; align-items: stretch; flex-wrap: nowrap; }

.ing-card {
    --sig: var(--plum);
    width: clamp(150px, 21vw, 200px); min-width: 150px; min-height: 210px;
    background: var(--parch); border: none; border-radius: 22px; padding: 12px 12px 10px;
    box-shadow: 0 10px 0 var(--sig), 0 16px 26px rgba(0, 0, 0, 0.35);
    cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center;
    animation: card-in 0.5s backwards, card-bob 3s ease-in-out infinite 0.5s;
    transition: transform 0.2s, box-shadow 0.2s;
}
@keyframes card-in { 0% { opacity: 0; transform: translateY(30px) scale(0.8); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes card-bob { 0%, 100% { transform: translateY(0) rotate(-0.6deg); } 50% { transform: translateY(-8px) rotate(0.6deg); } }
.ing-card:hover { transform: translateY(-6px) scale(1.03); }
.ing-card:active { transform: translateY(2px) scale(0.98); box-shadow: 0 4px 0 var(--sig), 0 8px 16px rgba(0, 0, 0, 0.35); }
.ing-card.fade { animation: card-fade 0.4s forwards; }
@keyframes card-fade { to { opacity: 0.15; transform: scale(0.85); } }
.ing-card.flying { border-radius: 22px; }

.card-scene {
    width: 100%; flex: 1; border-radius: 16px; overflow: hidden; position: relative;
    background: radial-gradient(circle at 50% 40%, #fff, color-mix(in srgb, var(--sig) 18%, #fff));
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 0 0 18px rgba(90, 60, 130, 0.18);
    min-height: 130px;
}
.card-scene.place { padding: 0; }
.card-scene .hero-sprite { width: 78%; height: auto; }
.card-scene .thing-sprite { width: 62%; height: auto; }
.card-scene .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-name {
    margin-top: 8px; font-size: clamp(0.82rem, 2vw, 1.05rem); font-weight: bold; color: #5A3C82;
    text-align: center; line-height: 1.1;
}
.card-pin { position: absolute; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--sig); box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.2); }
.card-pin.tl { left: 10px; } .card-pin.tr { right: 10px; }

.ing-card.jar .card-scene { position: relative; }
.jar-emoji { position: absolute; font-size: clamp(2.4rem, 7vw, 3.6rem); z-index: 2; animation: card-bob 2.4s ease-in-out infinite; }
.jar-svg { width: 70%; height: auto; }
.ing-card.chosen { animation: pop-chosen 0.5s ease forwards; }
@keyframes pop-chosen { 40% { transform: scale(1.12); } 100% { transform: scale(1.04); } }

#pick-fx { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.splash-drop { position: absolute; width: 12px; height: 12px; border-radius: 50%; animation: splash 0.6s ease-out forwards; }
@keyframes splash { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.3); opacity: 0; } }

/* ══ STIR ══════════════════════════════════════════════════ */

#screen-stir { display: flex; align-items: center; justify-content: center; }
#stir-zone {
    position: relative; background: none; border: none; cursor: pointer; padding: 0;
    width: clamp(300px, 50vw, 470px); z-index: 10;
}
#stir-pot { width: 100%; filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.45)); position: relative; }
#stir-pot::before, #stir-pot::after {
    content: ''; position: absolute; top: 22%; width: 30px; height: 66px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.34), transparent 70%); filter: blur(5px); pointer-events: none;
}
#stir-pot::before { left: 38%; animation: steam 3s ease-in-out infinite; }
#stir-pot::after { left: 55%; animation: steam 3s ease-in-out infinite 1s; }
#stir-pot .cauldron { width: 100%; height: auto; display: block; }
#stir-pot.swirl .brew { animation: swirl 0.5s ease; transform-origin: center; }
@keyframes swirl { 0% { transform: scaleX(1); } 50% { transform: scaleX(0.86) scaleY(1.1); } 100% { transform: scaleX(1); } }
#stir-spoon { position: absolute; top: -34%; left: 54%; width: 22%; transform-origin: 50% 100%; }
#stir-spoon svg { width: 100%; height: auto; }
#stir-spoon.stir { animation: spoon-stir 0.5s ease; }
@keyframes spoon-stir { 0% { transform: rotate(-16deg); } 50% { transform: rotate(18deg); } 100% { transform: rotate(-16deg); } }
#stir-hint {
    position: absolute; left: 50%; top: 14%; transform: translateX(-50%);
    font-size: clamp(1.1rem, 3.4vw, 1.6rem); color: #fff; font-weight: bold; z-index: 20;
    background: rgba(43, 35, 80, 0.5); padding: 8px 22px; border-radius: 40px; white-space: nowrap;
    animation: hint-bob 1.2s ease-in-out infinite;
}
@keyframes hint-bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }
#stir-wanda { right: 3%; bottom: 3%; width: clamp(130px, 18vw, 190px); height: clamp(160px, 25vh, 240px); z-index: 12; }
#stir-fx { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
.stir-bubble {
    position: absolute; bottom: 46%; width: calc(16px * var(--s)); height: calc(16px * var(--s));
    border-radius: 50%; background: rgba(255, 255, 255, 0.55); animation: bub-rise 0.85s ease-out forwards;
}
@keyframes bub-rise { 0% { transform: translateY(0) scale(0.4); opacity: 0.8; } 100% { transform: translateY(-120px) scale(1); opacity: 0; } }
.poof-flash { position: absolute; inset: 0; background: #fff; z-index: 50; animation: poof 0.5s ease-out forwards; pointer-events: none; }
@keyframes poof { 0% { opacity: 0; } 30% { opacity: 0.95; } 100% { opacity: 0; } }

/* ══ STORYBOOK ═════════════════════════════════════════════ */

#screen-story { display: flex; align-items: center; justify-content: center; padding: min(3vh, 22px); }
#book {
    position: relative; width: min(96%, 940px); height: min(94%, 660px);
    background: var(--parch); border-radius: 20px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 8px #fff, inset 0 0 0 12px #E7CF9E;
    display: flex; flex-direction: column; overflow: hidden;
}
#book.burst { animation: book-burst 0.7s cubic-bezier(.2,1.3,.4,1); }
@keyframes book-burst { 0% { transform: scale(0.1) rotate(-40deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); } }
#book.flip { animation: book-flip 0.5s ease; transform-origin: left center; }
@keyframes book-flip { 0% { transform: perspective(1200px) rotateY(0); } 50% { transform: perspective(1200px) rotateY(-14deg); } 100% { transform: perspective(1200px) rotateY(0); } }

#book-scene {
    position: relative; flex: 1; margin: 12px 12px 0; border-radius: 14px; overflow: hidden;
    box-shadow: inset 0 0 30px rgba(90, 60, 130, 0.25); min-height: 0;
}
.scene-backdrop { position: absolute; inset: 0; }
.scene-backdrop .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-vignette { position: absolute; inset: 0; box-shadow: inset 0 0 60px rgba(43, 35, 80, 0.3); pointer-events: none; }
.scene-hero, .scene-thing {
    position: absolute; width: 32%; z-index: 4;
}
.scene-hero .hero-sprite, .scene-thing .thing-sprite { width: 100%; height: auto; display: block; }
.scene-thing { width: 19%; }
.scene-hero { animation: sprite-bob 3s ease-in-out infinite; }
.scene-thing.settled { animation: float-bob 3.4s ease-in-out infinite; }
@keyframes sprite-bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -8px; } }
@keyframes float-bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -12px; } }
.scene-hero.enter { animation: hop-in 0.5s ease; }
@keyframes hop-in { 0% { transform: translate(-50%, 40px) scale(0.5); opacity: 0; } 60% { transform: translate(-50%, -10px) scale(1.05); } 100% { opacity: 1; } }
.scene-thing.enter { animation: float-in 0.6s ease; }
@keyframes float-in { 0% { opacity: 0; transform: translate(-50%, -30px) scale(0.4) rotate(-20deg); } 100% { opacity: 1; } }
.poke-spark {
    position: absolute; z-index: 7; pointer-events: none; font-size: 1.4rem; transform: translate(-50%, -50%);
    animation: poke 0.6s ease-out forwards;
}
@keyframes poke { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(0); } 40% { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(20deg); } 100% { opacity: 0; transform: translate(-50%, -90%) scale(0.8) rotate(40deg); } }
.scene-spark { position: absolute; width: 15%; z-index: 5; opacity: 0; transform: scale(0.2); }
.scene-spark svg { width: 100%; height: auto; filter: drop-shadow(0 0 10px var(--amber)); }
.scene-spark.glow { animation: spark-land 0.6s cubic-bezier(.2,1.4,.4,1) forwards; }
@keyframes spark-land { 0% { opacity: 0; transform: scale(1.6) translateY(-40px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

/* ambient loops inside backdrops */
.amb-bob { animation: sprite-bob 3.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.amb-wave { animation: wave-boing 2.4s ease-in-out infinite; transform-box: fill-box; }
.amb-wave2 { animation: wave-boing 2.8s ease-in-out infinite reverse; transform-box: fill-box; }
@keyframes wave-boing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.amb-spin-slow { animation: gentle-rock 6s ease-in-out infinite; transform-box: fill-box; }
@keyframes gentle-rock { 0%, 100% { transform: rotate(-1.4deg); } 50% { transform: rotate(1.4deg); } }
.amb-noodle, .amb-noodle2 { animation: noodle 3s ease-in-out infinite; transform-box: fill-box; transform-origin: bottom; }
.amb-noodle2 { animation-delay: 0.6s; }
@keyframes noodle { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-6px) scaleY(1.08); } }

#book-spine-wanda { left: -2%; bottom: 30%; width: clamp(72px, 10vw, 112px); height: clamp(92px, 14vh, 142px); z-index: 6; }

#book-text {
    min-height: 22%; max-height: 30%; padding: 10px 18px; display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: clamp(1.05rem, 2.7vw, 1.65rem); color: #4A3B5C; line-height: 1.32; font-weight: bold;
    overflow: hidden;
}
#book.finding #book-text { visibility: hidden; }
.kw-line { display: inline-block; max-width: 100%; }
.kw { transition: color 0.15s, transform 0.15s; display: inline-block; padding: 0 0.14em; }
.kw.lit { color: var(--pink); transform: scale(1.07) translateY(-2px); }

#spark-tray {
    position: absolute; left: 0; right: 0; bottom: 0; height: 30%; z-index: 18;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    pointer-events: none;
}
.spark-prompt { font-size: 1.6rem; animation: sprite-bob 1.4s ease-in-out infinite; }
.spark-row { display: flex; gap: 16px; justify-content: center; }
.spark-chip {
    pointer-events: auto; width: clamp(78px, 11vw, 100px); height: clamp(78px, 11vw, 100px);
    background: #fff; border: 4px solid var(--amber); border-radius: 22px; cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3); display: flex; align-items: center; justify-content: center;
    animation: chip-rise 0.4s backwards; transition: transform 0.15s;
}
@keyframes chip-rise { 0% { opacity: 0; transform: translateY(50px) scale(0.6); } 100% { opacity: 1; transform: translateY(0); } }
.spark-chip svg { width: 80%; height: auto; }
.spark-chip:active { transform: scale(0.92); }
.spark-chip.wobble { animation: chip-wobble 0.5s ease; }
@keyframes chip-wobble { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-6deg); } 60% { transform: translateX(10px) rotate(6deg); } }
.spark-chip.found { animation: chip-found 0.5s ease forwards; }
@keyframes chip-found { to { transform: scale(1.3); opacity: 0; } }
.spark-chip.hint { animation: chip-hint 0.9s ease-in-out infinite; border-color: var(--pink); }
@keyframes chip-hint { 0%, 100% { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3); } 50% { box-shadow: 0 0 0 6px rgba(255, 123, 172, 0.55), 0 8px 18px rgba(0, 0, 0, 0.3); } }
.spark-chip.lock { pointer-events: none; }

#hear-again {
    position: absolute; left: 14px; bottom: 14px; z-index: 20;
    width: 66px; height: 66px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--plum); color: #fff; font-size: 1.9rem; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    animation: card-bob 2.6s ease-in-out infinite;
}
#hear-again:active { transform: scale(0.9); }

#page-turn {
    position: absolute; right: 8px; bottom: 8px; z-index: 20;
    width: clamp(96px, 13vw, 120px); height: clamp(96px, 13vw, 120px); border: none; background: none; cursor: pointer; padding: 0;
    animation: corner-flap 1.3s ease-in-out infinite;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}
#page-turn svg { width: 100%; height: 100%; }
@keyframes corner-flap { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-7deg) translate(-3px, -3px); } }
#page-turn:active { transform: scale(0.92); }

#twist-tray {
    position: absolute; inset: 0; z-index: 22; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 18px; background: rgba(43, 35, 80, 0.5);
}
.twist-q { font-size: 3rem; animation: gentle-rock 1.6s ease-in-out infinite; }
#twist-tray { flex-direction: row; flex-wrap: wrap; }
.twist-q { width: 100%; text-align: center; }
.twist-card {
    width: clamp(120px, 18vw, 170px); height: clamp(120px, 18vw, 170px); border-radius: 26px; border: 5px solid #fff;
    background: var(--parch); cursor: pointer; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
    display: flex; align-items: center; justify-content: center; animation: chip-rise 0.4s backwards; transition: transform 0.2s;
}
.twist-emoji { font-size: clamp(3rem, 8vw, 4.4rem); }
.twist-card:active { transform: scale(0.94); }
.twist-card.chosen { animation: pop-chosen 0.5s forwards; }
.twist-card.shrink { animation: card-fade 0.5s forwards; }

#page-pips { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 30; }
.pip { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); transition: 0.3s; }
.pip.done { background: var(--amber); } .pip.on { background: #fff; transform: scale(1.4); }

.remix-stir { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.remix-stir .cauldron { width: 46%; animation: swirl 0.6s ease-in-out infinite; }
.remix-msg { color: var(--plum); font-size: clamp(1.1rem, 3vw, 1.6rem); font-weight: bold; }

/* ══ END CARD ══════════════════════════════════════════════ */

#screen-end { display: flex; align-items: center; justify-content: center; }
#end-card {
    background: var(--parch); border-radius: 30px; padding: clamp(24px, 5vw, 48px) clamp(30px, 6vw, 64px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 8px #fff, inset 0 0 0 12px #E7CF9E;
    text-align: center; z-index: 10; max-width: 92%;
}
#end-letters { font-size: clamp(2rem, 7vw, 4rem); color: #8E44AD; font-weight: bold; }
.end-l { display: inline-block; animation: stamp 0.4s cubic-bezier(.2,1.6,.4,1) backwards; }
@keyframes stamp { 0% { opacity: 0; transform: scale(2.4) translateY(-14px); } 100% { opacity: 1; transform: scale(1); } }
#orisit { font-size: clamp(1.6rem, 6vw, 3.2rem); color: var(--pink); font-weight: bold; margin-top: 6px; }
#orisit.boing { animation: boing 0.6s cubic-bezier(.2,1.7,.4,1); }
@keyframes boing { 0% { opacity: 0; transform: scale(0.2) rotate(-10deg); } 60% { transform: scale(1.2) rotate(4deg); } 100% { opacity: 1; transform: scale(1); } }

#end-wanda { right: 4%; bottom: 4%; width: clamp(140px, 20vw, 210px); height: clamp(170px, 26vh, 260px); z-index: 12; }

#retell-strip { margin-top: 18px; }
.retell-q { font-size: clamp(0.95rem, 2.6vw, 1.3rem); color: #5A3C82; font-weight: bold; margin-bottom: 12px; }
.retell-row { display: flex; gap: 14px; justify-content: center; }
.rt-thumb {
    width: clamp(96px, 14vw, 140px); border: 4px solid #fff; border-radius: 16px; background: #fff; cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3); padding: 0; overflow: hidden; position: relative; transition: transform 0.2s;
}
.rt-mini { position: relative; width: 100%; height: clamp(72px, 10vw, 100px); overflow: hidden; }
.rt-mini .backdrop { position: absolute; inset: 0; width: 100%; height: 100%; }
.rt-hero { position: absolute; left: 42%; bottom: 2%; transform: translateX(-50%); width: 50%; }
.rt-hero .hero-sprite { width: 100%; height: auto; }
.rt-thing { position: absolute; right: 6%; top: 22%; width: 32%; }
.rt-thing .thing-sprite { width: 100%; height: auto; }
.rt-finale { position: absolute; left: 6%; top: 6%; font-size: 1.1rem; }
.rt-badge {
    display: block; padding: 4px; font-weight: bold; color: #8E44AD; background: var(--amber); font-size: 0.9rem;
}
.rt-thumb.next-correct { border-color: var(--amber); }
.rt-thumb.placed { border-color: var(--brew); }
.rt-thumb.placed .rt-badge { background: var(--brew); color: #fff; }
.rt-thumb:active { transform: scale(0.94); }
.rt-thumb.wobble { animation: chip-wobble 0.5s ease; }
.rt-thumb.hint { animation: chip-hint 0.9s ease-in-out infinite; }
.retell-slots { display: flex; gap: 14px; justify-content: center; margin-top: 12px; }
.rt-slot { padding: 6px 14px; border-radius: 20px; background: #EADCF5; color: #9078A8; font-weight: bold; font-size: 0.85rem; }
.rt-slot.lit { background: var(--brew); color: #fff; }

#end-buttons { position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%); display: flex; gap: 22px; z-index: 20; }
#btn-remix, #btn-new {
    min-height: 110px; min-width: 150px; flex-direction: column; display: flex; gap: 2px; border-radius: 28px;
    padding: 12px 26px;
}
.eb-icon { font-size: 2.2rem; line-height: 1; } .eb-label { font-size: clamp(1rem, 2.6vw, 1.3rem); }
#btn-remix { animation: card-bob 2.4s ease-in-out infinite; }

/* ══ FOR GROWN-UPS ═════════════════════════════════════════ */

#info-overlay {
    position: fixed; inset: 0; z-index: 930; display: flex; align-items: center; justify-content: center;
    background: rgba(43, 35, 80, 0.55); animation: gk-fade-in 0.25s ease-out; padding: 16px;
}
#info-card {
    position: relative; max-width: min(94vw, 540px); max-height: 92vh; overflow-y: auto; text-align: left;
    border-radius: 26px;
}
#info-card h2 { color: #8E44AD; margin-bottom: 10px; font-size: clamp(1.3rem, 4vw, 1.7rem); }
#info-card h3 { color: var(--pink); margin: 4px 0 4px; font-size: 1.05rem; }
#info-card p { margin: 8px 0; line-height: 1.4; color: #4A3B5C; font-size: 0.98rem; }
.info-block { background: #FBF1DE; border-radius: 16px; padding: 12px 16px; margin: 12px 0; }
.info-fine { font-size: 0.88rem; opacity: 0.9; }
#level-picker { display: flex; gap: 10px; margin-top: 6px; }
.lvl-btn {
    flex: 1; min-height: 64px; border: 3px solid #E0CDEF; border-radius: 16px; background: #fff; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; font-family: inherit; color: #7A5DA0;
}
.lvl-btn b { font-size: 1.4rem; color: var(--plum); } .lvl-btn span { font-size: 0.78rem; font-weight: bold; }
.lvl-btn.on { border-color: var(--plum); background: #F6ECFC; box-shadow: 0 6px 14px rgba(181, 101, 216, 0.35); }
#info-close {
    position: absolute; top: 10px; right: 12px; width: 48px; height: 48px; border-radius: 50%; border: none;
    background: var(--pink); color: #fff; font-size: 1.3rem; cursor: pointer;
}
#info-close:active { transform: scale(0.9); }

/* nudge pulse */
.nudge { animation: nudge-pulse 0.9s ease-in-out infinite !important; }
@keyframes nudge-pulse { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 14px var(--amber)) brightness(1.12); } }

/* ── portrait / small screens ── */
@media (max-width: 780px) {
    #shelf { gap: 12px; }
    .ing-card { min-width: 132px; width: 30vw; min-height: 190px; }
    #book { height: min(90%, 620px); }
    #end-buttons { gap: 14px; }
    #btn-remix, #btn-new { min-width: 128px; }
}
@media (max-height: 640px) {
    #title-shelf { display: none; }
    #book-text { font-size: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
