/* Outfit (SIL Open Font License), self-hosted so the first offline start and slow connections use it too.
   One variable file per subset covers weights 300-700. */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/outfit-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/outfit-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --ink: #1d1a17;
  --accent: #2f68a8;
  --accent-soft: #dfe8f2;
  --good: #3f7d5a;
  --bad: #b04a3f;
  --shadow: 0 1px 2px rgba(40, 30, 20, .05), 0 6px 20px rgba(40, 30, 20, .06);
  --radius: 18px;
  --tabbar-h: 0px;
  color-scheme: light; --input: #fff; --k-digit: #13807a; --k-contraction: #2f68a8; --k-punct: #8a4fbf; --k-indicator: #94785e; --k-math: #b8407a; --lb-l: #2f68a8; --lb-b: #3f8a5c; --ctl-h: 40px; --bg: #f3efea; --surface: #fbf9f6; --surface-2: #ece6df; --line: #e2dad1; --dot-off: #d6cdc3; --muted: #857b72; --ink-2: #4a423c; --lb-off: #d6cdc3; --seg-bg: #e6dfd6; --dot-ring: #d6cdc3; --dot-fill: #e3dbd3; --seg-on: var(--surface);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark; --lb-l: #82acdf; --lb-b: #7dbb94;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px; line-height: 1.5; font-weight: 400;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 500; letter-spacing: -0.03em; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20; display: flex;
  padding: 12px max(16px, calc((100vw - 1120px) / 2)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid transparent;
}
.top.scrolled { border-bottom-color: var(--line); }
.brand { align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.logo { display: grid; grid-template-columns: repeat(2, 7px); grid-auto-flow: column; grid-template-rows: repeat(3, 7px); gap: 3px; padding: 5px 6px; background: var(--ink); border-radius: 8px; }
.logo i { width: 7px; height: 7px; border-radius: 50%; background: var(--bg); opacity: .25; }
.logo i:nth-child(1), .logo i:nth-child(2), .logo i:nth-child(5) { opacity: 1; }
.nav { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; }
.nav a { color: var(--ink-2); padding: 6px 14px; border-radius: 999px; font-size: .95rem; }
.nav a:hover { text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.icon-btn { border: 1px solid var(--line); background: var(--surface); width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; padding: 0; }
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-btn[hidden] { display: none; }

.tabbar { display: none; }
@media (max-width: 760px) {
  :root { --tabbar-h: 64px; }
  .nav { display: none; }
  #settingsBtn { margin-left: auto; }
  .tabbar {
    display: grid; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--accent); }
}

main { max-width: 1120px; margin: 0 auto; padding: 8px 16px 48px; outline: none; }
section { margin: 40px 0; }

/* ---------- braille cell ---------- */
.cell {
  --s: 10px; --on: var(--ink); --off: var(--dot-off);
  display: inline-grid; grid-template-columns: repeat(2, var(--s)); grid-template-rows: repeat(3, var(--s));
  grid-auto-flow: column; gap: var(--gap); vertical-align: middle;
}
.cell i { width: var(--s); height: var(--s); border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 1.5px var(--off); transition: background .2s, box-shadow .2s, transform .2s; }
.cell.ghost i { box-shadow: none; }
.cell i.on { background: var(--on); box-shadow: none; }
.cell.xs { --s: 4px; --gap: 2px; padding: 0; }

.cell.sm { --s: 7px; }
.cell.md { --s: 12px; }
.cell.lg { --s: 22px; }
.cell.xl { --s: 34px; }
.cell .num { display: none; }
.cell.numbered i { position: relative; }
.cell.numbered i::after { content: attr(data-n); position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--s) * .45); color: var(--muted); font-weight: 500; }
.cell.numbered i.on::after { color: var(--bg); }
.braille-line { display: flex; flex-wrap: wrap; gap: 4px 2px; align-items: flex-end; row-gap: 0; }
.bw { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.bw .lbl { font-size: .72rem; color: var(--muted); min-height: 1.1em; line-height: 1.1; white-space: nowrap; }
.bw.kind-contraction .lbl { color: var(--accent); }
.bw.kind-indicator .lbl { color: var(--muted); font-style: italic; }
.bw.space { width: 14px; }
.bword { display: inline-flex; gap: 2px; align-items: flex-end; flex-wrap: nowrap; }
.plate .bword { gap: 0; }
.bw-break { flex-basis: 100%; height: 0; }

/* ---------- common UI ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 10px 18px; border-radius: 999px; cursor: pointer; font-weight: 500; transition: transform .1s, background .2s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 85%, var(--bg)); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.ghost { background: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .92rem; white-space: nowrap; }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 999px; cursor: pointer; color: var(--ink-2); font-size: .92rem; }
.seg button.on { color: var(--ink); box-shadow: var(--shadow); }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: .92rem; color: var(--ink-2); user-select: none; }
.toggle input[type=checkbox] { appearance: none; width: 36px; height: 22px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.toggle input[type=checkbox]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.toggle input[type=checkbox]:checked { background: var(--accent); }
.toggle input[type=checkbox]:checked::after { transform: translateX(14px); }
kbd { font-family: inherit; font-size: .8em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; padding: 32px 0 8px; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 34ch; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 12px; padding-top: 16px; }

}
.decade-head { display: flex; gap: 10px; flex-wrap: wrap; }
.decade-head h3 { margin: 0; }
.decade-head span { color: var(--muted); font-size: .92rem; }
.alpha { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
@media (max-width: 760px) { .alpha { grid-template-columns: repeat(5, 1fr); } }
.letter {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 10px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: transform .15s, border-color .2s, box-shadow .2s; color: var(--ink);
}
.letter:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.letter .cell { --s: 11px; }
.letter b { font-weight: 500; font-size: 1.15rem; line-height: 1; }
.letter .hint { font-size: .68rem; color: var(--muted); }

.letter.empty { visibility: hidden; }
.letter .cell i.added, .crow .cell i.added { --on: var(--accent); }

.cell-anatomy { display: flex; gap: 20px; align-items: center; }
.cell-anatomy .cell { --s: 26px; }

.go { display: block; color: var(--ink); transition: transform .15s, border-color .2s; }
.go:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.go h3 { display: flex; align-items: center; gap: 10px; }
.go p { color: var(--ink-2); margin: 0; font-size: .95rem; }

/* ---------- sheet (detail) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(20, 16, 12, .35); z-index: 40; animation: fade .2s; }
.sheet {
  position: fixed; z-index: 41; overflow: auto; background: var(--surface); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet .close { right: 14px; top: 14px; border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; color: var(--ink-2); }
.detail-top { display: flex; gap: 24px; align-items: center; margin-bottom: 16px; }
.detail-top .big { font-size: 4rem; font-weight: 500; line-height: 1; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 16px; font-size: .95rem; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }

/* ---------- practice ---------- */
.practice-wrap { grid-template-columns: 1fr; gap: 18px; }
.stage { display: flex; flex-direction: column; align-items: center; text-align: center; }
.stage .prompt-cells { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(4px, 2vw, 10px); }
.stage .target { font-weight: 500; line-height: 1; }
.choices { display: grid; gap: 10px; width: 100%; max-width: 520px; }
.choices.words { grid-template-columns: repeat(2, 1fr); }
.choice { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 14px 6px; font-size: 1.5rem; font-weight: 500; cursor: pointer; transition: background .2s, border-color .2s, transform .1s; color: var(--ink); }
.choices.words .choice { font-size: 1.1rem; }
.choice:hover { border-color: var(--accent); }
.choice.right { background: color-mix(in srgb, var(--good) 18%, var(--surface)); border-color: var(--good); }
.choice.wrong { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-color: var(--bad); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.dotpad { display: grid; grid-auto-flow: column; background: var(--bg); border: 1px solid var(--line); }
.dotpad button { border-radius: 50%; border: 2px solid var(--dot-off); background: transparent; cursor: pointer; color: var(--muted); transition: background .15s, transform .1s, border-color .15s; }
.dotpad button:active { opacity: .8; }
.dotpad button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.dotpad.right button.on { background: var(--good); border-color: var(--good); }
.dotpad.wrong { animation: shake .3s; }
.feedback { min-height: 1.5em; font-weight: 500; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.stats { display: flex; gap: 18px; font-size: .9rem; color: var(--muted); }
.stats b { color: var(--ink); font-weight: 600; }
.mastery { display: flex; flex-wrap: wrap; gap: 4px; }
.mastery span { height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .78rem; background: var(--surface-2); color: var(--muted); }
.mastery span[data-l="1"], .legend i[data-l="1"] { background: #d5e3f3; color: #33557c; }
.mastery span[data-l="2"], .legend i[data-l="2"] { background: #8fb2da; color: #14304f; }
.mastery span[data-l="3"], .legend i[data-l="3"] { background: #2f68a8; color: #fff; }
.mastery span[data-l="4"], .legend i[data-l="4"] { background: #3f8a5c; color: #fff; }
.legend { display: inline-flex; gap: 3px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 4px; }

/* ---------- sweep ---------- */

input[type=range] { accent-color: var(--accent); }

/* ---------- reference ---------- */

.search { width: 100%; padding: 13px 18px 13px 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23857c71' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px center; font-size: 1rem; }

.sym { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-align: center; cursor: pointer; color: var(--ink); }
.sym:hover { border-color: var(--accent); }
.sym .cells { display: flex; gap: 2px; }
.sym .cell { --s: 9px; }
.sym b { font-weight: 500; font-size: 1rem; line-height: 1.2; }
.sym small { font-size: .7rem; color: var(--muted); line-height: 1.2; }

.group-title { gap: 10px; flex-wrap: wrap; }
.group-title h3 { margin: 0; }
.group-title span { color: var(--muted); font-size: .9rem; }

.example { display: grid; gap: 8px; padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.example .print { font-size: 1.15rem; font-weight: 500; }
.example .notes { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.example-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0 0 16px 18px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline b { display: block; font-weight: 600; }

/* ---------- signs ---------- */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.fact { padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.fact b { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.fact p { margin: 0; font-size: .95rem; }
.sign-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.plate {
  position: relative; background: #2e2a26; color: #f4f0e8; border-radius: 14px; padding: 20px 18px 18px;
  box-shadow: none; cursor: pointer; display: flex; flex-direction: column; gap: 14px; min-height: 150px; border: 0; text-align: left; font: inherit;
}
.plate.light { background: #ece6db; color: #1d1a17; }
.plate .ptxt { font-size: 1.5rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.plate .pic { position: absolute; right: 16px; top: 16px; opacity: .9; }
.plate .braille-line { gap: 2px; }
.plate .cell { --s: 7px; --on: #f4f0e8; --off: rgba(255,255,255,.08); }
.plate.light .cell { --on: #1d1a17; --off: rgba(0,0,0,.06); }
.plate .bw .lbl { display: none; }
.plate.decoded .bw .lbl { display: block; color: rgba(255,255,255,.75); }
.plate.light.decoded .bw .lbl { color: #6e675e; }

.plate .tap { font-size: .72rem; opacity: .55; margin-top: auto; }
.anatomy { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
@media (max-width: 760px) { .anatomy { grid-template-columns: 1fr; } }
.anatomy .plate { cursor: default; }
.anatomy ol li { margin-bottom: 6px; }
.elevator { display: inline-grid; grid-template-columns: auto auto; gap: 14px 12px; padding: 22px 26px; border-radius: 18px; background: #c4bdb2; align-items: center; }
.elevator .ebtn { width: 50px; height: 50px; border-radius: 50%; background: #efebe4; box-shadow: none; display: grid; place-items: center; font-weight: 600; color: #2a2723; font-size: 1.1rem; }
.elevator .eb { display: flex; gap: 2px; justify-content: flex-end; }
.elevator .cell { --s: 6px; --on: #2a2723; --off: transparent; }

/* ---------- translate ---------- */
.tr-input { width: 100%; min-height: 92px; max-height: 45vh; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); font-size: 1.15rem; resize: none; field-sizing: content; overflow-y: auto; }
.tr-out { min-height: 120px; }
.tr-out .cell { --s: 10px; }

.tr-tools { align-items: center; }

footer.foot { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* ---------- accessibility ---------- */
/* Skip link: off screen until it gets keyboard focus. */
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-200%); padding: 10px 16px; border: 0; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; }
.skip-link:focus { transform: none; }
/* Reduced motion (system setting): no movement, shakes, slides or flips. Right/wrong feedback stays,
   as a still ring instead of the animated glow, so nothing is lost. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .glow-good { box-shadow: 0 0 0 3px var(--good) !important; border-color: var(--good) !important; }
  .glow-bad { box-shadow: 0 0 0 3px var(--bad) !important; border-color: var(--bad) !important; }
  .mz-new.filling .fill { transform: scaleX(1); }
}
/* More contrast (system setting): darker secondary text, stronger lines, links underlined. */
@media (prefers-contrast: more) {
  :root { --muted: #5f564e; --line: #a99d90; }
  :root[data-theme="dark"] { --muted: #cfc5ba; --line: #8a7f73; }
  a:not(.btn):not(.hrow):not(.hcard):not(.sr):not([role="radio"]) { text-decoration: underline; text-underline-offset: 3px; }
  .cell i:not(.on) { box-shadow: inset 0 0 0 2px var(--off); }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --muted: #cfc5ba; --line: #8a7f73; } }
/* Windows high contrast: raised dots must still look raised. */
@media (forced-colors: active) {
  .cell i { forced-color-adjust: none; border: 1px solid CanvasText; background: Canvas; }
  .cell i.on { background: CanvasText; }
  .glow-good, .glow-bad { outline: 3px solid Highlight; }
}

/* ---------- layout v3 ---------- */

/* drop-down */
.dd { position: relative; display: inline-block; }
.dd-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 12px 8px 16px; cursor: pointer; font-size: .95rem; color: var(--ink); max-width: 100%; }
.dd-btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.dd-k { color: var(--muted); font-size: .85rem; }
.cs-i.cs-wnote { grid-column: span 4; display: flex; align-items: center; justify-content: flex-end; text-align: right; font-size: .78rem; color: var(--muted); line-height: 1.3; padding-right: 4px; }
.dd-v { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd .ic { color: var(--muted); transition: transform .2s; }
.dd.open .dd-btn .ic { transform: rotate(180deg); }
.dd-menu { display: none; position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; min-width: 230px; max-width: calc(100vw - 32px); max-height: min(60vh, 420px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px rgba(30,20,10,.16); padding: 6px; }
.dd-menu.up { top: auto; bottom: calc(100% + 6px); }
.dd-menu.right { left: auto; right: 0; }
.dd.open .dd-menu { display: block; animation: fade .15s; }
.dd-opt { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; border: 0; background: none; text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: .95rem; color: var(--ink); }
.dd-opt:hover { background: var(--surface-2); }
.dd-opt.on { color: var(--accent); font-weight: 500; }
.dd-opt small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.dd-group { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 10px 12px 4px; }

/* home */
.home-head { justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.home-head h1 { margin-bottom: 4px; }
.home-head p { margin: 0; max-width: 42ch; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tiles.one { grid-template-columns: 1fr; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.tile { display: flex; flex-direction: column; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); overflow: hidden; transition: transform .15s, border-color .2s; }
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.tile .art { height: 108px; display: grid; place-items: center; background: var(--surface-2); position: relative; overflow: hidden; }

.tile.wide { flex-direction: row; align-items: stretch; }
.tile.wide .art { width: 45%; height: auto; min-height: 96px; }

/* practice */

.stage { gap: 20px; padding: 26px 18px; transition: box-shadow .3s, border-color .3s; }
.choice small { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; }
.below-stage { display: flex; flex-direction: column; }
.practice-wrap { max-width: 720px; margin: 0 auto; display: block; }
.practice-wrap.mode-sweep { max-width: none; }

/* sheet + settings */
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; }
.sheet .close { position: static; }
.set-group { display: flex; flex-direction: column; }
.set-group:last-child { border-bottom: 0; }
.set-group h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; margin: 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; color: var(--ink-2); }
@media (min-width: 761px) { .sheet { width: min(480px, calc(100vw - 32px)); } }

/* reference */
.lead-p { color: var(--ink-2); max-width: 68ch; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin: 36px 0 0; font-size: .95rem; }

.example { color: var(--ink); }
a.example:hover { text-decoration: none; border-color: var(--accent); }
.sg { margin: 0 0 34px; scroll-margin-top: 80px; }
.sg-h { font-size: 1.2rem; }
.ptxt2 { font-size: .8em; opacity: .85; }
.plate .tap { display: none; }
.anatomy ol { margin: 0; padding-left: 20px; color: var(--ink-2); }
.elev-wrap { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.elev-text { flex: 1; min-width: 240px; }
.acc { color: var(--accent); }
.money { display: flex; gap: 12px; flex-wrap: wrap; }
.money .note { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.money .note span { display: flex; gap: 4px; flex-wrap: wrap; }
.money .note-gap { width: 34px; }
.nw { white-space: nowrap; }
.tr-out { margin-top: 12px; }
.tr-tools { margin: 12px 0; }
footer.foot { display: none; }

html, body { overflow-x: clip; }
.mrow { display: inline-flex; gap: 1px; align-items: center; }
.mrow .bw.space { width: 8px; }

/* ===================== v4 ===================== */

/* header: logo · section control · (desktop nav) · settings */
.brand { flex: none; }
.ctx { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; }
.ctx:empty { display: none; }

.ctx .icon-btn { width: 38px; height: 38px; }
.nav { margin-left: auto; }
#settingsBtn { margin-left: auto; }
.nav + #settingsBtn { margin-left: 0; }
@media (max-width: 760px) { .ctx { flex: 1; } .ctx .dd-menu { left: 0; } }
body[data-page="home"] .top { min-height: 56px; }
.logo.big { grid-template-columns: repeat(2, 14px); grid-template-rows: repeat(3, 14px); gap: 6px; padding: 11px 13px; border-radius: 16px; }
.logo.big i { width: 14px; height: 14px; }

/* pickers */
.picker { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 14px; }
.practice-wrap .picker { justify-content: space-between; }
.mode-sweep .picker { justify-content: space-between; }
.radios button { white-space: nowrap; }
@media (max-width: 420px) { .radios button { padding: 6px 11px; font-size: .88rem; } }

/* practice stage + glow feedback */
@keyframes glowGood { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 0%, transparent); } 25% { box-shadow: 0 0 0 3px var(--good), 0 0 26px color-mix(in srgb, var(--good) 55%, transparent); } 100% { box-shadow: 0 0 0 2px var(--good), 0 0 14px color-mix(in srgb, var(--good) 25%, transparent); } }
@keyframes glowBad { 0% { box-shadow: none; } 25% { box-shadow: 0 0 0 3px var(--bad), 0 0 26px color-mix(in srgb, var(--bad) 55%, transparent); } 100% { box-shadow: 0 0 0 2px var(--bad), 0 0 12px color-mix(in srgb, var(--bad) 22%, transparent); } }
.stage .prompt-cells .cell { --s: clamp(11px, 3.7vw, 21px); }
.stage .prompt-cells.many .cell { --s: clamp(7px, 2.1vw, 11px); }
.stage .prompt-cells.words .lbl { font-size: .9rem; color: var(--ink-2); min-height: 1.2em; }
.stage .target { font-size: 2.5rem; overflow-wrap: anywhere; }
.dotpad { grid-template-columns: repeat(2, 53px); grid-template-rows: repeat(3, 53px); gap: 10px; padding: 14px; border-radius: 20px; }
.dotpad button { font-size: 0; }

.build { display: flex; gap: 8px; }
.build .slot { width: 30px; height: 42px; border-radius: 8px; border: 1px dashed var(--line); display: grid; place-items: center; }
.build .slot.cur { border: 1.5px solid var(--accent); }
.link-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }
.link-btn:hover { color: var(--ink); }

.legend small { color: var(--muted); font-size: .8rem; margin-left: 4px; }
.mastery span { min-width: 28px; width: auto; padding: 0 6px; }

/* settings sheet */
.sheet { padding: 0; }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--surface); margin: 0; padding: 20px 20px 12px; }
.sheet-body { padding: 0 20px 20px; }
.settings { display: flex; flex-direction: column; }
.set-group { align-items: stretch; }
.set-row { flex-wrap: nowrap; font-size: .95rem; }

.set-row.switch { cursor: pointer; }
.set-row.switch input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; margin: 0; width: 47px; height: 29px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; }
.set-row.switch input[type=checkbox]::after { content: ''; position: absolute; top: 4px; left: 4px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.set-row.switch input[type=checkbox]:checked { background: var(--accent); }
.set-row.switch input[type=checkbox]:checked::after { transform: translateX(18px); }
.about p { margin: 0; color: var(--ink-2); font-size: .92rem; }

/* plain text lists (no boxes) */
.prose-list { max-width: 70ch; }
.prose-list h4 { margin: 18px 0 4px; font-size: 1rem; font-weight: 600; }
.prose-list h4:first-child { margin-top: 0; }
.prose-list p { margin: 0; color: var(--ink-2); }
.sg-h { margin: 0 0 12px; }

/* maths groups with labels */
.braille-line.groups { gap: 10px 6px; align-items: flex-start; }
.bgroup { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.bgroup .lbl { font-size: .74rem; color: var(--muted); white-space: nowrap; }
hr.pale { border: 0; border-top: 1px solid var(--line); margin: 30px 0 4px; }

/* expandable list with chevrons */
.acc-list { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.acc-item + .acc-item { border-top: 1px solid var(--line); }
.acc-item summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary span { display: flex; flex-direction: column; gap: 2px; }
.acc-item summary small { color: var(--muted); font-size: .85rem; }
.acc-item summary .ic { color: var(--muted); transition: transform .2s; flex: none; }
.acc-item[open] summary .ic { transform: rotate(180deg); }
.acc-body { padding: 0 16px 16px; color: var(--ink-2); }
.acc-body p { margin: 0 0 10px; max-width: 70ch; }
.small-btn { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; padding: 7px 14px; }
.braille-line.groups .cell { --s: 9px; }

.sheet .sym { padding: 10px 4px 8px; cursor: default; }
.sheet .sym .cell { --s: 7px; }

/* grade 2 compact tables */
.g2-compare { display: grid; gap: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); margin: 4px 0 26px; }
.g2-compare small { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 6px; }

.ctable { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 24px; border-top: 1px solid var(--line); }
.crow { display: grid; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; color: var(--ink); grid-template-columns: minmax(64px, auto) minmax(0, 1fr) auto; padding: 7px 4px; }
.crow:hover { background: var(--surface); }
.crow .cells { grid-row: 1 / 3; display: flex; gap: 2px; }
.crow .cell { --s: 7px; }
.crow b { font-weight: 600; font-size: 1rem; }
.crow .cnote { grid-column: 2 / 4; font-size: .8rem; color: var(--muted); }
.crow .cnote:empty { display: none; }

/* ===================== v5 ===================== */
body.s-color .cell.k-digit { --on: var(--k-digit); }
body.s-color .cell.k-contraction { --on: var(--k-contraction); }
body.s-color .cell.k-punct { --on: var(--k-punct); }
body.s-color .cell.k-indicator { --on: var(--k-indicator); }
body.s-color .cell.k-math { --on: var(--k-math); }

.settings .cell.k-digit { --on: var(--k-digit); } .settings .cell.k-contraction { --on: var(--k-contraction); } .settings .cell.k-punct { --on: var(--k-punct); } .settings .cell.k-indicator { --on: var(--k-indicator); } .settings .cell.k-math { --on: var(--k-math); }
.set-prev { margin: 2px 0 6px; padding: 12px 14px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.set-prev small { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.set-prev .sp-line { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.set-prev .sp-w { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.set-prev .sp-c { display: flex; }
.set-prev .cell { --s: clamp(6px, 1.9vw, 8px); padding: calc(var(--s) * .3) calc(var(--s) * .35); }
.set-prev .sp-l { font-size: .72rem; color: var(--muted); }
body:not(.s-color) .settings .set-prev .cell { --on: var(--ink); }

/* header */
.top { flex-direction: column; align-items: stretch; gap: 0; padding-top: 0; padding-bottom: 0; min-height: 0; }
.top-row { display: flex; align-items: center; gap: 10px; min-height: 58px; }
.head-title { font-size: 1.3rem; letter-spacing: -0.02em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .nav { margin-left: 0; }
#settingsBtn, .nav + #settingsBtn { margin-left: 0; }
.icon-btn.plain { border: 0; background: none; color: var(--ink-2); }
@media (hover: hover) { .icon-btn.plain:hover { background: var(--surface-2); color: var(--ink); } }
.top .icon-btn.plain { width: 42px; height: 42px; }
.top .icon-btn.plain .ic { width: 24px; height: 24px; }
.top.scrolled, .top:has(.subbar:not([hidden])) { border-bottom-color: var(--line); }
.subbar { display: flex; align-items: center; gap: 10px; padding: 0 0 10px; }
.subbar[hidden] { display: none; }
.dd-right { margin-left: auto; }
.dd-strong .dd-btn { border: 1.5px solid var(--ink); font-weight: 600; padding: 8px 12px 8px 16px; }
.subbar .dd-right .dd-btn { padding: 8px 10px 8px 14px; }
@media (max-width: 420px) { #jumpDD .dd-k { display: none; } #jumpDD .dd-v::before { content: 'Jump to'; font-size: .95rem; } #jumpDD .dd-v { font-size: 0; } #exDD .dd-v { display: none; } }
.modes { flex: 1; display: flex; max-width: 520px; }
.modes a { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 6px; color: var(--ink-2); font-size: .92rem; }
.modes a:hover { text-decoration: none; color: var(--ink); }
.modes a.on { box-shadow: var(--shadow); font-weight: 500; }
@media (max-width: 480px) { .modes a { flex-direction: column; gap: 1px; font-size: .74rem; padding: 5px 2px; border-radius: 14px; } .modes { border-radius: 18px; } }
.subbar #helpBtn { margin-left: auto; }

/* search: a dialog on a pale mask; the box is as tall as its content and scrolls inside before it reaches the screen edge */
html.so-open { overflow: hidden; }
.search-ov { --so-gap: 12px; --so-top: calc(var(--so-gap) + env(safe-area-inset-top)); position: fixed; inset: 0; z-index: 35; background: rgba(40, 30, 20, .14); animation: fade .15s; }
.search-ov[hidden] { display: none; }
.so-box { position: absolute; top: var(--so-top); left: 50%; transform: translateX(-50%); width: min(640px, calc(100% - 2 * var(--so-gap))); max-height: calc(var(--vvh, 100dvh) - var(--so-top) - var(--so-gap) - env(safe-area-inset-bottom)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 50px rgba(40, 28, 16, .18), 0 2px 8px rgba(40, 28, 16, .06); overflow: hidden; animation: soIn .18s ease-out; }
@keyframes soIn { from { opacity: 0; transform: translate(-50%, -6px); } }
@media (min-width: 761px) { .search-ov { --so-gap: 24px; --so-top: min(12vh, 96px); } }
.so-field { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); }
.so-field:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.so-ic { display: grid; color: var(--muted); }
.so-field input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: 10px 6px; border: 0; background: none; color: var(--ink); outline: none; }
.so-field input::-webkit-search-cancel-button { display: none; }
.so-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
.so-body:empty { display: none; }
.so-hint { margin: 0; padding: 12px 10px; color: var(--muted); font-size: .92rem; }
.so-hint b { color: var(--ink-2); font-weight: 500; }
.so-hh { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 2px 10px; }
.so-hh h2 { margin: 0; font-size: .8rem; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: .01em; }
.so-clear { border: 0; background: none; font: inherit; font-size: .85rem; color: var(--accent); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.so-clear:hover { background: var(--surface-2); }
.so-hist ul { list-style: none; margin: 0; padding: 0; }
.so-h { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; font: inherit; color: var(--ink); padding: 10px; border-radius: 12px; cursor: pointer; }
.so-h .ic { flex: none; color: var(--muted); }
.so-h span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-h:hover { background: var(--surface-2); }
.sr:focus-visible, .so-h:focus-visible { background: var(--surface-2); }
:root[data-theme="dark"] .search-ov { background: rgba(0, 0, 0, .3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .search-ov { background: rgba(0, 0, 0, .3); } }
:root[data-theme="dark"] .so-box { box-shadow: 0 18px 50px rgba(0, 0, 0, .45); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .so-box { box-shadow: 0 18px 50px rgba(0, 0, 0, .45); } }
@media (prefers-reduced-motion: reduce) { .search-ov, .so-box { animation: none; } }
.sr { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 12px; cursor: pointer; color: var(--ink); }
.sr:hover { background: var(--surface-2); text-decoration: none; }
.sr-cells { display: flex; gap: 2px; flex-wrap: wrap; color: var(--muted); }
.sr-cells .cell { --s: 7px; }
.sr-text { display: flex; flex-direction: column; min-width: 0; }
.sr-text small { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-sec { font-size: .75rem; color: var(--muted); background: var(--surface-2); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.sr.tr { grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); border-radius: 0; margin-top: 6px; padding-top: 14px; }
.sr.tr .sr-cells { order: 2; }
@media (max-width: 480px) { .sr-sec { display: none; } .sr { grid-template-columns: 64px minmax(0, 1fr); } }

/* home */
.home-head { display: block; }
.home-head h1 { font-size: clamp(2.2rem, 7vw, 3rem); margin: 0 0 6px; }

.sec-h { display: flex; align-items: center; gap: 10px; font-size: 1.32rem; font-weight: 600; color: var(--ink); margin: 32px 0 10px; }
.sec-h .ic { color: var(--accent); }
.hrows { border-top: 1px solid var(--line); }
.hrow { display: flex; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); min-height: 72px; }
.hrow:hover { text-decoration: none; background: var(--surface); }
.hrow-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hrow-text b { font-weight: 600; font-size: 1.05rem; }
.hrow-text span { color: var(--muted); font-size: .9rem; }

/* practice */
.stage { position: relative; justify-content: center; }
.link-btn.corner { position: absolute; top: 12px; right: 14px; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .85rem; }

.set-row.switch.disabled { cursor: default; color: var(--muted); }
.set-row.switch input:disabled { opacity: .5; cursor: not-allowed; }

/* bottom menu */
.btn[hidden] { display: none; }

/* logo + wordmark */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --lb-l: #82acdf; --lb-b: #7dbb94; } }
.logo-svg { display: block; }
.logo-svg .lb-l { fill: var(--lb-l); } .logo-svg .lb-b { fill: var(--lb-b); } .logo-svg .lb-off { fill: var(--lb-off); }

.wm-l { color: var(--lb-l); } .wm-b { color: var(--lb-b); }

/* ===================== v7 ===================== */
/* consistent control heights */
.seg { background: var(--seg-bg); height: var(--ctl-h); box-sizing: border-box; align-items: stretch; }
.seg button { padding: 0 14px; display: inline-flex; align-items: center; }
.seg button.on, .modes a.on { box-shadow: 0 1px 2px rgba(30, 20, 10, .14); }
.modes { background: var(--seg-bg); }
.dd-btn { height: var(--ctl-h); box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.btn.small-btn { height: var(--ctl-h); box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
.picker { min-height: var(--ctl-h); }

/* softer, larger glow; small quick shake */
@keyframes glowGood { 0% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--good) 70%, transparent), 0 0 48px 8px color-mix(in srgb, var(--good) 30%, transparent); } 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 55%, transparent), 0 0 36px 4px color-mix(in srgb, var(--good) 16%, transparent); } }
@keyframes glowBad { 0% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--bad) 70%, transparent), 0 0 48px 8px color-mix(in srgb, var(--bad) 28%, transparent); } 100% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--bad) 55%, transparent), 0 0 36px 4px color-mix(in srgb, var(--bad) 14%, transparent); } }
@keyframes shakeSm { 20% { transform: translateX(-2px); } 40% { transform: translateX(2px); } 60% { transform: translateX(-1.5px); } 80% { transform: translateX(1px); } }
.stage.glow-good { animation: glowGood .9s ease-out forwards; border-color: color-mix(in srgb, var(--good) 60%, var(--line)); }
.stage.glow-bad { animation: glowBad .8s ease-out forwards, shakeSm .2s linear; border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.choice.wrong { animation: shakeSm .2s linear; }

/* home rows: line icons */
.hrow-ic { flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.hrow > .ic:last-child { color: var(--muted); flex: none; }

/* compact narrow tables (languages, kana, start-with) */
.ctable.narrow { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); column-gap: 18px; margin-bottom: 8px; }
.ctable.narrow .crow { grid-template-columns: minmax(28px, auto) minmax(0, 1fr) auto; padding: 6px 2px; }
div.crow { cursor: default; }
div.crow:hover { background: none; }
.ctable.narrow .crow b { font-size: 1.05rem; }
@media (min-width: 900px) {
  .crow .cell { --s: 10px; }
  .crow { padding: 9px 4px; column-gap: 16px; }
  .ctable.narrow:not(.multi) { grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 22px; }
  .ctable.narrow .crow { padding: 10px 4px; column-gap: 16px; }
  .ctable.narrow .crow b { font-size: 1.2rem; }
}

/* overview */
.sg.prose p { max-width: 68ch; color: var(--ink-2); }
.sg.prose p .cell { vertical-align: middle; margin: 0 2px; }
.cell-anatomy .cell.xl { --s: 30px; }
.cell-anatomy p { margin: 0 0 10px; }

.timeline { margin-top: 14px; }

/* prev / next */
.pager { border-top: 0; padding-top: 0; margin-top: 40px; }
.pager .btn { height: auto; padding: 10px 16px; border-radius: 14px; gap: 10px; text-align: left; }
.pager .btn span { display: flex; flex-direction: column; line-height: 1.2; }
.pager .btn small { color: var(--muted); font-size: .75rem; font-weight: 400; }
.pager .btn.next { text-align: right; margin-left: auto; }
.pager .btn.next span { align-items: flex-end; }
.pager .pg-dir .ic { transform: rotate(180deg); }
.pager .pg-dir { display: flex; }
/* Lesson pages: one Next card under the check, then a quiet Previous link. */
.next-card { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 14px 16px 14px 14px; border-radius: 18px; background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .15s, border-color .2s; }
.next-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.next-card .hrow-ic { background: var(--accent); color: var(--surface); width: 52px; height: 52px; }
.next-card .nc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.next-card small { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.next-card b { font-size: 1.1rem; font-weight: 600; }
.next-card .nc-t span { font-size: .88rem; color: var(--ink-2); }
.next-card > .ic { color: var(--accent); flex: none; }
.pager.lesson-pager { margin-top: 18px; }
.lq-n { margin: 6px 0 0; text-align: center; font-size: .82rem; color: var(--muted); }
.seg.modes { height: auto; }
.modes .ic { flex: none; width: 20px; height: 20px; }

/* ===================== v8 ===================== */
/* one modal: 20px from every screen edge */
.sheet, .sheet[hidden] { padding: 0; }
.sheet { top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); width: min(480px, calc(100vw - 40px));
  max-height: calc(100dvh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); border-radius: 22px; animation: pop .22s; }
.sheet[hidden] { display: none; }
@media (max-width: 760px) { .sheet { top: 50%; bottom: auto; left: 50%; right: auto; transform: translate(-50%, -50%); width: calc(100vw - 40px); border-radius: 22px; animation: pop .22s; padding-bottom: 0; } .sheet-body { padding-bottom: 20px; } }

/* header: logo + wordmark on Home only */
.brand { display: none; }
body[data-page="home"] .brand { display: flex; align-items: center; gap: 10px; }
.brand-wm { font-size: 1.4rem; letter-spacing: -0.03em; color: var(--ink); white-space: nowrap; }
.brand .logo-svg { width: 36px; height: auto; }
.home-head { margin: 14px 0 18px; }

#helpBtn[hidden] { display: none; }

/* progress */

.tally { display: flex; flex-direction: column; gap: 5px; padding: 7px 10px; border-radius: 10px; color: var(--ink-2); }
.tally:hover { background: var(--surface-2); text-decoration: none; }

/* practice picker always fits */
.practice-wrap .picker { flex-wrap: nowrap; }
.practice-wrap .picker > .seg { flex: none; }
#setDD { min-width: 0; flex: 0 1 auto; margin-left: auto; }
#setDD .dd-btn { min-width: 0; width: 100%; }
#setDD .dd-v { min-width: 0; }
#setDD .dd-btn .ic { flex: none; }

/* below the stage: pills, then stats */
.below-stage { margin-top: 26px; gap: 14px; }
.mastery span { white-space: nowrap; }
.mode-words .stage { min-height: 0; }

.link-btn.pillish { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .85rem; display: inline-flex; align-items: center; gap: 4px; background: var(--surface); color: var(--ink-2); touch-action: manipulation; }
.link-btn.pillish .ic { width: 16px; height: 16px; }

/* signs: framed light plates, not inverted */
.plate, .plate.light { border-radius: 14px; padding: 22px 20px 20px; }

/* dot numbers only when the setting is on */

/* practise links in Reference */
.gt-link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: .9rem; white-space: nowrap; align-self: center; }
.gt-link .ic { width: 16px; height: 16px; }
.ex-note { margin: 0; }

/* ===================== v9 ===================== */
/* jump targets clear the two-row header */
[id] { scroll-margin-top: calc(var(--head-h, 120px) + 14px); }

/* breathing room after grids and tables, everywhere */
:is(.sign-gallery, .ctable, .example-grid, .g2-compare, .hrows, .acc-list, .money, .anatomy, .elev-wrap) + :is(p, .row, .ex-block) { margin-top: 18px; }
.ex-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 500; margin: 0 0 10px; }
.sg > .lead-p:first-child { margin-top: 0; }
.ov-rows { margin: 14px 0 4px; max-width: 520px; }

/* Learn section dropdown: filled; Jump to: lighter */
.dd-strong .dd-btn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dd-strong .dd-btn .ic { color: var(--bg); }
.dd-strong .dd-btn:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); border-color: var(--ink); }
.dd-right .dd-v, .dd-right .dd-k { font-weight: 400; }

/* clearer selected tab */
@media (max-width: 760px) {
  .tabbar a .ic { box-sizing: content-box; border-radius: 999px; transition: background .2s; }
  .tabbar a.active .ic { background: var(--accent-soft); }
  .tabbar a.active { font-weight: 600; }
}

/* wordmark: lighter letters, L and B stay bold */
.brand-wm { font-weight: 600; }
.brand-wm .wm-l, .brand-wm .wm-b { font-weight: 700; }

/* signs: one thick dark frame, soft double shadow */
.plate.blue { border-color: var(--accent); box-shadow: 0 1px 3px rgba(40, 28, 16, .08), 0 10px 28px rgba(40, 28, 16, .08); }
.anatomy .plate { width: 260px; }

/* practice: spare space goes above and below the card */
body[data-page="practice"] main { padding-bottom: 14px; }
.practice-wrap:not(.mode-sweep) { display: flex; flex-direction: column; min-height: calc(100dvh - var(--head-h, 120px) - var(--tabbar-h, 0px) - env(safe-area-inset-bottom) - 22px); }
.practice-wrap:not(.mode-sweep) .picker { margin-bottom: 0; }
.practice-wrap:not(.mode-sweep) #modeBody { flex: 1; display: flex; flex-direction: column; gap: 22px; min-height: 0; padding: 0; justify-content: flex-start; }
.practice-wrap:not(.mode-sweep) .stage { margin: auto 0; min-height: 0; }
.practice-wrap:not(.mode-sweep) .below-stage { margin-top: 0; }
.stage { min-height: 0; }

/* ===================== v10 ===================== */
/* tables with multi-cell symbols collapse together */
.ctable.narrow.multi { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
@media (max-width: 560px) { .ctable.narrow.multi { grid-template-columns: minmax(0, 1fr); } }

/* home */
.hrows + .sec-h { margin-top: 64px; }
.hrows:last-child .hrow:last-child { border-bottom: 0; }

/* settings: space instead of lines */
.settings { gap: 44px; }
.set-group { border-bottom: 0; padding-bottom: 0; gap: 22px; }

/* header + footer: translucent, no borders, header shadow once scrolled */
.top, .top.scrolled, .top:has(.subbar:not([hidden])) { transition: box-shadow .2s; }
@media (max-width: 760px) {
  .tabbar { grid-template-columns: repeat(5, 1fr); padding-left: 6px; padding-right: 6px; gap: 4px; }
  .tabbar a { padding: 5px 0 4px; border-radius: 14px; font-size: .74rem; }
  .tabbar a .ic { padding: 0; background: none !important; }
}

/* practice choices shrink on small phones */
.choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choice { min-width: 0; }
@media (max-width: 380px) { .choices { gap: 7px; } .choice { font-size: 1.25rem; } }
.help p { margin: 0 0 12px; }
.help p:last-child { margin-bottom: 0; }

/* alphabet headings */
.decade-head { align-items: center; margin-bottom: 2px; }
.decade-head h3.range { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
.decade-p { color: var(--ink-2); margin: 0 0 12px; max-width: 64ch; }
.ex-block + p, .ex-block + .row { margin-top: 22px; }

/* games list + shell */

.back-link { display: inline-flex; align-items: center; gap: 2px; font-weight: 500; color: var(--ink-2); height: var(--ctl-h); }
.back-link .ic { transform: rotate(180deg); }
.back-link:hover { color: var(--ink); text-decoration: none; }
.game-wrap { max-width: 720px; margin: 0 auto; }
.game-wrap .picker { margin: 4px 0 16px; }
.g-stats { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; font-size: .92rem; color: var(--muted); margin: 0 0 12px; }
.g-stats b { color: var(--ink); font-weight: 600; }
.g-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.g-card.glow-good, .rain-field.glow-good { animation: glowGood .9s ease-out forwards; }
.g-card.glow-bad, .rain-field.glow-bad { animation: glowBad .8s ease-out forwards, shakeSm .2s linear; }
.g-msg { margin: 0; min-height: 1.4em; text-align: center; color: var(--ink-2); }
.g-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.g-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; background: color-mix(in srgb, var(--surface) 94%, transparent); border-radius: inherit; z-index: 5; }
.g-overlay[hidden] { display: none; }
.g-overlay small { color: var(--muted); }
.g-big { font-size: 3rem; font-weight: 600; line-height: 1; }
.lives { display: inline-flex; align-items: center; gap: 2px; }
.lives svg { display: block; fill: none; stroke: var(--muted); stroke-width: 1.8; opacity: .6; transition: fill .2s, opacity .2s; }
.lives svg.on { fill: var(--ink-2); stroke: none; opacity: 1; }

.g-end { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px; }
.g-end b { font-size: 2.6rem; font-weight: 600; }
.g-end span { color: var(--muted); }

/* wordle */
.wd-board { display: grid; }
.wd-row { display: grid; }
.wd-tile { border: 1.5px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface); }
.wd-tile .cell { padding: 0; }
.wd-tile b { font-weight: 600; line-height: 1; }
.wd-row.cur .wd-tile { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.wd-tile.hit, .wd-k.hit { background: var(--good); border-color: var(--good); --on: #fff; --off: rgba(255, 255, 255, .35); color: #fff; }
.wd-tile.near, .wd-k.near { background: #b8912a; border-color: #b8912a; --on: #fff; --off: rgba(255, 255, 255, .4); color: #fff; }
.wd-tile.miss, .wd-k.miss { background: var(--surface-2); --on: var(--muted); color: var(--muted); }
.wd-keys { display: flex; flex-direction: column; }
.wd-krow { display: flex; gap: 4px; justify-content: center; }
.wd-k { flex: 1 1 0; max-width: 46px; min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; cursor: pointer; color: var(--ink); font: inherit; }
.wd-k .cell { --s: 5px; --gap: 2.5px; padding: 0; }
.wd-k b { font-size: .72rem; font-weight: 500; line-height: 1; }
.wd-k.wide { max-width: 66px; flex: 1.5 1 0; font-size: .78rem; }

/* memory */
.mem-grid { display: grid; margin: 0 auto; }
.mem-grid.n10 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 480px) { .mem-grid.n10 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mem-card { aspect-ratio: 3 / 4; border: 0; padding: 0; position: relative; cursor: pointer; background: none; }
.mem-back, .mem-face { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .35s; }
.mem-face { background: var(--surface); border: 1px solid var(--line); transform: rotateY(180deg); color: var(--ink); }
.mem-card.up .mem-back { transform: rotateY(180deg); }
.mem-card.up .mem-face { transform: rotateY(0); }
.mem-card.done .mem-face { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.mem-face b { font-size: 2rem; font-weight: 500; }

/* trivia + riddles */
.quiz { align-items: stretch; }
.quiz-q { font-size: 1.2rem; font-weight: 500; margin: 0; text-align: center; }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; color: var(--ink); font: inherit; }
.quiz-opt:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.quiz-opt .cell { --s: 6px; }
.quiz-opt .braille-line { justify-content: center; gap: 4px 2px; }
.quiz-opt .lbl { font-size: .66rem; }
.quiz-print { font-size: .88rem; color: var(--ink-2); }
.quiz.revealed .quiz-print { display: block; }
.quiz-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.quiz-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.quiz-opt.dim { opacity: .6; }

/* rain */
.rain-field { position: relative; overflow: hidden; padding: 0; }
.drop { position: absolute; top: 0; will-change: transform; transition: opacity .18s; }
.drop .cell { --s: 11px; }
.drop.pop { opacity: 0; }

/* time attack + mirror */
.ta-bar { height: 6px; background: var(--seg-bg); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.ta-bar i { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: inherit; }
.ta, .mm { min-height: clamp(170px, 100dvh - 440px, 260px); justify-content: center; }
.ta .prompt-cells .cell, .mm .prompt-cells .cell { --s: 22px; }
.mm .choices { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); max-width: 380px; }

/* secret agent */

.ag { align-items: stretch; }

.ag-brief { margin: 0; color: var(--ink-2); }
.ag-msg { display: flex; padding: 14px; border-radius: 14px; }
.ag-w { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 6px 8px; border-radius: 10px; }
.ag-w.cur { box-shadow: inset 0 0 0 1.5px var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.ag-w .cell { --s: 8px; }

.ag-after { margin: 0; font-style: italic; color: var(--ink-2); }

/* anagrams */
.an { min-height: 240px; justify-content: center; }
.an-cells { display: flex; flex-wrap: wrap; justify-content: center; }
.an-cells .cell { --s: 10.5px; }
.an-cells .lbl { font-size: .85rem; color: var(--accent); font-weight: 600; min-height: 1.2em; }

/* hangman */
.hm { align-items: center; flex-wrap: wrap; justify-content: center; }
.hm-art { flex: none; }
.hm-art path, .hm-art circle { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hm-art .p { opacity: 0; transition: opacity .3s; }
.hm-art .p.on { opacity: 1; stroke: var(--bad); }
.hm-side { display: flex; flex-direction: column; gap: 10px; align-items: center; min-width: 0; }
.hm-side small { color: var(--muted); }
.hm-word { display: flex; flex-wrap: wrap; justify-content: center; }
.hm-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; border-bottom: 2px solid var(--ink-2); }
.hm-slot b { font-size: .8rem; }
.cell.blank i { box-shadow: none; }

/* maze */
.mz-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; width: min(100%, 440px, max(220px, 100dvh - 340px)); container-type: inline-size; }
.mz-cell { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; padding: 0; color: var(--ink); font: inherit; }
.mz-cell .cell { --s: clamp(4px, 100cqi / var(--n) / 7, 9px); }
.mz-cell.walked { background: color-mix(in srgb, var(--good) 16%, var(--surface)); border-color: var(--good); }
.mz-cell.walked b { font-size: .72rem; line-height: 1; }
.mz-cell.trap { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-color: var(--bad); }

.mz-flag { font-size: 1.3rem; color: var(--accent); }

/* cheat sheet */
.cs-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cs-head .lead-p { margin: 0; }
.cheatsheet { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.cs-title { font-size: 1.4rem; margin: 0 0 4px; }
.cs-title small { font-size: .8rem; color: var(--muted); font-weight: 400; margin-left: 8px; }
@media screen and (max-width: 560px) { .cs-title small { display: block; margin: 2px 0 0; } }
.cheatsheet .ctable.narrow, .cheatsheet .ctable.narrow.multi { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.cheatsheet .crow .cnote { display: none; }
.cs-foot { color: var(--muted); font-size: .75rem; margin: 16px 0 0; text-align: right; }
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; padding: 0 !important; }
  .top, .tabbar, .pager, .cs-head, .search-ov, .sheet, .sheet-backdrop { display: none !important; }
  main { padding: 0; max-width: none; }
  .cheatsheet { border: 0; padding: 0; background: #fff; }
  .cheatsheet .ctable.narrow, .cheatsheet .ctable.narrow.multi { grid-template-columns: repeat(6, 1fr); column-gap: 10px; }
  .cheatsheet .crow { padding: 3px 2px; break-inside: avoid; }
  .cheatsheet .cell { --s: 6px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===================== v11 ===================== */
/* Braille geometry, in units of the dot pitch d (centre to centre inside a cell):
   dot diameter 0.6d, cell to cell 2.5d, line to line 4d, a space is one blank cell.
   With dot size --s: d = s / 0.6, so the gap inside a cell is 2s/3 and each cell carries
   0.75s of side padding (1.5s edge to edge between neighbours). Containers of consecutive
   cells therefore use no gap of their own. */
.cell { --gap: calc(var(--s) * 2 / 3); padding: calc(var(--s) * .35) calc(var(--s) * .75); }
.braille-line, .bword, .sym .cells, .crow .cells, .sr-cells, .plate .braille-line, .plate .bword, .quiz-opt .braille-line, .mrow, .an-cells, .stage .prompt-cells { column-gap: 0; }
.braille-line:not(:has(.lbl)) .cell { padding-block: calc(var(--s) * 1.17); }
.bw.space, .mrow .bw.space, .sweep-track .sc.space, body.s-sw-real .sweep-track .sc.space { width: auto; }
.space .cell { visibility: hidden; }
.ag-msg { gap: 12px 17px; }
/* unraised dots: outline (default) or filled */
body.s-dotfill .cell i:not(.on) { background: var(--off); box-shadow: none; }
body.s-dotfill :is(.cell.ghost, .cell.blank) i:not(.on) { background: transparent; }

/* header + footer: nearly opaque, with their borders back */
.top, .top.scrolled, .top:has(.subbar:not([hidden])) { background: color-mix(in srgb, var(--bg) 93%, transparent); border-bottom: 1px solid var(--line); }
@media (max-width: 760px) {
  .tabbar { background: color-mix(in srgb, var(--bg) 93%, transparent); border-top: 1px solid var(--line); }
  .tabbar a.active { box-shadow: none; background: color-mix(in srgb, var(--accent) 12%, transparent); }
}

/* games: level picker beside the back link; content centred; stats + buttons at the bottom */
.g-sub { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.g-sub .picker { margin: 0; display: flex; }
.g-sub .seg { flex: none; }
body[data-page="games"] main { padding-bottom: 14px; }
.game-wrap { display: flex; flex-direction: column; min-height: calc(100dvh - var(--head-h, 120px) - var(--tabbar-h, 0px) - env(safe-area-inset-bottom) - 24px); }
.game-wrap > .game { flex: 1; display: flex; flex-direction: column; }
.game::before, .game::after { content: ''; flex: 1 1 0; order: -1; }
.game::after { order: 1; }
.game > .g-foot { order: 2; }
.g-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding-top: 18px; }
.g-foot:not(:has(.g-stats)) { justify-content: center; }
.g-foot .g-stats, .g-foot .g-actions { margin: 0; }
.game > .g-msg { margin-top: 12px; }

/* memory: plain backs, sized to fit the screen */
.mem-grid { --cols: 4; --rows: 3; gap: 10px; max-width: 520px; width: min(100%, calc((100dvh - var(--head-h, 120px) - var(--tabbar-h, 0px) - env(safe-area-inset-bottom) - 130px - (var(--rows) - 1) * 10px) / var(--rows) * .75 * var(--cols) + (var(--cols) - 1) * 10px)); }
.mem-grid.n8 { --rows: 4; }
.mem-grid.n10 { --cols: 5; --rows: 4; }
@media (max-width: 480px) { .mem-grid.n10 { --cols: 4; --rows: 5; } }
.mem-back { background: var(--seg-bg); box-shadow: 0 2px 6px rgba(40, 28, 16, .14); }
.mem-back::after { content: ''; position: absolute; inset: 6px; border-radius: 7px; border: 1.5px solid color-mix(in srgb, var(--seg-bg) 78%, var(--ink)); }
.mem-face { box-shadow: 0 2px 6px rgba(40, 28, 16, .1); }
.mem-face .cell { --s: clamp(7px, 2.4vw, 11px); }

/* learn: more air between and within sections */
.sg { margin-bottom: 60px; }
.sg-h { margin-bottom: 18px; }
.group-title { margin: 40px 0 16px; }
.decade { margin-bottom: 48px; }
.decade-p { margin-bottom: 18px; }
.ex-block { margin-top: 36px; }
body[data-page="reference"] .lead-p { margin-bottom: 32px; }
.sg > p + p, .sg.prose p { margin-bottom: 16px; }
.crow, .ctable.narrow .crow { padding-top: 10px; padding-bottom: 10px; }
#exDD .dd-v { display: inline; font-size: .95rem; }
@media (max-width: 520px) { .tr-out .cell { --s: 7px; }  }
.braille-line.groups .bw.space { width: 14px; }
@media (max-width: 520px) { .card.tr-out { padding: 16px 12px; } }

/* ===================== v12 ===================== */
/* group headings: title + description in one column, Practise link in another */
.group-title { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: 4px; align-items: baseline; }
.group-title > h3, .group-title > span { grid-column: 1; }
.group-title > .gt-link { grid-column: 2; grid-row: 1; margin-left: 0; }
.group-title h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.group-title h3 .count { font-size: .72rem; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; letter-spacing: .01em; line-height: 1.3; }

/* memory hard: 6 × 5 */
.mem-grid.n15 { --cols: 6; --rows: 5; max-width: 600px; gap: 8px; }
.mem-grid.n15 .mem-face b { font-size: 1.5rem; }
.mem-grid.n15 .mem-back::after { inset: 4px; }

/* softer, smaller header and footer shadows */
.top.scrolled { box-shadow: 0 2px 8px rgba(40, 28, 16, .06); }
@media (max-width: 760px) { .tabbar { box-shadow: 0 -2px 8px rgba(40, 28, 16, .06); } }
.mem-grid { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }

/* ===================== v13 ===================== */
/* sign plates: dark (or blue for exits) like the real thing; colour-coded dots in paler shades */
.plate, .plate.light { background: #2b2724; color: #f6f1ea; border: 0; box-shadow: 0 1px 3px rgba(40, 28, 16, .12), 0 10px 26px rgba(40, 28, 16, .12); }
.plate.blue { background: #1f4a7a; color: #f6f1ea; border: 0; }
:root[data-theme="dark"] .plate { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .plate { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); } }
@media (hover: hover) { .plate:hover { box-shadow: 0 2px 4px rgba(40, 28, 16, .16), 0 14px 34px rgba(40, 28, 16, .18); } }
.plate .cell, .plate.light .cell { --on: #f6f1ea; --off: rgba(255, 255, 255, .16); }
body.s-color .plate .cell.k-digit { --on: #9fe0d6; }
body.s-color .plate .cell.k-contraction { --on: #b3d2f6; }
body.s-color .plate .cell.k-punct { --on: #d9c0f6; }
body.s-color .plate .cell.k-indicator { --on: #e6d0b8; }
body.s-color .plate .cell.k-math { --on: #f6bad6; }

.plate.decoded .bw .lbl, .plate.light.decoded .bw .lbl { color: rgba(255, 255, 255, .72); }
.plate.decoded .bw.kind-contraction .lbl { color: #b3d2f6; }

/* practice mode tabs: squarer plate */
.modes { border-radius: 10px !important; padding: 3px; }
.modes a { border-radius: 8px !important; }

/* cheat sheets */
.cs-head .row { gap: 10px; align-items: center; flex-wrap: wrap; }
.cs-block { margin-top: 26px; }
.cs-block:first-of-type { margin-top: 18px; }
.cs-block h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 12px; font-weight: 500; }
.cs-block h3 span { text-transform: none; letter-spacing: 0; font-size: .82rem; color: var(--muted); font-weight: 400; }
.cs-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 16px 4px; }
.cs-g2 .cs-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); }
.cs-i { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cs-i .cell { --s: 7px; }
.cs-i b { font-weight: 500; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cs-c { display: flex; }
.cs-i.wide { grid-column: span 2; }
.cs-blank { visibility: hidden; }
.cell.cs-inline { --s: 4px; padding: 0 2px; vertical-align: middle; }
@media (max-width: 640px) {
  .cs-decades .cs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .cheatsheet { padding: 16px 12px; }
}
@media print {
  .subbar, .cs-head { display: none !important; }
  .cheatsheet .cs-grid, .cheatsheet .cs-decades .cs-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
  .cheatsheet[data-grade="1"] .cs-block { break-inside: avoid; margin-top: 28px; }
  .cheatsheet[data-grade="2"] .cs-i .cell { --s: 5.5px; }
  .cheatsheet[data-grade="2"] .cs-grid { gap: 10px 4px; }
  .cheatsheet[data-grade="2"] .cs-i b { font-size: .72rem; }
  .cheatsheet[data-grade="2"] .cs-block { margin-top: 16px; }
  .cs-block h3 { break-after: avoid; }
  .cs-i { break-inside: avoid; }
}

/* games: compact enough that keyboards fit without scrolling */
.g-corner { position: absolute; top: 10px; right: 10px; z-index: 2; height: 32px; padding: 0 12px; font-size: .85rem; gap: 6px; display: inline-flex; align-items: center; }
.wd .g-corner { width: 34px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
.wd { padding: 12px; gap: 10px; }
.wd-board { gap: 5px; }
.wd-row { grid-template-columns: repeat(5, 44px); gap: 5px; }
.wd-tile { height: 42px; gap: 2px; border-radius: 8px; }
.wd-tile .cell { --s: 6px; --gap: 3px; }
.wd-tile b { font-size: .72rem; }
.wd-keys { margin-top: 10px; gap: 5px; }
.wd-k { height: 44px; gap: 2px; }
.g-msg:empty { display: none; }
.hm { flex-direction: column; gap: 10px; padding-top: 18px; }
.hm-art { width: 84px; height: 84px; }
.hm-slot { min-width: 22px; padding: 3px 2px 5px; }
.hm-slot .cell { --s: 6px; --gap: 4px; padding: 0; }
.hm-word { gap: 4px; }

.game.lv-hard .wd-k b, .game.lv-hard .wd:not(.done) .wd-tile b, .game.lv-hard .hm:not(.done) .hm-slot b { display: none; }
.sheet .example .braille-line.groups { gap: 6px 0; }
@media print { .cheatsheet[data-grade="1"] .cs-i .cell { --s: 12px; } .cheatsheet[data-grade="1"] .cs-i b { font-size: .95rem; } .cheatsheet[data-grade="1"] .cs-title { font-size: 1.7rem; } }

/* ===================== v14 ===================== */
/* dark mode: more contrast everywhere */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #12100e; --surface: #221e1a; --surface-2: #2f2a25; --ink: #f6f1e9; --ink-2: #ddd5c9; --muted: #ab9f92; --line: #4a423a;
    --dot-off: #6a6056; --dot-ring: #6a6056; --dot-fill: #4a423a; --lb-off: #4f463e; --seg-bg: #2f2a25; --seg-on: #5a5047; --input: #1b1815;
    --accent: #8db6e8; --accent-soft: #24374d; --good: #86c49d; --bad: #ea958a;
    --k-digit: #5ccfc0; --k-contraction: #8db6e8; --k-punct: #c39af0; --k-indicator: #c8b096; --k-math: #ef8cbb;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3); } }
:root[data-theme="dark"] { --bg: #12100e; --surface: #221e1a; --surface-2: #2f2a25; --ink: #f6f1e9; --ink-2: #ddd5c9; --muted: #ab9f92; --line: #4a423a;
    --dot-off: #6a6056; --dot-ring: #6a6056; --dot-fill: #4a423a; --lb-off: #4f463e; --seg-bg: #2f2a25; --seg-on: #5a5047; --input: #1b1815;
    --accent: #8db6e8; --accent-soft: #24374d; --good: #86c49d; --bad: #ea958a;
    --k-digit: #5ccfc0; --k-contraction: #8db6e8; --k-punct: #c39af0; --k-indicator: #c8b096; --k-math: #ef8cbb;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3); }
body.s-dotfill { --dot-off: var(--dot-fill); }
:root[data-theme="dark"] body.s-dotfill, :root[data-theme="dark"] body { --dot-fill: #4a423a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.s-dotfill { --dot-off: #4a423a; } }
:root[data-theme="dark"] body.s-dotfill { --dot-off: #4a423a; }
.seg button.on { background: var(--seg-on); }
:root[data-theme="dark"] .card, :root[data-theme="dark"] .stage { border-color: var(--line); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { color: var(--ink); } }

/* header: the page's tab icon beside a paler, lighter title */
.head-title { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink); }
.head-title .ht-game { width: 30px; height: 30px; border-radius: 9px; }
.head-title .ht-ic { display: grid; place-items: center; color: var(--muted); }
.head-title .ht-t { overflow: hidden; text-overflow: ellipsis; }
.brand, body[data-page="home"] .brand { display: none; }
.home-brand { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.home-brand .logo-svg { width: 45px; height: auto; }
.home-brand .brand-wm { font-size: 1.75rem; }

/* inverted pickers carry an icon */
.dd-lead { display: grid; place-items: center; margin-right: 2px; }
.dd-strong .dd-btn .dd-lead .ic { color: var(--bg); opacity: .85; }

/* practice: selected mode is inverted, like other main selections */
.modes a.on { background: var(--ink); color: var(--bg); }
.modes a.on .ic { color: var(--bg); }

/* cheat sheet print button matches the toggle */
.cs-head .btn { height: var(--ctl-h); padding: 0 16px; box-sizing: border-box; display: inline-flex; align-items: center; gap: 8px; }

/* games list: tiles, more air on top, quieter intro */
.g-tiles { border-top: 0; display: grid; gap: 10px; }
.g-tiles .hrow, .g-tiles .hrow:last-child { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 14px 16px; min-height: 0; }
.g-tiles .hrow:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.g-tiles + .sec-h { margin-top: 40px; }

/* game icon colours */
.hrow-ic[class*="gc-"], a[href^="#/games/"] .hrow-ic { --gc: var(--accent); color: var(--gc); background: color-mix(in srgb, var(--gc) 13%, var(--surface)); }
:is(.gc-wordle, a[href="#/games/wordle"] .hrow-ic) { --gc: #2f68a8; }
:is(.gc-snowman, a[href="#/games/snowman"] .hrow-ic) { --gc: #8a4fbf; }
:is(.gc-anagrams, a[href="#/games/anagrams"] .hrow-ic) { --gc: #b8407a; }
:is(.gc-agent, a[href="#/games/agent"] .hrow-ic) { --gc: #3f7d5a; }
:is(.gc-rain, a[href="#/games/rain"] .hrow-ic) { --gc: #13807a; }
:is(.gc-time, a[href="#/games/time"] .hrow-ic) { --gc: #4f5bbf; }
:is(.gc-mirror, a[href="#/games/mirror"] .hrow-ic) { --gc: #c0506a; }
:is(.gc-memory, a[href="#/games/memory"] .hrow-ic) { --gc: #6b7d2c; }
:is(.gc-maze, a[href="#/games/maze"] .hrow-ic) { --gc: #4d7590; }
:is(.gc-trivia, a[href="#/games/trivia"] .hrow-ic) { --gc: #7a3f7a; }
:is(.gc-riddles, a[href="#/games/riddles"] .hrow-ic) { --gc: #2f8ab8; }
:root[data-theme="dark"] .hrow-ic[class*="gc-"], :root[data-theme="dark"] a[href^="#/games/"] .hrow-ic { color: color-mix(in srgb, var(--gc) 55%, #fff); background: color-mix(in srgb, var(--gc) 30%, var(--surface)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.hrow-ic[class*="gc-"], a[href^="#/games/"] .hrow-ic) { color: color-mix(in srgb, var(--gc) 55%, #fff); background: color-mix(in srgb, var(--gc) 30%, var(--surface)); } }

/* settings */
.set-row.stack { flex-direction: column; align-items: stretch; gap: 10px; }
.set-row.stack > span { color: var(--ink); font-weight: 500; }
.set-row.stack .seg { width: 100%; height: auto; min-height: var(--ctl-h); }
.set-row.stack .seg button { flex: 1; justify-content: center; gap: 8px; padding: 8px 10px; }
.set-row.stack .seg button .cell { --s: 5px; padding: 0; }
.cell.pv-outline i:not(.on) { background: transparent; box-shadow: inset 0 0 0 1.2px var(--dot-ring); }
.cell.pv-fill i:not(.on) { background: var(--dot-fill); box-shadow: none; }
.set-note { margin: 0; color: var(--ink-2); font-size: .9rem; }
.reset-row { gap: 10px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.gh-link { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* practice help: keyboard tips last, small, only where a keyboard is likely */
.help .help-keys { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.help .help-keys .ic { flex: none; margin-top: 1px; }
@media (max-width: 600px) { .help .help-keys { display: none; } }

/* ===================== v15 ===================== */
/* only the chevron turns when a picker opens, not its leading icon */
.dd.open .dd-btn .dd-lead .ic { transform: none; }
.dd-btn .ic { transition: transform .2s; }
/* on-screen keyboard open: fit the content to the visible area */
body.kb-open { padding-bottom: 0; }
body.kb-open .tabbar { display: none; }
body.kb-open .practice-wrap:not(.mode-sweep) { min-height: calc(var(--vvh, 100dvh) - var(--head-h, 120px) - 12px); }
body.kb-open .mode-words #modeBody { min-height: 0; gap: 12px; padding-bottom: 8px; }
body.kb-open .mode-words .stage { min-height: 0; padding-top: 18px; padding-bottom: 18px; }

/* ---------- compact home ---------- */
.hnew { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); margin: 0 0 6px; }
.hnew .cell { flex: none; }
.hnew > div { margin-left: 6px; }
.hnew b { display: block; font-weight: 600; }
.hnew span { color: var(--ink-2); font-size: .95rem; }
.hsec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hsec-h .sec-h { margin: 0; }
.hsec-h > a { font-size: .95rem; font-weight: 500; }
.hprog { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.hprog .bar { flex: 1; max-width: 240px; height: 6px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.hprog .bar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.hsplit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.hcard { display: block; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none !important; transition: transform .1s, border-color .2s; min-width: 0; }
.hcard:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.hcard:active { transform: scale(.98); }
.hcard .k { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.hcard b { display: block; font-size: 1.05rem; font-weight: 600; margin: 4px 0 2px; overflow-wrap: anywhere; }
.hcard .d { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .85rem; color: var(--ink-2); }
.hcard.go { background: var(--accent); border-color: var(--accent); color: #fff; }
.hcard.go .k { color: #ffffffbb; }
.hcard.go .d { color: #ffffffdd; }
:root[data-theme="dark"] .hcard.go { color: #10161e; }
:root[data-theme="dark"] .hcard.go .k { color: #10161ebb; }
:root[data-theme="dark"] .hcard.go .d { color: #10161ecc; }

/* ---------- sweep box: all its styles in one place ---------- */
.sweep-box { --sw-bg: color-mix(in srgb, var(--surface) 65%, var(--surface-2)); position: relative; height: 345px; margin: 0 -4px; overflow: hidden; border-radius: 26px; background: var(--sw-bg); border: 1px solid var(--line); user-select: none; -webkit-user-select: none; touch-action: none; cursor: crosshair; }
/* Even inner shadow on all four sides, drawn above the cells and edge fades so nothing covers it. */
.sweep-box::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 14px rgba(40, 28, 16, .1); }
:root[data-theme="dark"] .sweep-box::after { box-shadow: inset 0 0 16px rgba(0, 0, 0, .4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sweep-box::after { box-shadow: inset 0 0 16px rgba(0, 0, 0, .4); } }
.sweep-box .edge { position: absolute; top: 0; bottom: 0; width: 18px; pointer-events: none; }
.sweep-box .edge.left { left: 0; background: linear-gradient(to right, var(--sw-bg), transparent); }
.sweep-box .edge.right { right: 0; background: linear-gradient(to left, var(--sw-bg), transparent); }
.sweep-top { position: absolute; z-index: 3; top: 12px; left: 14px; right: 14px; display: flex; align-items: center; gap: 8px; }
.sw-prog { flex: 1; height: 6px; margin: 0 4px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.sw-prog i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; }
.sweep-hint { position: absolute; left: 0; right: 0; bottom: 6px; padding: 8px; text-align: center; font-size: .8rem; color: var(--muted); pointer-events: none; transition: opacity .3s; }

/* Track of cells; letters appear once you have passed them. */
.sweep-track { position: absolute; left: 0; top: 82px; display: flex; align-items: flex-start; gap: 0; will-change: transform; }
.sweep-track .sc { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; }
.sweep-track .cell { --s: 18px; }
.sweep-track .sc .lbl { height: 1.3em; font-size: 1.2rem; color: var(--muted); opacity: 0; transition: opacity .2s; }
.sweep-track .sc.passed .lbl { opacity: 1; }
.sweep-track .sc.cur .lbl { color: var(--ink); }
.sweep-track .sc.kind-contraction .lbl { color: var(--accent); }

/* Reader line from the cells down to the top of the finger circle. */
.reader { position: absolute; top: 60px; height: 181px; width: 2px; margin-left: -1px; background: var(--accent); opacity: .26; pointer-events: none; }
.finger { position: absolute; top: 241px; width: 56px; height: 56px; margin-left: -28px; border-radius: 50%; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); opacity: .5; pointer-events: none; transition: opacity .2s; }
.sweep-box.active .finger { opacity: .85; }

/* Real size */
body.s-sw-real .sweep-box { height: 275px; }
body.s-sw-real .sweep-track { top: 92px; }
/* Real size: a dot 1.5 mm across, 2.5 mm between dot centres, 6.25 mm from cell to cell (--mm is a calibrated millimetre) */
body.s-sw-real .sweep-track .cell { --s: calc(var(--mm, 1mm) * 1.5); --gap: var(--mm, 1mm); padding: 0 calc(var(--mm, 1mm) * 1.125); }
body.s-sw-real .stage .prompt-cells .cell, body.s-sw-real .stage .prompt-cells.many .cell, body.s-sw-real .stage .prompt-cells.fmt .cell, body.s-sw-real .stage .prompt-cells.in-word .cell,
body.s-sw-real .spot-cells .cell, body.s-sw-real .tr-out .cell, .mm-demo .cell { --s: calc(var(--mm, 1mm) * 1.5); --gap: var(--mm, 1mm); padding-inline: calc(var(--mm, 1mm) * 1.125); }
body.s-sw-real .sweep-track .sc .lbl { font-size: .875rem; }
body.s-sw-real .reader { top: 66px; height: 119px; }
body.s-sw-real .finger { top: 185px; }

/* ---------- practice toggles at the top, two rows, no labels ---------- */
.practice-wrap.mode-sweep .picker, .practice-wrap.mode-words .picker { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; }
.practice-wrap .sw-row { display: flex; gap: 8px; min-width: 0; }
.practice-wrap .sw-row > .seg { flex: 1 1 0; display: flex; min-width: 0; }
.practice-wrap .sw-row > .seg button { flex: 1; min-width: 0; padding-inline: 4px; justify-content: center; text-align: center; }
.sweep-box { margin-top: 6px; }

/* ---------- calmer home ---------- */
body[data-page="home"] .head-title { visibility: hidden; }
body[data-page="home"] .top:not(.scrolled) { border-bottom-color: transparent; box-shadow: none; }
.hcard.go, :root[data-theme="dark"] .hcard.go { background: var(--surface); border-color: var(--line); color: var(--ink); }
.hcard.go .k, :root[data-theme="dark"] .hcard.go .k { color: var(--accent); }
.hcard.go .d, :root[data-theme="dark"] .hcard.go .d { color: var(--ink-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hcard.go { color: var(--ink); } :root:not([data-theme="light"]) .hcard.go .k { color: var(--accent); } :root:not([data-theme="light"]) .hcard.go .d { color: var(--ink-2); } }

.hsec { margin-top: 34px; }
.home-head { margin-bottom: 4px; }
/* Secret Agent message is one line that scrolls sideways, keeping the current word centred (leaves room for the keyboard) */
.ag-msg { position: relative; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.ag-msg::-webkit-scrollbar { display: none; }
.ag-w { flex: none; }

/* ---------- Translate, braille to text ---------- */
.tr-dir { margin: 2px 0 14px; }
.tr-dir .seg { display: flex; }
.tr-dir .seg button { flex: 1; justify-content: center; text-align: center; }
.tb-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; align-items: center; scrollbar-width: thin; }
.tb-cell { flex: none; display: grid; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.tb-cell.cur { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tb-dot { border-radius: 50%; border: 0; padding: 0; cursor: pointer; background: transparent; box-shadow: inset 0 0 0 2px var(--off, #cfc6b8); touch-action: manipulation; }
.tb-dot.on { background: var(--ink); box-shadow: none; }
.tb-add { flex: none; background: none; cursor: pointer; }

.tb-h { font-size: 1rem; font-weight: 600; margin: 0 0 8px; }
.tb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tb-list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.tb-list li > b { font-size: 1.25rem; font-weight: 600; }
.tb-list li > span { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); }
.tb-tok { display: inline-flex; align-items: center; gap: 6px; }
.tb-tok i { font-style: normal; color: var(--ink); font-weight: 500; }
.tb-c { display: inline-flex; }

/* ---------- games round ---------- */
/* One stats row: left, centre, right */
.g-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; font-size: .92rem; color: var(--muted); margin: 0 0 12px; min-height: 32px; }
.g-bar b { color: var(--ink); font-weight: 600; }
.g-bar .r { text-align: right; justify-self: end; white-space: nowrap; }
.g-bar .c { justify-self: center; }
.g-best { color: var(--muted); }
.g-bar .small-btn { padding: 5px 12px; font-size: .85rem; }
/* Start screens */
.g-overlay { padding: 18px; text-align: center; }
.g-how { margin: 0; max-width: 34ch; color: var(--ink-2); }
.g-incl { margin: 0; max-width: 36ch; font-size: .9rem; color: var(--muted); }
.g-incl b { color: var(--ink); font-weight: 600; }
/* Header slot (Secret Agent case, Trivia topic) and in-page level row with question count */
.g-slot { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
.g-slot:empty { display: none; }
.g-sub:has(.g-slot:empty) { justify-content: space-between; }
.g-lvrow { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; }
.g-qstats { display: flex; gap: 14px; font-size: .92rem; color: var(--muted); }
.g-qstats b { color: var(--ink); font-weight: 600; }
.g-qstats > span { white-space: nowrap; }
/* Memory: the back is a light card with an empty braille cell, so it reads as a card to turn over. */
.mem-back { background: var(--surface); box-shadow: 0 1px 4px rgba(40, 28, 16, .1); }
.mem-back::after, .mem-grid.n15 .mem-back::after { inset: 0; border-radius: inherit; border: 1px solid var(--line); }
.mem-back .cell { --s: clamp(6px, 2.2vw, 10px); --off: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.mem-grid.n15 .mem-back .cell { --s: clamp(5px, 1.7vw, 8px); }
/* Snowman */
.sm-art .ghost > * { stroke: color-mix(in srgb, var(--ink) 18%, transparent); stroke-dasharray: 3 4; fill: none; stroke-width: 2; }
.sm-art .parts .p { opacity: 0; }
.sm-art .parts .p.on { opacity: 1; stroke: var(--ink); }
.sm-art .parts circle.p.on { fill: var(--surface); }
.sm-art .base { stroke: var(--line); }
/* Anagrams: draggable tiles */
.an-cells { gap: 6px; }
.an-t { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 6px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; position: relative; transition: border-color .2s, background .2s; }
.an-t .lbl { min-height: 1.2em; font-size: .9rem; color: var(--ink); font-weight: 600; }
.an-t.drag { z-index: 3; cursor: grabbing; box-shadow: 0 8px 22px rgba(40, 28, 16, .2); border-color: var(--accent); }
.an.solved .an-t { border-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.an-tip { margin-top: 14px; }
/* Secret Agent */
.ag-prog { display: flex; align-items: center; gap: 12px; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ag-prog .bar { flex: 1; height: 6px; border-radius: 9px; background: var(--seg-bg); overflow: hidden; }
.ag-prog .bar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; transition: width .4s; }
.ag-title { display: block; font-size: 1.3rem; font-weight: 600; }
.ag-done .row { gap: 10px; flex-wrap: wrap; }
/* Maze */
.mz-target { text-align: center; color: var(--muted); margin: 0 0 12px; font-size: 1rem; }
.mz-target b { display: block; font-size: 1.7rem; font-weight: 600; color: var(--ink); letter-spacing: .02em; }
.mz-cell.here { box-shadow: inset 0 0 0 3px var(--accent); }
/* Type */
.practice-wrap .sw-row.fit { flex-wrap: wrap; }
.practice-wrap .sw-row.fit > .seg:first-child { flex: 2 1 130px; }
.practice-wrap .sw-row.fit > .seg:last-child { flex: 3 1 180px; }

/* Translate */
.subbar .tr-dir { flex: none; display: flex; margin: 0; height: var(--ctl-h); box-sizing: border-box; align-items: stretch; }
.subbar .tr-dir button { padding: 0 12px; display: grid; place-items: center; height: auto; }
.subbar:has(.tr-dir) { align-items: center; }
.subbar:has(.tr-dir) .dd-strong .dd-btn { height: var(--ctl-h); box-sizing: border-box; padding-top: 0; padding-bottom: 0; }
#langDD[hidden] { display: none; }
.tr-ex { margin: 0 0 10px; }
.tb-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.tb-cell { grid-template-columns: repeat(2, 30px); grid-auto-rows: 30px; gap: 6px; padding: 10px; }
.tb-dot { width: 30px; height: 30px; }
.tb-del { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.tb-del:hover { color: var(--bad); background: var(--surface-2); }
.tb-add { width: auto; height: auto; border: 0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; color: var(--accent); padding: 4px 6px; align-self: flex-start; margin-top: 30px; }
.tb-add span { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1.8rem; line-height: 46px; font-weight: 400; }
:root[data-theme="dark"] .tb-add span { color: #10161e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tb-add span { color: #10161e; } }

/* ---------- on-screen letter keyboard for games ---------- */
.g-kb { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.g-kb.off { opacity: .4; pointer-events: none; }
.g-kr { display: flex; gap: 5px; justify-content: center; }
.g-kr button { flex: 1 1 0; max-width: 48px; height: 46px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 1.1rem; cursor: pointer; padding: 0; box-shadow: 0 1px 0 var(--line); }
.g-kr button:active { background: var(--seg-bg); transform: translateY(1px); }
.g-kr button.wide { flex: 1.5 1 0; max-width: 72px; color: var(--ink-2); }

/* tighter game layouts */
.g-bar:has(.ta-bar) { grid-template-columns: auto 1fr auto; }
.g-bar .c:has(.ta-bar) { justify-self: stretch; display: flex; align-items: center; padding: 0 8px; }
.g-bar .ta-bar { flex: 1; }
.g-card.ta { position: relative; }
.rain-typed { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 1; font-size: 1.3rem; letter-spacing: .08em; color: var(--ink); pointer-events: none; min-height: 1.4em; }
.rain-typed.empty { display: none; }
.rain-field { height: clamp(240px, calc(100dvh - var(--head-h, 120px) - var(--tabbar-h, 0px) - 280px), 540px); }
.game-agent .ag-prog { margin: 0 2px 10px; }
.ag-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ag-top .ag-title { margin: 0; }
.ag-top #hint { padding: 5px 12px; font-size: .85rem; flex: none; }
.ag-msg { --sw-bg: color-mix(in srgb, var(--surface) 65%, var(--surface-2)); background: var(--sw-bg); border: 1px solid var(--line); box-shadow: inset 0 0 14px rgba(40, 28, 16, .1); }
:root[data-theme="dark"] .ag-msg { box-shadow: inset 0 0 16px rgba(0, 0, 0, .4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ag-msg { box-shadow: inset 0 0 16px rgba(0, 0, 0, .4); } }

/* timer bar with text inside, roomier scores, shared braille keyboard, quizzes, maze, confirm */
.g-bar .ta-bar { position: relative; height: 24px; margin: 0; min-width: 80px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.ta-bar .ta-fill { position: absolute; inset: 0; background: var(--accent); clip-path: inset(0 0 0 0 round 999px); }
.ta-bar .ta-t { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); line-height: 1; }
.ta-bar .ta-fill .ta-t { color: #fff; }
.g-sep { margin: 0 8px; color: color-mix(in srgb, var(--muted) 55%, transparent); }
.g-score, .g-best { white-space: nowrap; }
.g-best b { color: var(--ink-2); }
.wd-k:disabled { cursor: default; }
.hm-kb { margin-top: 12px; }
.wd .g-confirm { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; border-radius: inherit; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.g-confirm[hidden] { display: none; }
.g-confirm-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: 0 10px 30px rgba(40, 28, 16, .18); text-align: center; max-width: 300px; }
.g-confirm-box p { margin: 0 0 12px; }
.g-confirm-box .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.g-qstats { align-items: center; margin: 0 0 12px; min-height: 36px; }
.g-qslot { margin-left: auto; }
.g-qslot:empty { display: none; }
.q-next { position: sticky; bottom: calc(var(--tabbar-h, 0px) + env(safe-area-inset-bottom) + 10px); z-index: 6; display: flex; justify-content: center; margin-top: 14px; }
.q-next .btn { width: min(100%, 360px); min-height: 50px; justify-content: center; box-shadow: 0 6px 18px rgba(40, 28, 16, .18); }
.q-next .btn[hidden] { display: inline-flex; visibility: hidden; }
.mz-card .mz-target { display: flex; align-items: baseline; justify-content: center; gap: 8px; font-size: 1rem; color: var(--muted); }
.mz-card .mz-target b { display: inline; font-size: 1.5rem; font-weight: 700; letter-spacing: .03em; }
.mz-target b span { color: color-mix(in srgb, var(--muted) 55%, transparent); transition: color .25s; }
.mz-target b span.got { color: var(--accent); }
.mz-target b.won span { color: var(--good); }

.g-tiles:last-child { margin-bottom: 42px; }

/* a label that covers several cells runs across them, with a line after the letters to the end of the last cell.
   Cells sit edge to edge (no column gap), so n × the cell width is exactly the span. 18% matches the cell's side padding. */
.lbl.span { display: flex; align-items: center; align-self: flex-start; box-sizing: border-box; width: calc(var(--n) * 100%); padding: 0 18%; text-align: left; position: relative; z-index: 1; }
.lbl.span::after { content: ''; flex: 1 1 auto; min-width: 0; height: 1.5px; margin-left: .3em; border-radius: 1px; background: currentColor; opacity: .45; }
.lbl.span:empty::after { display: none; }
/* ---------- Learn: index, lesson check, collapsible Grade 2 groups ---------- */
.li-h { margin-top: 8px; }
body[data-page="reference"] .lead-p.li-p { margin: 0 0 14px; }
.li-prog { margin: 0 0 16px; }
.hrow-ic .lic { display: flex; gap: 3px; }
.hrow-ic .lic .cell { --s: 7px; --gap: 3px; --on: currentColor; --off: color-mix(in srgb, currentColor 32%, transparent); }
.hrow.li-done .hrow-ic { color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.g-tiles .hrow.li-next, .g-tiles .hrow.li-next:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.hrow.li-next .hrow-ic { background: var(--accent); color: #fff; }
.ref-back { flex: none; width: var(--ctl-h); justify-content: center; margin-left: -8px; }
.lq-wrap { margin-top: 48px; }
.lq { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 22px 18px 24px; text-align: center; max-width: 560px; transition: box-shadow .3s, border-color .3s; }
.lq.glow-good { animation: glowGood .9s ease-out forwards; border-color: color-mix(in srgb, var(--good) 60%, var(--line)); }
.lq.glow-bad { animation: glowBad .8s ease-out forwards, shakeSm .2s linear; border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.lq .prompt-cells { display: flex; justify-content: center; }
.lq .prompt-cells .cell { --s: clamp(11px, 3.7vw, 18px); }
.lq .lq-q { margin: 0; font-size: 1.1rem; font-weight: 500; color: var(--ink); max-width: 32ch; }
.lq .choices { max-width: 440px; }
.lq-pips { display: flex; gap: 6px; }
.lq-pips i { width: 22px; height: 4px; border-radius: 4px; background: var(--surface-2); }
.lq-pips i.past { background: var(--accent); }
.lq-pips i.now { background: color-mix(in srgb, var(--accent) 45%, var(--surface-2)); }
.lq-score { display: flex; align-items: center; gap: 10px; font-size: 2rem; margin-top: 8px; }
.lq-score.pass { color: var(--good); }
.lq-row { justify-content: center; margin: 0; }
.count.lq-done { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }

.g2-groups { border-bottom: 1px solid var(--line); }
.g2-group { border-top: 1px solid var(--line); scroll-margin-top: 120px; }
.g2-group summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 16px 4px; }
.g2-group summary::-webkit-details-marker { display: none; }
.g2-group .g2-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.g2-group h3 { margin: 0; font-size: 1.08rem; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.g2-group h3 .count { font-size: .72rem; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; letter-spacing: .01em; line-height: 1.3; }
.g2-group summary small { color: var(--muted); font-size: .9rem; }
.g2-group summary > .ic { color: var(--muted); transition: transform .2s; flex: none; }
.g2-group[open] summary > .ic { transform: rotate(180deg); }
.g2-body { padding: 0 0 26px; }
.g2-body .gt-link { display: inline-flex; align-items: center; margin: 0 0 12px; }
.g2-groups + .ex-block { margin-top: 32px; }
@media (max-width: 560px) {
  .cell-anatomy { flex-direction: column; align-items: flex-start; gap: 18px; }
  .cell-anatomy > .cell { align-self: center; }
}
@media (max-width: 360px) { .plate .cell { --s: 6px; } }
@media (max-width: 380px) { .ref-back ~ #secDD .dd-lead { display: none !important; } .ref-back { width: 28px; } .ref-back ~ #secDD { min-width: 0; flex: 0 1 auto; } .ref-back ~ #secDD .dd-btn { max-width: 100%; } .ref-back ~ #secDD .dd-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; } .subbar:has(.ref-back) { gap: 6px; } }

/* polish round */
/* games list */
.g-tiles.hrows .hrow:last-child { border-bottom: 1px solid var(--line); }
.g-tiles .hrow-ic { width: 55px; height: 55px; border-radius: 16px; }
/* Games page: two columns of tiles (three or four on wider screens). */
.g-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.g-grid .hrow, .g-grid .hrow:last-child { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
.g-grid .hrow-ic { width: 40px; height: 40px; border-radius: 12px; }
.g-grid .hrow-text span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .82rem; line-height: 1.35; }
body[data-page="games"] #view > .sec-h:first-child { margin-top: 20px; }
@media (min-width: 900px) { .g-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); } }
/* stats row: an empty left slot takes no room */
.g-bar:has(> .l:empty) { grid-template-columns: 1fr auto; }
.g-bar > .l:empty { display: none; }
.g-bar:has(> .l:empty) .c:has(.ta-bar) { padding-left: 0; }
/* start screens: Includes under Start */
.g-overlay .g-incl { margin-top: -4px; }
@media (max-height: 760px) {
  .g-overlay { gap: 8px; padding: 12px 16px; }
  .g-overlay .g-how { font-size: .95rem; }
  .ta .prompt-cells .cell, .mm .prompt-cells .cell { --s: 18px; }
  .g-kb { gap: 5px; margin-top: 10px; }
  .g-kr button { height: 40px; }
}
/* Secret Agent: letters under each cell */
.ag-w .lbl { font-size: .95rem; color: var(--ink-2); min-height: 1.25em; }
.ag-w.cur .lbl { color: var(--accent); font-weight: 500; }
.ag-w.done .lbl { color: var(--good); font-weight: 500; }
.ag-w .lbl .bad, .stage .lbl .bad { color: var(--bad); }
/* Maze */
.mz-card .mz-target { margin: -10px 0 2px; }
.mz-new { position: relative; overflow: hidden; isolation: isolate; }
.mz-new .fill { position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--accent) 22%, transparent); transform: scaleX(0); transform-origin: left; }
.mz-new.filling .fill { animation: mzfill 3s linear forwards; }
@keyframes mzfill { to { transform: scaleX(1); } }
/* quizzes */
.quiz .quiz-q { margin-bottom: 10px; }
.quiz-print { display: block; visibility: hidden; }
.quiz.revealed .quiz-print { visibility: visible; }
.g-solved { font-size: .92rem; color: var(--muted); }
.g-solved b { color: var(--ink); font-weight: 600; }
/* settings resets */
.reset-list { display: grid; gap: 10px; margin-top: 10px; }
.reset-list .reset-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reset-list .reset-row span { display: grid; gap: 2px; }
.reset-list .reset-row small { color: var(--muted); font-size: .8rem; }
.reset-list .reset-row .btn { flex: none; min-width: 92px; justify-content: center; }
.reset-list .btn.small-btn { height: 32px; min-width: 72px; padding: 0 12px; font-size: .82rem; border-radius: 999px; }
/* home: tally text only */
.hprog .bar { display: none; }
/* Learn tables: one cells column per table */
.ctable.cw .crow, .ctable.narrow.cw .crow { grid-template-columns: var(--cw) minmax(0, 1fr) auto; }
/* Grade 2 */
.practise-row { display: flex; justify-content: flex-start; margin: 12px 0 4px; }
.practise-btn { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); gap: 4px; }
.practise-btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none; }
.crow b .pre { color: var(--muted); opacity: .6; font-weight: 400; margin-right: 1px; }
.crow.has-ex .ex-tog { grid-column: 3; grid-row: 1; align-self: center; justify-self: end; background: none; border: 0; padding: 4px 2px; font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer; }
.crow.has-ex .ex-tog.open { color: var(--accent); }
.crow-ex { grid-column: 1 / -1; display: grid; gap: 8px; margin: 10px 0 4px; }
.crow-ex[hidden] { display: none; }
.g2ex { display: grid; grid-template-columns: 22px auto minmax(0, 1fr); align-items: center; column-gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.g2ex-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.g2ex.ok .g2ex-mark { color: #fff; background: var(--good); }
.g2ex.no { border-color: color-mix(in srgb, #c97a1a 45%, var(--line)); background: color-mix(in srgb, #c97a1a 7%, var(--surface)); }
.g2ex.no .g2ex-mark { color: #c97a1a; border-radius: 0; }
.g2ex-t { display: grid; gap: 1px; min-width: 0; }
.g2ex-t b { font-weight: 600; }
.g2ex.no .g2ex-t b { color: #b76a10; }
.g2ex-t small { color: var(--muted); font-size: .8rem; }
.g2ex-b .braille-line { flex-wrap: nowrap; }
.g2-compare { padding: 0; overflow: hidden; }
.g2c-scroll { overflow-x: auto; padding: 14px 16px; scrollbar-width: thin; }
.g2c-grid { display: grid; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: max-content; column-gap: 14px; row-gap: 10px; align-items: end; width: max-content; }
.g2-compare .g2c-k { display: grid; gap: 0; color: var(--muted); font-size: .78rem; line-height: 1.2; position: sticky; left: -16px; background: var(--surface); padding: 0 8px 4px 0; margin: 0; z-index: 1; align-self: stretch; align-content: end; }
.g2c-k span { color: var(--ink-2); }
.g2c-w .braille-line { flex-wrap: nowrap; }
/* Translate: Clear all in the header */
.subbar .tr-clear { margin-left: auto; }
/* Practice: Type */
.w-top { display: flex; justify-content: space-between; gap: 10px; width: 100%; margin-bottom: 8px; }
.w-top .small-btn { padding: 5px 12px; font-size: .85rem; }
.mode-words #wkb { margin-top: 12px; }
.mode-words .stage .prompt-cells.words .lbl { min-height: 1.2em; }
.mode-words .stage .prompt-cells.words .lbl:empty { min-height: 1.2em; }
/* Answer slots: one under each cell that takes letters; the next one is outlined, right ones go green, wrong ones red. */
.stage .prompt-cells.slots { row-gap: 10px; }
.stage .prompt-cells.slots .bw { width: var(--slot); gap: 8px; }
.stage .prompt-cells.slots .lbl { min-height: calc(var(--slot) * 1.15); }
.stage .prompt-cells.slots .lbl.slot { display: flex; align-items: center; justify-content: center; width: calc(var(--slot) - 4px); height: calc(var(--slot) * 1.15); padding: 0;
  border-radius: 9px; background: var(--bg); box-shadow: inset 0 -2px 0 var(--line); font-size: min(1.25rem, calc(var(--slot) * .6)); font-weight: 600; color: var(--ink); transition: background .15s, box-shadow .15s; }
.stage .prompt-cells.slots .lbl.slot.span { width: calc(var(--n) * var(--slot) - 4px); align-self: flex-start; }
.stage .prompt-cells.slots .lbl.slot.span::after { display: none; }
.stage .prompt-cells.slots .lbl.slot.multi { font-size: min(1rem, calc(var(--slot) * .42)); }
.stage .prompt-cells.slots .lbl.cur { background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); }
.stage .prompt-cells.slots .lbl.done { background: color-mix(in srgb, var(--good) 16%, var(--surface)); box-shadow: none; }
.stage .prompt-cells.slots .lbl.miss { background: color-mix(in srgb, var(--bad) 9%, var(--surface)); box-shadow: inset 0 0 0 2px var(--bad); }
.stage .prompt-cells.slots .lbl .bad { color: var(--bad); }
/* Practice: Read box centred in the space below the toggles */
.practice-wrap.mode-sweep { display: flex; flex-direction: column; min-height: calc(100dvh - var(--head-h, 120px) - var(--tabbar-h, 0px) - env(safe-area-inset-bottom) - 22px); }
.practice-wrap.mode-sweep #modeBody { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
/* Practice: Guess and Draw known count + pills */
.mastery-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .92rem; color: var(--muted); }
.mastery-h b { color: var(--ink); font-weight: 600; }
.m-more { border-radius: 10px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.m-more .ic { transition: transform .2s; }
.m-more.open .ic { transform: rotate(180deg); }
.mastery { position: relative; }
.mastery.clamp { max-height: calc(28px * 2 + 4px); overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent); mask-image: linear-gradient(to bottom, #000 62%, transparent); }
/* Practice: Draw, one pad per cell */
.pads { display: flex; gap: 12px; justify-content: center; flex-wrap: nowrap; }
.pads .dotpad { transition: border-color .2s, background .2s; }
.pads .dotpad.ok { border-color: color-mix(in srgb, var(--good) 60%, var(--line)); background: color-mix(in srgb, var(--good) 8%, var(--bg)); }
.pads .dotpad.bad { animation: padbad .8s ease-out; }
@keyframes padbad { 0%, 40% { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--bg)); } 100% { border-color: var(--line); } }
.pads:not([style*="--n:1"]) .dotpad { --b: min(53px, calc((min(100vw, 720px) - 84px - 12px * (var(--n) - 1)) / var(--n) / 2.95)); grid-template-columns: repeat(2, var(--b)); grid-template-rows: repeat(3, var(--b)); gap: calc(var(--b) * .19); padding: calc(var(--b) * .26); }
.m-more[hidden] { display: none; }
/* Type's Hint and Skip sit in the card's top corners, like Read's buttons */
.mode-words .stage { padding-top: 58px; }
.mode-words .w-top { position: absolute; top: 12px; left: 14px; right: 14px; margin: 0; width: auto; }
/* quieter Known chevron */
.m-more { border: 0; background: none; width: 30px; height: 28px; color: var(--muted); }
.m-more:hover { color: var(--ink); }
/* Cheat Sheet Print on the right */
.cs-head .row { flex: 1 1 100%; }
.cs-head #csPrint { margin-left: auto; }
/* Trivia and Riddles answers wrap inside their box when a word is too long for one row */
.quiz-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .quiz-opts { grid-template-columns: minmax(0, 1fr); } }
.quiz-opt { min-width: 0; }
.quiz-opt .braille-line { max-width: 100%; }
.quiz-opt .bword { flex-wrap: wrap; justify-content: center; max-width: 100%; }
.quiz-opt .quiz-print { overflow-wrap: anywhere; }

/* practice help lists the set; Auto intro card */
.help-mode { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 16px 0 4px; }
.help-mode summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; font-weight: 500; }
.help-mode summary::-webkit-details-marker { display: none; }
.help-mode summary .ic { color: var(--muted); transition: transform .2s; flex: none; }
.help-mode[open] summary .ic { transform: rotate(180deg); }
.help-mode > div { padding: 0 0 14px; }
.help-h { font-size: 1rem; font-weight: 600; margin: 20px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.help-h .count { color: var(--muted); font-weight: 400; font-size: .85rem; }
.help .ctable.help-list { margin: 0; }
.intro { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.intro-tag { font-size: .85rem; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 3px 10px; border-radius: 99px; }
.intro .prompt-cells { margin: 6px 0 0; }
.intro-ans { font-size: 2.2rem; font-weight: 600; line-height: 1.1; }
.intro-note { margin: 0; color: var(--muted); font-size: .9rem; max-width: 34ch; }
.intro .btn { margin-top: 6px; min-width: 140px; }

/* Update-ready bar (shown when a new deploy lands while the app is open) */
.upd-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 18px; border-radius: 99px; background: var(--ink, #1c1917); color: var(--bg); box-shadow: 0 6px 24px rgb(0 0 0 / .18); font-weight: 500; }
.upd-bar .btn { min-height: 34px; padding: 0 16px; background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 900px) { .upd-bar { bottom: 24px; } }

/* Search: a long result (a sign or phrase) puts its braille on its own line under the title */
.sr.long { grid-template-columns: minmax(0, 1fr) auto; }
.sr.long .sr-cells { grid-column: 1 / -1; order: 2; }
@media (max-width: 480px) { .sr.long { grid-template-columns: minmax(0, 1fr); } }
.g2c-scroll.more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
/* Game keyboards: keys a level never needs are dimmed */
.g-kr button.dim { opacity: .3; box-shadow: none; cursor: default; }
/* Laptop: the practice mode bar sits in the same centred column as the picker and card, and the card uses the room */
@media (min-width: 760px) {
  body[data-page="practice"] .subbar { justify-content: center; }
  body[data-page="practice"] .subbar .modes { flex: 0 1 720px; max-width: 720px; }
  body[data-page="practice"] .subbar #helpBtn { margin-left: 0; }
}
@media (min-width: 900px) and (min-height: 700px) {
  .stage { min-height: 380px; padding: 40px 28px; }
  .stage .prompt-cells .cell { --s: 30px; }
  .stage .prompt-cells.many .cell { --s: 16px; }
}
/* Games list: best score or Played, beside the chevron */
/* Type mode score line, between the card and the keyboard */
.w-score { display: flex; justify-content: center; gap: 18px; font-size: .88rem; color: var(--muted); margin: 12px 0 2px; flex-wrap: wrap; row-gap: 4px; }
.w-score b { color: var(--ink); font-weight: 600; }
/* End-of-round summary in Guess, Draw and Type. */
.rsum { width: 100%; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.rsum h3 { margin: 0; font-size: 1.25rem; font-weight: 600; text-align: center; }
.rs-big { font-size: 3.2rem; font-weight: 600; line-height: 1; text-align: center; letter-spacing: -.02em; }
.rs-big small { font-size: 1.35rem; font-weight: 400; color: var(--muted); }
.rs-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rs-facts div { background: var(--surface-2); border-radius: 12px; padding: 10px 6px; text-align: center; font-size: .78rem; color: var(--muted); }
.rs-facts b { display: block; font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.rs-k { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 -8px; }
.rs-clean { text-align: center; margin: 0; text-transform: none; letter-spacing: 0; font-size: .92rem; }
.ctable.rs-rows { grid-template-columns: 1fr; }
.rs-rows .crow { cursor: default; }
.rs-rows .crow:hover { background: none; }
.rs-acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
/* Home: one overall progress line under the logo */
/* Long Learn pages fold by section (Numbers, Signs) */
.fold .g2-body { padding: 0 0 22px; }
.fold .g2-body > .group-title:first-child h3 { display: none; }
.fold .g2-body > .group-title:first-child { margin-top: 0; }
/* Translate: Line / As a sign */
.tr-view { display: flex; margin: 0 0 10px; }
.tr-out.as-sign { padding: 16px; }
.tr-sign { grid-template-columns: minmax(0, 1fr); }
.tr-sign .plate { width: 100%; }
.tr-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.tr-sign .plate .braille-line { width: 100%; align-self: stretch; }
/* A second miss outlines the right answer. */
.choice.reveal { border: 2px dashed var(--good); }
.m-sep { color: var(--muted); margin: 0 4px; }
.backup-row .row { display: flex; gap: 8px; flex: none; }
/* Stats page (#/practice/stats) */
.st-page { max-width: 720px; margin: 0 auto; }
.st-page .sec-h { margin: 34px 0 12px; }
.st-top, .st-boxes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.st-boxes { grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
.st-top > div, .st-boxes > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.st-top b { font-size: 1.8rem; font-weight: 600; line-height: 1.1; }
.st-boxes b { font-size: 1.3rem; font-weight: 600; }
.st-top span, .st-boxes span { color: var(--muted); font-size: .85rem; }
.st-cal { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; max-width: 480px; }
.st-cal i { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); }
.st-cal i.on { background: color-mix(in srgb, var(--accent) calc(var(--a, 1) * 100%), var(--surface-2)); }
.st-calx { display: grid; grid-template-columns: 30px minmax(0, 480px); column-gap: 6px; row-gap: 4px; }
.st-calx .st-cal { max-width: none; }
.st-cal i.today { box-shadow: inset 0 0 0 2px var(--accent); }
.st-cal-m { display: grid; font-size: .72rem; color: var(--muted); }
.st-cal-m span { white-space: nowrap; overflow: visible; }
.st-cal-d { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; font-size: .68rem; color: var(--muted); align-items: center; }
.st-cal-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; max-width: 480px; margin: 10px 0 0 36px; font-size: .8rem; color: var(--muted); }
.st-leg { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.st-leg i { width: 11px; height: 11px; border-radius: 3px; background: color-mix(in srgb, var(--accent) calc(var(--a, 0) * 100%), var(--surface-2)); }
.st-table { width: 100%; border-collapse: collapse; }
.st-table th, .st-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); font-weight: 500; }
.st-table thead th { color: var(--muted); font-size: .85rem; }
.st-table th[scope="row"] { width: 30%; font-size: .92rem; }
.st-bar { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .85rem; }
.st-bar:hover { text-decoration: none; }
.st-track { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); display: flex; overflow: hidden; }
.st-track .k, .st-key .k { background: var(--good); }
.st-track .l, .st-key .l { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.st-n { min-width: 48px; text-align: right; }
.st-key span { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 8px; vertical-align: -1px; }
.st-key span:first-child { margin-left: 0; }
.st-row { margin-top: 16px; }
.mastery-h .st-link { font-size: .85rem; }
/* Sign Hunt: a directory plate whose lines are buttons */
:is(.gc-signhunt, a[href="#/games/signhunt"] .hrow-ic) { --gc: #2b6f8f; }
.hunt-q { margin: 0; font-size: 1.1rem; text-align: center; }
.hunt-plate { width: min(100%, 420px); cursor: default; gap: 6px; padding: 16px 14px; min-height: 0; }
.hunt-line { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; background: rgba(255, 255, 255, .04); cursor: pointer; font: inherit; color: inherit; text-align: left; }
.hunt-line:hover { border-color: rgba(255, 255, 255, .25); }
.hunt-line.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 22%, transparent); }
.hunt-line.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 22%, transparent); }
.hunt-line .cell { --on: #f4f0e8; --off: rgba(255, 255, 255, .1); --s: var(--hs, 6px); }
.hunt-line:disabled { cursor: default; }
.hunt-line:disabled:not(.right, .wrong) { opacity: .55; border-color: transparent; }
.hunt-plate .btn { align-self: center; }
@media (max-width: 420px) { .g-card.hunt { padding-inline: 10px; } .hunt-plate { padding: 12px 8px; } .hunt-line { padding: 8px 6px; } }
.sw-info { text-align: center; color: var(--muted); font-size: .88rem; margin: 12px 0 0; min-height: 1.3em; } .sw-info b { color: var(--ink); }

/* ---------- Home Stats section and the Stats modal ---------- */
.h-stats { display: grid; gap: 10px; margin-top: 12px; }
.hs-top { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.hs-top > div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.hs-top b { font-size: 1.5rem; font-weight: 600; line-height: 1.1; }
.hs-top span { color: var(--muted); font-size: .82rem; }
.hs-row { display: grid; grid-template-columns: 7.5em 1fr auto; align-items: center; gap: 12px; color: var(--ink-2); font-size: .92rem; }
.hs-row:hover { text-decoration: none; }
.hs-row .st-track { height: 10px; }
.hs-n { min-width: 56px; text-align: right; color: var(--muted); font-size: .85rem; }
.hs-n b { color: var(--ink); font-weight: 600; font-size: .95rem; }
.h-stats .st-key { margin: 2px 0 0; }
.sheet:has(.st-page) { width: min(600px, calc(100vw - 32px)); }
.sheet .st-page .sec-h { margin: 24px 0 10px; font-size: 1.1rem; }
.sheet .st-page .st-top b { font-size: 1.5rem; }
/* Translate: the language picker sits on the right of the header */
.subbar #langDD { margin-left: auto; }

/* Guess: a sign inside a real word; the other cells of the word are faded */
.prompt-cells .cell.dim { opacity: .15; }
.stage .prompt-cells.in-word { flex-wrap: nowrap; }
/* Everyday formats: words stay whole and wrap between each other */
.stage .prompt-cells.fmt { column-gap: clamp(14px, 4vw, 26px); row-gap: 12px; }
.prompt-cells.fmt .pc-word { display: inline-flex; }
.stage .prompt-cells.fmt .cell { --s: clamp(7px, 2.3vw, 14px); }
.stage .prompt-cells.in-word .cell { --s: clamp(9px, 2.9vw, 18px); }

/* ---------- Practice: Spot the right brailling ---------- */
.spot-q { font-size: 1.15rem; text-align: center; margin: 0 0 14px; outline: none; }
.spot-q b { font-size: 1.5rem; font-weight: 600; display: block; margin-top: 2px; }
.spot-opts { display: grid; gap: 10px; width: 100%; max-width: 520px; }
.spot-opt { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); cursor: pointer; text-align: left; }
.spot-opt:hover { border-color: var(--accent); }
.spot-n { width: 22px; flex: none; color: var(--muted); font-size: .85rem; font-weight: 500; }
.spot-cells { display: flex; flex-wrap: wrap; gap: 4px 0; }
.spot-cells .cell { --s: 8px; }
.spot-opt.right { background: color-mix(in srgb, var(--good) 18%, var(--surface)); border-color: var(--good); }
.spot-opt.wrong { background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border-color: var(--bad); animation: shakeSm .2s linear; }
.spot-opt.dim { opacity: .55; }
.spot-why { min-height: 2.8em; margin: 12px 0 0; max-width: 520px; font-size: .95rem; color: var(--ink-2, var(--ink)); text-align: center; }
.spot-next { min-height: var(--ctl-h); }

/* ---------- Learn: Watch Out (common Grade 2 mistakes) ---------- */
.mk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.mk { display: grid; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.mk .print { font-size: 1.1rem; font-weight: 500; }
.mk-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; column-gap: 10px; }
.mk-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.mk-row.ok .mk-mark { background: var(--good); }
.mk-row.no .mk-mark { background: var(--bad); }
.mk-row.no .braille-line { opacity: .85; }
.mk-row .braille-line { flex-wrap: wrap; }
.mk-why { margin: 0; font-size: .85rem; color: var(--muted); }

/* ---------- Contraction Hunt ---------- */
:is(.gc-chunt, a[href="#/games/chunt"] .hrow-ic) { --gc: #a0602a; }
.ch-q { margin: 0; font-size: 1.1rem; text-align: center; }
.ch-q b { font-weight: 600; }
.ch-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 18px 0 6px; }
.ch-c { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 7px 5px; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
.ch-c:hover:not(:disabled) { border-color: var(--accent); }
.ch-c .cell { --s: clamp(8px, 2.5vw, 12px); padding: 0; }
.ch-c .lbl { min-height: 1.2em; font-size: .85rem; color: var(--muted); }
.ch-c.got { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.ch-c.miss { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.ch-c.sign .lbl { color: var(--accent); font-weight: 600; }
.ch-c:disabled { cursor: default; }
.ch-left { margin: 0; min-height: 1.5em; text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Proofreader ---------- */
:is(.gc-proof, a[href="#/games/proof"] .hrow-ic) { --gc: #8a5a2f; }
.pr-q { margin: 0; font-size: 1.05rem; text-align: center; line-height: 1.5; }
.pr-q b { font-weight: 600; }
.pr-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 6px; margin: 6px 0 0; }
.pr-w { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px 5px; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; color: inherit; font: inherit; }
.pr-w:hover:not(:disabled) { border-color: var(--accent); }
.pr-cells { display: flex; }
.pr-w .cell { --s: clamp(6px, 1.9vw, 9px); }
.pr-w .lbl { min-height: 1.2em; font-size: .85rem; color: var(--muted); }
.pr-w.got { border-color: var(--good); background: color-mix(in srgb, var(--good) 16%, var(--surface)); }
.pr-w.missed { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.pr-w.fine { opacity: .55; }
.pr-w.got .lbl, .pr-w.missed .lbl { color: var(--ink); font-weight: 600; }
.pr-w:disabled { cursor: default; }
.pr-why { margin: 0; min-height: 1.5em; text-align: center; max-width: 34em; font-size: .95rem; }
.pr-why:empty { display: none; }

/* ---------- Practice: Write ---------- */
.cw-stage { gap: 16px; padding-top: 18px; padding-bottom: 20px; }
.practice-wrap .sw-row.cw-pick { flex: 1; }
.practice-wrap .sw-row.cw-pick > .seg { flex: 1 1 auto; }
.practice-wrap .sw-row.cw-pick > .seg button { padding-inline: 8px; }
.cw-strip { display: flex; gap: 18px; width: calc(100% + 36px); margin: 0 -18px; padding: 4px 18px 8px; overflow-x: auto; scrollbar-width: none; outline: none; }
.cw-strip::-webkit-scrollbar { display: none; }
.cw-strip::before, .cw-strip::after { content: ""; flex: 1 0 0; }
.cw-w { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 34px; }
.cw-p { font-size: 1.25rem; font-weight: 500; line-height: 1.2; color: var(--muted); white-space: nowrap; transition: color .2s; }
.cw-w.cur .cw-p, .cw-w.done .cw-p { color: var(--ink); }
.cw-w.cur .cw-p { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 5px; }
.cw-cells { display: flex; align-items: center; min-height: 46px; }
.cw-c { display: inline-grid; place-items: center; min-width: 22px; min-height: 34px; border-radius: 8px; }
.cw-c .cell { --s: 7px; }
.cw-c.now { min-height: 46px; padding: 0 6px; margin: 0 4px; outline: 1.5px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 0; }
.cw-c.now .cell { visibility: hidden; }
.cw-c.now.bad { outline-color: var(--bad); }
.cw-c.landing .cell { visibility: hidden; }
.cw-edit { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; width: 100%; }
.cw-edit #cwHint { justify-self: end; }
.cw-edit #cwSkip { justify-self: start; }
.cw-pad button.bad { background: var(--bad); border-color: var(--bad); }
.cw-foot { display: flex; justify-content: center; }
@media (max-height: 680px) { .cw-stage { gap: 12px; } }

/* ---------- Practice: placement check ---------- */
.pl-link { margin: 0; font-size: .9rem; color: var(--muted); }
.pl-intro, .pl-done { display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 460px; }
.pl-lead { font-size: 1.15rem; margin: 0; outline: none; }
.pl-where { display: flex; justify-content: space-between; width: 100%; max-width: 520px; margin: 0 0 6px; font-size: .9rem; color: var(--muted); }
.pl-foot { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.pl-big { display: grid; justify-items: center; outline: none; }
.pl-big b { font-size: 2.6rem; font-weight: 600; line-height: 1; }
.pl-big span { color: var(--muted); }
.pl-done p { margin: 0; }
.cw-stage [hidden] { display: none !important; }
.pl-link a { text-decoration: underline; text-underline-offset: 3px; }

/* Laptop: Home lays Learn, Practice and Games side by side; Guess and Draw put progress in a side panel. */
.kb-hint { display: none; }
@media (min-width: 1000px) {
  body[data-page="home"] #view { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 22px; align-items: start; }
  body[data-page="home"] #view > :not(.hsec), body[data-page="home"] #view > .hsec-stats { grid-column: 1 / -1; }
  body[data-page="home"] .hsplit { grid-template-columns: 1fr; }
  .practice-wrap:is(.mode-read, .mode-write) { max-width: 900px; }
  .practice-wrap:is(.mode-read, .mode-write) #modeBody { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; flex: none; }
  .practice-wrap:is(.mode-read, .mode-write) .stage { margin: 0; min-height: 440px; }
  .practice-wrap:is(.mode-read, .mode-write) .below-stage { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; gap: 14px; }
  .practice-wrap:is(.mode-read, .mode-write) .mastery-h { flex-wrap: wrap; }
  .kb-hint { display: block; margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }
  .kb-hint b { color: var(--ink-2); font-weight: 600; }
}
@media (min-width: 1000px) and (hover: none) { .kb-hint { display: none; } }

/* ===================== round 24: tighter Practice ===================== */
/* Picker, card, score and keyboard sit close together; spare height goes below, not between them. */
.practice-wrap { gap: 14px; }
.practice-wrap:not(.mode-sweep) #modeBody { gap: 12px; }
.practice-wrap.mode-sweep .picker { margin-bottom: 0; }
.practice-wrap.mode-sweep .sweep-box { margin-top: 0; }
/* Type: the card is centred in the space above; score and keyboard sit at the bottom. */
.practice-wrap.mode-words .stage { margin: auto 0; }
.practice-wrap.mode-compose .stage { margin: 0; }
.practice-wrap.mode-words .stage { padding-top: 50px; padding-bottom: 20px; gap: 14px; }
.mode-words .w-score, .mode-compose .w-score { margin: 0; }
.mode-words #wkb, .mode-words #wkb .g-kb { margin-top: 0; }
@media (max-height: 620px) {
  .practice-wrap.mode-words .stage { padding-top: 44px; padding-bottom: 14px; }
  .mode-words .g-kr button { height: 38px; }
}
/* Translate: the language menu shrinks (name cut short) instead of running off a narrow phone */
.subbar #langDD { min-width: 0; flex: 0 1 auto; }
.subbar #langDD .dd-btn { min-width: 0; width: 100%; }
.subbar #langDD .dd-v { min-width: 0; }
.subbar #langDD .dd-btn .ic { flex: none; }
.below-stage .mastery:empty { display: none; }
/* Write: a right cell flashes on the pad and in the line; when done the whole text wraps into view */
.cw-fly { position: fixed; z-index: 30; margin: 0; pointer-events: none; transform-origin: 50% 50%; border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--bg)); box-shadow: 0 0 0 2px var(--good), 0 0 18px color-mix(in srgb, var(--good) 40%, transparent); transition: background .3s, border-color .3s, box-shadow .3s; }
.cw-fly button { border-color: transparent; transition: border-color .2s; }
.cw-fly:not(.go) button { border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.cw-fly button.on { background: var(--good); border-color: var(--good); }
.cw-fly.go { background: transparent; border-color: transparent; box-shadow: none; }
.cw-c.fresh { animation: cwFresh .6s ease-out; }
@keyframes cwFresh { from { background: color-mix(in srgb, var(--good) 28%, transparent); } }
@media (prefers-reduced-motion: reduce) { .cw-c.fresh { animation: none; } }
/* Games with an on-screen keyboard: the card is centred in the space above, the keyboard sits at the bottom. */
.game > :is(.wd-keys, #kb) { order: 2; }
/* Small phones (360px): the Practice level menu, Translate's language menu and long page titles keep their words */
@media (max-width: 380px) {
  .practice-wrap .picker > .seg button { padding: 0 10px; }
  .practice-wrap .picker { gap: 6px; }
  #setDD .dd-btn { padding: 0 8px 0 12px; gap: 4px; }
  .subbar #langDD .dd-lead { display: none; }
  .subbar #langDD .dd-btn { padding: 0 10px 0 14px; gap: 4px; }
  .head-title { font-size: 1.12rem; gap: 8px; }
}
@media (max-width: 350px) {
  .practice-wrap .picker > .seg button { padding: 0 8px; }
  .head-title { font-size: 1.04rem; }
}
/* Main view takes focus for screen readers after a route change; it isn't a control, so no ring around the whole page */
#view:focus, #view:focus-visible { outline: none; }
/* Translate, Line view: a clear gap between wrapped rows so each row's letters sit with their own cells */
.tr-out .braille-line:has(.lbl) { row-gap: 14px; }
/* Laptop: Braidle and Snowman's braille keys grow to match the QWERTY keys in the other games */
@media (min-width: 900px) {
  .wd-keys { gap: 6px; }
  .wd-krow { gap: 6px; }
  .wd-k { max-width: 58px; height: 60px; gap: 4px; border-radius: 10px; }
  .wd-k .cell { --s: 7px; --gap: 3px; }
  .wd-k b { font-size: .85rem; }
  .wd-k.wide { max-width: 84px; font-size: .88rem; }
}

/* ---------- Peek: the cheat sheet in a sheet over Practice and the games ---------- */
.peek-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.cheatsheet.peek-cs { border: 0; padding: 0; background: none; border-radius: 0; }
.peek-cs .cs-title, .peek-cs .cs-foot { display: none; }
.peek-cs .cs-block:first-of-type { margin-top: 14px; }
/* Four header buttons on a small phone: a little narrower, so long game names still fit */
@media (max-width: 380px) {
  .top-row:has(#peekBtn:not([hidden])) { gap: 4px; }
  .top-row:has(#peekBtn:not([hidden])) .head-title { gap: 6px; }
  .top-row:has(#peekBtn:not([hidden])) .icon-btn.plain { width: 34px; }
}

/* ---------- Settings: real size calibration ---------- */
.mm-cal { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.mm-cal[hidden] { display: none; }
.mm-cal .set-note { margin: 0; }
.mm-row { display: flex; align-items: center; }
/* Ruler: cm and mm along the top (large), inches along the bottom (small). Ticks are placed in --mm units. */
.ruler { position: relative; height: 78px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.ruler i { position: absolute; width: 1px; margin-left: 8px; background: currentColor; }
.ruler .rt-m { top: 0; height: 9px; }
.ruler .rt-m.half { height: 14px; }
.ruler .rt-m.cm { height: 20px; width: 1.5px; }
.ruler .rt-i { bottom: 0; height: 4px; color: var(--muted); }
.ruler .rt-i.q { height: 6px; }
.ruler .rt-i.half { height: 9px; }
.ruler .rt-i.in { height: 13px; width: 1.5px; }
.ruler b { position: absolute; margin-left: 8px; transform: translateX(-50%); line-height: 1; font-variant-numeric: tabular-nums; }
.ruler .rl-cm { top: 23px; font-size: 1.05rem; font-weight: 600; }
.ruler .rl-in { bottom: 16px; font-size: .72rem; font-weight: 500; color: var(--muted); }
.ruler b.z { transform: none; }
.ruler .rl-u { position: absolute; right: 0; padding: 0 8px 0 10px; background: linear-gradient(to right, transparent, var(--surface) 8px); line-height: 1; }
.ruler .rl-u.top { top: 23px; font-size: 1.05rem; font-weight: 600; }
.ruler .rl-u.bot { bottom: 16px; font-size: .72rem; color: var(--muted); }
.mm-demo { display: inline-flex; }
.mm-ctl { display: flex; align-items: center; gap: 10px; }
.mm-ctl input { flex: 1; min-width: 0; accent-color: var(--accent); }
.mm-ctl .icon-btn { width: 36px; height: 36px; font-size: 1.2rem; line-height: 1; }

/* ---------- Milestones: a list in Stats ---------- */
.ms-mark { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--good); }
.ms-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ms-list li { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.ms-list .ms-t { flex: 1; min-width: 0; }
.ms-list .ms-n { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.ms-list li:not(.done) .ms-mark { background: none; box-shadow: inset 0 0 0 1.5px var(--dot-off); }
.ms-list li:not(.done) .ms-t { color: var(--muted); }

/* ===================== round 26: big text, Write cell, ruler ===================== */
/* Practice progress line: each "Label: n" stays whole when it wraps (large system text), Stats keeps to the right. */
.mastery-h .m-line { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; row-gap: 2px; }
.mastery-h .m-line > span:empty { display: none; }
#pRound, #mLearn { display: contents; }
.m-part { white-space: nowrap; }
.m-part::after { content: "·"; margin: 0 6px; color: var(--muted); }
.m-part.end::after { visibility: hidden; }
.m-part.last::after { display: none; }
.mastery-h .m-line { column-gap: 0; }
.mastery-h .st-link { flex: none; margin-left: auto; }
/* Draw: a long prompt that can't fit beside Show me moves below it (fitTarget in practice.js). */
.stage .target.below { margin-top: 30px; }
/* Type slots: a cell is 4.17 dots wide with its side padding, so dots of 0.24 of the slot fill it exactly and
   neighbours keep the 1.5-dot gap between cells (tests/spacing.js checks this on every screen). */
body:not(.s-sw-real) .stage .prompt-cells.slots .cell { --s: calc(var(--slot) * .24); }
