/* =========================================================================
   Typing Okay — design system
   Neutral paper + ink, one accent (okay green). Light & dark.
   ========================================================================= */

:root {
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #F0EEE8;
  --surface-3: #E6E3DB;
  --border: #E4E1D9;
  --border-strong: #CDC9BF;
  --text: #1C1B19;
  --text-2: #5E5B54;
  --text-3: #857F75;
  --accent: #0E7C66;
  --accent-hover: #0A6553;
  --accent-soft: #E1F0EB;
  --on-accent: #FFFFFF;
  --error: #C8382F;
  --error-soft: #FBE7E5;
  --seq-1: #7FC4B2; --seq-2: #4FAA92; --seq-3: #2A9079; --seq-4: #0E7C66; --seq-5: #0A5A4A;
  --heat-1: #EBA59D; --heat-2: #DF7B70; --heat-3: #CF4C40; --heat-4: #AE3128; --heat-5: #86221B;
  --shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 6px 20px rgba(28, 27, 25, .05);
  --shadow-lg: 0 18px 50px rgba(28, 27, 25, .14);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1120px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312; --surface: #1B1B19; --surface-2: #232320; --surface-3: #2D2C29;
    --border: #2F2E2A; --border-strong: #45433E;
    --text: #ECEAE4; --text-2: #A9A59C; --text-3: #77736A;
    --accent: #3CCFAE; --accent-hover: #63DCC1; --accent-soft: #15302A; --on-accent: #0B1F1A;
    --error: #FF6B5E; --error-soft: #3A1D1A;
    --seq-1: #1F6656; --seq-2: #2A8A73; --seq-3: #33AC8F; --seq-4: #3CCFAE; --seq-5: #9BE9D6;
    --heat-1: #8A342D; --heat-2: #B0443A; --heat-3: #D9564A; --heat-4: #FF6B5E; --heat-5: #FFA79E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312; --surface: #1B1B19; --surface-2: #232320; --surface-3: #2D2C29;
  --border: #2F2E2A; --border-strong: #45433E;
  --text: #ECEAE4; --text-2: #A9A59C; --text-3: #77736A;
  --accent: #3CCFAE; --accent-hover: #63DCC1; --accent-soft: #15302A; --on-accent: #0B1F1A;
  --error: #FF6B5E; --error-soft: #3A1D1A;
  --seq-1: #1F6656; --seq-2: #2A8A73; --seq-3: #33AC8F; --seq-4: #3CCFAE; --seq-5: #9BE9D6;
  --heat-1: #8A342D; --heat-2: #B0443A; --heat-3: #D9564A; --heat-4: #FF6B5E; --heat-5: #FFA79E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.4rem, 1.2rem + .8vw, 1.85rem); }
h3 { font-size: 1.15rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); color: var(--text); }
.ic { width: 20px; height: 20px; flex: none; fill: none; display: inline-block; vertical-align: -.22em; }
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 28px; height: 28px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
.main { flex: 1; width: 100%; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
kbd {
  font: 500 .78em/1 var(--mono);
  padding: .28em .5em .32em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  white-space: nowrap;
}
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---------- header ---------- */
.site-header { position: relative; z-index: 40; transition: opacity .4s var(--ease); }
.header-inner { display: flex; align-items: center; gap: 18px; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.logo:hover { color: var(--text); }
.logo-key {
  display: grid; place-items: center;
  width: 34px; height: 32px;
  font: 600 13px/1 var(--mono);
  letter-spacing: -.02em;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 9px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18);
  padding-bottom: 2px;
  transition: transform .15s var(--ease);
}
.logo:hover .logo-key { transform: translateY(1px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
.logo-text { font-weight: 500; font-size: 1.08rem; letter-spacing: -.03em; color: var(--text-2); }
.logo-text b { font-weight: 700; color: var(--text); }
.nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.nav > a, .nav-more-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: .93rem;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: 0;
  white-space: nowrap;
}
.nav > a:hover, .nav-more-btn:hover { color: var(--text); background: var(--surface-2); }
.nav > a[aria-current="page"], .nav-more-btn.is-active { color: var(--text); background: var(--surface-2); }
.nav-more { position: relative; }
.nav-more-btn .ic { transition: transform .2s; }
.nav-more-btn[aria-expanded="true"] .ic { transform: rotate(180deg); }
.more-menu {
  position: absolute; top: calc(100% + 8px); left: -40px;
  width: 300px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
}
.nav-more.is-open .more-menu { display: block; animation: pop .16s var(--ease); }
.more-menu a { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 10px; text-decoration: none; color: var(--text); }
.more-menu a:hover { background: var(--surface-2); color: var(--text); }
.more-menu a .ic { margin-top: 2px; color: var(--accent); }
.more-menu b { display: block; font-weight: 600; font-size: .93rem; }
.more-menu small { display: block; color: var(--text-2); font-size: .8rem; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: .86rem; font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .ic { width: 17px; height: 17px; }
.streak-chip .ic { color: var(--text-3); }
.streak-chip.is-active .ic { color: var(--accent); }
.streak-chip.is-pending .ic { color: var(--text-2); }
.rank-chip { padding-left: 5px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 0;
  background: none;
  color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.when-dark, .when-open { display: none; }
:root[data-theme="dark"] .when-dark { display: block; }
:root[data-theme="dark"] .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .when-dark { display: block; }
  :root:not([data-theme="light"]) .when-light { display: none; }
}
.menu-btn { display: none; }
.menu-btn[aria-expanded="true"] .when-open { display: block; }
.menu-btn[aria-expanded="true"] .when-closed { display: none; }

@media (max-width: 960px) {
  .menu-btn { display: inline-grid; }
  .nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    margin: 0; padding: 10px 16px 18px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: calc(100vh - 68px); overflow-y: auto;
  }
  .nav.is-open { display: flex; animation: pop .16s var(--ease); }
  .nav > a, .nav-more-btn { padding: 12px; font-size: 1rem; justify-content: flex-start; }
  .nav-more-btn { display: none; }
  .more-menu { display: grid; position: static; width: auto; box-shadow: none; border: 0; padding: 0; background: none; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 8px; }
  .rank-name { display: none; }
  .rank-chip { padding-right: 5px; }
}
@media (max-width: 520px) {
  .more-menu { grid-template-columns: 1fr; }
  .logo-text { font-size: 1rem; }
  .header-inner { gap: 10px; }
  .chip { height: 34px; padding: 0 10px; }
}

/* rank badge — a tiny keycap */
.rank-badge {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 5px;
  border-radius: 8px;
  font: 700 11px/1 var(--mono);
  background: var(--surface-2);
  color: var(--text-2);
  box-shadow: inset 0 -2px 0 var(--border-strong);
  padding-bottom: 2px;
}
.rank-badge.is-ranked { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); }
.rank-badge.lg { min-width: 64px; height: 64px; font-size: 22px; border-radius: 16px; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .2); padding-bottom: 5px; }
.rank-badge.lg:not(.is-ranked) { box-shadow: inset 0 -5px 0 var(--border-strong); }
.rank-badge.md { min-width: 42px; height: 42px; font-size: 14px; border-radius: 12px; padding-bottom: 3px; flex: none; }
.rank-badge.md.is-ranked { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .2); }
.drill-banner { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; max-width: 960px; margin: 0 auto 16px; padding: 8px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: .92rem; }
.drill-banner .ic { color: var(--accent); }

/* focus mode: fade chrome while typing */
body.is-typing [data-dim] { opacity: .12; pointer-events: none; }
body.is-typing .crumbs, body.is-typing .page-head { opacity: .25; transition: opacity .4s var(--ease); }

/* ---------- buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600; font-size: .95rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--border-strong); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-sm { height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn-lg { height: 54px; padding: 0 26px; font-size: 1.05rem; border-radius: 14px; }
.btn .ic { width: 18px; height: 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.seg {
  display: inline-flex; align-items: center;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 11px;
  gap: 2px;
}
.seg button, .seg a {
  border: 0; background: none;
  height: 32px; padding: 0 11px;
  border-radius: 8px;
  font-size: .85rem; font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button.is-on, .seg a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--border);
}
.seg .ic { width: 15px; height: 15px; }
.seg-label { font-size: .75rem; color: var(--text-3); padding: 0 6px 0 8px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }

.field { display: grid; gap: 6px; }
.field label, .label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- layout primitives ---------- */
.section { padding-block: 56px; }
.section-sm { padding-block: 32px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--text-2); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.card h3 { margin-bottom: 6px; }
.card p:last-child { margin-bottom: 0; }
.page-head { padding-block: 30px 14px; transition: opacity .4s var(--ease); }
.page-head h1 { margin-bottom: 10px; }
.page-head .lead { font-size: 1.08rem; color: var(--text-2); max-width: 720px; margin: 0; }
.crumbs { max-width: var(--wrap); margin: 0 auto; padding: 14px 20px 0; font-size: .82rem; color: var(--text-3); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--border-strong); }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* tiles: link cards for features */
.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s var(--ease), box-shadow .15s;
  min-height: 100%;
}
.tile:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.tile-icon {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
  font: 600 20px/1 var(--font);
}
.tile h3 { margin: 0; font-size: 1.05rem; }
.tile p { margin: 0; color: var(--text-2); font-size: .92rem; }
.tile .tile-meta { margin-top: auto; padding-top: 10px; font-size: .82rem; color: var(--text-3); display: flex; gap: 12px; align-items: center; }
.tile .tile-go { position: absolute; top: 20px; right: 20px; color: var(--text-3); transition: transform .15s, color .15s; }
.tile:hover .tile-go { transform: translateX(3px); color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* =========================================================================
   Typing area
   ========================================================================= */
.typer-section { padding-block: 18px 8px; }
.config {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 8px 10px;
  margin: 0 auto 26px;
  transition: opacity .3s var(--ease);
}
.config .divider { width: 1px; height: 22px; background: var(--border); }
body.is-typing .config { opacity: 0; pointer-events: none; }
@media (max-width: 640px) { .config .divider { display: none; } .config { gap: 8px; } }
@media (pointer: coarse) { .typer-hint { display: none; } }

.typer {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  outline: none;
}
.typer-stats {
  display: flex; align-items: baseline; gap: 22px;
  min-height: 36px;
  margin-bottom: 8px;
  font: 500 1.35rem/1 var(--mono);
  color: var(--accent);
}
.typer-stats .stat-sub { color: var(--text-3); font-size: 1rem; }
.typer-stats [data-live] { transition: opacity .2s; }
.typer:not(.is-running) .typer-stats .stat-live { opacity: 0; }
.words-viewport {
  position: relative;
  overflow: hidden;
  --fs: 1.6rem;
  --lh: 1.6;
  font: 400 var(--fs)/var(--lh) var(--mono);
  height: calc(var(--fs) * var(--lh) * 3);
  user-select: none;
  cursor: text;
}
.typer.size-s .words-viewport { --fs: 1.3rem; }
.typer.size-l .words-viewport { --fs: 2rem; }
.typer.lines-1 .words-viewport { height: calc(var(--fs) * var(--lh) * 1); }
.typer.lines-2 .words-viewport { height: calc(var(--fs) * var(--lh) * 2); }
.typer.lines-4 .words-viewport { height: calc(var(--fs) * var(--lh) * 4); }
@media (max-width: 640px) { .words-viewport { --fs: 1.22rem; } .typer.size-l .words-viewport { --fs: 1.45rem; } }
.words { position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; color: var(--text-3); transition: filter .25s, opacity .25s; }
.word { position: relative; margin-right: .6em; white-space: nowrap; }
.word .c { color: var(--text); }
.word .e { color: var(--error); }
.word .x { color: var(--error); opacity: .65; }
.word .m { text-decoration: underline; text-decoration-color: var(--error); }
.word.err { text-decoration: underline 2px; text-decoration-color: color-mix(in srgb, var(--error) 60%, transparent); text-underline-offset: .28em; }
.word.space-err::after { content: '·'; position: absolute; right: -.45em; color: var(--error); }

.caret {
  position: absolute; top: 0; left: 0;
  width: 2px;
  height: calc(var(--fs) * 1.2);
  margin-top: calc((var(--fs) * var(--lh) - var(--fs) * 1.2) / 2);
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  transition: transform .1s linear;
  will-change: transform;
}
.caret.is-idle { animation: blink 1.05s steps(1) infinite; }
.caret.no-smooth { transition: none; }
.caret.style-block { width: .62em; opacity: .28; border-radius: 3px; }
.caret.style-under { height: 2px; width: .62em; margin-top: calc((var(--fs) * var(--lh) + var(--fs) * 1.1) / 2); }
.caret.ghost { background: var(--text-3); opacity: .55; display: none; }
.caret.ghost.is-on { display: block; }
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.typer-input {
  position: absolute; left: 0; top: 0;
  width: 1px; height: 1px;
  opacity: 0;
  border: 0; padding: 0;
  font-size: 16px; /* prevents iOS zoom */
  pointer-events: none;
}
.focus-hint {
  position: absolute; inset: 44px 0 0 0;
  display: none; place-items: center;
  color: var(--text);
  font-weight: 500;
  gap: 8px;
  z-index: 3;
  cursor: pointer;
}
.focus-hint span { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); padding: 10px 16px; border-radius: 999px; box-shadow: var(--shadow); font-size: .95rem; }
.typer.is-blurred .focus-hint { display: grid; }
.typer.is-blurred .words { filter: blur(5px); opacity: .55; }
.typer.is-blurred .caret { opacity: 0; }

.typer-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.typer-hint { text-align: center; font-size: .82rem; color: var(--text-3); margin-top: 14px; }
.typer-hint kbd { font-size: .72rem; }
body.is-typing .typer-actions, body.is-typing .typer-hint { opacity: .25; transition: opacity .3s; }

.typer.shake { animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* =========================================================================
   Results
   ========================================================================= */
.results { max-width: 960px; margin: 0 auto; animation: rise .35s var(--ease); }
.results-top { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: start; }
@media (max-width: 760px) { .results-top { grid-template-columns: 1fr; gap: 20px; } }
.hero-stats { display: grid; gap: 18px; min-width: 170px; }
.hero-stat .label { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; margin-bottom: 2px; }
.hero-stat .value { font-size: 3.6rem; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.hero-stat .value small { font-size: 1rem; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-left: 4px; }
.hero-stat.is-acc .value { font-size: 2.6rem; }
@media (max-width: 760px) { .hero-stats { grid-template-columns: 1fr 1fr; } .hero-stat .value { font-size: 2.9rem; } .hero-stat.is-acc .value { font-size: 2.9rem; } }
.verdict { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.verdict-sub { color: var(--text-2); font-size: .92rem; margin: 0 0 14px; }
.pb-flag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .78rem; font-weight: 700; margin-bottom: 10px; animation: pop .4s var(--ease); }
.pb-flag .ic { width: 14px; height: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 22px; }
.mini-stat { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.mini-stat .label { display: block; font-size: .74rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.mini-stat .value { font-size: 1.25rem; font-weight: 700; letter-spacing: -.02em; }
.mini-stat .value small { font-size: .8rem; color: var(--text-3); font-weight: 500; }
.results-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }

/* rating card */
.rating-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin-top: 16px; }
.rating-card .rc-body { flex: 1; min-width: 0; }
.rating-card .rc-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-weight: 700; }
.rating-card .rc-delta { font: 600 .9rem/1 var(--mono); color: var(--accent); }
.rating-card .rc-delta.neg { color: var(--text-2); }
.rating-card .rc-sub { font-size: .85rem; color: var(--text-2); }
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin: 8px 0 4px; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); transition: width .9s var(--ease); }

/* charts */
.chart-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 8px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-title { font-size: .9rem; font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; background: currentColor; }
.legend i.k-accent { background: var(--accent); }
.legend i.k-muted { background: var(--text-3); }
.legend i.k-err { width: 9px; height: 9px; background: none; position: relative; }
.legend i.k-err::before, .legend i.k-err::after { content: ''; position: absolute; left: 4px; top: -1px; width: 1.75px; height: 11px; background: var(--error); transform: rotate(45deg); }
.legend i.k-err::after { transform: rotate(-45deg); }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font: 500 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .line-accent { stroke: var(--accent); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-muted { stroke: var(--text-3); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; opacity: .8; }
.chart .area-accent { fill: var(--accent); opacity: .1; }
.chart .dot-accent { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .err-mark { stroke: var(--error); stroke-width: 1.75; stroke-linecap: round; }
.chart .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart .end-label { fill: var(--text); font: 600 12px var(--font); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: .8rem;
  opacity: 0; transform: translateY(4px);
  transition: opacity .12s, transform .12s;
}
.chart-tip.is-on { opacity: 1; transform: none; }
.chart-tip .tt-h { color: var(--text-3); font-size: .74rem; margin-bottom: 4px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tt-row b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.chart-tip .tt-row span { color: var(--text-2); }
.chart-tip .tt-key { width: 12px; height: 2px; border-radius: 2px; }
.data-table-wrap { margin-top: 6px; }
.data-table-wrap summary { cursor: pointer; font-size: .8rem; color: var(--text-3); padding: 4px 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th { color: var(--text-3); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
.table-scroll { max-height: 260px; overflow: auto; }

/* =========================================================================
   On-screen keyboard
   ========================================================================= */
.kb { --k: 44px; --g: 6px; display: grid; gap: var(--g); justify-content: center; user-select: none; margin: 0 auto; }
.kb-row { display: flex; gap: var(--g); justify-content: center; }
.key {
  position: relative;
  width: var(--k); height: var(--k);
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 0 var(--border);
  display: grid; place-items: center;
  font: 500 14px/1 var(--mono);
  color: var(--text-2);
  transition: background .12s, color .12s, transform .08s, box-shadow .08s;
  flex: none;
}
.key .k-alt { position: absolute; top: 5px; left: 7px; font-size: 10px; color: var(--text-3); }
.key .k-main { font-size: 15px; }
.key.w-15 { width: calc(var(--k) * 1.5 + var(--g) * .5); }
.key.w-175 { width: calc(var(--k) * 1.75 + var(--g) * .75); }
.key.w-2 { width: calc(var(--k) * 2 + var(--g)); }
.key.w-225 { width: calc(var(--k) * 2.25 + var(--g) * 1.25); }
.key.w-275 { width: calc(var(--k) * 2.75 + var(--g) * 1.75); }
.key.w-space { width: calc(var(--k) * 6.25 + var(--g) * 5.25); }
.key.h-2 { height: calc(var(--k) * 2 + var(--g)); }
.key.fn { font-size: 11px; color: var(--text-3); font-family: var(--font); }
.key.home::after { content: ''; position: absolute; bottom: 7px; left: 50%; width: 10px; height: 2px; margin-left: -5px; border-radius: 2px; background: var(--text-3); }
.key.is-next { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 2px 0 var(--accent-hover); }
.key.is-next .k-alt, .key.is-next .k-main, .key.is-next .k-en { color: var(--on-accent) !important; }
.key.is-shift { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.key.is-press { transform: translateY(2px); box-shadow: 0 0 0 var(--border); }
.key.is-wrong { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.key.is-dim { opacity: .38; }
.key[data-heat] { color: var(--text); }
.key[data-heat="1"] { background: var(--heat-1); border-color: var(--heat-1); }
.key[data-heat="2"] { background: var(--heat-2); border-color: var(--heat-2); color: #fff; }
.key[data-heat="3"] { background: var(--heat-3); border-color: var(--heat-3); color: #fff; }
.key[data-heat="4"] { background: var(--heat-4); border-color: var(--heat-4); color: #fff; }
.key[data-heat="5"] { background: var(--heat-5); border-color: var(--heat-5); color: #fff; }
:root[data-theme="dark"] .key[data-heat="4"], :root[data-theme="dark"] .key[data-heat="5"] { color: #1b0f0d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .key[data-heat="4"], :root:not([data-theme="light"]) .key[data-heat="5"] { color: #1b0f0d; } }
@media (max-width: 760px) { .kb { --k: calc((100vw - 40px - 13 * 4px) / 14.5); --g: 4px; } .key { border-radius: 6px; font-size: 11px; } .key .k-main { font-size: 12px; } .key .k-alt { display: none; } .key.fn { font-size: 8px; } }
.finger-hint { text-align: center; color: var(--text-2); font-size: .88rem; margin-top: 12px; min-height: 1.4em; }
.finger-hint b { color: var(--text); }
.hands { display: flex; justify-content: center; gap: 38px; margin-top: 14px; }
.hand { display: flex; align-items: flex-end; gap: 5px; }
.finger { width: 14px; border-radius: 7px 7px 4px 4px; background: var(--surface-3); transition: background .15s; }
.finger.is-on { background: var(--accent); }
.hand .f0 { height: 26px; } .hand .f1 { height: 36px; } .hand .f2 { height: 40px; } .hand .f3 { height: 36px; } .hand .f4 { height: 20px; transform: translateY(4px) rotate(-18deg); }
.hand.right .f4 { transform: translateY(4px) rotate(18deg); }
@media (max-width: 760px) { .hands { display: none; } }

/* numpad */
.numpad { display: grid; grid-template-columns: repeat(4, var(--k)); grid-auto-rows: var(--k); gap: var(--g); justify-content: center; }
.numpad .key { width: auto; height: auto; }
.numpad .key.tall { grid-row: span 2; }
.numpad .key.wide { grid-column: span 2; }
@media (max-width: 760px) { .numpad { --k: 52px; } }

/* =========================================================================
   Lessons
   ========================================================================= */
.lessons-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .lessons-layout { grid-template-columns: 1fr; } }
.lesson-player { padding: 26px; min-height: 420px; }
@media (max-width: 560px) { .lesson-player { padding: 18px 14px; } }
.lesson-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.lesson-head h2 { margin: 0 0 4px; }
.lesson-head p.muted { margin: 0; font-size: .92rem; }
.lesson-meta { display: grid; justify-items: end; gap: 4px; font-size: .78rem; }
.lesson-meta .faint { display: inline-flex; align-items: center; gap: 2px; }
.steps { display: flex; gap: 6px; margin: 18px 0 14px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--surface-3); transition: background .3s; }
.steps span.is-on { background: var(--accent); }
.lesson-typer { max-width: none; }
.lesson-typer .words-viewport { --fs: 1.75rem; }
@media (max-width: 640px) { .lesson-typer .words-viewport { --fs: 1.3rem; } }
.lesson-tools { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 12px 0 18px; font-size: .88rem; color: var(--text-2); }
.lesson-tools .btn { margin-left: auto; }
.lesson-kb { margin-top: 6px; }
.lesson-result { text-align: center; padding: 26px 0 6px; animation: rise .35s var(--ease); }
.big-stars .stars { justify-content: center; gap: 10px; }
.big-stars .ic { width: 46px; height: 46px; }
.big-stars .star.on { animation: pop .5s var(--ease) backwards; }
.big-stars .star.on:nth-child(2) { animation-delay: .15s; }
.big-stars .star.on:nth-child(3) { animation-delay: .3s; }
.stars { display: inline-flex; gap: 2px; }
.stars .ic { width: 15px; height: 15px; color: var(--border-strong); }
.stars .star.on { color: var(--accent); fill: var(--accent); }
.course-map { display: grid; gap: 8px; }
.unit { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.unit summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; }
.unit summary::-webkit-details-marker { display: none; }
.unit-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); font: 600 12px var(--mono); color: var(--text-2); flex: none; }
.unit[open] .unit-n { background: var(--accent); color: var(--on-accent); }
.unit-t b { display: block; font-size: .93rem; }
.unit-t small { color: var(--text-3); font-size: .78rem; }
.lesson-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.lesson-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 9px; font-size: .9rem; text-decoration: none; color: var(--text-2); }
.lesson-link:hover { background: var(--surface-2); color: var(--text); }
.lesson-link.is-current { background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* =========================================================================
   Games
   ========================================================================= */
.game { position: relative; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; max-width: 980px; margin: 0 auto; }
.game-hud { display: flex; gap: 22px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); min-height: 58px; }
.hud-item small { display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-3); font-weight: 600; }
.hud-item b { font: 600 1.12rem/1.2 var(--mono); }
.hud-lives { margin-left: auto; display: flex; gap: 4px; }
.hud-lives .ic { width: 20px; height: 20px; color: var(--border-strong); }
.hud-lives .ic.on { color: var(--error); fill: var(--error); }
.game-stage { position: relative; height: clamp(380px, 62vh, 540px); overflow: hidden; background: var(--bg); }
.game-overlay { position: absolute; inset: 58px 0 0 0; display: grid; place-items: center; padding: 20px; z-index: 5; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.ov-card { text-align: center; max-width: 460px; animation: rise .3s var(--ease); }
.ov-card h2 { margin-bottom: 8px; }
.ov-intro { color: var(--text-2); margin-bottom: 18px; }
.ov-intro p { margin: 0 0 8px; }
.ov-card .seg { margin-bottom: 18px; }
.ov-best { margin: 14px 0 0; font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; }
.ov-score { margin: 6px 0 4px; }
.ov-score span { font-size: 3.2rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.ov-score small { display: block; color: var(--text-3); font-size: .8rem; }
.ov-rows { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 14px 0 18px; }
.ov-rows small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; }
.ov-rows b { font-size: 1.05rem; }
.grade { display: grid; place-items: center; width: 84px; height: 80px; margin: 0 auto 12px; border-radius: 20px; font: 700 42px/1 var(--mono); background: var(--surface-2); color: var(--text); box-shadow: inset 0 -6px 0 var(--border-strong); padding-bottom: 6px; animation: pop .45s var(--ease); }
.grade-S, .grade-A { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .22); }
.particles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
@media (max-width: 560px) { .game-hud { gap: 14px; padding: 8px 12px; } .hud-item b { font-size: .98rem; } .game-overlay { padding: 14px; } .ov-score span { font-size: 2.6rem; } }

/* word rain */
.rain-word { position: absolute; top: 0; left: 0; padding: 4px 10px 5px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 2px 0 var(--border); font: 500 1.05rem/1.3 var(--mono); color: var(--text); white-space: nowrap; will-change: transform; }
.rain-word b { color: var(--accent); font-weight: 600; }
.rain-word.is-target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); z-index: 2; }
.rain-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; background: var(--surface-2); border-top: 1px solid var(--border); }
.rain-buffer { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font: 600 1rem var(--mono); color: var(--accent); z-index: 3; }
.rain-buffer.bad { animation: shake .25s; color: var(--error); }
.game-stage.hit { animation: hitflash .45s; }
@keyframes hitflash { from { box-shadow: inset 0 -40px 40px -20px var(--error-soft), inset 0 0 0 3px var(--error); } to { box-shadow: none; } }
.game-stage.level-up { animation: lvl .6s; }
@keyframes lvl { from { box-shadow: inset 0 0 0 3px var(--accent); } to { box-shadow: none; } }

/* key invaders */
.invaders-stage canvas { width: 100%; height: 100%; }

/* number rush */
.rush-stage { display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 20px; }
.rush-bar { position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--surface-3); }
.rush-bar span { display: block; height: 100%; background: var(--accent); }
.rush-bar span.low { background: var(--error); }
.rush-kind { font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-3); font-weight: 600; }
.rush-card { font: 600 clamp(1.7rem, 5.5vw, 3.2rem)/1.2 var(--mono); letter-spacing: .04em; padding: 18px 30px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 3px 0 var(--border); max-width: 100%; overflow-wrap: anywhere; }
.rush-card.pop { animation: pop .25s var(--ease); }
.rush-typed { font-size: 1.5rem; min-height: 2.2rem; letter-spacing: .1em; }
.rush-typed .c { color: var(--text); } .rush-typed .e { color: var(--error); } .rush-typed .u { color: var(--text-3); }
.rush-stage.good .rush-card { border-color: var(--accent); }
.rush-stage.bad .rush-card { animation: shake .25s; border-color: var(--error); }
.rush-hint { font-size: .82rem; margin: 0; }

/* flash recall */
.recall-stage { display: grid; place-content: center; justify-items: center; gap: 18px; text-align: center; padding: 20px; }
.recall-item { position: relative; font-size: clamp(1.5rem, 5vw, 2.6rem); font-weight: 600; padding: 22px 32px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 3px 0 var(--border); min-width: min(280px, 90vw); overflow: hidden; max-width: 100%; overflow-wrap: anywhere; }
.recall-item.is-hidden { color: var(--text-3); letter-spacing: .25em; }
.recall-item.is-good { border-color: var(--accent); color: var(--accent); }
.recall-item.is-bad { border-color: var(--error); }
.recall-timer { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; background: var(--accent); animation: shrink linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }
.recall-input { font-size: 1.5rem; min-height: 2.3rem; }
.recall-input .e { color: var(--error); }
.recall-caret { display: inline-block; width: 2px; height: 1.15em; margin-left: 2px; background: var(--accent); vertical-align: -.18em; animation: blink 1s steps(1) infinite; }
.recall-hint { margin: 0; font-size: .9rem; }

/* typing race */
.race { max-width: 980px; margin: 0 auto; }
.lanes { display: grid; gap: 10px; margin-bottom: 26px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.lane { display: grid; grid-template-columns: 64px 1fr 70px; align-items: center; gap: 12px; }
.lane-name { font-size: .85rem; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane.is-you .lane-name { color: var(--text); }
.track { position: relative; height: 34px; border-radius: 10px; background: var(--surface-2); }
.track::after { content: ''; position: absolute; right: 8px; top: 6px; bottom: 6px; width: 4px; background: repeating-linear-gradient(var(--text-3) 0 4px, transparent 4px 8px); }
.car { position: absolute; top: 4px; left: 0; height: 26px; width: 44px; display: grid; place-items: center; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 2px 0 var(--border-strong); font: 600 11px var(--mono); color: var(--text-2); transition: left .12s linear; }
.lane.is-you .car { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 2px 0 var(--accent-hover); }
.lane-wpm { font: 500 .8rem var(--mono); color: var(--text-3); text-align: right; }
.race-play { position: relative; min-height: 190px; }
.race-overlay { position: absolute; inset: -12px; display: grid; place-items: center; z-index: 6; border-radius: var(--radius); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); text-align: center; }
.countdown { font: 700 5rem/1 var(--font); color: var(--accent); animation: pop .3s var(--ease); }
@media (max-width: 560px) { .lane { grid-template-columns: 48px 1fr 56px; gap: 8px; } .lanes { padding: 12px; } }

/* games hub */
.game-card .tile-icon { width: 52px; height: 52px; border-radius: 14px; }
.game-card .tile-icon .ic { width: 26px; height: 26px; }
.best-line { display: inline-flex; align-items: center; gap: 6px; }

/* =========================================================================
   Work skills: numbers, 10-key, data entry
   ========================================================================= */
.work-card { max-width: 980px; margin: 0 auto; }
.tool-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.tool-timer { font: 600 1.5rem/1 var(--mono); color: var(--accent); }
.tool-live { font: 500 .95rem var(--mono); color: var(--text-3); }
.tk-layout { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.ledger { list-style: none; margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-family: var(--mono); }
.ledger li { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 9px; font-size: 1.15rem; color: var(--text-3); }
.ledger .ln { font-size: .72rem; color: var(--text-3); }
.ledger .v { text-align: right; }
.ledger li.is-cur { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.ledger li.is-ok { color: var(--text-2); }
.ledger li.is-bad .v { color: var(--error); text-decoration: line-through; }
.ledger .you { font-size: .78rem; color: var(--error); }
.tk-entry { height: 66px; font: 600 2rem/1 var(--mono); text-align: right; letter-spacing: .04em; }
.tk-side { display: grid; gap: 18px; justify-items: stretch; }
.tk-side .numpad { --k: 54px; --g: 6px; }
.de-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.rec-card { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: 0 3px 0 var(--border); position: sticky; top: 16px; }
.rec-head { display: flex; justify-content: space-between; font-weight: 600; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.rec-head .faint { font-weight: 400; font-size: .8rem; }
.rec-row { display: grid; grid-template-columns: 136px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.rec-row:last-child { border-bottom: 0; }
.rec-row span { color: var(--text-3); }
.rec-row b { font: 500 1rem var(--mono); overflow-wrap: anywhere; }
.de-form { display: grid; gap: 9px; }
.de-form .field { grid-template-columns: 136px 1fr; align-items: center; gap: 8px; }
.de-form .input { height: 40px; font-size: .98rem; }
.de-form .btn-row { margin-top: 8px; }
.review { margin-top: 18px; }
.de-table th, .de-table td { text-align: left; }
.de-table td.e { color: var(--error); }
@media (max-width: 820px) {
  .tk-layout, .de-layout { grid-template-columns: 1fr; }
  .de-form .field { grid-template-columns: 1fr; gap: 4px; }
  .rec-card { position: static; }
}

/* =========================================================================
   Certificate
   ========================================================================= */
.cert-setup { max-width: 640px; margin: 0 auto; display: grid; gap: 18px; padding: 28px; }
.cert-setup .seg { flex-wrap: wrap; }
.cert-setup .btn-primary { justify-self: start; }
.cert-out { text-align: center; animation: rise .35s var(--ease); }
.cert-frame { max-width: 920px; margin: 20px auto 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-lg); aspect-ratio: 2000 / 1414; background: #FFFDF8; display: grid; place-items: center; }
.cert-loading { color: #6A665E; font-size: .95rem; }
.cert-img { width: 100%; height: auto; }
.cert-history { max-width: 920px; margin: 40px auto 0; }
.print-only { display: none; }
.input.shake { animation: shake .25s; border-color: var(--error); }
@media print {
  body.printing-cert > *:not(.print-only) { display: none !important; }
  body.printing-cert .print-only { display: block; }
  .print-only img { width: 100%; }
  @page { size: A4 landscape; margin: 0; }
}

/* =========================================================================
   Exams
   ========================================================================= */
.exam { max-width: 980px; margin: 0 auto; }
.exam-setup { padding: 28px; display: grid; gap: 18px; }
.exam-setup h2 { margin: 0; }
.exam-setup .seg { flex-wrap: wrap; }
.exam-setup .btn-primary { justify-self: start; }
.exam-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
@media (max-width: 640px) { .exam-grid { grid-template-columns: 1fr; } }
.exam-bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 0; background: var(--bg); }
.exam-bar .tool-timer.low { color: var(--error); }
.exam-bar .grow { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-passage { max-height: 250px; overflow: auto; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 1.08rem; line-height: 1.85; user-select: none; -webkit-user-select: none; position: relative; }
.exam-passage span.is-cur { background: var(--accent-soft); border-radius: 4px; box-shadow: 0 0 0 2px var(--accent-soft); }
.exam-input { margin-top: 14px; min-height: 230px; font: 1.05rem/1.8 var(--mono); }
.verdict-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: .95rem; margin-bottom: 8px; }
.verdict-badge .ic { width: 18px; height: 18px; }
.verdict-badge.is-pass { background: var(--accent-soft); color: var(--accent); }
.verdict-badge.is-fail { background: var(--error-soft); color: var(--error); }
.exam-compare { margin-top: 18px; }
.exam-marked { line-height: 2.05; font-size: 1.02rem; margin-top: 10px; }
.m-full s { color: var(--error); text-decoration-thickness: 2px; }
.m-full ins { text-decoration: none; color: var(--text-3); font-size: .9em; }
.m-half { text-decoration: underline wavy var(--error); text-underline-offset: 4px; }
.m-omit ins { text-decoration: line-through; color: var(--text-3); }
.legend i.k-half { width: 14px; height: 6px; background: none; border-bottom: 2px dotted var(--error); }
.legend i.k-omit { background: var(--text-3); }

/* custom text */
.custom-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .custom-grid { grid-template-columns: 1fr; } }
.custom-opts { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 14px; }
.library { display: grid; gap: 8px; margin-top: 10px; }
.lib-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.lib-body { flex: 1; min-width: 0; }
.lib-body b { display: block; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-body small { color: var(--text-3); font-size: .8rem; }

/* =========================================================================
   Progress dashboard
   ========================================================================= */
.progress-head { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .progress-head { grid-template-columns: 1fr; } }
.rank-card { display: flex; align-items: center; gap: 22px; }
.rank-card .eyebrow { margin-bottom: 2px; }
.rank-card h2 { margin: 0 0 6px; }
.rank-card .muted { margin: 6px 0 0; font-size: .92rem; }
.rank-body { flex: 1; min-width: 0; }
.streak-card { display: flex; align-items: center; gap: 16px; }
.streak-big { display: flex; align-items: center; gap: 4px; font: 700 2.4rem/1 var(--font); letter-spacing: -.03em; color: var(--text); }
.streak-big .ic { color: var(--accent); width: 34px; height: 34px; }
.stat-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
@media (max-width: 960px) { .stat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-tile .value { font-size: 1.6rem; }
.stat-tile small.faint { display: block; font-size: .72rem; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-grid .span-2 { grid-column: 1 / -1; }
.panel h2 { font-size: 1.1rem; margin-bottom: 4px; }
.panel .sub { color: var(--text-3); font-size: .85rem; margin: 0 0 12px; }
.empty { color: var(--text-3); font-size: .92rem; padding: 18px 0; margin: 0; }
.cal { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.cal-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); display: inline-block; }
.cal-cell[data-l="1"] { background: var(--seq-1); } .cal-cell[data-l="2"] { background: var(--seq-2); } .cal-cell[data-l="3"] { background: var(--seq-3); } .cal-cell[data-l="4"] { background: var(--seq-4); } .cal-cell[data-l="5"] { background: var(--seq-5); }
.cal-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: .82rem; }
.cal-legend { display: inline-flex; align-items: center; gap: 3px; color: var(--text-3); }
.heat-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 22px; align-items: start; }
@media (max-width: 960px) { .heat-wrap { grid-template-columns: 1fr; } }
.heat-wrap .kb { --k: 38px; --g: 5px; }
@media (max-width: 760px) { .heat-wrap .kb { --k: calc((100vw - 80px - 13 * 4px) / 14.5); --g: 4px; } }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--text-3); margin-top: 12px; flex-wrap: wrap; }
.heat-legend span.sw { width: 16px; height: 12px; border-radius: 3px; display: inline-block; }
.btn-danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn-danger:hover { filter: brightness(1.05); color: #fff; border-color: var(--error); }

/* 404 */
.nf h1 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); }
.nf-type { display: inline-flex; align-items: center; min-width: 220px; min-height: 64px; justify-content: center; margin-top: 18px; padding: 10px 22px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); font-size: 2rem; cursor: text; }
.nf-typed.ok { color: var(--accent); }
.nf-caret { width: 2px; height: 2rem; background: var(--accent); margin-left: 2px; animation: blink 1.05s steps(1) infinite; }
.blog-list .tile { gap: 8px; }
.blog-list .badge { align-self: flex-start; }

/* =========================================================================
   Feedback: toasts, modal, confetti
   ========================================================================= */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: rise .25s var(--ease); pointer-events: auto; }
.toast .ic { width: 18px; height: 18px; color: var(--accent); }
:root[data-theme="dark"] .toast .ic { color: #0E7C66; }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
dialog.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 28px;
  width: min(460px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(10, 10, 9, .45); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .25s var(--ease); }
.modal-close { position: absolute; top: 12px; right: 12px; }
.promo { text-align: center; }
.promo .rank-badge { margin: 4px auto 16px; }
.promo h2 { margin-bottom: 6px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* settings popover */
.popover { position: absolute; z-index: 30; right: 0; top: calc(100% + 8px); width: 280px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); display: none; text-align: left; }
.popover.is-open { display: block; animation: pop .16s var(--ease); }
.popover .pop-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; font-size: .88rem; }
.popover .pop-row + .pop-row { border-top: 1px solid var(--border); }
.popover .seg button { height: 28px; padding: 0 9px; font-size: .8rem; }
.rel { position: relative; }

/* =========================================================================
   Home
   ========================================================================= */
.home-hero { padding-block: 26px 0; text-align: center; }
.home-hero h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); margin-bottom: 6px; }
.home-hero .lead { color: var(--text-2); margin: 0 auto 4px; max-width: 620px; }
.welcome-back { display: none; max-width: 960px; margin: 34px auto 0; }
.welcome-back.is-on { display: block; }
.continue-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .continue-grid { grid-template-columns: 1fr; } }
.continue-card { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); }
.continue-card:hover { border-color: var(--border-strong); color: var(--text); }
.continue-card .cc-body { min-width: 0; }
.continue-card small { display: block; color: var(--text-3); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.continue-card b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card .tile-icon { margin: 0; flex: none; }

.ladder { display: flex; flex-wrap: wrap; gap: 8px; }
.ladder-step { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: .88rem; }
.ladder-step small { display: block; color: var(--text-3); font-size: .75rem; }
.ladder-step.is-you { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* =========================================================================
   Content / prose (SEO copy, blog)
   ========================================================================= */
.prose { font-size: 1.04rem; line-height: 1.75; color: var(--text); }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--text-3); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose blockquote { margin: 1.5em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--accent); color: var(--text-2); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2em 0 1.6em; font-size: .95rem; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.prose .table-wrap { overflow-x: auto; }
.prose .note { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-size: .95rem; }
.prose .note p:last-child { margin: 0; }
.article-head { padding-block: 34px 8px; }
.article-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-3); font-size: .86rem; margin-bottom: 26px; }
.toc { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); margin: 0 0 30px; font-size: .95rem; }
.toc b { display: block; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc a { color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.content-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
@media (max-width: 960px) { .content-split { grid-template-columns: 1fr; } }
.side-stack { display: grid; gap: 16px; align-content: start; position: sticky; top: 20px; }
@media (max-width: 960px) { .side-stack { position: static; } }

.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { list-style: none; cursor: pointer; padding: 18px 36px 18px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 6px; top: 14px; font-size: 1.4rem; font-weight: 400; color: var(--text-3); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq-a { color: var(--text-2); padding: 0 0 16px; }
.faq .faq-a p { margin: 0; }

.speed-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.speed-table td, .speed-table th { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.speed-table th { font-size: .76rem; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- footer ---------- */
.site-footer { margin-top: 72px; border-top: 1px solid var(--border); padding: 44px 0 28px; font-size: .9rem; transition: opacity .4s var(--ease); }
.footer-top { display: grid; grid-template-columns: 260px 1fr; gap: 40px; }
.footer-brand p { color: var(--text-2); margin-top: 14px; font-size: .88rem; }
.footer-cols { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 24px; }
.footer-cols h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 12px; font-weight: 600; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-cols a { color: var(--text-2); text-decoration: none; font-size: .87rem; }
.footer-cols a:hover { color: var(--accent); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-3); font-size: .82rem; }
@media (max-width: 1080px) { .footer-top { grid-template-columns: 1fr; } .footer-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- ads (hidden until enabled in core.js) ---------- */
.ad { display: none; }
html.ads-on .ad { display: block; min-height: 120px; margin: 32px auto; max-width: 970px; text-align: center; }
html.ads-on .ad::before { content: 'Advertisement'; display: block; font-size: .7rem; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
html.ads-on .ad.is-empty { display: none; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .caret.is-idle { animation: none; }
}

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .ad, .no-print, .crumbs { display: none !important; }
  body { background: #fff; color: #000; }
}
