/* Palette and rules from Echo Valley's STYLE.md so the set looks like one moonlit mountain world. */
:root {
  --ink: #5b3f37; --paper: #fff6e6; --paper-d: #f1dfc4; --night0: #0d0f2b; --night1: #232457; --night2: #2d2a5e;
  --moon: #fff3c4; --lantern: #ffb347; --lantern-d: #c9772a; --coral: #f2706a; --coral-d: #b84a52;
  --wood: #d79d5e; --wood-d: #b77b45; --mint: #bfe3c3; --lav: #cfc3ef; --pinkt: #f6c2cf; --butter: #ffe7a0;
  --green: #59b37a; --shade: rgba(10, 8, 30, .45);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .36 0 0 0 0 .25 0 0 0 0 .2 0 0 0 .11 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --font: Jua, 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night0); color: var(--moon); font-family: var(--font);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; touch-action: manipulation; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 3px solid var(--lantern); outline-offset: 3px; }
[hidden] { display: none !important; }
svg { display: block; }

body.titling .app { visibility: hidden; }
#sky { position: fixed; inset: 0; background: #0b0d29; overflow: hidden; }
#sky > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* the moon stays near the play column on any screen shape */
#sky .moon { position: absolute; top: max(9vh, 66px); right: max(7vw, calc(50vw - 340px)); width: clamp(64px, 11vh, 104px); aspect-ratio: 1;
  border-radius: 50%; box-shadow: 0 0 40px 12px rgba(255, 243, 196, .32), 0 0 140px 60px rgba(205, 212, 255, .14); }
#sky .moon svg { width: 100%; height: 100%; }
#sky .tw { animation: twinkle 3.2s ease-in-out infinite; animation-delay: calc(var(--k) * -.47s); }
#sky .cloud { animation: drift 90s linear infinite alternate; } #sky .c2 { animation-duration: 120s; animation-direction: alternate-reverse; }
.fly { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #fff3a0; box-shadow: 0 0 8px 3px rgba(255, 230, 120, .55);
  animation: firefly 9s ease-in-out infinite, glowfly 2.6s ease-in-out infinite; animation-delay: calc(var(--k) * -1.3s), calc(var(--k) * -.7s); }
/* paper grain over everything: the handmade-toy finish */
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 50; background: var(--grain); background-size: 140px; mix-blend-mode: overlay; opacity: .7; }

.app { position: relative; width: min(100vw, 540px); height: 100dvh; margin: 0 auto; display: flex; flex-direction: column;
  padding: var(--safe-t) 0 var(--safe-b); overflow: visible; container-type: inline-size; }

/* ---------- top bar ---------- */
.top { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 6px 8px; z-index: 5; }
.sp { flex: 1; }
.ib { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--paper) var(--grain);
  color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--paper-d), 0 6px 0 var(--ink); transition: transform .1s; }
.ib svg { width: 24px; height: 24px; }
.ib:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.grown { position: relative; opacity: .8; }
.grown .ring { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; }
.grown .ring circle { fill: none; stroke: var(--lantern); stroke-width: 3; stroke-dasharray: 107; stroke-dashoffset: 107; }
.grown.holding .ring circle { transition: stroke-dashoffset 1.6s linear; stroke-dashoffset: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 20px; background: var(--wood);
  color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--wood-d); font-size: 18px; white-space: nowrap; }
.chip .dots { display: inline-flex; gap: 4px; }
.chip .dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); }
.chip .dots i.done { background: var(--green); }
.chip .dots i.now { background: var(--lantern); animation: blink 1s infinite alternate; }

.screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- street ---------- */
.village { position: absolute; inset: 0 0 86px; display: flex; justify-content: center; }
.village svg { width: 100%; height: 100%; overflow: visible; }
#street { overflow: visible; }
.village .mlive.next { cursor: pointer; }
.village .ring { animation: ringpulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.village .arrow { animation: bob 1s ease-in-out infinite; }
.village .smoke circle { fill: #e8e4f0; opacity: 0; animation: smoke 4.5s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.village .smoke circle:nth-child(2) { animation-delay: 1.5s; } .village .smoke circle:nth-child(3) { animation-delay: 3s; }
.village .ffly { animation: glowfly 2.4s ease-in-out infinite, fireflyS 8s ease-in-out infinite; animation-delay: calc(var(--k) * -.9s); transform-box: fill-box; }
.village .pulse { animation: pulse 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.village .mh.today:not(.next):not(.done) { opacity: .95; }
.village .mlan.on ellipse { animation: flicker 2.4s ease-in-out infinite; }
.village .mlan.newlit ellipse { animation: lightup 1s ease-out both; }
.streetbar { position: absolute; left: 0; right: 0; bottom: 0; box-shadow: 0 30px 0 100vmax transparent; display: flex; align-items: flex-end; gap: 10px; padding: 0 12px 12px; z-index: 2;
  background: linear-gradient(transparent, rgba(13, 15, 43, .55) 60%); }
.cart { flex: 1; height: 84px; position: relative; }
.cart > svg { position: absolute; left: 0; bottom: 0; height: 90px; width: auto; overflow: visible; }
.cart .appr { animation: tug 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.cart .keeps { position: absolute; left: 34px; bottom: 44px; display: flex; flex-wrap: wrap-reverse; gap: 1px; width: 150px; }
.cart .keeps span { width: 22px; height: 22px; animation: hop 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.4s); }
.cart .keeps span.new { animation: giftin 1.2s cubic-bezier(.3, 1.6, .5, 1) both; }
.go { width: 92px; height: 92px; border-radius: 50%; background: var(--coral) var(--grain); color: var(--paper); border: 4px solid var(--ink);
  box-shadow: 0 6px 0 var(--coral-d), 0 8px 0 var(--ink), 0 0 30px rgba(242, 112, 106, .45); display: grid; place-items: center; animation: breathe 1.8s ease-in-out infinite; }
.go svg { width: 46px; height: 46px; margin-left: 6px; }
.go:active { transform: translateY(5px) scale(.96); box-shadow: 0 2px 0 var(--ink); }

.card { background: var(--paper) var(--grain); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px 26px 20px 28px;
  box-shadow: 0 8px 0 var(--paper-d), 0 10px 0 var(--ink), 0 18px 30px var(--shade); }
.dayend { position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%); width: min(92%, 360px); padding: 18px 16px 20px; text-align: center;
  animation: dropin .6s cubic-bezier(.3, 1.6, .5, 1) both; z-index: 4; }
.dayend h2 { margin: 0 0 10px; font-size: 30px; font-weight: normal; }
.dayend .faces { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.dayend .face { width: 70px; }
.dayend .face .pic { height: 62px; display: flex; align-items: flex-end; justify-content: center; }
.dayend .face .pic svg { height: 100%; width: auto; }
.dayend .face .hs { display: flex; justify-content: center; gap: 1px; margin-top: 4px; }
.hs i { width: 16px; height: 16px; color: var(--coral); }
.hs i svg { width: 100%; height: 100%; }
.hs i.part { color: #f6c2cf; }
.hs i.empty { color: #d8c8b8; }
.bigbtn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 30px; background: var(--coral) var(--grain);
  border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--coral-d), 0 7px 0 var(--ink); color: var(--paper); font-size: 24px; -webkit-text-stroke: .5px var(--ink); }
.bigbtn svg { width: 26px; height: 26px; }
.bigbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }

/* ---------- door scene ---------- */
.scene { flex: 1 1 auto; min-height: 0; position: relative; display: flex; align-items: flex-end; justify-content: center; }
.facade { position: relative; container-type: inline-size; animation: zoomin .55s cubic-bezier(.3, 1.3, .5, 1) both; }
.fsvg, .fsvg svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fsvg .lan.on .halo { animation: flicker 2.4s ease-in-out infinite; }
.fsvg .steam { animation: steam 3s ease-in-out infinite; }
.plate, .hearts { position: absolute; top: 40.6%; height: 6.4%; display: grid; place-items: center; padding: 0 2cqw; background: var(--wood) var(--grain);
  border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); font-size: 4.6cqw; white-space: nowrap; box-shadow: 0 3px 0 var(--wood-d); }
.plate { left: 67%; min-width: 22%; transform: rotate(2deg); }
.plate.focus { animation: wiggle .6s ease-in-out 2; background-color: var(--butter); }
.hearts { left: 6%; z-index: 3; height: auto; padding: 1cqw 2.2cqw 1.2cqw; display: flex; flex-direction: column; align-items: center; gap: .4cqw; transform: rotate(-2deg);
  animation: dropin .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.hearts .tagrow { display: flex; align-items: center; gap: 1.2cqw; font-size: 4.8cqw; line-height: 1; }
.hearts .tagrow b { font-weight: normal; }
.hearts .age { width: 9.5cqw; height: 9.5cqw; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ink); }
.hearts .age svg { width: 96%; height: 96%; }
.age-baby { background: #bcd7ff; } .age-kid { background: var(--mint); } .age-grownup { background: var(--lav); } .age-elder { background: var(--butter); }
.hearts .hs { display: flex; gap: .6cqw; }
.hearts i { width: 4.2cqw; height: 4.2cqw; color: var(--coral); }
.hearts i svg { width: 100%; height: 100%; }
.hearts i.part { color: #f6c2cf; } .hearts i.empty { color: #d8c8b8; }
/* the apprentice stands at the door at kid height: a friend is as tall as you, grown-ups tower */
.me { position: absolute; left: 67%; bottom: 8.8%; height: 31%; aspect-ratio: 60/112; z-index: 4; pointer-events: none; }
.me svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 0 rgba(10, 8, 30, .35)); }
.me svg .ears { animation: wag 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.hearts i.pop { animation: heartpop .7s cubic-bezier(.3, 1.8, .5, 1); }

.doorway { position: absolute; left: 32.5%; top: 39.583%; width: 35%; height: 50%; perspective: 1600px; }
.doorway.rect, .doorway.rect .leaf, .doorway.rect .inside { border-radius: 6px 6px 2px 2px; }
.doorway.arch, .doorway.arch .leaf, .doorway.arch .inside { border-radius: 50% 50% 3px 3px / 26% 26% 3px 3px; }
.doorway.round, .doorway.round .leaf, .doorway.round .inside { border-radius: 50% 50% 6px 6px / 38% 38% 6px 6px; }
.inside { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 50% 70%, #ffe2a0, #f2a650 60%, #8a4a2a); }
.under { position: absolute; left: 6%; right: 6%; bottom: -1px; height: 4px; background: #ffd88a; opacity: 0; filter: blur(2px); transition: opacity .4s; }
.under.on { opacity: 1; box-shadow: 0 0 14px 4px rgba(255, 210, 120, .7); }
.leaf { position: absolute; inset: 0; overflow: hidden; transform-origin: 0 50%; transition: transform 1.1s cubic-bezier(.5, -0.1, .3, 1.15);
  box-shadow: inset -6px 0 0 rgba(0, 0, 0, .15), 0 0 0 2px var(--ink); z-index: 2; }
.leaf svg { width: 100%; height: 100%; }
.leaf.knock { animation: knock .36s; }
.leaf.jiggle { animation: jiggle .5s; }
.doorway.open .leaf { transform: rotateY(-100deg); box-shadow: inset -6px 0 0 rgba(0, 0, 0, .3), 0 0 0 2px var(--ink); }
.doorway.night .inside { background: radial-gradient(ellipse at 50% 70%, #b9a0d8, #6a5a9a 60%, #2d2a5e); }

.res { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 92%; display: flex; align-items: flex-end; justify-content: center; }
.res > svg { height: 100%; width: auto; max-width: 100%; overflow: visible; filter: drop-shadow(-1.5px -1.5px 0 rgba(255, 243, 196, .38)) drop-shadow(0 4px 0 rgba(10, 8, 30, .35)); }
.res .ec, .res .arm, .res .fur { display: none; }
.res.sleepy .eo { display: none; } .res.sleepy .ec { display: inline; }
.res.show { animation: reveal .7s cubic-bezier(.3, 1.7, .5, 1) both; }
.res .b { transform-box: fill-box; transform-origin: 50% 100%; animation: breathe 2.6s ease-in-out infinite; }
.res.happy .b { animation: happy .6s cubic-bezier(.3, 1.8, .5, 1) 2; }
.res.talking .b { animation: talk .26s ease-in-out infinite alternate; }
.res [class*="acc-"], .res .hd, .res .ears, .res .tail, .res .arm { transform-box: fill-box; transform-origin: 50% 50%; }
.res .eo, .res .ec, .res .fm { transform: translateX(4px); } /* look toward the apprentice */
.res .tail { transform-origin: 0% 100%; animation: wag 2s ease-in-out infinite; }

/* comic reactions: over-casual (grown-ups) are bigger; over-formal (little ones) are small and giggly */
.res.r-glasses .acc-glasses { animation: popoff 1.4s cubic-bezier(.3, .6, .4, 1); }
.res.r-bun .acc-bun { animation: flyup 1.3s cubic-bezier(.3, .6, .4, 1); }
.res.r-hat .acc-hat { animation: flyup 1.4s cubic-bezier(.3, .6, .4, 1); }
.res.r-towel .acc-towel { animation: popoff 1.3s cubic-bezier(.3, .6, .4, 1); }
.res.r-beard .acc-beard { transform-origin: 50% 0; animation: boing 1.1s ease-out; }
.res.r-ears .ears { animation: propeller 1.2s ease-in-out; transform-origin: 50% 100%; }
.res.r-spin .hd { animation: spin 1.1s ease-in-out; }
.res.r-puff .b { animation: puff 1.2s ease-out; } .res.r-puff .fur { display: inline; }
.res.r-disguise .acc-shawl { animation: flyaway 1.4s ease-in both; }
.res.r-salute .arm { display: inline; animation: salute 1.3s ease-in-out; transform-origin: 30% 100%; }
.res.r-topple .b { animation: topple 1.3s ease-in-out; }
.res.r-giggle .b { animation: giggle .14s linear 8; }
.res.r-roll .b { animation: roll 1.1s ease-in-out; transform-origin: 50% 60%; }
.res.r-plop .b { animation: plop 1.1s ease-out; }
.res.r-peek .b { animation: peek 1.4s ease-in-out; }
.res.r-puzzled .b { animation: tilt 1.2s ease-in-out; }
.mark { position: absolute; left: 50%; top: 6%; transform: translateX(-50%); font-size: 13cqw; color: var(--moon); -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 0 3px 0 var(--ink); opacity: 0; pointer-events: none; white-space: nowrap; }
.mark.on { animation: markin 1.4s ease-out both; }

.say { position: absolute; left: 50%; top: 1.5%; transform: translateX(-50%); max-width: 92%; padding: 2.2cqw 4cqw; z-index: 3;
  background: var(--paper) var(--grain); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px 26px 20px 28px;
  font-size: 7.4cqw; line-height: 1.2; text-align: center; word-break: keep-all; box-shadow: 0 5px 0 var(--shade); animation: bubble .4s cubic-bezier(.3, 1.7, .5, 1); }
.say::after { content: ''; position: absolute; left: 50%; bottom: -14px; width: 20px; height: 14px; background: var(--paper); clip-path: polygon(0 0, 100% 0, 30% 100%);
  filter: drop-shadow(0 3px 0 var(--ink)); }
.say.model { background-color: var(--butter); }
.say.model::before { content: '♪ '; color: var(--coral); }
.say.voiceonly { display: flex; align-items: center; gap: 2cqw; padding: 2cqw 3cqw; }
.say.voiceonly svg { height: 9cqw; width: auto; color: var(--ink); }
.say.voiceonly .wv { animation: wv .5s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -.09s); transform-box: fill-box; transform-origin: center; }
.say.voiceonly .again { width: 11cqw; height: 11cqw; border-radius: 50%; background: var(--lantern); border: 2px solid var(--ink); display: grid; place-items: center; }
.say.voiceonly .again svg { width: 6cqw; height: 6cqw; }
.knocktext { position: absolute; left: 50%; top: 27.5%; transform: translateX(-50%); font-size: 13cqw; color: var(--moon); -webkit-text-stroke: 2px var(--ink);
  text-shadow: 0 4px 0 var(--ink); pointer-events: none; z-index: 3; }
.knocktext.hint { animation: hint 1.4s ease-in-out infinite; }
.knocktext.hit { animation: hit .4s cubic-bezier(.3, 1.8, .5, 1); }

.prop { position: absolute; left: 50%; bottom: 6%; width: 22%; aspect-ratio: 1; transform: translateX(-50%); z-index: 3; pointer-events: none; }
.prop svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 0 var(--shade)); }
.prop.box { animation: boxin .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.prop.give { animation: givebox .8s ease-in both; }
.prop.treat { left: 60%; bottom: 24%; width: 13%; animation: offer .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.prop.treat.take { animation: take .7s ease-in both; }
.prop.oops { animation: oops 1.2s ease-in-out both; }
.prop.open { left: 50%; bottom: 11%; width: 24%; animation: boxin .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.prop.out { left: 56%; bottom: 11%; width: 12%; animation: boxin .5s both; }
.prop.night { left: 50%; bottom: 38%; width: 13%; animation: boxin .5s both; }
.prop .tag { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); background: var(--paper); color: var(--ink); border: 2px solid var(--ink);
  border-radius: 8px; padding: .5cqw 1.6cqw; font-size: 4.4cqw; white-space: nowrap; }

/* ---------- speech bubbles to choose from ---------- */
.talk { position: relative; z-index: 5; background: #262b52; box-shadow: 0 0 0 100vmax #262b52; clip-path: inset(0 -100vmax -100vmax -100vmax); flex: 0 0 auto; display: flex; flex-direction: column; gap: 9px; padding: 10px 12px 12px; min-height: 120px; justify-content: flex-end; }
.opt { display: flex; align-items: stretch; background: var(--paper) var(--grain); color: var(--ink); border: 3px solid var(--ink);
  border-radius: 22px 26px 20px 28px; box-shadow: 0 5px 0 var(--paper-d), 0 7px 0 var(--ink); animation: optin .45s cubic-bezier(.3, 1.6, .5, 1) backwards;
  animation-delay: calc(var(--i) * .08s); transition: transform .12s, opacity .3s, filter .3s; }
.opt:nth-child(2) { border-radius: 26px 20px 28px 22px; } .opt:nth-child(3) { border-radius: 20px 28px 22px 26px; }
.opt .spk { flex: 0 0 52px; display: grid; place-items: center; border-right: 2px dashed rgba(91, 63, 55, .35); color: var(--ink); }
.opt .spk svg { width: 26px; height: 26px; }
.opt .spk:active svg { transform: scale(.85); }
.opt .pick { flex: 1; min-height: 56px; padding: 8px 12px; text-align: left; font-size: clamp(18px, 6.2cqw, 28px); line-height: 1.15; word-break: keep-all; color: var(--ink); }
.opt:active { transform: translateY(3px); }
.opt.reading { background-color: var(--butter); transform: scale(1.03); }
.opt.chosen { background-color: var(--butter); animation: said .5s cubic-bezier(.3, 1.7, .5, 1); }
.opt.dim { opacity: .35; filter: grayscale(.6); pointer-events: none; }
.opt.glow { box-shadow: 0 0 0 4px var(--lantern), 0 5px 0 var(--paper-d), 0 7px 0 var(--ink), 0 0 26px var(--lantern); animation: nudge 1s ease-in-out infinite; }
.opt.right { background-color: var(--mint); }

/* ---------- title ---------- */
.titlescreen { position: fixed; inset: 0; z-index: 20; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh;
  padding: var(--safe-t) 16px var(--safe-b); }
.sign { background: var(--wood) var(--grain); border: 4px solid var(--ink); border-radius: 14px; padding: 8px 30px 12px; box-shadow: 0 8px 0 var(--wood-d), 0 10px 0 var(--ink);
  transform: rotate(-2deg); animation: swing 4s ease-in-out infinite; }
.sign h1 { margin: 0; font-weight: normal; font-size: max(40px, min(16vw, 8vh, 76px)); color: var(--paper); -webkit-text-stroke: 2px var(--ink); text-align: center; line-height: 1; text-shadow: 0 4px 0 var(--ink); }
.sign small { font-size: .55em; }
.titleart { width: min(82vw, 380px, 38vh); aspect-ratio: 400/480; position: relative; }
.titleart .appr { position: absolute; left: -16%; bottom: 3%; width: 46%; }
.titleart .appr svg { width: 100%; height: auto; overflow: visible; }
.titleart .appr .appr { animation: tug 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.titleart .fsvg, .titleart .fsvg svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.titleart .peeker { position: absolute; left: 36%; bottom: 0; width: 28%; height: 40%; display: flex; align-items: flex-end; justify-content: center; animation: peekin 3.2s ease-in-out infinite; }
.titleart .peeker svg { height: 100%; width: auto; }
.titleart .tdoor { position: absolute; left: 32.5%; top: 39.583%; width: 35%; height: 50%; border-radius: 6px 6px 2px 2px; overflow: hidden; perspective: 600px; }
.titleart .tdoor .inside { position: absolute; inset: 0; }
.titleart .tdoor .leaf { animation: ajar 3.2s ease-in-out infinite; }
.classbadge { background: var(--mint); color: var(--ink); border: 3px solid var(--ink); border-radius: 18px; padding: 4px 14px; font-size: 18px; }
.start { width: 120px; height: 120px; border-radius: 50%; background: var(--coral) var(--grain); border: 4px solid var(--ink); color: var(--paper);
  box-shadow: 0 7px 0 var(--coral-d), 0 9px 0 var(--ink), 0 0 36px rgba(242, 112, 106, .5); display: grid; place-items: center; animation: breathe 1.6s ease-in-out infinite; }
.start svg { width: 56px; height: 56px; margin-left: 8px; }

/* ---------- sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(13, 15, 43, .7); display: flex; align-items: flex-end; justify-content: center; }
.sheetcard { position: relative; width: min(100%, 540px); max-height: 92dvh; overflow: auto; background: var(--paper) var(--grain); color: var(--ink);
  border: 3px solid var(--ink); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 14px 14px calc(18px + var(--safe-b)); animation: sheetup .35s cubic-bezier(.3, 1.3, .5, 1); -webkit-user-select: text; user-select: text; }
.sheetcard .close { position: sticky; top: 0; float: right; margin-left: 8px; z-index: 2; }
.sheetbody h2 { margin: 4px 0 12px; font-weight: normal; font-size: 28px; }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; clear: both; }
.acard { border: 3px solid var(--ink); border-radius: 16px 20px 14px 22px; padding: 6px 4px 8px; text-align: center; background: var(--butter); box-shadow: 0 4px 0 var(--shade); }
.acard.kid { background: var(--mint); } .acard.adult { background: var(--lav); } .acard.sur { background: var(--pinkt); }
.acard .pic { height: 74px; display: flex; align-items: flex-end; justify-content: center; }
.acard .pic svg { height: 100%; width: auto; max-width: 100%; }
.acard.unmet .pic svg { filter: brightness(0) opacity(.3); }
.acard .nm { font-size: 15px; margin-top: 4px; }
.acard .hs { display: flex; justify-content: center; }
.acard .kp { height: 26px; margin-top: 2px; display: flex; justify-content: center; }
.acard .kp svg { height: 26px; width: 26px; }
.lanterncount { display: flex; align-items: center; gap: 6px; font-size: 22px; margin: 0 0 12px; color: var(--ink); }
.lanterncount i { width: 28px; height: 28px; color: #ff8a4a; }

/* grown-ups corner: plain, bilingual, Gowun Dodum */
.grownups { font-family: 'Gowun Dodum', system-ui, sans-serif; font-size: 15.5px; line-height: 1.45; clear: both; }
.grownups h2 { font-family: var(--font); }
.grownups h3 { font-size: 17px; margin: 18px 0 6px; }
.grownups table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.grownups td, .grownups th { border-bottom: 1px solid #e2cfb2; padding: 5px 4px; text-align: left; vertical-align: top; }
.grownups td.n { text-align: right; white-space: nowrap; }
.grownups .bar { height: 8px; border-radius: 4px; background: #eadcc6; overflow: hidden; margin-top: 3px; }
.grownups .bar b { display: block; height: 100%; background: var(--green); }
.grownups .ko { color: #8a6a5a; }
.grownups textarea, .grownups input, .grownups select { width: 100%; font: inherit; border: 2px solid var(--ink); border-radius: 10px; padding: 8px; background: #fffdf8; color: var(--ink); }
.grownups textarea { min-height: 70px; }
.grownups .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.grownups .btn { border: 2px solid var(--ink); border-radius: 10px; padding: 7px 12px; background: var(--butter); color: var(--ink); font-family: inherit; }
.grownups .btn.warn { background: #f8d0cc; }
.grownups .fine { font-size: 13px; color: #8a6a5a; }
.grownups .link { word-break: break-all; font-size: 13px; background: #fffdf8; border: 1px dashed var(--ink); border-radius: 8px; padding: 6px; }

/* ---------- fx ---------- */
.ghost { position: fixed; z-index: 25; width: 64px; height: 64px; pointer-events: none; animation: ghosttap 1.3s ease-in-out infinite; }
.ghost svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 0 var(--shade)); }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 26; overflow: hidden; }
.fx .h { position: absolute; width: 34px; height: 34px; color: var(--coral); animation: floatup 1.3s ease-out forwards; }
.fx .h svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 var(--ink)); }
.toast { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 6; padding: 16px 20px; text-align: center; width: min(88%, 340px);
  animation: dropin .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.toast .pic { height: 90px; display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.toast .pic svg { height: 100%; width: auto; }
.toast .pic .kpic svg { height: 60px; animation: giftin 1.2s cubic-bezier(.3, 1.6, .5, 1) both; }
.toast p { font-size: 26px; margin: 8px 0 12px; }

@keyframes twinkle { 50% { opacity: .15; } }
@keyframes drift { from { transform: translateX(-60px); } to { transform: translateX(60px); } }
@keyframes firefly { 25% { transform: translate(24px, -18px); } 50% { transform: translate(-10px, -36px); } 75% { transform: translate(-26px, -8px); } }
@keyframes fireflyS { 25% { transform: translate(8px, -6px); } 50% { transform: translate(-4px, -12px); } 75% { transform: translate(-9px, -3px); } }
@keyframes glowfly { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
@keyframes ringpulse { 0%, 100% { transform: scale(.86); opacity: .9; } 50% { transform: scale(1.04); opacity: .35; } }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes smoke { 0% { opacity: 0; transform: translate(0, 6px) scale(.6); } 20% { opacity: .35; } 100% { opacity: 0; transform: translate(10px, -26px) scale(1.8); } }
@keyframes steam { 0%, 100% { opacity: .2; transform: translateY(2px); } 50% { opacity: .8; transform: translateY(-4px); } }
@keyframes tug { 50% { transform: translateY(-2px) rotate(-1.5deg); } }
@keyframes breathe { 50% { transform: scale(1.03, .97); } }
@keyframes blink { to { opacity: .4; } }
@keyframes pulse { 50% { transform: scale(1.15); opacity: .6; } }
@keyframes flicker { 0%, 100% { opacity: 1; } 45% { opacity: .82; } 50% { opacity: .95; } }
@keyframes lightup { 0% { fill: #5a4e6a; transform: scale(.6); } 60% { transform: scale(1.6); } 100% { transform: none; } }
@keyframes hop { 0%, 80%, 100% { transform: none; } 88% { transform: translateY(-5px); } }
@keyframes giftin { 0% { transform: translateY(-80px) scale(2) rotate(-30deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes dropin { 0% { opacity: 0; translate: 0 -40px; scale: .8; } 100% { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes zoomin { 0% { transform: scale(.6) translateY(10%); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes wiggle { 25% { transform: rotate(-4deg) scale(1.08); } 75% { transform: rotate(5deg) scale(1.08); } }
@keyframes heartpop { 0% { transform: scale(.3); } 60% { transform: scale(1.5); } 100% { transform: none; } }
@keyframes knock { 20% { transform: translateX(3px) rotate(.6deg); } 40% { transform: none; } 60% { transform: translateX(3px) rotate(.6deg); } 80% { transform: none; } }
@keyframes jiggle { 25% { transform: rotateY(-4deg); } 50% { transform: none; } 75% { transform: rotateY(-6deg); } }
@keyframes reveal { 0% { transform: translateX(-50%) translateY(30%) scale(.7, 1.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: translateX(-50%); opacity: 1; } }
@keyframes happy { 40% { transform: translateY(-14%) scale(.95, 1.06); } 70% { transform: scale(1.06, .94); } }
@keyframes talk { to { transform: scale(1.02, .97); } }
@keyframes wag { 50% { transform: rotate(-6deg); } }
@keyframes popoff { 0% { transform: none; } 25% { transform: translate(-20px, -70px) rotate(-40deg); } 55% { transform: translate(-30px, -30px) rotate(-200deg); } 80% { transform: translate(0, 6px) rotate(-360deg); } 100% { transform: none; } }
@keyframes flyup { 0% { transform: none; } 30% { transform: translateY(-90px) rotate(20deg); } 60% { transform: translateY(-60px) rotate(-12deg); } 85% { transform: translateY(4px); } 100% { transform: none; } }
@keyframes boing { 20% { transform: scaleY(1.6) rotate(20deg); } 40% { transform: scaleY(.6) rotate(-20deg); } 60% { transform: scaleY(1.3) rotate(10deg); } 80% { transform: scaleY(.9); } }
@keyframes propeller { 0% { transform: none; } 80% { transform: rotate(720deg); } 100% { transform: rotate(720deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes puff { 20% { transform: scale(1.25); } 70% { transform: scale(1.2); } }
@keyframes flyaway { 0% { transform: none; } 100% { transform: translate(60px, -160px) rotate(80deg); opacity: 0; } }
@keyframes salute { 0%, 100% { transform: rotate(0); } 20%, 80% { transform: rotate(-8deg); } 40%, 60% { transform: rotate(6deg); } }
@keyframes topple { 30% { transform: rotate(28deg); } 55% { transform: rotate(-10deg); } 75% { transform: rotate(6deg); } }
@keyframes giggle { 50% { transform: translateX(3%) rotate(2deg); } }
@keyframes roll { 0% { transform: none; } 70% { transform: rotate(360deg) translateX(10%); } 100% { transform: rotate(360deg); } }
@keyframes plop { 25% { transform: scale(1.25, .7); } 50% { transform: scale(.9, 1.1); } }
@keyframes peek { 20%, 60% { transform: scaleX(-1); } 40%, 80% { transform: none; } }
@keyframes tilt { 25%, 75% { transform: rotate(-12deg); } }
@keyframes markin { 0% { opacity: 0; transform: translate(-50%, 20%) scale(.4); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -20%); } }
@keyframes bubble { 0% { transform: translateX(-50%) scale(.5); opacity: 0; } 100% { transform: translateX(-50%); opacity: 1; } }
@keyframes wv { from { transform: scaleY(.4); } to { transform: scaleY(1.1); } }
@keyframes hint { 50% { transform: translateX(-50%) scale(1.12) rotate(-4deg); } }
@keyframes hit { 0% { transform: translateX(-50%) scale(.5); } 100% { transform: translateX(-50%); } }
@keyframes boxin { 0% { transform: translate(-50%, 60%) scale(.6); opacity: 0; } 100% { transform: translateX(-50%); opacity: 1; } }
@keyframes givebox { 0% { transform: translateX(-50%); } 100% { transform: translate(-50%, -120%) scale(.5); opacity: 0; } }
@keyframes offer { 0% { transform: translateX(-50%) scale(.3); opacity: 0; } 100% { transform: translateX(-50%); opacity: 1; } }
@keyframes take { 100% { transform: translate(-80%, 200%) scale(.5); opacity: 0; } }
@keyframes oops { 0% { transform: translateX(-50%); } 20% { transform: translateX(-50%) rotate(-20deg); } 40% { transform: translateX(-50%) rotate(15deg); } 60% { transform: translateX(-10%) rotate(200deg); } 100% { transform: translateX(-50%) rotate(0); } }
@keyframes optin { 0% { transform: translateY(30px) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes said { 40% { transform: scale(1.06); } }
@keyframes nudge { 50% { transform: scale(1.03); } }
@keyframes swing { 50% { transform: rotate(2deg); } }
@keyframes peekin { 0%, 20%, 90%, 100% { transform: translateY(30%); opacity: 0; } 40%, 75% { transform: none; opacity: 1; } }
@keyframes ajar { 0%, 15%, 95%, 100% { transform: none; } 35%, 80% { transform: rotateY(-50deg); } }
@keyframes sheetup { from { transform: translateY(40%); } }
@keyframes ghosttap { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-6px, 10px) scale(.9); } }
@keyframes floatup { 0% { transform: translateY(0) scale(.5); opacity: 0; } 20% { opacity: 1; transform: translateY(-20px) scale(1.2); } 100% { transform: translateY(-140px) scale(.8); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; transition-duration: .01s !important; } }
@media (max-height: 640px) { .titleart { width: min(72vw, 34vh); } .titlescreen { gap: 1vh; } .start { width: 96px; height: 96px; } .opt .pick { min-height: 46px; padding: 5px 10px; } .talk { gap: 7px; padding: 6px 10px 8px; } .ib { width: 40px; height: 40px; } .go { width: 76px; height: 76px; } }
