  :root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1c1f24;
    --muted: #646b76;
    --line: #dde1e7;
    --btn: #eceff3;
    --accent: #2563eb;
    --accent-text: #ffffff;
    --ok: #15803d;
    --bad: #b91c1c;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #121417;
      --card: #1c1f24;
      --text: #e8eaed;
      --muted: #9aa1ab;
      --line: #2e333b;
      --btn: #262a31;
      --accent: #5b8cff;
      --accent-text: #0b0d10;
      --ok: #4ade80;
      --bad: #f87171;
    }
  }
  :root[data-theme="dark"] {
    --bg: #121417;
    --card: #1c1f24;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --line: #2e333b;
    --btn: #262a31;
    --accent: #5b8cff;
    --accent-text: #0b0d10;
    --ok: #4ade80;
    --bad: #f87171;
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.4;
  }
  main { max-width: 520px; margin: 0 auto; padding: 16px; }
  h1 { font-size: 1.6rem; margin: 8px 0 4px; }
  h2 { font-size: 1.1rem; margin: 0 0 10px; }
  h3 { font-size: 1rem; margin: 18px 0 8px; }
  .sub, .muted { color: var(--muted); }
  .card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
  }
  .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
  .between { justify-content: space-between; }
  button, input {
    font: inherit;
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--btn);
    color: var(--text);
    padding: 10px 14px;
    cursor: pointer;
  }
  button:disabled { opacity: 0.5; cursor: default; }
  button[hidden] { display: none; }
  .primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
  .big { width: 100%; font-size: 1.1rem; padding: 14px; }
  .link { background: none; border: none; color: var(--accent); padding: 6px 0; min-height: 0; }
  .segmented { display: flex; gap: 8px; flex-wrap: wrap; }
  .segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: transparent; }
  .timer { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
  .timer.low { color: var(--bad); }
  .bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 8px 0 16px; }
  .bar div { height: 100%; width: 100%; background: var(--accent); transition: width 1s linear; }
  .bar div.low { background: var(--bad); }
  .transcript { min-height: 1.4em; margin: 6px 0; color: var(--muted); font-size: 0.95rem; overflow-wrap: anywhere; }
  .transcript span { color: var(--text); }
  .letters { display: flex; flex-wrap: wrap; gap: 6px; min-height: 52px; margin: 6px 0 10px; }
  .tile {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; height: 52px; padding: 0 8px;
    border-radius: 10px; border: 1px solid var(--line); background: var(--btn);
    font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
    animation: pop 0.25s ease-out;
  }
  @keyframes pop {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
  .typed { display: flex; gap: 8px; margin: 12px 0; }
  .typed input { flex: 1; min-width: 0; font-size: 1.05rem; }
  .feedback { min-height: 3em; margin-bottom: 8px; }
  .feedback p { margin: 4px 0; }
  .ok { color: var(--ok); font-weight: 600; font-size: 1.2rem; }
  .bad { color: var(--bad); font-weight: 600; font-size: 1.2rem; }
  .big-score { font-size: 2.6rem; font-weight: 700; margin: 6px 0; }
  .misses { padding-left: 18px; }
  .misses li { margin: 6px 0; }
  .error { color: var(--bad); }
  code { font-family: ui-monospace, Menlo, Consolas, monospace; }
