/* =========================================================
   Keystride — paper press edition
   A warm, editorial typing studio.
   ========================================================= */

:root {
  --paper: #f2eadc;
  --paper-light: #fbf7ee;
  --paper-deep: #e6dac6;
  --ink: #171512;
  --ink-soft: #3d372f;
  --muted: #776f62;
  --dim: #9b9182;
  --ghost: #c9bfaf;
  --red: #e94b2c;
  --red-deep: #b52f18;
  --red-soft: #f8d5ca;
  --blue: #2947c8;
  --blue-deep: #1b2f8f;
  --blue-soft: #dfe5ff;
  --yellow: #f3c84b;
  --green: #3c765a;

  --finger-pinky: #d64d31;
  --finger-ring: #c49118;
  --finger-middle: #3c765a;
  --finger-index: #2947c8;
  --finger-thumb: #7a57a7;

  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-body: "Segoe UI", Aptos, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", "Roboto Mono", Consolas, monospace;

  --line: rgba(23, 21, 18, 0.18);
  --line-strong: rgba(23, 21, 18, 0.65);
  --shadow-hard: 6px 6px 0 var(--ink);
  --shadow-hard-sm: 3px 3px 0 var(--ink);
  --shadow-soft: 0 20px 50px rgba(42, 31, 19, 0.12);
  --radius: 4px;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(23, 21, 18, 0.115) 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button,
textarea,
input {
  font: inherit;
}

button { color: inherit; }

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

::selection {
  color: var(--paper-light);
  background: var(--blue);
}

[hidden] { display: none !important; }

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page-decor {
  position: fixed;
  z-index: -1;
  pointer-events: none;
}

.decor-sun {
  width: 390px;
  height: 390px;
  top: -165px;
  right: -100px;
  border-radius: 50%;
  background: var(--yellow);
  opacity: 0.35;
}

.decor-block {
  width: 240px;
  height: 240px;
  left: -130px;
  bottom: -110px;
  background: var(--blue);
  opacity: 0.08;
  transform: rotate(14deg);
}

.app-shell {
  min-height: 100vh;
}

/* =========================================================
   Masthead
   ========================================================= */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 2px solid var(--ink);
  background: rgba(242, 234, 220, 0.94);
  backdrop-filter: blur(14px) saturate(120%);
}

.masthead-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 32px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--red);
  color: var(--paper-light);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease);
}

.brand:hover .brand-mark {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.055em;
}

.brand-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.primary-nav {
  justify-self: center;
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: var(--shadow-hard-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 33px;
  padding: 0 14px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.035em;
  cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.nav-index {
  color: var(--dim);
  font-size: 7.5px;
}

.nav-link:hover { background: rgba(23, 21, 18, 0.065); }

.nav-link.is-active {
  background: var(--ink);
  color: var(--paper-light);
}

.nav-link.is-active .nav-index { color: var(--yellow); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.streak-pill {
  height: 35px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
  white-space: nowrap;
}

.streak-pill .flame {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
}

.streak-pill .flame svg {
  width: 13px;
  height: 13px;
  fill: var(--red);
  stroke: var(--ink);
  stroke-width: 1;
}

.streak-pill strong { font-size: 10px; }
.streak-pill > span:last-child { color: rgba(23, 21, 18, 0.65); }

.command-trigger {
  height: 35px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px 0 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
}

.command-trigger svg { width: 14px; height: 14px; }
.command-trigger kbd { min-width: 35px; border-color: var(--line); background: var(--paper); color: var(--muted); }

.command-trigger:hover,
.map-trigger:hover,
.icon-toggle:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.map-trigger {
  height: 35px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--red);
  color: var(--paper-light);
  box-shadow: 2px 2px 0 var(--ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
}

.map-trigger svg { width: 13px; height: 13px; }

.icon-toggle {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  color: var(--muted);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background 140ms var(--ease), color 140ms var(--ease);
}

.icon-toggle svg { width: 15px; height: 15px; }

.icon-toggle.is-on {
  background: var(--blue);
  color: var(--paper-light);
}

.masthead-sub {
  max-width: 1400px;
  margin: 0 auto;
  padding: 7px 32px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid rgba(23, 21, 18, 0.13);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.crumb strong { color: var(--ink-soft); font-weight: 600; }
.crumb-slash { opacity: 0.45; }

.masthead-note {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

/* =========================================================
   Base elements
   ========================================================= */

.main { min-height: 50vh; }

.view { animation: view-in 380ms var(--ease) both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  display: inline-block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.practice-wrap {
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 32px 46px;
}

.page-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 42px 32px 64px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  cursor: pointer;
}

.text-link:hover { color: var(--red); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  color: var(--ink);
  box-shadow: var(--shadow-hard-sm);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.075em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background 140ms var(--ease), color 140ms var(--ease);
}

.btn svg { width: 14px; height: 14px; }

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--ink);
}

.btn-ink { background: var(--ink); color: var(--paper-light); }
.btn-ink:hover { background: var(--blue); }
.btn-outline { background: var(--paper-light); }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-danger { background: var(--red); color: var(--paper-light); }

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 7.5px;
}

.btn-sm svg { width: 12px; height: 12px; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 17px;
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
}

.icon-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.icon-btn svg { width: 16px; height: 16px; }

/* =========================================================
   Practice — studio head
   ========================================================= */

.studio-top { margin-bottom: 18px; }

.studio-kicker {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 34px;
  margin-bottom: 13px;
}

.track-switch {
  display: inline-flex;
  padding: 3px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: var(--shadow-hard-sm);
}

.track-tab {
  height: 29px;
  padding: 0 13px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.track-tab:hover { color: var(--ink); }

.track-tab.is-active {
  background: var(--blue);
  color: var(--paper-light);
}

.track-tab[data-track="code"],
.track-tab[data-track="languages"] { margin-left: 2px; }

.track-tab[data-track="code"].is-active {
  background: var(--ink);
}

.track-tab[data-track="languages"].is-active {
  background: var(--red);
}

body.is-random .path-summary-rule,
body.is-random #pathPercent { display: none; }

.path-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.path-summary strong { color: var(--ink); font-weight: 700; }

.path-summary-rule {
  width: 22px;
  height: 1px;
  background: var(--line-strong);
}

.lesson-map-link { margin-left: auto; }

.lesson-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
}

.lesson-copy { min-width: 0; max-width: 850px; }

.lesson-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--muted);
}

.eyebrow-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
}

.lesson-heading h1,
.page-heading h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.98;
  text-wrap: balance;
}

.lesson-heading h1 { font-size: clamp(42px, 4vw, 60px); }

.lesson-heading p {
  max-width: 650px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.focus-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
}

.focus-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.focus-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.focus-chip {
  min-width: 25px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}

.focus-chip.is-word {
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.lesson-actions,
.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  padding-bottom: 3px;
}

/* =========================================================
   Scoreboard
   ========================================================= */

.scoreboard {
  display: grid;
  grid-template-columns: 1.45fr 0.8fr 0.8fr 0.8fr 1.25fr;
  margin-bottom: 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 5px 5px 0 var(--ink);
  overflow: hidden;
}

.score-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 90px;
  padding: 10px 20px;
  background: var(--blue);
  color: var(--paper-light);
}

.score-label {
  color: inherit;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

.score-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 2px 0 0;
}

.score-value strong {
  font-family: var(--font-display);
  font-size: 52px;
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.92;
  font-variant-numeric: tabular-nums;
}

.score-value span {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.score-target {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  opacity: 0.65;
}

.score-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  min-height: 90px;
  padding: 10px 16px;
  border-left: 2px solid var(--ink);
}

.score-cell .score-label { color: var(--muted); opacity: 1; }

.score-cell strong {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-cell strong span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0;
}

.score-goal {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 90px;
  padding: 10px 18px;
  border-left: 2px solid var(--ink);
  background: var(--yellow);
}

.goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.goal-row strong { font-weight: 700; }

.goal-track {
  height: 9px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
  background: var(--paper-light);
}

.goal-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--red);
  transition: width 250ms var(--ease), background 200ms;
}

/* =========================================================
   Typing board
   ========================================================= */

.typing-card {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: var(--shadow-hard);
}

.typing-card:focus-within {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.typing-card.is-code { background: #f8f4e9; }
.typing-card.is-finished { box-shadow: 6px 6px 0 var(--green); }

.typing-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 8px 20px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.card-status-group {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.code-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--blue);
  color: var(--paper-light);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

.run-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--dim);
  transition: background 140ms, box-shadow 140ms;
}

.typing-card.is-running .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(60, 118, 90, 0.14);
}

.typing-card.is-running .run-status { color: var(--ink); }

.typing-card.is-finished .status-dot {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(41, 71, 200, 0.12);
}

.typing-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reveal-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reveal-switch {
  display: flex;
  padding: 2px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--paper-light);
}

.reveal-switch button {
  height: 24px;
  padding: 0 8px;
  border: 0;
  border-radius: 1px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.reveal-switch button.is-active {
  background: var(--ink);
  color: var(--paper-light);
}

.run-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  white-space: nowrap;
}

.type-viewport {
  position: relative;
  min-height: 154px;
  display: flex;
  align-items: center;
  padding: 20px 32px 22px;
}

.typing-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
  cursor: text;
  resize: none;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
}

.type-text {
  width: 100%;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(23px, 2.25vw, 31px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: normal;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

.word { display: inline-block; white-space: nowrap; }

.char {
  position: relative;
  display: inline;
  color: var(--ink-soft);
  transition: color 100ms linear, background 100ms linear;
}

.char.space { white-space: pre; }
.char.is-hidden { color: var(--ghost); }
.char.is-hidden.space { color: transparent; }
.char.is-ahead { color: #675f53; }
.char.done { color: var(--ink); }

.char.error {
  color: var(--red);
  text-decoration: underline wavy rgba(233, 75, 44, 0.7);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}

.char.current {
  color: var(--paper-light);
  background: var(--blue);
  border-radius: 2px;
  box-shadow: 2px 2px 0 var(--ink);
}

.char.current.space,
.char.current.newline { background: var(--blue); }

.char.newline {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.25em;
  margin: 0 0.22em;
  padding: 0 0.28em;
  border: 1px dashed var(--line-strong);
  border-radius: 2px;
  color: var(--muted);
  font-size: 0.5em;
  letter-spacing: 0;
  line-height: 1;
  vertical-align: middle;
}

.char.newline.done { border-color: var(--green); color: var(--green); }
.char.newline.error { border-color: var(--red); color: var(--red); text-decoration: none; }

.char.newline.current {
  border-color: var(--ink);
  color: var(--paper-light);
}

.type-text.is-code {
  font-size: clamp(17px, 1.65vw, 22px);
  line-height: 1.72;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.type-text.is-code .word {
  display: inline;
  white-space: pre;
}

.char.current::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 0.14em;
  bottom: 0.14em;
  width: 2px;
  background: var(--yellow);
  opacity: 0.9;
  animation: caret-blink 1s steps(1, end) infinite;
}

.char.current.newline::after { display: none; }

@keyframes caret-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

.type-viewport.is-blurred .type-text {
  filter: blur(1.6px);
  opacity: 0.4;
}

.focus-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(251, 247, 238, 0.74);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.veil-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--red);
  color: var(--paper-light);
  font-family: var(--font-display);
  font-size: 17px;
  box-shadow: 2px 2px 0 var(--ink);
}

.focus-veil strong {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.focus-veil small { color: var(--muted); font-size: 9px; }

.typing-bottom { padding: 0 20px 12px; }

.card-progress {
  height: 7px;
  margin-bottom: 11px;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
  background: var(--paper-light);
  overflow: hidden;
}

.card-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--red);
  transition: width 160ms ease-out;
}

.typing-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.01em;
}

.hint-sep { color: var(--dim); }

.typing-card.shake { animation: shake 210ms ease-in-out; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  50% { transform: translateX(2px); }
  75% { transform: translateX(-1px); }
}

/* =========================================================
   Lower deck — keyboard + coach
   ========================================================= */

.lower-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(280px, 0.72fr);
  gap: 20px;
  align-items: start;
  margin-top: 18px;
  min-width: 0;
}

.lower-deck > * { min-width: 0; }

.keyboard-card {
  min-width: 0;
  padding: 15px 18px 13px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 5px 5px 0 var(--ink);
}

.keyboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.keyboard-head h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}

.next-key {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 25px;
  padding: 0 7px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--blue);
  color: var(--paper-light);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 2px 2px 0 var(--ink);
}

.next-key.has-shift { min-width: 78px; }

.finger-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 1px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.finger-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--finger-color);
}

.keyboard-scroll {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.keyboard-scroll::-webkit-scrollbar { display: none; }

.keyboard {
  min-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  user-select: none;
}

.kb-row {
  display: flex;
  gap: 5px;
}

.key {
  --finger-color: var(--dim);
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  background: #fffaf0;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1;
  box-shadow: 0 2px 0 var(--ink);
  transition: color 100ms var(--ease), background 100ms var(--ease), transform 80ms var(--ease), box-shadow 100ms var(--ease);
}

.key .key-shift {
  position: absolute;
  top: 3px;
  left: 5px;
  color: var(--dim);
  font-size: 6px;
  line-height: 1;
}

.key .key-base {
  transform: translateY(1px);
  text-transform: uppercase;
}

.key .key-dot {
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: var(--finger-color);
  transform: translateX(-50%);
}

.key.letter .key-base { font-size: 10px; }

.key.home-key::before {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 8px;
  height: 1.5px;
  border-radius: 99px;
  background: var(--ink);
  transform: translateX(-50%);
}

.key.home-key .key-dot { bottom: 6px; }

.key.special {
  flex-grow: 1.7;
  font-family: var(--font-body);
  font-size: 7px;
  letter-spacing: 0.03em;
}

.key.space { flex: 6 1 0; }

.key.is-next {
  background: var(--blue);
  color: var(--paper-light);
  box-shadow: 0 3px 0 var(--ink);
  transform: translateY(-1px);
  z-index: 2;
}

.key.is-next .key-shift,
.key.is-next .key-dot {
  background: var(--paper-light);
  color: var(--paper-light);
}

.key.is-next .key-dot { opacity: 0.5; }
.key.is-next.home-key::before { background: var(--paper-light); }

.key.is-shift-next {
  background: var(--yellow);
  color: var(--ink);
}

.key.hit-correct { animation: key-tap 140ms ease-out; }

.key.hit-miss {
  background: var(--red);
  color: var(--paper-light);
  animation: key-miss 160ms ease-out;
}

@keyframes key-tap {
  0% { transform: translateY(1px); }
  100% { transform: translateY(0); }
}

@keyframes key-miss {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-2px); }
  70% { transform: translateX(2px); }
}

.keyboard-tinted .key {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--finger-color) 12%, #fffaf0);
  color: var(--ink);
}

.keyboard-tinted .key .key-dot { background: var(--finger-color); opacity: 0.9; }
.keyboard-tinted .key.home-key::before { background: var(--finger-color); }

.finger-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
}

.finger-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.finger-legend i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--tone);
}

.legend-tip { margin-left: auto; color: var(--dim); }
.legend-tip b { color: var(--ink); font-weight: 600; }

.support-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.coach-card {
  padding: 19px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper-light);
  box-shadow: 5px 5px 0 var(--red);
}

.coach-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}

.coach-avatar {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1.5px solid var(--paper-light);
  border-radius: 3px;
  background: var(--red);
  color: var(--paper-light);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1;
}

.coach-head > div {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.coach-head span:not(.coach-avatar):not(.coach-mark) {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coach-head small {
  margin-top: 3px;
  color: rgba(251, 247, 238, 0.52);
  font-size: 8px;
}

.coach-mark { margin-left: auto; color: var(--yellow); font-size: 16px; }

.coach-card > p {
  margin: 0;
  color: rgba(251, 247, 238, 0.77);
  font-size: 11px;
  line-height: 1.6;
}

.weak-block {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid rgba(251, 247, 238, 0.2);
}

.weak-title {
  display: block;
  margin-bottom: 7px;
  color: rgba(251, 247, 238, 0.56);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.key-chips { display: flex; flex-wrap: wrap; gap: 4px; }

.key-chip {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 6px;
  border: 1px solid rgba(251, 247, 238, 0.3);
  border-radius: 2px;
  background: rgba(251, 247, 238, 0.08);
  color: var(--paper-light);
  font-family: var(--font-mono);
  font-size: 8px;
}

.key-chip small { color: var(--yellow); font-family: var(--font-body); font-size: 7px; }

.coach-card .btn { margin-top: 13px; }

.note-card {
  padding: 17px 18px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(0.25deg);
}

.note-card .eyebrow { margin-bottom: 7px; color: rgba(23, 21, 18, 0.6); }

.note-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.6;
}

/* =========================================================
   Page headings and progress
   ========================================================= */

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}

.page-heading h1 { font-size: clamp(52px, 5.6vw, 82px); }

.page-heading p {
  max-width: 590px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card {
  min-width: 0;
  padding: 17px 17px 15px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 4px 4px 0 var(--ink);
}

.metric-card:nth-child(1) { background: var(--blue); color: var(--paper-light); }
.metric-card:nth-child(2) { background: var(--yellow); color: var(--ink); }
.metric-card:nth-child(4) { background: var(--red); color: var(--paper-light); }

.metric-label {
  display: block;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.65;
}

.metric-card strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 11px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(32px, 3.3vw, 46px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.metric-card strong small {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.55;
}

.metric-foot {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: 8.5px;
  opacity: 0.58;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 4px 4px 0 var(--ink);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-head h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1;
}

.panel-meta {
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
}

.chart-wrap { min-height: 230px; margin-top: 18px; }

.chart-empty,
.list-empty {
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.chart-empty svg { width: 25px; height: 25px; margin-bottom: 5px; opacity: 0.5; }
.chart-empty strong,
.list-empty strong { color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.chart-empty span,
.list-empty span { font-size: 9.5px; }

.speed-svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-grid-line { stroke: rgba(23, 21, 18, 0.11); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); stroke: none; font-family: var(--font-mono); font-size: 12px; }
.chart-area { fill: url(#chartFill); stroke: none; }
.chart-single-line { stroke: rgba(41, 71, 200, 0.3); stroke-width: 1; stroke-dasharray: 3 6; }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--paper-light); stroke: var(--blue); stroke-width: 2.5; }
.chart-dot:hover { fill: var(--red); stroke: var(--red); }

.weak-panel { display: flex; flex-direction: column; }

.weak-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 23px;
}

.weak-row {
  display: grid;
  grid-template-columns: 26px 1fr 34px;
  align-items: center;
  gap: 10px;
}

.weak-glyph {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
}

.weak-bar {
  height: 8px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
  background: var(--paper-light);
}

.weak-bar span { display: block; height: 100%; background: var(--red); }

.weak-count { color: var(--muted); font-family: var(--font-mono); font-size: 8px; text-align: right; }

.weak-panel .text-link { margin-top: 17px; align-self: flex-start; }

.calendar-panel { display: flex; flex-direction: column; }

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  max-width: 320px;
  margin-top: 20px;
}

.cal-cell {
  aspect-ratio: 1;
  border: 1.5px solid rgba(23, 21, 18, 0.18);
  border-radius: 2px;
  background: rgba(23, 21, 18, 0.045);
}

.cal-cell[data-level="1"] { border-color: rgba(41, 71, 200, 0.25); background: rgba(41, 71, 200, 0.2); }
.cal-cell[data-level="2"] { border-color: rgba(41, 71, 200, 0.35); background: rgba(41, 71, 200, 0.4); }
.cal-cell[data-level="3"] { border-color: rgba(41, 71, 200, 0.5); background: rgba(41, 71, 200, 0.67); }
.cal-cell[data-level="4"] { border-color: var(--ink); background: var(--blue); }
.cal-cell.is-today { outline: 2px solid var(--red); outline-offset: 2px; }

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: auto;
  padding-top: 17px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
}

.calendar-legend i {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(23, 21, 18, 0.18);
  border-radius: 1px;
  background: rgba(23, 21, 18, 0.045);
}
.calendar-legend i:nth-of-type(2) { background: rgba(41, 71, 200, 0.2); }
.calendar-legend i:nth-of-type(3) { background: rgba(41, 71, 200, 0.4); }
.calendar-legend i:nth-of-type(4) { background: var(--blue); }

.records-panel { display: flex; flex-direction: column; }

.record-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 11px;
}

.record-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.record-row:first-child { border-top: 0; }

.record-rank { color: var(--dim); font-family: var(--font-mono); font-size: 8px; }

.record-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.record-copy strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-score {
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.record-score small {
  margin-left: 3px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 7px;
}

.sessions-panel { grid-column: 1 / -1; }

.session-list {
  display: flex;
  flex-direction: column;
  margin-top: 11px;
}

.session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px 64px 58px;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.session-row:first-child { border-top: 0; }

.session-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-name small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.session-number {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-align: right;
}

.session-number small { color: var(--muted); font-size: 7px; font-weight: 400; }
.session-accuracy { color: var(--muted); }

.session-badge {
  justify-self: end;
  color: var(--red);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.sessions-panel .text-link { color: var(--muted); font-size: 8.5px; }
.sessions-panel .text-link:hover { color: var(--red); }

/* =========================================================
   Guide
   ========================================================= */

.guide-heading { max-width: 900px; }

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.guide-card,
.guide-hero-card,
.guide-cta {
  position: relative;
  overflow: hidden;
  padding: 25px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 4px 4px 0 var(--ink);
}

.guide-hero-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 280px;
  align-items: center;
  gap: 32px;
  padding: 31px 32px;
  background: var(--ink);
  color: var(--paper-light);
  box-shadow: 6px 6px 0 var(--red);
}

.guide-number {
  align-self: flex-start;
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 76px;
  font-weight: 400;
  letter-spacing: -0.08em;
  line-height: 0.8;
}

.guide-hero-card .eyebrow { color: rgba(251, 247, 238, 0.5); }

.guide-hero-card h2 {
  margin: 9px 0 9px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.5vw, 48px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}

.guide-hero-card p {
  max-width: 620px;
  margin: 0;
  color: rgba(251, 247, 238, 0.65);
  font-size: 11.5px;
  line-height: 1.65;
}

.guide-quote {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding-left: 25px;
  border-left: 1px solid rgba(251, 247, 238, 0.2);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 20px;
  font-style: italic;
  line-height: 1.4;
}

.guide-card h2 {
  margin: 8px 0 18px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.check-list li > span {
  padding-top: 1px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 8px;
}

.check-list li p { margin: 0; }
.check-list b { color: var(--ink); }

.warmup-card { background: var(--blue-soft); }

.guide-lede {
  margin: -6px 0 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.warmup-steps { display: flex; flex-direction: column; }

.warmup-steps > div {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid rgba(23, 21, 18, 0.14);
}

.warmup-steps > div > span {
  padding-top: 1px;
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 8px;
}

.warmup-steps p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; }
.warmup-steps b { color: var(--ink); }

.map-card { grid-column: 1 / -1; }
.map-card .panel-head { margin-bottom: 19px; }
.map-card .keyboard { min-width: 760px; }
.map-card .key { height: 38px; }

.map-note { margin: 17px 0 0; color: var(--muted); font-size: 9.5px; }
.map-note::before { content: "↳"; margin-right: 6px; color: var(--red); }

.code-guide-card,
.shortcuts-guide-card { grid-column: 1 / -1; }

.code-guide-grid,
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 19px;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
}

.code-guide-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px;
  background: var(--paper-light);
}

.code-guide-grid b { color: var(--blue); font-family: var(--font-mono); font-size: 8px; font-weight: 400; }
.code-guide-grid span { color: var(--ink-soft); font-size: 10.5px; font-weight: 600; line-height: 1.35; }
.code-guide-grid small { color: var(--muted); font-size: 9px; line-height: 1.5; }

.shortcut-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.shortcut-grid > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--paper-light);
}

.shortcut-grid kbd {
  flex: none;
  height: 22px;
  min-width: 48px;
  padding: 0 7px;
  border-color: var(--ink);
  color: var(--ink);
  font-size: 7.5px;
}

.shortcut-grid span { color: var(--muted); font-size: 9.5px; line-height: 1.4; }

.rhythm-card { background: var(--yellow); }
.rhythm-card .eyebrow { color: rgba(23, 21, 18, 0.58); }

.routine { display: flex; flex-direction: column; }

.routine > div {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 13px;
  padding: 13px 0;
  border-top: 1px solid rgba(23, 21, 18, 0.24);
}

.routine > div:first-child { border-top: 0; padding-top: 0; }
.routine > div:last-child { padding-bottom: 0; }

.routine > div > span {
  color: var(--red-deep);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
}

.routine p { margin: 0; color: var(--ink-soft); font-size: 10.5px; line-height: 1.55; }
.routine b { color: var(--ink); font-weight: 600; }

.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
}

.rule-grid > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--paper-light);
}

.rule-grid b { color: var(--blue); font-family: var(--font-mono); font-size: 8px; font-weight: 400; }
.rule-grid span { color: var(--ink-soft); font-size: 10.5px; font-weight: 600; }
.rule-grid small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.rule-grid .rule-highlight { background: var(--yellow); }
.rule-grid .rule-highlight b { color: var(--red-deep); }

.guide-cta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 25px 28px;
  background: var(--red);
  color: var(--paper-light);
  box-shadow: 6px 6px 0 var(--ink);
}

.guide-cta .eyebrow { color: rgba(251, 247, 238, 0.62); }

.guide-cta h2 {
  margin: 7px 0 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.035em;
}

/* =========================================================
   Course map dialog
   ========================================================= */

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
}

dialog::backdrop {
  background: rgba(23, 21, 18, 0.6);
  backdrop-filter: blur(3px);
}

dialog[open] { animation: dialog-in 220ms var(--ease) both; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}

.course-dialog {
  width: min(570px, calc(100vw - 28px));
  max-height: min(82vh, 760px);
}

.course-shell {
  display: flex;
  flex-direction: column;
  max-height: min(82vh, 760px);
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper-light);
  box-shadow: 10px 10px 0 var(--ink);
}

.course-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 22px 15px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.course-head h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}

.course-summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 22px 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-wrap: wrap;
}

.course-summary strong { color: var(--ink); }

.path-progress {
  height: 8px;
  margin: 0 22px 4px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: 1px;
  background: var(--paper-light);
}

.path-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--red);
  transition: width 400ms var(--ease);
}

.course-path {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 21, 18, 0.25) transparent;
}

.course-path::-webkit-scrollbar { width: 6px; }
.course-path::-webkit-scrollbar-thumb { background: rgba(23, 21, 18, 0.22); border-radius: 9px; }

.unit { margin-bottom: 17px; }

.unit-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px 7px;
}

.unit-title span { color: var(--red); font-family: var(--font-mono); font-size: 8px; }

.unit-title h3 {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lesson-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-bottom: 3px;
  padding: 8px 9px;
  border: 1.5px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}

.lesson-link:hover { border-color: var(--line); background: var(--paper); }

.lesson-link.is-active {
  border-color: var(--ink);
  background: var(--blue);
  color: var(--paper-light);
}

.lesson-link.is-complete .lesson-index {
  border-color: var(--ink);
  background: var(--yellow);
  color: var(--ink);
}

.lesson-link.is-active .lesson-index,
.lesson-link.is-active .lesson-score {
  border-color: var(--paper-light);
  color: var(--paper-light);
}

.lesson-index {
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.lesson-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-score { flex: none; color: var(--dim); font-family: var(--font-mono); font-size: 8px; }

.course-foot {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 22px;
  border-top: 2px solid var(--ink);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
}

.course-foot kbd { color: var(--ink); }
.version { color: var(--dim); font-family: var(--font-mono); }

/* =========================================================
   Summary / reset dialogs
   ========================================================= */

.summary-dialog {
  width: min(530px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  scrollbar-width: none;
}

.summary-dialog::-webkit-scrollbar { display: none; }

.summary-shell {
  position: relative;
  overflow: hidden;
  padding: 31px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper-light);
  box-shadow: 10px 10px 0 var(--ink);
}

.summary-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: var(--red);
}

.summary-close { position: absolute; top: 15px; right: 15px; }

.summary-top { text-align: center; }

.summary-stars {
  margin: 16px 0 8px;
  color: var(--red);
  font-size: 27px;
  letter-spacing: 7px;
  line-height: 1;
}

.summary-stars .off { color: var(--ghost); }

.summary-top h2 {
  margin: 9px 0 0;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 1;
}

.summary-top p {
  max-width: 360px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.pb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  padding: 5px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 1.5px 1.5px 0 var(--ink);
}

.pb-badge::before { content: "✦"; }

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 24px 0 17px;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

.summary-stats > div {
  padding: 16px 8px;
  border-left: 1.5px solid var(--ink);
  text-align: center;
}

.summary-stats > div:first-child { border-left: 0; }

.summary-stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: 31px;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-stats span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.summary-coach {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
}

.coach-avatar.small {
  width: 22px;
  height: 22px;
  border-color: var(--ink);
  font-size: 12px;
}

.summary-coach p { margin: 1px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }

.summary-weak {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
}

.summary-weak > span { flex: none; }
.summary-weak .key-chip { border-color: var(--ink); background: var(--paper); color: var(--ink); }
.summary-weak .key-chip small { color: var(--red); }

.summary-actions { display: flex; gap: 8px; margin-top: 20px; }
.summary-actions .btn-ink { flex: 1; }

.summary-progress-link { display: block; margin: 16px auto 0; color: var(--muted); font-size: 8px; }
.summary-progress-link:hover { color: var(--red); }

.reset-dialog { width: min(440px, calc(100vw - 28px)); }

.reset-shell {
  padding: 27px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper-light);
  box-shadow: 9px 9px 0 var(--ink);
}

.reset-shell h2 {
  margin: 8px 0 9px;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}

.reset-shell p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.reset-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* =========================================================
   Command palette
   ========================================================= */

.command-dialog {
  width: min(640px, calc(100vw - 24px));
  max-height: min(76vh, 620px);
  margin: 11vh auto auto;
}

.command-shell {
  display: flex;
  flex-direction: column;
  max-height: min(76vh, 620px);
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper-light);
  box-shadow: 10px 10px 0 var(--ink);
}

.command-search {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: none;
  padding: 16px 17px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.command-search > svg { width: 18px; height: 18px; color: var(--muted); }

.command-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
}

.command-search input::placeholder { color: var(--dim); }

.command-search kbd {
  height: 21px;
  min-width: 34px;
  padding: 0 6px;
  border-color: var(--ink);
  color: var(--ink);
  font-size: 7.5px;
}

.command-results {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  padding: 7px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 21, 18, 0.25) transparent;
}

.command-results::-webkit-scrollbar { width: 6px; }
.command-results::-webkit-scrollbar-thumb { background: rgba(23, 21, 18, 0.22); border-radius: 9px; }

.command-item {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1.5px solid transparent;
  border-radius: 2px;
  color: var(--ink-soft);
  cursor: pointer;
}

.command-item:hover { border-color: var(--line); background: var(--paper); }

.command-item.is-selected {
  border-color: var(--ink);
  background: var(--blue);
  color: var(--paper-light);
}

.command-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--paper-light);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 8px;
}

.command-item.is-selected .command-icon {
  border-color: var(--paper-light);
  background: transparent;
  color: var(--paper-light);
}

.command-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.command-copy strong {
  overflow: hidden;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-copy small {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-item.is-selected .command-copy small { color: rgba(251, 247, 238, 0.65); }

.command-item kbd {
  height: 19px;
  padding: 0 5px;
  border-color: currentColor;
  color: var(--muted);
  font-size: 7px;
}

.command-item.is-selected kbd { color: var(--paper-light); }

.command-enter { color: var(--dim); font-family: var(--font-mono); font-size: 10px; opacity: 0; }
.command-item.is-selected .command-enter { opacity: 0.8; color: var(--paper-light); }

.command-empty {
  padding: 38px 16px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  text-align: center;
}

.command-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  padding: 10px 16px;
  border-top: 2px solid var(--ink);
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
}

.command-footer span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

.command-footer kbd {
  height: 16px;
  min-width: 17px;
  font-size: 6.5px;
  border-color: var(--line-strong);
  color: var(--ink);
}

.command-footer-tip { margin-left: auto; font-size: 7px; opacity: 0.75; }

/* =========================================================
   Toast
   ========================================================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 10px 15px;
  border: 2px solid var(--paper-light);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper-light);
  box-shadow: 4px 4px 0 var(--red);
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1240px) {
  .masthead-inner { padding-left: 24px; padding-right: 24px; gap: 18px; }
  .masthead-sub { padding-left: 24px; padding-right: 24px; }
  .practice-wrap, .page-wrap { padding-left: 24px; padding-right: 24px; }
  .map-trigger span { display: none; }
  .map-trigger { width: 35px; justify-content: center; padding: 0; }
  .scoreboard { grid-template-columns: 1.3fr 0.8fr 0.8fr 0.8fr; }
  .score-goal {
    grid-column: 1 / -1;
    min-height: auto;
    border-left: 0;
    border-top: 2px solid var(--ink);
  }
}

@media (max-width: 1050px) {
  .masthead-inner { grid-template-columns: auto 1fr auto; }
  .primary-nav { justify-self: end; }
  .streak-pill > span:last-child { display: none; }
  .command-trigger > span { display: none; }
  .lower-deck { grid-template-columns: minmax(0, 1fr) 300px; }
  .guide-hero-card { grid-template-columns: 70px minmax(0, 1fr); }
  .guide-quote {
    grid-column: 1 / -1;
    padding: 17px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(251, 247, 238, 0.2);
    font-size: 17px;
  }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .masthead-inner {
    grid-template-columns: auto 1fr;
    padding-top: 12px;
    padding-bottom: 11px;
  }
  .brand-copy strong { font-size: 24px; }
  .brand-mark { width: 42px; height: 42px; font-size: 25px; }
  .topbar-actions { justify-self: end; }
  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: stretch;
    margin-top: 2px;
  }
  .nav-link { flex: 1; justify-content: center; }
  .masthead-sub { padding-top: 7px; }
  .practice-wrap, .page-wrap { padding: 23px 18px 42px; }
  .studio-kicker { flex-wrap: wrap; gap: 12px 16px; }
  .lesson-map-link { margin-left: 0; }
  .lesson-heading { align-items: flex-start; flex-direction: column; gap: 17px; }
  .lesson-heading h1 { font-size: clamp(42px, 8vw, 60px); }
  .lesson-actions { width: 100%; }
  .lesson-actions .btn { flex: 1; }
  .scoreboard { grid-template-columns: 1.4fr 1fr 1fr; }
  .score-main { grid-column: span 3; min-height: 95px; }
  .score-cell { min-height: 80px; border-top: 2px solid var(--ink); }
  .score-cell:first-of-type { border-left: 0; }
  .score-goal { grid-column: span 3; }
  .score-cell strong { font-size: 30px; }
  .typing-top { grid-template-columns: 1fr auto; }
  .typing-controls { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .run-meta { grid-column: 2; grid-row: 1; }
  .type-text { font-size: clamp(21px, 4.2vw, 27px); }
  .type-viewport { min-height: 160px; padding: 20px 21px 22px; }
  .lower-deck { grid-template-columns: minmax(0, 1fr); }
  .support-rail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); min-width: 0; }
  .note-card { transform: none; }
  .keyboard-head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .finger-hint { margin-top: -2px; }
  .legend-tip { display: none; }
  .page-heading { flex-direction: column; align-items: flex-start; gap: 20px; margin-bottom: 25px; }
  .page-heading h1 { font-size: clamp(44px, 8.5vw, 66px); }
  .page-actions { flex-wrap: wrap; }
  .progress-grid { grid-template-columns: 1fr; }
  .sessions-panel { grid-column: auto; }
  .guide-grid { grid-template-columns: 1fr; }
  .map-card, .guide-hero-card, .guide-cta, .code-guide-card, .shortcuts-guide-card { grid-column: auto; }
  .guide-hero-card { grid-template-columns: 1fr; gap: 14px; padding: 24px; }
  .guide-number { font-size: 50px; }
  .guide-quote { grid-column: auto; }
  .code-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-cta { align-items: flex-start; flex-direction: column; gap: 18px; }
  .command-dialog { margin-top: 9vh; }
}

@media (max-width: 620px) {
  .masthead-inner { gap: 12px; padding: 10px 14px 9px; }
  .brand { gap: 8px; }
  .brand-mark { width: 38px; height: 38px; font-size: 22px; box-shadow: 2px 2px 0 var(--ink); }
  .brand-copy strong { font-size: 22px; }
  .brand-copy small { font-size: 6px; margin-top: 4px; }
  .topbar-actions { gap: 4px; }
  .streak-pill { height: 32px; padding: 0 7px; }
  .streak-pill .flame { width: 12px; height: 12px; }
  .command-trigger { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .command-trigger kbd { display: none; }
  .map-trigger { width: 32px; height: 32px; }
  .icon-toggle { width: 32px; height: 32px; }
  .primary-nav { padding: 3px; gap: 2px; margin-top: 0; }
  .nav-link { height: 30px; padding: 0 6px; font-size: 8px; gap: 4px; }
  .nav-index { display: none; }
  .masthead-sub { padding: 6px 14px 8px; }
  .masthead-note { display: none; }
  .practice-wrap, .page-wrap { padding: 18px 12px 34px; }
  .studio-kicker { gap: 10px; margin-bottom: 16px; }
  .track-tab { height: 27px; padding: 0 9px; font-size: 7.5px; }
  .path-summary { font-size: 7px; }
  .lesson-map-link { display: none; }
  .lesson-heading h1 { font-size: 42px; }
  .lesson-heading p { font-size: 12px; }
  .lesson-actions .btn { height: 39px; }
  .scoreboard { grid-template-columns: 1.35fr 1fr 1fr; }
  .score-main { grid-column: span 3; min-height: 84px; padding: 11px 14px; }
  .score-value strong { font-size: 50px; }
  .score-cell { min-height: 69px; padding: 9px 11px; gap: 6px; }
  .score-cell strong { font-size: 26px; }
  .score-label { font-size: 6.5px; }
  .score-goal { padding: 10px 13px; }
  .typing-top { padding: 9px 12px; gap: 8px; }
  .run-status { font-size: 7px; }
  .run-meta { font-size: 7.5px; }
  .reveal-label { display: none; }
  .reveal-switch button { height: 22px; padding: 0 5px; font-size: 6.5px; }
  .type-viewport { min-height: 152px; padding: 15px 13px 18px; }
  .type-text { font-size: 21px; line-height: 1.68; letter-spacing: -0.045em; }
  .type-text.is-code { font-size: 16px; }
  .typing-bottom { padding: 0 13px 12px; }
  .typing-hint { font-size: 6.5px; gap: 5px; }
  .typing-hint > span:first-child { display: none; }
  .typing-hint .hint-sep { display: none; }
  .keyboard-card { padding: 15px 13px 12px; }
  .keyboard { min-width: 580px; }
  .key { height: 33px; }
  .finger-legend { font-size: 6.5px; gap: 7px 10px; }
  .support-rail { grid-template-columns: 1fr; }
  .coach-card { box-shadow: 4px 4px 0 var(--red); }
  .page-heading h1 { font-size: 44px; }
  .page-heading p { font-size: 12px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .metric-grid { gap: 9px; }
  .metric-card { padding: 13px 12px; box-shadow: 3px 3px 0 var(--ink); }
  .metric-card strong { font-size: 30px; }
  .metric-label { font-size: 6.5px; }
  .metric-foot { font-size: 7.5px; }
  .panel { padding: 16px; box-shadow: 3px 3px 0 var(--ink); }
  .panel-head h2 { font-size: 21px; }
  .chart-wrap { min-height: 200px; }
  .session-row { grid-template-columns: minmax(0, 1fr) 42px 36px 31px; gap: 7px; }
  .session-badge { font-size: 7px; letter-spacing: 0; }
  .session-name small { font-size: 7px; }
  .guide-card, .guide-hero-card, .guide-cta { padding: 20px 17px; }
  .guide-card h2 { font-size: 24px; }
  .guide-hero-card h2 { font-size: 31px; }
  .rule-grid { grid-template-columns: 1fr; }
  .code-guide-grid { grid-template-columns: 1fr; }
  .shortcut-grid { grid-template-columns: 1fr; }
  .map-card .keyboard { min-width: 590px; }
  .command-dialog { width: calc(100vw - 14px); margin-top: 7vh; }
  .command-shell { box-shadow: 6px 6px 0 var(--ink); }
  .command-search { padding: 13px; }
  .command-search input { font-size: 13px; }
  .command-item { padding: 8px; gap: 8px; }
  .command-footer { gap: 8px; padding: 9px 12px; }
  .command-footer-tip { display: none; }
  .summary-shell { padding: 26px 18px; box-shadow: 6px 6px 0 var(--ink); }
  .summary-top h2 { font-size: 32px; }
  .summary-stats strong { font-size: 25px; }
  .summary-actions { flex-direction: column-reverse; }
  .summary-actions .btn { width: 100%; }
  .reset-actions { flex-direction: column-reverse; }
  .reset-actions .btn { width: 100%; }
  .course-head { padding: 17px 15px 12px; }
  .course-head h2 { font-size: 30px; }
  .course-summary { padding: 12px 15px 8px; }
  .path-progress { margin-left: 15px; margin-right: 15px; }
  .course-path { padding: 10px 11px 16px; }
  .course-foot { padding: 10px 15px; }
  .course-foot > span:first-child { display: none; }
  .toast { font-size: 8px; }
}

/* =========================================================
   Site footer, consent and privacy page
   ========================================================= */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 32px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-footer .version { font-size: inherit; }

.footer-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer-link:hover { color: var(--red); }

.consent-dialog { width: min(570px, calc(100vw - 28px)); }

.consent-shell {
  position: relative;
  padding: 29px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper-light);
  box-shadow: 10px 10px 0 var(--ink);
}

.consent-close { position: absolute; top: 14px; right: 14px; }

.consent-shell h2 {
  max-width: 430px;
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1;
}

.consent-shell > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.62;
}

.consent-shell > p strong { color: var(--ink); }

.consent-status {
  margin-top: 15px !important;
  padding: 8px 10px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink) !important;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.02em;
}

.consent-actions {
  display: flex;
  gap: 8px;
  margin-top: 19px;
}

.consent-actions .btn-ink { flex: 1; }

.consent-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  font-size: 8px;
}

.consent-details {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1.5px solid var(--line);
}

.consent-details p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.consent-details p:last-child { margin-bottom: 0; }
.consent-details strong { color: var(--ink); }

.legal-wrap {
  max-width: 840px;
  margin: 0 auto;
  padding: 48px 28px 64px;
}

.legal-back { margin-bottom: 38px; color: var(--muted); font-size: 8px; }
.legal-back:hover { color: var(--red); }

.legal-head h1 {
  max-width: 720px;
  margin: 9px 0 13px;
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 76px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.96;
}

.legal-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.legal-date {
  display: block;
  margin-top: 17px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.legal-card {
  margin-top: 22px;
  padding: 22px 24px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  background: var(--paper-light);
  box-shadow: 6px 6px 0 var(--ink);
}

.legal-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 400;
  letter-spacing: -0.04em;
}

.legal-card p,
.legal-card li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.68;
}

.legal-card p { margin: 0 0 10px; }
.legal-card p:last-child { margin-bottom: 0; }
.legal-card ul { margin: 0 0 13px; padding-left: 19px; }
.legal-card li { margin: 2px 0; }
.legal-card strong { color: var(--ink); }

.legal-card code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.legal-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 31px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (max-width: 620px) {
  .site-footer {
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 12px 12px 24px;
    font-size: 7px;
  }

  .consent-shell { padding: 24px 19px 20px; }
  .consent-shell h2 { max-width: 300px; font-size: 32px; }
  .consent-shell > p { font-size: 10px; }
  .consent-actions { flex-direction: column; }
  .consent-actions .btn { width: 100%; }
  .consent-close { top: 10px; right: 10px; }

  .legal-wrap { padding: 30px 16px 46px; }
  .legal-back { margin-bottom: 28px; }
  .legal-head h1 { font-size: 45px; }
  .legal-head p { font-size: 12px; }
  .legal-card { padding: 18px 16px; box-shadow: 4px 4px 0 var(--ink); }
  .legal-card h2 { font-size: 24px; }
  .legal-card p, .legal-card li { font-size: 11px; }
  .legal-foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
