/* Copyright (c) 2026 Aqta Technologies Limited. All rights reserved. Proprietary and confidential. */
/* Tera Early: big targets, no reading needed to navigate, works on a small cheap phone. */
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: #FFF7E0;
  color: #1B2433;
  font: 600 1.25rem/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
#app { min-height: 100%; max-width: 1120px; margin: 0 auto; padding: 16px clamp(16px, 3vw, 32px) 72px; position: relative; }
.screen { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 680px; margin-inline: auto; padding-top: 8px; }
#home, #setup { max-width: none; }
.app-identity { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; width: 100%; padding-bottom: 10px; border-bottom: 1px solid #D6CFBF; }
.app-name { font-size: 1.1rem; line-height: 1.3; font-weight: 800; color: #0A7C8C; }
.tera-logo { display: block; width: 144px; height: auto; max-width: calc(100% - 84px); flex: none; }
.maker-logo { display: block; width: 96px; height: auto; flex: none; }
.screen[hidden] { display: none; }
.tera { display: block; height: auto; }
.tera.small { width: 110px; margin-top: 4px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; }
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 132px; border: 0; border-radius: 22px; background: #fff; color: inherit;
  font: inherit; font-size: 1.05rem; box-shadow: 0 0 0 3px #1B2433, 6px 7px 0 rgba(27,36,51,.14); cursor: pointer;
}
.tile .ico { font-size: 3rem; font-weight: 800; line-height: 1; color: #0A7C8C; }
.tile:active, .choice:active { transform: translate(2px, 2px); box-shadow: 0 0 0 3px #1B2433, 3px 4px 0 rgba(27,36,51,.14); }
.stars { min-height: 34px; font-size: 1.8rem; color: #E8A317; letter-spacing: 4px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.home-btn, .hear-btn {
  width: 64px; height: 64px; border-radius: 50%; border: 0; background: #fff; font-size: 1.8rem;
  box-shadow: 0 0 0 3px #1B2433; cursor: pointer;
}
.prompt { text-align: center; font-size: 1.5rem; font-weight: 800; min-height: 2.2em; }
.scene { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; min-height: 150px; width: 100%; }
.group {
  display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 6px;
  width: 46%; min-height: 150px; padding: 12px; border-radius: 20px; border: 0; background: #fff;
  box-shadow: 0 0 0 3px #1B2433; cursor: pointer;
}
.plus { font-size: 2.6rem; font-weight: 800; }
.letter-big { font-size: 7rem; font-weight: 800; line-height: 1; color: #0A7C8C; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.choice {
  min-height: 88px; padding: .2em .1em; border: 0; border-radius: 20px; background: #fff; color: inherit;
  font: 800 2.4rem/1.3 system-ui, sans-serif; box-shadow: 0 0 0 3px #1B2433, 6px 7px 0 rgba(27,36,51,.14); cursor: pointer;
}
.choice.right { background: #CDEFE9; }
.choice.wrong { background: #FBE3D9; animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.obj { width: 40px; height: 40px; }

dialog { max-width: 420px; border: 0; border-radius: 16px; padding: 20px; box-shadow: 0 0 0 3px #1B2433; font-size: 1rem; }
dialog h2 { font-size: 1.2rem; margin-bottom: 10px; }
dialog p { margin-bottom: 10px; font-weight: 500; }
dialog .small { font-size: .85rem; color: #6A7280; }
dialog button { display: block; width: 100%; min-height: 48px; margin-top: 8px; border-radius: 10px; border: 2px solid #1B2433; background: #fff; font: 700 1rem system-ui, sans-serif; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* ---------- Tera's motions (12 Nov 2026) ---------- */
.tera-live { display: block; width: 190px; height: 190px; object-fit: contain; cursor: pointer; transform-origin: 50% 90%; }
.tera-live.small { width: 130px; height: 130px; }
.m-bob { animation: bob 2.4s ease-in-out infinite; }
.m-tilt { animation: tilt .8s ease-in-out 2; }
.m-bounce { animation: bounce .5s ease-out 3; }
.m-pulse { animation: pulse .6s ease-in-out 3; }
.m-talk { animation: talk .28s ease-in-out infinite; }
.m-lean { animation: lean 1.6s ease-in-out infinite; }
.m-ponder { animation: ponder 1.8s ease-in-out infinite; }
.m-pop { animation: pop .35s ease-out 1; }
.m-nod { animation: nod .5s ease-in-out 3; }
.m-jump { animation: jump .55s cubic-bezier(.3,1.6,.5,1) 2; }
.m-breathe { animation: breathe 3s ease-in-out infinite; }
.m-dance { animation: dance .7s ease-in-out infinite; }
.m-wave-flag { animation: tilt .6s ease-in-out 3; }
.m-scan { animation: scan 2s ease-in-out infinite; }
.m-present { animation: pop .4s ease-out 1, bob 2.4s 0.4s ease-in-out infinite; }
.m-sail { animation: sail 1.4s ease-in-out infinite; }
.m-droop { animation: droop 1.2s ease-in-out 1 forwards; }
.m-yawn { animation: yawn 2.2s ease-in-out infinite; }
.m-glow { animation: glow 1.6s ease-in-out infinite; }
.m-spin { animation: spin .8s ease-in-out 1; }
.m-peek { animation: peek 1.4s ease-in-out 1; }
.m-wave { animation: wave .45s ease-in-out 4; }
.m-giggle { animation: giggle .14s linear 8; }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes tilt { 50% { transform: rotate(-8deg); } }
@keyframes bounce { 40% { transform: translateY(-18px) scale(1.03); } 70% { transform: translateY(0) scale(1,.96); } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes talk { 50% { transform: scaleY(.97) translateY(2px); } }
@keyframes lean { 50% { transform: rotate(4deg) translateX(4px); } }
@keyframes ponder { 50% { transform: rotate(-4deg) translateY(-4px); } }
@keyframes pop { 0% { transform: scale(.7); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes nod { 50% { transform: rotate(5deg) translateY(4px); } }
@keyframes jump { 45% { transform: translateY(-34px) rotate(-4deg); } 80% { transform: translateY(0) scale(1.04,.94); } }
@keyframes breathe { 50% { transform: scale(1.03); } }
@keyframes dance { 25% { transform: rotate(-10deg) translateY(-10px); } 75% { transform: rotate(10deg) translateY(-10px); } }
@keyframes scan { 0%, 100% { transform: translateX(-10px) rotate(-3deg); } 50% { transform: translateX(10px) rotate(3deg); } }
@keyframes sail { 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes droop { to { transform: translateY(6px) rotate(-3deg); } }
@keyframes yawn { 50% { transform: scale(1.04, .97); } }
@keyframes glow { 50% { filter: drop-shadow(0 0 14px rgba(244,182,63,.9)); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes peek { 0% { transform: translateX(60px) rotate(12deg); opacity: .4; } 40%, 70% { transform: translateX(0) rotate(0); opacity: 1; } 100% { transform: none; } }
@keyframes wave { 50% { transform: rotate(10deg); } }
@keyframes giggle { 25% { transform: translateX(-3px) rotate(-2deg); } 75% { transform: translateX(3px) rotate(2deg); } }
/* Explorer motions play once and settle on their illustrated pose. */
.m-ready-to-explore { animation: ready-to-explore 1.2s ease-in-out 1; }
.m-look-near { animation: look-near 1.4s ease-in-out 1; }
.m-look-far { animation: look-far 1.6s ease-in-out 1; }
.m-found-a-clue { animation: found-a-clue 1.2s ease-in-out 1; }
.m-count-along { animation: count-along 1.5s ease-in-out 1; }
.m-compare-sides { animation: compare-sides 1.6s ease-in-out 1; }
.m-make-space { animation: make-space 1.2s ease-in-out 1; }
.m-follow-the-path { animation: follow-the-path 1.6s ease-in-out 1; }
.m-sound-it-out { animation: sound-it-out 1.2s ease-in-out 1; }
.m-build-together { animation: build-together 1.4s ease-in-out 1; }
.m-try-another-way { animation: try-another-way 1.2s ease-in-out 1; }
.m-you-did-it { animation: you-did-it 1.2s ease-in-out 1; }
.m-sticker-discovery { animation: sticker-discovery 1.4s ease-in-out 1; }
.m-pass-to-friend { animation: pass-to-friend 1.4s ease-in-out 1; }
.m-story-time { animation: story-time 1.6s ease-in-out 1; }
.m-rest-with-me { animation: rest-with-me 1.6s ease-in-out 1; }
@keyframes ready-to-explore { 35% { transform: translateY(-6px) rotate(-3deg); } 70% { transform: translateY(-2px) rotate(2deg); } }
@keyframes look-near { 35%, 65% { transform: translateY(3px) rotate(-4deg) scale(1.04); } }
@keyframes look-far { 35%, 65% { transform: translateY(-4px) rotate(4deg) scale(1.06); } }
@keyframes found-a-clue { 35% { transform: translateY(-8px) rotate(-2deg) scale(1.04); } 65% { transform: translateY(-3px) rotate(2deg); } }
@keyframes count-along { 20% { transform: translateY(4px) rotate(-2deg); } 40%, 80% { transform: none; } 60% { transform: translateY(4px) rotate(2deg); } }
@keyframes compare-sides { 25% { transform: translateX(-6px) rotate(-4deg); } 75% { transform: translateX(6px) rotate(4deg); } }
@keyframes make-space { 40%, 65% { transform: translateX(-8px) scale(.98); } }
@keyframes follow-the-path { 25% { transform: translate(-6px, -2px); } 50% { transform: translate(0, -5px); } 75% { transform: translate(6px, -2px); } }
@keyframes sound-it-out { 20%, 60% { transform: scale(1.02, .98); } 40%, 80% { transform: translateY(-2px); } }
@keyframes build-together { 30% { transform: translate(-3px, 3px) rotate(-3deg); } 65% { transform: translate(3px, -3px) rotate(3deg); } }
@keyframes try-another-way { 30% { transform: translateY(2px) rotate(-4deg); } 65% { transform: translateY(-2px) rotate(4deg); } }
@keyframes you-did-it { 40% { transform: translateY(-10px) scale(1.06); } 70% { transform: translateY(-2px) scale(1.02); } }
@keyframes sticker-discovery { 35% { transform: rotate(-3deg) scale(1.08); } 70% { transform: rotate(3deg) scale(1.04); } }
@keyframes pass-to-friend { 40%, 65% { transform: translateX(10px) rotate(5deg); } }
@keyframes story-time { 30% { transform: translateY(2px) rotate(-3deg); } 65% { transform: translateY(2px) rotate(3deg); } }
@keyframes rest-with-me { 40%, 70% { transform: translateY(4px) scale(.98); } }
.zzz { position: absolute; font: 800 1.6rem system-ui; color: #0A7C8C; animation: zzz 2.4s ease-in infinite; pointer-events: none; }
@keyframes zzz { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(30px, -70px) scale(1.2); } }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -20px; width: 12px; height: 16px; border-radius: 3px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.tera-wrap { position: relative; display: flex; justify-content: center; }
@media (prefers-reduced-motion: reduce) { .tera-live { animation: none !important; } .confetti { display: none; } }

.legal { margin-top: 14px; line-height: 1.4; }

/* First-run setup for a grown-up, and the adult gate (12 Nov 2026) */
.setup-h { font-size: 1.6rem; }
.setup-card { width: 100%; padding: 18px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 3px #1B2433; font: 500 1rem/1.45 system-ui, sans-serif; }
.setup-card p { margin-bottom: 10px; }
.setup-list { margin: 0 0 14px; padding-left: 1.2em; }
.setup-list li { margin-bottom: 4px; }
.setup-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0; font-weight: 700; }
.setup-row select, #gateA, #gate2A { min-height: 44px; padding: 0 10px; border-radius: 10px; border: 2px solid #1B2433; font: 600 1rem system-ui, sans-serif; background: #fff; }
.setup-row select { min-width: 0; max-width: 100%; }
#gateA, #gate2A { width: 100%; margin-bottom: 10px; }
.setup-check { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 12px; font-weight: 600; }
.setup-check input { width: 22px; height: 22px; flex: none; margin-top: 2px; }
#setupGo { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: #0A7C8C; color: #fff; font: 800 1.1rem system-ui, sans-serif; }
#setupGo:disabled { background: #B9C2C9; }
.gate-q { font-weight: 600; }
.gate-msg { min-height: 1.2em; color: #B42318; font-weight: 700; }
.small { font-size: .85rem; color: #6A7280; }
body.in-setup .foot { display: none; }
#setup .legal-note { margin-top: 12px; font-size: .75rem; color: #5E6470; }

/* ---------- Testera look (12 Nov 2026): paper, washi tape, Jakarta, raised teal ---------- */
@font-face { font-family: 'Jakarta'; src: url('fonts/jakarta-500.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Jakarta'; src: url('fonts/jakarta-700.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Jakarta'; src: url('fonts/jakarta-800.ttf') format('truetype'); font-weight: 800; font-display: swap; }
:root { --paper: #EFF8FC; --card: #FFFFFF; --ink: #173448; --teal: #087F8C; --teal-dark: #05616C; --tape-y: #FFE499; --tape-b: #C6EAF6; }
body {
  background-color: var(--paper);
  background-image: radial-gradient(ellipse 90% 50% at 50% 0%, #FFFFFF 10%, transparent 100%);
  color: var(--ink);
  font-family: 'Jakarta', system-ui, -apple-system, sans-serif;
}
.tile, .choice, .group, .home-btn, .hear-btn, .setup-card, dialog {
  background: var(--card);
  box-shadow: 0 0 0 1px #D4E4ED, 0 5px 0 #D4E4ED;
  border-radius: 20px;
}
.tile { position: relative; font-weight: 700; font-size: 1.05rem; }
.tile::before { content: none; }
.tile:nth-child(2)::before, .tile:nth-child(3)::before { background: var(--tape-b); transform: rotate(5deg); }
.tile .ico { font-weight: 800; color: var(--teal); }
.tile:active, .choice:active { transform: translateY(3px); box-shadow: 0 0 0 1px #B6D3DE, 0 2px 0 #B6D3DE; }
.choice { font-family: 'Jakarta', system-ui, sans-serif; font-weight: 800; }
.choice.right { background: #DDF0EC; box-shadow: 0 0 0 2.5px var(--teal), 0 12px 22px -12px rgba(11,110,126,.5); }
.choice.wrong { background: #FBE7DD; }
.group { border-radius: 24px; background-color: var(--card); }
.prompt { font-weight: 800; letter-spacing: -.02em; }
.prompt::after { content: none; }
.setup-h { font-weight: 800; letter-spacing: -.03em; }
#setupGo, #gate2Go { background: var(--teal); color: #fff; border: 0; border-radius: 6px; box-shadow: 0 5px 0 var(--teal-dark); font-family: 'Jakarta', system-ui, sans-serif; font-weight: 700; }
#setupGo:active, #gate2Go:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--teal-dark); }
#setupGo:disabled { background: #B9C2C9; box-shadow: 0 5px 0 #98A2AA; }
dialog button, .setup-row select, #gateA, #gate2A { font-family: 'Jakarta', system-ui, sans-serif; border-radius: 6px; }
.stars { color: #E0A21B; }
.home-label { align-self: stretch; margin: 2px 0 0; padding: 10px 14px; background: var(--card); font: 500 .9rem/1.35 ui-monospace, Menlo, monospace; box-shadow: 0 1px 1px rgba(58,42,14,.14), 0 10px 18px -12px rgba(58,42,14,.35); transform: rotate(-.6deg); }

#play .tera-wrap { margin-top: 26px; }

/* 12 Nov QA fixes */
dialog { margin: auto; } /* the global margin reset removed the browser's centring */
.scene .group { width: 40%; } /* "3 + 2" stays on one row */
.scene .group[style*="width:100%"] { width: 100%; }
body.in-play .foot { display: none; }
#holdReset.holding { background: #E3F2F4; transition: background 2s linear; }
@media (orientation: landscape) and (max-height: 520px) {
  #play { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 8px 16px; }
  #play > * { grid-column: 1 / -1; }
  #play .prompt { min-height: 0; font-size: 1.2rem; }
  #play .scene { grid-column: 1; min-height: 0; } #play .group { min-height: 110px; }
  #play .choices { grid-column: 2; grid-template-columns: 1fr; }
  #play .tera-wrap { display: none; }
}

/* Footer: quiet legal line and grown-up controls, no underlined links */
.foot { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: linear-gradient(to top, rgba(244,239,228,.96) 70%, rgba(244,239,228,0)); font: 500 .72rem 'Jakarta', system-ui, sans-serif; color: #5E6470; }
.foot-nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 100%; }
.foot-nav button { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 0 12px; border: 1.5px solid #D6CFBF; border-radius: 999px;
  background: #FBF8F1; color: #4A5260; font: 600 .78rem 'Jakarta', system-ui, sans-serif; cursor: pointer; text-decoration: none; }
.foot-nav button:hover { border-color: #1B2433; color: #1B2433; }
.foot-nav button:focus-visible { outline: 3px solid #0A7C8C; outline-offset: 2px; }
.foot-nav .adult { border-color: #1B2433; color: #1B2433; }
.foot-nav svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 380px) { .foot-c { display: none; } .foot { justify-content: flex-end; } }
.foot-c { white-space: nowrap; }
.foot-nav button { min-height: 34px; padding: 0 11px; }
dialog { max-width: min(420px, calc(100% - 24px)); }
@media (max-width: 380px) { .foot-c { display: inline; } }
@media (max-width: 340px) { .foot-c { display: none; } }

/* Drawn icons in place of emoji, so every phone shows the same thing */
.home-btn, .hear-btn { display: inline-flex; align-items: center; justify-content: center; color: #1B2433; }
.home-btn svg, .hear-btn svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.listen { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-width: 48px; min-height: 52px; padding: 10px 16px; border-radius: 12px; border: 1.5px solid #1B2433;
  background: #FBF8F1; box-shadow: 0 3px 0 rgba(27,36,51,.12); color: #0A7C8C; font: 700 1rem/1.3 'Jakarta', system-ui, sans-serif; cursor: pointer; }
.listen svg { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.listen:active { transform: scale(.96); }
.nudge { animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); box-shadow: 0 0 0 5px #0A7C8C; } }
@media (prefers-reduced-motion: reduce) { .nudge { animation: none; box-shadow: 0 0 0 5px #0A7C8C; } }

/* Picture icons on the home tiles, for children who cannot read yet */
.tile .ico svg { display: block; width: 96px; height: 48px; margin: 0 auto 6px; }
.tile .ico-abc { display: block; font: 800 2.6rem/1.2 'Jakarta', system-ui, sans-serif; color: #0A7C8C; letter-spacing: .02em; margin-bottom: 6px; }

/* Numbered learners share one tablet. Colour never carries identity alone. */
[hidden] { display: none !important; }

/* New activities share the existing large controls and calm feedback. */
.word-picture { width: 116px; height: 116px; object-fit: contain; }
.word-slots { display: flex; justify-content: center; gap: 12px; width: 100%; }
.word-slot { display: grid; place-items: center; width: 56px; height: 60px; border: 2px dashed var(--teal); border-radius: 12px; font-size: 2.1rem; font-weight: 800; background: #fffdf7; }
.word-slot.filled { border-style: solid; background: #DDF0EC; }
.word-tile:disabled { opacity: .45; box-shadow: none; }
.ten-frames { width: 100%; display: grid; gap: 12px; }
.ten-frame { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 2px; }
.ten-cell { display: grid; place-items: center; min-height: 30px; aspect-ratio: 1; border: 1px solid #9eaaa5; border-radius: 5px; background: #fffdf7; }
.ten-cell .obj { width: 100%; height: auto; }
.take-away { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%; }
.take-object { display: inline-flex; }
.take-object.taken { opacity: 0; animation: take-away 1s ease-out both; }
@keyframes take-away { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(28px) scale(.6); } }
.number-line { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(1.6rem, calc(100% / var(--line-columns))), 1fr)); width: 100%; row-gap: 20px; }
.line-cell { position: relative; text-align: center; border-bottom: 3px solid var(--teal); padding: 8px 0; font-size: 1.2rem; font-weight: 800; }
.line-cell::after { content: ''; position: absolute; bottom: -7px; left: 50%; height: 10px; width: 2px; background: var(--teal); }
.line-cell.missing { background: #fff1a8; border-radius: 7px 7px 0 0; }
#learnersH { font-size: clamp(1.7rem, 7vw, 2.2rem); text-align: center; }
.picker-help { font-size: 1.1rem; text-align: center; }
.practice-review { margin-block: 16px; padding-block: 16px; border-block: 1px solid #C7DDE7; }
.practice-review h3 { font-size: 1.2rem; }
.practice-review .practice-learner { margin-top: 4px; font-weight: 800; color: var(--teal-dark); }
.practice-review p { overflow-wrap: anywhere; }
.practice-suggestions { display: grid; gap: 12px; margin-block: 14px; }
.practice-suggestion { padding: 12px; border-radius: 12px; background: #E2F2F5; }
.practice-suggestion h4 { font-size: 1rem; }
.practice-suggestion .practice-next { margin-block: 4px; font-weight: 800; }
.practice-review summary { min-height: 48px; padding-block: 12px; cursor: pointer; font-size: 1rem; font-weight: 700; }
.practice-review summary:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
.practice-skill-list { list-style: none; padding: 0; margin: 0; }
.practice-skill-list > li { padding-block: 12px; border-top: 1px solid #D4E4ED; }
.practice-skill-list h4 { font-size: 1rem; }
.practice-skill-list p { margin-block: 4px; }
.practice-recent { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin-block: 6px; font-size: .85rem; }
.practice-recent li { padding: 4px 8px; border-radius: 6px; }
.practice-right { color: #165D48; background: #DDF0E7; }
.practice-retry { color: #754C12; background: #FFF0D2; }
.adult-attribution { display: flex; align-items: center; gap: 12px; padding-block: 16px; }
.adult-attribution .maker-logo { width: 72px; }
.adult-attribution p { margin: 0; }
.learner-cards { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; padding: 8px 2px 20px; }
.learner-card { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 122px; padding: 12px 6px; border: 2px solid var(--ink); border-radius: 16px; color: var(--ink); box-shadow: 0 4px 0 #1f23282b; font: 800 2rem 'Jakarta', system-ui, sans-serif; cursor: pointer; }
.learner-card svg, .player-badge svg { width: 58px; height: 58px; fill: var(--card); stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.learner-card:active { transform: translateY(2px); box-shadow: 0 2px 0 #1f23282b; }
.learner-card:focus-visible, #changePlayer:focus-visible { outline: 4px solid var(--teal); outline-offset: 4px; }
.player-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; padding: 0 0 14px; }
.player-badge { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 12px; font-size: .95rem; }
.player-badge svg { width: 34px; height: 34px; flex: none; }
#changePlayer { min-height: 52px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--card); color: var(--ink); font: 700 1rem 'Jakarta', system-ui, sans-serif; touch-action: none; -webkit-touch-callout: none; cursor: pointer; }
#playerHoldHint { grid-column: 2; font-size: .85rem; text-align: center; }
#changePlayer.holding, #holdReset.holding { background: #BFE2DB; box-shadow: inset 0 -5px 0 var(--teal); }
.classroom-settings { border: 1px solid #B7B0A4; border-radius: 10px; padding: 12px; margin: 12px 0 18px; }
.classroom-settings legend { font-weight: 800; padding: 0 6px; }
#learnerCount { width: 76px; min-height: 48px; border: 2px solid var(--ink); border-radius: 6px; padding: 8px; font: inherit; background: var(--card); }
#classroomMsg { color: #B42318; margin-top: 8px; }
.storage-details { font-size: .85rem; line-height: 1.45; margin: 12px 0; overflow-wrap: anywhere; }
.storage-details summary { min-height: 44px; cursor: pointer; display: list-item; padding: 10px 0; }
.storage-details code { font-size: .85em; }
@media (max-width: 340px) { .player-bar { gap: 6px; } .player-badge { padding: 5px; gap: 3px; } #changePlayer { padding: 8px; } }

/* One welcome and one activity area, with the same order on every screen. */
.journey-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; }
.journey-top h1 { font-size: clamp(1.4rem, 6vw, 2rem); line-height: 1.15; }
.daily-sun { display: flex; align-items: center; gap: 6px; font-size: .9rem; flex: none; }
.daily-sun svg { width: 28px; height: 28px; fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; }
.daily-sun[data-played="true"] svg circle { fill: #F4B63F; }
.daily-sun[data-played="true"] svg { stroke: var(--ink); }
.journey-button, .quiet-button { min-width: 48px; min-height: 52px; padding: 10px 16px; border: 1.5px solid #C7DDE7; border-radius: 16px; font: 700 1rem 'Jakarta', system-ui, sans-serif; color: var(--ink); background: var(--card); cursor: pointer; }
.journey-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: #FFFFFF; box-shadow: 0 3px 0 #C7DDE7; }
.journey-button img { width: 40px; height: 40px; }
.quiet-button { background: #FFFFFF; border-color: #C7DDE7; }
button:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }
h1[tabindex="-1"]:focus, .prompt[tabindex="-1"]:focus { outline: none; }
.pair-status, .turn-badge { font-size: 1rem; text-align: center; padding: 8px 12px; background: #DDF0EC; border-radius: 12px; }
.reward-note { font-size: 1rem; color: var(--teal-dark); text-align: center; }
.book-help { font-size: 1.15rem; text-align: center; }
.book-progress, .book-note { font-size: .9rem; line-height: 1.5; font-weight: 500; text-align: center; max-width: 32ch; }
.dress-tera { position: relative; width: 200px; }
.dress-tera > img { display: block; width: 100%; }
.cover-stickers { position: absolute; left: 27%; right: 20%; bottom: 22%; height: 24%; pointer-events: none; }
.cover-stickers img { width: 36%; position: absolute; bottom: 0; left: 0; transform: rotate(-10deg); }
.cover-stickers img:nth-child(2) { left: 62%; bottom: 12%; transform: rotate(12deg); }
.cover-stickers img:nth-child(3) { left: 30%; bottom: 53%; transform: rotate(3deg); }
.sticker-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); width: 100%; gap: 9px; }
.sticker-slot { aspect-ratio: 1; min-width: 48px; min-height: 48px; border: 1.5px solid #C7C0B0; border-radius: 12px; padding: 4px; background: var(--card); cursor: pointer; }
.sticker-slot img { width: 100%; height: 100%; display: block; }
.sticker-slot[data-earned="false"] { background: transparent; border-style: dashed; cursor: default; }
.sticker-slot[data-earned="false"] img { filter: grayscale(1); opacity: .18; }
.sticker-slot[aria-pressed="true"] { border: 3px solid var(--teal); background: #DDF0EC; padding: 2.5px; }
.pass-mark { width: 130px; height: 130px; border: 2px solid var(--ink); border-radius: 28px; padding: 16px; }
.pass-mark svg { width: 100%; height: 100%; fill: var(--card); stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
#pass, #partners { text-align: center; }
#pass h1, #partners h1 { font-size: 1.6rem; }
#pass p { font-size: 1.05rem; }
.learner-card:disabled { opacity: .55; box-shadow: none; }
.learner-card small { font-size: .8rem; }
@media (max-width: 340px) { .sticker-grid { gap: 7px; } }

/* Adult controls must never cover a child's activity or sticker button. */
#app { padding-bottom: 20px; }
.foot { position: static; justify-content: center; margin-top: 12px; padding: 0 0 env(safe-area-inset-bottom); background: none; }
.foot-nav { justify-content: center; gap: 4px; }
.foot-nav button { border-color: transparent; background: transparent; color: #476475; }
.foot-nav .adult { border-color: transparent; background: transparent; color: #476475; }

/* Native controls keep Tera's reactions available to keyboard and touch users. */
.tera-button{display:inline-flex;align-items:center;justify-content:center;min-width:48px;min-height:48px;padding:0;border:0;border-radius:24px;background:transparent;box-shadow:none;cursor:pointer;touch-action:manipulation}
.tera-button:focus-visible{outline:3px solid var(--teal);outline-offset:5px}
.tera-button .tera-live{display:block}
.tera-still{cursor:default}

/* Pack availability and review stay readable in the existing grown-up dialog. */
.pack-status { margin: 12px; padding: 12px 16px; border-radius: 14px; background: #FFF1D6; font-size: 16px; }
.pack-review { margin: 18px 0; padding: 14px; border: 2px solid #D9D2BD; border-radius: 14px; }
.pack-review summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
#packReviewContent { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 16px; line-height: 1.6; }
#offlineStatus { padding: 12px; border-radius: 12px; background: #FFF1D6; }
#offlineStatus[data-state="ready"] { background: #DDF0EC; }

/* Saving notices explain device problems to the grown-up without stopping play. */
.saving-notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 12px; padding: 12px 16px; border: 2px solid #D9D2BD; border-radius: 14px; background: #FFF1D6; }
.saving-notice p { margin: 0; font-size: 16px; }
.saving-notice[hidden], .saving-message[hidden] { display: none; }
.saving-message { padding: 12px 14px; border-radius: 12px; background: #FFF1D6; font-size: 16px; line-height: 1.5; }
#savingStatus[data-state="saved"] { background: #DDF0EC; }

/* A visible method, worked help and a calm pause between short questions. */
#play { gap: 12px; }
#play .prompt { min-height: 0; }
#play .scene { padding: 12px; border: 1px solid #D4E4ED; border-radius: 24px; background: var(--card); }
#play .scene .group:not(button) { padding: 0; background: transparent; box-shadow: none; }
#play .scene:has(> button.group) { padding: 0; border: 0; background: transparent; gap: 12px; }
#play .scene > button.group { width: calc(50% - 6px); padding: 10px; }
#play .choice { border: 2px solid var(--teal); box-shadow: 0 4px 0 #C7DDE7; }
#play .tera-wrap { justify-self: center; margin-top: 8px; }
.round-progress { font-size: 1rem; font-weight: 700; color: var(--teal-dark); text-align: center; }
.lesson-card { width: 100%; padding: 0; border: 0; background: transparent; font-size: 1.05rem; line-height: 1.4; }
.lesson-guide { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 12px; }
#play .lesson-guide .tera-wrap { margin: 0; }
#play .lesson-guide .tera-live.small { width: 76px; height: 76px; }
.lesson-copy { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 16px; background: #E2F2F0; border-radius: 16px; }
.lesson-copy > p { flex: 1 1 200px; }
.lesson-copy > button { min-height: 48px; padding: 8px 12px; white-space: nowrap; }
.lesson-card button:disabled { opacity: .6; cursor: default; }
#workedHelp { margin-top: 12px; padding: 16px; background: #FFF0CB; border-radius: 16px; }
.lesson-stage { font-size: 1.125rem; font-weight: 800; color: var(--teal-dark); margin-bottom: 6px; }
#helpSteps:not(:empty) { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#guidedTry { margin-top: 12px; }
.speech-caption { width: 100%; max-width: 560px; margin: 12px auto 0; padding: 12px 16px; border-radius: 16px; background: var(--card); font-size: 1rem; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.lesson-copy .speech-caption { flex-basis: 100%; max-width: none; padding: 0; margin: 0; background: transparent; text-align: left; color: var(--teal-dark); font-weight: 800; }
@media (max-width: 420px) { .lesson-guide { grid-template-columns: 56px minmax(0, 1fr); gap: 8px; } #play .lesson-guide .tera-live.small { width: 56px; height: 56px; } .lesson-copy { padding: 10px 12px; } .lesson-copy > p { flex-basis: 100%; } }
.answer-reason { width: 100%; padding: 12px 16px; border-radius: 12px; background: #DDF0EC; font-size: 1.1rem; line-height: 1.4; text-align: center; }
#nextQuestion { min-width: 144px; justify-self: center; margin-top: 4px; }
.counted-object { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; background: #FFF1A8; }
.worked-word { display: inline-flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.worked-word span { display: inline-grid; place-items: center; min-width: 44px; min-height: 48px; padding: 4px 8px; border: 1.5px solid var(--teal); border-radius: 8px; background: #DDF0EC; color: var(--teal-dark); font-size: 1.6rem; font-weight: 800; }
#roundEnd { text-align: center; }
#roundEnd h1 { font-size: clamp(1.6rem, 6vw, 2rem); }
#roundEnd p { max-width: 38ch; font-size: 1.1rem; line-height: 1.4; }
@media (max-width: 600px) {
  #app { padding-top: 12px; }
  .tera-logo { width: 128px; }
  .journey-button img { width: 24px; height: 24px; }
  .foot { margin-top: 8px; }
  .foot-nav button { min-height: 48px; }
  #play { gap: 8px; }
  #play .home-btn, #play .hear-btn { width: 52px; height: 52px; }
  #play .prompt { font-size: 1.6rem; }
  #play .scene { min-height: 120px; }
  #play .group { min-height: 96px; }
  #play .choice { min-height: 72px; }
  #play .tera-wrap { margin-top: 0; }
  #play .tera-live.small { width: 64px; height: 64px; }
  .lesson-card { font-size: 1.125rem; }
  .lesson-card > button { min-height: 48px; padding: 8px; }
  .speech-caption { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
}

/* Write: trace a letter. A large pale letter, numbered start dots and arrows, then the child's own line. */
#play[data-game="trace"] .scene { flex-direction: column; flex-wrap: nowrap; min-height: 0; gap: 6px; }
#play[data-game="trace"] .choices { display: none; }
#play[data-game="trace"] .tera-live.small { width: 96px; height: 96px; }
#play[data-game="trace"] .tera-wrap { margin-top: 0; }
#play[data-game="trace"] { gap: 8px; }
#play[data-game="trace"] .lesson-card { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 12px; font-size: 1.125rem; }
#play[data-game="trace"] .lesson-card > button { justify-self: end; }
.trace-board { position: relative; width: min(100%, 380px); margin: 0 auto; overflow: hidden; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1.5px rgba(31,35,40,.85), 0 12px 22px -12px rgba(58,42,14,.35); }
.trace-svg { display: block; width: 100%; height: auto; max-height: max(250px, calc(100vh - 330px)); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.trace-lines line { stroke: #B9C6C9; stroke-width: .8; }
.trace-lines .trace-baseline { stroke: #8FA3A8; stroke-width: 1.1; }
.trace-lines .trace-dashed { stroke-dasharray: 3 3; }
.trace-outline path, .trace-fill path, .trace-guide path, .trace-ink-path, .trace-demo-path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.trace-outline path { stroke: var(--teal-dark); }
.trace-outline circle { fill: var(--teal-dark); }
.trace-fill path { stroke: #EAF6F4; }
.trace-fill circle { fill: #EAF6F4; }
.trace-guide path { stroke: var(--teal); stroke-width: 1.1; stroke-dasharray: 1.5 3.5; opacity: .6; }
.trace-ink-path { stroke: var(--teal); }
.trace-ink-dot { fill: var(--teal); }
.trace-demo-path { stroke: #F4B63F; stroke-width: 8.5; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.trace-pen { fill: #E8A317; stroke: var(--ink); stroke-width: 1.5; opacity: 0; }
.trace-arrow { fill: var(--ink); }
.trace-arrow.done { opacity: 0; }
.trace-live { fill: none; stroke: var(--teal); stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.trace-live.miss { stroke: #E3A58A; transition: opacity .4s; opacity: .5; }
.trace-start { opacity: .55; }
.trace-start.next { opacity: 1; }
.trace-start.done { opacity: 0; }
.trace-dot { fill: #D9534F; }
.trace-number { fill: #fff; font: 800 8.5px 'Jakarta', system-ui, sans-serif; pointer-events: none; }
.trace-ring { fill: none; stroke: #D9534F; stroke-width: 1.5; opacity: 0; }
.trace-start.next .trace-ring { opacity: 1; transform-box: fill-box; transform-origin: center; animation: trace-ring 1.1s ease-in-out infinite; }
@keyframes trace-ring { 50% { transform: scale(1.25); opacity: .55; } }
.trace-skip { position: absolute; right: 8px; bottom: 8px; min-width: 72px; min-height: 48px; padding: 6px 16px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); color: var(--ink); font: 700 1rem 'Jakarta', system-ui, sans-serif; cursor: pointer; }
.trace-hint { width: 100%; min-height: 2.8em; font-size: 1.1rem; line-height: 1.35; text-align: center; font-weight: 600; }
.trace-reward { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 76px; animation: trace-pop .5s ease-out 1; }
.trace-picture { width: 72px; height: 72px; object-fit: contain; }
.trace-caption { font-size: 1.35rem; font-weight: 800; color: var(--teal-dark); }
@keyframes trace-pop { 0% { transform: scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (orientation: landscape) and (max-height: 520px) {
  #play[data-game="trace"] .scene { align-items: center; }
  .trace-svg { max-height: 62vh; }
}
/* 18 Nov: activity screens fill the viewport. The stage grows into the free height, the answers sit
   low in thumb reach and Tera with the hint sits at the bottom like a companion. */
#play .scene .group[data-fit] { display: grid; grid-template-columns: repeat(var(--cols, 3), var(--obj, 64px)); grid-auto-rows: var(--obj, 64px); gap: 8px; place-content: center; }
#play .scene .group[data-fit] .obj { width: var(--obj, 64px); height: var(--obj, 64px); }
#play .take-away { display: grid; grid-template-columns: repeat(var(--cols, 3), var(--obj, 64px)); grid-auto-rows: var(--obj, 64px); gap: 10px; place-content: center; height: 100%; }
#play .take-away .take-object .obj { width: var(--obj, 64px); height: var(--obj, 64px); }
#play .ten-frames { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; width: 100%; height: 100%; }
#play .ten-frames[data-side="true"] { flex-direction: row; }
#play .ten-frame { grid-template-columns: repeat(5, var(--cell, 48px)); grid-auto-rows: var(--cell, 48px); gap: 6px; }
#play .ten-cell { min-height: 0; width: var(--cell, 48px); height: var(--cell, 48px); border-radius: 8px; }
#play .ten-cell .obj { width: 86%; height: 86%; }
#play .word-picture { width: var(--pic, 128px); height: var(--pic, 128px); }
#play .trace-board { width: var(--board, min(100%, 380px)); max-width: 100%; }
#play .trace-svg { max-height: none; }
#play .choice { min-height: clamp(76px, 10dvh, 116px); font-size: clamp(2.5rem, 5.2dvh, 3.6rem); line-height: 1.1; }
#play .lesson-card, #play[data-game="trace"] .lesson-card { font-size: 1.25rem; line-height: 1.35; }
#play .lesson-copy > button, #play .lesson-card button { font-size: 1.25rem; min-height: 52px; }
#play .lesson-guide { grid-template-columns: clamp(80px, 11dvh, 140px) minmax(0, 1fr); gap: 12px; }
#play .lesson-guide .tera-live.small, #play[data-game="trace"] .lesson-guide .tera-live.small { width: clamp(80px, 11dvh, 140px); height: clamp(80px, 11dvh, 140px); }
#play .trace-hint { font-size: 1.25rem; min-height: 0; }
#play .answer-reason { font-size: 1.25rem; }
#play .round-progress { font-size: 1.125rem; }
#play .listen { font-size: 1.25rem; min-height: 56px; }
@media (orientation: portrait), (min-height: 521px) {
  body.in-play #app { padding-bottom: 12px; }
  #play:not([hidden]) { min-height: calc(100dvh - 32px); }
  #play .scene { flex: 1 1 0; min-height: 180px; align-items: stretch; align-content: stretch; }
  #play .scene:has(> .word-picture), #play[data-game="trace"] .scene { flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center; }
  #play .scene > .group, #play .scene > .ten-frames, #play .scene > .take-away { align-self: stretch; }
  #play .scene > .plus { align-self: center; }
  #play .lesson-card { margin-top: auto; }
}
@media (max-width: 420px) {
  #play .lesson-guide { grid-template-columns: 80px minmax(0, 1fr); gap: 8px; }
  #play .lesson-guide .tera-live.small, #play[data-game="trace"] .lesson-guide .tera-live.small { width: 80px; height: 80px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* Phone on its side: stage on the left, question, answers and Tera on the right. */
  body.in-play #app { padding-top: 8px; padding-bottom: 8px; }
  #play:not([hidden]) { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-auto-flow: row dense; align-items: start; gap: 8px 16px; padding-top: 0; }
  #play .bar { grid-column: 1 / -1; }
  #play .scene { grid-column: 1; grid-row: 2 / span 5; height: calc(100dvh - 92px); min-height: 0; align-items: stretch; }
  #play .scene:has(> .word-picture), #play[data-game="trace"] .scene { flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center; }
  #play .prompt, #play .choices, #play .lesson-card, #play .answer-reason, #play #nextQuestion, #play .turn-badge, #play .reward-note { grid-column: 2; }
  #play .choice { min-height: 64px; font-size: 2.2rem; }
  #play .choices { grid-template-columns: repeat(3, 1fr); }
  #play .lesson-guide { grid-template-columns: 64px minmax(0, 1fr); }
  #play .lesson-guide .tera-wrap { display: block; }
  #play .lesson-guide .tera-live.small, #play[data-game="trace"] .lesson-guide .tera-live.small { width: 64px; height: 64px; }
  #play .lesson-card { font-size: 1.125rem; }
}

/* 18 Nov: short screens fill the height too, with the main picture growing and the action low. */
#learners:not([hidden]), #partners:not([hidden]), #roundEnd:not([hidden]), #pass:not([hidden]), #rest:not([hidden]), #book:not([hidden]) { min-height: calc(100dvh - 88px); }
#learners .learner-cards, #partners .learner-cards { flex: 1 1 auto; grid-auto-rows: minmax(122px, 1fr); align-content: stretch; }
#learners .learner-card, #partners .learner-card { justify-content: center; font-size: clamp(2rem, 5dvh, 3.4rem); }
#learners .learner-card svg, #partners .learner-card svg { width: clamp(58px, 14dvh, 160px); height: clamp(58px, 14dvh, 160px); }
#learners .picker-help { font-size: 1.25rem; }
@media (orientation: portrait) { #learners .learner-cards, #partners .learner-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#roundEnd:not([hidden]), #pass:not([hidden]) { justify-content: center; }
#roundEnd .tera-live.small, #pass .tera-live.small { width: clamp(130px, 34dvh, 380px); height: clamp(130px, 34dvh, 380px); }
#roundEnd h1 { font-size: clamp(2rem, 5dvh, 3rem); }
#roundEnd p, #pass p { font-size: 1.25rem; }
#roundEnd #roundHome, #pass .journey-button { min-height: 64px; width: min(100%, 420px); margin-top: auto; font-size: 1.25rem; }
#pass .pass-mark { width: clamp(110px, 18dvh, 200px); height: clamp(110px, 18dvh, 200px); }
#rest:not([hidden]) { justify-content: center; }
#rest #teraRest { width: clamp(190px, 45dvh, 460px); height: clamp(190px, 45dvh, 460px); }
#rest .prompt { font-size: clamp(1.5rem, 4dvh, 2.4rem); }
/* Stickers: the grid takes the free height; small notes stay readable. */
.book-progress, .book-note { font-size: 1rem; }
#book .book-note { margin-top: auto; }
/* Grown-up text never drops below 16px. */
dialog .small, dialog small, dialog code, dialog li, #terms p, #privacy p { font-size: max(18px, 1.125rem); }
dialog a { display: inline-block; min-height: 44px; padding-block: 10px; }
#adult .small, #adult p, #adult li { font-size: max(18px, 1.125rem); }
/* Setup: the card fills the screen and Start sits low, in reach. */
body.in-setup #app { padding-bottom: 16px; }
#setup .setup-react-screen { min-height: calc(100dvh - 40px); gap: 48px; }
#setup .setup-card.setup-react-card { flex: 1 1 auto; display: flex; flex-direction: column; font-size: clamp(1rem, 1.7dvh, 1.25rem); }
#setup .setup-react-card .setup-react-content { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-evenly; }
#setup .setup-react-card .setup-react-controls { margin-top: 12px; }
#setup .setup-react-controls #setupGo { min-height: 60px; font-size: 1.25rem; }
@media (min-width: 700px) and (orientation: portrait) { #setup .setup-card.setup-react-card { max-width: 680px; } }
dialog .storage-details, dialog .storage-details summary, dialog .storage-details p, dialog .storage-details code { font-size: max(18px, 1.125rem); }
/* Home and Bedtime reach the footer on tall screens; the last row sits low, in reach. */
#bedtime:not([hidden]) { min-height: calc(100dvh - 88px); }
#bedtime > .story-actions { margin-top: auto; }
#bedtime > [role="status"]:empty { position: absolute; }
@media (min-height: 900px) and (min-width: 600px) {
  #bedtime .story-choice-picture { height: clamp(124px, 14dvh, 220px); }
  #bedtime .story-words p { font-size: 1.45rem; }
}
.install-area { margin: 16px 0; padding: 14px 16px; border: 1px solid #D5DEE7; border-radius: 12px; background: #F6FAFC; }
.install-area h3 { margin: 0 0 6px; }
.install-area button { margin-top: 8px; min-height: 48px; }

/* Home and its compact alternative share the same activities and focus order. */
#home:not([hidden]) {
  --menu-gap: clamp(12px, 2vw, 24px);
  max-width: 1000px;
  gap: clamp(14px, 2.8vh, 28px);
}
#home .app-identity { border: 0; padding: 0; }
#viewToggle { border-radius: 99px; padding-inline: 18px; }
.adventure-welcome {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 32px);
  width: 100%;
}
.adventure-welcome .journey-top {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.adventure-welcome h1 { font-size: clamp(1.75rem, 4.5vw, 3.25rem); letter-spacing: -.04em; }
#home .daily-sun { color: #425e68; font-size: 1.125rem; }
#home .map-captain { order: -1; flex: none; }
.map-captain .tera-live {
  width: clamp(82px, 11vw, 132px);
  height: auto;
  aspect-ratio: 1;
}
.island-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--menu-gap);
  width: 100%;
}
.island-map:not(.simple-list):has(.numbers-island.single-game) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
}
.island-group { min-width: 0; }
.island-group h2 { margin-bottom: 9px; font-size: 1.2rem; letter-spacing: -.015em; }
.island-group.visited h2 { color: var(--teal-dark); }
.island-group .tiles { gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(132px, 100%), 1fr)); }
.island-group .tile {
  --tile-fill: #eaf3f5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: clamp(124px, 18vh, 168px);
  padding: 12px 9px;
  border: 1px solid rgba(29, 58, 65, .11);
  border-radius: 22px;
  background: var(--tile-fill);
  box-shadow: 0 3px 0 rgba(29, 58, 65, .14);
  color: var(--ink);
  font-size: clamp(1.15rem, 1.7vw, 1.45rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.numbers-island .tile { --tile-fill: #ffeadc; }
.words-island .tile { --tile-fill: #dff2eb; }
.tile[data-game="trace"] { --tile-fill: #fff2ce; }
.island-group .tile .ico { display: flex; justify-content: center; align-items: center; height: clamp(64px, 10vh, 94px); max-width: 100%; }
.island-group .tile .activity-art { width: auto; height: 100%; object-fit: contain; }
.island-group .tile .ico svg { width: 76px; height: 45px; max-width: 100%; margin: 0; }
.island-group .tile .ico-abc { font-size: 2.25rem; }
.apple-trio img { width: clamp(21px, 3.4vw, 43px); height: auto; }
.apple-trio img:nth-child(2) { transform: translateY(-14%); }
.island-hint { margin-top: 9px; color: #415e69; font-size: 1rem; font-weight: 500; line-height: 1.4; }
#home .stars { margin-inline-start: auto; color: #825600; font-size: 1.2rem; letter-spacing: 1px; min-height: 0; }
#home .stars:empty { display: none; }
.journey-tools { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.journey-tools img { width: 32px; height: 32px; }

.bedtime-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(104px, 33%);
  gap: clamp(10px, 2vw, 22px);
  align-items: center;
  overflow: hidden;
  width: 100%;
  min-height: clamp(92px, 13vh, 126px);
  padding: 0 0 0 clamp(10px, 2vw, 22px);
  border: 1px solid #bccfce;
  border-radius: 20px;
  background: #f5f5e9;
  box-shadow: 0 3px 0 #d2e0dd;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.bedtime-entry > img:first-child { width: clamp(48px, 7vw, 80px); height: auto; }
.bedtime-entry strong, .bedtime-entry small { display: block; }
.bedtime-entry strong { font-size: clamp(1.25rem, 2.4vw, 1.8rem); }
.bedtime-entry small { margin-top: 4px; font-size: 1rem; line-height: 1.4; font-weight: 500; }
.bedtime-scene { display: block; align-self: stretch; width: 100%; height: 0; min-height: 100%; object-fit: cover; object-position: 55% 45%; }
.simple-list .tiles { display: flex; flex-direction: column; }
.simple-list .tile { flex-direction: row; justify-content: flex-start; min-height: 64px; gap: 12px; padding: 6px 16px; border-radius: 14px; box-shadow: none; font-size: 1.125rem; text-align: left; }
.simple-list .tile .ico { width: 64px; height: 46px; flex: none; }
.simple-list .apple-trio img { width: 20px; }
.simple-list .tile .ico svg { height: 38px; }
@media (hover: hover) {
  .island-group .tile:hover, .bedtime-entry:hover { border-color: #45766d; }
}
@media (max-width: 680px) {
  .island-map, .island-map:not(.simple-list):has(.numbers-island.single-game) { grid-template-columns: 1fr; }
  .island-group .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .single-game .tiles { grid-template-columns: 1fr; }
  .island-map:not(.simple-list) .single-game .tile { flex-direction: row; gap: 16px; min-height: 76px; }
  .island-map:not(.simple-list) .single-game .ico { height: 46px; }
  .island-group .tile { min-height: 100px; }
  .island-group .tile .ico { height: 52px; }
  .simple-list .tile { min-height: 56px; }
  .simple-list .tile .ico { height: 40px; }
  .island-hint { margin-top: 6px; }
  .bedtime-entry { grid-template-columns: minmax(0, 1fr) 32%; padding-left: 16px; }
  .bedtime-entry > img:first-child { display: none; }
  .bedtime-entry > span { padding-block: 9px; }
  .adventure-welcome .journey-top { gap: 2px; }
}
@media (max-height: 560px) and (min-width: 681px) {
  #home:not([hidden]) { gap: 12px; }
  .map-captain .tera-live { width: 64px; }
  .adventure-welcome h1 { font-size: 1.8rem; }
  .island-group .tile { min-height: 92px; }
  .island-group .tile .ico { height: 44px; }
  .simple-list .tile { min-height: 54px; }
  .bedtime-entry { min-height: 72px; }
}
#app:has(#home:not([hidden])) .foot-nav button { min-height: 48px; }

/* Phone readability pass, 20 November 2026: no line a child or grown-up reads is under 18px,
   and every control is at least 48px tall. */
.island-hint, .daily-sun, .bedtime-entry small, .journey-button, .quiet-button, .tile, .picker-help,
.book-progress, .book-note, #pass p, .round-progress, .lesson-card, .pair-status, .turn-badge, .reward-note,
.player-badge, #playerHoldHint, .learner-card small, .speech-caption, #changePlayer,
dialog, dialog .small, .small, .storage-details, .practice-recent, .practice-review summary,
.practice-suggestion h4, .practice-skill-list h4, .pack-status, .saving-notice p, .saving-message, #packReviewContent { font-size: 1.125rem; }
dialog button { font-size: 1.125rem; }
.foot-nav button { min-height: 48px; font-size: 1.125rem; }
.setup-row select, #gate2A, #learnerCount { min-height: 48px; font-size: 1.125rem; }
#app #setup .setup-card.setup-react-card { font-size: 1.125rem; }

/* Thai helper language: system Thai fonts only (no downloads), with room for stacked marks. */
:lang(th) { font-family: 'Jakarta', system-ui, -apple-system, 'Sukhumvit Set', 'Thonburi', 'Noto Sans Thai', 'Noto Sans Thai UI', 'Leelawadee UI', 'Leelawadee', Tahoma, sans-serif; line-height: 1.6; }
.th-help { display: block; margin-top: 2px; font-size: 1.125rem; font-weight: 500; line-height: 1.6; color: #476475; letter-spacing: 0; }
.th-help[hidden] { display: none; }
p.th-help { width: 100%; margin: 0; text-align: center; }
.lesson-copy p.th-help { text-align: left; }
.journey-top h1 .th-help, .island-group h2 .th-help { font-size: 1.125rem; }
.tile .th-help { margin-top: 0; }
.helper-summary { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: #DDF0EC; font-size: 1.125rem; line-height: 1.6; color: #173448; }
.helper-summary[hidden] { display: none; }
#setup .helper-summary { width: 100%; max-width: 560px; margin: 0 auto 44px; }
.trace-skip { font-size: 1.125rem; }
.pack-review summary { min-height: 48px; }
#adultContact a { display: inline-block; min-height: 48px; padding-block: 12px; }
