:root {
  --paper: #ffffff;
  --ink: #1d2b4f;
  --navy: #1e3a6e;
  --star: #ffd23f;
  --sea: #125cad;
  --mint: #b1ebdf;
  --sand: #fcdc9f;
  --sun: #fff4cc;
  --line: #d9e4ee;
  --head: "Fredoka", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
section { scroll-margin-top: 84px; }
body {
  margin: 0; overflow-x: hidden;
  background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.55 var(--body);
}
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--sea); outline-offset: 3px; border-radius: 8px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 12px; background: var(--paper); padding: 8px 12px; z-index: 60; }

.outline {
  font: 700 clamp(2rem, 5vw, 3.2rem)/1.06 var(--head);
  color: #fff;
  -webkit-text-stroke: 0.1em var(--sea);
  paint-order: stroke fill;
  text-shadow: 0 0.08em 0 rgba(18, 92, 173, 0.28);
  margin: 0 0 0.4em;
}

.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font: 700 1.05rem var(--body); color: var(--ink);
  background: var(--paper); border: 3px solid var(--ink); border-radius: 999px;
  padding: 11px 22px; box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn-star { background: var(--star); }

/* ---------- Floating nav ---------- */
.top {
  position: fixed; z-index: 50; top: 14px; left: 50%; translate: -50% 0;
  width: min(980px, calc(100% - 24px));
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 6px 16px;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px);
  border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 700 1.5rem/1 var(--head); }
.brand img { width: 28px; transition: rotate 0.3s ease; }
.brand:hover img { rotate: -12deg; }
.brand .brand-pip { width: 24px; margin: 0 0 0 -14px; align-self: flex-start; }
.brand:hover .brand-pip { rotate: 14deg; translate: 0 -3px; }
.brand i { font-style: normal; color: #e0a800; }
.brand span { white-space: nowrap; }
.top nav { display: flex; align-items: center; gap: 4px; }
.top nav a {
  white-space: nowrap;
  color: var(--ink); text-decoration: none; font: 700 1rem var(--body);
  padding: 9px 16px; border-radius: 999px; transition: background 0.15s ease;
}
.top nav a:hover { background: var(--mint); }
.top nav a.nav-cta { background: var(--star); border: 2px solid var(--ink); }
.top nav a.nav-cta:hover { background: #ffe27a; }

/* ---------- Intro ---------- */
.intro {
  position: relative; overflow: hidden;
  height: max(640px, 100svh);
  background: linear-gradient(#7cc8f7, #b9e3fb 55%, #e3f5ff);
}
.sky .sun {
  position: absolute; right: 3%; top: 11%; width: 120px; height: 120px; border-radius: 50%;
  background: #ffd23f; box-shadow: 0 0 0 22px rgba(255, 210, 63, 0.3), 0 0 0 48px rgba(255, 210, 63, 0.14);
  animation: glow 6s ease-in-out infinite;
}
@keyframes glow { 50% { scale: 1.06; } }
.clouds i {
  position: absolute; display: block; height: 46px; border-radius: 999px; background: #fff; opacity: 0.95;
  animation: drift 70s linear infinite;
}
.clouds i::before, .clouds i::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.clouds i::before { width: 60px; height: 60px; left: 22px; top: -28px; }
.clouds i::after { width: 44px; height: 44px; left: 70px; top: -18px; }
.clouds i:nth-child(1) { width: 150px; top: 20%; }
.clouds i:nth-child(2) { width: 120px; top: 36%; animation-duration: 90s; animation-delay: -40s; }
.clouds i:nth-child(3) { width: 170px; top: 13%; animation-duration: 110s; animation-delay: -75s; opacity: 0.75; }
@keyframes drift { from { translate: -20vw 0; } to { translate: 120vw 0; } }

.intro .far, .intro .mid, .intro .front { position: absolute; left: 0; width: 100%; bottom: 0; }
.intro .far { height: 46%; }
.intro .mid { height: 34%; }
.intro .front { height: 20%; }
.flowers i {
  position: absolute; bottom: calc(6% + var(--y, 0px)); width: 14px; height: 14px; border-radius: 50%;
  background: var(--f); box-shadow: 0 0 0 4px #fff;
}
.flowers i:nth-child(1) { left: 5%; --f: #f58fbf; --y: 30px; }
.flowers i:nth-child(2) { left: 12%; --f: #ffd23f; --y: 10px; }
.flowers i:nth-child(3) { left: 27%; --f: #e5463b; --y: 40px; }
.flowers i:nth-child(4) { left: 58%; --f: #9466d6; --y: 20px; }
.flowers i:nth-child(5) { left: 71%; --f: #ffd23f; --y: 44px; }
.flowers i:nth-child(6) { left: 88%; --f: #f58fbf; --y: 16px; }
.flowers i:nth-child(7) { left: 95%; --f: #5bb8f0; --y: 36px; }

.intro-text {
  position: relative; z-index: 3;
  width: min(1100px, 100%); margin: 0 auto;
  padding: clamp(110px, 16vh, 150px) clamp(20px, 5vw, 64px) 0;
}
.headline { margin: 0 0 18px; font-family: var(--head); line-height: 0.95; }
.headline span {
  display: block; width: fit-content;
  font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 700;
  color: #fff; -webkit-text-stroke: 0.11em var(--ink); paint-order: stroke fill;
  text-shadow: 0 0.09em 0 var(--ink);
}
.headline span:nth-child(1) { rotate: -2deg; }
.headline span:nth-child(2) { rotate: 1deg; margin-left: 0.4em; }
.headline .big {
  font-size: clamp(4rem, 11vw, 8rem); color: var(--star); rotate: -3deg; margin: 4px 0 24px;
  animation: wobble 5s ease-in-out infinite;
}
@keyframes wobble { 0%, 100% { rotate: -3deg; } 50% { rotate: 1deg; } }
.intro-text p { font-size: 1.15rem; font-weight: 600; max-width: 24em; margin: 0 0 24px; }
.cta { display: flex; flex-wrap: wrap; gap: 14px; }

/* Book covers fanned in the sky */
.fan {
  position: absolute; z-index: 1; right: clamp(24px, 5vw, 96px);
  bottom: calc(9% + clamp(130px, 26vh, 250px) * 0.42);
  display: flex; align-items: flex-start;
  animation: bob 6s ease-in-out infinite;
}
@keyframes bob { 50% { translate: 0 -10px; } }
.fan a {
  display: block; width: clamp(120px, 12vw, 200px); margin-left: -60px;
  rotate: var(--r); transform-origin: 50% 120%;
  border: 4px solid #fff; border-radius: 10px; background: #fff;
  box-shadow: 0 6px 0 var(--c), 0 14px 24px rgba(13, 50, 80, 0.25);
  transition: translate 0.2s ease, rotate 0.2s ease;
}
.fan a:first-child { margin-left: 0; }
.fan a img { border-radius: 6px; }
.fan a:hover, .fan a:focus-visible { translate: 0 -18px; rotate: 0deg; z-index: 1; }

/* Four Cappys standing on the front hill */
.parade {
  position: absolute; z-index: 2; right: clamp(8px, 4vw, 60px); bottom: 9%;
  display: flex; align-items: flex-end; gap: clamp(2px, 1.2vw, 18px);
}
.parade > img:not(.hero-pip) {
  height: clamp(130px, 26vh, 250px); width: auto; transform-origin: 50% 100%;
  animation: breathe 3.6s ease-in-out infinite;
}
.parade > img:nth-child(2) { animation-delay: -0.9s; }
.parade > img:nth-child(3) { animation-delay: -1.8s; }
.parade > img:nth-child(4) { animation-delay: -2.7s; }
.parade > img:nth-child(5) { animation-delay: -3.6s; }
@keyframes breathe { 50% { scale: 1.02 0.98; } }
.parade > img.landed { animation: squash 0.45s ease-out; }
@keyframes squash { 30% { scale: 1.08 0.9; } 65% { scale: 0.97 1.04; } }
.hero-pip { position: absolute; left: 0; top: 0; width: clamp(48px, 5vw, 72px); height: auto; pointer-events: none; }

/* ---------- Worlds ---------- */
.world { position: relative; }
.stage { position: absolute; inset: 0 auto 0 0; width: 46%; z-index: 5; pointer-events: none; }
.pin { position: sticky; top: 0; height: 100svh; display: grid; place-items: end center; padding-bottom: 9vh; }
.actor { position: relative; width: clamp(180px, 22vw, 300px); aspect-ratio: 3 / 4.4; }
.actor .cappy {
  position: absolute; inset: auto 0 0 0; margin: auto; width: 100%; height: auto;
  opacity: 0; scale: 0.6; transform-origin: 50% 100%;
  transition: opacity 0.25s ease, scale 0.35s cubic-bezier(.3, 1.6, .5, 1);
}
.actor .cappy.is-on { opacity: 1; scale: 1; animation: idle 3.2s ease-in-out infinite; }
@keyframes idle { 0%, 100% { translate: 0 0; rotate: -1.5deg; } 50% { translate: 0 -8px; rotate: 1.5deg; } }
.actor .pip { position: absolute; width: 30%; left: 30%; bottom: 90%; transform-origin: 50% 100%; animation: pip-idle 4s ease-in-out infinite; }
@keyframes pip-idle {
  0%, 60%, 100% { translate: 0 0; } 68% { translate: 0 -22px; } 76% { translate: 0 0; } 82% { translate: 0 -10px; } 88% { translate: 0 0; }
}
.actor.swap .pip { animation: pip-swap 0.7s ease-out; }
@keyframes pip-swap { 45% { translate: 40px -90px; rotate: 20deg; } }
.puff { position: absolute; left: 50%; top: 45%; width: 10px; height: 10px; border-radius: 50%; translate: -50% -50%; opacity: 0; }
.actor.swap .puff { animation: puff 0.6s ease-out; }
@keyframes puff {
  0% { opacity: 0.95; box-shadow: 0 0 0 0 #fff, 40px -30px 0 6px #fff, -46px -10px 0 8px #fff, 30px 40px 0 4px #fff, -30px 50px 0 6px #fff; }
  100% { opacity: 0; box-shadow: 0 0 0 120px rgba(255,255,255,0), 120px -90px 0 0 #fff, -130px -30px 0 0 #fff, 90px 110px 0 0 #fff, -90px 120px 0 0 #fff; }
}

.scene {
  position: relative; overflow: hidden; min-height: 100svh;
  display: grid; align-items: center;
  padding: 100px clamp(16px, 5vw, 72px) 120px 46%;
}
.decor { position: absolute; inset: 0; z-index: 0; }
.decor .ground { position: absolute; left: 0; bottom: 0; width: 100%; height: 22vh; z-index: 0; }
.decor .a { position: absolute; z-index: 1; width: auto; transition: translate 1s cubic-bezier(.2, .9, .3, 1.2), opacity 0.6s ease; }

.card {
  position: relative; z-index: 6;
  display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr); gap: 24px; align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border: 4px solid var(--c); border-radius: 28px;
  padding: clamp(16px, 2.5vw, 28px); box-shadow: 0 10px 0 var(--c);
  max-width: 640px;
  translate: 0 40px; opacity: 0;
  transition: translate 0.7s cubic-bezier(.2, .9, .3, 1.15), opacity 0.5s ease;
}
.scene.is-in .card { translate: 0 0; opacity: 1; }
.cover { border-radius: 10px; rotate: -3deg; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2); }
.card h2 { font: 700 clamp(1.5rem, 2.6vw, 2.1rem)/1.1 var(--head); color: var(--c); margin: 0 0 8px; }
.card p { margin: 0 0 10px; }
.card .meta { font-weight: 800; color: var(--c); }
.card .btn { margin-top: 6px; font-size: 0.98rem; }

.scene-xmas { background: linear-gradient(#bcd9f5, #e3f0fc 70%); }
.snow { position: absolute; inset: 0; }
.snow i { position: absolute; top: -20px; width: var(--s); height: var(--s); border-radius: 50%; background: #fff; opacity: 0.9; animation: fall var(--d) linear infinite; animation-delay: var(--del); }
@keyframes fall { to { translate: var(--x) 110vh; } }
.a-snowman { height: 30vh; left: 4%; bottom: 10vh; }
.a-reindeer { height: 17vh; left: 31%; bottom: 10vh; translate: 30vw 0; opacity: 0; }
.a-penguin { height: 15vh; right: 6%; bottom: 9vh; translate: 0 40px; opacity: 0; }
.scene-xmas.is-in .a-reindeer, .scene-xmas.is-in .a-penguin { translate: 0 0; opacity: 1; }

.scene-safari { background: linear-gradient(#ffd77a, #ffeec2 75%); }
.scene-safari .sun { position: absolute; width: 22vh; height: 22vh; border-radius: 50%; background: #ffb43b; right: 8%; top: 12%; box-shadow: 0 0 0 26px rgba(255, 180, 59, 0.25), 0 0 0 56px rgba(255, 180, 59, 0.12); animation: glow 5s ease-in-out infinite; }
.tree { position: absolute; width: 34vh; right: 46%; bottom: 15vh; }
.a-giraffe { height: 36vh; left: 3%; bottom: 9vh; translate: 0 50vh; }
.a-elephant { height: 18vh; right: 30%; bottom: 7vh; translate: 40vw 0; }
.a-lion { height: 15vh; right: 10%; bottom: 6vh; translate: 40vw 0; }
.a-zebra { height: 16vh; left: 33%; bottom: 5vh; translate: -40vw 0; }
.scene-safari.is-in .a { translate: 0 0; }
.scene-safari.is-in .a-elephant { transition-delay: 0.15s; }
.scene-safari.is-in .a-lion { transition-delay: 0.3s; }

.scene-bakery { background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 6px, transparent 7px) 0 0 / 46px 46px, linear-gradient(#ffc9dc, #ffe6ef 80%); }
.counter { position: absolute; left: 0; right: 0; bottom: 0; height: 18vh; background: repeating-linear-gradient(90deg, #fff 0 40px, #ff8fb5 40px 80px); border-top: 10px solid #d9668f; }
.scene-bakery .a { animation: float 5s ease-in-out infinite; }
.a-cake { height: 15vh; right: 4%; bottom: 15vh; animation: none !important; }
.a-cupcake { height: 12vh; left: 30%; top: 16%; }
.a-donut { height: 11vh; right: 12%; top: 12%; animation-delay: -1s !important; }
.a-cookie { height: 9vh; left: 6%; top: 22%; animation-delay: -2s !important; }
.a-strawberry { height: 9vh; right: 40%; top: 8%; animation-delay: -3s !important; }
@keyframes float { 50% { translate: 0 -16px; rotate: 6deg; } }

.scene-ocean { background: linear-gradient(#8ee0d6, #3fa9c9 55%, #1f6fa8); }
.rays { position: absolute; inset: 0; background: repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.16) 0 40px, transparent 40px 140px); mask-image: linear-gradient(#000, transparent 70%); animation: rays 9s ease-in-out infinite alternate; }
@keyframes rays { to { translate: 60px 0; } }
.bubbles i { position: absolute; bottom: -30px; width: var(--s); height: var(--s); border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.15); animation: rise var(--d) linear infinite; animation-delay: var(--del); }
@keyframes rise { to { translate: var(--x) -110vh; } }
/* Whale and turtle face right; the fish faces left, so it swims right-to-left. */
.a-whale { height: 16vh; top: 14%; left: 0; opacity: 0.85; animation: swim-r 38s linear infinite; }
.a-turtle { height: 11vh; top: 26%; left: 0; animation: swim-r 30s linear infinite; animation-delay: -12s; }
.a-fish { height: 8vh; top: 42%; left: 0; animation: swim-l 16s linear infinite; animation-delay: -6s; }
.a-octopus { height: 13vh; right: 10%; bottom: 14vh; animation: float 4s ease-in-out infinite; }
.a-crab { height: 8vh; left: 30%; bottom: 5vh; animation: scuttle 7s ease-in-out infinite; }
.a-starfish { height: 7vh; right: 30%; bottom: 4vh; rotate: 12deg; }
@keyframes swim-r { from { translate: -20vw 0; } to { translate: 110vw -30px; } }
@keyframes swim-l { from { translate: 110vw 0; } to { translate: -20vw 20px; } }
@keyframes scuttle { 50% { translate: 80px 0; } }

.scene-garden { background: linear-gradient(#bfe6ff, #e9f7ff 60%, #f3fbe9); }
.g-sun { position: absolute; width: 18vh; height: 18vh; border-radius: 50%; background: #ffd23f; left: 8%; top: 10%; box-shadow: 0 0 0 22px rgba(255, 210, 63, 0.25), 0 0 0 48px rgba(255, 210, 63, 0.12); animation: glow 6s ease-in-out infinite; }
.scene-garden .ga-tulip { height: 12vh; left: 3%; bottom: 6vh; }
.scene-garden .ga-sunflower { height: 17vh; left: 52%; bottom: 7vh; }
.scene-garden .ga-pumpkin { height: 10vh; right: 24%; bottom: 5vh; }
.scene-garden .ga-snowman { height: 15vh; right: 4%; bottom: 7vh; }
.scene-garden .ga-butterfly { height: 7vh; left: 35%; top: 30%; animation: flutter 9s ease-in-out infinite; }
.scene-garden .ga-leaf { height: 6vh; left: 40%; top: -10vh; animation: g-fall 11s linear infinite; }
.scene-garden .ga-flake { height: 5vh; left: 7%; top: -10vh; animation: g-fall 13s linear infinite; animation-delay: -6s; }
@keyframes flutter { 25% { translate: 60px -30px; rotate: -8deg; } 50% { translate: 120px 10px; } 75% { translate: 50px 30px; rotate: 8deg; } }
@keyframes g-fall { from { translate: 0 0; rotate: 0deg; } to { translate: -80px 110vh; rotate: 300deg; } }

.soon { text-align: center; font: 600 1.3rem var(--head); color: var(--navy); margin: 0; padding: 26px 16px; background: var(--sand); }

/* ---------- Studio ---------- */
.studio { background: var(--sun); padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 48px); }
.studio-head { text-align: center; margin-bottom: 24px; }
.studio-head p { margin: 0; font-size: 1.15rem; }
.widget {
  max-width: 1120px; margin: 0 auto;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 28px;
  padding: clamp(14px, 3vw, 26px); box-shadow: 10px 10px 0 var(--star);
}
.table { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
.table > * { min-width: 0; }
.paper-wrap { justify-self: center; max-width: 100%; border: 2px solid var(--line); border-radius: 16px; padding: 10px; }
.paper { position: relative; }
#fill-layer { display: block; width: auto; height: auto; max-width: 100%; max-height: 66vh; }
#line-layer { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.paper.brush #line-layer { cursor: cell; }
.modes { display: grid; grid-template-columns: 1fr 1fr; background: #eef3f8; border-radius: 999px; padding: 4px; margin-bottom: 12px; }
.modes button { font: 800 1rem var(--body); color: var(--ink); background: none; border: 0; border-radius: 999px; padding: 8px; cursor: pointer; }
.modes button[aria-checked="true"] { background: var(--paper); box-shadow: 0 2px 0 var(--ink); outline: 2px solid var(--ink); }
.sizes { display: flex; gap: 8px; margin-bottom: 12px; }
.sizes button { flex: 1; height: 40px; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--line); border-radius: 12px; cursor: pointer; }
.sizes button i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }
.sizes button[aria-checked="true"] { border-color: var(--ink); }
.crayons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 4px; }
.crayon { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; display: grid; justify-items: center; gap: 2px; font: 700 0.68rem var(--body); color: var(--ink); }
.crayon svg { width: 30px; height: 80px; transition: transform 0.15s ease; }
.crayon[aria-checked="true"] svg { transform: translateY(-10px); }
.crayon[aria-checked="true"] span { text-decoration: underline 3px var(--star); text-underline-offset: 3px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.actions button { font: 700 0.95rem var(--body); color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 999px; padding: 9px 10px; cursor: pointer; }
.actions button:hover { background: var(--mint); }
.actions #save { background: var(--star); }
.pop { position: fixed; z-index: 70; pointer-events: none; width: 10px; height: 10px; border-radius: 50%; animation: pop 0.6s ease-out forwards; }
@keyframes pop { to { translate: var(--x) var(--y); opacity: 0; scale: 0.3; } }

/* ---------- Unlock ---------- */

footer { padding: 22px 16px; text-align: center; font-size: 0.9rem; background: var(--sand); }
footer p { margin: 0; }

/* ---------- Games ---------- */
.play { background: #e6f6ff; padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 48px); }
.game {
  --c: #e0a800; scroll-margin-top: 92px; max-width: 960px; margin: 0 auto; background: #fff;
  border: 3px solid var(--ink); border-radius: 26px; padding: clamp(12px, 2.4vw, 22px);
  box-shadow: 10px 10px 0 var(--c); transition: box-shadow .3s;
}
.game-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.game-title { margin: 0; font: 700 clamp(1.3rem, 3vw, 1.7rem) var(--head); color: var(--c); }
.game-sound {
  display: grid; place-items: center; width: 42px; height: 42px; flex: none; cursor: pointer;
  border: 2px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink);
}
.game-sound[aria-pressed="false"] { color: #8a94a8; }
.g-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.g-chips button, .game-help {
  font: 700 0.92rem var(--body); color: var(--ink); background: #fff; cursor: pointer;
  border: 2px solid var(--c, var(--ink)); border-radius: 999px; padding: 6px 13px;
}
.g-chips button[aria-pressed="true"] { background: var(--c); color: #fff; }
.g-stage { position: relative; }
.game-foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 12px; }
.game-foot.no-help { grid-template-columns: auto 1fr; }
.game-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.game-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--c); background: #fff; }
.game-dots i.got { background: var(--star); border-color: var(--ink); }
.game-dots i.now { box-shadow: 0 0 0 3px rgba(255, 210, 63, .6); }
.game-msg { margin: 0; min-height: 1.3em; font: 600 1.12rem/1.25 var(--head); color: var(--ink); text-align: center; }
.game-help { border-color: var(--star); background: #fff8dc; }
.bit { position: absolute; width: 10px; height: 10px; border-radius: 3px; pointer-events: none; translate: -50% -50%; z-index: 20; animation: bit .9s ease-out forwards; }
@keyframes bit { to { translate: calc(-50% + var(--dx)) calc(-50% + var(--dy)); rotate: 220deg; opacity: 0; } }
.game-done {
  position: absolute; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: rgba(255, 255, 255, .96); border-radius: 16px; text-align: center; line-height: 1.3; padding: 16px;
  place-content: safe center; overflow: hidden;
}
.g-stage:has(> .game-done) { min-height: var(--need, 0px); }
.game-done > img { width: clamp(80px, 14vw, 120px); animation: bob 2s ease-in-out infinite; }
.done-title { font: 700 clamp(1.5rem, 4vw, 2.2rem)/1.15 var(--head); color: var(--ink); margin: 0; }
.done-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 6px; }
@keyframes wiggle { 20%, 60% { rotate: -6deg; } 40%, 80% { rotate: 6deg; } }
@keyframes hop { 40% { translate: 0 -18px; } }

/* Find Pip */
.pic { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; border-radius: 16px; overflow: hidden; border: 2px solid var(--line); background: #fff; line-height: 0; }
.pic > img { display: block; width: auto; height: auto; max-width: 100%; max-height: max(320px, calc(100svh - 300px)); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.fx { position: absolute; inset: 0; pointer-events: none; }
.fx span { position: absolute; translate: -50% -50%; }
.fx .miss { width: 44px; height: 44px; border: 4px solid #ff7aa8; border-radius: 50%; animation: miss .5s ease-out forwards; }
@keyframes miss { from { scale: .3; opacity: 1; } to { scale: 1.3; opacity: 0; } }
.fx .hint { width: var(--s); height: var(--s); border: 5px dashed var(--star); border-radius: 50%; background: rgba(255, 210, 63, .14); animation: hint 1.2s ease-in-out infinite; }
@keyframes hint { 50% { scale: 1.12; } }
.fx .glow { width: var(--s); height: var(--s); border-radius: 50%; background: radial-gradient(rgba(255, 210, 63, .85), rgba(255, 210, 63, 0) 70%); animation: glow 1.8s ease-out forwards; }
@keyframes glow { from { scale: .2; } 30% { scale: 1.4; } to { scale: 1.1; opacity: .8; } }
.fx .pip-out { width: var(--s); animation: pip-pop 1.8s cubic-bezier(.3, 1.6, .5, 1) forwards; }
.fx .pip-out img { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 0 rgba(29, 43, 79, .25)); }
@keyframes pip-pop { 0% { scale: 0; translate: -50% -50%; } 25% { scale: 1.25; translate: -50% -110%; } 45% { scale: 1; translate: -50% -80%; } 60% { translate: -50% -120%; } 75%, 100% { scale: 1; translate: -50% -85%; } }

/* Decorate the tree */
.tree-stage { display: grid; gap: 12px; }
.tree-scene {
  position: relative; width: min(100%, calc((100svh - 330px) * 400 / 470), 440px); min-width: 240px; margin: 0 auto;
  aspect-ratio: 400 / 470; border-radius: 16px; background: linear-gradient(#cfe6fb, #eef7ff);
}
.xtree { position: absolute; inset: 0; width: 100%; height: 100%; }
.xtree .lights circle { opacity: 0; }
.xtree.lit .lights circle { opacity: 1; animation: twinkle 1s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes twinkle { to { opacity: .35; } }
.orn-layer { position: absolute; inset: 0; }
.orn { position: absolute; width: 11%; translate: -50% -50%; pointer-events: none; animation: hang .45s cubic-bezier(.3, 1.6, .5, 1); }
.orn svg, .orn img { display: block; width: 100%; height: auto; }
.orn.pip { width: 13%; }
.orn.star-top { width: 17%; animation: star-on .8s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes hang { from { scale: 1.6; } }
@keyframes star-on { from { scale: 0; rotate: -180deg; } }
.orn.ghost { position: fixed; z-index: 100; animation: none; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .25)); }
.tree-cappy { position: absolute; right: -14%; bottom: 2%; width: 30%; pointer-events: none; }
.tree-cappy.cheer { animation: hop .6s ease-in-out 3; }
.tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tray-item {
  width: 62px; height: 62px; padding: 8px; display: grid; place-items: center; cursor: grab; touch-action: none;
  background: #fff; border: 3px solid var(--line); border-radius: 16px;
}
.tray-item svg, .tray-item img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.star-item { opacity: .45; }
.star-item.ready { opacity: 1; border-color: var(--star); animation: hint 1s ease-in-out infinite; }

/* Letter safari */
.abc-stage { display: grid; gap: 16px; padding: 6px 0; }
.abc-top { display: flex; justify-content: center; align-items: center; gap: 16px; }
.abc-cappy { height: clamp(80px, 13vw, 120px); }
.abc-letter {
  display: flex; align-items: baseline; gap: 6px; padding: 6px 26px; border-radius: 22px;
  background: var(--c); color: #fff; border: 4px solid var(--ink); box-shadow: 0 6px 0 var(--ink);
  font: 700 clamp(3.6rem, 10vw, 5.6rem)/1 var(--head);
}
.abc-letter .lower { font-size: .6em; opacity: .9; }
.abc-letter.bounce { animation: hang .5s cubic-bezier(.3, 1.6, .5, 1); }
.abc-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 2vw, 16px); width: min(100%, calc((100svh - 420px) * 2.4)); min-width: min(100%, 300px); margin: 0 auto; }
.abc-card {
  display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: 6px; padding: 12px 8px; cursor: pointer; overflow: hidden;
  aspect-ratio: 5 / 6; background: #fff7e8; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 5px 0 var(--c);
}
.abc-card img { width: 85%; height: 100%; min-height: 0; object-fit: contain; }
.abc-card .name { font: 700 1.05rem var(--head); color: var(--ink); visibility: hidden; }
.abc-card.named .name { visibility: visible; }
.abc-card.nope { animation: wiggle .45s; opacity: .55; }
.abc-card.yes { background: #fff1b8; border-color: var(--ink); animation: hop .6s ease-in-out 2; }

/* Count the treats */
.bake-stage { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "order plate" "shelf shelf"; gap: 14px; align-items: center; }
.bake-order { grid-area: order; display: flex; align-items: flex-end; }
.bake-cappy { height: clamp(110px, 18vw, 170px); }
.bubble {
  display: grid; justify-items: center; gap: 2px; margin: 0 0 60px -8px; padding: 10px 16px;
  background: #fff; border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 4px 0 var(--c);
}
.bubble .num { font: 700 3.4rem/1 var(--head); color: var(--c); }
.bubble .what { font: 700 1rem var(--head); }
.bubble .want { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 120px; }
.bubble .want i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--c); }
.bubble .want i.on { background: var(--c); }
.plate {
  grid-area: plate; justify-self: center; width: min(100%, 480px); min-height: 190px; display: grid; place-items: center; padding: 26px 46px;
  background: #fff; border: 4px solid var(--ink); border-radius: 50%;
  box-shadow: inset 0 0 0 18px #fff, inset 0 0 0 21px #cfe5e1, 0 10px 0 rgba(29, 43, 79, .12);
}
.plate.yum { animation: hop .5s ease-in-out 2; }
.plate-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; max-width: 360px; }
.shelf {
  grid-area: shelf; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; padding: 10px;
  background: #f6d7b0; border: 3px solid var(--ink); border-radius: 16px; box-shadow: inset 0 -8px 0 #e3b57f; min-height: 80px;
}
.treat { width: 84px; height: 84px; padding: 4px; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
.treat img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.treat.land { animation: hang .35s cubic-bezier(.3, 1.6, .5, 1); }

/* Garden: Season Sorter */
.ss-stage { display: grid; gap: 10px; }
.ss-q { margin: 0; text-align: center; font: 700 clamp(1.3rem, 3.4vw, 1.9rem) var(--head); color: var(--c); }
.ss-top { display: flex; align-items: center; justify-content: center; padding: 14px; border-radius: 18px; background: linear-gradient(#d8f0ff, #f3fbe9 70%, #cdeba9); border: 3px solid var(--ink); }
.ss-thing { display: block; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
.ss-thing img { display: block; height: clamp(120px, calc(100svh - 600px), 200px); width: auto; max-width: 100%; object-fit: contain; pointer-events: none; }
.ss-thing.ss-in { animation: ss-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes ss-pop { from { scale: .3; opacity: 0; } }
.ss-bins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ss-bin {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 150px; padding: 10px 6px 8px;
  font: inherit; color: var(--ink); background: var(--sb); border: 3px solid var(--ink); border-radius: 18px; cursor: pointer; touch-action: manipulation;
  box-shadow: inset 0 -8px 0 var(--sc);
}
.ss-bin:hover { translate: 0 -2px; }
.ss-bin:focus-visible { outline: 4px solid var(--star); outline-offset: 3px; }
.ss-bin b { font: 700 clamp(1rem, 2.6vw, 1.25rem) var(--head); }
.ss-emb svg { width: 46px; height: 46px; display: block; }
.ss-got { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.ss-got img { width: 40px; height: 40px; object-fit: contain; }
.ss-bin.nope { animation: wiggle .45s; }
.ss-bin.yes { animation: ss-bump .4s ease-out; }
@keyframes ss-bump { 50% { scale: 1.07; } }
@media (max-width: 560px) {
  .ss-bins { grid-template-columns: repeat(2, 1fr); }
  .ss-bin { min-height: 104px; grid-template-columns: auto 1fr; justify-items: start; align-items: center; text-align: left; }
  .ss-got { grid-column: 1 / -1; justify-content: flex-start; }
  .ss-emb svg { width: 36px; height: 36px; }
}

/* Ocean opposites */
.opp-stage { display: grid; gap: 10px; }
.opp-q { text-align: center; font: 700 clamp(1.3rem, 3.4vw, 1.9rem) var(--head); color: var(--c); }
.opp-sea {
  position: relative; height: clamp(300px, calc(100svh - 360px), 440px); border-radius: 18px; overflow: hidden;
  background: linear-gradient(#bfe9ff, #5bb8e8); display: flex; justify-content: space-around; align-items: center; container-type: inline-size;
}
.opp-sea::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 14%; background: #f6dfae; border-top: 3px solid var(--ink); }
.bub { position: absolute; bottom: -20px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; opacity: .7; animation: rise 7s linear infinite; }
.bub:nth-child(1) { left: 12%; } .bub:nth-child(2) { left: 52%; animation-delay: -3s; width: 12px; height: 12px; } .bub:nth-child(3) { left: 84%; animation-delay: -5s; }
@keyframes rise { to { translate: 0 -480px; } }
.opp-item { position: relative; z-index: 1; border: 0; background: none; padding: 6px; cursor: pointer; touch-action: manipulation; border-radius: 20px; }
.opp-item img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; pointer-events: none; margin: 0 auto; }
.opp-item.nope { animation: wiggle .45s; }
.opp-item.yes { background: rgba(255, 210, 63, .5); outline: 4px dashed var(--star); }
.kind-size .opp-item { height: calc(72% * var(--k)); max-width: 46%; margin-bottom: 8%; align-self: flex-end; }
.kind-height { flex-direction: row; }
.kind-height .opp-item { height: 26%; align-self: center; }
.kind-height .opp-item.at-top { align-self: flex-start; margin-top: 4%; }
.kind-height .opp-item.at-bottom { align-self: flex-end; margin-bottom: 15%; }
.kind-fill .opp-item { width: min(30%, 190px); }
.jar svg { display: block; width: 100%; height: auto; }
.jar-in { position: absolute; left: 16%; right: 16%; bottom: 9%; height: 52%; display: flex; flex-wrap: wrap-reverse; justify-content: center; align-content: flex-start; gap: 2px; }
.jar-in img { width: 40%; height: auto; animation: bob 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.6s); }

@media (max-width: 640px) {
  .game { box-shadow: 6px 6px 0 var(--c); border-radius: 20px; }
  .g-chips button { padding: 5px 9px; font-size: 0.82rem; }
  .game-sound { width: 36px; height: 36px; }
  .game-foot { grid-template-columns: 1fr auto; }
  .game-foot.no-help { grid-template-columns: 1fr; }
  .game-msg { grid-column: 1 / -1; grid-row: 1; }
  .pic > img { max-height: max(300px, calc(100svh - 320px)); }
  .arcade-btn img { height: 48px; }
  .arcade-btn b { font-size: 0.88rem; }
  .tray-item { width: 52px; height: 52px; padding: 6px; }
  .bake-stage { grid-template-columns: 1fr; grid-template-areas: "order" "plate" "shelf"; }
  .bake-order { justify-content: center; }
  .bubble { margin-bottom: 40px; }
  .plate { min-height: 150px; padding: 20px 30px; }
  .treat { width: 58px; height: 58px; }
  .opp-sea { height: clamp(280px, 52svh, 400px); }
}
@media (prefers-reduced-motion: reduce) {
  .fx span, .bit, .orn, .abc-card, .plate, .opp-item { animation-duration: .01s !important; }
  .kind-speed .opp-item { animation-duration: var(--sw) !important; }
  .scene-garden .a, .g-sun, .ss-thing.ss-in, .ss-bin { animation: none !important; }
}

/* Find Pip counter */
.game-dots.pip-count { align-items: center; gap: 6px; font: 700 1.1rem var(--head); color: var(--ink); }
.pip-count img { width: 30px; height: auto; }
.pip-count b { color: var(--c); font-size: 1.3rem; }

/* Lock card + locked bits */
.game-lock .lock-ico { width: 64px; height: auto; animation: wiggle 1.2s ease-in-out 1; }
.lock-text { margin: 0; max-width: 34ch; font-size: 1.02rem; color: var(--ink); }
.game-dots i.lk { border-style: dashed; opacity: .55; }
.tray-item.locked { position: relative; cursor: pointer; opacity: .5; filter: grayscale(.7); }
.tray-item.locked::after {
  content: ""; position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: #ffd23f url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='11' width='14' height='10' rx='2' fill='%231d2b4f'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' fill='none' stroke='%231d2b4f' stroke-width='2.5'/%3E%3C/svg%3E") center / 14px no-repeat;
  border: 2px solid var(--ink);
}
/* fast / slow: two lanes, each swims one way only, facing forward */
.kind-speed { display: block; }
.kind-speed .opp-item { position: absolute; left: 0; height: 28%; width: auto; animation: swim-lane var(--sw) linear infinite; animation-delay: var(--lag); }
.kind-speed .opp-item:nth-of-type(1) { top: 10%; }
.kind-speed .opp-item:nth-of-type(2) { top: 48%; }
.kind-speed .opp-item.faces-left { animation-direction: reverse; }
@keyframes swim-lane { from { translate: -105% 0; } to { translate: 100cqw 0; } }


/* ---------- printable downloads ---------- */
.downloads { margin-top: 22px; }
.downloads h3 { font: 700 1.3rem/1.2 var(--head); margin: 0 0 4px; }
.downloads p { margin: 0 0 12px; }
.dl-list { display: flex; flex-wrap: wrap; gap: 10px; }
.dl-btn { display: grid; text-align: left; gap: 2px; padding: 10px 16px 10px 44px; border-radius: 14px;
  border: 3px solid var(--c); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b3550' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11M7 10l5 5 5-5M5 20h14'/%3E%3C/svg%3E") 14px 50%/20px no-repeat;
  color: #2b3550; font: inherit; cursor: pointer; box-shadow: 0 4px 0 var(--c); transition: translate .15s, box-shadow .15s; }
.dl-btn:hover { translate: 0 -2px; box-shadow: 0 6px 0 var(--c); }
.dl-btn:active { translate: 0 3px; box-shadow: 0 1px 0 var(--c); }
.dl-btn:disabled { cursor: progress; opacity: .8; }
.dl-btn:focus-visible { outline: 3px solid #2b3550; outline-offset: 3px; }
.dl-btn small { opacity: .75; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .top { padding-left: 12px; }
  .top nav a { padding: 8px 10px; font-size: 0.92rem; }
  .intro { height: auto; min-height: 0; padding-bottom: min(calc(62vw + 64px), 410px); }
  .intro-text { padding-top: 92px; text-align: left; }
  .intro-text p { font-size: 1.02rem; margin-bottom: 18px; }
  .cta .btn { font-size: 0.95rem; padding: 12px 18px; }
  .parade { left: 0; right: 0; margin: 0 auto; width: fit-content; translate: none; bottom: 26px; gap: 0; }
  .parade > img:not(.hero-pip) { height: min(31vw, 190px); margin-left: -3vw; }
  .parade > img:nth-child(1) { margin-left: 0; }
  .fan { left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(26px + min(31vw, 190px) * 0.45); }
  .fan a { width: min(25vw, 180px); margin-left: -7vw; border-width: 3px; border-radius: 8px; }
  .fan a:first-child { margin-left: 0; }
  .sky .sun { width: 70px; height: 70px; top: 11%; right: 6%; }
  .stage { width: 100%; }
  .pin { place-items: end start; padding: 0 0 3vh 4vw; }
  .actor { width: 34vw; max-width: 170px; }
  .scene { padding: 88px 16px calc(36vw + 16vh); align-items: center; }
  .card { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; box-shadow: 0 6px 0 var(--c); }
  .card p { font-size: 0.95rem; }
  .a-snowman { height: 18vh; left: auto; right: 4%; }
  .scene-garden .ga-tulip, .scene-garden .ga-pumpkin, .scene-garden .ga-leaf, .scene-garden .ga-butterfly, .scene-garden .ga-flake { display: none; }
  .scene-garden .ga-sunflower { height: 11vh; left: 44%; bottom: 6vh; }
  .scene-garden .ga-snowman { height: 12vh; right: 3%; bottom: 6vh; }
  .a-reindeer { left: 45%; height: 12vh; }
  .a-penguin { height: 10vh; }
  .tree { width: 22vh; right: 0; }
  .a-giraffe { height: 22vh; left: auto; right: 30%; }
  .a-zebra { left: auto; right: 4%; height: 10vh; }
  .a-elephant, .a-lion { display: none; }
  .a-cake { height: 13vh; }
  .a-octopus { height: 9vh; }
  .table { grid-template-columns: 1fr; }
  .crayons { display: flex; overflow-x: auto; gap: 6px; padding-top: 12px; }
  .crayon svg { width: 26px; height: 70px; }
  .actions { grid-template-columns: repeat(4, 1fr); }
  .actions button { font-size: 0.82rem; padding: 8px 4px; }
  .unlock { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .unlock-pip { width: 90px; }
  .widget { box-shadow: 6px 6px 0 var(--star); }
}
@media (max-width: 480px) {
  .brand { font-size: 1.22rem; gap: 6px; }
  .brand img { width: 22px; }
  .brand .brand-pip { width: 19px; margin-left: -11px; }
  .top nav a:first-child { display: none; }
  .top nav .wide { display: none; }
  .actions { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { translate: 0 0; opacity: 1; }
  .decor .a { translate: 0 0 !important; opacity: 1 !important; }
  .snow, .bubbles, .clouds { display: none; }
}

/* very narrow phones: keep the brand on one line next to the links */
@media (max-width: 380px) {
  .brand { font-size: 1.05rem; gap: 5px; }
  .top nav a { padding: 8px 7px; font-size: 0.85rem; }
}
@media (max-width: 340px) {
  .brand .brand-pip { display: none; }
  .top nav a { padding: 8px 5px; }
}

/* Code box + Amazon button on game lock cards */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lock-msg { flex-basis: 100%; min-height: 1.3em; margin: 0; font-weight: 700; color: #b23a2b; font-size: .95rem; }
.btn-buy { background: #fff; text-decoration: none; }
.btn-buy[disabled] { opacity: .6; cursor: default; box-shadow: none; transform: none; }
.card-btns { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
a.btn-buy[aria-disabled="true"] { opacity: .6; pointer-events: none; box-shadow: none; }

/* ---------- Book puzzles ---------- */
.act-intro { margin: 0 0 12px; color: #4a5672; }
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 12px; }
.act-card {
  position: relative; display: grid; gap: 4px; justify-items: center; padding: 8px 8px 10px; cursor: pointer;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 4px 0 var(--c);
  font-family: var(--body); color: var(--ink); transition: translate .15s;
}
.act-card:hover { translate: 0 -3px; }
.act-card img { width: 100%; aspect-ratio: 612 / 660; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); background: #fff; }
.act-card b { font: 700 0.98rem/1.15 var(--head); text-align: center; }
.act-card small { font-size: 0.78rem; color: #5a6784; }
.act-card.locked img { opacity: .55; }
.act-badge { position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); font-size: 0.95rem; }
.act-badge.ok { background: var(--star); font-weight: 800; }
.act-back { margin-bottom: 10px; font: 700 0.92rem var(--body); color: var(--ink); background: #fff; cursor: pointer; border: 2px solid var(--c); border-radius: 999px; padding: 6px 14px; }
.act-back::before { content: "‹ "; }
.act-sheet {
  position: relative; width: min(100%, 600px, calc((100svh - 230px) * 612 / 660)); min-width: min(100%, 300px); margin: 0 auto;
  border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: #fff; touch-action: none; user-select: none; -webkit-user-select: none;
}
.act-sheet.dim { opacity: .35; }
.act-sheet > img, .act-sheet > canvas, .act-sheet > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.act-sheet svg { cursor: pointer; overflow: visible; }
.act-trail { fill: none; stroke: var(--c); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.act-line { fill: none; stroke: var(--c); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.act-line.bad { stroke: #e5463b; stroke-dasharray: 8 8; }
.act-band { stroke: var(--c); stroke-width: 3; stroke-dasharray: 6 7; stroke-linecap: round; opacity: .7; pointer-events: none; }
.act-shape { fill: var(--star); opacity: .35; pointer-events: none; }
.act-ring { fill: none; stroke: var(--star); stroke-width: 5; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: act-pulse 1.1s ease-in-out infinite; }
.act-ring.flash { stroke: #e5463b; }
@keyframes act-pulse { 50% { transform: scale(1.35); opacity: .6; } }
.act-star { fill: var(--star); opacity: .8; pointer-events: none; }
.act-hit { fill: transparent; }
.act-circle { fill: none; stroke: var(--c); stroke-width: 5; pointer-events: none; }
.act-count { font: 800 26px var(--head); fill: var(--c); text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: #fff; stroke-width: 6px; stroke-linejoin: round; pointer-events: none; }
.act-answer { font: 800 46px var(--head); fill: var(--c); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.act-x { fill: none; stroke: #e5463b; stroke-width: 5; stroke-linecap: round; pointer-events: none; }
.act-hint { fill: rgba(255, 210, 63, .35); stroke: var(--star); stroke-width: 4; pointer-events: none; animation: act-pulse .65s ease-in-out 2; transform-box: fill-box; transform-origin: center; }
.act-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.act-palette button { display: inline-flex; align-items: center; gap: 6px; font: 700 0.9rem var(--body); color: var(--ink); background: #fff; cursor: pointer; border: 2px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 6px; }
.act-palette button i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); }
.act-palette button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--star); }
@media (max-width: 640px) {
  .act-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .act-ring, .act-hint { animation: none; } }
.g-stage.act-locked { min-height: 580px; }

/* ---------- Play & color hub ---------- */
.play { scroll-margin-top: 70px; }
.hub { max-width: 960px; margin: 0 auto 26px; }
.hub-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 0; scrollbar-width: none; }
.hub-tabs button {
  flex: none; font: 700 1.02rem var(--head); color: var(--ink); cursor: pointer;
  background: #fff; border: 3px solid var(--ink); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 9px 18px 8px;
  box-shadow: inset 0 -4px 0 var(--c);
}
.hub-tabs button[aria-selected="true"] { background: var(--c); color: #fff; box-shadow: none; }
.hub-panel { grid-template-columns: minmax(0, 1fr);
  --c: #C8322B; background: #fff; border: 3px solid var(--ink); border-radius: 0 22px 22px 22px;
  padding: clamp(16px, 2.6vw, 26px); box-shadow: 10px 10px 0 var(--c); display: grid; gap: 18px;
}
.hub-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; }
.hub-head > img { width: 64px; height: 64px; object-fit: contain; }
.hub-head .btn { padding: 8px 16px; font-size: 0.95rem; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.hub-hint { margin: 2px 0 0; font-size: 0.92rem; color: #4a5672; }
.hub-actions { display: grid; justify-items: end; gap: 6px; }
.hub-act-row { display: flex; align-items: center; gap: 10px; }
.hub-head > div { min-width: 0; }
.hub-actions .code-form { flex: none; flex-wrap: nowrap; gap: 6px; }
.hub-actions .code-form input { flex: none; width: 11.5rem; padding: 8px 12px; font-size: 1rem; }
.hub-actions > .hub-msg { text-align: right; font-size: 0.92rem; width: 0; min-width: 100%; }
@media (max-width: 1000px) {
  .hub-actions { grid-column: 1 / -1; justify-items: start; }
  .hub-actions > .hub-msg { text-align: left; }
}
.hub-head h3 { margin: 0; font: 700 clamp(1.35rem, 3vw, 1.8rem)/1.1 var(--head); color: var(--c); }
.hub-head p { margin: 4px 0 0; color: #4a5672; }
.hub-code { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: #fff8dc; border: 2px solid var(--star); border-radius: 16px; padding: 12px 16px; }
.hub-code > p { flex: 1 1 240px; }
.hub-code > .code-form { flex: 1 1 360px; }
.hub-code.ok { background: #eafaf5; border-color: #7fd8c4; }
.hub-code .btn { padding: 8px 16px; box-shadow: 0 4px 0 var(--ink); }
.hub-code p { margin: 0; }
.code-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.code-form input {
  flex: 1 1 190px; min-width: 0; max-width: 22rem; font: 700 1.05rem var(--body); letter-spacing: 0.05em; text-transform: uppercase;
  padding: 9px 14px; border-radius: 999px; border: 3px solid var(--ink); color: var(--ink); background: #fff;
}
.code-form input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 600; color: #8090a8; }
.code-form input:focus-visible { outline: 3px solid var(--star); outline-offset: 2px; }
.code-form .btn { padding: 9px 18px; box-shadow: 0 4px 0 var(--ink); }
.hub-msg { flex-basis: 100%; margin: 0; min-height: 0; font-weight: 700; }
.hub-msg:empty { display: none; }
.hub-msg.err { color: #b3261e; }
.hub-msg.ok { color: #0d7a5f; }
.hub-kinds { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); scroll-margin-top: 84px; scrollbar-width: none; }
.hub-kinds button {
  flex: none; display: grid; justify-items: start; gap: 1px; font: 700 1.02rem/1.1 var(--head); color: var(--ink); cursor: pointer; text-align: left;
  background: none; border: 0; border-bottom: 4px solid transparent; margin-bottom: -2px; padding: 6px 14px 8px;
}
.hub-kinds button:hover { border-bottom-color: var(--line); }
.hub-kinds small { font: 600 0.76rem var(--body); color: #5a6784; }
.hub-kinds button[aria-selected="true"] { color: var(--c); border-bottom-color: var(--c); }
.hub-strip { position: relative; margin-top: -6px; }
.hub-row { position: relative; display: flex; gap: 10px; overflow-x: auto; padding: 6px 4px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.hub-row > .hub-tile { flex: 0 0 104px; scroll-snap-align: start; }
.hub-arrow {
  position: absolute; top: 38px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font: 700 1.6rem/1 var(--head); color: var(--ink);
}
.hub-arrow.prev { left: -12px; } .hub-arrow.next { right: -12px; }
.hub-arrow[hidden] { display: none; }
.hub-panel .game { max-width: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 4px 0 0; }
.hub-tile {
  position: relative; display: grid; align-content: start; gap: 3px; padding: 6px 6px 8px; cursor: pointer; text-align: center;
  background: #fff; border: 2px solid var(--line); border-radius: 16px; font-family: var(--body); color: var(--ink);
  transition: translate .15s, border-color .15s;
}
.hub-tile:hover { translate: 0 -2px; border-color: var(--c); }
.hub-tile[aria-pressed="true"] { border-color: var(--c); box-shadow: 0 0 0 3px var(--c); }
.hub-pic { position: relative; display: grid; place-items: center; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #f6f9fc; margin-bottom: 3px; }
.hub-pic img { width: 100%; height: 100%; object-fit: contain; }
.hub-tile b { font: 700 0.82rem/1.15 var(--head); }
.hub-tile small { font-size: 0.76rem; color: #5a6784; }
.hub-tile.done small { color: #0d7a5f; font-weight: 800; }
.hub-tile.locked { background: #f4f6fa; border-style: dashed; border-color: #b7c3d3; }
.hub-tile.locked .hub-pic img { filter: grayscale(1) blur(1.5px); opacity: .45; }
.hub-lock {
  position: absolute; width: 38px; height: 38px;
  background: no-repeat center / 38px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='10' width='16' height='12' rx='3' fill='%23ffd23f' stroke='%231d2b4f' stroke-width='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3' fill='none' stroke='%231d2b4f' stroke-width='2.4'/%3E%3C/svg%3E");
}
.game-body.g-color { padding-top: 4px; }
.code-dialog {
  width: min(92vw, 30rem); border: 3px solid var(--ink); border-radius: 26px; padding: 22px 22px 18px; text-align: center;
  box-shadow: 10px 10px 0 var(--star); color: var(--ink); font-family: var(--body);
}
.code-dialog::backdrop { background: rgba(29, 43, 79, .55); }
.code-dialog > img { display: block; width: 84px; height: auto; margin: 0 auto; }
.sizes[hidden] { display: none; }
.code-dialog h2 { margin: 4px 0 6px; font: 700 1.6rem/1.1 var(--head); }
.code-dialog p { margin: 0 0 10px; }
.code-dialog .code-for { font-weight: 800; }
.code-dialog .code-form { justify-content: center; margin-top: 6px; }
.code-x { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink); }
@media (max-width: 640px) {
  .hub-tabs { margin: 0 -16px; padding-inline: 16px; }
  .hub-tabs button { font-size: 0.95rem; padding: 8px 13px 7px; }
  .hub-panel { border-radius: 0 0 20px 20px; box-shadow: 6px 6px 0 var(--c); }
  .hub-row { margin: 0 -14px; padding-inline: 14px; }
  .hub-row > .hub-tile { flex-basis: 92px; }
  .hub-arrow { display: none; }
  .hub-kinds button { padding: 6px 10px 8px; font-size: 0.92rem; }
  .hub-kinds { margin: 0 -16px; padding-inline: 12px; }
  .hub-code p { font-size: 0.92rem; }
  .hub-head > img { width: 48px; height: 48px; }
  .hub-actions { justify-items: stretch; }
  .tree-cappy { right: -6%; width: 26%; }
  .hub-act-row { flex-wrap: wrap; }
  .hub-actions .code-form { flex: 1 1 100%; }
  .hub-actions .code-form input { flex: 1 1 auto; width: auto; }
  .hub-actions .btn-buy { flex: 1; text-align: center; }
  .hub-actions > .hub-msg { text-align: left; }
  .hub-code > .code-form { flex-wrap: wrap; }
}

.act-pick { fill: color-mix(in srgb, var(--c) 14%, transparent); stroke: var(--c); stroke-width: 3; stroke-dasharray: 8 6; pointer-events: none; }
.hub-ready { display: grid; justify-items: center; gap: 12px; padding: 26px 12px 30px; text-align: center; }
.hub-ready img { width: 120px; height: 120px; object-fit: contain; animation: bob 3s ease-in-out infinite; }
.hub-ready p { margin: 0; color: #4a5672; max-width: 30rem; }
.hub-ready .btn { font-size: 1.15rem; padding: 12px 26px; }
