:root, [data-theme=classic] {
  --bg: #f3f7ff;
  --card: #ffffff;
  --ink: #26314d;
  --muted: #7a85a3;
  --line: #e3e8f4;
  --brand: #4fb7ff;
  --go: #58cc02;
  --go-dark: #46a302;
  --bad: #ff4b4b;
  --bad-bg: #ffdfe0;
  --good-bg: #d7ffb8;
  --star: #ffc800;
  --purple: #7b4dff;
  --purple-dark: #5631c9;
  --brand-dark: #2e93d6;
  --good-line: #b8f28b;
  --bad-line: #ffc1c1;
  --bad-ink: #d33;
  --bad-dark: #c33;
  --star-dark: #e6a800;
  --meh: #c77700;
  --disabled: #d4d9e6;
  --off: #dde2ee;            /* empty stars */
  --track: #dfe5f2;          /* progress bar background */
  --done-bg: #fffbea;
  --done-line: #ffe59a;
  --slot: #c9d2e6;
  --hilite: #fff6c7;         /* story sentence being read */
  --soft: #e3f3ff;           /* tapped word, my chat bubble */
  --soft-line: #bfe3ff;
  /* letter tracing canvas */
  --trace-rule: #e4e9f5;
  --trace-guide: #d7deee;
  --trace-ink: #7b4dff;
  --radius: 22px;
  --shadow: 0 4px 0 rgba(38, 49, 77, .08);
  --head: 'Baloo 2', 'Andika', system-ui, sans-serif;
  --read: 'Andika', 'Comic Sans MS', system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--read);
  font-size: 18px;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  /* touch devices: no double-tap zoom, no long-press text selection or callout menus */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, select, textarea { -webkit-user-select: text; user-select: text; color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 1.15; }
.reading { font-family: var(--read); }
.hint { color: var(--muted); font-size: 16px; }
.center { text-align: center; }
.good { color: var(--go-dark); font-weight: 700; }
.meh { color: var(--meh); }

#app { min-height: 100%; }
.screen {
  max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: 16px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* ---------- buttons ---------- */
.btn {
  background: var(--brand); color: #fff; font-family: var(--head); font-weight: 800;
  font-size: 18px; padding: 10px 20px; border-radius: 16px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .18); transition: transform .08s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .18); }
.btn.big { font-size: 22px; padding: 14px 28px; }
.btn.go { background: var(--go); }
.btn.ghost { background: var(--card); color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn:disabled { background: var(--disabled); box-shadow: none; color: #fff; }
.round {
  width: 64px; height: 64px; border-radius: 50%; font-size: 30px;
  background: var(--brand); box-shadow: 0 4px 0 var(--brand-dark);
}
.round.slow { width: 52px; height: 52px; font-size: 24px; background: var(--card); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.round:active, .pulse { transform: scale(.92); }
.icon-btn { font-size: 24px; width: 44px; height: 44px; border-radius: 12px; }
.mini { font-size: 16px; padding: 4px 6px; border-radius: 10px; opacity: .75; flex: none; }
@media (hover: hover) { .mini:hover { opacity: 1; background: rgba(0, 0, 0, .05); } }

.row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.tools { display: flex; gap: 14px; justify-content: center; align-items: center; margin: 16px 0; flex-wrap: wrap; }

/* ---------- welcome ---------- */
.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.mascot { font-size: 110px; line-height: 1; }
.mascot.sm { font-size: 30px; vertical-align: middle; }
.bob { animation: bob 2.4s ease-in-out infinite; }
.speech-bubble {
  background: var(--card); border-radius: var(--radius); padding: 16px 22px; font-size: 24px;
  box-shadow: var(--shadow); border: 2px solid var(--line); position: relative;
}
.name-in {
  font-size: 26px; text-align: center; padding: 12px 16px; border-radius: 16px;
  border: 3px solid var(--line); width: min(320px, 100%); outline: none; background: var(--card);
}
.name-in:focus { border-color: var(--brand); }

/* ---------- home ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.topbar h1 { font-size: 26px; }
.hi { font-family: var(--head); font-size: 22px; }
.stats { display: flex; align-items: center; gap: 6px; }
.stat { background: var(--card); border-radius: 999px; padding: 4px 12px; font-weight: 700; box-shadow: var(--shadow); font-size: 16px; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.qbtn {
  background: var(--card); border-radius: 18px; padding: 10px 6px; font-family: var(--head); font-weight: 700;
  font-size: 15px; box-shadow: var(--shadow); border: 2px solid var(--line); display: flex; flex-direction: column; align-items: center;
}
.qbtn span { font-size: 28px; }
.qbtn b { color: var(--muted); font-size: 13px; }
.qbtn:disabled { opacity: .45; }

.units { display: flex; flex-direction: column; gap: 18px; }
.unit { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 2px solid var(--line); }
.unit.locked { opacity: .6; }
.u-head { background: var(--c); color: #fff; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.u-emo { font-size: 40px; background: rgba(255, 255, 255, .3); border-radius: 16px; width: 58px; height: 58px; display: grid; place-items: center; flex: none; }
.u-text { flex: 1; min-width: 0; }
.u-text h2 { font-size: 24px; text-shadow: 0 2px 0 rgba(0, 0, 0, .12); }
.u-text p { margin: 0; opacity: .95; font-size: 15px; }
.u-sticker { font-size: 30px; filter: grayscale(.3); }
.u-sticker.got { filter: none; animation: bob 2s infinite; }

.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 14px; }
.lesson-btn {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 8px;
  text-align: left; padding: 10px 12px; border-radius: 16px; background: var(--bg);
  border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); transition: transform .08s;
}
.lesson-btn:active { transform: translateY(2px); }
.lesson-btn .l-ico { grid-row: 1 / 4; font-size: 30px; align-self: center; }
.l-kind { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.l-title { font-family: var(--head); font-weight: 700; font-size: 16px; line-height: 1.15; }
.l-stars { color: var(--star); font-size: 16px; letter-spacing: 1px; }
.l-stars i { color: var(--off); font-style: normal; }
.lesson-btn.done { background: var(--done-bg); border-color: var(--done-line); box-shadow: 0 3px 0 var(--done-line); }
.lesson-btn.next { border-color: var(--c); box-shadow: 0 3px 0 var(--c); animation: glow 1.6s ease-in-out infinite; background: var(--card); }
.lesson-btn.locked { opacity: .55; }
.foot-note { margin: 24px 0 8px; }

/* ---------- player ---------- */
.player { display: flex; flex-direction: column; padding: 0; max-width: none; }
.p-top { width: 100%; max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 12px 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.p-title { display: none; }
.bar { flex: 1; height: 16px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--go); border-radius: 999px; transition: width .35s; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .1); }
.stage { flex: 1; padding: 4px 16px 140px; width: 100%; max-width: 640px; margin: 0 auto; }
.prompt { font-family: var(--head); font-weight: 800; font-size: 24px; margin: 6px 0 14px; text-align: center; }

.foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 2px solid var(--line);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.foot > * { max-width: 640px; }
.foot-msg { font-family: var(--head); font-weight: 800; font-size: 22px; }
.foot.good { background: var(--good-bg); border-color: var(--good-line); }
.foot.good .foot-msg { color: var(--go-dark); }
.foot.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.foot.bad .foot-msg { color: var(--bad-ink); }
.foot .next { margin-left: auto; }
@media (min-width: 680px) { .foot { padding-left: calc(50% - 304px); padding-right: calc(50% - 304px); } }

.card {
  background: var(--card); border-radius: var(--radius); border: 2px solid var(--line); box-shadow: var(--shadow);
  padding: 18px; text-align: center; position: relative;
}
.pic { font-size: 96px; line-height: 1.1; display: block; }
.pic.small { font-size: 60px; }
.pic.tiny { font-size: 32px; display: inline-block; }
.word { font-size: 44px; font-weight: 700; margin-top: 6px; }
.phrase { font-size: 28px; font-weight: 700; margin-top: 6px; line-height: 1.3; }
.ctx { color: var(--muted); margin-top: 10px; font-size: 17px; }
.ctx.big { font-size: 22px; color: var(--ink); }
.hl { color: var(--bad); }
.letter-big { font-size: 96px; font-weight: 700; line-height: 1; color: var(--purple); }
.letter-big span { margin-left: 18px; color: var(--brand); }

.th { margin-top: 10px; }
.th-btn { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--bg); border: 2px solid var(--line); color: var(--muted); }
.th-text { display: block; margin-top: 6px; color: var(--muted); font-size: 20px; font-family: system-ui, sans-serif; }
.th-text[hidden] { display: none; }

/* choices */
.choices { display: grid; gap: 12px; margin-top: 18px; }
.choices.pics { grid-template-columns: repeat(3, 1fr); }
.choices.letters { grid-template-columns: repeat(3, 1fr); }
.choices.texts { grid-template-columns: 1fr; }
.choice {
  background: var(--card); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 4px 0 var(--line);
  padding: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px;
  transition: transform .08s, border-color .15s, background .15s;
}
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.choices.pics .choice { aspect-ratio: 1; }
.choices.pics .pic { font-size: clamp(48px, 15vw, 76px); }
.choices.letters .choice span { font-size: 56px; font-weight: 700; }
.choices.texts .choice { justify-content: flex-start; text-align: left; font-size: 21px; }
.choices.texts .choice .reading { flex: 1; }
.choice.right { border-color: var(--go); background: var(--good-bg); box-shadow: 0 4px 0 var(--go); }
.choice.wrong { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 var(--bad); opacity: .6; }
.choice.faded { opacity: .4; }

/* tiles */
.tiles-box { margin-top: 16px; }
.slots {
  min-height: 72px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center;
  padding: 10px; border-bottom: 3px dashed var(--line); margin-bottom: 18px;
}
.slots.words { justify-content: flex-start; border: 3px dashed var(--line); border-radius: 18px; background: var(--card); }
.slot { width: 52px; height: 60px; border-radius: 14px; border: 3px dashed var(--slot); background: var(--card); }
.slot-hint { color: var(--muted); font-size: 16px; padding-left: 6px; }
.pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile {
  min-width: 52px; height: 60px; padding: 0 14px; border-radius: 14px; background: var(--card);
  border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); font-size: 26px; font-weight: 700; font-family: var(--read);
}
.slots.words .tile, .pool .tile { font-size: 22px; }
.tile.in { border-color: var(--brand); box-shadow: 0 4px 0 var(--brand-dark); }
.tile.used { visibility: hidden; }
.tile.bad { border-color: var(--bad); background: var(--bad-bg); box-shadow: 0 4px 0 var(--bad); }
.slots.solved .tile { border-color: var(--go); background: var(--good-bg); box-shadow: 0 4px 0 var(--go); }
.end-punct { font-size: 28px; font-weight: 700; }

/* mic */
.mic-box { text-align: center; margin-top: 8px; }
.mic-btn {
  width: 96px; height: 96px; border-radius: 50%; font-size: 44px; background: var(--purple); color: #fff;
  box-shadow: 0 5px 0 var(--purple-dark); transition: transform .1s;
}
.mic-btn.live { animation: live 1s ease-in-out infinite; background: var(--bad); box-shadow: 0 5px 0 var(--bad-dark); }
.heard { min-height: 28px; margin-top: 12px; font-size: 18px; }
.listening { color: var(--bad); font-weight: 700; }
.mic-extra { margin-top: 8px; }

/* trace */
.trace-wrap { display: flex; justify-content: center; }
canvas.trace { background: var(--card); border-radius: 24px; border: 3px solid var(--line); touch-action: none; box-shadow: var(--shadow); }
.trace-msg { text-align: center; min-height: 24px; }

/* story */
.story { text-align: left; }
.story h2 { font-size: 26px; margin-bottom: 10px; text-align: center; }
.sent { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; transition: background .2s; }
.sent.now { background: var(--hilite); }
.sent p { margin: 0; flex: 1; font-size: 23px; line-height: 1.4; }
.s-pic { font-size: 34px; flex: none; }
.w { border-radius: 6px; cursor: pointer; }
.w.pulse { background: var(--soft); }
@media (hover: hover) { .w:hover { background: var(--soft); } }

/* dialogue */
.scene { text-align: center; color: var(--muted); font-weight: 700; margin-bottom: 10px; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; align-items: flex-end; gap: 8px; max-width: 90%; }
.msg.me { flex-direction: row-reverse; margin-left: auto; }
.av { font-size: 38px; flex: none; }
.bub { background: var(--card); border: 2px solid var(--line); border-radius: 20px 20px 20px 6px; padding: 8px 12px; font-size: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.bub small { width: 100%; color: var(--muted); font-size: 13px; font-weight: 700; }
.msg.me .bub { background: var(--soft); border-color: var(--soft-line); border-radius: 20px 20px 6px 20px; }
.d-choices { margin-top: 18px; text-align: center; }
.d-choices .choices { margin-top: 8px; }
.d-choices .next-line { margin-top: 12px; }

/* finish */
.finish { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; overflow: hidden; position: relative; }
.finish h1 { font-size: 36px; }
.big-stars { font-size: 64px; color: var(--off); }
.big-stars span.on { color: var(--star); display: inline-block; animation: popin .5s both; text-shadow: 0 4px 0 var(--star-dark); }
.gain { font-family: var(--head); font-weight: 800; font-size: 26px; margin: 0; color: var(--star-dark); }
.new-sticker { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: var(--radius); padding: 14px 20px; border: 3px solid var(--star); }
.new-sticker span { font-size: 64px; }
.new-sticker p { margin: 0; text-align: left; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -40px; font-style: normal; font-size: 26px; animation: fall linear forwards; }

/* sub pages */
.wgroup { margin-bottom: 20px; }
.wgroup h2 { font-size: 22px; color: var(--c); margin-bottom: 8px; }
.wlist { display: grid; gap: 8px; }
.witem { display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; text-align: left; font-size: 20px; flex-wrap: wrap; }
.witem small { color: var(--muted); font-family: system-ui, sans-serif; margin-left: auto; font-size: 15px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.sticker { background: var(--card); border-radius: var(--radius); border: 3px dashed var(--line); padding: 16px 10px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.sticker span { font-size: 56px; filter: grayscale(1); opacity: .4; }
.sticker.got { border: 3px solid var(--c); }
.sticker.got span { filter: none; opacity: 1; }
.sticker small { color: var(--muted); }
.settings .card { text-align: left; margin-bottom: 16px; }
.form label { display: block; margin-bottom: 14px; font-weight: 700; }
.form input[type=text], .form input:not([type]), .form select { display: block; width: 100%; margin-top: 6px; font: inherit; padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); }
.form input[type=range] { width: 100%; }
.form .sw { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.form .sw input { width: 22px; height: 22px; }
.form h3 { margin-bottom: 8px; }
.tips ul { margin: 0; padding-left: 20px; line-height: 1.6; }

/* animations */
.pop { animation: popin .35s both; }
.shake { animation: shake .4s; }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes glow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes live { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 380px) {
  .word { font-size: 36px; }
  .phrase { font-size: 24px; }
  .pic { font-size: 80px; }
  .lessons { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- learners ---------- */
.link { color: var(--brand); text-decoration: underline; font-size: 16px; padding: 8px; }
.corner { position: absolute; top: 16px; left: 16px; }
.welcome { position: relative; }
.avatars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 360px; }
.av-pick { font-size: 32px; width: 52px; height: 52px; border-radius: 50%; background: var(--card); border: 3px solid var(--line); }
.av-pick.on { border-color: var(--go); background: var(--good-bg); transform: scale(1.1); }
.picker { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.picker h1 { font-size: 30px; }
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; width: 100%; }
.kid {
  background: var(--card); border: 3px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 0 var(--line);
  padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 20px;
}
.kid:active { transform: translateY(3px); }
.kid small { color: var(--muted); font-size: 15px; }
.kid.add { border-style: dashed; color: var(--muted); }
.kid-av { font-size: 56px; line-height: 1; }
.kid-av.sm { font-size: 28px; vertical-align: middle; }
.hi.switch { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; }
.hi.switch:active { background: var(--card); }

/* ---------- my style ---------- */
.style-screen .prompt { margin-top: 18px; }
.style-screen .avatars { margin: 0 auto; max-width: 560px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.theme-card {
  background: var(--bg); color: var(--ink); border: 3px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--line); padding: 16px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; font-family: var(--head); font-size: 20px;
}
.theme-card.on { border-color: var(--brand); box-shadow: 0 4px 0 var(--brand); }
.theme-card small { color: var(--muted); font-family: system-ui, sans-serif; font-size: 15px; }
.tc-mascot { font-size: 64px; line-height: 1; }
.tc-look { display: flex; gap: 6px; }
.tc-look i { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-style: normal; font-size: 24px; }
.tc-check { position: absolute; top: 8px; right: 12px; color: var(--brand); font-size: 24px; font-weight: 800; }

/* ---------- grown-ups ---------- */
.row.left { justify-content: flex-start; margin-top: 8px; }
.btn.sm { font-size: 15px; padding: 6px 10px; }
.err { color: var(--bad-ink); font-weight: 700; }
.learner { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.learner .ln { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.learner .ln small { color: var(--muted); font-size: 14px; }
.learner + .btn { margin-top: 12px; }
.fam-code { font-family: ui-monospace, monospace; font-size: 32px; font-weight: 700; letter-spacing: .12em; margin: 4px 0; color: var(--purple); }
.fam-forms { display: grid; gap: 14px; }
.fam-forms form { display: grid; gap: 8px; padding: 12px; background: var(--bg); border-radius: 16px; }
.fam-forms input { font: inherit; padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); width: 100%; }
.fam-forms .code { text-transform: uppercase; letter-spacing: .1em; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.tile-stat { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; }
.tile-stat b { font-family: var(--head); font-size: 28px; line-height: 1.1; }
.tile-stat b small { font-size: 16px; color: var(--muted); }
.tile-stat span { color: var(--muted); font-size: 15px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; }
.day { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; }
.day .col { height: 90px; width: 100%; max-width: 28px; display: flex; align-items: flex-end; }
.day .col i { display: block; width: 100%; background: var(--go); border-radius: 6px 6px 0 0; min-height: 2px; }
.day b { min-height: 16px; }
.day span { color: var(--muted); }
.uprog { display: grid; grid-template-columns: 1fr 90px 36px; gap: 8px; align-items: center; font-size: 15px; margin-bottom: 6px; }
.ubar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.ubar i { display: block; height: 100%; background: var(--c); }
.uprog small { color: var(--muted); text-align: right; }
.trouble { display: grid; gap: 6px; }
.trouble .witem { font-size: 17px; padding: 6px 10px; }
.log { width: 100%; border-collapse: collapse; font-size: 14px; }
.log td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.log td:first-child { color: var(--muted); white-space: nowrap; }
.log .st { color: var(--star); white-space: nowrap; }
.report .card { text-align: left; margin-bottom: 16px; }
.learner .ln small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.learner .l-report { padding: 6px 8px; }

/* ================= iPad / tablet ================= */
@media (min-width: 740px) {
  body { font-size: 20px; }
  .home, .sub { max-width: 1180px; }
  .picker, .welcome { max-width: 760px; }
  .units { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
  .quick { max-width: 640px; margin-left: auto; margin-right: auto; }
  .hi { font-size: 26px; }
  .stat { font-size: 18px; padding: 6px 14px; }
  .icon-btn { width: 52px; height: 52px; font-size: 28px; }
  .mascot { font-size: 140px; }
  .speech-bubble { font-size: 28px; }
  .av-pick { width: 64px; height: 64px; font-size: 40px; }
  .avatars { max-width: 480px; gap: 10px; }
  .kids { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .kid-av { font-size: 72px; }

  /* lesson player */
  .p-top { padding: 18px 24px; }
  .bar { height: 20px; }
  .stage { max-width: 780px; padding: 8px 24px 160px; }
  .prompt { font-size: 32px; margin: 10px 0 20px; }
  .card { padding: 26px; }
  .pic { font-size: 140px; }
  .pic.small { font-size: 84px; }
  .word { font-size: 64px; }
  .phrase { font-size: 36px; }
  .ctx { font-size: 20px; }
  .ctx.big { font-size: 26px; }
  .letter-big { font-size: 130px; }
  .round { width: 80px; height: 80px; font-size: 38px; }
  .round.slow { width: 64px; height: 64px; font-size: 30px; }
  .mini { font-size: 20px; padding: 6px 8px; }
  .choices { gap: 16px; }
  .choice { min-height: 80px; border-radius: 24px; }
  .choices.pics .pic { font-size: 110px; }
  .choices.letters .choice span { font-size: 80px; }
  .choices.texts .choice { font-size: 26px; padding: 18px 20px; }
  .tile { min-width: 64px; height: 76px; font-size: 34px; border-radius: 18px; }
  .slots.words .tile, .pool .tile { font-size: 28px; }
  .slot { width: 64px; height: 76px; border-radius: 18px; }
  .pool { gap: 14px; }
  .mic-btn { width: 128px; height: 128px; font-size: 60px; }
  .heard { font-size: 22px; }
  .sent p { font-size: 30px; }
  .s-pic { font-size: 44px; }
  .story h2 { font-size: 34px; }
  .bub { font-size: 26px; }
  .av { font-size: 50px; }
  .foot { padding-top: 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .foot-msg { font-size: 28px; }
  .btn { font-size: 21px; padding: 12px 24px; border-radius: 18px; }
  .btn.big { font-size: 26px; padding: 16px 36px; border-radius: 20px; }
  .finish h1 { font-size: 48px; }
  .big-stars { font-size: 96px; }

  /* grown-ups */
  .sub.settings, .sub.report { max-width: 860px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .fam-forms { grid-template-columns: 1fr 1fr; }
  .sticker-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .wlist { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 680px) and (max-width: 1099px) {
  .foot { padding-left: calc(50% - 370px); padding-right: calc(50% - 370px); }
}

/* iPad landscape: question on the left, answers on the right, so nothing needs scrolling */
@media (min-width: 1000px) and (orientation: landscape) {
  .foot { padding-left: calc(50% - 540px); padding-right: calc(50% - 540px); }
  .stage:not([data-type=story]):not([data-type=dialogue]):not([data-type=trace]) {
    max-width: 1140px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 48px; align-content: start;
  }
  .stage > .prompt { grid-column: 1 / -1; }
  .stage > .card, .stage > .tools { grid-column: 1; }
  .stage > .choices, .stage > .tiles-box, .stage > .mic-box {
    grid-column: 2; grid-row: 2 / span 3; align-self: center; margin-top: 0;
  }
  .stage[data-type=dialogue], .stage[data-type=story] { max-width: 900px; }
  .stage[data-type=trace] {
    display: grid; grid-template-columns: auto 260px; column-gap: 40px;
    justify-content: center; align-items: center; max-width: 1000px;
  }
  .stage[data-type=trace] > .prompt { grid-column: 1 / -1; }
  .stage[data-type=trace] > .trace-wrap { grid-column: 1; grid-row: 2 / span 2; }
  .stage[data-type=trace] > .tools { grid-column: 2; grid-row: 2; flex-direction: column; align-self: end; }
  .stage[data-type=trace] > .trace-msg { grid-column: 2; grid-row: 3; align-self: start; }
  .stage[data-type=trace] .tools .btn { width: 180px; }

  /* landscape is short: shrink the big pictures so everything fits above the footer */
  .prompt { margin: 4px 0 14px; }
  .card { padding: 18px; }
  .pic { font-size: 110px; }
  .letter-big { font-size: 100px; }
  .word { font-size: 56px; }
}
@media (min-width: 1000px) and (orientation: landscape) and (max-height: 800px) {
  .pic { font-size: 92px; }
  .letter-big { font-size: 84px; }
  .phrase { font-size: 30px; }
  .choices.pics .pic { font-size: 90px; }
  .p-top { padding: 12px 24px; }
}

/* Thai line under an English instruction */
.th-sub {
  display: block; font-family: system-ui, -apple-system, "Sukhumvit Set", "Noto Sans Thai", sans-serif;
  font-weight: 500; font-size: .68em; line-height: 1.3; color: var(--muted); margin-top: 2px; letter-spacing: 0;
}
.prompt .th-sub { font-size: .62em; font-weight: 600; margin-top: 4px; }
.btn .th-sub { color: inherit; opacity: .85; font-size: .62em; margin-top: 0; }
.foot-msg .th-sub { color: inherit; opacity: .8; }
.ctx .th-sub { font-size: .8em; margin-top: 4px; }
.story-name { color: var(--muted); font-weight: 700; font-size: 16px; margin-bottom: 6px; }
