/* Bé Đánh Vần — web prototype. One theme: warm paper notebook (from DanhVan/Core/Theme.swift). */

@font-face { font-family: "Nunito"; src: url("../assets/fonts/Nunito-Variable.woff2") format("woff2"); font-weight: 200 1000; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../assets/fonts/Andika-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("../assets/fonts/Andika-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Playpen Sans"; src: url("../assets/fonts/PlaypenSans-Variable.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }
@font-face { font-family: "Be Vietnam Pro"; src: url("../assets/fonts/BeVietnamPro-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Be Vietnam Pro"; src: url("../assets/fonts/BeVietnamPro-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lexend"; src: url("../assets/fonts/Lexend-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Mali"; src: url("../assets/fonts/Mali-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mali"; src: url("../assets/fonts/Mali-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Quicksand"; src: url("../assets/fonts/Quicksand-Variable.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Baloo 2"; src: url("../assets/fonts/Baloo2-Variable.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Patrick Hand"; src: url("../assets/fonts/PatrickHand-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Itim"; src: url("../assets/fonts/Itim-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Sriracha"; src: url("../assets/fonts/Sriracha-Regular.woff2") format("woff2"); font-display: swap; }

:root {
  /* Base palette */
  --ink: #2B2D42;
  --ink-soft: #6B6F80;
  --paper: #FFF8EC;
  --card: #FFFFFF;
  --good: #2BB673;
  --bad: #F0616D;
  --accent: #FF9F1C;
  --star: #FFC233;
  --lvc: var(--accent);   /* colour of the current level; screens override it */

  /* Level colours 1–7, 99 */
  --lv1: #FF7A59; --lv2: #F6B826; --lv3: #2BB673; --lv4: #3D9BFF;
  --lv5: #8B6CF6; --lv6: #FF6FA8; --lv7: #16B8B0; --lv99: #FF8A3D;

  /* Spelling parts — default set "Xanh biển – Đỏ mận"; overridden by settings (data-colors on <html>) */
  --onset: #3A64A0;
  --rhyme: #A8384F;
  --tone: #2C7F57;
  --blend: #6E55A8;
  --word: #B86E12;

  /* Type */
  --font-ui: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --font-read: "Andika", "Nunito", sans-serif;
  --read-scale: 1;

  /* Shape */
  --r-sm: 14px; --r-md: 20px; --r-lg: 28px; --r-xl: 36px;
  --gutter: clamp(16px, 3.2vw, 36px);
  --maxw: 1180px;

  /* Touch targets */
  --tap: 56px;          /* minimum for children's controls */
  --tap-lg: 68px;

  color-scheme: light;
}
html[data-colors="orange"] { --onset: #2D5F9A; --rhyme: #B0531A; --tone: #2C7F57; --blend: #6E55A8; --word: #9A4471; }
html[data-colors="violet"] { --onset: #2B6A8F; --rhyme: #7D4BA8; --tone: #2C7F57; --blend: #B0661A; --word: #A4466E; }
html[data-colormode="mono"] { --onset: var(--ink); --rhyme: var(--ink); --tone: var(--ink); }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 4px solid color-mix(in srgb, var(--accent) 70%, white); outline-offset: 3px; }
img { display: block; }
a.chunky, a.cardbtn, a.modetab { text-decoration: none; }
a.cardbtn { color: inherit; }
[hidden] { display: none !important; }
.read { font-family: var(--font-read); }
.muted { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Background: paper + faint scattered letters ---------- */
#bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(900px 700px at 0 0, color-mix(in srgb, var(--tint, var(--accent)) 18%, transparent), transparent 70%),
    radial-gradient(800px 600px at 100% 100%, color-mix(in srgb, var(--tone) 8%, transparent), transparent 70%),
    var(--paper);
}
#bg span { position: absolute; font-weight: 900; color: var(--ink); opacity: .035; user-select: none; }

/* ---------- Layout ---------- */
.screen { max-width: var(--maxw); margin: 0 auto; padding: calc(env(safe-area-inset-top) + 20px) var(--gutter) calc(env(safe-area-inset-bottom) + 40px); animation: enter .28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
/* The title keeps at least 180 px; a button beside it (.topbar-action) moves to its own row rather than squeezing it. */
.topbar .title { flex: 1 1 180px; min-width: 0; }
@media (max-width: 600px) { .topbar .topbar-action { flex: 1 1 100%; } }
.topbar h1 { margin: 0; font-size: clamp(26px, 3.4vw, 38px); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; }
.topbar .topbar-pic { flex: none; width: clamp(44px, 7vw, 64px); height: clamp(44px, 7vw, 64px); object-fit: contain; }
.topbar p { margin: 4px 0 0; font-size: clamp(15px, 1.6vw, 20px); font-weight: 600; color: var(--ink-soft); }
.section-title { font-size: clamp(22px, 2.6vw, 30px); font-weight: 900; margin: 34px 0 16px; }
.grid { display: grid; gap: clamp(16px, 2vw, 24px); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid.extras { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.grid.lessons { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.center { display: flex; flex-direction: column; align-items: center; text-align: center; }
.spacer { flex: 1; }

/* ---------- Buttons ---------- */
/* Chunky: coloured slab on a darker base that presses down. */
.chunky {
  --c: var(--accent); --fg: #fff; --depth: 6px; --rad: 22px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 22px; border-radius: var(--rad);
  background: linear-gradient(to bottom, rgb(255 255 255 / .22), transparent 50%), var(--c);
  color: var(--fg); font-weight: 800; font-size: 19px;
  box-shadow: 0 var(--depth) 0 color-mix(in srgb, var(--c) 75%, black);
  margin-bottom: var(--depth);
  transition: transform .12s cubic-bezier(.3,1.6,.6,1), box-shadow .12s;
  user-select: none;
}
.chunky:active:not(:disabled), .chunky.pressed { transform: translateY(var(--depth)); box-shadow: 0 0 0 color-mix(in srgb, var(--c) 75%, black); }
.chunky:disabled { opacity: .45; }
.chunky.white { --c: #fff; --fg: var(--ink); box-shadow: 0 var(--depth) 0 #DCD6CB; }
.chunky.white:active:not(:disabled) { box-shadow: 0 0 0 #DCD6CB; }
.chunky.soft { --fg: var(--ink-soft); }
.chunky.good { --c: var(--good); }
.chunky.bad { --c: var(--bad); }
.chunky.big { min-height: 76px; font-size: 22px; --rad: 24px; --depth: 7px; padding: 0 28px; }
.chunky.round { width: 72px; min-height: 72px; padding: 0; border-radius: 50%; font-size: 26px; }
/* Line icons (ui.js SPEAKER): about the size an emoji had in the same text, in the text's colour. */
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.chunky.icon { width: 64px; min-height: 64px; padding: 0; --rad: 20px; --depth: 5px; font-size: 26px; }
.chunky.back { width: 64px; min-height: 64px; padding: 0; --rad: 20px; --depth: 5px; flex: none; }
.chunky.back svg { width: 26px; height: 26px; }

/* Card button: white face on a soft tinted base. */
.cardbtn {
  --c: var(--accent);
  display: flex; align-items: center; gap: 18px; width: 100%; text-align: left;
  padding: 20px; border-radius: var(--r-lg); background: var(--card);
  box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 35%, transparent);
  margin-bottom: 7px; transition: transform .14s cubic-bezier(.3,1.6,.6,1), box-shadow .14s;
}
.cardbtn:active { transform: translateY(7px); box-shadow: 0 0 0 transparent; }
.cardbtn h3 { margin: 0; font-size: clamp(20px, 2.2vw, 26px); font-weight: 900; }
.cardbtn p { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: var(--ink-soft); }
.cardbtn .chev { margin-left: auto; color: var(--c); font-size: 26px; font-weight: 900; }

.bubble { --c: var(--accent); flex: none; display: grid; place-items: center; border-radius: 50%;
  width: var(--s, 62px); height: var(--s, 62px);
  background: color-mix(in srgb, var(--c) 14%, white); border: 3px solid color-mix(in srgb, var(--c) 25%, white); }
.bubble img, .bubble .emoji { width: 72%; height: 72%; object-fit: contain; }
.emoji { display: grid; place-items: center; line-height: 1; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; font-weight: 800; font-size: 15px; }

.stars { display: inline-flex; gap: 3px; font-size: var(--s, 20px); line-height: 1; }
.stars .on { color: var(--star); }
.stars .off { color: color-mix(in srgb, var(--ink-soft) 35%, transparent); }

/* ---------- Mascot ---------- */
.mascot { display: flex; align-items: flex-start; gap: 10px; }
.mascot .owl { flex: none; width: var(--s, 92px); height: var(--s, 92px); border-radius: 50%; background: #fff;
  border: 4px solid color-mix(in srgb, var(--accent) 40%, white); display: grid; place-items: center;
  box-shadow: 0 5px 18px color-mix(in srgb, var(--accent) 25%, transparent); animation: bob 3.2s ease-in-out infinite; cursor: pointer; }
.mascot .owl img { width: 80%; }
.mascot .say { background: #fff; border-radius: 20px; padding: 12px 18px; font-weight: 800; font-size: clamp(17px, 2vw, 22px);
  box-shadow: 0 4px 16px rgb(0 0 0 / .08); animation: pop .3s cubic-bezier(.3,1.6,.6,1); }
@keyframes bob { 0%,100% { transform: translateY(5px) rotate(4deg); } 50% { transform: translateY(-5px) rotate(-4deg); } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- Home ---------- */
.home-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.home-head .hello { flex: 1; min-width: 200px; }
.home-head h1 { margin: 0; font-size: clamp(30px, 4.4vw, 46px); font-weight: 900; line-height: 1.05; }
.home-head p { margin: 6px 0 0; font-size: clamp(16px, 2vw, 22px); font-weight: 700; color: var(--ink-soft); }
.home-head .actions { display: flex; gap: 12px; }
.dot-alert { position: absolute; top: -4px; right: -4px; width: 15px; height: 15px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }
.continue { margin-top: 26px; }
.continue .play { margin-left: auto; flex: none; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 24px; background: var(--c); }
.continue .t { font-family: var(--font-read); font-size: clamp(24px, 3vw, 34px); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
@media (max-width: 600px) { .continue { gap: 12px; padding: 14px; } .continue .stars { display: none; } .continue .bubble { --s: 52px !important; } .continue .play { width: 48px; height: 48px; font-size: 20px; } }

.levelcard { --rad: 32px; --depth: 9px; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 8px;
  padding: 22px 24px; min-height: 220px; font-size: inherit; }
.levelcard .top { display: flex; justify-content: space-between; align-items: flex-start; }
.levelcard .top img { width: 72px; height: 72px; filter: drop-shadow(0 3px 4px rgb(0 0 0 / .15)); }
.levelcard .tag { background: rgb(255 255 255 / .25); }
.levelcard h3 { margin: auto 0 0; font-size: clamp(26px, 2.8vw, 32px); font-weight: 900; }
.levelcard .sub { font-size: 17px; font-weight: 700; opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 16px; margin-top: 4px; }
.progress .bar { flex: 1; height: 12px; border-radius: 99px; background: rgb(255 255 255 / .3); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: #fff; border-radius: 99px; }

/* ---------- Level ---------- */
.lessoncard { flex-direction: column; align-items: flex-start; gap: 6px; min-height: 196px; }
.lessoncard .head { display: flex; width: 100%; justify-content: space-between; align-items: center; }
.lessoncard .t { font-family: var(--font-read); font-size: clamp(24px, 2.6vw, 32px); font-weight: 700; margin-top: auto; line-height: 1.15; word-spacing: .3em; overflow-wrap: anywhere; max-width: 100%; }
.lessoncard .t.ui { font-family: var(--font-ui); font-weight: 900; }

/* ---------- Lesson ---------- */
.lesson-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 18px; }
.lesson-head h1 { margin: 0; min-width: 0; font-family: var(--font-read); font-size: clamp(24px, 3.2vw, 36px); font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.modetabs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; grid-column: 1 / -1; }
@media (min-width: 1180px) { .lesson-head { grid-template-columns: auto 1fr auto auto; } .modetabs { grid-column: auto; } }
.modetab { --c: var(--lvc); min-height: 54px; padding: 0 16px; font-size: 17px; --rad: 18px; --depth: 5px; }
.modetab:not(.on) { --c: #fff; --fg: var(--ink); box-shadow: 0 5px 0 #DCD6CB; }
.modetab .done { color: var(--star); }
.modetab.on .done { color: #fff; }
.stage-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; min-height: 52vh; }

/* Bottom tab bar for lesson modes on phones */
@media (max-width: 720px) {
  .lesson-head { grid-template-columns: auto 1fr; }
  .lesson-head .stars { display: none; }
  .modetabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; justify-content: space-around; flex-wrap: nowrap; gap: 4px;
    padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); background: rgb(255 255 255 / .94); backdrop-filter: blur(10px);
    box-shadow: 0 -2px 16px rgb(0 0 0 / .08); }
  .modetab { flex: 1; flex-direction: column; gap: 0; min-height: 56px; padding: 4px 2px; font-size: 12px; --depth: 0px; box-shadow: none !important; }
  .modetab:not(.on) { background: transparent; }
  .modetab .em { font-size: 22px; }
  .screen.has-tabbar { padding-bottom: calc(env(safe-area-inset-bottom) + 110px); }
}

/* ---------- Spelling stage ---------- */
.stage { position: relative; display: flex; justify-content: center; align-items: flex-end; flex-wrap: wrap; gap: 0 .32em;
  font-family: var(--font-read); font-weight: 700; line-height: 1.25; padding: .12em .2em;
  font-size: calc(var(--stage-size, 120px) * var(--read-scale)); }
.stage .syl { position: relative; display: inline-flex; transition: opacity .25s, transform .3s cubic-bezier(.3,1.6,.6,1); border-radius: .14em; }
.stage .syl.dim { opacity: .4; }
.stage .syl.reading { transform: scale(1.05); }
.stage .syl.reading::before { content: ""; position: absolute; inset: .1em -.06em; border-radius: .16em; z-index: -1;
  background: color-mix(in srgb, var(--word) 22%, transparent); transform-origin: left; animation: sweep .6s ease-out both; animation-delay: var(--delay, 0s); }
@keyframes sweep { from { transform: scaleX(0); } }
.stage .ch { display: inline-block; transition: opacity .25s, color .25s, transform .3s cubic-bezier(.3,1.6,.6,1); }
.stage .ch.on { color: var(--onset); }
.stage .ch.rh { color: var(--rhyme); }
html[data-colormode="letters"] .stage .ch.rh.cons { color: var(--onset); }
.stage .ch.faded { opacity: .3; }
.stage .ch.toneon { color: var(--tone); transform: scale(1.12); }
/* The tone step: the letter is redrawn by an SVG on its own baseline, faded, with only the mark lit (tonemark.js). */
.stage .ch.tone-lit-letter { position: relative; -webkit-text-fill-color: transparent; }
.stage .tone-lit { position: absolute; overflow: visible; pointer-events: none; animation: fade .25s; -webkit-text-fill-color: initial; }
.stage .tone-lit .faded-part { fill: currentColor; opacity: .3; }
.stage .tone-lit .lit-part { fill: var(--tone); }
.stage .baseline-probe { display: inline-block; }
.stage .frame { position: absolute; pointer-events: none; border-radius: calc(var(--stage-size, 120px) * .18 * var(--read-scale));
  border: max(3px, calc(var(--stage-size, 120px) * .035)) solid color-mix(in srgb, var(--fc) 80%, transparent);
  background: color-mix(in srgb, var(--fc) 14%, transparent); z-index: -1;
  transition: left .35s cubic-bezier(.3,1.3,.6,1), top .35s, width .35s cubic-bezier(.3,1.3,.6,1), height .35s, opacity .2s; }
.stage-caption { min-height: 34px; font-size: 20px; font-weight: 800; color: var(--fc, var(--ink-soft)); }
.stage-caption .tm { font-family: var(--font-read); font-size: 30px; }

.steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 900px; }
.step { --c: var(--ink-soft); font-family: var(--font-read); font-weight: 700; font-size: clamp(18px, 2vw, 22px);
  padding: 6px 14px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 8%, transparent);
  transition: transform .2s cubic-bezier(.3,1.6,.6,1), background .2s; }
.step.past { background: color-mix(in srgb, var(--c) 16%, transparent); }
.step.now { background: var(--c); color: #fff; transform: scale(1.12); }
.step.newsyl { margin-left: 14px; }

.controls { display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager { font-weight: 800; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.pager i { width: 12px; height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--ink-soft) 25%, transparent); transition: width .2s; }
.pager i.on { width: 30px; background: var(--lvc, var(--accent)); }

.focus-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-weight: 800; font-size: 18px; }
.focus-banner .chip { font-family: var(--font-read); font-size: 26px; padding: 2px 16px; border-radius: 999px; background: color-mix(in srgb, var(--rhyme) 12%, white); color: var(--rhyme); }
.focus-banner .chip.tone { background: color-mix(in srgb, var(--tone) 12%, white); color: var(--tone); }

.illus { width: clamp(90px, 14vw, 150px); height: clamp(90px, 14vw, 150px); object-fit: contain; }

.letter-big { font-family: var(--font-read); font-weight: 700; font-size: calc(clamp(110px, 18vw, 170px) * var(--read-scale)); line-height: 1; color: var(--onset); animation: pulse .5s ease-out; }
.letter-big.vowel { color: var(--rhyme); }
.letter-big small { font-size: .53em; opacity: .55; margin-left: .15em; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.letter-layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: center; width: 100%; }
@media (min-width: 900px) { .letter-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
.lettercard { background: #fff; border-radius: var(--r-xl); padding: 24px; box-shadow: 0 8px 0 color-mix(in srgb, var(--lvc) 30%, transparent); }

.sentence { display: flex; flex-wrap: wrap; justify-content: center; gap: .1em .28em; font-family: var(--font-read); font-weight: 700;
  font-size: calc(clamp(38px, 6vw, 64px) * var(--read-scale)); line-height: 1.35; }
.sentence .tok { padding: 0 .08em; border-radius: .18em; transition: background .2s, transform .2s; }
.sentence button.tok:hover { background: color-mix(in srgb, var(--word) 10%, transparent); }
.sentence .tok.sel { background: color-mix(in srgb, var(--onset) 14%, transparent); }
.sentence .tok.karaoke { background: color-mix(in srgb, var(--star) 45%, transparent); }
.sentence .tok.wrong { animation: shake .45s; }

/* ---------- Exercises ---------- */
.prompt-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.speaker { width: clamp(96px, 13vw, 130px); height: clamp(96px, 13vw, 130px); border-radius: 50%; font-size: clamp(38px, 5vw, 52px); --depth: 8px; }
.options { display: grid; gap: clamp(12px, 2vw, 22px); width: 100%; max-width: 980px; }
.options.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.options.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .options.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.option { position: relative; background: #fff; border-radius: var(--r-lg); min-height: clamp(110px, 18vh, 170px);
  display: grid; place-items: center; font-family: var(--font-read); font-weight: 700; font-size: calc(clamp(38px, 6vw, 76px) * var(--read-scale));
  box-shadow: 0 7px 0 #E4DDD0; margin-bottom: 7px; border: 4px solid transparent; transition: transform .15s, opacity .2s, border-color .2s; padding: 8px; }
.option > .ot { display: inline-block; max-width: 100%; text-align: center; }
.option.letter { font-size: calc(clamp(60px, 9vw, 110px) * var(--read-scale)); min-height: clamp(130px, 22vh, 190px); }
.option.long { font-size: calc(clamp(30px, 4.4vw, 56px) * var(--read-scale)); }
.option:active:not(:disabled) { transform: translateY(7px); box-shadow: 0 0 0 transparent; }
.option.right { border-color: var(--good); transform: scale(1.06); }
.option.right::after { content: "✓"; position: absolute; top: -14px; right: -14px; width: 40px; height: 40px; border-radius: 50%; background: var(--good); color: #fff; font: 900 24px/40px var(--font-ui); text-align: center; }
.option.wrong { opacity: .45; animation: shake .45s; }
.option:disabled { cursor: default; }
.locked .option:not(.wrong) { filter: saturate(.6); }
@keyframes shake { 0%,100% { transform: translateX(0); } 17% { transform: translateX(12px); } 33% { transform: translateX(-12px); } 50% { transform: translateX(10px); } 67% { transform: translateX(-8px); } 83% { transform: translateX(5px); } }
.shake { animation: shake .45s; }

/* Build */
.slots { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.slot { width: clamp(96px, 13vw, 150px); height: clamp(96px, 13vw, 150px); border-radius: 26px; border: 4px dashed color-mix(in srgb, var(--c, var(--ink-soft)) 55%, transparent);
  display: grid; place-items: center; font-family: var(--font-read); font-weight: 700; font-size: calc(clamp(40px, 5.4vw, 64px) * var(--read-scale)); color: var(--c); background: rgb(255 255 255 / .6); position: relative; }
.slot.filled { border-style: solid; background: #fff; }
.slot.over { background: color-mix(in srgb, var(--c) 12%, white); }
.slot .q { color: color-mix(in srgb, var(--ink-soft) 40%, transparent); }
.slot-label { text-align: center; font-weight: 800; color: var(--ink-soft); margin-top: 6px; font-size: 15px; }
.plus { font-size: 34px; font-weight: 900; color: var(--ink-soft); }
.bank { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.bank h4 { margin: 0; font-size: 16px; color: var(--ink-soft); font-weight: 800; }
.tiles { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.tile { --c: var(--ink); min-width: clamp(70px, 8vw, 90px); min-height: clamp(64px, 8vw, 84px); padding: 0 14px; border-radius: 20px; background: #fff;
  font-family: var(--font-read); font-weight: 700; font-size: calc(clamp(34px, 4.4vw, 56px) * var(--read-scale)); color: var(--c);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 25%, #E4DDD0); margin-bottom: 6px; touch-action: none; user-select: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; }
.tile small { font-family: var(--font-ui); font-size: 13px; font-weight: 800; color: var(--ink-soft); }
.tile.used { opacity: .25; }
.tile.dragging { position: fixed; z-index: 50; pointer-events: none; transform: scale(1.1); box-shadow: 0 14px 28px rgb(0 0 0 / .2); }
.banks { display: grid; gap: 18px; width: 100%; grid-template-columns: 1fr; }
@media (min-width: 900px) { .banks.three { grid-template-columns: 1fr 1.2fr 1.6fr; } }

/* Order train */
.train { display: flex; align-items: flex-end; gap: 8px; justify-content: center; flex-wrap: wrap; }
.wagon { width: clamp(70px, 10vw, 120px); height: clamp(80px, 11vw, 130px); border-radius: 22px; background: var(--c); color: #fff; position: relative;
  display: grid; place-items: center; font-family: var(--font-read); font-weight: 700; font-size: calc(clamp(40px, 6vw, 72px) * var(--read-scale)); margin-bottom: 18px; transition: transform .3s; }
.wagon::before, .wagon::after { content: ""; position: absolute; bottom: -14px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); }
.wagon::before { left: 16%; } .wagon::after { right: 16%; }
.wagon.gap { background: rgb(255 255 255 / .7); border: 4px dashed var(--ink-soft); color: var(--ink-soft); }
.wagon.lit { transform: translateY(-10px); }
.engine { font-size: clamp(60px, 9vw, 104px); margin-bottom: 8px; }

/* Read aloud */
.mic { width: 84px; height: 84px; border-radius: 50%; --c: var(--bad); font-size: 34px; position: relative; }
.mic.rec::before { content: ""; position: absolute; inset: calc(-1 * var(--lvl, 6px)); border-radius: 50%; background: color-mix(in srgb, var(--bad) 30%, transparent); z-index: -1; transition: inset .08s; }

/* ---------- Celebration ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgb(43 45 66 / .45); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.celebrate { position: relative; background: var(--paper); border-radius: 44px; padding: clamp(22px, 4vw, 40px); width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; text-align: center; animation: pop .35s cubic-bezier(.3,1.6,.6,1); }
.celebrate h2 { margin: 0; font-size: clamp(36px, 5vw, 50px); font-weight: 900; }
.celebrate .lead { margin: 6px 0 20px; font-size: 20px; font-weight: 700; color: var(--ink-soft); }
.rewards { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.reward { width: clamp(150px, 26vw, 210px); min-height: 190px; flex-direction: column; justify-content: center; text-align: center; gap: 8px; }
.reward img { width: 110px; height: 110px; object-fit: contain; }
.reward .w { font-family: var(--font-read); font-weight: 700; font-size: 28px; }
.reward .k { font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.reward.chosen { outline: 5px solid var(--good); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 41; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- Alphabet ---------- */
.abc { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(clamp(72px, 10vw, 112px), 1fr)); }
.abc .chunky { --c: #fff; --fg: var(--ink); --rad: 22px; min-height: clamp(70px, 10vw, 104px); font-family: var(--font-read); font-weight: 700; font-size: calc(clamp(28px, 3.6vw, 42px) * var(--read-scale)); padding: 0 10px; box-shadow: 0 6px 0 #DCD6CB; }
.abc .chunky.on { --c: var(--sel); --fg: #fff; box-shadow: 0 6px 0 color-mix(in srgb, var(--sel) 75%, black); }
.abc-layout { display: grid; gap: 24px; grid-template-columns: 1fr; }
.abc-example { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 14px 6px; border-radius: 26px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  background: color-mix(in srgb, var(--ex) 8%, white); border: 3px solid color-mix(in srgb, var(--ex) 22%, transparent);
  transition: transform .12s cubic-bezier(.3,1.6,.6,1), box-shadow .15s; }
.abc-example:active { transform: scale(.97); }
.abc-example:focus-visible { outline: 3px solid var(--ex); outline-offset: 3px; }
.abc-example-pic { width: clamp(100px, 15vw, 160px); height: clamp(100px, 15vw, 160px); object-fit: contain; }
.abc-example-pic.emoji { width: auto; height: auto; font-size: clamp(76px, 11vw, 120px); line-height: 1.2; }
.abc-example-word { width: 100%; }
/* Says "this makes a sound" to a child who can't read a label yet. */
.abc-example-say { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: #fff; color: var(--ex); box-shadow: 0 2px 6px rgb(0 0 0 / .08); pointer-events: none; }
.abc-example-say svg { width: 24px; height: 24px; }
/* The stage's caption ("phụ âm", "vần") still shows while spelling, just in less room than on a lesson stage. */
.abc-example .center { gap: 0 !important; }
.abc-example .stage-caption { min-height: 26px; font-size: 17px; }
@media (min-width: 1000px) { .abc-layout { grid-template-columns: 1.6fr 1fr; align-items: start; } .abc-detail { position: sticky; top: 20px; } }
.panel { background: #fff; border-radius: var(--r-xl); padding: 22px; box-shadow: 0 8px 0 rgb(0 0 0 / .05); }

/* ---------- Drill ---------- */
.drill-layout { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .drill-layout { grid-template-columns: 1.15fr 1fr; align-items: start; } .drill-detail { position: sticky; top: 20px; } }
.pop-close { display: none; }
/* Narrow screens (js/popover.js): the side panel floats next to the tapped item, with a little arrow pointing at it. */
.panel.pop { position: fixed; z-index: 30; width: min(460px, calc(100vw - 24px)); padding: 22px 18px 18px; overflow: visible;
  box-shadow: 0 14px 40px rgb(43 45 66 / .25), 0 0 0 1px rgb(43 45 66 / .05); }
.panel.pop.in { animation: popIn .22s cubic-bezier(.3,1.4,.6,1); }
@keyframes popIn { from { opacity: 0; } }   /* no scaling: the stage measures its letters while it appears */
.panel.pop::before { content: ""; position: absolute; left: var(--ax, 50%); top: -9px; width: 20px; height: 20px; background: #fff;
  transform: translateX(-50%) rotate(45deg); border-radius: 4px 0 0 0; box-shadow: -1px -1px 0 rgb(43 45 66 / .05); }
.panel.pop.above::before { top: auto; bottom: -9px; border-radius: 0 0 4px 0; box-shadow: 1px 1px 0 rgb(43 45 66 / .05); }
.panel.pop > :not(.pop-close) { max-width: 100%; }
.panel.pop .controls { gap: 10px; }
@media (max-width: 600px) { .panel.pop { padding: 18px 14px 14px; gap: 10px !important; } .panel.pop .stage-caption { min-height: 26px; font-size: 17px; } }
.panel.pop .pop-close { display: grid; place-items: center; position: absolute; top: 8px; right: 8px; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  background: var(--paper); color: var(--ink-soft); font-size: 18px; font-weight: 900; }
.panel.pop .pop-close:active { transform: scale(.92); }
.group { background: #fff; border-radius: var(--r-lg); padding: 18px 20px; box-shadow: 0 6px 0 color-mix(in srgb, var(--lv4) 25%, transparent); margin-bottom: 18px; }
.group h3 { margin: 0; font-size: 22px; font-weight: 900; }
.rhymechip { --c: #fff; --fg: var(--rhyme); --rad: 16px; --depth: 4px; min-height: 52px; min-width: 64px; padding: 0 14px; font-family: var(--font-read); font-weight: 700; font-size: calc(30px * var(--read-scale)); box-shadow: 0 4px 0 #E4DDD0; }
.rhymechip.on { --c: var(--rhyme); --fg: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--rhyme) 70%, black); }

/* ---------- Free play ---------- */
.freeinput { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 26px; padding: 8px 8px 8px 22px; box-shadow: 0 6px 0 #E4DDD0; max-width: 760px; margin: 0 auto; }
.freeinput input { flex: 1; min-width: 0; border: 0; outline: 0; font-family: var(--font-read); font-weight: 700; font-size: clamp(30px, 4.4vw, 46px); color: var(--ink); background: transparent; height: 68px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 16px 0; }
.suggest button { font-family: var(--font-read); font-weight: 700; font-size: 20px; padding: 6px 14px; border-radius: 999px; background: #fff; box-shadow: 0 3px 0 #E4DDD0; }

/* ---------- Garden (GardenView.swift): full-screen scenery, header and basket float over it ---------- */
.gscreen { position: fixed; inset: 0; overflow: hidden; background: #BCE4F5; user-select: none; -webkit-user-select: none; }
.gscroll { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.gscroll::-webkit-scrollbar { display: none; }
.gpage { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: start; overflow: hidden; }
.gpage canvas { position: absolute; inset: 0; }
.gterrain { position: absolute; left: 50%; top: 112px; transform: translateX(-50%); padding: 0 18px; height: 44px; line-height: 44px; border-radius: 22px;
  background: rgb(255 255 255 / .75); color: var(--ink-soft); font-weight: 900; font-size: 20px; white-space: nowrap; }
.gpet { position: absolute; transform: translate(-50%, -50%); }
.gbody { position: absolute; inset: 0; transform-origin: 50% 100%; display: block; will-change: transform; }
.gbody img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.gshadow { position: absolute; left: 50%; bottom: -3%; width: 62%; height: 10%; border-radius: 50%; background: rgb(0 0 0 / .14); transform: translateX(-50%); }
.gwant { position: absolute; left: 50%; top: calc(var(--size) * -0.45); transform: translateX(-50%); display: flex; padding: 7px 12px; border-radius: 999px; background: #fff;
  box-shadow: 0 2px 5px rgb(0 0 0 / .18); z-index: 2; transition: transform .2s cubic-bezier(.3,1.6,.6,1); }
.gwant:active { transform: translateX(-50%) scale(.92); }
.gwant img, .gwant .emoji { width: 34px; height: 34px; }
.ghearts { position: absolute; left: 50%; top: 50%; pointer-events: none; }
.ghearts i { position: absolute; font-style: normal; line-height: 1; text-shadow: 0 0 2px rgb(255 255 255 / .8); }
.gscroll.choosing .gbody img { filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 4px var(--good)); }
.gtop { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 16px; padding: calc(env(safe-area-inset-top) + 20px) 28px 0; pointer-events: none; }
.gtop > * { pointer-events: auto; }
.gtop h1 { margin: 0; min-width: 0; font-size: clamp(21px, 3.4vw, 34px); font-weight: 900; color: var(--ink); line-height: 1.1; }
.gcount { display: inline-flex; align-items: center; height: 60px; padding: 0 20px; border-radius: 30px; background: #fff; box-shadow: 0 3px 6px rgb(0 0 0 / .1); font-size: 28px; font-weight: 900; flex: none; }
.gtoast { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 96px); transform: translateX(-50%); max-width: calc(100% - 32px); z-index: 20;
  min-height: 64px; padding: 14px 26px; border-radius: 32px; background: var(--paper); box-shadow: 0 4px 10px rgb(0 0 0 / .18);
  font-size: clamp(18px, 2.4vw, 23px); font-weight: 900; color: var(--ink); text-align: center; display: flex; align-items: center; justify-content: center; }
.gtoast.in { animation: toastIn .4s cubic-bezier(.3,1.3,.6,1); }
@keyframes toastIn { from { transform: translate(-50%, -40px); opacity: 0; } }
.gempty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0 40px; pointer-events: none; }
/* It lands on the horizon, among fences and bushes, so it needs a backing to be read (as in GardenView.swift). */
.gempty-card { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 28px 36px; max-width: 640px; text-align: center;
  border-radius: 36px; background: rgb(255 255 255 / .85); box-shadow: 0 4px 10px rgb(0 0 0 / .1); }
.gempty img, .gempty .emoji { width: 130px; height: 130px; }
.gempty h2 { margin: 0; font-size: 30px; font-weight: 900; }
.gempty p { margin: 0; font-size: 22px; font-weight: 600; color: var(--ink-soft); }
.gbottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 28px calc(env(safe-area-inset-bottom) + 20px); pointer-events: none; }
.gbottom > * { pointer-events: auto; }
.gdots { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 12px; }
.gdot { position: relative; width: 12px; height: 12px; border-radius: 50%; background: rgb(43 45 66 / .22); }
.gdot.on { width: 16px; height: 16px; background: var(--ink); }
.gdot i { position: absolute; top: -4px; right: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.gtray { display: flex; align-items: flex-end; gap: 14px; }
.gfoods { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 14px; overflow-x: auto; padding: 12px 10px 4px 2px; scrollbar-width: none; }
.gfoods::-webkit-scrollbar { display: none; }
.gtray-empty { font-size: 21px; font-weight: 600; color: var(--ink-soft); padding-bottom: 6px; }
.gfood { position: relative; flex: none; width: 88px; height: 96px; border-radius: 22px; background: #fff; box-shadow: 0 3px 5px rgb(0 0 0 / .1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; color: var(--ink); touch-action: pan-x; transition: box-shadow .2s, opacity .2s; }
.gfood img, .gfood .emoji { width: 52px; height: 52px; }
.gfood b { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 15px; font-weight: 900; line-height: 26px; text-align: center; }
.gfood.lifted { opacity: .35; }
.gghost { position: fixed; z-index: 30; margin: 0; pointer-events: none; box-shadow: 0 3px 12px rgb(0 0 0 / .25); transition: none; }
.gfood.sel { box-shadow: 0 0 0 4px var(--good), 0 3px 5px rgb(0 0 0 / .1); }
.gforage { flex: none; --c: var(--accent); min-height: 68px; font-size: 23px; padding: 0 22px; }
.gforage img, .gforage .emoji { width: 34px; height: 34px; }
.gerrand { position: fixed; inset: 0; z-index: 45; overflow: auto; background:
  radial-gradient(900px 700px at 0 0, color-mix(in srgb, var(--tint) 18%, transparent), transparent 70%), var(--paper); }
.gerrand .gerrand-food { width: 66px; height: 66px; }
@media (max-width: 720px) {
  .gtop { padding: calc(env(safe-area-inset-top) + 12px) 16px 0; gap: 10px; }
  .gcount { height: 48px; font-size: 22px; padding: 0 14px; }
  .gbottom { padding: 0 12px calc(env(safe-area-inset-bottom) + 12px); }
  .gforage { min-height: 60px; font-size: 19px; padding: 0 14px; }
  .gterrain { top: 84px; font-size: 17px; height: 38px; line-height: 38px; }
  .gtoast { top: calc(env(safe-area-inset-top) + 76px); }
  .gempty { padding: 0 16px; }
  .gempty-card { padding: 24px 20px; }
}

/* ---------- Parent ---------- */
.gate { background: var(--paper); border-radius: 36px; padding: 28px; width: min(440px, 100%); text-align: center; animation: pop .3s cubic-bezier(.3,1.6,.6,1); }
.gate .q { font-size: 48px; font-weight: 900; margin: 10px 0; }
/* Web only: the iPad suggestion before Tập viết (screens/write.js ipadTip). */
.tip-card { background: var(--paper); border-radius: 36px; padding: 28px; width: min(460px, 100%); max-height: 100%; overflow: auto;
  text-align: center; animation: pop .3s cubic-bezier(.3,1.6,.6,1); }
.tip-card .tip-pic { display: block; width: 84px; height: 84px; margin: 0 auto; }
.tip-card h2 { margin: 6px 0 8px; font-size: 24px; font-weight: 900; }
.tip-card p { margin: 0 0 18px; font-weight: 700; line-height: 1.45; }
.tip-actions { display: grid; gap: 6px; }
.tip-actions .chunky { width: 100%; }
.tip-card .tip-note { margin: 8px 0 0; font-size: 14px; }
.gate .ans { font-size: 40px; font-weight: 900; min-height: 56px; letter-spacing: .1em; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.keypad .chunky { min-height: 62px; font-size: 28px; --rad: 18px; --depth: 5px; }

.parent { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .parent { grid-template-columns: 260px 1fr; } }
.side { display: flex; flex-direction: column; gap: 6px; }
.side a { display: flex; align-items: center; min-height: 56px; gap: 12px; padding: 12px 16px; border-radius: 16px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; }
.side a.on { background: #fff; box-shadow: 0 4px 0 #E4DDD0; }
.side .ico { width: 26px; height: 26px; vertical-align: 0; color: var(--ink-soft); }
.side a.on .ico { color: var(--ink); }
@media (max-width: 859px) { .parent.has-section .side { display: none; } .parent:not(.has-section) .pcontent { display: none; } }
@media (min-width: 860px) { .back-to-list { display: none !important; } }
.pcontent h2 { margin: 0 0 16px; font-size: 28px; font-weight: 900; }
.field { background: #fff; border-radius: 20px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 3px 0 #EDE6DA; }
.field > label, .field > .lbl { display: block; font-weight: 800; margin-bottom: 10px; }
/* A switch row is a label too; without this the rule above stacks it and glues the switch to the text. */
.field > label.toggle { display: flex; margin-bottom: 0; }
.field .hint { font-size: 14px; color: var(--ink-soft); font-weight: 600; margin-top: 6px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; background: var(--paper); padding: 5px; border-radius: 14px; }
.seg button { padding: 9px 14px; border-radius: 10px; font-weight: 800; font-size: 15px; color: var(--ink-soft); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgb(0 0 0 / .1); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; padding: 6px 0; }
.toggle input { width: 52px; height: 30px; appearance: none; border-radius: 99px; background: #DDD6CA; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgb(0 0 0 / .2); }
.toggle input:checked { background: var(--good); }
.toggle input:checked::after { left: 25px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.textin { width: 100%; font: 700 20px var(--font-ui); padding: 12px 14px; border-radius: 14px; border: 2px solid #E4DDD0; color: var(--ink); background: var(--paper); }
textarea.textin { display: block; resize: vertical; min-height: 140px; font-weight: 600; font-size: 18px; line-height: 1.45; }
.textin::placeholder { color: color-mix(in srgb, var(--ink-soft) 70%, transparent); font-weight: 600; }
.link { color: var(--accent); font-weight: 800; text-decoration: underline; }
.fb-result { margin: 14px 0 6px; padding: 12px 16px; border-radius: 16px; background: #fff; font-weight: 700; color: var(--ink-soft); }
.fb-result.ok { color: var(--good); }
.fontlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.fontlist button { text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--paper); border: 3px solid transparent; }
.fontlist button.on { border-color: var(--accent); background: #fff; }
.fontlist .sample { font-size: 30px; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 16px; border-radius: 14px;
  background: var(--paper); border: 3px solid transparent; font-weight: 800; font-size: 18px; text-align: left; }
.choice .tick { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 3px solid #DDD6CA; color: transparent; font-size: 16px; font-weight: 900; flex: none; }
.choice.on { border-color: var(--good); background: #fff; }
.choice.on .tick { background: var(--good); border-color: var(--good); color: #fff; }
.field-actions { margin-top: 10px; }
.field-actions .chunky { min-height: 48px; font-size: 16px; }
.colorsets { display: grid; gap: 10px; }
.colorsets button { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--paper); border: 3px solid transparent; font-weight: 800; text-align: left; }
.colorsets button.on { border-color: var(--accent); background: #fff; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.stat { background: #fff; border-radius: 20px; padding: 16px; text-align: center; box-shadow: 0 3px 0 #EDE6DA; }
.stat b { display: block; font-size: 34px; font-weight: 900; }
.stat span { font-weight: 700; color: var(--ink-soft); }
.danger { color: var(--bad); }
.legal-points { margin: 0; padding-left: 1.2em; font-weight: 600; line-height: 1.5; }
.legal-points li { margin: 6px 0; }
.legal-links { display: grid; gap: 10px; }
.legal-link { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: 12px 48px 12px 16px; border-radius: 16px;
  background: var(--paper); color: var(--ink); text-decoration: none; }
.legal-link b { font-size: 18px; font-weight: 900; }
.legal-link span { font-size: 15px; font-weight: 600; color: var(--ink-soft); }
.legal-link i { position: absolute; right: 16px; top: 50%; translate: 0 -50%; font-style: normal; font-weight: 900; color: var(--accent); font-size: 20px; }

/* ---------- Voice review (prototype only) ---------- */
.rv-tools { display: flex; flex-direction: column; gap: 10px; }
.rv-list { display: flex; flex-direction: column; gap: 6px; }
.rv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border-radius: 14px; padding: 8px 12px; box-shadow: 0 2px 0 #EDE6DA; }
.rv-row.now { box-shadow: 0 0 0 3px var(--accent); }
.rv-text { flex: 1; min-width: 180px; font-size: 22px; font-weight: 700; }
.rv-g { font-size: 12px; font-weight: 800; color: var(--ink-soft); background: var(--paper); border-radius: 8px; padding: 2px 8px; }
.rv-voice { display: inline-flex; border-radius: 10px; overflow: hidden; border: 2px solid #E4DDD0; }
.rv-voice.bad { border-color: var(--bad); }
.rv-voice button { padding: 6px 10px; font-weight: 800; font-size: 14px; background: #fff; }
.rv-voice button:disabled { color: #bbb; }
.rv-voice .rv-flag { border-left: 2px solid #E4DDD0; color: var(--ink-soft); }
.rv-voice.bad .rv-flag { background: var(--bad); color: #fff; }

/* ---------- First-visit setup (js/onboarding.js) ----------
   One screen, no page scroll: the card fills what the viewport leaves and each step fits inside it. Steps slide
   in the way the parent is going; the sky changes colour with the step (--obc, registered so it can ease). */
@property --obc { syntax: "<color>"; inherits: true; initial-value: #FF7A59; }
.ob { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; overflow: hidden; background: var(--paper);
  transition: --obc .6s ease; animation: fade .35s ease-out; }
.ob.closing { animation: obClose .38s ease-in forwards; }
@keyframes obClose { to { opacity: 0; transform: scale(1.03); } }

.ob-sky { position: absolute; inset: 0; pointer-events: none; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--obc) 26%, var(--paper)), var(--paper) 55%, color-mix(in srgb, var(--obc) 14%, var(--paper))); }
.ob-blob { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(40px); opacity: .5; animation: obDrift 18s ease-in-out infinite alternate; }
.ob-blob.a { background: color-mix(in srgb, var(--obc) 55%, transparent); left: -20vmax; top: -24vmax; }
.ob-blob.b { background: color-mix(in srgb, var(--lv2) 40%, transparent); right: -26vmax; top: 20vh; animation-duration: 23s; animation-delay: -6s; }
.ob-blob.c { background: color-mix(in srgb, var(--lv4) 30%, transparent); left: 10vw; bottom: -36vmax; animation-duration: 27s; animation-delay: -12s; }
@keyframes obDrift { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, 4vmax) scale(1.15); } }
.ob-letters span { position: absolute; bottom: -90px; font-family: var(--font-read); font-weight: 700; opacity: .22;
  animation: obFloat linear infinite; will-change: transform; }
@keyframes obFloat { from { transform: translateY(0) rotate(var(--r)); } to { transform: translateY(calc(-100vh - 180px)) rotate(calc(var(--r) * -1)); } }
.ob-pets img { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 6px); width: clamp(84px, 9vw, 120px); translate: -50% 0;
  animation: obBob 3.4s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes obBob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
/* The friends sit beside the card, so only where there is room beside it. */
@media (max-width: 1000px), (max-height: 640px) { .ob-pets { display: none; } }

.ob-frame { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 14px); gap: 10px; }
.ob-top { width: min(680px, 100%); display: flex; align-items: center; gap: 12px; }
.ob-back { flex: none; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: #fff; color: var(--ink);
  box-shadow: 0 4px 0 #DCD6CB; }
.ob-back svg { width: 22px; height: 22px; }
.ob-back:active { transform: translateY(4px); box-shadow: none; }
.ob-progress { flex: 1; display: flex; gap: 6px; }
.ob-progress i { flex: 1; height: 12px; border-radius: 99px; background: rgb(255 255 255 / .7); overflow: hidden; box-shadow: inset 0 1px 2px rgb(0 0 0 / .08); }
.ob-progress b { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--obc); transition: width .45s cubic-bezier(.3,1.3,.6,1); }
.ob-progress i.on b { width: 100%; }
.ob-count { flex: none; min-width: 34px; font-weight: 900; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.ob-skip { flex: none; min-height: 48px; padding: 0 6px; font-weight: 800; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }

/* 780 px tall at most, shrinking to what a short screen leaves; on a tall one the bar and card sit centred together. */
.ob-card { position: relative; flex: 0 1 780px; min-height: 0; width: min(680px, 100%); border-radius: var(--r-xl);
  background: rgb(255 255 255 / .9); backdrop-filter: blur(10px); box-shadow: 0 8px 0 rgb(0 0 0 / .05), 0 24px 60px rgb(0 0 0 / .1); overflow: hidden; }
.ob-stage { position: absolute; inset: 0; }
.ob-step { position: absolute; inset: 0; display: flex; flex-direction: column; padding: clamp(18px, 3.4vh, 34px) clamp(18px, 4vw, 40px) clamp(16px, 3vh, 30px);
  overflow-y: auto; }
.ob-step.enter-fwd { animation: obInFwd .42s cubic-bezier(.2,.9,.3,1.1) both; }
.ob-step.enter-back { animation: obInBack .42s cubic-bezier(.2,.9,.3,1.1) both; }
.ob-step.leave-fwd { animation: obOutFwd .32s ease-in both; pointer-events: none; }
.ob-step.leave-back { animation: obOutBack .32s ease-in both; pointer-events: none; }
@keyframes obInFwd { from { opacity: 0; transform: translateX(60px); } }
@keyframes obInBack { from { opacity: 0; transform: translateX(-60px); } }
@keyframes obOutFwd { to { opacity: 0; transform: translateX(-60px); } }
@keyframes obOutBack { to { opacity: 0; transform: translateX(60px); } }

.ob-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: clamp(10px, 2vh, 18px); }
.ob-body h1 { margin: 0; font-size: clamp(27px, 4.4vw, 40px); font-weight: 900; line-height: 1.15; }
.ob-body h2 { margin: 0; font-size: clamp(25px, 3.8vw, 34px); font-weight: 900; line-height: 1.15; }
.ob-lead { margin: 0; max-width: 34em; font-size: clamp(17px, 2.1vw, 20px); font-weight: 600; line-height: 1.5; color: var(--ink-soft); }
.ob-lead b { color: var(--ink); }
.ob-note { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.ob-foot { flex: none; display: flex; justify-content: center; padding-top: clamp(10px, 2vh, 18px); }
.ob-foot .chunky { width: min(100%, 340px); }

.ob-hero { display: flex; align-items: flex-end; justify-content: center; gap: clamp(4px, 2vw, 18px); }
.ob-owl { display: grid; place-items: center; width: clamp(104px, 17vh, 150px); aspect-ratio: 1; border-radius: 50%; background: #fff;
  border: 5px solid color-mix(in srgb, var(--obc) 45%, white); box-shadow: 0 8px 24px color-mix(in srgb, var(--obc) 30%, transparent);
  animation: obBob 3.2s ease-in-out infinite; }
.ob-owl img, .ob-owl .emoji { width: 72%; font-size: 64px; }
.ob-owl.small { width: 64px; border-width: 3px; flex: none; animation-duration: 2.6s; }
.ob-pet { width: clamp(76px, 13vh, 112px); animation: obBob 3.4s ease-in-out infinite; animation-delay: var(--d, 0s); }

.ob-name { max-width: 420px; text-align: center; font-size: clamp(24px, 3.6vw, 30px); padding: 14px 18px; border-width: 3px; }
.ob-name:focus { outline: none; border-color: var(--obc); background: #fff; }
.ob-said { display: flex; align-items: center; gap: 12px; max-width: 460px; }
.ob-bubble { position: relative; padding: 12px 18px; border-radius: 20px; background: color-mix(in srgb, var(--obc) 12%, white);
  font-family: var(--font-read); font-size: clamp(19px, 2.6vw, 23px); font-weight: 700; text-align: left; line-height: 1.35; overflow-wrap: anywhere; }
.ob-bubble::before { content: ""; position: absolute; left: -8px; top: 50%; translate: 0 -50%; border: 9px solid transparent; border-left: 0;
  border-right-color: color-mix(in srgb, var(--obc) 12%, white); }

.ob-group { width: 100%; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ob-label { font-weight: 900; font-size: 17px; }
.ob-label span { font-weight: 700; color: var(--ink-soft); font-size: 15px; }
.ob-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ob-opt { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 14px; border-radius: 18px; background: var(--paper);
  border: 3px solid transparent; text-align: left; transition: border-color .2s, background .2s, transform .12s; }
.ob-opt:active { transform: scale(.97); }
.ob-opt b { font-size: 18px; font-weight: 900; }
.ob-opt .tick { margin-left: auto; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 3px solid #DDD6CA;
  color: transparent; font-size: 15px; font-weight: 900; flex: none; }
.ob-opt[aria-checked=true] { border-color: var(--obc); background: #fff; }
.ob-opt[aria-checked=true] .tick { background: var(--obc); border-color: var(--obc); color: #fff; }
.ob-optt { display: flex; flex-direction: column; min-width: 0; }
.ob-optt small { font-size: 14px; font-weight: 700; color: var(--ink-soft); line-height: 1.3; }
.ob-wave { flex: none; display: flex; align-items: center; gap: 3px; height: 24px; }
.ob-wave i { width: 4px; height: 10px; border-radius: 4px; background: var(--obc); }
.ob-opt.talking .ob-wave i { animation: obWave .7s ease-in-out infinite; }
.ob-opt.talking .ob-wave i:nth-child(2) { animation-delay: .15s; }
.ob-opt.talking .ob-wave i:nth-child(3) { animation-delay: .3s; }
@keyframes obWave { 50% { height: 24px; } }
.ob-example { width: 100%; min-height: 0; padding: 10px 6px 4px; border-radius: 20px; background: var(--paper); }
.ob-example .stage-caption { min-height: 26px; font-size: 17px; }
.ob-example .steps { gap: 6px; }

.ob-chip { display: inline-block; padding: 1px 10px; border-radius: 10px; background: var(--paper); color: var(--ink); font-weight: 800; white-space: nowrap; }
.ob-tips { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.ob-tips li { display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px; border-radius: 20px; background: var(--paper); }
.ob-tips b { display: block; font-size: 18px; font-weight: 900; margin-bottom: 2px; }
.ob-tips span:not(.read) { font-size: 16px; font-weight: 600; color: var(--ink-soft); line-height: 1.4; }
.ob-ic { flex: none; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: #fff; }
.ob-ic img, .ob-ic .emoji { width: 36px; font-size: 30px; }
.ob-swatches { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ob-swatches .read { font-size: 22px; font-weight: 700; color: var(--ink); background: #fff; border-radius: 10px; padding: 0 8px; line-height: 1.4; }
.ob-swatches i { width: 20px; height: 20px; border-radius: 50%; }

/* Short screens (a phone with the browser's bars, a laptop in a small window): tighten so the step still fits. */
@media (max-height: 720px) {
  .ob-opt { min-height: 52px; padding: 8px 12px; }
  .ob-body { gap: 10px; }
  .ob-tips li { padding: 10px 14px; }
  .ob-example { padding-top: 6px; }
}
/* A phone on its side is too short for any step as laid out: drop the pictures, shrink the type, and keep the
   step's button pinned to the bottom of the card so it is always in reach while the rest scrolls above it. */
@media (max-height: 500px) {
  .ob-frame { padding-top: calc(env(safe-area-inset-top) + 6px); padding-bottom: calc(env(safe-area-inset-bottom) + 8px); gap: 6px; }
  .ob-back { width: 40px; height: 40px; }
  .ob-skip { min-height: 40px; }
  .ob-hero, .ob-said .ob-owl { display: none; }
  .ob-step { padding: 14px 20px 0; }
  .ob-body { gap: 8px; justify-content: flex-start; }
  .ob-body h1 { font-size: 24px; }
  .ob-body h1 br { display: none; }
  .ob-body h2 { font-size: 22px; }
  .ob-lead { font-size: 16px; }
  .ob-foot { position: sticky; bottom: 0; padding: 8px 0 10px; background: linear-gradient(transparent, rgb(255 255 255 / .95) 30%); }
  .ob-foot .chunky.big { min-height: 52px; font-size: 18px; }
}
@media (max-width: 520px) {
  .ob-body h2 { font-size: 23px; }
  .ob-step { padding-left: 16px; padding-right: 16px; }
  .ob-group { gap: 6px; }
  .ob-label { font-size: 16px; }
  .ob-label span { font-size: 14px; }
  .ob-foot .chunky.big { min-height: 60px; }
  .ob-example .steps .step { font-size: 16px; padding: 4px 10px; }
  .ob-example .stage-caption { min-height: 22px; font-size: 15px; }
  .ob-swatches .read { font-size: 18px; padding: 0 6px; }
  .ob-swatches i { width: 16px; height: 16px; }
  .ob-swatches { gap: 6px; }
  .ob-skip { font-size: 15px; }
  .ob-opt { gap: 8px; padding: 8px 10px; }
  .ob-opt b { font-size: 17px; }
  .ob-optt small { font-size: 13px; }
  .ob-wave { display: none; }
  .ob-opt.talking { background: color-mix(in srgb, var(--obc) 10%, white); }
}

/* ---------- Tập viết (Screens/WritingView.swift, TracingView.swift) ---------- */
/* Letter tiles: 4 across on a phone, more as the screen widens; never narrower than a finger. */
.write-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 600px) { .write-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 900px) { .write-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.write-tile { --rad: 22px; flex-direction: column; gap: 0; min-height: clamp(76px, 10vw, 104px); padding: 4px 6px; }
.write-tile .wt-glyph { font-family: var(--font-read); font-weight: 700; color: var(--ic); line-height: 1.1;
  font-size: calc(clamp(34px, 4.4vw, 48px) * var(--read-scale)); }
.write-tile .wt-name { font-size: 15px; font-weight: 800; color: var(--ink-soft); }
.write-tile .wt-check { position: absolute; top: 6px; right: 8px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--good); color: #fff; font-size: 13px; font-weight: 900; }

/* The board: as big as the screen allows, leaving room for the title and the buttons under it. */
.write-screen { padding-bottom: calc(env(safe-area-inset-bottom) + 20px); }
.write-screen .topbar { margin-bottom: 12px; flex-wrap: nowrap; }
.write-stage { position: relative; display: flex; justify-content: center; }
.write-board { width: min(100%, 680px, calc((100svh - 250px) * var(--bw) / var(--bh))); min-width: min(100%, 300px); aspect-ratio: var(--bw) / var(--bh);
  background: #fff; border-radius: var(--r-xl); box-shadow: 0 8px 0 #E9E1D3, 0 18px 40px rgb(0 0 0 / .06); }
.trace-board { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.tb-lines line { stroke: #E3D5BE; stroke-width: .8; }
.tb-lines line.mid { stroke-dasharray: 3 3; }
.tb-lines line.base { stroke: #CDB99A; stroke-width: 1.1; }
.tb-ghost path { fill: none; stroke: #C9C3B8; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.tb-ghost circle { fill: #C9C3B8; }
.tb-tube-out path { fill: none; stroke: #E2D6C2; stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.tb-tube-out circle { fill: #E2D6C2; }
.tb-tube-in path { fill: none; stroke: #FFFCF6; stroke-width: 11.6; stroke-linecap: round; stroke-linejoin: round; }
.tb-tube-in circle { fill: #FFFCF6; }
.tb-ink path { fill: none; stroke: var(--ink-c); stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.tb-ink circle { fill: var(--ink-c); }
/* Tone marks are small: a thinner tube and ink keep a hook or a wave from filling in (TracingView.swift does the same). */
.trace-board.thin .tb-tube-out path { stroke-width: 12; }
.trace-board.thin .tb-tube-in path { stroke-width: 8.6; }
.trace-board.thin .tb-ink path { stroke-width: 8; }
.tb-dots { fill: none; stroke: #A79A86; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: .1 4.4; }
.tb-arrows polygon { fill: #A79A86; }
.tb-start circle { fill: var(--good); stroke: #fff; stroke-width: 1.6; }
.tb-start text { fill: #fff; font: 900 8px var(--font-ui); text-anchor: middle; pointer-events: none; }
.tb-start { transform-box: fill-box; transform-origin: center; animation: startPulse 1.6s ease-in-out infinite; }
.tb-start.flash { animation: startFlash .5s ease-in-out 3; }
@keyframes startPulse { 50% { transform: scale(1.15); } }
@keyframes startFlash { 50% { transform: scale(1.6); } }
.tb-pen { fill: var(--accent); stroke: #fff; stroke-width: 1.6; pointer-events: none; }
.write-screen .topbar p.done { color: var(--good); font-weight: 900; animation: pop .3s; }
.write-controls { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.write-controls .chunky.icon svg { width: 26px; height: 26px; }
.write-controls .chunky.pulse { animation: pulse 1s ease-in-out infinite; }
@media (max-width: 719px) {
  .write-board { width: 100%; }
  .write-controls { gap: 8px; flex-wrap: nowrap; }
  .write-controls .chunky.icon { width: 56px; }
  .write-controls .chunky:not(.icon) { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 16px; white-space: nowrap; }
}

/* ---------- Toast, welcome back, prototype tools ---------- */
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; font-weight: 800; padding: 12px 22px; border-radius: 18px; max-width: calc(100vw - 32px); animation: pop .25s; }
.start { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; text-align: center; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); }
.proto-fab { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 4px); z-index: 55; opacity: .85; padding: 8px 12px; border-radius: 12px; border: 2px dashed #9b8f7a; background: rgb(255 255 255 / .9); font: 800 13px var(--font-ui); color: #6b5f4a; }
.proto-panel { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 44px); z-index: 55; width: min(320px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 14px; border-radius: 16px; border: 2px dashed #9b8f7a; background: #fffdf8; font-size: 14px; box-shadow: 0 10px 30px rgb(0 0 0 / .15); }
.proto-panel h4 { margin: 8px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: #8a7e69; }
.proto-panel a, .proto-panel button { display: block; width: 100%; text-align: left; padding: 6px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 700; }
.proto-panel a:hover, .proto-panel button:hover { background: var(--paper); }

/* ---------- Hover (web only: iPad has no pointer to hover with) ----------
   Only for a real mouse or trackpad, so a tap on a phone or tablet doesn't leave a button stuck "hovered".
   A light lift and brighten, never information (SPEC §4). :not(:active) keeps the press-down effect in charge,
   and the states that already move things (picked, right/wrong, used, being dragged) are left alone. */
@media (hover: hover) and (pointer: fine) {
  .chunky:hover:not(:disabled):not(:active):not(.pressed) { transform: translateY(-2px); filter: brightness(1.05); }
  .chunky { transition: transform .12s cubic-bezier(.3,1.6,.6,1), box-shadow .12s, filter .15s; }
  .cardbtn:hover:not(:disabled):not(:active) { transform: translateY(-3px);
    box-shadow: 0 7px 0 color-mix(in srgb, var(--c) 35%, transparent), 0 14px 24px rgb(0 0 0 / .08); }
  .option:hover:not(:disabled):not(:active):not(.right):not(.wrong) { transform: translateY(-3px);
    box-shadow: 0 7px 0 #E4DDD0, 0 14px 24px rgb(0 0 0 / .08); }
  .tile:not(.used):not(.dragging) { transition: transform .12s; }
  .tile:hover:not(.used):not(.dragging):not(:active) { transform: translateY(-2px); }
  .gfood { transition: box-shadow .2s, opacity .2s, transform .12s; }
  .gfood:hover:not(.lifted):not(:active) { transform: translateY(-3px); box-shadow: 0 8px 16px rgb(0 0 0 / .14); }
  .gfood.sel:hover:not(.lifted):not(:active) { box-shadow: 0 0 0 4px var(--good), 0 8px 16px rgb(0 0 0 / .14); }
  .gwant:hover:not(:active) { transform: translateX(-50%) scale(1.08); }
  .gscroll:not(.choosing) .gbody:hover img { filter: brightness(1.06) drop-shadow(0 0 6px rgb(255 255 255 / .9)); }
  .gdot { transition: transform .12s; }
  .gdot:hover { transform: scale(1.25); }
  .mascot .owl:hover { filter: brightness(1.05); }
  .ob-opt:hover:not(:active) { background: #fff; box-shadow: 0 6px 16px rgb(0 0 0 / .07); }
  .ob-back:hover:not(:active) { transform: translateY(-2px); }
  .ob-skip:hover { color: var(--ink); }
  .legal-link:hover { background: #fff; box-shadow: 0 6px 16px rgb(0 0 0 / .07); }
  .write-tile:hover .wt-glyph { filter: brightness(1.1); }
  .abc-example:hover:not(:active) { transform: translateY(-2px); box-shadow: 0 10px 22px rgb(0 0 0 / .07); }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .chunky:hover, .cardbtn:hover, .option:hover, .tile:hover, .gfood:hover, .abc-example:hover { transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.tonemark { display: inline-block; vertical-align: -0.12em; }
.stage-caption { display: inline-flex; align-items: center; gap: 8px; }
.tile .tonemark { color: var(--tone); }
@media (max-width: 720px) {
  .chunky.big { min-height: 58px; font-size: 18px; padding: 0 18px; }
  .chunky.round { width: 58px; min-height: 58px; }
}
