/* =============================================================================
   style.css - the look of the site. Colors live in the :root block right below,
   so you can retheme everything by changing a few lines.
============================================================================= */
:root {
  --cream: #fff6e0; --cream-2: #ffeccb; --paper: #fffdf5; --ink: #6b4a3a; --ink-soft: #8d6e5d;
  --mint: #d9eecb; --green: #9ccf93; --green-2: #b6e0a8; --leaf: #5fa56b;
  --butter: #ffe9a0; --butter-2: #ffd966; --pink: #ffc6d3; --pink-2: #ff9fb5;
  --sky: #cfe9f5; --water: #a9d6ee; --lav: #c9c4ef;
  --hand: "Marker Felt", "Chalkboard SE", "Comic Neue", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --round: "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", system-ui, -apple-system, sans-serif;
  --script: "Bradley Hand", "Segoe Print", "Chalkboard SE", "Comic Sans MS", cursive;
  --hud-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --top: calc(var(--hud-h) + var(--safe-t));
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--cream); color: var(--ink);
  font-family: var(--round); overscroll-behavior: none; touch-action: manipulation; -webkit-text-size-adjust: 100%; }
#app { position: fixed; inset: 0; height: 100vh; height: 100dvh; overflow: hidden; }
#stage { position: absolute; inset: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 4px dashed var(--ink); outline-offset: 3px; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 150; }

.chapter { position: absolute; inset: 0; overflow: hidden; outline: none; }
.chapter.enter { z-index: 5; animation: iris .95s cubic-bezier(.6, .05, .3, 1) both; }
@keyframes iris { from { clip-path: circle(0% at 50% 88%); } to { clip-path: circle(150% at 50% 88%); } }
.scene { position: absolute; inset: 0; padding-top: var(--top); overflow: hidden; }

/* ---------- top bar ---------- */
.hud { position: absolute; z-index: 20; top: 0; left: 0; right: 0; height: var(--top); padding: var(--safe-t) 10px 0;
  display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--paper); border: 3px solid var(--ink);
  display: grid; place-items: center; box-shadow: 2px 3px 0 var(--ink); transition: transform .12s; }
.hud-btn:active { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--ink); }
.hud-btn svg { width: 24px; height: 24px; }
.dots { display: flex; background: rgba(255, 253, 245, .9); border: 3px solid var(--ink); border-radius: 999px; padding: 0 6px; box-shadow: 2px 3px 0 var(--ink); }
.dot { width: 27px; height: 38px; position: relative; }
.dot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: #eadfcd; border: 2.5px solid var(--ink); transition: transform .25s, background .25s; }
.dot.reached::before { background: var(--pink-2); }
.dot[aria-current="step"]::before { background: var(--butter-2); transform: scale(1.4); }
.dot:disabled { cursor: default; }

/* ---------- shared bits ---------- */
.chapter-title { font-family: var(--hand); font-size: clamp(26px, 7.4vw, 38px); line-height: 1.05; margin: 0; text-align: center;
  text-shadow: 0 3px 0 rgba(255, 255, 255, .75); }
.intro { margin: 8px auto 0; max-width: 30em; text-align: center; font-size: 16px; line-height: 1.35; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 10px 28px;
  font-family: var(--hand); font-size: 21px; background: var(--butter-2); border: 3px solid var(--ink);
  border-radius: 22px 28px 22px 30px / 28px 22px 30px 22px; box-shadow: 4px 5px 0 var(--ink); transition: transform .12s, box-shadow .12s; }
.btn:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn.ghost { background: var(--paper); }
.pop-in { animation: pop .5s both; }

.bubble { padding: 9px 14px; background: #fff; border: 3px solid var(--ink); border-radius: 20px 22px 20px 10px; font-family: var(--hand);
  font-size: 17px; line-height: 1.25; color: var(--ink); opacity: 0; transform: scale(.7); pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: min(72vw, 270px); position: relative; text-align: center; }
.bubble.show { opacity: 1; transform: scale(1); animation: pop .35s both; }
.bubble:empty { visibility: hidden; }
.bubble::after { content: ""; position: absolute; bottom: -9px; left: calc(50% - 7px); width: 14px; height: 14px; background: #fff;
  border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg); }

.char { display: block; overflow: visible; }
.char .f { display: none; }
.char.mood-happy .f-happy, .char.mood-shout .f-shout, .char.mood-shock .f-shock,
.char.mood-sleepy .f-sleepy, .char.mood-wink .f-wink, .char.mood-love .f-love { display: inline; }

.sparkle-pop { position: absolute; width: 24px; margin: -12px 0 0 -12px; pointer-events: none; z-index: 30; animation: spark .95s ease-out forwards; }
.sparkle-pop svg { width: 100%; height: auto; display: block; }
.heart-pop { width: 20px; margin: -10px 0 0 -10px; }

/* =============================================================================
   CHAPTER 1 - WELCOME : sunny meadow
============================================================================= */
.sc-welcome { background: var(--cream); }
.sc-welcome .sun { position: absolute; right: -52px; top: calc(var(--top) + 150px); width: 150px; height: 150px; border-radius: 50%; background: #ffeaa0; border: 4px solid var(--ink); opacity: .9; }
.clouds .cloud { position: absolute; width: 96px; opacity: .95; animation: drift 38s linear infinite; }
.clouds .cloud svg { width: 100%; height: auto; display: block; }
.clouds .c1 { top: calc(var(--top) + 150px); left: -110px; animation-duration: 46s; }
.clouds .c2 { top: calc(var(--top) + 60px); left: -110px; width: 70px; animation-duration: 34s; animation-delay: -16s; }
.clouds .c3 { top: calc(var(--top) + 230px); left: -110px; width: 80px; animation-duration: 52s; animation-delay: -30s; }
.w-head { position: absolute; top: calc(var(--top) + 8px); left: 0; right: 0; text-align: center; padding: 0 16px; z-index: 3; }
.title { font-family: var(--hand); font-size: clamp(34px, 10.4vw, 62px); line-height: 1.02; margin: 0; color: var(--ink); text-shadow: 0 4px 0 rgba(255, 255, 255, .85); }
.title span span { display: inline-block; animation: wave 2.2s ease-in-out infinite; animation-delay: calc(var(--i) * -.12s); }
.title span span:nth-child(3n+1) { color: #ff7f9f; }
.title span span:nth-child(3n+2) { color: #e0a800; }
.title span span:nth-child(3n) { color: #5fa56b; }
.title .sp { display: inline-block; width: .3em; }
.subtitle { margin: 8px 0 0; font-family: var(--hand); font-size: clamp(17px, 4.6vw, 22px); }
.hill { position: absolute; left: -12%; right: -12%; bottom: -9%; height: 33%; background: var(--green); border-top: 4px solid var(--ink); border-radius: 50% 50% 0 0 / 40% 40% 0 0; }
.hill-back { bottom: 8%; height: 22%; background: var(--green-2); left: -30%; right: 25%; }
.flowers { position: absolute; left: 0; right: 0; bottom: 0; height: 32%; z-index: 3; pointer-events: none; }
.flower-btn { position: absolute; width: 46px; pointer-events: auto; transform-origin: 50% 100%; animation: sway 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
.flower-btn.spin { animation: flspin .8s ease-out; }
.flower-btn svg { width: 100%; height: auto; display: block; }
.bfly { position: absolute; top: calc(var(--top) + 250px); left: 0; width: 38px; animation: flyby 15s ease-in-out infinite; pointer-events: none; z-index: 4; }
.bfly svg { width: 100%; height: auto; display: block; }
.bfly .wing { animation: flap .22s ease-in-out infinite alternate; transform-origin: 30px 25px; }

.mascot { position: absolute; left: 50%; bottom: 19%; width: min(58vw, 240px); margin-left: calc(min(58vw, 240px) / -2); z-index: 5; }
.mascot .bubble { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); margin: 0 auto; width: fit-content; max-width: min(78vw, 300px); transform-origin: 50% 100%; }
.bunny-btn { display: block; width: 100%; transform-origin: 50% 90%; }
.bunny-btn svg { width: 100%; height: auto; }
.gift-btn { position: absolute; left: 50%; bottom: -17%; width: 42%; margin-left: -21%; transform-origin: 50% 100%; z-index: 2; animation: bob 1.8s ease-in-out infinite; }
.gift-btn svg { width: 100%; height: auto; display: block; overflow: visible; }
.gift-btn.shake { animation: shake .75s ease-in-out; }
.gift-btn.open { animation: none; }
.gift-btn.open .gift-lid { animation: lidfly .9s ease-out forwards; transform-box: fill-box; transform-origin: 50% 50%; }
.hint { position: absolute; left: 50%; bottom: calc(4% + var(--safe-b)); margin: 0 0 0 -90px; width: 180px; padding: 4px 0; text-align: center; font-family: var(--hand); font-size: 21px; z-index: 6;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 2px 3px 0 var(--ink); animation: bob 1.5s ease-in-out infinite; transition: opacity .4s; }
.hint.gone { opacity: 0; animation: none; }

.a-hop { animation: hop .7s ease-out; }
.a-spin { animation: spin 1s ease-in-out; }
.a-wiggle { animation: wiggle .8s ease-in-out; }
.a-dash-l { animation: dashL 1.1s ease-in-out; }
.a-dash-r { animation: dashR 1.1s ease-in-out; }

/* =============================================================================
   CHAPTER 2 - LOVE QUIZ : gingham picnic blanket
============================================================================= */
.sc-quiz { background-color: #e1f2d4; background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, .6) 0 26px, transparent 26px 52px),
  repeating-linear-gradient(90deg, rgba(255, 255, 255, .6) 0 26px, transparent 26px 52px); display: flex; flex-direction: column; align-items: center; }
.quiz-top { padding: 4px 16px 0; text-align: center; flex: none; }
.carrots { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.carrot { width: 24px; height: auto; }
.carrot .c-body { fill: #f0e2cf; transition: fill .3s; }
.carrot.done .c-body { fill: #ffb86b; }
.carrot.done { animation: pop .5s both; }
.quiz-main { flex: 1; width: 100%; max-width: 560px; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(26px + var(--safe-b)); }
.paper { position: relative; background-color: var(--paper); background-image: repeating-linear-gradient(transparent 0 31px, #e4efd8 31px 32px);
  border: 4px solid var(--ink); border-radius: 22px 30px 24px 34px / 30px 22px 34px 24px; box-shadow: 5px 6px 0 var(--ink); padding: 18px 16px 12px 36px; overflow: hidden; }
.paper::before { content: ""; position: absolute; left: 24px; top: 0; bottom: 0; border-left: 3px solid #ffb3c1; }
.paper.in { animation: pageIn .45s ease-out both; }
.paper.out { animation: pageOut .38s ease-in both; }
.qnum { margin: 0 0 4px; font-family: var(--hand); font-size: 15px; color: var(--ink-soft); }
.qtext { margin: 0 0 8px; font-family: var(--hand); font-size: clamp(20px, 5.6vw, 26px); line-height: 1.2; }
.answers { display: block; }
.answer { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 48px; padding: 8px 12px; margin: 9px 0;
  font-family: var(--hand); font-size: clamp(16px, 4.5vw, 19px); line-height: 1.2; background: var(--butter); border: 3px solid var(--ink);
  border-radius: 16px 22px 18px 24px; box-shadow: 3px 4px 0 var(--ink); transition: transform .15s, box-shadow .15s; position: relative; }
.answer.a1 { background: var(--pink); } .answer.a2 { background: #cfeaf7; } .answer.a3 { background: #dff1c8; }
.answer:active:not(.locked) { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.answer .badge { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 15px; }
.answer.locked { cursor: default; opacity: .72; }
.answer.picked { opacity: 1; }
.answer.right { background: #c7ecb4; animation: pop .5s both; }
.answer.right::after { content: "\2605"; position: absolute; right: 12px; font-size: 22px; color: #e0a800; }
.answer.wrong { animation: wobble .6s both; }
.answer.reveal { opacity: 1; background: #c7ecb4; outline: 4px solid var(--leaf); outline-offset: -2px; animation: pop .5s .25s both; }
.answer.reveal::after { content: "\2605"; position: absolute; right: 12px; font-size: 22px; color: #e0a800; }
.reaction { display: flex; align-items: flex-end; gap: 6px; margin: 16px 0 6px; }
.helper-char { flex: none; width: 78px; transform-origin: 50% 90%; }
.helper-char svg { width: 100%; height: auto; }
.reaction .bubble { opacity: 1; transform: none; flex: 0 1 auto; text-align: left; margin-bottom: 18px; border-radius: 22px 22px 22px 8px; }
.reaction .bubble::after { left: -9px; bottom: 14px; transform: rotate(135deg); }
.quiz-main > .btn { display: flex; margin: 12px auto 0; }
.score { font-family: var(--hand); font-size: clamp(22px, 6.4vw, 28px); margin: 6px 0; color: #e05577; }
.result-text { font-family: var(--hand); font-size: 20px; line-height: 1.3; margin: 0 0 10px; }

/* =============================================================================
   CHAPTER 3 - SCRAPBOOK : craft desk with polka dots
============================================================================= */
.sc-scrap { background-color: #fff0b8; background-image: radial-gradient(#efce72 1.7px, transparent 1.8px); background-size: 22px 22px; padding-top: 0; }
.scrap-scroll { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--top) + 6px) 12px calc(36px + var(--safe-b)); }
.scrap-head { text-align: center; }
.tape-title { display: inline-block; margin: 0; padding: 6px 22px; font-family: var(--hand); font-size: clamp(24px, 7vw, 32px); background-color: var(--pink);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .4) 0 8px, transparent 8px 16px); border: 3px solid var(--ink);
  border-left-style: dashed; border-right-style: dashed; transform: rotate(-2deg); box-shadow: 3px 4px 0 rgba(107, 74, 58, .4); }
.found { margin: 8px 0 0; font-family: var(--hand); font-size: 17px; min-height: 1.3em; text-align: center; }
.board { display: flex; flex-wrap: wrap; justify-content: center; gap: 24px 14px; max-width: 640px; margin: 18px auto 10px; padding-top: 8px; }
.polaroid { position: relative; width: clamp(140px, 42vw, 182px); aspect-ratio: 4 / 5; transform: rotate(var(--rot, 0deg)); perspective: 900px; transition: transform .35s; display: block; }
.polaroid:hover { transform: rotate(var(--rot, 0deg)) translateY(-4px); }
.polaroid.is-flipped { transform: rotate(0deg) scale(1.1); }
.polaroid .flip { position: absolute; inset: 0; display: block; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1); }
.polaroid.is-flipped .flip { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: #fff;
  border: 3px solid var(--ink); padding: 8px 8px 0; box-shadow: 3px 5px 0 rgba(107, 74, 58, .35); text-align: center; }
.face.front img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; border: 2px solid #eadfcf; background: #f6efe3; }
.cap { flex: 1; display: grid; place-items: center; padding: 4px 2px 6px; font-family: var(--hand); font-size: 15px; line-height: 1.15; }
.face.back { transform: rotateY(180deg); background: var(--pink); padding: 12px 10px; justify-content: center; align-items: center; gap: 6px; overflow: hidden; }
.note-label { font-family: var(--hand); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.msg { font-family: var(--hand); font-size: 15px; line-height: 1.25; flex: 0 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.msg::-webkit-scrollbar { display: none; }
.stamp { position: absolute; right: 6px; bottom: 4px; width: 26px; opacity: .85; }
.stamp svg { width: 100%; height: auto; display: block; }
.tape { position: absolute; top: -12px; left: 50%; width: 64px; height: 22px; margin-left: -32px; z-index: 3; background: rgba(255, 226, 122, .88);
  border: 2px solid rgba(107, 74, 58, .3); transform: rotate(var(--tape-rot, -4deg)); }
.scrap-foot { text-align: center; padding-top: 10px; }

/* =============================================================================
   CHAPTER 4 - BIRTHDAY CAKE : party room with bunting
============================================================================= */
.sc-cake { background-color: #ffe4ec; background-image: repeating-linear-gradient(90deg, transparent 0 38px, rgba(255, 255, 255, .55) 38px 76px); display: flex; flex-direction: column; align-items: center; }
.bunting { position: absolute; top: calc(var(--top) - 10px); left: 0; right: 0; z-index: 1; }
.bunting svg { width: 100%; height: auto; display: block; }
.balloons .bl { position: absolute; width: 46px; animation: floaty 4.5s ease-in-out infinite; z-index: 1; }
.balloons .bl svg { width: 100%; height: auto; display: block; }
.balloons .b1 { left: 4%; top: calc(var(--top) + 100px); }
.balloons .b2 { right: 5%; top: calc(var(--top) + 130px); animation-delay: -1.5s; width: 40px; }
.balloons .b3 { right: 18%; top: calc(var(--top) + 250px); animation-delay: -3s; width: 36px; }
.cake-head { position: relative; z-index: 2; text-align: center; padding: 58px 22px 0; flex: none; }
.cake-head .count { margin: 8px 0 0; font-family: var(--hand); font-size: 18px; min-height: 1.3em; }
.cake-head.celebrate .chapter-title { animation: pop .6s both; color: #e05577; }
.cake-stage { position: relative; flex: 1; min-height: 0; width: 100%; display: grid; justify-items: center; align-items: end; padding: 6px 0 calc(11.5vh + var(--safe-b)); }
.cake-stage .cake { position: relative; z-index: 2; width: min(86vw, 350px); height: auto; max-height: 100%; overflow: visible; }
.glow { position: absolute; left: 50%; bottom: calc(11.5vh + var(--safe-b) + 20px); width: min(80vw, 330px); aspect-ratio: 1; margin-left: calc(min(80vw, 330px) / -2);
  border-radius: 50%; background: rgba(255, 233, 150, .6); opacity: calc(var(--lit, 1) * .85); transition: opacity .7s; }
.table { position: absolute; left: -6%; right: -6%; bottom: -3%; height: 17%; background: #e7c39c; border-top: 4px solid var(--ink); border-radius: 50% 50% 0 0 / 22% 22% 0 0; z-index: 1; }
.candle { cursor: pointer; outline: none; }
.candle:focus-visible .hit { stroke: var(--ink); stroke-width: 3; stroke-dasharray: 5 4; }
.candle .flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker .55s ease-in-out infinite alternate; transition: transform .25s, opacity .25s; }
.candle:hover .flame { transform: scale(1.12); }
.candle.out .flame { animation: none; transform: scale(0); opacity: 0; }
.candle .smoke { opacity: 0; }
.candle.out .smoke { animation: smoke 1.6s ease-out forwards; }
.helper { position: absolute; left: 8px; bottom: calc(6px + var(--safe-b)); width: 78px; z-index: 5; }
.helper svg { width: 100%; height: auto; display: block; }
.helper .bubble { position: absolute; left: 68px; bottom: 78px; width: max-content; max-width: 60vw; transform-origin: 0 100%; text-align: left; border-radius: 20px 20px 20px 8px; }
.helper .bubble::after { left: -9px; bottom: 14px; transform: rotate(135deg); }
.sc-cake > .btn { position: absolute; right: 14px; bottom: calc(18px + var(--safe-b)); z-index: 6; }

/* =============================================================================
   CHAPTER 5 - ACROSS THE DISTANCE : dusk, river, stepping stones
============================================================================= */
.sc-dist { background: linear-gradient(#bccaf0 0%, #cdd0f0 38%, #f6d5e3 72%, #fbe0d6 100%); display: flex; flex-direction: column; --cw: clamp(78px, 23vw, 118px); }
.stars span { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fffbe0; animation: twinkle 3.4s ease-in-out infinite; animation-delay: var(--d); }
.moon { position: absolute; right: 7%; top: calc(var(--top) + 118px); width: 58px; opacity: .95; }
.moon svg { width: 100%; height: auto; display: block; }
.sc-dist .clouds .c1 { top: calc(var(--top) + 150px); width: 84px; }
.sc-dist .clouds .c2 { top: calc(var(--top) + 220px); width: 64px; }
.dist-head { position: relative; z-index: 2; text-align: center; padding: 4px 18px 0; flex: none; }
.miles { margin: 8px 0 0; font-family: var(--hand); font-size: clamp(22px, 6.4vw, 28px); color: #e05577; text-shadow: 0 2px 0 rgba(255, 255, 255, .8); min-height: 1.2em; }
.world { position: relative; flex: 1; min-height: 200px; z-index: 2; }
.river { position: absolute; left: 0; right: 0; bottom: 0; height: 24%; background: var(--water); border-top: 4px solid var(--ink); overflow: hidden; }
.river i { position: absolute; height: 6px; width: 54px; border-radius: 6px; background: rgba(255, 255, 255, .7); animation: ripple 5s ease-in-out infinite; }
.river i:nth-child(1) { left: 34%; top: 38%; } .river i:nth-child(2) { left: 52%; top: 62%; animation-delay: -2s; } .river i:nth-child(3) { left: 62%; top: 30%; animation-delay: -3.5s; width: 40px; }
.cliff { position: absolute; bottom: 0; height: 31%; width: 27%; background: var(--green); border: 4px solid var(--ink); z-index: 1; }
.cliff-l { left: -4px; border-radius: 0 28px 0 0; }
.cliff-r { right: -4px; border-radius: 28px 0 0 0; }
.stone { position: absolute; bottom: calc(31% - 12px); width: 42px; height: 18px; margin-left: -21px; background: var(--mint); border: 3px solid var(--ink); border-radius: 50%;
  transform: scale(0); transition: transform .45s cubic-bezier(.3, 1.7, .5, 1); z-index: 1; }
.stone::after { content: ""; position: absolute; left: 50%; top: 2px; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--pink-2); }
.stone.on { transform: scale(1); }
.who { position: absolute; bottom: calc(31% - 3px); width: var(--cw); z-index: 3; transition: left .18s linear, right .18s linear, margin .5s; }
.who-l { left: calc(3% + var(--p) * (47% - var(--cw))); }
.who-r { right: calc(3% + var(--p) * (47% - var(--cw))); }
.who .char { width: 100%; height: auto; }
.who-r .char { transform: scaleX(-1); }
.who .bubble { position: absolute; bottom: calc(100% + 2px); width: max-content; max-width: min(62vw, 230px); z-index: 4; font-size: 16px; }
.who-l .bubble { left: 0; transform-origin: 20% 100%; text-align: left; }
.who-r .bubble { right: 0; transform-origin: 80% 100%; text-align: left; }
.who-l .bubble::after { left: 24px; }
.who-r .bubble::after { left: auto; right: 24px; }
.sc-dist.walking .who .char { animation: walk .3s ease-in-out infinite alternate; }
.sc-dist.walking .who-r .char { animation-name: walkR; }
.sc-dist.hugging .who-l { margin-left: 12px; }
.sc-dist.hugging .who-r { margin-right: 12px; }
.sc-dist.hugging .who .char { animation: hugpulse 1.4s ease-in-out infinite; transform-origin: 50% 100%; }
.sc-dist.hugging .who-r .char { animation-name: hugpulseR; }
.hug-bubble { position: absolute; left: 50%; bottom: calc(31% + var(--cw) * 1.1); transform-origin: 50% 100%; margin-left: -110px; width: 220px; max-width: 80vw; z-index: 5; }
.hearts { position: absolute; left: 50%; bottom: calc(31% + var(--cw) * .7); width: 0; height: 0; z-index: 6; }
.rise-heart { position: absolute; width: 22px; opacity: 0; animation: rise 2.6s ease-out infinite; }
.rise-heart svg { width: 100%; height: auto; display: block; }
.controls { position: relative; z-index: 3; flex: none; padding: 8px 22px calc(18px + var(--safe-b)); text-align: center; min-height: 112px; }
.controls .btn { margin-top: 18px; }
.slider-label { display: block; font-family: var(--hand); font-size: 19px; margin-bottom: 2px; }
.slider { -webkit-appearance: none; appearance: none; width: min(100%, 420px); height: 46px; margin: 4px 0 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.slider::-webkit-slider-runnable-track { height: 18px; border-radius: 99px; border: 3px solid var(--ink); background: linear-gradient(to right, var(--pink-2) calc(var(--p, 0) * 100%), var(--paper) calc(var(--p, 0) * 100%)); }
.slider::-moz-range-track { height: 12px; border-radius: 99px; border: 3px solid var(--ink); background: linear-gradient(to right, var(--pink-2) calc(var(--p, 0) * 100%), var(--paper) calc(var(--p, 0) * 100%)); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 46px; height: 46px; margin-top: -15px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: 2px 3px 0 var(--ink);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='%23ff9fb5' stroke='%236b4a3a' stroke-width='2'%3E%3Ccircle cx='20' cy='9' r='6.5'/%3E%3Ccircle cx='31' cy='17' r='6.5'/%3E%3Ccircle cx='27' cy='30' r='6.5'/%3E%3Ccircle cx='13' cy='30' r='6.5'/%3E%3Ccircle cx='9' cy='17' r='6.5'/%3E%3C/g%3E%3Ccircle cx='20' cy='20' r='6' fill='%23ffe27a' stroke='%236b4a3a' stroke-width='2'/%3E%3C/svg%3E") center / 30px no-repeat; }
.slider::-moz-range-thumb { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); box-shadow: 2px 3px 0 var(--ink); background-color: #fff; }
.slider:disabled { opacity: .6; cursor: default; }

/* =============================================================================
   CHAPTER 6 - FINAL LETTER : cozy envelope room
============================================================================= */
.sc-letter { background: #fff0d9; }
.petals span { position: absolute; top: -40px; left: var(--x); width: 16px; animation: petalfall var(--t) linear infinite; animation-delay: var(--d); opacity: .9; z-index: 1; }
.petals span svg { width: 100%; height: auto; display: block; }
.envelope-wrap { position: absolute; inset: 0; padding-top: var(--top); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 2; transition: opacity .7s, transform .7s; }
.envelope-wrap .hint { position: static; margin: 4px 0 0; }
.envelope-wrap.gone { opacity: 0; transform: translateY(40px) scale(.96); pointer-events: none; }
.env-for { margin: 0; font-family: var(--hand); font-size: clamp(28px, 8vw, 40px); text-shadow: 0 3px 0 rgba(255, 255, 255, .8); }
.envelope { display: block; width: min(84vw, 350px); animation: bob 2.2s ease-in-out infinite; }
.envelope.open { animation: none; }
.env-svg { width: 100%; height: auto; display: block; overflow: visible; }
.env-flap { transform-box: fill-box; transform-origin: 50% 0%; transition: transform .6s ease-in-out; }
.env-flap .seal { transition: opacity .25s; }
.envelope.open .env-flap { transform: scaleY(-1); }
.envelope.open .env-flap path:first-child { fill: #ffd5e0; }
.envelope.open .seal { opacity: 0; }
.env-paper { transition: transform 1s .5s cubic-bezier(.3, 1.2, .5, 1); }
.envelope.open .env-paper { transform: translateY(-86px); }
.letter-view { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--top) + 6px) 12px calc(40px + var(--safe-b)); opacity: 0; pointer-events: none; transition: opacity .9s; z-index: 3; outline: none; }
.letter-view.on { opacity: 1; pointer-events: auto; }
.letter-paper { position: relative; max-width: 560px; margin: 0 auto; padding: 22px 20px 28px 46px; background-color: var(--paper); background-image: repeating-linear-gradient(transparent 0 33px, #efe3cf 33px 34px);
  border: 4px solid var(--ink); border-radius: 10px 20px 12px 22px; box-shadow: 6px 8px 0 rgba(107, 74, 58, .3); }
.letter-paper::before { content: ""; position: absolute; left: 34px; top: 0; bottom: 0; border-left: 3px solid #ffb3c1; }
.letter-paper::after { content: ""; position: absolute; right: -4px; top: 18px; width: 54px; height: 20px; background: rgba(255, 226, 122, .88); border: 2px solid rgba(107, 74, 58, .3); transform: rotate(35deg); }
.lp { margin: 0 0 34px; font-family: var(--script); font-size: clamp(20px, 5.4vw, 25px); line-height: 34px; opacity: 0; transform: translateY(16px); transition: opacity 1s, transform 1s; }
.lp.show { opacity: 1; transform: none; }
.letter-title { font-size: clamp(26px, 7.4vw, 34px); font-weight: bold; }
.sig { text-align: right; font-size: clamp(22px, 6vw, 28px); line-height: 34px; margin-bottom: 20px; }
.letter-end { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 0; }
.end-bunny { width: 110px; }
.end-bunny svg { width: 100%; height: auto; display: block; }

/* =============================================================================
   ANIMATIONS
============================================================================= */
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes wave { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-7px) rotate(-3deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes flspin { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(1.25); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 240px)); } }
@keyframes flyby { 0% { transform: translate(-60px, 0); } 25% { transform: translate(30vw, -50px); } 50% { transform: translate(55vw, 20px); } 75% { transform: translate(80vw, -40px); } 100% { transform: translate(110vw, 0); } }
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.3); } }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 30% { transform: translateY(-34px) scale(.94, 1.08); } 60% { transform: translateY(0) scale(1.08, .9); } 80% { transform: translateY(-6px); } }
@keyframes spin { 0% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-46px) rotate(180deg); } 100% { transform: translateY(0) rotate(360deg); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-7deg); } 40% { transform: rotate(6deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
@keyframes dashL { 0%, 100% { transform: translateX(0); } 35%, 60% { transform: translateX(-22vw); } }
@keyframes dashR { 0%, 100% { transform: translateX(0); } 35%, 60% { transform: translateX(22vw); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(-9deg) scale(1.05); } 30% { transform: rotate(8deg) scale(1.08); } 45% { transform: rotate(-8deg) scale(1.1); } 60% { transform: rotate(7deg) scale(1.1); } 80% { transform: rotate(-3deg) scale(1.12); } }
@keyframes lidfly { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(24px, -120px) rotate(28deg); opacity: 0; } }
@keyframes spark { 0% { transform: translate(0, 0) scale(.3) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(120deg); opacity: 0; } }
@keyframes pageIn { from { transform: translateX(40px) rotate(2deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pageOut { to { transform: translateX(-60px) rotate(-4deg); opacity: 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-2deg) translateX(-5px); } 50% { transform: rotate(2deg) translateX(5px); } 75% { transform: rotate(-1deg) translateX(-3px); } }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }
@keyframes flicker { from { transform: scale(1, 1) rotate(-3deg); } to { transform: scale(.9, 1.1) rotate(3deg); } }
@keyframes smoke { 0% { opacity: .9; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-26px); } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.3); } }
@keyframes ripple { 0%, 100% { transform: translateX(0); opacity: .7; } 50% { transform: translateX(18px); opacity: .3; } }
@keyframes walk { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-9px) rotate(3deg); } }
@keyframes walkR { from { transform: scaleX(-1) translateY(0) rotate(3deg); } to { transform: scaleX(-1) translateY(-9px) rotate(-3deg); } }
@keyframes hugpulse { 0%, 100% { transform: scale(1, 1) rotate(5deg); } 50% { transform: scale(1.04, .95) rotate(7deg); } }
@keyframes hugpulseR { 0%, 100% { transform: scaleX(-1) scale(1, 1) rotate(5deg); } 50% { transform: scaleX(-1) scale(1.04, .95) rotate(7deg); } }
@keyframes rise { 0% { transform: translate(0, 0) scale(.5); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), -150px) scale(1.1); opacity: 0; } }
@keyframes petalfall { 0% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(40px, 50vh) rotate(180deg); } 100% { transform: translate(-20px, 110vh) rotate(360deg); } }

/* =============================================================================
   LOADING SCREEN : meadow, bouncing runner, blooming flowers, candy-stripe bar
============================================================================= */
.loader { position: fixed; inset: 0; z-index: 100; overflow: hidden;
  transition: opacity .7s, transform .7s; }
.loader.leave { opacity: 0; transform: scale(1.06); pointer-events: none; }
.loader.has-bg .meadow { display: none; }
.loader .meadow { position: absolute; inset: 0; width: 100%; height: 100%; }
.ld-petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.ld-box { position: relative; z-index: 2; width: min(70vw, 310px); text-align: center; padding-top: 6px; }
.ld-box::before { content: ""; position: absolute; left: -28%; right: -28%; top: -26px; bottom: -70px; border-radius: 50%; background: rgba(255, 255, 255, .34); z-index: -1; }
.ld-title { margin: 0 0 88px; font-family: var(--hand); font-size: clamp(21px, 6vw, 27px); line-height: 1.15; min-height: 2.3em; display: flex; align-items: flex-end; justify-content: center;
  color: var(--ink); text-shadow: 0 2px 0 rgba(255, 255, 255, .8); }
.ld-title.pop { animation: pop .45s both; }
.ld-bar { position: relative; height: 30px; border: 4px solid var(--ink); border-radius: 99px; background: var(--paper); box-shadow: 3px 5px 0 var(--ink); }
.ld-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 100%); border-radius: 99px; overflow: hidden;
  background: repeating-linear-gradient(-45deg, #ff8fab 0 11px, #ffb3c6 11px 22px); background-size: 31px 31px; animation: ldstripe .7s linear infinite; }
.ld-fill::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .55); }
.ld-bloom { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.ld-bloom .flower { position: absolute; bottom: calc(100% - 8px); width: 34px; height: auto; margin-left: -17px; transform: scale(0) rotate(-50deg); transform-origin: 50% 100%;
  transition: transform .55s cubic-bezier(.3, 1.9, .5, 1); }
.ld-bloom .flower.on { transform: scale(1) rotate(0); }
.ld-trail { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.ld-spark { position: absolute; bottom: calc(100% - 2px); width: 14px; margin-left: -7px; animation: ldspark .9s ease-out forwards; }
.ld-spark svg { width: 100%; height: auto; display: block; }
.ld-mochi { position: absolute; z-index: 3; left: calc(var(--p, 0) * 100%); bottom: calc(100% - 7px); width: 78px; margin-left: -39px; pointer-events: none; }
.ld-mochi:has(.ld-img) { width: 92px; margin-left: -46px; bottom: calc(100% - 9px); }
.ld-hop { transform-origin: 50% 100%; animation: ldhop .42s ease-in-out infinite alternate; }
.ld-hop > svg, .ld-hop > img { width: 100%; height: auto; display: block; }
.ld-hop > .ld-flip { animation: ldflip .8s ease-in-out; }
.ld-shadow { position: absolute; left: 50%; bottom: -3px; width: 46px; height: 9px; margin-left: -23px; border-radius: 50%; background: rgba(90, 60, 40, .28); animation: ldshadow .42s ease-in-out infinite alternate; }
.loader.done .ld-hop { animation: hop .8s ease-out infinite; }
.loader.done .ld-shadow { animation: ldshadow .8s ease-out infinite alternate; }
.loader.done .ld-bar { animation: ldflash .7s ease-out; }
.ld-pct { margin: 20px 0 0; font-family: var(--hand); font-size: 34px; line-height: 1; color: var(--ink); text-shadow: 0 3px 0 rgba(255, 255, 255, .85); }
.ld-pct.bump { animation: pop .35s both; }
.ld-tap { margin: 18px -20px 0; padding: 10px 14px; font-size: 19px; white-space: nowrap; animation: pop .5s both, wiggle 1.6s 1s ease-in-out infinite; }
@keyframes ldhop { from { transform: translateY(0) scale(1.06, .94); } to { transform: translateY(-13px) scale(.95, 1.05); } }
@keyframes ldshadow { from { transform: scale(1.05); opacity: .9; } to { transform: scale(.65); opacity: .5; } }
@keyframes ldflip { 0% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-28px) rotate(180deg) scale(1.1); } 100% { transform: translateY(0) rotate(360deg); } }
@keyframes ldstripe { to { background-position: 31px 0; } }
@keyframes ldflash { 0%, 100% { filter: none; } 40% { filter: brightness(1.14); } }
@keyframes ldspark { from { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); } to { opacity: 0; transform: translate(var(--dx, -14px), 24px) rotate(160deg) scale(.4); } }

/* ---- zoom into the button, flood with yellow, pull the ribbon ---- */
.ld-world { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; background-color: #c3e6ae; background-size: cover; background-position: center;
  transform-origin: var(--zx, 50%) var(--zy, 50%); }
.loader.zoom .ld-world { transform: scale(3.2); transition: transform .95s cubic-bezier(.6, .02, .9, .35); }
.loader.zoom .ld-box { pointer-events: none; }
.loader.covered .ld-world { display: none; }
.ld-flood { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: visible;
  background-color: var(--butter-2); background-image: radial-gradient(rgba(255, 255, 255, .42) 3px, transparent 3.5px); background-size: 30px 30px;
  clip-path: circle(0px at var(--fx, 50%) var(--fy, 50%)); }
.loader.zoom .ld-flood { clip-path: circle(var(--fr, 1400px) at var(--fx, 50%) var(--fy, 50%)); transition: clip-path .8s cubic-bezier(.5, 0, .3, 1) .15s; }
.loader.covered .ld-flood { clip-path: none; pointer-events: auto; transition: transform 1.05s cubic-bezier(.7, 0, .25, 1); }
.ld-flood::after { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 26px;
  background: radial-gradient(circle at 13px 100%, var(--butter-2) 13px, transparent 14px) 0 0 / 26px 26px repeat-x; }
.ld-pulltext { position: absolute; left: 0; right: 0; top: 56%; margin: 0; padding: 0 16px; text-align: center; font-family: var(--hand); font-size: clamp(46px, 15vw, 70px); line-height: 1;
  color: var(--ink); text-shadow: 0 4px 0 rgba(255, 255, 255, .85); visibility: hidden; }
.ld-pulltext small { display: block; margin-top: 12px; font-size: clamp(17px, 4.8vw, 22px); color: var(--ink-soft); text-shadow: none; }
.loader.covered .ld-pulltext { visibility: visible; animation: pop .6s .55s backwards, pullbob 1.5s 1.2s ease-in-out infinite; }
.rb { position: absolute; top: 0; left: 50%; width: 120px; margin-left: -60px; transform-origin: 50% 0; cursor: grab; touch-action: none; visibility: hidden; outline-offset: 4px; }
.rb.dragging { cursor: grabbing; }
.loader.covered .rb { visibility: visible; animation: ribdrop 1.05s cubic-bezier(.3, 1.45, .5, 1) .2s backwards; }
.rb-in { transform-origin: 50% 0; animation: rbsway 2.6s 1.4s ease-in-out infinite; }
.rb.dragging .rb-in, .rb.go .rb-in { animation: none; }
.rb-svg { display: block; width: 100%; height: auto; }
@keyframes ribdrop { from { transform: translateY(-105%); } to { transform: translateY(0); } }
@keyframes rbsway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }
@keyframes pullbob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-9px) rotate(2deg); } }

/* ---- the opening letter, revealed when the yellow page is pulled down ---- */
.ld-letter { position: absolute; inset: 0; z-index: 3; visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  padding: calc(var(--safe-t) + 34px) 14px calc(124px + var(--safe-b)); background-color: #c3e6ae; background-image: var(--ld-bg, none); background-size: cover; background-position: center; }
.loader.covered .ld-letter { visibility: visible; }
.il-petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.il-sheet { position: relative; z-index: 2; width: min(90vw, 520px); transform: scale(0); opacity: 0; }
.ld-letter.show .il-sheet { animation: ilunfold 1s cubic-bezier(.3, 1.35, .5, 1) forwards; }
.il-tape { position: absolute; z-index: 3; top: -13px; left: 50%; width: 86px; height: 26px; margin-left: -43px; background: rgba(255, 226, 122, .92); border: 2px solid rgba(107, 74, 58, .3); transform: rotate(-3deg); }
.il-paper { position: relative; max-height: calc(100vh - 270px); max-height: calc(100dvh - 270px); overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 28px 20px 18px 46px; background-color: var(--paper); background-image: repeating-linear-gradient(transparent 0 33px, #e9efdc 33px 34px);
  border: 4px solid var(--ink); border-radius: 10px 20px 12px 22px; box-shadow: 6px 8px 0 rgba(107, 74, 58, .3); }
.il-paper::before { content: ""; position: absolute; left: 34px; top: 0; bottom: 0; border-left: 3px solid #ffb3c1; }
.il-title, .il-p, .il-sig { margin: 0 0 34px; font-family: var(--script); font-size: clamp(19px, 5.2vw, 24px); line-height: 34px; }
.il-title { font-size: clamp(25px, 6.8vw, 32px); font-weight: bold; }
.il-sig { text-align: right; margin-bottom: 8px; }
.il-paper .w { display: inline-block; opacity: 0; }
.ld-letter.show .il-paper .w { animation: ilword .55s var(--d, 1.3s) both; }
.il-friends { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.il-friend { position: absolute; width: var(--s, 90px); opacity: 0; --from: 115%; }
.il-friend img, .il-friend svg { display: block; width: 100%; height: auto; }
.il-friend.pos-bl { left: 6px; bottom: calc(14px + var(--safe-b)); }
.il-friend.pos-br { right: 6px; bottom: calc(14px + var(--safe-b)); }
.il-friend.pos-bc { left: 50%; margin-left: calc(var(--s, 90px) / -2); bottom: calc(14px + var(--safe-b)); }
.il-friend.pos-tl { left: 6px; top: calc(var(--safe-t) + 6px); --from: -115%; }
.il-friend.pos-tr { right: 6px; top: calc(var(--safe-t) + 6px); --from: -115%; }
.ld-letter.show .il-friend { animation: ilpeek .9s cubic-bezier(.3, 1.5, .5, 1) calc(1.6s + var(--k, 0) * .35s) both, ilbob 2.6s ease-in-out calc(2.8s + var(--k, 0) * .35s) infinite; }
.il-go { position: absolute; z-index: 5; left: 0; right: 0; bottom: calc(34px + var(--safe-b)); margin: 0 auto; width: fit-content; }
@keyframes ilunfold { from { transform: translateY(55%) rotate(-9deg) scale(.15); opacity: 0; } to { transform: rotate(-1.2deg) scale(1); opacity: 1; } }
@keyframes ilword { from { opacity: 0; transform: translateY(8px) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes ilpeek { from { opacity: 1; transform: translateY(var(--from, 115%)); } to { opacity: 1; transform: none; } }
@keyframes ilbob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }

/* ---- the birthday lock: envelope with dots, question and keypad ---- */
.ld-lock { position: absolute; inset: 0; z-index: 4; visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; overflow: hidden;
  padding: calc(var(--safe-t) + 18px) 16px calc(14px + var(--safe-b)); background-color: #c3e6ae; background-size: cover; background-position: center; }
.loader.covered .ld-lock.show { visibility: visible; animation: lkin .6s ease-out both; }
.ld-lock.gone { opacity: 0; pointer-events: none; transition: opacity .8s; }
.lk-q { margin: 0; max-width: 16em; text-align: center; font-family: var(--hand); font-size: clamp(26px, 7.6vw, 34px); line-height: 1.1; color: var(--ink); text-shadow: 0 3px 0 rgba(255, 255, 255, .85); }
.lk-hint { margin: 0; min-height: 1.2em; text-align: center; font-size: 15px; color: var(--ink-soft); text-shadow: 0 1px 0 rgba(255, 255, 255, .8); }
.lk-env { position: relative; width: min(78vw, 310px); margin: 6px 0 0; }
.lk-env .env-svg { width: 100%; height: auto; display: block; overflow: visible; }
.lk-env.lk-shake { animation: lkshake .55s ease-in-out; }
.lk-plate { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 7px 16px; white-space: nowrap;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 2px 3px 0 var(--ink); transition: opacity .3s; }
.lk-env.open .lk-plate { opacity: 0; }
.lk-slash { font-family: var(--hand); font-size: 26px; line-height: 1; color: var(--ink); }
.lk-dot { display: block; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); transition: background .15s, transform .15s; }
.lk-dot.on { background: var(--pink-2); transform: scale(1.12); }
.lk-dot.bad { background: #ff7b7b; animation: wobble .5s both; }
.lk-dot.ok { background: var(--green); animation: pop .5s both; }
.lk-msg { margin: 0; min-height: 1.5em; text-align: center; font-family: var(--hand); font-size: 20px; color: var(--ink); }
.lk-msg.bad { color: #c0392b; } .lk-msg.good { color: #3f8a4f; }
.lk-pad { --k: clamp(50px, 8.2vh, 66px); display: grid; grid-template-columns: repeat(3, var(--k)); gap: 10px; margin-top: 4px; }
.lk-key { width: var(--k); height: var(--k); display: grid; place-items: center; border-radius: 50%; background: var(--butter-2); border: 3px solid var(--ink); box-shadow: 2px 4px 0 var(--ink);
  font-family: var(--hand); font-size: calc(var(--k) * .46); color: var(--ink); transition: transform .1s, box-shadow .1s; }
.lk-key:active { transform: translate(2px, 3px); box-shadow: 0 1px 0 var(--ink); }
.lk-key.back { background: var(--pink); }
@keyframes lkin { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes lkshake { 0%, 100% { transform: translateX(0) rotate(0); } 15% { transform: translateX(-12px) rotate(-3deg); } 35% { transform: translateX(10px) rotate(3deg); } 55% { transform: translateX(-8px) rotate(-2deg); } 75% { transform: translateX(5px) rotate(1deg); } }

/* ---- the letter slides up and out of the envelope ---- */
.lk-env.out .env-paper { transform: translateY(-1500px); transition: transform .95s cubic-bezier(.5, 0, .9, .4); }

/* ---- the menu: a big letter with three options ---- */
.sc-menu { display: flex; align-items: center; justify-content: center; background-color: #c3e6ae; background-size: cover; background-position: center;
  padding: calc(var(--top) + 24px) 12px calc(112px + var(--safe-b)); }
.mn-sheet { position: relative; z-index: 2; width: min(94vw, 540px); max-height: 100%; display: flex; flex-direction: column; transform: rotate(-.8deg); }
.sc-menu.intro .mn-sheet { animation: mndrop 1.15s cubic-bezier(.3, 1.3, .5, 1) .15s both; }
.mn-tape { position: absolute; z-index: 3; top: -13px; left: 50%; width: 90px; height: 26px; margin-left: -45px; background: rgba(255, 226, 122, .92); border: 2px solid rgba(107, 74, 58, .3); transform: rotate(-3deg); }
.mn-paper { position: relative; display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - var(--top) - 160px); max-height: calc(100dvh - var(--top) - 160px);
  padding: 20px 16px 14px 44px; background-color: var(--paper);
  border: 4px solid var(--ink); border-radius: 10px 22px 12px 24px; box-shadow: 6px 8px 0 rgba(107, 74, 58, .3); }
.mn-paper::before { content: ""; position: absolute; left: 32px; top: 0; bottom: 0; border-left: 3px solid #ffb3c1; }
.mn-text { --fs: 21px; --lh: 34px; flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: none; margin-bottom: 6px;
  background-image: repeating-linear-gradient(transparent 0 calc(var(--lh) - 1px), #e9efdc calc(var(--lh) - 1px) var(--lh)); }
.mn-text::-webkit-scrollbar { display: none; }
.mn-text.scrolls { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); }
.mn-title, .mn-p, .mn-sig { margin: 0; font-family: var(--script); font-size: var(--fs); line-height: var(--lh); }
.mn-title { font-size: calc(var(--fs) * 1.3); font-weight: bold; margin-bottom: var(--lh); }
.mn-p { text-indent: 1.4em; }
.mn-sig { text-align: right; }
.mn-paper .w { display: inline-block; }
.sc-menu.intro .mn-paper .w { opacity: 0; animation: ilword .55s var(--d, 1.5s) both; }
.mn-heading { flex: none; margin: 2px 0 6px; font-family: var(--hand); font-size: 18px; line-height: 1.15; color: var(--ink-soft); }
.mn-opts { flex: none; display: grid; gap: 9px; padding: 2px 0; }
.mn-opt { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 6px 18px 6px 14px; text-align: left;
  font-family: var(--hand); font-size: clamp(22px, 6.4vw, 27px); line-height: 1.05; color: var(--ink); background: var(--butter-2); border: 3px solid var(--ink);
  border-radius: 20px 26px 20px 28px / 26px 20px 28px 20px; box-shadow: 4px 5px 0 var(--ink); transition: transform .12s, box-shadow .12s;
  animation: pop .55s calc(var(--k, 0) * .12s + var(--ow, .1s)) backwards; }
.mn-opt.mo1 { background: var(--pink); } .mn-opt.mo2 { background: #cfeaf7; }
.mn-opt:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.mn-opt small { display: block; margin-top: 3px; font-size: .52em; opacity: .75; }
.mn-ico { flex: none; width: 40px; height: 40px; }
.mn-ico svg { display: block; width: 100%; height: 100%; }
.mn-opt.done { padding-right: 58px; }
.mn-opt.done::after { content: "\2713"; position: absolute; right: 14px; top: 50%; width: 32px; height: 32px; margin-top: -16px; display: grid; place-items: center;
  background: var(--green); border: 3px solid var(--ink); border-radius: 50%; font-size: 19px; line-height: 1; font-family: var(--round); }
.sc-menu .il-friend { opacity: 0; animation: ilpeek .9s cubic-bezier(.3, 1.5, .5, 1) calc(var(--fd, .2s) + var(--k, 0) * .35s) both, ilbob 2.6s ease-in-out calc(var(--fd, .2s) + 1.2s + var(--k, 0) * .35s) infinite; }
.sc-menu .il-friend.pos-tl, .sc-menu .il-friend.pos-tr { top: calc(var(--top) - 8px); }
@keyframes mndrop { from { transform: translateY(-120%) rotate(-9deg) scale(.5); } to { transform: rotate(-.8deg) scale(1); } }

/* ---- picture characters and the little friends that peek in everywhere ---- */
img.pic { display: block; width: 100%; height: auto; pointer-events: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.deco { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.deco .il-friend { opacity: 0; animation: ilpeek .9s cubic-bezier(.3, 1.5, .5, 1) calc(.6s + var(--k, 0) * .3s) both, ilbob 2.8s ease-in-out calc(1.8s + var(--k, 0) * .3s) infinite; }
.il-friend.pos-ml { left: 4px; top: 46%; --from: -115%; }
.il-friend.pos-mr { right: 4px; top: 46%; --from: 115%; }
.lk-env .deco { display: none; }

/* ---------- bigger screens: keep the phone-style layout centred and comfy ---------- */
@media (min-width: 760px) {
  .intro { font-size: 18px; }
  .answer { font-size: 20px; }
  .mascot { width: 250px; margin-left: -125px; }
  .who { --cw: 120px; }
}

/* ---------- reduced motion: no flying, spinning or looping ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .clouds .cloud, .bfly, .petals span, .rise-heart { animation: none !important; }
  .clouds .cloud { left: 12%; }
  .bfly, .petals { display: none; }
}

/* the final letter: her song button */
.song-btn { background: linear-gradient(#ffd6e0, #ff9fb5); color: #5b2a3a; }
.song-btn.playing { background: linear-gradient(#fff2b0, #ffd84a); }
/* the song player: a dreamy night sky, a spinning record with Usagi, and dancing bars */
.song-stage { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: calc(var(--top) + 6px) 18px calc(26px + var(--safe-b)); background: radial-gradient(120% 90% at 50% 20%, #6d4aa8 0%, #3b2a6b 52%, #241a46 100%); color: #fff; opacity: 0; visibility: hidden; transition: opacity .7s, visibility 0s .7s; overflow: hidden; --b: 0; }
.song-stage.on { opacity: 1; visibility: visible; transition: opacity .7s; }
.ss-stars span { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #fff7c8; opacity: .8; animation: twinkle 3s var(--d) ease-in-out infinite; }
.ss-glow { position: absolute; left: 50%; top: 36%; width: 120vw; max-width: 640px; aspect-ratio: 1; transform: translate(-50%, -50%) scale(calc(.85 + var(--b) * .5)); border-radius: 50%; background: radial-gradient(circle, rgba(255, 159, 181, .55), rgba(255, 159, 181, 0) 62%); opacity: calc(.35 + var(--b) * .65); transition: transform .08s linear, opacity .08s linear; pointer-events: none; }
.ss-notes { position: absolute; inset: 0; pointer-events: none; }
.ss-note { position: absolute; bottom: 4%; color: #ffd6e0; text-shadow: 0 0 10px rgba(255, 190, 210, .9); opacity: 0; animation: ssRise var(--t) ease-in forwards; }
@keyframes ssRise { 0% { transform: translate(0, 0) rotate(-8deg); opacity: 0; } 12% { opacity: .95; } 100% { transform: translate(var(--dx), -78vh) rotate(14deg); opacity: 0; } }
.ss-disc { position: relative; width: min(58vw, 240px); aspect-ratio: 1; z-index: 2; }
.ss-vinyl { position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle at 50% 50%, #1b1230 0 3px, #2a1d48 3px 5px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 4px rgba(255, 255, 255, .12); animation: ssSpin 5s linear infinite; animation-play-state: paused; }
.ss-vinyl::before { content: ""; position: absolute; inset: 31%; border-radius: 50%; background: conic-gradient(#ffc6d3, #ffe9a0, #bfe9ff, #ffc6d3); }
.ss-vinyl::after { content: ""; position: absolute; left: 12%; top: 10%; width: 34%; height: 18%; border-radius: 50%; background: linear-gradient(120deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, 0)); transform: rotate(-30deg); }
.song-stage.playing .ss-vinyl { animation-play-state: running; }
@keyframes ssSpin { to { transform: rotate(360deg); } }
.ss-usagi { position: absolute; left: 50%; bottom: 8%; width: 74%; transform: translateX(-50%) scale(calc(1 + var(--b) * .1)); transform-origin: 50% 100%; transition: transform .08s linear; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.song-stage.playing .ss-usagi { animation: ssBob 1.1s ease-in-out infinite alternate; }
@keyframes ssBob { from { margin-bottom: 0; rotate: -3deg; } to { margin-bottom: 8px; rotate: 3deg; } }
.ss-usagi img { width: 100%; height: auto; display: block; }
.ss-title { margin: 6px 0 0; font-family: var(--hand); font-size: clamp(28px, 8.5vw, 40px); line-height: 1.05; text-align: center; text-shadow: 0 2px 12px rgba(255, 159, 181, .8); z-index: 2; }
.ss-sub { margin: 0; font-size: 17px; opacity: .85; text-align: center; z-index: 2; }
.ss-eq { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 70px; width: min(86vw, 340px); z-index: 2; }
.ss-eq i { flex: 1; height: 100%; border-radius: 6px 6px 3px 3px; background: linear-gradient(#ffe9a0, #ff9fb5); transform: scaleY(.12); transform-origin: 50% 100%; transition: transform .07s linear; }
.ss-prog { width: min(80vw, 300px); height: 7px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; z-index: 2; }
.ss-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe9a0, #ff9fb5); border-radius: 99px; }
.ss-time { margin: 0; font-size: 14px; opacity: .8; z-index: 2; }
.ss-btns { display: flex; align-items: center; gap: 14px; z-index: 2; }
.ss-play { width: 62px; height: 62px; border-radius: 50%; border: 3px solid #fff; background: linear-gradient(#ffd6e0, #ff9fb5); color: #5b2a3a; display: grid; place-items: center; cursor: pointer; box-shadow: 0 5px 16px rgba(0, 0, 0, .35); }
.ss-play svg { width: 28px; height: 28px; }
.ss-play:active { transform: scale(.93); }
.song-stage .btn.ghost { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .6); }
@media (prefers-reduced-motion: reduce) { .ss-vinyl, .song-stage.playing .ss-usagi, .ss-stars span { animation: none !important; } }
/* your own pictures on the bridge: shown as they are (not mirrored), optionally in a round frame */
.who-r .char.own { transform: none; }
.sc-dist.walking .who-r .char.own { animation-name: walk; }
.sc-dist.hugging .who-r .char.own { animation-name: hugpulse; }
.who .char.own.round { border-radius: 50%; aspect-ratio: 1 / 1; object-fit: cover; border: 4px solid #fff; box-shadow: 0 5px 14px rgba(120, 60, 80, .28); background: #fff; }

/* small hint on the loading screen so her first tap switches the sound on before the bar finishes */
.ld-soundhint { margin: 10px 0 0; padding: 5px 12px; font-size: 14px; color: var(--ink-soft); background: rgba(255, 255, 255, .72); border-radius: 999px; animation: pop .5s .6s both; }
.ld-soundhint:empty, .ld-soundhint.gone { display: none; }
.loader.done .ld-soundhint { display: none; }

/* the picture in the middle of the record */
.ss-cd { position: absolute; left: 50%; top: 50%; width: 66%; aspect-ratio: 1; transform: translate(-50%, -50%) scale(calc(1 + var(--b) * .06)); border-radius: 50%; overflow: hidden; border: 4px solid #fff; background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .45); transition: transform .08s linear; }
.ss-cd img { width: 100%; height: 100%; object-fit: cover; display: block; }
.song-stage.playing .ss-cd { animation: ssCdBob 1.1s ease-in-out infinite alternate; }
@keyframes ssCdBob { from { rotate: -3deg; } to { rotate: 3deg; } }
@media (prefers-reduced-motion: reduce) { .song-stage.playing .ss-cd { animation: none !important; } }

/* the present: Usagi hides in the gift, then pops out when the cover comes off */
.mascot.wait .bunny-btn { opacity: 0; pointer-events: none; transform: translateY(46%) scale(.3); }
.mascot.emerge .bunny-btn { animation: emerge .8s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes emerge { 0% { opacity: 1; transform: translateY(46%) scale(.3); } 55% { opacity: 1; transform: translateY(-9%) scale(1.07); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
.mascot .gift-btn { transition: width .6s ease, margin-left .6s ease, bottom .6s ease; }
.mascot.wait .gift-btn { width: 66%; margin-left: -33%; bottom: 4%; }
