:root {
  --bg: #fff8ec; --ink: #3b2f5c; --soft: #8a7fa8; --card: #ffffff; --line: #e9e1f3;
  --stencil: #cfc8dc; --accent: #ff7a59; --good: #43a047;
  --font: "Andika", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
input { user-select: text; -webkit-user-select: text; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
#app { position: fixed; inset: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; padding: 16px; }
.screen.on { display: flex; animation: fade .25s ease; }
.screen.scroll { overflow-y: auto; touch-action: pan-y; display: none; }
.screen.scroll.on { display: block; }
#s-home { overflow-y: auto; overflow-x: hidden; touch-action: pan-y; padding-bottom: calc(24px + env(safe-area-inset-bottom)); } /* 26 games don't fit one screen: home must scroll */
#s-home > * { flex-shrink: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }

h1.logo { font-size: clamp(40px, 9vw, 72px); margin: 4vh 0 0; color: var(--accent); letter-spacing: 1px; }
h1.logo span { color: #6a4fc7; }
h2 { margin: 8px 0 12px; font-size: 30px; text-align: center; }
h3 { margin: 16px 0 8px; }
.sub { color: var(--soft); font-size: 22px; margin: 6px 0 18px; text-align: center; }
.text { max-width: 640px; margin: 0 auto; font-size: 18px; line-height: 1.5; }

.icon-btn { width: 56px; height: 56px; border-radius: 18px; background: var(--card); font-size: 28px; box-shadow: 0 3px 0 var(--line); flex: none; }
.icon-btn.back { position: absolute; left: 16px; top: 16px; }
.link-btn { margin-top: auto; color: var(--soft); font-size: 16px; padding: 12px; text-decoration: underline; }
.big-btn { margin-top: 20px; width: 120px; height: 72px; border-radius: 24px; background: var(--good); color: #fff; font-size: 40px; box-shadow: 0 5px 0 #2e7d32; }
.big-btn:active, .icon-btn:active, .mode:active, .pcard:active { transform: translateY(3px); box-shadow: none; }

/* profiles */
.profile-list { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; max-width: 900px; }
.pcard { width: 150px; height: 170px; border-radius: 28px; background: var(--card); box-shadow: 0 5px 0 var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.pcard .av { font-size: 72px; line-height: 1; }
.pcard .nm { font-size: 22px; font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .ag { font-size: 14px; color: var(--soft); }
.pcard.add .av { color: var(--soft); font-size: 64px; }

#new-name { font: inherit; font-size: 26px; padding: 12px 18px; border-radius: 18px; border: 3px solid var(--line); width: min(360px, 90vw); text-align: center; background: #fff; color: var(--ink); }
.pick { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; max-width: 640px; }
.pick button { min-width: 64px; height: 64px; border-radius: 18px; background: var(--card); font-size: 38px; box-shadow: 0 3px 0 var(--line); border: 3px solid transparent; }
.pick button.sel { border-color: var(--accent); }
.pick.bands button { font-size: 18px; padding: 0 14px; height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pick.bands b { font-size: 26px; }

/* home */
.bar { width: 100%; display: flex; align-items: center; gap: 12px; }
.chip { height: 56px; padding: 0 16px 0 8px; border-radius: 28px; background: var(--card); box-shadow: 0 3px 0 var(--line); font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chip .av { font-size: 36px; }
.stars { margin-left: auto; font-size: 24px; font-weight: 700; background: var(--card); padding: 8px 16px; border-radius: 20px; box-shadow: 0 3px 0 var(--line); white-space: nowrap; }
.langs { display: flex; gap: 10px; margin: 22px 0 6px; flex-wrap: wrap; justify-content: center; }
.langs button { padding: 12px 20px; border-radius: 22px; font-size: 20px; font-weight: 700; background: var(--card); box-shadow: 0 3px 0 var(--line); border: 3px solid transparent; }
.langs button.sel { border-color: #6a4fc7; color: #6a4fc7; }
.band-line { color: var(--soft); font-size: 18px; margin: 6px 0 14px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; }
.stk { padding: 6px 14px; border-radius: 16px; background: var(--card); box-shadow: 0 3px 0 var(--line); color: var(--ink); font-size: 17px; font-weight: 700; min-height: 44px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; width: min(860px, 100%); }
.mode { height: 170px; border-radius: 30px; color: #fff; font-size: 26px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 6px 0 rgba(0,0,0,.18); position: relative; }
.mode .ic { font-size: 64px; line-height: 1; }
.mode .pct { position: absolute; bottom: 10px; font-size: 14px; opacity: .9; }

/* play */
#s-play { padding: 12px; }
.badge { height: 44px; padding: 0 14px; border-radius: 22px; color: #fff; font-weight: 700; display: flex; align-items: center; gap: 6px; font-size: 18px; white-space: nowrap; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; flex: 1; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dots i.done { background: var(--good); }
.dots i.cur { background: var(--accent); transform: scale(1.3); }
#stage { position: relative; flex: 1; width: 100%; }
#prompt { position: absolute; left: 0; right: 0; top: 4%; text-align: center; font-size: clamp(22px, 4.4vw, 40px); padding: 0 70px; }
#prompt .gap { display: inline-block; min-width: 3em; border-bottom: 4px dashed var(--stencil); }
#picture { position: absolute; left: 50%; top: 18%; transform: translate(-50%, 0) scale(1); font-size: clamp(80px, 19vmin, 170px); line-height: 1; transition: transform .45s cubic-bezier(.3,1.6,.5,1), opacity .3s; pointer-events: none; }
#picture.hide { opacity: 0; transform: translate(-50%, 0) scale(.3); }
#picture.faint { opacity: .25; }
/* while the word is being built the picture stays in view, a bit smaller, and gulps each letter that flies in */
#picture.show { opacity: 1; transform: translate(-50%, 0) scale(.8); }
#picture.gulping { animation: gulp .3s ease-out; }
@keyframes gulp { 40% { scale: 1.18; } }
#picture.pop { opacity: 1; transform: translate(-50%, -10%) scale(1.6); }
#stencil { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: .06em; white-space: nowrap; transition: transform .3s; }
#stencil.wiggle { animation: wiggle .7s ease; }
@keyframes wiggle { 20% { transform: translate(-50%, -50%) rotate(-4deg) scale(1.08); } 40% { transform: translate(-50%, -50%) rotate(4deg) scale(1.08); } 60% { transform: translate(-50%, -50%) rotate(-2deg) scale(1.05); } }
.slot { position: relative; font-weight: 700; line-height: 1.15; text-align: center; color: transparent; -webkit-text-stroke: 2px var(--stencil); padding: 0 .04em; border-radius: .15em; transition: color .2s, -webkit-text-stroke-color .2s; }
.slot.box { -webkit-text-stroke: 0; border: 4px dashed var(--stencil); }
.slot.fixed { color: var(--ink); -webkit-text-stroke: 0; }
.slot.filled { -webkit-text-stroke: 0; }
.slot.hint { animation: hint 1s ease 2; }
@keyframes hint { 50% { -webkit-text-stroke-color: var(--accent); border-color: var(--accent); } }

.tile { position: absolute; left: 0; top: 0; font-weight: 700; line-height: 1.15; text-align: center; touch-action: none; cursor: grab; padding: 0 .04em;
  transition: transform .45s cubic-bezier(.3,1.4,.5,1); will-change: transform; filter: drop-shadow(0 3px 0 rgba(0,0,0,.12)); z-index: 2; }
#tiles { position: absolute; inset: 0; pointer-events: none; }
/* a touch area of at least 48px round every loose tile, however small its letter (thin letters on phones were ~35px) */
.tile::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 48px); height: max(100%, 48px); transform: translate(-50%, -50%); }
.tile.placed::after { display: none; }
#tiles .tile { pointer-events: auto; }
.tile.word { background: var(--card); border-radius: .15em; border: 4px solid transparent; }
.tile.drag { transition: none; z-index: 10; filter: drop-shadow(0 10px 8px rgba(0,0,0,.25)); }
.tile.placed { cursor: default; filter: none; z-index: 1; }
.tile.shake { animation: shake .35s; }
@keyframes shake { 25% { margin-left: -8px; } 75% { margin-left: 8px; } }

.arrow { position: absolute; bottom: 16px; width: 76px; height: 76px; border-radius: 50%; font-size: 34px; color: #fff; background: #6a4fc7; box-shadow: 0 5px 0 #4b3796; z-index: 20; }
.arrow.prev { left: 16px; background: #b7aed0; box-shadow: 0 5px 0 #9087ab; }
.arrow.next { right: 16px; }
.arrow.next.ready { background: var(--good); box-shadow: 0 5px 0 #2e7d32; animation: pulse 1s infinite; }
.arrow:disabled { opacity: .35; }
@keyframes pulse { 50% { transform: scale(1.12); } }

#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.spark { position: absolute; font-size: 32px; animation: burst 1.2s ease-out forwards; }
@keyframes burst { from { transform: translate(0,0) scale(.4) rotate(0); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(var(--r)); opacity: 0; } }
.confetti { position: absolute; top: -24px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 110vh) rotate(var(--r)); } }
.praise { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font-size: clamp(30px, 6vw, 56px); font-weight: 700; color: var(--accent); animation: rise .6s cubic-bezier(.3,1.6,.5,1); }
.praise small { display: block; font-size: .5em; color: #f9a825; }
@keyframes rise { from { transform: translateY(30px) scale(.6); opacity: 0; } }

/* stickers */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 14px; width: min(760px, 100%); }
.shelf div { height: 84px; border-radius: 22px; background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 50px; box-shadow: 0 3px 0 var(--line); }
.shelf div.locked { filter: grayscale(1); opacity: .25; }

/* gate */
.hold { width: 140px; height: 140px; border-radius: 50%; background: var(--card); box-shadow: 0 5px 0 var(--line); position: relative; overflow: hidden; font-size: 60px; }
.hold i { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: rgba(106,79,199,.25); }
.hold span { position: relative; }
.gate-answers { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; max-width: calc(100vw - 40px); }
.gate-answers button { width: clamp(64px, 18vw, 80px); height: 64px; border-radius: 18px; background: var(--card); font-size: 26px; box-shadow: 0 3px 0 var(--line); }

/* report */
#report { max-width: 820px; margin: 0 auto; }
.rcard { background: var(--card); border-radius: 22px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 3px 0 var(--line); }
.rcard h3 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.rrow { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin: 10px 0; font-size: 16px; }
.rrow .rbar { grid-column: 1 / -1; grid-row: 2; }
.rrow > span:last-child { white-space: nowrap; font-size: 14px; color: var(--soft); }
.rrow > span:first-child { white-space: nowrap; }
@media (max-width: 480px) { /* phones: the game name gets its own line; the bar and the counts share the next */
  .rrow > span:first-child { grid-column: 1 / -1; }
  .rrow .rbar { grid-column: 1; grid-row: 2; }
  .rrow > span:last-child { grid-column: 2; grid-row: 2; font-size: 13px; }
}
.rbar { height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.rbar b { display: block; height: 100%; background: var(--good); border-radius: 7px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi { background: var(--bg); border-radius: 16px; padding: 10px; text-align: center; }
.kpi b { display: block; font-size: 28px; }
.kpi span { color: var(--soft); font-size: 14px; }
.days { display: flex; gap: 4px; align-items: flex-end; height: 80px; }
.days div { flex: 1; background: #b9a8f0; border-radius: 4px 4px 0 0; min-height: 3px; }
.days-l { display: flex; justify-content: space-between; color: var(--soft); font-size: 12px; margin-top: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { background: var(--bg); padding: 4px 10px; border-radius: 12px; font-size: 15px; }
.tags span.m { background: #e3f4e4; }
.rbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.rbtns button { padding: 10px 16px; border-radius: 14px; background: var(--bg); font-size: 16px; font-weight: 700; border: 2px solid var(--line); }
.rbtns button.sel { border-color: #6a4fc7; color: #6a4fc7; }
.rbtns button.danger { color: #c62828; }

@media (max-height: 520px) {
  h1.logo { margin-top: 0; font-size: 40px; }
  .mode { height: 120px; } .mode .ic { font-size: 44px; }
  #picture { top: 12%; font-size: 56px; }
  .arrow { width: 62px; height: 62px; font-size: 28px; }
}

/* clay pictures */
img.clay { width: 1em; height: 1em; object-fit: contain; vertical-align: middle; pointer-events: none; }
img.clay.big { width: 1.25em; height: 1.25em; filter: drop-shadow(0 8px 10px rgba(80, 50, 20, .18)); }
img.ic-s { width: 1.2em; height: 1.2em; vertical-align: -0.25em; }
img.ic-m { width: 34px; height: 34px; }
.count { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px; max-width: 80vw; font-size: .42em; white-space: nowrap; }
.count img.fruit { width: 1.4em; height: 1.4em; }
.count b { margin: 0 .3em; color: var(--ink); }
.mode .ic img.clay { width: 72px; height: 72px; filter: drop-shadow(0 4px 4px rgba(0,0,0,.15)); }
.pcard .av img.clay { width: 84px; height: 84px; }
@media (max-width: 600px) { /* phones: always two games per row (one column made the home screen ~4000px tall) */
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .mode { height: 140px; font-size: 20px; border-radius: 24px; padding: 0 6px; text-align: center; overflow-wrap: anywhere; }
  .mode .ic { font-size: 48px; } .mode .ic img.clay { width: 56px; height: 56px; }
}
.chip .av img.clay { width: 40px; height: 40px; }
.pick button img.clay { width: 44px; height: 44px; }
.shelf div img.clay { width: 60px; height: 60px; }

/* ---------- monsters ---------- */
.runner { position: absolute; left: 0; top: 0; pointer-events: none; will-change: transform; filter: drop-shadow(0 8px 6px rgba(40, 20, 60, .22)); }
.mon .lg1 { animation: step .18s ease-in-out infinite alternate; }
.mon .lg2 { animation: step .18s ease-in-out infinite alternate-reverse; }
.mon .eye { animation: blink 3.2s infinite; }
.mon .bob { animation: bob .36s ease-in-out infinite alternate; transform-origin: 60px 130px; }
@keyframes step { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes bob { from { transform: scale(1, 1); } to { transform: scale(1.05, .95); } }
.guard .mon .lg1, .guard .mon .lg2 { animation-duration: .9s; }
.guard .mon .bob { animation-duration: 1.4s; }

/* letters: bobbing in the air, tumbling when knocked, flying into the picture */
.tile.air { animation: air .5s ease-in-out infinite alternate; }
@keyframes air { from { rotate: -7deg; } to { rotate: 7deg; } }
.tile.knock { transition: transform .75s cubic-bezier(.2, 1.5, .4, 1); animation: tumble .7s ease-out; }
@keyframes tumble { from { rotate: 0deg; } 60% { rotate: 380deg; } to { rotate: 360deg; } }
.tile.fly { transition: transform .5s cubic-bezier(.6, -0.2, .7, .4), opacity .2s .45s; z-index: 12; animation: spinin .5s ease-in; }
@keyframes spinin { to { rotate: 300deg; } }
#picture.born { opacity: 1; transform: translate(-50%, -10%) scale(1.6); animation: born .8s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes born { from { transform: translate(-50%, -10%) scale(0) rotate(-25deg); } 60% { transform: translate(-50%, -10%) scale(1.9) rotate(6deg); } }
.slot.reveal { animation: reveal .6s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes reveal { from { transform: translateY(30px) scale(.3); opacity: 0; } }

/* ---------- level map ---------- */
#s-map { padding: 12px 12px 0; }
#map-scroll { position: relative; flex: 1; width: 100%; margin-top: 10px; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; border-radius: 26px 26px 0 0; scrollbar-width: none; }
#map-scroll::-webkit-scrollbar { display: none; }
#map { position: relative; width: 100%; }
#map-fx { position: absolute; left: 0; right: 0; top: 80px; bottom: 0; pointer-events: none; overflow: hidden; z-index: 30; border-radius: 26px 26px 0 0; } /* placed over the map by fitMapFx() */
.chap { position: absolute; left: 0; right: 0; }
.chapnum { position: absolute; width: 44px; height: 52px; border-radius: 10px 10px 22px 22px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: var(--ink); }
.deco { position: absolute; font-size: 40px; opacity: .9; pointer-events: none; }
.deco img.clay { width: 48px; height: 48px; }
.road { position: absolute; left: 0; top: 0; pointer-events: none; }
.road path { fill: none; stroke-linecap: round; }
.road .r1 { stroke: rgba(80, 50, 30, .16); stroke-width: 58; transform: translateY(6px); }
.road .r2 { stroke: #fff7e6; stroke-width: 50; }
.road .r3 { stroke: #ffcf6b; stroke-width: 6; stroke-dasharray: 2 22; }
.lvl { position: absolute; width: 76px; height: 76px; border-radius: 50%; font-size: 30px; font-weight: 700; color: #fff; background: var(--c, #c9c2d8); box-shadow: 0 6px 0 rgba(0,0,0,.2), inset 0 -6px 0 rgba(0,0,0,.12), inset 0 5px 0 rgba(255,255,255,.35); border: 4px solid #fff; z-index: 3; }
.lvl.locked { background: #d9d3e5; color: #fff; font-size: 26px; }
.lvl.open { animation: pulse 1.1s infinite; }
.lvl b { position: relative; top: -2px; }
.lvl .st { position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); display: flex; gap: 1px; font-size: 20px; }
.lvl .st i { font-style: normal; color: rgba(0,0,0,.14); text-shadow: 0 1px 0 #fff; }
.lvl .st i.on { color: #ffc107; text-shadow: 0 2px 0 #c77c00; }
.lvl .st i.pop { animation: starpop .6s cubic-bezier(.3, 1.8, .5, 1) both; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
.lvl.born { animation: born2 .7s cubic-bezier(.3, 1.8, .5, 1), pulse 1.1s .7s infinite; }
@keyframes born2 { from { transform: scale(.2); } }
.lvl.shake { animation: shake .35s; }
.me { position: absolute; width: 64px; height: 64px; z-index: 6; transition: left .8s cubic-bezier(.4, 0, .3, 1), top .8s cubic-bezier(.4, 0, .3, 1); animation: me 1s ease-in-out infinite alternate; pointer-events: none; }
.me img.clay { width: 64px; height: 64px; filter: drop-shadow(0 6px 4px rgba(0,0,0,.25)); }
.me.hopping { animation: hop .8s ease-in-out; }
@keyframes me { to { transform: translateY(-8px); } }
@keyframes hop { 50% { transform: translateY(-70px) scale(1.15); } }
.guard { position: absolute; z-index: 4; cursor: pointer; }
.guard.locked { filter: grayscale(.85) brightness(1.1); opacity: .65; }
.guard .lockb { position: absolute; right: 0; top: 10px; font-size: 26px; }
.guard.jump { animation: gjump .6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes gjump { 40% { transform: translateY(-40px) rotate(-8deg); } }
.chapban { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; background: #fff; border-radius: 34px; padding: 14px 34px 18px; box-shadow: 0 8px 0 rgba(0,0,0,.12); animation: rise .6s cubic-bezier(.3, 1.6, .5, 1), fadeout .5s 2.9s forwards; z-index: 50; }
.chapban b { font-size: 64px; line-height: 1; color: var(--accent); }
.chapban span { font-size: 28px; }
@keyframes fadeout { to { opacity: 0; transform: translateX(-50%) scale(.8); } }
@media (prefers-reduced-motion: reduce) { .tile.air, .lvl.open, .me, .mon .bob, .mon .lg1, .mon .lg2 { animation: none; } }

/* tracing: a big letter to follow with a finger; it fills with colour, then wakes up */
#trace { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); height: 70%; aspect-ratio: 112 / 152; max-width: 86%; touch-action: none; }
.trace-svg { width: 100%; height: 100%; overflow: visible; touch-action: none; }
.t-body path { fill: none; stroke: #ece6f7; stroke-width: 22; stroke-linecap: round; stroke-linejoin: round; }
.t-guide path { fill: none; stroke: #c9bfe0; stroke-width: 1.6; stroke-dasharray: 2.5 4; stroke-linecap: round; opacity: .55; }
.t-guide path.cur { stroke: #8f7bd1; opacity: 1; animation: march 1.1s linear infinite; }
@keyframes march { to { stroke-dashoffset: -13; } }
.t-ink path { fill: none; stroke-width: 17; stroke-linecap: round; stroke-linejoin: round; }
.t-arrow { fill: #8f7bd1; opacity: .8; }
.t-pen circle { stroke: #fff; stroke-width: 2.5; filter: drop-shadow(0 1.5px 1.5px rgba(0,0,0,.3)); }
.t-pen text { font: 700 9px Andika, sans-serif; fill: #fff; text-anchor: middle; pointer-events: none; }
.t-pen { transition: transform .06s linear; }
.t-pen > * { transform-box: fill-box; transform-origin: center; }
.t-pen:not(.on) circle { animation: penpulse 1.2s ease-in-out infinite; }
@keyframes penpulse { 50% { scale: 1.25; } }
.t-pen.nudge circle { animation: nudge .45s; }
@keyframes nudge { 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
#trace.alive .trace-svg { animation: wake 1.2s cubic-bezier(.3, 1.6, .5, 1), wiggle 1.4s 1.2s ease-in-out 2; transform-origin: 50% 90%; }
@keyframes wake { 0% { transform: scale(1); } 30% { transform: scale(1.12, .9); } 60% { transform: scale(.95, 1.08) translateY(-6%); } }
@keyframes wiggle { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.t-eye { animation: eyepop .5s .15s cubic-bezier(.3, 1.8, .5, 1) backwards; }
@keyframes eyepop { from { scale: 0; } }
.t-eye { transform-box: fill-box; transform-origin: center; }
#picture.trace-pic { left: auto; right: 4%; top: 4%; transform: none; font-size: clamp(54px, 13vmin, 110px); opacity: 1; }
#picture.trace-pic.pop { transform: scale(1.35) rotate(-6deg); }
@media (prefers-reduced-motion: reduce) { .t-guide path.cur, .t-pen:not(.on) circle, #trace.alive .trace-svg { animation: none; } }

/* ---------- tap games: Listen, Match, Pop; and Count's hopping things ---------- */
.count > .hop1 { animation: chop .4s ease; }
@keyframes chop { 45% { transform: translateY(-28%) scale(1.18); } }
#game { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; overflow: hidden; z-index: 5; }
#game button { -webkit-tap-highlight-color: transparent; }
#game .shake { animation: shake .35s; }
#game .ring { animation: ring .5s ease; }
@keyframes ring { 30% { transform: scale(1.18) rotate(-8deg); } 60% { transform: scale(1.1) rotate(6deg); } }
.g-ear { border: 0; background: #fff; border-radius: 50%; width: 86px; height: 86px; font-size: 44px; box-shadow: 0 5px 0 rgba(0,0,0,.15); cursor: pointer; }
.g-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 3vmin; padding: 0 64px; }
.g-card { position: relative; border: 0; background: #fff; border-radius: 26px; width: clamp(110px, 25vmin, 210px); aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: 0 6px 0 rgba(0,0,0,.14); cursor: pointer; font-size: clamp(60px, 15vmin, 120px); transition: transform .25s cubic-bezier(.3,1.6,.5,1), opacity .3s, box-shadow .2s; }
.g-card img.clay { width: 78%; height: auto; }
.g-card:active { transform: scale(.95); }
.g-name { display: none; font-family: "Andika", system-ui, sans-serif; font-weight: 700; font-size: clamp(20px, 4.5vmin, 34px); color: var(--ink); line-height: 1.1; }
.g-listen.read .g-name { display: block; font-size: clamp(26px, 6vmin, 50px); }
.g-listen.read .g-card.right img.clay { width: 55%; animation: born2 .5s cubic-bezier(.3,1.8,.5,1); }
.g-card.wrong { opacity: .45; }
.solved .g-card:not(.right) { opacity: .2; transform: scale(.85); }
.g-card.right { transform: scale(1.12); box-shadow: 0 0 0 6px #ffd43b, 0 6px 0 rgba(0,0,0,.14); }
.g-card.right .g-name { display: block; }
.g-grid { display: grid; gap: 2.2vmin; }
.g-flip { border: 0; background: none; padding: 0; width: clamp(72px, 17vmin, 150px); aspect-ratio: 3 / 4; perspective: 700px; cursor: pointer; }
.g-flip .in { position: relative; display: block; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.g-flip.up .in { transform: rotateY(180deg); }
.g-flip .bk, .g-flip .f { position: absolute; inset: 0; border-radius: 16px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 5px 0 rgba(0,0,0,.15); }
.g-flip .bk { background: var(--c); color: #fff; font-size: clamp(26px, 6vmin, 48px); background-image: radial-gradient(rgba(255,255,255,.18) 2px, transparent 2.5px); background-size: 14px 14px; }
.g-flip .f { background: #fff; transform: rotateY(180deg); font-size: clamp(50px, 12vmin, 100px); }
.g-flip .f img.clay { width: 84%; height: auto; }
.g-flip .f.w { font-family: "Andika", system-ui, sans-serif; font-weight: 700; font-size: clamp(15px, 3.6vmin, 30px); color: var(--ink); padding: 4px; word-break: break-word; text-align: center; }
.g-flip.got .f { box-shadow: 0 0 0 5px #8ce99a, 0 5px 0 rgba(0,0,0,.15); animation: got .5s ease; }
@keyframes got { 40% { scale: 1.12; } }
.g-pop { justify-content: flex-start !important; }
.g-top { position: relative; z-index: 3; display: flex; align-items: center; gap: 14px; margin-top: 1.5vh; background: rgba(255,255,255,.85); border-radius: 999px; padding: 6px 18px 6px 6px; box-shadow: 0 4px 0 rgba(0,0,0,.1); }
.g-target { border: 0; background: var(--c); color: #fff; border-radius: 50%; width: clamp(70px, 14vmin, 110px); aspect-ratio: 1; font-family: "Andika", system-ui, sans-serif !important; font-weight: 700; font-size: clamp(44px, 9vmin, 72px); cursor: pointer; line-height: 1; }
.g-pic { font-size: clamp(44px, 9vmin, 70px); line-height: 1; }
.g-got { display: flex; gap: 4px; font-size: 22px; color: #d0c8e0; }
.g-got i { font-style: normal; transition: color .2s, transform .2s; }
.g-got i.on { color: #f59f00; transform: scale(1.25); }
.g-bub { position: absolute; left: 0; top: 0; width: clamp(72px, 14vmin, 108px); aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 1;
  font-family: "Andika", system-ui, sans-serif; font-weight: 700; font-size: clamp(34px, 7vmin, 54px); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 30% 28%, rgba(255,255,255,.95) 0 7%, rgba(255,255,255,.3) 8% 20%, transparent 21%), radial-gradient(circle, color-mix(in srgb, var(--c) 70%, white) 0 45%, var(--c) 75%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.55), 0 6px 14px rgba(0,0,0,.12); }
.g-bub.in { animation: bin .5s ease-out; }
@keyframes bin { from { opacity: 0; scale: .6; } }
.g-bub.popped { animation: bpop .32s ease-out forwards; pointer-events: none; }
@keyframes bpop { to { transform: scale(1.7); opacity: 0; } }
.g-bub.nope { animation: shake .35s; }
.g-bub.away { opacity: .4; transition: opacity .4s; pointer-events: none; }
.g-ear img.clay { width: 58px; height: 58px; }
/* Spell and Missing number: empty boxes instead of outlined letters; numbers spaced apart */
.slot.blind { -webkit-text-stroke: 0; border-bottom: .07em solid var(--stencil); border-radius: 0; margin: 0 .04em; min-width: .55em; }
.slot.blind.filled { border-bottom-color: transparent; }
#stencil.nums, #stencil.spaced { gap: .3em; }
.g-find .g-name b { color: var(--c); font-size: 1.25em; }
/* Dots and More: groups of things on a card */
.g-dots { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2%; width: 90%; }
.g-card .g-dots img.clay, .g-flip .f .g-dots img.clay { width: 44%; height: auto; }
.g-card .g-dots.some img.clay, .g-flip .f .g-dots.some img.clay { width: 30%; }
.g-card .g-dots.many img.clay, .g-flip .f .g-dots.many img.clay { width: 22%; }
.g-flip .f.num { font-family: "Andika", system-ui, sans-serif; font-weight: 700; color: var(--c); font-size: clamp(40px, 10vmin, 84px); }
.g-more .g-card { width: clamp(140px, 36vmin, 300px); }
.g-more .solved .g-card:not(.right) { opacity: .55; transform: scale(.9); }
.g-more .solved .g-name { display: block; font-size: clamp(28px, 6vmin, 48px); }
/* Shadows */
.g-sil { font-size: clamp(90px, 24vmin, 200px); line-height: 1; }
.g-sil img.clay { width: 1.2em; height: 1.2em; filter: brightness(0) opacity(.75); transition: filter .6s; }
.g-sil.lit img.clay { filter: none; animation: born2 .6s cubic-bezier(.3,1.8,.5,1); }
.g-shadow .g-card { width: clamp(100px, 22vmin, 180px); }
/* Puzzle */
.g-board { position: absolute; border-radius: 18px; background: rgba(255,255,255,.7); box-shadow: inset 0 0 0 3px #e9e2f5; }
.g-ghost { position: absolute; inset: 0; background-size: 100% 100%; opacity: .18; filter: grayscale(.6); border-radius: 18px; }
.g-cell { position: absolute; box-shadow: inset 0 0 0 1.5px rgba(112, 72, 232, .25); }
.g-cell.glow { animation: glow 1s ease 2; }
@keyframes glow { 50% { background: rgba(255, 212, 59, .45); } }
.g-piece { position: absolute; z-index: 2; border-radius: 10px; background-color: #fff; background-repeat: no-repeat; box-shadow: 0 6px 12px rgba(0,0,0,.18), inset 0 0 0 2px rgba(255,255,255,.9); cursor: grab; touch-action: none; transition: transform .2s; }
.g-piece.drag { z-index: 6; cursor: grabbing; box-shadow: 0 14px 24px rgba(0,0,0,.25); transition: none; }
.g-piece.placed { z-index: 1; border-radius: 0; box-shadow: none; background-color: transparent; pointer-events: none; transition: left .15s, top .15s; }
.g-board.whole { animation: got .5s ease; }
.g-board.whole .g-cell { box-shadow: none; }
/* Rhymes and Clap: the word's picture with a speaker beside it */
.g-head { display: flex; align-items: center; gap: 18px; }
.g-head .g-pic { font-size: clamp(70px, 17vmin, 140px); line-height: 1; }
.g-head .g-pic img.clay { width: 1.15em; height: 1.15em; }
.g-nums .g-claps { width: clamp(84px, 18vmin, 150px); gap: 2px; }
.g-claps b { font-family: "Andika", system-ui, sans-serif; font-size: clamp(34px, 8vmin, 64px); color: var(--c); line-height: 1; }
.g-claps span { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px; width: 92%; }
.g-card .g-claps span img.clay, .g-claps span img.clay { width: 30%; height: auto; }
.g-parts { display: flex; gap: 8px; min-height: 1.3em; font-family: "Andika", system-ui, sans-serif; font-weight: 700; font-size: clamp(26px, 6vmin, 46px); visibility: hidden; }
.g-parts.show { visibility: visible; }
.g-syl { background: #fff; border-radius: 12px; padding: 0 12px; box-shadow: 0 3px 0 rgba(0,0,0,.1); color: var(--ink); transition: background .2s, color .2s, transform .2s; }
.g-syl.on { background: var(--c); color: #fff; transform: translateY(-4px); }
/* Clap: a big clap button to clap along with the word; the claps so far show beside it */
.g-padrow { display: flex; align-items: center; gap: 14px; min-height: clamp(84px, 16vmin, 120px); }
.g-clappad { width: clamp(84px, 16vmin, 120px); height: clamp(84px, 16vmin, 120px); border-radius: 50%; background: #fff; border: 5px solid #f59f00; box-shadow: 0 6px 0 rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; font-size: clamp(44px, 9vmin, 68px); }
.g-clappad img.clay { width: 1em; height: 1em; }
.g-clappad:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.g-tally { display: flex; gap: 2px; min-width: 2em; font-size: clamp(28px, 6vmin, 44px); }
.g-tally img.clay { width: 1em; height: 1em; }
.g-claps.lit { background: #fff3bf; transform: translateY(-4px); }
/* Quick look */
.g-flashcard { position: relative; background: #fff; border-radius: 26px; width: clamp(190px, 42vmin, 340px); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 0 rgba(0,0,0,.12); }
.g-flashcard .g-dots { width: 86%; }
.g-flashcard .g-dots img.clay { width: 26%; height: auto; transition: opacity .25s; }
.g-flashcard .g-dots.many img.clay { width: 20%; }
.g-cover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(60px, 14vmin, 120px); opacity: 0; transition: opacity .25s; pointer-events: none; }
.g-flashcard.hid .g-dots img.clay { opacity: 0; }
.g-flashcard.hid .g-cover { opacity: 1; }
.g-flash .g-ear { position: absolute; right: 18px; bottom: 18px; }
/* Copy me */
.g-pads { display: grid; grid-template-columns: repeat(2, auto); gap: 3vmin; }
.g-pad { border: 0; width: clamp(110px, 24vmin, 190px); aspect-ratio: 1; border-radius: 30px; background: color-mix(in srgb, var(--pc) 35%, white); box-shadow: 0 7px 0 color-mix(in srgb, var(--pc) 60%, #333); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .1s, background .1s, box-shadow .1s; touch-action: none; }
.g-pad svg { width: 70%; height: 70%; transition: transform .15s; }
.g-pad.on { background: var(--pc); transform: translateY(4px) scale(1.06); box-shadow: 0 3px 0 color-mix(in srgb, var(--pc) 60%, #333), 0 0 30px var(--pc); }
.g-pad.on svg { transform: scale(1.15) rotate(-6deg); }
.g-copy.watch .g-pad { cursor: default; }
.g-copy .g-got { font-size: 26px; }

/* voice picker: recorded, fun voices, and CAIMEX voices when online */
.vpick { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; }
.vpick .vcard { background: var(--card); border-radius: 24px; padding: 18px; width: min(92vw, 460px); text-align: center; box-shadow: 0 6px 0 var(--line); }
.vpick h3 { margin: 0 0 10px; font-size: 32px; }
.vpick .vrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.vpick .vrow button { border-radius: 18px; padding: 12px 6px; font-size: 17px; background: #fff; box-shadow: 0 3px 0 var(--line); display: grid; gap: 4px; }
.vpick .vrow button span { font-size: 34px; }
.vpick .vrow button.sel { outline: 4px solid #7c5cff; }
.vpick .vnote { font-size: 13px; opacity: .75; margin: 12px 4px 0; }
.vpick .vdone { margin-top: 12px; width: 64px; height: 56px; border-radius: 18px; font-size: 28px; background: #7c5cff; color: #fff; }
/* CAIMEX labels */
.cxb { display: inline-flex; gap: 4px; align-items: center; background: #111827; color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 13px; letter-spacing: .2px; }
.cxb b { color: #facc15; }
.vpick h3 { font-size: 24px; }
.vpick .vsec { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; font-size: 14px; opacity: .85; }
.vpick .vsec.cx { opacity: 1; }
.vpick .vsec small { font-size: 12px; opacity: .7; }
.vpick .vrow button.cx { background: #fffbea; }
.vpick .vrow button i { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .5px; color: #a16207; }
.cxt { color: #a16207; font-size: 12px; }
