/* CodingMarble Typing — design system
   Signature: finger-zone keycaps. Every colour in the keyboard, tiles and hands encodes a finger. */
:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #eef1f8; --ink: #151833; --ink-2: #4a4f6e; --muted: #7d839f;
  --line: #dde2ee; --accent: #ff5a1f; --accent-ink: #c2410c; --accent-soft: #ffe6dc; --link: #2f4be0; --bad: #e5484d; --bad-soft: #fde4e4;
  --untyped: #a2a8c0; --caret: var(--accent);
  --f-lp: #ffc9d6; --f-lr: #ffe0a3; --f-lm: #c9f0c0; --f-li: #bfe3ff; --f-ri: #d9ccff; --f-rm: #c9f0c0; --f-rr: #ffe0a3; --f-rp: #ffc9d6; --f-th: #e3e6f0;
  --f-lp-d: #e993a8; --f-lr-d: #e2b45c; --f-lm-d: #86c979; --f-li-d: #74b3e6; --f-ri-d: #a591e8; --f-rm-d: #86c979; --f-rr-d: #e2b45c; --f-rp-d: #e993a8; --f-th-d: #b8bdd0;
  --key-ink: #151833;
  --font-display: 'Unbounded', 'Hanken Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-type: var(--font-mono);
  --type-scale: 1;
  --r: 18px; --r-sm: 10px;
  --shadow: 0 1px 2px rgba(21, 24, 51, .06), 0 8px 28px -10px rgba(21, 24, 51, .16);
  --shadow-lg: 0 2px 4px rgba(21, 24, 51, .05), 0 24px 60px -20px rgba(21, 24, 51, .28);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
[data-theme="night"] {
  --bg: #0f1226; --surface: #171b36; --surface-2: #1e2344; --ink: #eceefa; --ink-2: #b6bbd8; --muted: #8288ad; --line: #2b3059;
  --accent: #ff7a45; --accent-ink: #ff9a70; --accent-soft: #3a2230; --link: #8ea2ff; --bad: #ff6b6f; --bad-soft: #3d1f2a; --untyped: #565d8c;
  --f-lp: #5a2f45; --f-lr: #5a4526; --f-lm: #2d5132; --f-li: #22476a; --f-ri: #3e3470; --f-rm: #2d5132; --f-rr: #5a4526; --f-rp: #5a2f45; --f-th: #2b3059;
  --f-lp-d: #3a1c2c; --f-lr-d: #3a2c16; --f-lm-d: #1b331f; --f-li-d: #142c44; --f-ri-d: #262048; --f-rm-d: #1b331f; --f-rr-d: #3a2c16; --f-rp-d: #3a1c2c; --f-th-d: #1b1f3d;
  --key-ink: #eceefa; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6); --shadow-lg: 0 30px 70px -25px rgba(0,0,0,.7); color-scheme: dark;
}
[data-theme="chalk"] {
  --bg: #1d3a32; --surface: #234539; --surface-2: #2a5043; --ink: #f3f6ee; --ink-2: #cfdccf; --muted: #93ab9c; --line: #3a6153;
  --accent: #ffd166; --accent-ink: #ffd166; --accent-soft: #3d4a2c; --link: #9fe0ff; --bad: #ff8a80; --bad-soft: #4a3330; --untyped: #7e9c8d;
  --f-lp: #6b3f4a; --f-lr: #6b5a33; --f-lm: #3d6b44; --f-li: #33587a; --f-ri: #52487a; --f-rm: #3d6b44; --f-rr: #6b5a33; --f-rp: #6b3f4a; --f-th: #34574b;
  --f-lp-d: #4a2a33; --f-lr-d: #4a3e22; --f-lm-d: #284a2e; --f-li-d: #223d56; --f-ri-d: #383156; --f-rm-d: #284a2e; --f-rr-d: #4a3e22; --f-rp-d: #4a2a33; --f-th-d: #203a31;
  --key-ink: #f3f6ee; color-scheme: dark;
}
[data-theme="sepia"] { --bg: #f1e9da; --surface: #fbf6ec; --surface-2: #efe5d2; --ink: #3b2a1a; --ink-2: #6b5842; --muted: #9a8670; --line: #e0d3bb; --accent: #b5541c; --accent-ink: #9a4412; --accent-soft: #f4dcc6; --untyped: #b7a58c; --link: #7a4a1c; }
[data-theme="mint"] { --bg: #eaf6f1; --surface: #ffffff; --surface-2: #dff0e8; --ink: #0f2e28; --ink-2: #3e5d55; --muted: #6f8d85; --line: #cfe5dc; --accent: #0e9f86; --accent-ink: #0a7a67; --accent-soft: #d2f1e8; --untyped: #9bb8ae; --link: #0a6b8a; }
[data-theme="contrast"] { --bg: #000; --surface: #000; --surface-2: #111; --ink: #fff; --ink-2: #fff; --muted: #ddd; --line: #fff; --accent: #ffea00; --accent-ink: #ffea00; --accent-soft: #333; --link: #7cf; --bad: #ff5c5c; --bad-soft: #300; --untyped: #999;
  --f-lp: #000; --f-lr: #000; --f-lm: #000; --f-li: #000; --f-ri: #000; --f-rm: #000; --f-rr: #000; --f-rp: #000; --f-th: #000; --key-ink: #fff; color-scheme: dark; }
[data-font="sans"] { --font-type: var(--font-body); }
[data-font="readable"] { --font-type: 'Atkinson Hyperlegible', var(--font-body); }
[data-font="serif"] { --font-type: Georgia, 'Times New Roman', serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.65 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--link); text-underline-offset: .18em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 12px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
kbd { font: 600 .78em var(--font-mono); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 6px; padding: .05em .45em; color: var(--ink-2); }
code { font: .9em var(--font-mono); background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.top-in { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 36px; height: 36px; transition: transform .25s var(--ease); }
.brand:hover svg { transform: translateY(2px) rotate(-4deg); }
.brand span { display: flex; flex-direction: column; line-height: 1; }
.brand b { font: 800 1.12rem var(--font-display); letter-spacing: -.02em; }
.brand small { font: 500 .64rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.top-act { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.15rem; line-height: 1; transition: transform .15s var(--ease), background .15s; }
.icon-btn:hover { background: var(--surface-2); } .icon-btn:active { transform: translateY(2px); }
.tools-btn { height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); font-weight: 700; cursor: pointer; }
.tools-pop { position: absolute; right: 0; top: 50px; width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; display: grid; opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right; transition: .18s var(--ease); }
.tools-pop.open { opacity: 1; visibility: visible; transform: none; }
.tools-pop a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.tools-pop a:hover { background: var(--surface-2); }
.tools-pop span { font-size: .82rem; color: var(--muted); }
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; position: relative; }
.menu-btn span, .menu-btn span::before, .menu-btn span::after { position: absolute; left: 11px; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; content: ''; transition: .2s; }
.menu-btn span { top: 19px; } .menu-btn span::before { left: 0; top: -6px; } .menu-btn span::after { left: 0; top: 6px; }
.menu-btn[aria-expanded="true"] span { background: transparent; }
.menu-btn[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); } .menu-btn[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); }

/* ---------- hero ---------- */
.hero { padding: 36px 0 18px; }
.hero-tool { padding: 22px 0 14px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .84rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); text-decoration: none; } .crumbs a:hover { text-decoration: underline; }
.kicker { font: 600 .72rem var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; display: inline-flex; align-items: center; gap: 8px; }
.kicker::before { content: ''; width: 8px; height: 8px; border-radius: 3px; background: var(--accent); box-shadow: 0 2px 0 var(--accent-ink); }
h1 { font: 800 clamp(1.7rem, 3.6vw, 2.9rem)/1.08 var(--font-display); letter-spacing: -.035em; margin: 0; max-width: 22ch; text-wrap: balance; }
.home h1 { font-size: clamp(2rem, 4.6vw, 3.6rem); }
h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 68ch; margin: 12px 0 0; }

/* ---------- app shell ---------- */
.app-wrap { position: relative; }
.app { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: clamp(14px, 2.4vw, 26px); min-height: 420px; }
.app-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); min-height: 300px; justify-content: center; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.err-note { color: var(--bad); }

/* toolbar */
.tt-bar, .tt-bar2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tt-bar2 { margin-top: 10px; }
.grow { flex: 1; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: .88rem; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, transform .12s; }
.seg button:hover { color: var(--ink); }
.seg button:active { transform: translateY(1px); }
.seg button.on { background: var(--ink); color: var(--bg); box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 60%, #000); }
.seg.tog button.on { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.tt .sub { display: none; }
.tt[data-mode="time"] [data-g="time"], .tt[data-mode="time"] [data-g="flags"], .tt[data-mode="words"] [data-g="count"], .tt[data-mode="words"] [data-g="flags"], .tt[data-mode="numbers"] [data-g="count"] { display: inline-flex; }
.pick { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.pick span { font: 600 .7rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
select, .field input, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; min-height: 38px; color: var(--ink); }
select { padding-right: 28px; max-width: 260px; }
textarea { width: 100%; resize: vertical; }
.custom-box { margin-top: 12px; display: grid; gap: 8px; }
.custom-box[hidden] { display: none; }
.custom-box label { font-weight: 600; }
.custom-box .btn { justify-self: start; }

/* live stats */
.live { display: flex; align-items: baseline; gap: 18px; margin: 18px 4px 6px; font-family: var(--font-mono); color: var(--muted); min-height: 2rem; }
.lv-time { font: 700 1.6rem var(--font-mono); color: var(--accent); min-width: 3ch; }
.live b { color: var(--ink); font-weight: 700; }
.lv-prog { flex: 1; height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; align-self: center; max-width: 280px; margin-left: auto; }
.lv-prog i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .2s var(--ease); }
.tt[data-mode="time"] .lv-prog { visibility: hidden; }

/* typing box */
.typebox { position: relative; border-radius: 16px; padding: 10px 6px; cursor: text; outline: none; }
.hidden-input { position: absolute; opacity: 0; left: 0; top: 0; width: 1px; height: 1px; font-size: 16px; border: 0; padding: 0; pointer-events: none; }
.tb-text { position: relative; font-family: var(--script-font, var(--font-type)); font-size: calc(1.6rem * var(--type-scale)); line-height: 1.55; }
.words-wrap { position: relative; height: calc(3 * 1.55em + 2 * .25em); overflow: hidden; }
.complex .words-wrap { height: calc(3 * 2em + 2 * .35em); }
.words { position: relative; display: flex; flex-wrap: wrap; row-gap: .25em; column-gap: .6em; transition: transform .22s var(--ease); color: var(--untyped); }
.complex .words { row-gap: .35em; line-height: 2em; }
.w { white-space: nowrap; border-radius: 6px; }
.c { transition: color .08s; }
.c.ok { color: var(--ink); }
.c.bad { color: var(--bad); background: var(--bad-soft); border-radius: 3px; }
.c.extra { color: var(--bad); opacity: .65; }
.c.nl { color: var(--untyped); opacity: .6; margin-left: .15em; }
.w.done.wrong { text-decoration: underline wavy var(--bad) 2px; text-underline-offset: .28em; }
.brk { flex-basis: 100%; height: 0; }
.w.rom { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.15; }
.w.rom .rd { font-size: 1.05em; color: var(--ink); }
.w.rom .rt { font-family: var(--font-mono); font-size: .56em; }
.complex .w { padding: 0 .12em; }
.complex .w.done { color: var(--ink); }
.complex .w.done.wrong { color: var(--bad); }
.complex .w.cur { color: var(--ink); background: var(--accent-soft); box-shadow: 0 2px 0 var(--accent); }
.complex .w.cur.err { background: var(--bad-soft); box-shadow: 0 2px 0 var(--bad); }
.echo { position: absolute; left: 6px; top: 10px; font-family: var(--script-font, var(--font-type)); font-size: calc(1rem * var(--type-scale)); background: var(--ink); color: var(--bg); padding: 2px 10px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .15s; white-space: nowrap; z-index: 2; }
.echo.show { opacity: 1; } .echo.bad { background: var(--bad); color: #fff; }
.caret { position: absolute; left: 0; top: 0; width: 3px; border-radius: 3px; background: var(--caret); transition: transform .09s linear; z-index: 1; pointer-events: none; margin-left: -1px; }
.caret.idle { animation: blink 1.05s step-end infinite; }
[data-caret="block"] .caret { width: .6em; opacity: .35; }
[data-caret="underline"] .caret { height: 3px !important; width: .6em; margin-top: 1.35em; }
@keyframes blink { 50% { opacity: 0; } }
.blind .c.bad { color: var(--ink); background: none; } .blind .w.done.wrong { text-decoration: none; }
.focus-hint { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600; color: var(--ink); background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: blur(3px); border-radius: 16px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.typebox:not(.focused) .focus-hint { opacity: 1; }
.tt.finished .typebox { display: none; }
.shake { animation: shake .22s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.tt-keys { text-align: center; margin: 14px 0 0; }
.tt.running .tt-bar, .tt.running .tt-bar2 { opacity: .35; transition: opacity .3s; }
.tt.running .tt-bar:hover, .tt.running .tt-bar2:hover { opacity: 1; }

/* ---------- keyboard ---------- */
.kb-slot { margin-top: 22px; container-type: inline-size; }
.kb-slot[hidden] { display: none; }
.kb { --u: min(3.1rem, calc((100cqi - 8px) / 15.6)); display: grid; gap: calc(var(--u) * .1); justify-content: center; user-select: none; }
.kb-row { display: flex; gap: calc(var(--u) * .1); justify-content: center; }
.key { --c: var(--f-lp); --d: var(--f-lp-d); position: relative; width: calc(var(--u) * var(--w, 1) + (var(--w, 1) - 1) * var(--u) * .1); height: calc(var(--u) * .92); border-radius: calc(var(--u) * .18); background: var(--c); color: var(--key-ink); border-bottom: calc(var(--u) * .1) solid var(--d); display: grid; place-items: center; font: 600 calc(var(--u) * .34) var(--font-mono); transition: transform .08s, border-bottom-width .08s, box-shadow .15s, background .3s; opacity: 0; animation: keyIn .5s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 12ms); }
@keyframes keyIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.key b { font-weight: 700; line-height: 1; } .key small { position: absolute; left: 12%; top: 6%; font-size: .72em; opacity: .7; line-height: 1; }
.key.mod { --c: var(--f-th); --d: var(--f-th-d); font-size: calc(var(--u) * .25); color: var(--ink-2); }
.key.bump::after { content: ''; position: absolute; bottom: 16%; width: 26%; height: 3px; border-radius: 2px; background: currentColor; opacity: .45; }
.key.down { transform: translateY(calc(var(--u) * .07)); border-bottom-width: calc(var(--u) * .03); }
.key.bad { background: var(--bad) !important; color: #fff; }
.key.next { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--accent); animation: keyIn .5s var(--ease) forwards, pulse 1.2s ease-in-out infinite; z-index: 1; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 9px color-mix(in srgb, var(--accent) 35%, transparent); } }
.f-lp { --c: var(--f-lp); --d: var(--f-lp-d); } .f-lr { --c: var(--f-lr); --d: var(--f-lr-d); } .f-lm { --c: var(--f-lm); --d: var(--f-lm-d); } .f-li { --c: var(--f-li); --d: var(--f-li-d); }
.f-ri { --c: var(--f-ri); --d: var(--f-ri-d); } .f-rm { --c: var(--f-rm); --d: var(--f-rm-d); } .f-rr { --c: var(--f-rr); --d: var(--f-rr-d); } .f-rp { --c: var(--f-rp); --d: var(--f-rp-d); } .f-th { --c: var(--f-th); --d: var(--f-th-d); }
.key[data-code="Space"] { --c: var(--f-th); --d: var(--f-th-d); }
.heatmap .key[style*="--heat"] { background: color-mix(in srgb, var(--bad) calc(var(--heat) * 85%), var(--c)); }
.hands { display: block; width: min(460px, 80%); margin: 10px auto 0; overflow: visible; }
.hands .palm { fill: var(--surface-2); stroke: var(--line); stroke-width: 2; }
.hands .fg { fill: var(--c); stroke: var(--d); stroke-width: 2; opacity: .55; transition: transform .25s var(--ease), opacity .2s; transform-box: fill-box; transform-origin: bottom center; }
.hands .fg.on { opacity: 1; transform: translateY(-10px); stroke: var(--accent); stroke-width: 3; }
.hands .thumb-l.on, .hands .thumb-r.on { transform: translateY(-6px); }
.kb-tip { text-align: center; min-height: 1.6em; margin: 6px 0 0; color: var(--ink-2); font-size: .92rem; }
.kb-tip b { font-family: var(--font-mono); background: var(--surface-2); border-radius: 6px; padding: 0 .4em; }
.dot { display: inline-block; width: .8em; height: .8em; border-radius: 3px; background: var(--c); border: 2px solid var(--d); vertical-align: -1px; }

/* ---------- results ---------- */
.res-slot[hidden] { display: none; }
.result { outline: none; animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.res-main { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 24px; align-items: center; }
.res-big .kicker { margin-bottom: 4px; }
.pb { color: var(--accent-ink); }
.res-wpm { margin: 0; display: flex; align-items: baseline; gap: 10px; line-height: 1; }
.res-wpm .num { font: 800 clamp(4rem, 9vw, 6.4rem)/.9 var(--font-display); letter-spacing: -.05em; color: var(--accent); }
.res-wpm .unit { font: 700 1.1rem var(--font-mono); color: var(--ink-2); }
.res-pct { margin: 10px 0 0; color: var(--ink-2); }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.res-stats div { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; }
.res-stats dt { font: 600 .68rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.res-stats dd { margin: 4px 0 0; font: 700 1.45rem var(--font-mono); }
.res-stats dd small { font-size: .6em; color: var(--muted); }
.chars b { font-weight: 700; } .chars .ok { color: var(--ink); } .chars .bad { color: var(--bad); }
.res-stats .chars { font-size: 1.05rem; }
.res-advice { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 18px 0 0; color: var(--ink); }
.chart { margin: 18px 0 0; }
.chart svg { width: 100%; height: auto; display: block; }
.ch-grid line { stroke: var(--line); stroke-dasharray: 3 5; } .ch-grid text, .ch-x { font: 11px var(--font-mono); fill: var(--muted); text-anchor: end; }
.ch-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.ch-wpm { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.2s var(--ease) .2s forwards; }
.ch-raw { fill: none; stroke: var(--untyped); stroke-width: 1.5; stroke-dasharray: 4 4; }
.ch-err line { stroke: var(--bad); stroke-width: 3; stroke-linecap: round; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.chart figcaption { font-size: .8rem; color: var(--muted); display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.lg { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: -8px; } .lg-wpm { background: var(--accent); } .lg-raw { background: var(--untyped); } .lg-err { background: var(--bad); width: 4px; height: 12px; }
.res-keys h3 { font: 700 1rem var(--font-body); margin: 18px 0 8px; }
.res-keys p { margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.keycap { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; background: var(--f-th); border-bottom: 4px solid var(--f-th-d); border-radius: 9px; font: 700 1.1rem var(--script-font, var(--font-mono)); }
.res-words { margin-top: 10px; } .res-words summary { cursor: pointer; font-weight: 600; }
.res-words span { display: inline-block; background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: 0 6px; margin: 2px; font-family: var(--script-font, var(--font-mono)); }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: .95rem; text-decoration: none; cursor: pointer; box-shadow: 0 3px 0 var(--line); transition: transform .1s, box-shadow .1s, background .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 3px 0 var(--accent-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.primary:active { box-shadow: 0 0 0 var(--accent-ink); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn kbd { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: inherit; }

/* ---------- keycap tiles & cards ---------- */
.cap { display: inline-grid; place-items: center; width: 54px; height: 50px; flex: none; border-radius: 12px; background: var(--c, var(--f-li)); border-bottom: 5px solid var(--d, var(--f-li-d)); color: var(--key-ink); font: 700 .9rem var(--font-mono); letter-spacing: -.02em; transition: transform .12s, border-bottom-width .12s; }
.cap span { max-width: 48px; overflow: hidden; white-space: nowrap; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card { --rx: 0deg; --ry: 0deg; position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; column-gap: 14px; row-gap: 2px; align-items: start; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: 0 1px 0 var(--line); transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .35s var(--ease), box-shadow .25s, border-color .2s; overflow: hidden; }
.card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.card:hover::before { opacity: 1; }
.card:hover .cap, .card:focus-visible .cap { transform: translateY(3px); border-bottom-width: 2px; }
.card .cap { grid-row: span 2; }
.card-t { font-weight: 700; font-size: 1.02rem; line-height: 1.3; }
.card-d { font-size: .88rem; color: var(--ink-2); line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; transition: transform .15s var(--ease), background .15s; }
.chip:hover { transform: translateY(-2px); background: var(--surface-2); }
.chip.more { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- home showcase ---------- */
.show { margin-top: 64px; }
.show-head { max-width: 640px; margin-bottom: 20px; }
.show-head h2, .related h2, .hub h2 { font: 800 clamp(1.4rem, 2.6vw, 2rem)/1.15 var(--font-display); letter-spacing: -.03em; margin: 0 0 8px; }
.show-head p { color: var(--ink-2); margin: 0 0 14px; }
.show-learn { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: clamp(20px, 4vw, 40px); }
.path { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 10px; counter-reset: l; }
.path li { display: grid; justify-items: center; gap: 6px; text-align: center; }
.path .cap { width: 64px; height: 58px; font-size: 1rem; }
.path small { color: var(--ink-2); font-size: .8rem; line-height: 1.3; }
.reveal-on .path li { opacity: 0; transform: translateY(12px); transition: .5s var(--ease); transition-delay: calc(var(--i) * 60ms); }
.reveal-on .in .path li { opacity: 1; transform: none; }
.hub { margin-top: 26px; }
.related { margin-top: 56px; }

/* ---------- article ---------- */
.article-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; margin-top: 56px; align-items: start; }
.article-wrap:not(:has(.toc)) { grid-template-columns: minmax(0, 1fr); }
.toc { position: sticky; top: 88px; display: grid; gap: 2px; font-size: .88rem; border-left: 2px solid var(--line); padding-left: 14px; }
.toc p { font: 600 .7rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.toc a { color: var(--ink-2); text-decoration: none; padding: 3px 0; } .toc a:hover { color: var(--accent-ink); }
.prose { max-width: 76ch; font-size: 1.04rem; }
.prose h2 { font: 800 clamp(1.3rem, 2.2vw, 1.7rem)/1.2 var(--font-display); letter-spacing: -.025em; margin: 2.2em 0 .6em; scroll-margin-top: 90px; }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { font: 700 1.15rem/1.3 var(--font-body); margin: 1.6em 0 .4em; }
.prose p, .prose li { color: var(--ink-2); } .prose strong { color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.3em; } .prose li { margin: .3em 0; }
.prose .formula { font: 600 1.05rem var(--font-mono); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 16px; color: var(--ink); overflow-x: auto; }
.table-scroll { overflow-x: auto; margin: 1em 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.prose th { font: 600 .74rem var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.prose tr:last-child td { border-bottom: 0; }
.prose .note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.faq { margin-top: 2.6em; }
.faq h2 { margin-top: 0; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font-weight: 700; color: var(--ink); position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 12px; font: 700 1.3rem var(--font-mono); color: var(--accent); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details div { padding: 0 0 16px; color: var(--ink-2); }
.faq details div p:first-child { margin-top: 0; }

/* ---------- footer ---------- */
.foot { margin-top: 90px; background: var(--ink); color: color-mix(in srgb, var(--bg) 80%, transparent); padding: 48px 0 20px; }
[data-theme="night"] .foot, [data-theme="chalk"] .foot, [data-theme="contrast"] .foot { background: var(--surface); color: var(--ink-2); }
.foot a { color: inherit; text-decoration: none; } .foot a:hover { color: var(--accent); }
.foot-in { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; }
.foot .brand { color: inherit; } .foot .brand small { color: inherit; opacity: .7; }
.foot-brand p { font-size: .9rem; max-width: 34ch; opacity: .85; }
.foot-col { display: grid; gap: 6px; align-content: start; font-size: .9rem; }
.foot-col h2 { font: 600 .72rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; margin: 0 0 6px; opacity: .6; }
.foot-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 36px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: .84rem; opacity: .8; }

/* ---------- misc ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 12px; font-weight: 600; opacity: 0; transition: .25s var(--ease); z-index: 90; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 95; }
dialog.settings { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); padding: 0; width: min(560px, 100% - 24px); box-shadow: var(--shadow-lg); }
dialog.settings::backdrop { background: rgba(15, 18, 38, .45); backdrop-filter: blur(3px); }
dialog.settings[open] { animation: rise .3s var(--ease); }
.settings form { padding: 20px 22px; }
.settings header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.settings h2 { font: 800 1.3rem var(--font-display); margin: 0; }
.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.set-grid label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.set-grid label.chk { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.set-grid select { max-width: none; }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
.reveal-on [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal-on [data-reveal].in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .nav { position: fixed; inset: 64px 0 auto 0; flex-direction: column; background: var(--surface); padding: 10px 16px 18px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(-8px); transition: .2s var(--ease); margin: 0; }
  .nav.open { opacity: 1; visibility: visible; transform: none; }
  .nav a { padding: 12px; }
  .menu-btn { display: inline-block; }
  .article-wrap { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; }
  .show-learn { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .res-main { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .tools-btn { display: none; }
  .brand small { display: none; }
  .res-stats { grid-template-columns: repeat(2, 1fr); }
  .tb-text { font-size: calc(1.25rem * var(--type-scale)); }
  .set-grid { grid-template-columns: 1fr; }
  .path { grid-template-columns: repeat(2, 1fr); }
  .hands { display: none; }
  .live { gap: 12px; }
  select { max-width: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .key { opacity: 1; }
  .caret.idle { animation: none; }
}

/* ---------- lessons ---------- */
.ls-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.ls-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.ls-map { max-height: 640px; overflow: auto; padding-right: 6px; scrollbar-width: thin; }
.ls-stage-t { font: 600 .68rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.ls-stage-t:first-child { margin-top: 0; }
.ls-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ls-node { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 12px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink); transition: background .15s, border-color .15s; }
.ls-node .cap { width: 46px; height: 42px; font-size: .9rem; }
.ls-node small { font-size: .68rem; color: var(--muted); line-height: 1.2; text-align: center; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-node.passed small { color: var(--accent-ink); letter-spacing: .05em; }
.ls-node:hover:not(:disabled) { background: var(--surface-2); }
.ls-node:hover:not(:disabled) .cap { transform: translateY(2px); border-bottom-width: 3px; }
.ls-node.cur { border-color: var(--accent); background: var(--accent-soft); }
.ls-node:disabled { cursor: not-allowed; opacity: .45; filter: grayscale(.7); }
.ls-head h2 { font: 800 clamp(1.2rem, 2.4vw, 1.6rem) var(--font-display); letter-spacing: -.02em; margin: 0 0 6px; }
.ls-intro { color: var(--ink-2); margin: 0 0 12px; max-width: 70ch; }
.ls-bar { height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.ls-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .25s var(--ease); }
.ls-done { text-align: center; padding: 18px 0 6px; animation: rise .45s var(--ease); }
.ls-done .res-stats { max-width: 520px; margin: 14px auto 0; }
.ls-done .res-actions { justify-content: center; }
.ls-stars { font-size: 3rem; line-height: 1; display: flex; justify-content: center; gap: 10px; }
.ls-stars span { color: var(--line); transform: scale(.4); opacity: 0; animation: star .5s var(--ease) forwards; animation-delay: var(--d); }
.ls-stars span.on { color: var(--accent); text-shadow: 0 3px 0 var(--accent-ink); }
@keyframes star { to { transform: none; opacity: 1; } }
.ls-verdict { font-weight: 700; margin: 10px 0 0; }
.ls .typebox { margin-top: 4px; }
@media (max-width: 900px) { .ls-grid { grid-template-columns: 1fr; } .ls-map { max-height: 260px; } .ls-row { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 560px) { .ls-row { grid-template-columns: repeat(4, 1fr); } }

/* ---------- exam simulator ---------- */
.ex-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.field > span { font: 600 .7rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field select { max-width: none; width: 100%; }
.field[hidden] { display: none; }
.ex-rules { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; color: var(--ink-2); margin: 14px 0; }
.ex-status { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.ex-timer { font: 700 2rem var(--font-mono); color: var(--accent); min-width: 5ch; }
.ex-timer.low { color: var(--bad); animation: blink 1s step-end infinite; }
.ex-meta { color: var(--muted); font-size: .9rem; }
.ex-passage { max-height: 230px; overflow: auto; background: var(--surface-2); border-radius: 14px; padding: 14px 18px; font-size: 1.08rem; line-height: 1.75; user-select: none; }
.ex-passage h3 { margin: 0 0 6px; font-size: 1rem; }
.ex-passage p { margin: 0; }
.ex-label { display: block; font-weight: 700; margin: 14px 0 6px; }
.ex-answer { font: 1.08rem/1.75 var(--font-body); min-height: 200px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); }
.ex-answer:focus { outline: none; border-color: var(--accent); }
.ex-answer.nope { animation: shake .22s; border-color: var(--bad); }
.ex.hi .ex-passage, .ex.hi .ex-answer, .ex.hi .ex-review { font-family: 'Noto Sans Devanagari', var(--font-body); }
.ex-verdict { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; padding: 12px 8px 4px; }
.stamp { font: 800 clamp(1.6rem, 4vw, 2.4rem) var(--font-display); letter-spacing: .02em; padding: 6px 18px; border: 4px solid currentColor; border-radius: 14px; transform: rotate(-4deg); animation: stamp .5s var(--ease); }
.pass .stamp { color: #12a150; } .fail .stamp { color: var(--bad); }
@keyframes stamp { from { transform: rotate(-4deg) scale(1.8); opacity: 0; } to { transform: rotate(-4deg); opacity: 1; } }
.ex-verdict p { margin: 0; font-weight: 600; }
.ex-stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ex-stats .bad { color: var(--bad); }
.ex-review { background: var(--surface-2); border-radius: 14px; padding: 14px 18px; line-height: 2.2; max-height: 360px; overflow: auto; }
.ex-review del, .ex-legend del { color: var(--bad); text-decoration: line-through 2px; }
.ex-review ins, .ex-legend ins { color: var(--bad); text-decoration: none; background: var(--bad-soft); border-radius: 4px; padding: 0 3px; }
.ex-review mark, .ex-legend mark { background: none; color: inherit; border-bottom: 3px solid var(--bad); position: relative; }
.ex-review mark.half, .ex-legend mark.half { border-bottom-color: #e2951b; }
.ex-review mark small, .ex-legend mark small { position: absolute; left: 0; top: -1.3em; font-size: .7em; color: var(--bad); white-space: nowrap; line-height: 1; }
.ex-legend { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 10px; }
@media (max-width: 760px) { .ex-fields { grid-template-columns: 1fr 1fr; } }

/* ---------- small screens: one scrollable row of test options ---------- */
@media (max-width: 620px) {
  .hero { padding: 22px 0 12px; }
  h1, .home h1 { font-size: clamp(1.45rem, 7vw, 2rem); }
  .lead { font-size: 1rem; }
  .tt-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px 2px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .tt-bar::-webkit-scrollbar { display: none; }
  .tt-bar .seg { flex-wrap: nowrap; flex: none; }
  .seg button { padding: 6px 10px; white-space: nowrap; }
  .tt-bar2 .pick span { display: none; }
  .app { padding: 12px; border-radius: 18px; }
}
@media (pointer: coarse) and (hover: none) { .tt-keys { display: none; } }
.tt.finished .live { visibility: hidden; height: 0; margin: 0; min-height: 0; }

/* ---------- round 2: motion polish ---------- */
.words-wrap:has(.w.rom) { height: 6.15em; }
.words:has(.w.rom) { row-gap: .25em; }
/* keypress ripple on the on-screen keyboard */
.key::before { content: ''; position: absolute; inset: -2px; border-radius: inherit; border: 2px solid var(--accent); opacity: 0; transform: scale(.9); pointer-events: none; }
.key.down::before { animation: ripple .38s var(--ease); }
.key.bad::before { border-color: var(--bad); }
@keyframes ripple { 0% { opacity: .9; transform: scale(.92); } 100% { opacity: 0; transform: scale(1.35); } }
/* caret glow while typing */
.tt.running .caret { box-shadow: 0 0 10px 1px color-mix(in srgb, var(--caret) 55%, transparent); }
/* word streak */
.lv-streak { font: 700 .95rem var(--font-mono); color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s var(--ease); }
.lv-streak.on { opacity: 1; transform: none; }
.lv-streak.pop { animation: streakPop .5s var(--ease); }
@keyframes streakPop { 0% { transform: scale(1); } 35% { transform: scale(1.35) rotate(-4deg); } 100% { transform: scale(1); } }
.w.done:not(.wrong) { animation: settle .35s var(--ease); }
@keyframes settle { from { color: var(--accent-ink); } }
/* results entrance: stagger the stat cards */
.result .res-stats > div { opacity: 0; animation: rise .5s var(--ease) forwards; }
.result .res-stats > div:nth-child(1) { animation-delay: .08s; } .result .res-stats > div:nth-child(2) { animation-delay: .14s; } .result .res-stats > div:nth-child(3) { animation-delay: .2s; }
.result .res-stats > div:nth-child(4) { animation-delay: .26s; } .result .res-stats > div:nth-child(5) { animation-delay: .32s; } .result .res-stats > div:nth-child(6) { animation-delay: .38s; }
.res-wpm .num { display: inline-block; animation: wpmIn .7s var(--ease); }
@keyframes wpmIn { from { transform: translateY(18px) scale(.85); opacity: 0; } }
/* H1 accent word types itself in once */
h1 em .tch { opacity: 0; animation: tch .01s forwards; animation-delay: calc(var(--n) * 55ms + 250ms); }
h1 em.typing::after { content: ''; display: inline-block; width: .08em; height: .9em; margin-left: .04em; background: var(--accent); vertical-align: -.08em; animation: blink 1s step-end infinite; animation-delay: .2s; }
h1 em.typed::after { animation: blink 1s step-end 3, fadeOut .3s 3s forwards; }
@keyframes tch { to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { h1 em .tch { opacity: 1; animation: none; } h1 em.typing::after { display: none; } .result .res-stats > div { opacity: 1; } }

/* ---------- lessons v2: meet / find / mix / words / sentence ---------- */
.ls-progress { color: var(--ink-2); } .ls-progress b { color: var(--ink); }
.ls-choose { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: -4px 0 14px; }
.ls-node.flag .cap { --c: var(--surface-2); --d: var(--line); }
.ls-node.review small::after { content: ' · review'; color: var(--bad); }
.lp-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; padding: 0; counter-reset: s; }
.lp-steps li { counter-increment: s; display: inline-flex; align-items: center; gap: 6px; font: 600 .78rem var(--font-body); color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 4px 12px 4px 4px; transition: background .25s, color .25s; }
.lp-steps li::before { content: counter(s); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); font: 700 .7rem var(--font-mono); }
.lp-steps li.cur { background: var(--accent-soft); color: var(--accent-ink); }
.lp-steps li.cur::before { background: var(--accent); color: #fff; }
.lp-steps li.done { color: var(--ink-2); }
.lp-steps li.done::before { content: '✓'; background: #12a150; color: #fff; }
.lp-stage { min-height: 250px; }
.lp-stage.enter > * { animation: rise .45s var(--ease) both; }
.lp-msg { min-height: 1.6em; margin: 10px 0 0; font-weight: 600; color: var(--ink); text-align: center; }
.lp-msg.flash:not(:empty) { animation: rise .3s var(--ease); background: var(--accent-soft); border-radius: 10px; padding: 6px 12px; }
.lp-note { color: var(--ink-2); margin: 0 0 10px; text-align: center; }
.lp-kbtoggle { display: flex; justify-content: center; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); }
.ls-play .hidden-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; font-size: 16px; }
.ls-play { position: relative; }
.kb-dim .kb .key:not(.next) { opacity: .28; filter: saturate(.4); transition: opacity .3s; }
.hands .fg.on { animation: tap 1.1s var(--ease) infinite; }
@keyframes tap { 0%, 100% { transform: translateY(-10px); } 45% { transform: translateY(-2px); } 60% { transform: translateY(-12px); } }
/* onboarding */
.ob { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ob-card { background: var(--surface-2); border-radius: 16px; padding: 16px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--k) * 90ms); }
.ob-ic { font-size: 2rem; }
.ob-card h3 { font: 800 1.1rem var(--font-display); margin: 6px 0; }
.ob-card p { color: var(--ink-2); margin: 0 0 10px; font-size: .95rem; }
.ob-check { text-align: center; margin-top: 16px; }
.ob-check p { margin: 4px 0; }
.ob-done { text-align: center; padding: 20px 0; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .85rem; }
/* meet the keys */
.meet { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.meet-lead { grid-column: 1 / -1; font-size: 1.05rem; background: var(--surface-2); border-radius: 14px; padding: 12px 16px; margin: 0; }
.meet-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; background: var(--surface-2); border-radius: 16px; padding: 14px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--k, 0) * 110ms); }
.meet-card h3 { margin: 0; font: 800 1.3rem var(--script-font, var(--font-body)); display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.meet-card .snd { font: 600 .95rem var(--font-mono); color: var(--accent-ink); }
.tag { font: 600 .68rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; background: var(--surface); border-radius: 6px; padding: 2px 6px; color: var(--ink-2); }
.fing { margin: 4px 0; font-weight: 600; color: var(--ink-2); font-size: .9rem; }
.meet-card ul { margin: 4px 0 0; padding-left: 1.1em; font-size: .92rem; color: var(--ink-2); }
.meet-card .ex { margin: 6px 0 0; font-size: .92rem; } .meet-card .ex b { font-family: var(--script-font, inherit); font-size: 1.1em; }
.cap.giant-sm { width: 72px; height: 68px; font-size: 1.7rem; border-bottom-width: 7px; border-radius: 16px; animation: capTap 1.6s var(--ease) infinite; }
.cap.giant-sm span { font-family: var(--script-font, var(--font-mono)); max-width: none; }
@keyframes capTap { 0%, 70%, 100% { transform: none; border-bottom-width: 7px; } 80% { transform: translateY(5px); border-bottom-width: 2px; } }
.meet-act { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
/* find the key */
.find { text-align: center; }
.find-hint { font-weight: 600; margin: 0 0 14px; color: var(--ink-2); }
.find-key { display: grid; place-items: center; min-height: 150px; }
.cap.giant { width: 128px; height: 120px; font-size: 4rem; border-radius: 24px; border-bottom-width: 12px; transition: transform .12s, border-bottom-width .12s, background .2s; animation: keyPop .35s var(--ease); }
.cap.giant span { font-family: var(--script-font, var(--font-mono)); max-width: none; overflow: visible; }
.cap.giant.hit { transform: translateY(9px) scale(.96); border-bottom-width: 3px; background: #b9f0c9; }
.cap.giant.miss { animation: shake .25s; background: var(--bad-soft); }
@keyframes keyPop { from { transform: scale(.6); opacity: 0; } }
.find-next { font: 600 1.05rem var(--script-font, var(--font-mono)); letter-spacing: .1em; margin: 12px 0; }
.find-bar { height: 6px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin: 12px auto 0; max-width: 520px; }
.find-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .25s var(--ease); }
/* results */
.ls-acc { margin: 6px 0; } .ls-acc span { font: 800 2.6rem var(--font-display); color: var(--accent); } .ls-acc small { color: var(--muted); font-size: 1rem; }
.tricky { display: flex; justify-content: center; flex-wrap: wrap; align-items: center; gap: 8px; }
.tricky .keycap small { font: 600 .7rem var(--font-mono); color: var(--bad); margin-left: 3px; }
@media (max-width: 760px) { .ob { grid-template-columns: 1fr; } .cap.giant { width: 104px; height: 98px; font-size: 3.2rem; } }
@media (prefers-reduced-motion: reduce) { .hands .fg.on, .cap.giant-sm { animation: none; } }
.lp-steps[hidden] { display: none; }
.tt-hint { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 9px 12px; margin: 12px 0 0; font-size: .93rem; animation: rise .4s var(--ease); }
.tt-hint[hidden] { display: none; }
.tt-hint-x { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink-2); font-size: 1rem; padding: 2px 6px; border-radius: 6px; }
.tt-hint-x:hover { background: var(--surface); }

/* bilingual keycaps: English letter bottom-left, language letter big, Shift letter top-right */
.kb.bi .key { place-items: center end; padding-right: 12%; }
.kb.bi .key.mod, .kb.bi .key[data-code="Space"] { place-items: center; padding-right: 0; }
.kb.bi .key i.en { position: absolute; left: 11%; bottom: 12%; font: 700 calc(var(--u) * .24) var(--font-mono); font-style: normal; color: var(--key-ink); opacity: .55; line-height: 1; }
.kb.bi .key b { font-family: var(--script-font, var(--font-body)); font-size: calc(var(--u) * .4); color: var(--accent-ink); font-weight: 700; }
.kb.bi .key small { left: auto; right: 11%; top: 7%; font-family: var(--script-font, var(--font-body)); color: var(--accent-ink); opacity: .8; }
.kb.bi .key.bad b, .kb.bi .key.bad i.en, .kb.bi .key.bad small { color: #fff; }

/* bilingual keycaps: English letter bottom-left, language letter big, Shift letter top-right */
.kb.bi .key:not(.mod):not([data-code="Space"]) { place-items: center end; padding-right: calc(var(--u) * .16); }
.kb.bi .key i.en { position: absolute; left: 11%; bottom: 13%; font: 700 calc(var(--u) * .24) var(--font-mono); font-style: normal; color: var(--key-ink); opacity: .55; line-height: 1; }
.kb.bi .key:not(.mod) b { font-family: 'Noto Sans Devanagari', var(--font-body); font-size: calc(var(--u) * .42); color: var(--accent-ink); font-weight: 700; }
.kb.bi .key small { left: auto; right: 12%; top: 6%; font-family: 'Noto Sans Devanagari', var(--font-body); color: var(--accent-ink); opacity: .85; }
.kb.bi .key.bad b, .kb.bi .key.bad i.en, .kb.bi .key.bad small { color: #fff; }
