@font-face {
  font-family: 'Recursive';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(../fonts/recursive-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;
}
@font-face {
  font-family: 'Recursive';
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(../fonts/recursive-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --ground: #F3F1F9;
  --paper: #FFFFFF;
  --ink: #241F3B;
  --ink-2: #4A4566;
  --muted: #6E6987;
  --line: #E2DEEE;
  --line-2: #CBC5DF;
  --gold: #F0A419;
  --bad: #E0475A;
  --heat-c: #D93C6A;
  --f-p: #F28CB8;
  --f-r: #F6AE4C;
  --f-m: #5CC793;
  --f-i: #6C9EF5;
  --f-t: #B4A2F0;
  --shadow: 0 1px 0 rgba(36, 31, 59, .04), 0 8px 24px -12px rgba(36, 31, 59, .18);
  --mix: 24%;
  --edge: 55%;
  --key-ink: var(--ink-2);
  --casl: .7;
  --mono: 0;
  --g: 5px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ground: #16132A; --paper: #211D38; --ink: #F2EFFA; --ink-2: #D2CCE8; --muted: #9D97BA; --line: #322D52; --line-2: #48416F;
  --gold: #FFC24A; --bad: #FF6B7A; --heat-c: #FF5C8E; --mix: 14%; --edge: 78%;
  --f-p: #F78DBE; --f-r: #F7B65C; --f-m: #5FD49B; --f-i: #79A8FF; --f-t: #BBA9FF;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #16132A; --paper: #211D38; --ink: #F2EFFA; --ink-2: #D2CCE8; --muted: #9D97BA; --line: #322D52; --line-2: #48416F;
    --gold: #FFC24A; --bad: #FF6B7A; --heat-c: #FF5C8E; --mix: 14%; --edge: 78%;
    --f-p: #F78DBE; --f-r: #F7B65C; --f-m: #5FD49B; --f-i: #79A8FF; --f-t: #BBA9FF;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
* { font-variation-settings: 'CASL' var(--casl), 'MONO' var(--mono); }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: 'Recursive', ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.55; font-weight: 420;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; }
p { margin: 0; }
small { font-size: .8em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px 72px; }

/* ---------- controls ---------- */
button, .btn {
  font: inherit; font-weight: 650; font-size: .95rem; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 40px; padding: 0 18px; border-radius: 12px;
  border: 1.5px solid var(--line-2); background: var(--paper);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background-color .15s ease, border-color .15s ease;
}
button:hover, .btn:hover { border-color: var(--ink-2); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.primary, .btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); box-shadow: 0 3px 0 color-mix(in oklab, var(--ink) 55%, var(--ground)); }
.primary:hover, .btn.primary:hover { background: color-mix(in oklab, var(--ink) 88%, var(--f-i)); border-color: transparent; }
.primary:active { box-shadow: 0 1px 0 color-mix(in oklab, var(--ink) 55%, var(--ground)); transform: translateY(2px); }
.big { min-height: 52px; padding: 0 26px; font-size: 1.06rem; border-radius: 14px; }
.ghost, .btn.ghost { border-color: transparent; background: transparent; }
.ghost:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); border-color: transparent; }
.danger { color: var(--bad); }
.linkish { border: 0; background: none; padding: 0; min-height: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
:focus-visible { outline: 3px solid var(--f-i); outline-offset: 2px; border-radius: 10px; }
select {
  font: inherit; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 10px;
  min-height: 40px; padding: 0 34px 0 12px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat;
}

/* ---------- header ---------- */
.top {
  max-width: 1120px; margin: 0 auto; padding: 18px 24px; display: flex; align-items: center; gap: 28px;
}
.brand { font-size: 1.5rem; font-weight: 860; text-decoration: none; letter-spacing: -0.02em; display: inline-flex; align-items: center; --casl: 1; }
.brand-cap {
  display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin-right: 1px;
  background: var(--f-i); color: #1d1a33; border-radius: .3em; box-shadow: 0 3px 0 color-mix(in oklab, var(--f-i) 55%, #1d1a33); transform: translateY(-2px);
}
.tabs { display: flex; gap: 4px; }
.tab { text-decoration: none; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 650; position: relative; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 3px; border-radius: 3px; background: var(--ink); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rank { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink-2); font-size: .92rem; padding: 4px 12px 4px 6px; border-radius: 999px; background: var(--paper); border: 1.5px solid var(--line); }
.rank b { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.rank-e { font-size: 1.3rem; line-height: 1; }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 700; color: var(--ink-2); }
.lvl svg { width: 28px; height: 28px; transform: rotate(-90deg); }
.lvl circle { fill: none; stroke-width: 4; }
.lvl-track { stroke: var(--line); }
.lvl-fill { stroke: var(--gold); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.icon-btn { width: 40px; padding: 0; position: relative; border-color: transparent; background: transparent; }
.icon-btn:hover { background: var(--paper); border-color: var(--line); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn .dot, .acc-state .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--f-m); box-shadow: 0 0 0 2px var(--ground); }
body.typing .tabs { display: none; }
body.typing .top-right { visibility: hidden; }

/* ---------- keycaps ---------- */
.f-lp, .f-rp { --fc: var(--f-p); }
.f-lr, .f-rr { --fc: var(--f-r); }
.f-lm, .f-rm { --fc: var(--f-m); }
.f-li, .f-ri { --fc: var(--f-i); }
.f-th { --fc: var(--f-t); }
.f-x { --fc: var(--line-2); }
.cap {
  --s: 64px;
  display: inline-grid; place-items: center; min-width: var(--s); height: var(--s); padding: 0 .25em;
  border-radius: calc(var(--s) * .24); background: var(--fc); color: #1d1a33;
  font-weight: 800; font-size: calc(var(--s) * .46); line-height: 1; --mono: 1; --casl: 1;
  box-shadow: 0 calc(var(--s) * .08) 0 color-mix(in oklab, var(--fc) 50%, #1d1a33), inset 0 -2px 0 rgba(255, 255, 255, .25);
  transform: translateY(calc(var(--s) * -.04));
}
.cap.wide { min-width: calc(var(--s) * 1.5); }
.cap.mini { --s: 30px; margin: 0 2px; vertical-align: middle; }
.caps { display: inline-flex; gap: 12px; align-items: center; }

/* ---------- learn ---------- */
.hero {
  display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 1.85fr); gap: 40px; align-items: center;
  padding: 20px 0 44px;
}
.hero-meta { color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.hero-title { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; font-size: 2.1rem; }
.hero-title .caps { padding-bottom: 6px; }
.hero-name { font-size: 1.9rem; }
.hero-sub { margin-top: 14px; color: var(--ink-2); font-size: 1.06rem; max-width: 34ch; }
.tip { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: color-mix(in oklab, var(--f-i) 14%, var(--paper)); color: var(--ink-2); max-width: 40ch; font-size: .95rem; }
.hero-actions { display: flex; align-items: center; gap: 16px; margin-top: 26px; }
.step-pips { display: inline-flex; gap: 6px; }
.step-pips i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.step-pips i.s1 { background: color-mix(in oklab, var(--gold) 45%, var(--paper)); }
.step-pips i.s2 { background: color-mix(in oklab, var(--gold) 75%, var(--paper)); }
.step-pips i.s3 { background: var(--gold); }
.hero-kb { margin: 0; padding: 22px 22px 16px; background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: .85rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.lg-known { background: linear-gradient(90deg, var(--f-p) 0 25%, var(--f-r) 25% 50%, var(--f-m) 50% 75%, var(--f-i) 75%); opacity: .55; }
.lg-fresh { background: var(--f-i); box-shadow: 0 0 0 2px var(--ink); }
.lg-todo { border: 1.5px dashed var(--line-2); }

.path h2, .stats h2, .recent h2 { font-size: 1.3rem; margin-bottom: 16px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 14px; }
.tile {
  display: grid; grid-template-rows: auto 1fr auto; gap: 6px; height: 100%; min-height: 128px; padding: 10px 12px 12px;
  text-decoration: none; background: var(--paper); border-radius: 16px; border: 1.5px solid var(--line);
  box-shadow: 0 4px 0 var(--line); transition: transform .1s ease, box-shadow .1s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--line-2); }
.tile:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line-2); }
.tile.current { border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.tile.locked { background: transparent; border-style: dashed; box-shadow: none; color: var(--muted); }
.tile.locked .cap { filter: grayscale(1); opacity: .45; }
.tile-n { font-size: .8rem; font-weight: 700; color: var(--muted); }
.tile-caps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tile-caps .cap { --s: 34px; }
.tile-name { font-size: .82rem; font-weight: 650; color: var(--ink-2); line-height: 1.2; }
.tile-name:empty { display: none; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; }
.tile-stars { font-weight: 750; color: var(--ink-2); }
.tile.done .tile-stars { color: color-mix(in oklab, var(--gold) 80%, var(--ink)); }
.tile-stars small { color: var(--muted); font-weight: 500; }
.lock { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* ---------- lesson ---------- */
.back { display: inline-block; margin: 6px 0 18px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--ink); }
.lesson { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px 48px; align-items: start; }
.lesson-head { grid-column: 1 / -1; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.step { display: grid; grid-template-columns: auto 1fr auto auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1.5px solid var(--line); }
.step:first-child { border-top: 1.5px solid var(--line); }
.step-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 1.5px solid var(--line-2); font-weight: 750; font-size: .9rem; }
.step-body { display: flex; flex-direction: column; }
.step-body span { color: var(--muted); font-size: .9rem; }
.stars { display: inline-flex; gap: 1px; font-size: 1.15rem; line-height: 1; }
.stars i { font-style: normal; color: var(--line-2); }
.stars i.on { color: var(--gold); }
.lesson-kb { margin: 0; padding: 18px; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); }

/* ---------- practice ---------- */
.page-title { font-size: 2rem; margin: 10px 0 8px; }
.page-sub { color: var(--muted); margin-bottom: 26px; }
.modes { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.mode { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 18px 0; border-bottom: 1.5px solid var(--line); }
.mode:first-child { border-top: 1.5px solid var(--line); }
.mode-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; }
.mode-icon svg { width: 30px; height: 30px; fill: none; stroke: #1d1a33; stroke-width: 2; stroke-linecap: round; }
.mode-icon .fillme { fill: #1d1a33; }
.mi-words { background: var(--f-m); } .mi-words svg rect { fill: rgba(255,255,255,.55); stroke: none; }
.mi-sentences { background: var(--f-i); }
.mi-weak { background: var(--f-p); }
.mi-test { background: var(--f-r); }
.mode-body { display: flex; flex-direction: column; gap: 2px; }
.mode-body b { font-size: 1.08rem; }
.mode-body span { color: var(--muted); }

/* ---------- stats ---------- */
.rankcard { display: flex; gap: 26px; align-items: center; padding: 26px 28px; background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); margin-bottom: 30px; }
.rank-big { font-size: 5.2rem; line-height: 1; filter: drop-shadow(0 6px 10px rgba(36, 31, 59, .15)); }
.rankcard h2 { font-size: 2rem; margin-bottom: 6px; }
.rankcard p { color: var(--ink-2); }
.rankcard .muted { margin-top: 4px; color: var(--muted); }
.ladder { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 14px; font-size: 1.2rem; }
.ladder span { opacity: .3; filter: grayscale(1); }
.ladder .past { opacity: .75; filter: none; }
.ladder .now { opacity: 1; filter: none; transform: scale(1.25); }
.big-num { font-size: 3rem; font-weight: 850; }
.totals { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; margin: 0 0 34px; }
.totals div { border-left: 3px solid var(--line-2); padding-left: 14px; }
.totals dt { color: var(--muted); font-size: .88rem; }
.totals dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.totals small { font-size: .55em; color: var(--muted); font-weight: 600; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.chart { margin: 0; }
.chart figcaption { font-weight: 700; margin-bottom: 8px; }
.chart-plot { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--ink); stroke: var(--ground); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: var(--paper); border-radius: 10px; padding: 7px 10px; font-size: .8rem; line-height: 1.35; display: flex; flex-direction: column; white-space: nowrap; box-shadow: var(--shadow); }
.tooltip b { font-size: .95rem; }
[data-toggle-table] { margin: 12px 0 0; }
.table-wrap { margin-top: 14px; overflow-x: auto; }
.heat { margin-top: 44px; }
.heat .muted { margin-bottom: 14px; }
.heat .kb-slot { max-width: 760px; padding: 18px; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow); }
.heat-legend { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.heat-legend i { width: 140px; height: 10px; border-radius: 5px; background: linear-gradient(90deg, color-mix(in oklab, var(--heat-c) 6%, var(--paper)), color-mix(in oklab, var(--heat-c) 80%, var(--paper))); }
.recent { margin-top: 44px; }
.runs { width: 100%; max-width: 760px; border-collapse: collapse; font-size: .93rem; }
.runs th { text-align: left; font-weight: 650; color: var(--muted); font-size: .82rem; padding: 6px 10px 6px 0; border-bottom: 1.5px solid var(--line-2); }
.runs td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.runs .num { text-align: right; }
.runs small { color: var(--muted); }
.empty { text-align: center; padding: 60px 20px; display: grid; justify-items: center; gap: 18px; }
.empty-e { font-size: 4rem; }

/* ---------- keyboard ---------- */
.kb-slot, .kb-host { container-type: inline-size; }
.kb { --u: min(46px, calc((100cqi - 14 * var(--g)) / 15)); display: flex; flex-direction: column; gap: var(--g); align-items: center; user-select: none; }
.kb-row { display: flex; gap: var(--g); }
.key {
  --w: 1; position: relative;
  width: calc(var(--w) * var(--u) + (var(--w) - 1) * var(--g)); height: calc(var(--u) * .94);
  border-radius: calc(var(--u) * .2);
  background: color-mix(in oklab, var(--fc) var(--mix), var(--paper));
  box-shadow: 0 calc(var(--u) * .07) 0 color-mix(in oklab, var(--fc) var(--edge), var(--paper));
  color: var(--ink-2);
  display: grid; place-items: center;
  font-weight: 700; font-size: calc(var(--u) * .38); line-height: 1; --mono: 1;
  transition: transform .09s ease, box-shadow .09s ease, background-color .15s ease;
}
.key .k-alt { position: absolute; top: calc(var(--u) * .08); right: calc(var(--u) * .12); font-size: calc(var(--u) * .24); font-weight: 600; opacity: .55; }
.key.mod { background: color-mix(in oklab, var(--ink) 5%, var(--paper)); box-shadow: 0 calc(var(--u) * .07) 0 var(--line); color: var(--muted); font-size: calc(var(--u) * .34); }
.key.f-th { background: color-mix(in oklab, var(--fc) 18%, var(--paper)); }
.key.home::after { content: ''; position: absolute; bottom: calc(var(--u) * .14); width: calc(var(--u) * .28); height: 2.5px; border-radius: 2px; background: currentColor; opacity: .55; }
.key.dead .k-main { opacity: .7; }
.key.unknown { background: transparent; box-shadow: none; outline: 1.5px dashed var(--line-2); outline-offset: -1.5px; color: color-mix(in oklab, var(--muted) 60%, transparent); }
.key.fresh { background: var(--fc); color: #1d1a33; box-shadow: 0 calc(var(--u) * .07) 0 color-mix(in oklab, var(--fc) 50%, #1d1a33), 0 0 0 3px var(--ink); z-index: 1; animation: fresh 1.6s ease-in-out 3; }
@keyframes fresh { 50% { transform: translateY(-3px); } }
.key.next { background: var(--fc); color: #1d1a33; transform: translateY(-2px); box-shadow: 0 calc(var(--u) * .1) 0 color-mix(in oklab, var(--fc) 50%, #1d1a33), 0 0 0 3px var(--ink); z-index: 1; }
.key.mod.next { --fc: var(--f-t); }
.key.next2 { outline: 2px dashed var(--ink); outline-offset: 1px; }
.key.press { transform: translateY(2px); box-shadow: 0 0 0 transparent; }
.key.press-bad { background: var(--bad); color: #fff; transform: translateY(2px); box-shadow: none; }
.no-hints .key.next, .no-hints .key.next2 { background: color-mix(in oklab, var(--fc) var(--mix), var(--paper)); color: var(--ink-2); transform: none; outline: none; box-shadow: 0 calc(var(--u) * .07) 0 color-mix(in oklab, var(--fc) var(--edge), var(--paper)); }
.no-hints .key.mod.next { background: color-mix(in oklab, var(--ink) 5%, var(--paper)); }
.kb-heat .key:not(.mod) { background: color-mix(in oklab, var(--heat-c) calc(var(--heat, 0) * 80% + 6%), var(--paper)); box-shadow: 0 calc(var(--u) * .07) 0 var(--line); color: var(--ink); }
.kb-heat .key:not(.mod):not(.heat-on) { background: var(--paper); outline: 1.5px solid var(--line); outline-offset: -1.5px; color: var(--muted); }
.kb-heat .key.home::after { opacity: .3; }

/* ---------- hands ---------- */
.hands-host { display: flex; justify-content: center; margin-top: -6px; }
.hands { width: min(420px, 90%); height: auto; }
.hands .palm { fill: color-mix(in oklab, var(--ink) 6%, var(--paper)); stroke: var(--line-2); stroke-width: 1.5; }
.hands .fg { fill: var(--fc); opacity: .28; transform-box: fill-box; transition: opacity .12s ease, transform .12s ease; stroke: color-mix(in oklab, var(--fc) 55%, var(--ink)); stroke-width: 0; }
.hands .fg.on { opacity: 1; transform: translateY(-6px); stroke-width: 2; }
.hands .f-lp, .hands .f-rp { --fc: var(--f-p); }
.hands .f-lr, .hands .f-rr { --fc: var(--f-r); }
.hands .f-lm, .hands .f-rm { --fc: var(--f-m); }
.hands .f-li, .hands .f-ri { --fc: var(--f-i); }

/* ---------- run ---------- */
.run { max-width: 980px; margin: 0 auto; padding-top: 4px; }
.run-bar { display: flex; align-items: center; gap: 16px; min-height: 44px; }
.run-exit { padding-left: 8px; }
.run-title { font-weight: 700; color: var(--ink-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-live { display: flex; gap: 22px; font-variant-numeric: tabular-nums; color: var(--muted); }
.run-live b { color: var(--ink); font-size: 1.25rem; font-weight: 800; }
.run-live small { font-size: .82rem; margin-left: 2px; }
.run-progress { height: 4px; border-radius: 4px; background: var(--line); margin: 10px 0 16px; overflow: hidden; }
.run-progress i { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 4px; transition: width .2s linear; }
.text-wrap { position: relative; }
.text-box {
  --mono: 1; --casl: .85;
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow); padding: 26px 34px;
  font-size: clamp(21px, 3vw, 31px); line-height: 1.75; cursor: text;
  font-weight: 520; outline: none;
}
.text-view { max-height: calc(3 * 1.75em); overflow: hidden; }
.text-inner { position: relative; transition: transform .18s ease; }
.w { display: inline-block; white-space: pre; }
.c { border-radius: 6px; position: relative; color: var(--ink); }
.c.done { color: color-mix(in oklab, var(--ink) 34%, var(--paper)); }
.c.err { color: var(--bad); background: color-mix(in oklab, var(--bad) 12%, transparent); }
.c.cur { background: color-mix(in oklab, var(--f-i) 26%, transparent); box-shadow: inset 0 -3px 0 var(--ink); }
.c.bad { background: color-mix(in oklab, var(--bad) 28%, transparent); box-shadow: inset 0 -3px 0 var(--bad); animation: nudge .18s ease; }
@keyframes nudge { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.trap { position: absolute; left: 12px; top: 12px; width: 2px; height: 2px; opacity: 0; border: 0; padding: 0; resize: none; font-size: 16px; caret-color: transparent; }
.paused { position: absolute; inset: 0; border-radius: 22px; display: grid; place-content: center; justify-items: center; gap: 12px; background: color-mix(in oklab, var(--paper) 72%, transparent); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); text-align: center; color: var(--ink-2); }
.run-hint { min-height: 1.6em; text-align: center; color: var(--ink-2); font-weight: 600; margin: 12px 0 8px; }
.run .kb-host { max-width: 760px; margin: 0 auto; }

/* ---------- dialogs ---------- */
.dlg { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: calc(100vw - 24px); overflow: visible; }
.dlg::backdrop { background: color-mix(in oklab, #120f22 45%, transparent); backdrop-filter: blur(3px); }
.res, .sheet { background: var(--paper); border-radius: 24px; box-shadow: 0 30px 80px -20px rgba(18, 15, 34, .5); width: 480px; max-width: 100%; padding: 28px; position: relative; }
.sheet { width: 560px; max-height: calc(100vh - 40px); overflow: auto; }
.sheet.narrow { width: 440px; }
.res { text-align: center; }
.res-stars { display: flex; justify-content: center; gap: 6px; font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }
.res-stars i { font-style: normal; color: var(--line-2); }
.res-stars i.on { color: var(--gold); animation: pop .45s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: var(--d); }
@keyframes pop { from { transform: scale(.2) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
.res-animal { display: grid; justify-items: center; gap: 4px; margin-bottom: 14px; }
.res-e { font-size: 4rem; line-height: 1.1; }
.res-animal h2 { font-size: 1.45rem; }
.res-nums { display: grid; grid-template-columns: repeat(3, 1fr); margin: 10px 0 14px; padding: 14px 0; border-top: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); }
.res-nums dt { color: var(--muted); font-size: .82rem; }
.res-nums dd { margin: 0; font-size: 1.7rem; font-weight: 820; font-variant-numeric: tabular-nums; }
.res-nums small { font-size: .55em; color: var(--muted); font-weight: 600; }
.res-msg { font-weight: 650; }
.res-hint { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chip { font-size: .82rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: color-mix(in oklab, var(--f-m) 30%, var(--paper)); }
.chip.gold { background: color-mix(in oklab, var(--gold) 35%, var(--paper)); }
.chip.soft { background: color-mix(in oklab, var(--ink) 6%, var(--paper)); color: var(--ink-2); }
.res-missed { margin-top: 14px; color: var(--ink-2); font-size: .92rem; }
.res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.sheet .res-actions { justify-content: flex-start; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.sheet-head h2 { font-size: 1.4rem; }
.fields { display: grid; gap: 14px; }
.field { display: grid; grid-template-columns: 1fr minmax(0, 1.2fr); align-items: center; gap: 12px; }
.field > span { font-weight: 600; }
.switches { display: grid; gap: 2px; margin-top: 18px; padding-top: 12px; border-top: 1.5px solid var(--line); }
.switch { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; padding: 9px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.sw { width: 40px; height: 24px; border-radius: 12px; background: var(--line-2); position: relative; transition: background-color .15s ease; margin-top: 1px; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--paper); transition: transform .15s ease; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + .sw { background: var(--ink); }
.switch input:checked + .sw::after { transform: translateX(16px); }
.switch input:focus-visible + .sw { outline: 3px solid var(--f-i); outline-offset: 2px; }
.sw-text { display: flex; flex-direction: column; }
.sw-text small { color: var(--muted); font-size: .85rem; }
.data { margin-top: 16px; padding-top: 16px; border-top: 1.5px solid var(--line); }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.data-msg { min-height: 1.4em; margin-top: 8px; font-size: .9rem; color: var(--ink-2); }
.sheet-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.acc-form { display: grid; gap: 4px; margin-top: 16px; }
.field-col { display: grid; gap: 6px; font-weight: 600; }
.field-col input { font: inherit; font-weight: 500; color: var(--ink); background: var(--paper); border: 1.5px solid var(--line-2); border-radius: 10px; min-height: 44px; padding: 0 12px; }
.field-col input[name=code] { --mono: 1; font-size: 1.3rem; letter-spacing: .12em; }
.acc-form .res-actions { justify-content: flex-start; margin-top: 12px; }
.acc-msg { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in oklab, var(--bad) 12%, var(--paper)); color: var(--ink); font-size: .92rem; }
.acc-state { position: relative; padding-left: 18px; font-weight: 700; margin-bottom: 8px; }
.acc-state .dot { top: 8px; left: 0; right: auto; }
.sheet p + p { margin-top: 8px; }

.confetti { position: absolute; left: 50%; top: 30%; width: 0; height: 0; pointer-events: none; }
.confetti i { position: absolute; width: 9px; height: 14px; border-radius: 3px; animation: conf 1.3s cubic-bezier(.2, .7, .4, 1) forwards; opacity: 0; }
@keyframes conf {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  60% { opacity: 1; }
  100% { transform: translate(var(--x), calc(var(--y) + 260px)) rotate(var(--r)); opacity: 0; }
}

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 12px; font-weight: 650; opacity: 0; transition: opacity .25s ease, transform .25s ease; z-index: 10; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .lesson { grid-template-columns: 1fr; }
  .totals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px 56px; }
  .top { padding: 14px 16px; gap: 12px; flex-wrap: wrap; }
  .tabs { order: 3; width: 100%; }
  .tab { padding: 6px 10px; }
  .rank { display: none; }
  .hero-title { font-size: 1.7rem; }
  .cap { --s: 54px; }
  .hero-kb, .lesson-kb, .heat .kb-slot { padding: 12px; border-radius: 16px; }
  .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rankcard { flex-direction: column; align-items: flex-start; padding: 20px; }
  .step { grid-template-columns: auto 1fr auto; }
  .step .stars { grid-column: 2; }
  .step button { grid-column: 3; grid-row: 1 / span 2; }
  .mode { grid-template-columns: auto 1fr; }
  .mode button { grid-column: 1 / -1; justify-self: start; }
  .text-box { padding: 18px 20px; }
  .run-live { gap: 12px; }
  .run-title { display: none; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .res, .sheet { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (forced-colors: active) {
  .key.next, .key.fresh { outline: 3px solid Highlight; }
  .c.cur { outline: 2px solid Highlight; }
}
