@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/fredoka-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 600; font-display: swap; src: url('assets/fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/fredoka-latin-700-normal.woff2') format('woff2'); }
:root {
  --ink: #12335f;
  --pink: #2b8cff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Fredoka', 'Trebuchet MS', 'Comic Sans MS', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #8fd0ff, #7fa8ff, #b0f0ff, #8fd0ff);
  background-size: 300% 300%;
  animation: gradientShift 16s ease infinite;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
img { -webkit-user-drag: none; }

#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) 10px max(6px, env(safe-area-inset-bottom));
  max-width: 1040px;
  margin: 0 auto;
}

/* ---------- header ---------- */
header { text-align: center; position: relative; padding: 0 52px; }
h1 {
  margin: 0; line-height: 1; font-weight: 700;
  font-size: clamp(28px, 7vw, 50px);
  color: #fff; letter-spacing: .5px;
  text-shadow: 0 3px 0 #2f7be0, 0 6px 0 #1c4fb0, 0 9px 14px rgba(0, 40, 120, .35);
}
header p {
  margin: 8px 0 0; font-weight: 600; color: #fff;
  font-size: clamp(14px, 3.6vw, 21px);
  text-shadow: 0 2px 0 #2f7be0, 0 3px 8px rgba(0, 40, 120, .3);
}
.round {
  position: absolute; right: 0; top: 0;
  width: 44px; height: 44px; border-radius: 50%; border: 0; font-size: 22px; cursor: pointer;
  background: linear-gradient(#fff, #d6ecff);
  box-shadow: inset 0 2px 0 #fff, 0 4px 0 #2f6fbd, 0 6px 10px rgba(0, 50, 140, .3);
  transition: transform .15s;
}
.round:active { transform: translateY(3px); box-shadow: inset 0 2px 0 #fff, 0 1px 0 #2f6fbd; }

/* ---------- stage ---------- */
#stage {
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; border-radius: 30px; border: 5px solid #fff;
  box-shadow: 0 0 0 3px var(--pink), 0 14px 30px rgba(0, 60, 170, .35);
  background: #d6ecff;
}
.bg {
  position: absolute; inset: 0; z-index: 0; opacity: 0;
  transition: opacity .9s ease; pointer-events: none; overflow: hidden;
}
.bg.on { opacity: 1; }
.bg::after { /* floor */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 14%;
  background: var(--floor, linear-gradient(#b8f0c8, #7fd9a0));
  border-top: 3px solid rgba(255, 255, 255, .6);
}
.bg .d { position: absolute; line-height: 1; }

.bg[data-for=home]     { background: radial-gradient(circle at 20% 20%, #fff7 0 8%, transparent 9%), linear-gradient(#d6f0ff, #b8d4ff 60%, #c8f5ec); --floor: linear-gradient(#eef8ff, #b8dcf5); }
.bg[data-for=paint]    { background: radial-gradient(#ffffff55 12%, transparent 13%) 0 0 / 34px 34px, linear-gradient(#f4faff, #cfe6ff); --floor: linear-gradient(#e6b27a, #c98d55); }
.bg[data-for=read]     { background: linear-gradient(#cfe4ff, #e0eeff 70%, #f2f8ff); --floor: linear-gradient(#8fb4ff, #6a92e8); }
.bg[data-for=snack]    { background: linear-gradient(#ffe9a8, #ffc46b); --floor: linear-gradient(#a6d65a, #7fb840); }
.bg[data-for=nap]      { background: linear-gradient(#071238, #1c3078 70%, #2c4a9a); --floor: linear-gradient(#2a458f, #1b3270); }

.rainbow { right: 6%; top: 6%; font-size: clamp(60px, 12vw, 120px); opacity: .85; }
.sun { right: 7%; top: 5%; font-size: clamp(46px, 9vw, 84px); animation: spin 40s linear infinite; }
.moon { right: 9%; top: 9%; font-size: clamp(54px, 10vw, 100px); filter: drop-shadow(0 0 18px #fff6b0); animation: bob 5s ease-in-out infinite; }
.fl { animation: bob 4s ease-in-out infinite; }
.tw { animation: twinkle 2.2s ease-in-out infinite; }


/* ---------- Ginny ---------- */
#ginnyWrap {
  position: absolute; z-index: 2; bottom: 2.5%; height: 78%;
  aspect-ratio: 590 / 1500; left: 50%; translate: -50% 0;
  transition: left .9s cubic-bezier(.25, .9, .3, 1.1);
}
[data-scene=paint] #ginnyWrap { left: 27%; }
[data-scene=read]  #ginnyWrap { left: 50%; }
#ginnyHop, #ginnyBody { position: relative; width: 100%; height: 100%; transform-origin: 50% 100%; }
#ginny { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 6px 8px rgba(60, 20, 90, .25)); pointer-events: none; }
#ginnyBody { cursor: pointer; }
.shadow {
  position: absolute; left: 4%; right: 4%; bottom: -1.2%; height: 3.4%;
  background: radial-gradient(closest-side, rgba(40, 0, 60, .35), transparent); filter: blur(2px);
}

/* closed eyelids (blink + sleep): fur-colored lid with soft shading and a gentle lash curve */
.lid {
  position: absolute; width: 16.8%; height: 5.8%; opacity: 0; transition: opacity .12s; pointer-events: none;
  border-radius: 50% 50% 48% 48% / 55% 55% 45% 45%;
  background: radial-gradient(ellipse at 50% 20%, #dcae6b 0%, #cf9c58 60%, #bd8647 100%);
  box-shadow: 0 0 5px 3px rgba(205, 156, 88, .85), inset 0 -3px 4px rgba(120, 70, 25, .35);
}
.lid::after { /* lash line */
  content: ''; position: absolute; left: 4%; right: 4%; bottom: 8%; height: 46%;
  border-bottom: 3px solid #3b200f; border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.lid.l { left: 19.2%; top: 16.4%; transform: rotate(-4deg); }
.lid.r { left: 53.4%; top: 15.6%; transform: rotate(-4deg); }
.blink .lid, .asleep .lid { opacity: 1; }


/* idle animations per scene */
[data-scene=home]     #ginnyBody { animation: bob 3.4s ease-in-out infinite; }
[data-scene=christmas] #ginnyBody { animation: sway 2.6s ease-in-out infinite; }
[data-scene=paint]    #ginnyBody { animation: bob 3.4s ease-in-out infinite; }
[data-scene=paint]    #ginnyBody.painting { animation: nod .45s ease-in-out infinite; }
[data-scene=read]     #ginnyBody { animation: readTilt 4.6s ease-in-out infinite; }
[data-scene=snack]    #ginnyBody { animation: lookUp 3.8s ease-in-out infinite; }
[data-scene=nap]      #ginnyBody { animation: sleepy 5s ease-in-out infinite; }
[data-scene=nap] #ginny { filter: brightness(.82) saturate(.9) drop-shadow(0 6px 8px rgba(0, 0, 0, .35)); }
#ginnyHop.hop   { animation: hop .7s cubic-bezier(.3, 1.4, .5, 1); }
#ginnyHop.munch { animation: munch .5s ease-in-out; }
#ginnyHop.enter { animation: enter 1s cubic-bezier(.2, 1.4, .4, 1); }

/* ---------- speech bubble ---------- */
#bubble {
  position: absolute; z-index: 8; top: 2.5%; left: 50%; translate: -50% 0;
  width: max-content; max-width: min(88%, 520px);
  background: #fff; border: 3px solid #7fbcff; border-radius: 22px; padding: 8px 16px;
  font-size: clamp(14px, 3.6vw, 21px); font-weight: 600; text-align: center; line-height: 1.25;
  box-shadow: 0 6px 0 #c2e0ff, 0 10px 18px rgba(120, 0, 120, .2);
}
#bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -13px; translate: -50% 0;
  border: 10px solid transparent; border-top-color: #7fbcff; border-bottom: 0;
}
#bubble.pop { animation: pop .45s cubic-bezier(.2, 1.5, .4, 1); }

#props, #fx { position: absolute; inset: 0; pointer-events: none; }
#props { z-index: 4; }
#fx { z-index: 9; }
#props > *, #props button, #props canvas { pointer-events: auto; }
.fxp { position: absolute; font-size: 22px; pointer-events: none; }
.trail { position: fixed; z-index: 99; pointer-events: none; font-size: 16px; translate: -50% -50%; }

/* ---------- dock ---------- */
#dock { display: flex; gap: clamp(5px, 1.6vw, 12px); padding: 2px 2px 8px; }
.btn {
  flex: 1; min-width: 0; border: 0; border-radius: 22px; padding: 7px 2px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: clamp(9px, 2.45vw, 17px); color: #fff;
  background: linear-gradient(var(--c1), var(--c2));
  text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, .75), inset 0 -4px 0 rgba(0, 0, 0, .12), 0 5px 0 var(--c3), 0 9px 14px rgba(90, 0, 110, .3);
  transition: transform .18s cubic-bezier(.3, 1.6, .5, 1), box-shadow .18s, background .3s;
  position: relative; overflow: hidden;
}
.btn::before { /* glossy shine */
  content: ''; position: absolute; left: 8%; right: 8%; top: 3px; height: 42%; border-radius: 18px 18px 40px 40px;
  background: linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, 0)); pointer-events: none;
}
.btn .ico { font-size: clamp(26px, 7.4vw, 44px); line-height: 1.15; }
.btn:hover { transform: translateY(-3px) scale(1.04); }
.btn:active { transform: translateY(4px); box-shadow: inset 0 3px 0 rgba(255, 255, 255, .75), 0 1px 0 var(--c3); }
.btn[aria-pressed=true] {
  transform: translateY(-5px) scale(1.06);
  background: linear-gradient(#fff6b0, #ffd23d); color: #7a3b00; text-shadow: 0 1px 0 #fff8;
  box-shadow: inset 0 3px 0 #fff, 0 5px 0 #d49a00, 0 0 0 3px #fff, 0 10px 18px rgba(255, 180, 0, .5);
}
footer { text-align: center; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 0 #2f7be0; padding-bottom: 2px; }

/* ---------- intro ---------- */
#intro {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(70, 150, 255, .55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: opacity .6s, visibility .6s;
}
#intro.gone { opacity: 0; visibility: hidden; }
#intro .card {
  background: #fff; border-radius: 34px; border: 5px solid #7fbcff; padding: 22px 26px 26px; text-align: center;
  box-shadow: 0 0 0 4px #fff, 0 20px 50px rgba(0, 40, 120, .45); animation: pop .7s cubic-bezier(.2, 1.5, .4, 1); max-width: 360px; width: 100%;
}
.headshot { width: 150px; height: 150px; margin: -80px auto 6px; border-radius: 50%; overflow: hidden; border: 5px solid #fff; background: linear-gradient(#d6f0ff, #b8d4ff); box-shadow: 0 0 0 4px #7fbcff, 0 8px 16px rgba(0, 0, 0, .2); }
.headshot img { width: 120%; margin: 0 -10%; position: relative; top: -2%; }
#intro h2 { margin: 6px 0 0; font-size: 34px; color: #2b8cff; }
#intro p { margin: 4px 0 16px; font-weight: 600; font-size: 19px; }
.btn.big { width: 100%; flex: none; flex-direction: row; justify-content: center; padding: 16px; font-size: 22px; animation: pulse 1.6s ease-in-out infinite; }

/* ---------- scene props ---------- */
.zzz { position: absolute; font-weight: 700; color: #fff; text-shadow: 0 0 10px #8fa0ff; animation: floatUp 4s ease-out forwards; pointer-events: none !important; }


.bg[data-for=jokes] { background: radial-gradient(#ffffff66 12%, transparent 13%) 0 0 / 40px 40px, linear-gradient(#bfe6ff, #e8f6ff 55%, #fff4b8); --floor: linear-gradient(#ffe27a, #ffc93d); }
.rise { bottom: -12%; animation: balloonUp 14s linear infinite; }
[data-scene=jokes] #ginnyBody { animation: sway 2.6s ease-in-out infinite; }
#ginnyBody.talking { animation: talk .42s ease-in-out infinite !important; }
.book.joke { border-left-color: #ffc93d; border-right-color: #ffc93d; box-shadow: 0 8px 0 #d49a00, 0 14px 22px rgba(0, 0, 0, .25); }
.book.joke p { font-size: clamp(17px, 4.4vw, 28px); }

/* christmas */
.bg[data-for=christmas] {
  background: radial-gradient(circle at 16% 72%, rgba(255, 170, 60, .55), transparent 46%), repeating-linear-gradient(90deg, #ffffff12 0 14px, transparent 14px 28px), linear-gradient(#ffd9b8, #e9a67d);
  --floor: linear-gradient(#8a5a3c, #5e3a24);
}
.lights { position: absolute; left: 0; right: 0; top: 0; height: 22px; border-bottom: 2px solid #3a2a1a; border-radius: 0 0 50% 50% / 0 0 100% 100%; }
.lights::before, .lights::after { content: ''; position: absolute; inset: 4px 0 0; animation: blinkLights 1.4s steps(1) infinite; }
.lights::before { background: radial-gradient(circle at 10px 8px, #ff4d4d 5px, transparent 6px) 0 0 / 40px 16px, radial-gradient(circle at 30px 8px, #3dd0ff 5px, transparent 6px) 0 0 / 40px 16px; filter: drop-shadow(0 0 4px #fff8); }
.lights::after { background: radial-gradient(circle at 10px 8px, #ffd84d 5px, transparent 6px) 0 0 / 40px 16px, radial-gradient(circle at 30px 8px, #5be37d 5px, transparent 6px) 0 0 / 40px 16px; animation-delay: -.7s; filter: drop-shadow(0 0 4px #fff8); }
.fire {
  position: absolute; left: 3%; bottom: 13.5%; width: 27%; height: 30%; border-radius: 10px 10px 0 0;
  background: radial-gradient(ellipse at 50% 100%, #ffb23c 0, #b53a0a 38%, #2a0f08 70%) center 40% / 62% 70% no-repeat, repeating-linear-gradient(0deg, #8f837d 0 18px, #a89c95 18px 20px), #9a8f8a;
  box-shadow: inset 0 0 0 3px #7c716c, 0 0 40px 6px rgba(255, 160, 50, .45);
}
.flame { position: absolute; left: 50%; bottom: 10%; translate: -50% 0; font-size: clamp(28px, 7vw, 52px); animation: flicker .5s ease-in-out infinite alternate; filter: drop-shadow(0 0 10px #ffb23c); }
.mantel { position: absolute; left: 1%; width: 31%; bottom: calc(13.5% + 30%); height: 14px; background: linear-gradient(#a8693a, #7a4824); border-radius: 6px; box-shadow: 0 4px 6px rgba(0, 0, 0, .25); }
.sock { bottom: calc(13.5% + 30% + 1px); font-size: clamp(20px, 5vw, 34px); transform-origin: 50% 100%; animation: sway 3s ease-in-out infinite; }
.cocoa { left: 33%; bottom: 14.5%; font-size: clamp(22px, 5vw, 34px); }
.tree { right: -2%; bottom: 12.5%; font-size: clamp(120px, 36vw, 260px); filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .25)); transform-origin: 50% 100%; transition: filter .3s; }
.twinkle .tree { animation: treePop 1.2s ease; filter: drop-shadow(0 0 18px #ffe27a) brightness(1.15); }
[data-scene=christmas] #ginnyWrap { left: 44%; }
.hat { display: none; position: absolute; left: 30.5%; top: -2.2%; width: 32%; height: 8%; z-index: 3; transform: rotate(9deg); pointer-events: none; }
[data-scene=christmas] .hat { display: block; }
.hat::before { content: ''; position: absolute; inset: 0 0 16% 0; background: linear-gradient(90deg, #ff5a52, #c62828); clip-path: polygon(0 100%, 100% 100%, 90% 52%, 66% 12%, 40% 6%, 12% 46%); }
.hat::after { content: ''; position: absolute; left: -3%; right: -3%; bottom: 0; height: 24%; background: #fff; border-radius: 99px; box-shadow: 0 2px 3px rgba(0, 0, 0, .25); }
.hat b { position: absolute; left: 33%; top: -6%; width: 17%; aspect-ratio: 1; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.tree-hit { position: absolute; right: 2%; bottom: 13%; width: clamp(90px, 30%, 210px); height: 46%; background: none; border: 0; cursor: pointer; }
.gift { position: absolute; bottom: 2.5%; background: none; border: 0; padding: 0; line-height: 1; cursor: pointer; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), opacity .3s; animation: bob 2.6s ease-in-out infinite; filter-origin: center; }
.gift.opened { transform: scale(0); opacity: 0; pointer-events: none; }
.surprise { position: absolute; font-size: 52px; line-height: 1; pointer-events: none !important; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3)); }
.flake { position: absolute; top: -6%; color: #fff; text-shadow: 0 0 6px #fff; pointer-events: none !important; animation: snowfall linear forwards; }

/* paint */
.easel {
  position: absolute; right: 3%; bottom: 4%; width: clamp(170px, 52%, 460px); animation: pop .6s cubic-bezier(.2, 1.4, .4, 1);
  background: #fff; border: 6px solid #c98d55; border-radius: 14px; padding: 6px; box-shadow: 0 8px 0 #a56d3a, 0 14px 20px rgba(0, 0, 0, .25);
}
.easel canvas { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; background: #fff; touch-action: none; cursor: crosshair; }
.palette { display: flex; gap: 6px; justify-content: center; align-items: center; padding-top: 8px; flex-wrap: wrap; }
.dot { width: clamp(24px, 6vw, 34px); height: clamp(24px, 6vw, 34px); border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #0002, 0 3px 0 #0003; cursor: pointer; padding: 0; transition: transform .15s; }
.dot[aria-pressed=true] { transform: scale(1.3); box-shadow: 0 0 0 3px #4a1f6b, 0 3px 0 #0003; }
.dot.rainbow-dot { background: conic-gradient(red, orange, yellow, lime, cyan, blue, magenta, red); }
.dot.clear { background: #fff; font-size: 16px; line-height: 1; }

/* read */
.book {
  position: absolute; left: 50%; bottom: 4%; translate: -50% 0; width: min(88%, 520px); border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink);
  background: #fff; border-radius: 18px 18px 22px 22px; border-left: 12px solid #2b8cff; border-right: 12px solid #2b8cff;
  box-shadow: 0 8px 0 #1a62c2, 0 14px 22px rgba(0, 0, 0, .25); animation: pop .6s cubic-bezier(.2, 1.4, .4, 1); text-align: center;
}
.book .page { padding: 10px 14px 4px; }
.book .page.flip { animation: flip .5s ease; }
.book .pic { font-size: clamp(40px, 10vw, 70px); line-height: 1; }
.book p { margin: 4px 0 0; font-weight: 600; font-size: clamp(15px, 3.8vw, 24px); line-height: 1.2; }
.book small { display: block; padding: 4px 0 8px; opacity: .6; font-weight: 600; font-size: clamp(11px, 2.6vw, 14px); }

/* snack */
.leaf {
  position: absolute; top: -12%; background: none; border: 0; padding: 4px; font-size: clamp(34px, 8vw, 54px); cursor: pointer; line-height: 1;
  animation: fall 7s linear forwards, wiggle 1.3s ease-in-out infinite;
}
.counter {
  position: absolute; left: 50%; translate: -50% 0; bottom: 3%; background: #fff; border: 4px solid #3ddc84; border-radius: 99px; padding: 6px 24px; white-space: nowrap;
  font-weight: 700; font-size: clamp(19px, 5.4vw, 32px); box-shadow: 0 4px 0 #1b9650; color: #1b9650; pointer-events: none !important;
}

/* ---------- keyframes ---------- */
@keyframes gradientShift { 0%, 100% { background-position: 0 50%; } 50% { background-position: 100% 50%; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-1.4%) rotate(.6deg); } }
@keyframes sway { 0%, 100% { transform: rotate(-1.6deg); } 50% { transform: rotate(1.6deg); } }
@keyframes hop { 0% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(0) scale(1.06, .94); } 50% { transform: translateY(-9%) scale(.96, 1.05) rotate(4deg); } 80% { transform: translateY(0) scale(1.05, .95); } 100% { transform: translateY(0) scale(1); } }
@keyframes munch { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-3deg) scaleY(1.02); } 40% { transform: rotate(2deg); } 60% { transform: rotate(-3deg) scaleY(1.02); } 80% { transform: rotate(1deg); } }
@keyframes enter { 0% { transform: translateY(60%) scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes nod { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(-2.5deg) translateY(1%); } }
@keyframes readTilt { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(1deg) translateY(.8%); } }
@keyframes lookUp { 0%, 100% { transform: rotate(2.4deg) scale(1.01); } 50% { transform: rotate(-.6deg) scale(1.03); } }
@keyframes sleepy { 0%, 100% { transform: rotate(4deg) scaleY(.995); } 50% { transform: rotate(6.5deg) scaleY(1.005); } }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6) rotate(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-62vh) scale(1.15) rotate(24deg); opacity: 0; } }
@keyframes fall { from { top: -12%; } to { top: 96%; } }
@keyframes wiggle { 0%, 100% { rotate: -14deg; } 50% { rotate: 14deg; } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(150vw); } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes flip { 0% { transform: rotateY(90deg); opacity: 0; } 100% { transform: rotateY(0); opacity: 1; } }

/* wide screens: a bit more room */
@media (min-width: 800px) {
  #ginnyWrap { height: 82%; }
  [data-scene=paint] #ginnyWrap { left: 30%; }
}
/* Reduce Motion: calm the decorative loops only. Game animations (falling leaves, page turns) must keep running. */
@media (prefers-reduced-motion: reduce) {
  body, .sun, .moon, .fl, .tw, .rise, .flame, .lights::before, .lights::after, .flake, .leaf { animation-iteration-count: 1; }
  body { animation: none; }
  .leaf { animation: fall 7s linear forwards; }
  .rise, .flake { display: none; }
}
}

@keyframes blinkLights { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes flicker { from { transform: scale(1) rotate(-3deg); } to { transform: scale(1.12) rotate(3deg); } }
@keyframes treePop { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.06) rotate(-1.5deg); } 60% { transform: scale(1.04) rotate(1.5deg); } }
@keyframes snowfall { from { transform: translate(0, 0) rotate(0); } to { transform: translate(var(--dx), 112vh) rotate(260deg); } }

.counter.bump { animation: pop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes balloonUp { from { transform: translateY(0) rotate(-6deg); } to { transform: translateY(-115vh) rotate(8deg); } }
@keyframes talk { 0%, 100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(-2.2deg) translateY(-1%); } }

/* video overlay */
#movie { position: absolute; inset: 0; z-index: 20; background: rgba(5, 15, 40, .85); display: none; place-items: center; }
#movie.on { display: grid; animation: pop .35s ease-out; }
#movie video { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; background: transparent; }
#movie .close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; font-size: 20px; font-weight: 700; color: #12335f; background: #fff; cursor: pointer; box-shadow: 0 3px 0 #9cc4f5; }

/* storybook: closed cover -> zooms into a big page-turning book */
.cover {
  position: absolute; left: 50%; bottom: 4%; translate: -50% 0; width: clamp(170px, 54%, 300px); aspect-ratio: .8; cursor: pointer; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 12px 10px 10px 18px; color: #fff; text-align: center;
  background: linear-gradient(160deg, #4b97ff, #1d5fcf); border-radius: 8px 18px 18px 8px; border-left: 14px solid #1546a0;
  box-shadow: inset 0 3px 0 #ffffff55, 0 10px 0 #0f3a86, 0 16px 22px rgba(0, 20, 80, .35); animation: coverPulse 1.8s ease-in-out infinite;
}
.cover.away { display: none; }
.ctitle { font-weight: 700; font-size: clamp(15px, 4.4vw, 24px); line-height: 1.1; text-shadow: 0 2px 0 #0f3a86; }
.cart { width: 100%; flex: 1; min-height: 0; margin: 8px 0; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 3px #fff8; }
.cart svg { width: 100%; height: 100%; display: block; }
.cmeta { font-size: clamp(11px, 2.8vw, 14px); font-weight: 600; opacity: .9; }
.zoomed #ginnyWrap, .zoomed #bubble { opacity: 0; pointer-events: none; }
#ginnyWrap { transition: left .9s cubic-bezier(.25, .9, .3, 1.1), opacity .4s; }
#bubble { transition: opacity .3s; }
.bookzoom {
  position: absolute; inset: 2% 2.5% 2.5%; z-index: 6; perspective: 1800px; transform-origin: 50% 100%; animation: zoomIn .6s cubic-bezier(.2, .9, .3, 1.08);
  background: linear-gradient(160deg, #4b97ff, #1d5fcf); border-radius: 22px; padding: 9px; box-shadow: 0 14px 30px rgba(0, 20, 90, .5), inset 0 3px 0 #ffffff55; cursor: pointer;
}
.bookzoom.out { animation: zoomOut .42s ease-in forwards; }
.bpage {
  position: absolute; inset: 9px; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, #fffdf4, #f6eed8); box-shadow: inset 0 0 0 1px #0001, inset 6px 0 10px -6px rgba(90, 60, 10, .3);
}
.bpage .art { flex: none; width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 3px #fff, 0 3px 12px rgba(0, 60, 140, .25); background: #bfe0ff; }
.bpage .art svg { width: 100%; height: 100%; display: block; }
.bpage .txt { flex: 1; min-height: 0; margin: 0; display: grid; place-items: center; text-align: center; font-weight: 600; font-size: clamp(22px, 6.4vw, 32px); line-height: 1.25; color: var(--ink); }
.dots { display: flex; gap: 7px; justify-content: center; padding-bottom: 2px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #c9d9f2; }
.dots i.on { background: #2b8cff; transform: scale(1.25); }
.curl { position: absolute; right: 0; bottom: 0; width: 34px; height: 34px; background: linear-gradient(315deg, #e2d4ae 50%, transparent 50%); border-radius: 14px 0 14px 0; animation: curl 1.4s ease-in-out infinite; pointer-events: none; }
.bflip { position: absolute; inset: 9px; transform-origin: left center; transform-style: preserve-3d; display: none; pointer-events: none; }
.bflip.go { display: block; animation: bookFlip .85s cubic-bezier(.5, .05, .3, 1) forwards; }
.bface { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.bface.bfront { inset: 0; }
.bface.bback { transform: rotateY(180deg); background: linear-gradient(225deg, #fffdf4, #ebe0c3); border-radius: 14px; }
.close { position: absolute; top: 16px; left: 16px; z-index: 5; width: 42px; height: 42px; border-radius: 50%; border: 0; font-size: 18px; font-weight: 700; color: #12335f; background: #fff; cursor: pointer; box-shadow: 0 3px 0 #9cc4f5; }
@media (min-width: 760px) {
  .bpage { flex-direction: row; align-items: center; gap: 22px; padding: 18px 26px; }
  .bpage .art { width: auto; height: 100%; max-width: 55%; }
  .bpage .txt { height: 100%; font-size: clamp(22px, 2.6vw, 34px); }
  .bpage .dots { position: absolute; bottom: 14px; left: 0; right: 0; }
}
@keyframes bookFlip { to { transform: rotateY(-180deg); } }
.bflip.back.go { animation: bookFlipBack .85s cubic-bezier(.5, .05, .3, 1) forwards; }
@keyframes bookFlipBack { from { transform: rotateY(-180deg); } to { transform: rotateY(0deg); } }
@keyframes curl { 0%, 100% { width: 26px; height: 26px; } 50% { width: 42px; height: 42px; } }
@keyframes zoomIn { from { transform: translateY(34%) scale(.3); opacity: .1; } to { transform: none; opacity: 1; } }
@keyframes zoomOut { to { transform: translateY(34%) scale(.3); opacity: 0; } }
@keyframes coverPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* counting sheep */
.sheep { position: absolute; left: 0; bottom: 15.5%; z-index: 2; font-size: clamp(38px, 10vw, 58px); line-height: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 30, .35)); pointer-events: none !important; }
.counter.sheepc { border-color: #9fb0ff; color: #2c3a8c; box-shadow: 0 4px 0 #4a5bc0; background: #eef1ff; z-index: 3; }

/* "tap the tree" hint */
.tree-hit .tip { position: absolute; right: 2%; top: -6%; white-space: nowrap; pointer-events: none;
  padding: 7px 14px; border-radius: 99px; background: #fff; color: #12335f; font-weight: 700; font-size: clamp(12px, 3.2vw, 17px);
  box-shadow: 0 3px 0 #9cc4f5, 0 6px 12px rgba(0, 40, 120, .3); animation: tipBounce 1.2s ease-in-out infinite; z-index: 4; }
.tree-hit .tip::after { content: ''; position: absolute; right: 36px; bottom: -7px; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); }
@keyframes tipBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
