:root {
  --bg1: #e8f7ff; --bg2: #fff6e5;
  --ink: #33415c; --muted: #7a8699;
  --card: #ffffff; --line: #e3e8f0;
  --go: #3bb273; --go-dark: #2a8f5a;
  --accent: #ff9f1c; --bad: #ff6b6b; --good: #3bb273;
  /* finger colours */
  --L5: #c3a6ff; --L4: #7fd1ff; --L3: #8be09b; --L2: #ffbf69;
  --R2: #ffe066; --R3: #8be09b; --R4: #7fd1ff; --R5: #c3a6ff;
  --L1: #ffb3c7; --R1: #ffb3c7;
  --font: 'Fredoka', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { background: linear-gradient(160deg, #e8f7ff, #fff6e5) fixed; }
body {
  font-family: var(--font); color: var(--ink);
  background: radial-gradient(circle at 15% 10%, #fff 0, transparent 40%), linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  overflow-x: hidden;
}
h1, h2 { margin: 0; font-weight: 600; }
h2 { font-size: 1.2rem; margin-bottom: .6rem; color: #4a5a78; }
button { font-family: inherit; color: inherit; cursor: pointer; }
code { background: #f2f4f8; padding: 1px 5px; border-radius: 5px; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
#screen-game.active { display: flex; flex-direction: column; height: 100vh; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 16px; padding: .6rem 1.1rem; font-size: 1.05rem; font-weight: 500; transition: transform .1s, box-shadow .1s; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.12); }
.btn.soft { background: #fff; }
.btn.small { padding: .4rem .8rem; font-size: .95rem; }
.btn.big { font-size: 1.5rem; padding: .8rem 2rem; border-radius: 22px; }
.btn.go { background: var(--go); color: #fff; box-shadow: 0 4px 0 var(--go-dark); }
.btn.danger { background: #ffe3e3; color: #b42323; margin-top: .5rem; }

/* ---------- top bar ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .8rem; }
.brand h1 { font-size: 2rem; color: #2f7d5b; }
.tagline { margin: 0; color: var(--muted); }
.tagline .home-link { color: var(--go-dark); text-decoration: none; border-bottom: 1px dotted currentColor; }
.mascot-big { font-size: 3rem; display: inline-block; animation: bob 3s ease-in-out infinite; }
.top-actions { display: flex; gap: .6rem; align-items: center; }
.star-count { background: #fff7d6; border-radius: 99px; padding: .35rem .9rem; font-size: 1.15rem; box-shadow: 0 2px 0 #f1dc8f; }

/* ---------- menu ---------- */
.menu-body { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem 2rem; }
.hello { font-size: 1.4rem; margin: 0 0 .8rem .3rem; min-height: 1em; }
.panel { background: var(--card); border-radius: 22px; padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 4px 0 var(--line); }
.row-panel { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.seg { display: inline-flex; gap: .5rem; flex-wrap: wrap; }
.seg button { border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: .5rem 1.1rem; font-size: 1.2rem; }
.seg button.on { border-color: var(--go); background: #e9f9f0; }
.badge { display: inline-block; background: #dc143c; color: #fff; border-radius: 6px; padding: 0 .35rem; font-size: .85rem; font-weight: 600; vertical-align: middle; }
.badge.en { background: #1d4ed8; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.cat { border: 3px solid var(--line); background: #fff; border-radius: 18px; padding: .7rem .5rem; display: flex; flex-direction: column; align-items: center; gap: .2rem; transition: transform .15s; }
.cat:hover { transform: translateY(-3px); }
.cat.on { border-color: var(--go); background: #e9f9f0; }
.cat-icon { font-size: 2.4rem; }
.cat-name { font-size: 1.15rem; font-weight: 500; }
.cat-desc { font-size: .8rem; color: var(--muted); text-align: center; }
.cat-prog { width: 80%; height: 7px; border-radius: 9px; background: #eef1f6; overflow: hidden; margin-top: .3rem; }
.cat-prog span { display: block; height: 100%; background: linear-gradient(90deg, #ffd166, #3bb273); }

.level-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.level { border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: .5rem .9rem; display: flex; flex-direction: column; align-items: center; min-width: 120px; font-size: 1.05rem; }
.level.on { border-color: var(--go); background: #e9f9f0; }
.level:disabled { opacity: .4; cursor: not-allowed; }
.level small { color: var(--muted); }
.lv-icon { font-size: 1.5rem; font-weight: 600; }
/* mode switch: letters / numbers */
.mode-seg { display: flex; margin: 0 0 1rem; }
.mode-seg button { flex: 1; font-size: 1.6rem; padding: .7rem 1rem; border-radius: 20px; font-weight: 600; }

.polish-seg { margin-top: .7rem; }
.polish-seg button { font-size: 1.05rem; }
.polish-seg.hidden { display: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- game ---------- */
.game-top { display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; gap: 1rem; }
.game-top-right { display: flex; gap: .5rem; align-items: center; }
.progress { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--line); font-size: 12px; display: grid; place-items: center; }
.dot.cur { border-color: var(--accent); transform: scale(1.2); }
.dot.done { background: #fff7d6; border-color: #f1dc8f; }

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; padding: 0 1rem; }
.picture { min-height: 18vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.picture.pop { animation: pop .5s ease-out; }
.picture .emoji { font-size: clamp(4rem, 15vh, 9rem); line-height: 1.1; animation: bob 3.5s ease-in-out infinite; }
.pic-note { color: var(--muted); }
.swatch { width: clamp(90px, 15vh, 150px); height: clamp(90px, 15vh, 150px); border-radius: 50%; border: 5px solid #fff; box-shadow: 0 6px 18px rgba(0,0,0,.15); animation: bob 3.5s ease-in-out infinite; }
.objects { display: grid; grid-template-columns: repeat(5, auto); gap: .2rem .5rem; font-size: clamp(2rem, 6vh, 3.4rem); justify-content: center; }
.objects.n1, .objects.n2, .objects.n3, .objects.n4 { grid-template-columns: repeat(4, auto); }
.num-big { font-size: clamp(3rem, 10vh, 6rem); font-weight: 700; color: #ff7b54; line-height: 1; }
.num-big + .objects { font-size: clamp(1.4rem, 3.5vh, 2.2rem); }
.num-words { font-size: clamp(1.8rem, 6vh, 3rem); background: #fff; border-radius: 22px; padding: .5rem 1.5rem; box-shadow: 0 4px 0 var(--line); color: #5a4fcf; }
/* math tasks */
.equation { font-size: clamp(3rem, 11vh, 6.5rem); font-weight: 700; color: #5a4fcf; line-height: 1.1; white-space: nowrap; }
.eq-ans { display: inline-block; min-width: 1em; color: var(--accent); border-bottom: 6px solid var(--accent); }
.eq-ans.solved { color: var(--good); border-bottom-color: var(--good); animation: pop .5s ease-out; }
.math-hint { background: #fff; border-radius: 18px; padding: .4rem 1rem; margin-top: .4rem; box-shadow: 0 3px 0 var(--line); text-align: center; animation: pop .4s ease-out; }
.math-hint p { margin: .2rem 0; font-size: 1.3rem; }
/* clock */
.clock-face { display: block; height: clamp(150px, 30vh, 270px); width: auto; }
.clock-face .cf-rim { fill: #fff; stroke: #5a4fcf; stroke-width: 6; }
.clock-face .cf-tick { stroke: #c8d0dc; stroke-width: 1.5; }
.clock-face .cf-tick5 { stroke: #5a4fcf; stroke-width: 3; stroke-linecap: round; }
.clock-face .cf-num { font: 700 19px Fredoka, sans-serif; fill: #3d3a5c; text-anchor: middle; dominant-baseline: central; }
.clock-face .cf-mins { font: 600 11px Fredoka, sans-serif; fill: #2f80ed; text-anchor: middle; dominant-baseline: central; }
.clock-face .cf-hour { stroke: #ff7b54; stroke-width: 9; stroke-linecap: round; }
.clock-face .cf-minute { stroke: #2f80ed; stroke-width: 5; stroke-linecap: round; }
.clock-face .cf-pin { fill: #3d3a5c; }
.clock-ans { font-size: clamp(1.6rem, 5vh, 2.6rem); font-weight: 700; color: var(--good); animation: pop .5s ease-out; text-align: center; }
.clock-ans small { display: block; font-size: .55em; font-weight: 500; color: var(--muted); }
.clock-hint p { font-size: 1.05rem; }
.clock-hint b { color: #2f80ed; }
.word .ch.fixed { color: var(--muted); border-color: transparent; }
/* money: coins at their real relative sizes (--d = diameter in mm), notes as coloured cards */
.money { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5em .7em; max-width: 92vw; font-size: clamp(13px, 2.4vh, 19px); }
.coin { width: calc(var(--d) * .24em); height: calc(var(--d) * .24em); border-radius: 50%; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; color: #4a3b1c; box-shadow: inset 0 0 0 .25em rgba(255,255,255,.35), 0 3px 0 rgba(0,0,0,.18); }
.coin b { font-size: 1.5em; }
.coin small { font-size: .8em; font-weight: 600; }
.coin.copper { background: radial-gradient(circle at 35% 30%, #f3c89a, #c27a45); }
.coin.silver { background: radial-gradient(circle at 35% 30%, #ffffff, #b9c0c9); color: #3d4450; }
.coin.bi2 { background: radial-gradient(circle, #e9edf2 0 58%, #e0b84f 60% 100%); color: #3d4450; }
.coin.bi5 { background: radial-gradient(circle, #e8c25a 0 58%, #d7dde4 60% 100%); }
.note { width: 7.5em; height: 3.8em; border-radius: .5em; display: inline-flex; align-items: baseline; justify-content: center; gap: .2em; padding-top: .5em; color: #fff; font-weight: 700; box-shadow: inset 0 0 0 .3em rgba(255,255,255,.35), 0 3px 0 rgba(0,0,0,.18); text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.note b { font-size: 2em; }
.note.n10 { background: #b8794a; } .note.n20 { background: #8e6bbf; } .note.n50 { background: #4f7fc4; }
.note.n100 { background: #5b9a6b; } .note.n200 { background: #cfa63c; } .note.n500 { background: #8a6a4f; }
.piggy { text-align: center; margin: 1rem auto; }
.piggy-pig { font-size: 5rem; background: none; border: 0; cursor: pointer; animation: bob 3.5s ease-in-out infinite; }
.piggy-sum { font-size: 2.4rem; font-weight: 700; color: #ff7b54; margin: .2rem 0; }
.mtable.clock td { width: 3.4em; }
.hint-objs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .15rem .3rem; font-size: clamp(1.4rem, 4vh, 2.2rem); max-width: 80vw; }
.hint-objs b { margin: 0 .4rem; color: var(--muted); }
.hint-objs .gone { opacity: .3; text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 4px; }
.hint-objs .empty { opacity: .55; }
.hint-groups { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; font-size: clamp(1.2rem, 3.4vh, 1.9rem); }
.hint-groups .grp { border: 3px dashed #f1dc8f; border-radius: 14px; padding: .1rem .3rem; }
.translation { color: var(--muted); font-size: 1.15rem; min-height: 1.5em; }

.word { display: flex; gap: .15em; font-size: clamp(3rem, 11vh, 6.5rem); font-weight: 600; margin: .2em 0; flex-wrap: wrap; justify-content: center; }
.word.long { font-size: clamp(2.4rem, 8vh, 5rem); }
.ch { min-width: .62em; text-align: center; padding: 0 .06em; border-bottom: 6px solid transparent; border-radius: 6px; transition: color .2s, transform .2s; line-height: 1.15; }
.ch.todo { color: #b5bfd0; }
.ch.cur { color: var(--ink); border-bottom-color: var(--accent); background: #fff4d8; animation: breathe 1.8s ease-in-out infinite; }
.ch.done { color: var(--good); }
.ch.space { color: #cfd6e2; font-weight: 400; }
.ch.space.cur { color: var(--accent); }
.ch.hiddench { color: #d6dce6; }
.ch.shake { animation: shake .35s; background: #ffe3e3; }
.word.celebrate .ch { animation: jump .6s ease; color: var(--good); }
.word.celebrate .ch:nth-child(2) { animation-delay: .05s; } .word.celebrate .ch:nth-child(3) { animation-delay: .1s; }
.word.celebrate .ch:nth-child(4) { animation-delay: .15s; } .word.celebrate .ch:nth-child(5) { animation-delay: .2s; }
.word.celebrate .ch:nth-child(6) { animation-delay: .25s; } .word.celebrate .ch:nth-child(7) { animation-delay: .3s; }
.word.celebrate .ch:nth-child(n+8) { animation-delay: .35s; }

.bubble-row { display: flex; align-items: center; gap: .6rem; min-height: 3.2rem; max-width: 900px; }
.mascot { font-size: 2.6rem; display: inline-block; }
.mascot.wiggle { animation: wiggle .5s; }
.bubble { background: #fff; border-radius: 18px; padding: .55rem 1rem; font-size: 1.2rem; box-shadow: 0 3px 0 var(--line); position: relative; }
.bubble::before { content: ''; position: absolute; left: -10px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-right-color: #fff; border-left: 0; }
.bubble.oops { background: #fff4e0; }
.bubble.oops::before { border-right-color: #fff4e0; }
.bubble.yay { background: #e9f9f0; }
.bubble.yay::before { border-right-color: #e9f9f0; }

/* ---------- keyboard ---------- */
.kb-area { display: flex; justify-content: center; align-items: flex-end; gap: .6rem; padding: .3rem .8rem 1rem; }
.keyboard { background: #dfe6f1; padding: 8px; border-radius: 18px; width: min(860px, 70vw); box-shadow: inset 0 -4px 0 #c8d1df; }
.keyboard.hidden { visibility: hidden; }
.kb-row { display: flex; gap: 5px; margin-bottom: 5px; }
.kb-row:last-child { margin-bottom: 0; }
.keyboard.digits-only { width: min(620px, 80vw); }
.keyboard.digits-only .key { height: clamp(44px, 7vh, 64px); font-size: clamp(1.1rem, 3vh, 1.6rem); font-weight: 600; }
.kb-area.digits-only .hand { display: none; }
.key { flex: 1 1 0; height: clamp(30px, 5.2vh, 50px); background: #fff; border-radius: 9px; display: flex; align-items: center; justify-content: center; position: relative; font-size: clamp(.8rem, 2vh, 1.15rem); font-weight: 500; box-shadow: 0 3px 0 #b9c3d3; transition: transform .1s, background .15s; }
.key.mod { font-size: clamp(.6rem, 1.5vh, .85rem); color: var(--muted); }
.key .alt { position: absolute; right: 5px; bottom: 1px; font-size: .62em; color: #b07ad0; }
.key.bump::after { content: ''; position: absolute; bottom: 5px; left: 50%; width: 12px; margin-left: -6px; height: 3px; border-radius: 2px; background: #8a96a8; }
/* finger zones */
body:not(.no-colors) .key.f-L5 { background: color-mix(in srgb, var(--L5) 28%, #fff); }
body:not(.no-colors) .key.f-L4 { background: color-mix(in srgb, var(--L4) 28%, #fff); }
body:not(.no-colors) .key.f-L3 { background: color-mix(in srgb, var(--L3) 28%, #fff); }
body:not(.no-colors) .key.f-L2 { background: color-mix(in srgb, var(--L2) 30%, #fff); }
body:not(.no-colors) .key.f-R2 { background: color-mix(in srgb, var(--R2) 34%, #fff); }
body:not(.no-colors) .key.f-R3 { background: color-mix(in srgb, var(--R3) 28%, #fff); }
body:not(.no-colors) .key.f-R4 { background: color-mix(in srgb, var(--R4) 28%, #fff); }
body:not(.no-colors) .key.f-R5 { background: color-mix(in srgb, var(--R5) 28%, #fff); }
body:not(.no-colors) .key.f-L1, body:not(.no-colors) .key.f-R1 { background: color-mix(in srgb, var(--R1) 25%, #fff); }
.key.target, .key.target2 { z-index: 2; outline: 4px solid var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.key.target { transform: translateY(-3px) scale(1.08); font-weight: 700; color: var(--ink); }
.key.f-L5.target { background: var(--L5) !important; } .key.f-L4.target { background: var(--L4) !important; }
.key.f-L3.target { background: var(--L3) !important; } .key.f-L2.target { background: var(--L2) !important; }
.key.f-R2.target { background: var(--R2) !important; } .key.f-R3.target { background: var(--R3) !important; }
.key.f-R4.target { background: var(--R4) !important; } .key.f-R5.target { background: var(--R5) !important; }
.key.f-R1.target, .key.f-R1.target2, .key.f-L1.target { background: var(--R1) !important; }
.key.target2 { outline-style: dashed; }
.key.good { background: #c9f2d8 !important; }
.key.bad { background: #ffc9c9 !important; animation: shake .35s; }

/* ---------- hands ---------- */
.hand { width: clamp(90px, 12vw, 160px); }
.hand.hidden { visibility: hidden; }
.hand svg { width: 100%; display: block; }
.finger, .palm { fill: #fdebd9; stroke: #e5c8ad; stroke-width: 2; transition: fill .2s; }
body:not(.no-colors) #fg-L5, body:not(.no-colors) #fg-R5 { fill: color-mix(in srgb, var(--L5) 35%, #fdebd9); }
body:not(.no-colors) #fg-L4, body:not(.no-colors) #fg-R4 { fill: color-mix(in srgb, var(--L4) 35%, #fdebd9); }
body:not(.no-colors) #fg-L3, body:not(.no-colors) #fg-R3 { fill: color-mix(in srgb, var(--L3) 35%, #fdebd9); }
body:not(.no-colors) #fg-L2 { fill: color-mix(in srgb, var(--L2) 35%, #fdebd9); }
body:not(.no-colors) #fg-R2 { fill: color-mix(in srgb, var(--R2) 45%, #fdebd9); }
.finger.active { stroke: var(--accent); stroke-width: 5; }
.finger.active:not(.thumb) { animation: wag 1s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
#fg-L5.active, #fg-R5.active { fill: var(--L5); } #fg-L4.active, #fg-R4.active { fill: var(--L4); }
#fg-L3.active, #fg-R3.active { fill: var(--L3); } #fg-L2.active { fill: var(--L2); } #fg-R2.active { fill: var(--R2); }
#fg-L1.active, #fg-R1.active { fill: var(--R1); }
.fkey { font: 600 14px var(--font); fill: #6b7588; text-anchor: middle; pointer-events: none; }
.hand-label { font: 500 16px var(--font); fill: #b39a83; text-anchor: middle; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(40, 60, 90, .35); display: none; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.overlay.show { display: flex; }
.overlay .card { background: #fff; border-radius: 28px; padding: 1.6rem 2rem; max-width: 640px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.2); animation: pop .4s ease-out; font-size: 1.15rem; }
.overlay h2 { font-size: 1.7rem; color: #2f7d5b; }
.overlay input { font: inherit; font-size: 1.5rem; padding: .4rem .8rem; border-radius: 14px; border: 3px solid var(--line); text-align: center; width: 12em; max-width: 100%; }
.overlay input:focus { outline: none; border-color: var(--go); }
.kbd { display: inline-grid; place-items: center; min-width: 2.2em; height: 2.2em; padding: 0 .4em; background: #fff; border-radius: 10px; box-shadow: 0 3px 0 #b9c3d3, 0 0 0 2px #dfe6f1; font-weight: 600; }
.kbd.small { min-width: 1.6em; height: 1.6em; font-size: .9em; margin: 0 2px; }
.kbd.wide { padding: 0 1.2em; }
.press { font-size: 1.3rem; margin-top: 1rem; animation: breathe 2s ease-in-out infinite; }
.big-emoji { font-size: 4rem; }
.bounce { animation: jump 1.2s ease infinite; display: inline-block; }

/* ---------- end ---------- */
.end-wrap { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; text-align: center; }
.end-wrap h1 { font-size: 2.6rem; color: #2f7d5b; }
.end-wrap > p { font-size: 1.3rem; }
.end-words { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 1rem 0; }
.end-word { background: #fff; border-radius: 16px; padding: .4rem .8rem; font-size: 1.3rem; display: flex; align-items: center; gap: .4rem; box-shadow: 0 3px 0 var(--line); }
.end-word.perfect { box-shadow: 0 3px 0 #f1dc8f; background: #fffbea; }
.ew-pic { font-size: 1.6rem; }
.mini-swatch { display: inline-block; width: 1.2em; height: 1.2em; border-radius: 50%; border: 2px solid #ddd; vertical-align: middle; }
.mini-swatch.big { width: 2.2em; height: 2.2em; }
.new-stickers { font-size: 1.3rem; background: #fff; display: inline-block; padding: .5rem 1rem; border-radius: 16px; }
.end-actions { display: flex; gap: .8rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.hint-small { color: var(--muted); font-size: .95rem; }
.center { text-align: center; }

/* ---------- album ---------- */
.album-tabs { display: flex; gap: .5rem; flex-wrap: wrap; padding: 0 1.5rem; }
.tab { border: 3px solid var(--line); background: #fff; border-radius: 14px; padding: .4rem .9rem; font-size: 1.05rem; }
.tab.on { border-color: var(--go); background: #e9f9f0; }
.tab small { color: var(--muted); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .8rem; padding: 1rem 1.5rem; }
.sticker { background: #fff; border: 3px dashed #d5dce8; border-radius: 18px; padding: .6rem; display: flex; flex-direction: column; align-items: center; gap: .1rem; min-height: 130px; }
.sticker.got { border: 3px solid #ffe08a; box-shadow: 0 4px 0 #f1dc8f; transform: rotate(-1deg); }
.sticker.got:nth-child(even) { transform: rotate(1.2deg); }
.st-pic { font-size: 3rem; line-height: 1.2; }
.sticker:not(.got) .st-pic { filter: grayscale(1) brightness(0) opacity(.15); }
.st-word { font-size: 1.1rem; font-weight: 500; }
.st-en { font-size: .9rem; color: #1d4ed8; }
.sticker-num { font-size: 2.4rem; color: #ff7b54; }
.sticker.nope { animation: shake .35s; }

/* number tables (math album) */
.album-grid.math { display: block; max-width: 760px; margin: 0 auto; }
.mt-summary { font-size: 1.3rem; text-align: center; margin: 0 0 .6rem; }
.mt-wrap { overflow-x: auto; }
.mtable { border-collapse: separate; border-spacing: 4px; margin: 0 auto; font-size: clamp(.85rem, 2.2vw, 1.2rem); }
.mtable th { color: var(--muted); font-weight: 600; padding: .2rem .4rem; }
.mtable th.mt-op { color: #5a4fcf; font-size: 1.3em; }
.mtable td { width: 2.6em; height: 2.3em; text-align: center; border-radius: 10px; font-weight: 600; cursor: pointer; }
.mtable td.todo { background: #fff; color: #c8d0dc; border: 2px dashed #d5dce8; }
.mtable td.c0 { background: #fff3c4; color: #8a6d00; box-shadow: 0 2px 0 #f1dc8f; }
.mtable td.c1 { background: #dff5e7; color: #2a8f5a; box-shadow: 0 2px 0 #b5e3c6; }
.mtable td.c2 { background: #fff; border: 2px solid #ffe08a; }
.mtable td.na { cursor: default; }
.mtable td.nope { animation: shake .35s; }
.mt-legend { text-align: center; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .8rem; justify-content: center; align-items: center; }
.mt-legend span { display: inline-grid; place-items: center; min-width: 1.8em; height: 1.6em; border-radius: 8px; }
.mt-legend .c0 { background: #fff3c4; } .mt-legend .c1 { background: #dff5e7; color: #2a8f5a; }
.mt-legend .c2 { border: 2px solid #ffe08a; } .mt-legend .todo { border: 2px dashed #d5dce8; }
.mt-levels { display: flex; flex-direction: column; gap: .5rem; background: #fff; border-radius: 18px; padding: .8rem 1rem; box-shadow: 0 4px 0 var(--line); margin-top: .8rem; }
.mt-level { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: 1.1rem; }
.mt-level > span:first-child { min-width: 7.5em; }
.mt-level small { color: var(--muted); }
.pbar-mini { width: 160px; height: 10px; border-radius: 9px; background: #eef1f6; overflow: hidden; }
.pbar-mini span { display: block; height: 100%; background: linear-gradient(90deg, #ffd166, #3bb273); }

/* read-aloud voices */
.voice-note { margin: .6rem 0 0; color: #b05a00; background: #fff4e0; border-radius: 12px; padding: .4rem .8rem; }
.voice-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid #f0f2f6; }
.voice-row select { min-width: 0; max-width: 100%; font: inherit; padding: .3rem .5rem; border-radius: 10px; border: 2px solid #e3e7ef; background: #fff; }

/* ---------- parent ---------- */
.parent-body { max-width: 900px; margin: 0 auto; padding: 0 1.5rem 2rem; }
.settings { display: flex; flex-direction: column; gap: .3rem; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem .2rem; border-bottom: 1px solid #f0f2f6; font-size: 1.02rem; }
.set-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--go); }
.set-row select, .set-row input:not([type]) { font: inherit; padding: .25rem .5rem; border-radius: 10px; border: 2px solid var(--line); }
textarea { width: 100%; font: 1rem/1.4 ui-monospace, Consolas, monospace; border-radius: 14px; border: 2px solid var(--line); padding: .6rem; margin-bottom: .5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-bottom: .6rem; }
.stat-grid div { background: #f6f8fc; border-radius: 14px; padding: .6rem; text-align: center; display: flex; flex-direction: column; }
.stat-grid b { font-size: 1.6rem; color: #2f7d5b; }
.stat-grid span { color: var(--muted); font-size: .9rem; }
.tips li { margin-bottom: .35rem; }

/* ---------- player switcher ---------- */
#btn-player:empty { display: none; }
.btn.player { display: inline-flex; align-items: center; gap: .35rem; }
.pl-avatar { font-size: 1.5rem; line-height: 1; }
.btn.player small { color: var(--muted); }
.game-player { font-size: 1.8rem; }
.wide-card { max-width: 760px !important; }
.prof-list { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin: .5rem 0 1rem; }
.prof { border: 3px solid var(--line); background: #fff; border-radius: 20px; padding: .7rem 1rem; display: flex; flex-direction: column; align-items: center; min-width: 130px; transition: transform .15s; }
.prof:hover { transform: translateY(-3px); }
.prof.on { border-color: var(--go); background: #e9f9f0; }
.prof b { font-size: 1.25rem; font-weight: 600; }
.prof small { color: var(--muted); }
.prof-av { font-size: 3rem; line-height: 1.2; }
.prof-av.small { font-size: 1.8rem; }
.prof-form { display: none; flex-direction: column; align-items: center; gap: .8rem; margin-top: .5rem; }
.prof-form.open { display: flex; }
.avatar-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: .35rem; }
.av { font-size: 2rem; border: 3px solid transparent; background: #f6f8fc; border-radius: 14px; width: 3.1rem; height: 3.1rem; display: grid; place-items: center; padding: 0; }
.av.on { border-color: var(--go); background: #e9f9f0; transform: scale(1.1); }
.player-row { display: flex; align-items: center; gap: .6rem; padding: .45rem .3rem; border-bottom: 1px solid #f0f2f6; font-size: 1.1rem; }
.player-row.on { background: #f3fbf6; border-radius: 12px; }
.player-row small { color: var(--muted); }
.grow { flex: 1; }
.emoji-select { font-size: 1.3rem; }
h2 small { font-weight: 400; color: var(--muted); font-size: .8em; }

/* sentences */
.word .wgroup { display: inline-flex; gap: .15em; }
.word { column-gap: .15em; row-gap: .1em; }
.word.sentence { font-size: clamp(2rem, 6.5vh, 3.8rem); max-width: 95vw; }
.picture .emoji.pair { letter-spacing: .1em; font-size: clamp(3.5rem, 12vh, 7rem); }

/* ---------- confetti ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
#confetti span { position: absolute; font-size: 1.6rem; animation: fly 1.5s cubic-bezier(.2,.7,.4,1) forwards; }

/* ---------- animations ---------- */
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes pulse { 0%,100% { outline-color: var(--accent); } 50% { outline-color: #ffd89a; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes jump { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-22px); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
@keyframes wag { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes fly { 0% { transform: translate(0,0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), calc(var(--dy) + 420px)) rotate(var(--r)); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
@media (max-width: 700px) { .hand { display: none; } .keyboard { width: 96vw; } }

/* ---------- phones and tablets: the on-screen keyboard is the way to type ---------- */
#screen-game.active { height: 100dvh; } /* the visible height, without the browser's bars */
.touch-note { display: none; }
body.touch .touch-note { display: block; color: var(--muted); margin: -.4rem 0 .8rem .3rem; }
body.touch .kbd-only { display: none; }
body.touch .hand { display: none; }
body.touch .keyboard { width: min(980px, 98vw); }
body.touch .keyboard.digits-only { width: min(620px, 96vw); }
body.touch .key { height: clamp(38px, 7.5vh, 64px); font-size: clamp(1rem, 2.6vh, 1.4rem); cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body.touch .key.latched { background: var(--R1); color: var(--ink); transform: translateY(2px); box-shadow: 0 1px 0 #b9c3d3; }
body.touch #ov-ready { cursor: pointer; }

/* low screens: a phone held sideways */
@media (max-height: 500px) {
  .game-top { padding: .15rem .6rem; }
  .game-top .btn { padding: .25rem .7rem; font-size: .9rem; }
  .stage > * { flex-shrink: 0; }
  .picture { min-height: 0; }
  .picture .emoji { font-size: clamp(2rem, 13vh, 4rem); }
  .translation { min-height: 0; font-size: .95rem; }
  .word { font-size: clamp(1.8rem, 11vh, 3rem); margin: 0; }
  .word.long { font-size: clamp(1.5rem, 8vh, 2.6rem); }
  .word.sentence { font-size: clamp(1.2rem, 6vh, 2rem); }
  .bubble-row { min-height: 0; }
  .bubble { font-size: .95rem; padding: .3rem .8rem; }
  .mascot { font-size: 1.8rem; }
  .kb-area { padding: .2rem .4rem .4rem; }
  .kb-row { gap: 3px; margin-bottom: 3px; }
  .keyboard { padding: 5px; }
  .key, body.touch .key { height: clamp(22px, 7.6vh, 40px); font-size: clamp(.8rem, 4vh, 1.1rem); }
  .keyboard.digits-only .key { height: clamp(34px, 12vh, 52px); }
}

/* narrow screens: a phone held upright (the menu suggests turning it) */
@media (max-width: 600px) {
  .game-top { gap: .4rem; padding: .4rem .5rem; }
  .word { font-size: clamp(1.8rem, 13vw, 6.5rem); }
  .word.long { font-size: clamp(1.4rem, 8.5vw, 5rem); }
  .word.sentence { font-size: clamp(1.1rem, 6vw, 3.8rem); }
  .keyboard { padding: 4px; }
  .kb-row { gap: 2px; margin-bottom: 3px; }
  .key { border-radius: 6px; }
  body.touch .key { font-size: 1rem; }
  .key.mod, body.touch .key.mod { font-size: .6rem; }
}
