/* Typing Form Coach styles.
   Hand-drawn look: warm paper, pencil ink, felt-tip headings, wobbly edges and
   hard offset shadows. Text is Shantell Sans (drawn from artist Shantell Martin's
   handwriting); the line you type is Monaspace Radon, a handwritten monospace. The typing screen borrows monkeytype's calm layout: big
   live numbers above the text, dim untyped letters, and a thin caret.
   Colors and shapes are custom properties so dark mode only changes the variables. */

/* One variable file covers every weight plus the Informality and Bounce axes. */
@font-face {
  font-family: "Shantell Sans";
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/shantell-sans-latin-full-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Monaspace Radon";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/monaspace-radon-latin-400-normal.woff2") format("woff2");
}

:root {
  /* Paper and ink */
  --paper: #fdfbf7;
  --card: #ffffff;
  --ink: #2d2d2d;            /* soft pencil black, never pure black */
  --ink-soft: #5c5853;       /* secondary text */
  --pencil: #77716a;         /* untyped letters (4.7:1 on paper) */
  --erased: #e5e0d8;         /* old paper, dividers, dot grain */
  --marker: #ff4d4d;         /* red correction marker, for drawings */
  --marker-ink: #c62828;     /* red that is dark enough for text */
  --marker-fill: #d93030;    /* red behind white text (4.7:1) */
  --pen: #2d5da1;            /* blue ballpoint */
  --pen-ink: #2d5da1;
  --postit: #fff9c4;
  --postit-ink: #2d2d2d;
  --highlighter: #ffec7a;
  --tape: rgba(170, 160, 145, 0.38);
  --ok: #2f7a45;
  --ok-bg: #e4f3e2;
  --bad-bg: #ffe4e1;
  --warn-bg: #fff9c4;
  --beat-good: rgba(47, 122, 69, 0.4);
  --beat-bad: rgba(217, 48, 48, 0.42);
  --beat-warn: rgba(232, 134, 12, 0.45);
  --info-bg: #e6eefa;
  --rule-line: #d6e2f0;      /* notebook ruling */
  --shadow-ink: #2d2d2d;

  /* Wobbly edges: big elliptical radii that never repeat, so nothing looks machine-cut. */
  --wobbly: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --wobbly-md: 15px 225px 15px 255px / 255px 15px 225px 15px;
  --wobbly-sm: 6px 14px 8px 12px / 12px 7px 14px 6px;
  --wobbly-blob: 58% 42% 55% 45% / 46% 56% 44% 54%;

  /* Hard shadows, no blur */
  --shadow: 4px 4px 0 0 var(--shadow-ink);
  --shadow-sm: 2px 2px 0 0 var(--shadow-ink);
  --shadow-lg: 8px 8px 0 0 var(--shadow-ink);
  --shadow-soft: 3px 3px 0 0 rgba(45, 45, 45, 0.12);

  --font-hand: "Shantell Sans", "Comic Sans MS", "Segoe Print", cursive;
  --font-marker: "Shantell Sans", "Comic Sans MS", "Segoe Print", cursive;
  --font-type: "Monaspace Radon", "Comic Mono", ui-monospace, monospace;
  /* Shantell Sans axes: calm handwriting for reading, a loose bouncy marker for headings and numbers. */
  --hand-axes: "INFM" 40, "BNCE" 10;
  --marker-axes: "INFM" 100, "BNCE" 60;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12'%3E%3Cpath d='M2 2.5c2.4 2.1 4.8 4.6 8.1 7 2.6-2.3 5-4.6 7.6-7.2' fill='none' stroke='%232d2d2d' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Night notebook: graphite paper with chalky ink and a monkeytype-yellow highlighter. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #2c2e31;
    --card: #343639;
    --ink: #ebe6db;
    --ink-soft: #bdb8ad;
    --pencil: #a09c94;
    --erased: #45474b;
    --marker: #ff6b6b;
    --marker-ink: #ff8a80;
    --marker-fill: #d93030;
    --pen: #8fb4ec;
    --pen-ink: #9cc0f5;
    --postit: #e2b714;
    --postit-ink: #2d2d2d;
    --highlighter: rgba(226, 183, 20, 0.45);
    --tape: rgba(235, 230, 219, 0.2);
    --ok: #8fd19e;
    --ok-bg: #26382b;
    --bad-bg: #4a2a2a;
    --warn-bg: #4a4020;
    --beat-good: rgba(110, 205, 135, 0.35);
    --beat-bad: rgba(255, 107, 107, 0.4);
    --beat-warn: rgba(255, 170, 70, 0.42);
    --info-bg: #2a3445;
    --rule-line: #3e4147;
    --shadow-ink: #151618;
    --shadow-soft: 3px 3px 0 0 rgba(0, 0, 0, 0.35);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12'%3E%3Cpath d='M2 2.5c2.4 2.1 4.8 4.6 8.1 7 2.6-2.3 5-4.6 7.6-7.2' fill='none' stroke='%23ebe6db' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }

/* Classes that set `display` would otherwise override the hidden attribute. */
[hidden] { display: none !important; }

/* A ruled SVG sheet sweeps across the viewport with a bending edge. */
.page-turn-cover {
  position: fixed;
  inset: var(--page-turn-top, 0px) 0 0;
  z-index: 100;
  --turn-paper: var(--paper);
  pointer-events: auto;
}
.page-turn-cover--landing { --turn-paper: #2c2e31; }
.page-turn-art { display: block; width: 100%; height: 100%; overflow: visible; }
.page-turn-sheet { filter: drop-shadow(16px 0 22px rgba(0, 0, 0, 0.42)); }
.page-turn-margin { fill: none; stroke: rgba(255, 107, 107, 0.35); stroke-width: 1; }
.page-turn-fold { fill: none; stroke-width: 74; }
.page-turn-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-family: var(--font-marker);
  font-size: clamp(1.1rem, 1.8vw, 1.5rem);
  font-variation-settings: var(--marker-axes);
  font-weight: 800;
  letter-spacing: -0.09em;
  line-height: 0.85;
  opacity: 0;
  pointer-events: none;
  animation: turn-logo-moment 850ms linear both;
}
.page-turn-logo .logo-circled { color: var(--marker-ink); }
.page-turn-cover--landing { --ink: #fff8fa; --marker: #ff6b6b; --marker-ink: #ff6b6b; }
@keyframes turn-logo-moment {
  0%, 43% { opacity: 0; transform: scale(0.97); }
  49% { opacity: 1; transform: scale(1); }
  69% { opacity: 1; transform: scale(1); }
  78%, 100% { opacity: 0; transform: scale(1.015); }
}
.page-turn-cover.is-revealing { opacity: 0; transition: opacity 180ms ease-out; }

body {
  position: relative;
  isolation: isolate;
  --notebook-rule-gap: 4.7rem;
  --notebook-first-rule: 8.8rem;
  --landing-content-pad: clamp(1.25rem, 5vw, 5rem);
  --header-container-offset: max(0px, calc(50vw - 600px));
  --paper-margin-x: clamp(8rem, calc(50vw - 600px + 8rem), 10rem);
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--font-hand);
  font-variation-settings: var(--hand-axes);
}
body::before,
body::after { position: absolute; z-index: -1; inset: 0; content: ""; pointer-events: none; }
body::before {
  top: calc(var(--notebook-first-rule) - 4rem);
  background-image: repeating-linear-gradient(to bottom, transparent 0 4rem, rgba(255, 107, 107, 0.085) 4rem calc(4rem + 1px), transparent calc(4rem + 1px) var(--notebook-rule-gap));
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}
body::after {
  right: auto;
  width: var(--paper-margin-x);
  background-image: radial-gradient(circle at 50% 8rem, #252629 0 0.782rem, #715057 0.794rem 0.966rem, transparent 0.989rem);
  background-repeat: repeat-y;
  background-size: var(--paper-margin-x) 24rem;
}
body:has(#screen-dashboard:not([hidden]))::after { background-image: none; }
.paper-margin-foreground { position: absolute; z-index: -1; top: 0; bottom: 0; left: var(--paper-margin-x); width: 1px; background: rgba(255, 107, 107, 0.24); pointer-events: none; }

h1, h2, h3 { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; line-height: 1.15; }
h2 { font-size: clamp(1.75rem, 3.6vw, 2.35rem); font-weight: 800; margin: 0.75rem 0 1.25rem; }
h3 {
  font-size: 1.55rem;
  margin: 2rem 0 0.75rem;
  text-decoration: none;
}
strong { font-weight: 400; color: var(--ink); background: linear-gradient(transparent 58%, var(--highlighter) 58%); }

/* Visible focus everywhere, for keyboard users: a blue pen circle. */
:focus-visible {
  outline: 3px dashed var(--pen);
  outline-offset: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  background: var(--postit);
  color: var(--postit-ink);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-sm);
  padding: 0.5rem 1rem;
  z-index: 30;
}

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 110;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem 0.9rem;
  border-bottom: 0;
  transition: opacity 200ms ease;
}
.app-header::before { position: absolute; z-index: -1; inset-block: 0; left: 50%; width: 100vw; transform: translateX(-50%); background-color: var(--paper); content: ""; pointer-events: none; box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.82), 0 5px 12px -5px rgba(0, 0, 0, 0.68); transition: box-shadow 250ms ease; }
.app-header.is-page-turning::before { box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.68), 0 18px 28px -12px rgba(0, 0, 0, 0.46); }
body:has(#screen-landing:not([hidden])) .app-header.is-scrolled::before { box-shadow: 0 12px 22px -3px rgba(0, 0, 0, 0.88), 0 30px 44px -10px rgba(0, 0, 0, 0.62); }
body:has(#screen-landing:not([hidden])) .app-header::before { background-color: #2c2e31; }
.app-header::after { position: absolute; z-index: 10; bottom: 0; left: 50%; width: 100vw; height: 1px; transform: translateX(-50%); background: rgba(255, 107, 107, 0.72); content: ""; pointer-events: none; }
.logo {
  margin-left: calc(0px - var(--header-container-offset));
  color: var(--ink);
  font-family: var(--font-marker);
  font-variation-settings: var(--marker-axes);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transform: rotate(-1deg);
}
/* A red marker loop drawn around "Form". */
.logo-circled { position: relative; display: inline-block; padding: 0 0.2em; margin: 0 0.15em; color: var(--marker-ink); }
.logo-serif { font-family: "Times New Roman", Times, serif; font-weight: 400; letter-spacing: -0.06em; }
.logo-circled::after {
  content: "";
  position: absolute;
  inset: -0.12em -0.15em -0.05em -0.2em;
  border: 2.5px solid var(--marker);
  border-radius: var(--wobbly-blob);
  transform: rotate(-4deg);
  pointer-events: none;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--pencil);
  font-size: 1.05rem;
  counter-reset: step;
}
.steps li { position: relative; counter-increment: step; }
.steps li::before { content: counter(step) ". "; }
.landing-nav { display: flex; align-items: center; gap: 0.35rem 1.1rem; margin-right: calc(0px - var(--header-container-offset)); }
.landing-nav a {
  color: var(--ink-soft);
  font-weight: 650;
  text-decoration: none;
}
.landing-nav a:hover { color: var(--marker-ink); }
.landing-nav [aria-current] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--marker-ink); text-decoration-thickness: 2px; text-underline-offset: 0.28em; }
.landing-nav .nav-cta {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  font: inherit;
  font-weight: 650;
}
.landing-nav .nav-cta:hover:not(:disabled) { background: transparent; color: var(--marker-ink); box-shadow: none; }
.landing-nav .nav-cta:active:not(:disabled) { transform: none; }
body:has(#screen-landing:not([hidden])) .steps { display: none; }
body:has(#screen-about:not([hidden])) .steps { display: none; }
body:has(#screen-landing:not([hidden])) .debug-toggle { display: none; }
body:not(:has(#screen-landing:not([hidden]))) .app-header { column-gap: 1rem; }
body:not(:has(#screen-landing:not([hidden]))) .steps { order: 2; margin-left: auto; gap: 0.15rem 0.65rem; font-size: 0.92rem; }
body:not(:has(#screen-landing:not([hidden]))) .landing-nav { order: 3; margin-right: calc(0px - var(--header-container-offset)); margin-left: auto; }
/* Circle whichever step is on screen, like a teacher marking the page. */
body:has(#screen-setup:not([hidden])) .steps [data-step="setup"],
body:has(#screen-calibrate:not([hidden])) .steps [data-step="calibrate"],
body:has(#screen-choose:not([hidden])) .steps [data-step="choose"],
body:has(#screen-exercise:not([hidden])) .steps [data-step="exercise"],
body:has(#screen-summary:not([hidden])) .steps [data-step="summary"] {
  color: var(--ink);
}
body:has(#screen-typing-test:not([hidden])) .steps [data-step="typing-test"] { color: var(--ink); }
body:has(#screen-setup:not([hidden])) .steps [data-step="setup"]::after,
body:has(#screen-calibrate:not([hidden])) .steps [data-step="calibrate"]::after,
body:has(#screen-choose:not([hidden])) .steps [data-step="choose"]::after,
body:has(#screen-exercise:not([hidden])) .steps [data-step="exercise"]::after,
body:has(#screen-summary:not([hidden])) .steps [data-step="summary"]::after {
  content: "";
  position: absolute;
  inset: -0.1em -0.45em -0.05em -0.4em;
  border: 2px solid var(--pen);
  border-radius: var(--wobbly-blob);
  transform: rotate(2deg);
}
body:has(#screen-typing-test:not([hidden])) .steps [data-step="typing-test"]::after {
  content: "";
  position: absolute;
  inset: -0.1em -0.45em -0.05em -0.4em;
  border: 2px solid var(--pen);
  border-radius: var(--wobbly-blob);
  transform: rotate(2deg);
}

main { padding: 0.5rem 1.25rem 5rem; max-width: 1200px; margin: 0 auto; }
.screen-about { min-height: calc(100vh - 4.5rem); max-width: 60rem; margin: 0 auto; padding: 2.5rem 0 3rem; }
.about-hero { margin-bottom: 1.75rem; }
.about-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 0.6rem; }
.about-logo { white-space: nowrap; }
.about-lead { font-size: clamp(1.15rem, 2vw, 1.45rem); max-width: 44rem; margin: 0; color: var(--ink); }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; }
.about-card h2 { font-size: 1.45rem; margin: 0 0 0.6rem; }
.about-card p { margin: 0 0 0.5rem; }
.about-card--wide { grid-column: 1 / -1; }
.about-steps { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.6rem; }
.about-steps li::marker { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; color: var(--marker-ink); }
.about-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0; margin: 0 0 0.75rem; }
.about-tags li { padding: 0.1rem 0.65rem; border: 2px solid var(--ink); border-radius: var(--wobbly-sm); background: var(--postit); color: var(--postit-ink); font-size: 0.95rem; }
.about-actions { margin-top: 1.75rem; }
@media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; } }
.screen-dashboard {
  --dashboard-panel-inset: clamp(0.9rem, 2vw, 1.5rem);
  --dashboard-panel-padding: clamp(1.1rem, 2.5vw, 2rem);
  min-height: calc(100vh - 4.5rem);
  padding-top: 0.75rem;
}
.screen-dashboard > h1 { margin: 0 0 1rem; margin-left: calc(var(--paper-margin-x) - var(--header-container-offset) - 1.25rem + var(--dashboard-panel-inset) + var(--dashboard-panel-padding)); }
.screen-dashboard.is-first-setup::before {
  position: fixed;
  z-index: 9;
  inset: 0;
  content: "";
  background: rgba(8, 9, 11, 0.52);
  backdrop-filter: grayscale(0.85) blur(2px);
  pointer-events: none;
}
.screen-dashboard.is-first-setup .dashboard-submenu { z-index: 8; filter: grayscale(1) blur(4px); pointer-events: none; }
.dashboard-first-visit { position: fixed; z-index: 12; inset: 0; pointer-events: none; }
.dashboard-welcome-copy {
  position: absolute;
  z-index: 1;
  top: 48%;
  left: 50%;
  width: min(88vw, 34rem);
  padding: 1rem 1.4rem 1.1rem;
  transform: translate(-50%, -50%);
  border: 1.5px solid var(--marker);
  border-radius: var(--wobbly-sm);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  box-shadow: 0 0.7rem 1.5rem rgba(0, 0, 0, 0.25);
  text-align: center;
}
.dashboard-welcome-copy h2 { margin: 0 0 0.35rem; font-size: clamp(1.6rem, 3vw, 2.15rem); }
.dashboard-welcome-copy p { margin: 0; color: var(--ink); font-size: clamp(1rem, 1.7vw, 1.2rem); }
.dashboard-welcome-logo { display: inline-block; color: var(--ink); font-family: var(--font-marker); font-weight: 800; letter-spacing: -0.08em; }
.dashboard-welcome-logo .logo-circled { color: var(--marker-ink); }
.dashboard-submenu {
  position: fixed;
  z-index: 15;
  top: 50%;
  left: 0.5rem;
  display: grid;
  gap: 0.5rem;
  width: calc(var(--paper-margin-x) - 1rem);
  transform: translateY(-50%);
}
.dashboard-submenu button {
  padding: 0.25rem 0.35rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  font-size: 0.88rem;
  line-height: 1.3;
  text-align: center;
}
.dashboard-submenu button:hover:not(:disabled) { border-bottom-color: var(--marker); background: transparent; color: var(--ink); }
.dashboard-submenu button[aria-current="page"] { border-bottom-color: var(--marker); color: var(--ink); font-weight: 700; }
.dashboard-submenu button:active:not(:disabled) { transform: none; box-shadow: none; }
.dashboard-start-panel {
  width: calc(100vw - var(--paper-margin-x) - var(--dashboard-panel-inset) - var(--dashboard-panel-inset));
  margin-left: calc(var(--paper-margin-x) - var(--header-container-offset) - 1.25rem + var(--dashboard-panel-inset));
  padding: var(--dashboard-panel-padding);
  border-color: var(--marker);
}
.panel.dashboard-start-panel { position: sticky; top: 4.5rem; z-index: 10; border-color: var(--marker); box-shadow: 0 0.9rem 1.4rem -0.65rem rgba(0, 0, 0, 0.58), var(--shadow); }
.screen-dashboard.is-first-setup .dashboard-start-panel { animation: dashboard-panel-emerge 560ms cubic-bezier(0.2, 0.75, 0.25, 1) 1s both; }
@keyframes dashboard-panel-emerge {
  from { filter: grayscale(0.8) blur(3px); opacity: 0.68; transform: translateY(16px); }
  to { filter: none; opacity: 1; transform: translateY(0); }
}
.dashboard-lessons {
  width: calc(100vw - var(--paper-margin-x) - var(--dashboard-panel-inset) - var(--dashboard-panel-inset));
  margin-left: calc(var(--paper-margin-x) - var(--header-container-offset) - 1.25rem + var(--dashboard-panel-inset));
}
.dashboard-lessons h2 { margin: clamp(2rem, 4vh, 3rem) 0 0.75rem; }
.dashboard-start-copy h2 { font-family: "Times New Roman", Times, serif; font-weight: 400; }
.dashboard-start-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(1rem, 2.2vw, 2rem); }
.dashboard-start-actions { display: flex; align-items: center; gap: 0.65rem; }
.dashboard-camera-icon { width: clamp(3.5rem, 6vw, 5.5rem); height: auto; overflow: visible; fill: none; stroke: var(--marker-ink); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.dashboard-camera-icon .dashboard-camera-flash { fill: var(--marker-ink); stroke: none; }
.dashboard-start-copy h2 { margin: 0 0 0.3rem; }
.dashboard-start-copy p { margin: 0; color: var(--ink-soft); }
.dashboard-start-panel.is-camera-ready { border-color: var(--marker); }
.dashboard-camera-preview { width: min(92vw, 64rem); max-height: 90dvh; }
.dashboard-preview-map-note { margin: -0.45rem 0 0.65rem; color: var(--ink-soft); font-size: 0.9rem; }
.dashboard-preview-stage { position: relative; width: 100%; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 0.35rem; background: #1f2022; }
.dashboard-preview-video {
  display: block;
  width: 100%;
  height: 100%;
  background: #1f2022;
  object-fit: contain;
}
.dashboard-preview-video.is-rotated { transform: rotate(180deg); }
.dashboard-preview-video.is-flipped { transform: scale(-1, -1); }
.dashboard-preview-video.is-rotated.is-flipped { transform: none; }
.dashboard-preview-overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.dashboard-checks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.65rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.dashboard-checks li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.65rem; min-width: 0; padding: 0.8rem; border: 1px solid var(--erased); border-radius: var(--wobbly-sm); }
.dashboard-check-mark { display: grid; place-items: center; width: 1.55rem; height: 1.55rem; border: 1.5px solid var(--pencil); border-radius: 50%; color: transparent; font-size: 0.95rem; line-height: 1; }
.dashboard-check-copy { display: grid; min-width: 0; }
.dashboard-check-copy strong { overflow: hidden; background: none; color: var(--ink); font-size: 0.95rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-check-copy small { color: var(--ink-soft); font-size: 0.78rem; line-height: 1.25; }
.dashboard-check-state { color: var(--pencil); font-size: 0.75rem; white-space: nowrap; }
.dashboard-checks li.is-complete { border-color: var(--ok); }
.dashboard-checks li.is-complete .dashboard-check-mark { border-color: var(--ok); background: var(--ok); color: #fff; }
.dashboard-checks li.is-complete .dashboard-check-state { color: var(--ok); }
.dashboard-finger-accuracy {
  width: calc(100vw - var(--paper-margin-x) - var(--dashboard-panel-inset) - var(--dashboard-panel-inset));
  margin: 1.25rem 0 2rem calc(var(--paper-margin-x) - var(--header-container-offset) - 1.25rem + var(--dashboard-panel-inset));
  border-color: var(--marker);
}
.dashboard-finger-accuracy-heading { margin-bottom: 1rem; }
.dashboard-finger-accuracy-heading h2 { margin: 0 0 0.25rem; }
.dashboard-finger-accuracy-heading p { margin: 0; color: var(--ink-soft); }
.dashboard-finger-hands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dashboard-hand-card {
  display: grid;
  grid-template-columns: clamp(4.5rem, 8vw, 6.25rem) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: center;
  gap: 0.55rem 1rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--marker) 72%, var(--erased));
  border-radius: var(--wobbly-sm);
  background: color-mix(in srgb, var(--card) 75%, var(--marker) 4%);
}
.dashboard-hand-card h3 { grid-column: 1 / -1; margin: 0; font-size: 1rem; }
.dashboard-hand-model { grid-column: 1; grid-row: 2; width: 100%; height: auto; overflow: visible; }
.dashboard-hand-model .dashboard-hand-art { transform-box: fill-box; transform-origin: center; }
.dashboard-hand-model .dashboard-hand-art.is-right-hand { transform: scaleX(-1); }
.dashboard-hand-model .hero-hand-outline { fill: color-mix(in srgb, var(--marker) 12%, var(--card)); stroke: var(--marker-ink); stroke-width: 1.2; }
.dashboard-hand-model .hero-hand-outline-top { stroke: color-mix(in srgb, var(--marker) 74%, var(--card)); stroke-width: 1.5; }
.dashboard-hand-model .hero-hand-separators { stroke: color-mix(in srgb, var(--ink-soft) 70%, transparent); }
.dashboard-hand-model .hero-hand-nails { stroke: color-mix(in srgb, var(--marker-ink) 44%, transparent); }
.dashboard-hand-model .hero-hand-finger { fill: color-mix(in srgb, var(--marker) 19%, transparent); }
.dashboard-hand-model .dashboard-hand-side { fill: var(--marker-ink); font-family: var(--font-marker); font-size: 22px; font-weight: 800; text-anchor: middle; }
.dashboard-finger-list { display: grid; gap: 0.44rem; margin: 0; padding: 0; list-style: none; }
.dashboard-finger-stat { display: grid; grid-template-columns: minmax(3.4rem, auto) minmax(2.5rem, 1fr) 2.7rem; align-items: center; gap: 0.55rem; min-width: 0; }
.dashboard-finger-name { color: var(--ink-soft); font-size: 0.82rem; text-transform: capitalize; }
.dashboard-finger-track { height: 0.42rem; overflow: hidden; border-radius: 99px; background: var(--erased); }
.dashboard-finger-fill { display: block; height: 100%; border-radius: inherit; background: var(--marker); transition: width 260ms ease; }
.dashboard-finger-value { color: var(--ink); font-size: 0.85rem; text-align: right; }
.dashboard-finger-accuracy-note { margin: 0.8rem 0 0; }
.screen-typing-test {
  max-width: 1100px;
  min-height: calc(100svh - 6rem);
  margin-inline: auto;
  padding: clamp(1.25rem, 5vh, 3.5rem) 0;
}
.screen-typing-test h2 { margin-bottom: 0.45rem; }
.typing-test-intro { margin: 0 0 1.5rem; color: var(--ink-soft); font-size: 1.1rem; }
.typing-test-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.panel.typing-test-panel {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.typing-test-panel > .hint { margin-top: 0; }
.typing-test-editor {
  --test-type-size: clamp(2.8rem, 5vw, 3.5rem);
  position: relative;
  min-height: calc(var(--notebook-rule-gap) * 7 + var(--typing-test-line-shift, 0px) + 0.5rem);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: text;
}
.typing-test-editor:focus-within { outline: 0; }
.typing-test-passage {
  min-height: 100%;
  margin: 0;
  padding: 0.25rem 0 var(--typing-test-line-shift, 0px);
  background: transparent;
  font-family: "Times New Roman", Times, serif;
  font-size: var(--test-type-size);
  line-height: var(--notebook-rule-gap);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transform: translateY(var(--typing-test-line-shift, 0px));
}
.typing-test-letter--typed { color: var(--ink); }
.typing-test-letter--ghost { color: color-mix(in srgb, var(--pencil) 38%, transparent); }
.typing-test-letter--wrong { position: relative; color: transparent; background: var(--bad-bg); border-radius: 2px; }
.typing-test-letter--wrong::after {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--marker-ink);
  content: attr(data-entered);
  white-space: pre;
  pointer-events: none;
}
.typing-test-letter--current { position: relative; }
.typing-test-letter--current::before {
  position: absolute;
  top: 0;
  left: 0;
  height: 1.1em;
  border-left: 2px solid var(--marker-ink);
  content: "";
  pointer-events: none;
}
@keyframes typing-test-caret-blink { 50% { opacity: 0; } }
.typing-test-editor:focus-within .typing-test-letter--current::before { animation: typing-test-caret-blink 1s steps(2, start) infinite; }
.typing-test-input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.25rem 0;
  resize: none;
  overflow: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font-family: "Times New Roman", Times, serif;
  font-size: var(--test-type-size);
  line-height: var(--notebook-rule-gap);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  opacity: 0;
  cursor: text;
}
.typing-test-input::selection { color: transparent; background: transparent; }
.typing-test-input:disabled { opacity: 0.72; }
.typing-test-panel .button-row { flex: 0 0 auto; margin-top: 1.5rem; padding-top: 0; }
.typing-test-score {
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) minmax(15rem, 1.4fr);
  align-items: center;
  gap: 0.25rem 1rem;
  padding: 0.6rem 1rem;
  text-align: left;
}
.typing-test-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0; }
.typing-test-stats div { display: flex; align-items: baseline; gap: 0.45rem; padding: 0.25rem 0.65rem; border-left: 2px solid var(--erased); }
.typing-test-stats dt { color: var(--ink-soft); font-size: 0.9rem; }
.typing-test-stats dd {
  margin: 0.1rem 0 0;
  font-family: var(--font-marker);
  font-variation-settings: var(--marker-axes);
  font-size: 1.55rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.typing-test-score .status-line { min-height: 0; margin: 0; }
#typing-test-title .step-tag { background: var(--marker); color: var(--shadow-ink); border-color: var(--marker-ink); }

/* ---- Landing page ---- */
.screen-landing {
  --paper: #2c2e31;
  --card: #343639;
  --ink: #f5eff1;
  --ink-soft: #c5b9be;
  --pencil: #a99ba1;
  --erased: #484348;
  --marker: #ff6b6b;
  --marker-ink: #ff6b6b;
  --marker-fill: #ba607b;
  --pen: #ff6b6b;
  --pen-ink: #ff6b6b;
  --postit: #49363f;
  --postit-ink: #f5eff1;
  --highlighter: #795064;
  --tape: rgba(255, 107, 107, 0.3);
  --ok: #ff6b6b;
  --ok-bg: #3d3439;
  --bad-bg: #49363f;
  --warn-bg: #453c3d;
  --info-bg: #38343a;
  --rule-line: #484348;
  --shadow-ink: #17181a;
  min-height: 100vh;
  padding-top: 0;
  color: var(--ink);
}
body:has(#screen-landing:not([hidden])) { background-color: #2c2e31; }
body:has(#screen-landing:not([hidden])) main { max-width: 100%; padding: 0 var(--landing-content-pad) 4rem; }
.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: clamp(3rem, 7vw, 6.5rem);
  align-items: center;
  min-height: min(680px, calc(100vh - 8rem));
  padding: 0 0 clamp(5rem, 9vw, 8rem);
}
.eyebrow, .section-kicker {
  color: var(--marker-ink);
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.eyebrow span { display: inline-block; margin-right: 0.45rem; transform: rotate(-8deg); }
.hero-copy h1 {
  max-width: 760px;
  margin: 0.65rem 0 1.25rem;
  font-size: clamp(3.25rem, 7vw, 6.5rem);
  letter-spacing: -0.055em;
  line-height: 0.9;
}
.hero-copy h1 span {
  color: var(--pen-ink);
}
.hero-lede { max-width: 620px; margin: 0; color: var(--ink-soft); font-size: clamp(1.15rem, 2vw, 1.35rem); line-height: 1.55; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.35rem; margin-top: 2rem; }
button.hero-primary { padding: 0.75rem 1.45rem 0.85rem; background: var(--marker-fill); color: #fff; }
.hero-link { display: inline-block; padding: 0.75rem 1.45rem 0.85rem; border: 3px solid var(--ink); border-radius: var(--wobbly); background: var(--card); color: var(--ink); box-shadow: var(--shadow); font-family: var(--font-marker); font-weight: 700; font-size: 1.15rem; text-decoration: none; transition: transform 100ms ease, box-shadow 100ms ease, background-color 100ms ease, color 100ms ease; }
.hero-link:hover { border-color: var(--marker); }
.text-button {
  padding: 0.35rem 0.2rem;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-weight: 650;
}
.text-button:hover:not(:disabled) { border-color: var(--marker); }
.trust-list { display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; margin: 1.6rem 0 0; padding: 0; list-style: none; color: var(--ink-soft); font-size: 0.92rem; }
.trust-list li::before { content: "✓"; margin-right: 0.45rem; color: var(--ok); font-weight: 800; }

.lesson-preview {
  position: relative;
  width: min(100%, 560px);
  justify-self: end;
  padding: 1.4rem;
  background: var(--card);
  border: 2.5px solid var(--marker);
  border-radius: 18px 10px 26px 12px / 12px 24px 10px 20px;
  box-shadow: 12px 12px 0 var(--shadow-ink);
  transform: rotate(1.2deg);
}
.lesson-preview::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1.2rem -1.3rem -1.3rem 1.3rem;
  background: var(--postit);
  border: 2px solid var(--marker);
  transform: rotate(-3deg);
}
.preview-tape { position: absolute; top: -1.2rem; left: 50%; width: 7rem; height: 2rem; background: var(--tape); transform: translateX(-50%) rotate(-2deg); }
.preview-topbar { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.75rem; border-bottom: 2px dashed var(--erased); color: var(--ink-soft); font-size: 0.86rem; }
.preview-label { font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.preview-camera span { display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.3rem; border-radius: 50%; background: var(--ok); }
.preview-stats { display: flex; gap: 1.8rem; margin: 1.1rem 0; }
.preview-stats div { display: flex; flex-direction: column-reverse; }
.preview-stats dt { color: var(--ink-soft); font-size: 0.82rem; }
.preview-stats dd { margin: 0; color: var(--pen-ink); font-family: var(--font-marker); font-size: 2rem; font-weight: 750; line-height: 1; }
.preview-paper {
  min-height: 145px;
  padding: 1.25rem 1.1rem;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(transparent 0 2.75rem, var(--rule-line) 2.75rem calc(2.75rem + 1px));
  border-left: 2px solid var(--marker);
  font: 1.28rem/2.18 var(--font-type);
}
.preview-paper p { margin: 0; }
.typed-good { color: var(--ink); }
.typed-next { color: var(--pencil); }
.preview-caret { display: inline-block; width: 2px; height: 1.25em; margin: 0 0.08em; background: var(--pen); vertical-align: -0.22em; }
.preview-next { margin: 0.75rem 0 0.65rem; color: var(--pen-ink); font-weight: 650; }
.home-row-demo { display: flex; gap: 0.35rem; }
.home-row-demo span:not(.key-gap) { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border: 2px solid var(--ink); border-radius: 5px; box-shadow: 0 3px 0 var(--ink); font: 0.92rem var(--font-type); }
.home-row-demo .active-key { background: var(--highlighter); color: var(--postit-ink); transform: translateY(3px); box-shadow: none; }
.home-row-demo .key-gap { flex: 1; }
.preview-feedback { margin: 1rem 0 0; padding: 0.55rem 0.75rem; background: var(--ok-bg); color: var(--ok); border-radius: var(--wobbly-sm); font-weight: 700; }

.landing-note { position: relative; width: calc(100% + 2 * var(--landing-content-pad)); max-width: none; margin: 0 calc(-1 * var(--landing-content-pad)); padding: clamp(3.5rem, 6vw, 5.5rem) var(--landing-content-pad); background-color: #45474b; border-block: 1px solid rgba(235, 230, 219, 0.18); text-align: center; scroll-margin-top: 5rem; }
.landing-note p { max-width: 1320px; margin: 0 auto; font-family: var(--font-marker); font-size: clamp(1.9rem, 5.2vw, 4.1rem); font-weight: 650; line-height: 1.2; }
.note-mark { position: absolute; left: var(--landing-content-pad); top: -1.7rem; color: var(--marker); font: 6rem/1 var(--font-marker); transform: rotate(-8deg); }
.landing-section { padding: 0 0 clamp(6rem, 11vw, 10rem); scroll-margin-top: 5rem; }
.section-heading { max-width: 700px; margin-bottom: 3rem; }
.section-heading.compact { margin-bottom: 2rem; }
.section-heading h2, .privacy-card h2, .landing-final h2 { margin: 0.25rem 0 0.75rem; font-size: clamp(2.35rem, 5vw, 4.4rem); letter-spacing: -0.035em; }
.section-heading > p:last-child { color: var(--ink-soft); font-size: 1.15rem; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin: 0; padding: 0; list-style: none; counter-reset: none; }
.how-grid li { position: relative; min-height: 300px; padding: 1.6rem; background: var(--card); border: 2px solid var(--ink); border-radius: var(--wobbly-md); box-shadow: var(--shadow); }
.how-grid li:nth-child(2) { transform: translateY(1.5rem) rotate(0.7deg); }
.how-grid li:nth-child(3) { transform: rotate(-0.7deg); }
.how-number { float: right; color: var(--pencil); font: 1rem var(--font-type); }
.how-icon { display: grid; place-items: center; width: 4.25rem; height: 4.25rem; margin-bottom: 2.25rem; background: var(--postit); color: var(--postit-ink); border: 2px solid var(--ink); border-radius: var(--wobbly-blob); font-size: 2rem; transform: rotate(-4deg); }
.how-grid h3, .lesson-path h3 { margin: 0 0 0.55rem; text-decoration: none; }
.how-grid p, .lesson-path article > p:not(.lesson-sample) { margin: 0; color: var(--ink-soft); }

.lessons-section { position: relative; }
.lesson-path { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.lesson-path article { position: relative; min-height: 265px; padding: 1.5rem; border-top: 3px solid var(--ink); border-bottom: 2px dashed var(--erased); }
.lesson-path article + article::before { content: "→"; position: absolute; left: -1.25rem; top: 50%; z-index: 2; color: var(--marker-ink); font-size: 2rem; transform: translateY(-50%) rotate(-8deg); }
.level-pill { display: inline-block; margin-bottom: 2.2rem; padding: 0.15rem 0.65rem; background: var(--postit); color: var(--postit-ink); border: 2px solid var(--ink); border-radius: var(--wobbly-sm); transform: rotate(-2deg); }
.lesson-sample { position: absolute; left: 1.5rem; right: 1.5rem; bottom: 1.25rem; margin: 0; color: var(--pen-ink); font: 1.05rem var(--font-type); }

.privacy-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1.3fr) minmax(250px, 0.7fr);
  gap: 2rem;
  align-items: center;
  margin-bottom: clamp(6rem, 11vw, 10rem);
  padding: clamp(1.75rem, 5vw, 3.5rem);
  background: var(--info-bg);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-md);
  box-shadow: var(--shadow-lg);
  scroll-margin-top: 2rem;
}
.privacy-icon { display: grid; place-items: center; width: 5.5rem; height: 5.5rem; background: var(--card); border: 2px solid var(--ink); border-radius: 50%; color: var(--pen-ink); font-size: 2.4rem; }
.privacy-card h2 { font-size: clamp(2.1rem, 4vw, 3.5rem); }
.privacy-card p { margin: 0; }
.privacy-card ul { margin: 0; padding: 0; list-style: none; }
.privacy-card li { margin: 0.65rem 0; }
.privacy-card li::before { content: "✓"; margin-right: 0.55rem; color: var(--ok); font-weight: 800; }
.landing-final { width: calc(100% + 2 * var(--landing-content-pad)); margin-inline: calc(-1 * var(--landing-content-pad)); padding: clamp(4.5rem, 8vw, 7rem) var(--landing-content-pad); background-color: #45474b; border-top: 1px solid rgba(235, 230, 219, 0.18); text-align: center; }
.landing-final h2 { max-width: 850px; margin: 0.35rem auto 2rem; }
.landing-footer { display: flex; width: calc(100% + 2 * var(--landing-content-pad)); justify-content: space-between; gap: 1.5rem; margin-inline: calc(-1 * var(--landing-content-pad)); padding: 2rem var(--landing-content-pad) 0; padding-left: calc(var(--paper-margin-x) + 0.75rem); border-top: 2px solid #ff6b6b; background-color: #2c2e31; color: var(--ink-soft); font-size: 0.92rem; }
.landing-footer p { margin: 0; }
.landing-footer strong { background: none; font-weight: 800; }
.landing-footer div { display: flex; flex-wrap: wrap; gap: 1rem; }
.landing-footer a { color: inherit; }

/* One centered opening composition, followed by the longer story below. */
.landing-stage {
  --edge-shadow-depth: min(30vw, 15rem);
  --scroll-cue-bottom: 1rem;
  --scroll-cue-height: 3.3rem;
  --scroll-cue-divider-gap: 0.85rem;
  --section-highlight-start: calc(100% - var(--scroll-cue-bottom) - var(--scroll-cue-height) - var(--scroll-cue-divider-gap) - 2px);
  position: relative;
  display: flex;
  width: calc(100% + 2 * var(--landing-content-pad));
  margin-inline: calc(0px - var(--landing-content-pad));
  min-height: calc(100svh - 4rem);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.7rem, 2.3vh, 1.4rem);
  overflow: hidden;
  padding: 1.5rem 1rem 4.5rem;
  background: linear-gradient(to bottom, transparent var(--section-highlight-start), #45474b var(--section-highlight-start));
  text-align: center;
  scroll-margin-top: 0;
}
.hero-heading-group {
  position: absolute;
  z-index: 3;
  top: 47%;
  left: 50%;
  display: flex;
  width: min(56rem, calc(100% - 2rem));
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  transform: translate(-50%, -50%);
  transition: top 750ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero-heading-group .landing-copy { width: 100%; align-items: center; text-align: center; }
.hero-heading-group .scene-actions { margin-top: 0; opacity: 0; visibility: hidden; transform: translateY(5px); pointer-events: none; transition: opacity 400ms ease 650ms, transform 400ms ease 650ms, visibility 0s linear 1050ms; }
.landing-stage.is-resetting .scene-actions { transition: none !important; }
.landing-stage.real-arriving .hero-heading-group .scene-actions { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition: opacity 400ms ease 650ms, transform 400ms ease 650ms, visibility 0s linear 650ms; }
.landing-story-section { display: grid; min-height: calc(100svh - 4rem); place-items: center; padding: clamp(3rem, 7vh, 6rem) 0; }
.landing-story-section#how-it-works { width: calc(100% + 2 * var(--landing-content-pad)); min-height: 0; margin-inline: calc(-1 * var(--landing-content-pad)); padding: clamp(2.75rem, 6vh, 4.5rem) var(--landing-content-pad) clamp(3.5rem, 8vh, 6rem); place-items: stretch; background-color: #45474b; }
.typing-story-box { display: flex; width: 100%; min-height: inherit; flex-direction: column; justify-content: flex-start; margin: 0 auto; padding: clamp(1rem, 4vw, 3rem) 0; }
.typing-story-box--intro { padding-top: clamp(1rem, 4vh, 2.5rem); }
.landing-story-section#how-it-works .typing-story-box--intro { min-height: 0; padding: 0; }
.speed-story-layout { --story-margin-clearance: max(0px, calc(var(--paper-margin-x) - var(--landing-content-pad) + 1rem)); position: relative; display: grid; width: calc(100% - var(--story-margin-clearance)); min-height: 16rem; margin-left: var(--story-margin-clearance); grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; align-items: stretch; gap: clamp(1.5rem, 4vw, 4rem); }
.speed-story-context { grid-column: 2; grid-row: 1; justify-self: stretch; align-self: stretch; width: 100%; min-width: 0; padding: clamp(1.2rem, 2.5vw, 2rem); overflow: visible; border: 1.5px solid var(--marker); border-radius: 0.5rem; background: rgba(38, 39, 42, 0.32); }
.speed-story-context p { margin: 0; color: rgba(245, 239, 241, 0.96); font-family: var(--font-hand); font-variation-settings: var(--hand-axes); font-size: clamp(1.12rem, 1.55vw, 1.45rem); line-height: 1.55; }
.speed-story-rows { container-type: inline-size; display: flex; grid-column: 1; grid-row: 1; width: 100%; min-width: 0; flex-direction: column; gap: clamp(0.45rem, 1.2vh, 0.85rem); justify-self: stretch; margin: 0; padding: clamp(0.75rem, 1.5vw, 1.25rem); border: 1.5px solid var(--marker); border-radius: 0.65rem; background: rgba(38, 39, 42, 0.32); }
.speed-story-row--fast { --runner-color: #ff8585; }
.speed-story-row--average { --runner-color: #a9d8ff; }
.speed-story-row--hunt { --runner-color: #ffd27d; }
.speed-story-copy { width: 100%; min-height: 2.9em; margin-inline: auto; color: var(--runner-color); font-family: "Times New Roman", Times, serif; font-size: clamp(1.35rem, 3.3cqi, 1.75rem); line-height: 1.45; text-align: left; white-space: normal; }
.speed-story-wpm { display: inline-block; margin-left: 0.8em; padding: 0.1em 0.5em; border: 1px solid currentColor; border-radius: 999px; font-size: 0.62em; font-weight: 700; letter-spacing: 0.035em; line-height: 1.2; vertical-align: 0.15em; opacity: 0; visibility: hidden; transform: translateX(-0.3em); transition: opacity 220ms ease, transform 220ms ease, visibility 0s linear 220ms; }
.speed-story-wpm.is-visible { opacity: 1; visibility: visible; transform: none; transition: opacity 220ms ease, transform 220ms ease, visibility 0s; }
.speed-story-mistake { border-radius: 0.12em; background: rgba(255, 133, 133, 0.2); color: #ffaaa6; }
.story-beat-heading-row { --story-title-inset: max(0px, calc(var(--paper-margin-x) - var(--landing-content-pad) + 0.75rem)); display: block; width: calc(100% - var(--story-title-inset)); margin-left: var(--story-title-inset); }
.story-beat-title { width: 100%; max-width: 100%; margin: 0; color: var(--ink); font-family: "Times New Roman", Times, serif; font-size: clamp(2rem, 3.5vw, 3.4rem); font-weight: 400; line-height: 1.16; text-align: left; }
.story-beat-title strong { background: none; color: inherit; font-weight: 700; }
.story-inline-wordmark { display: inline-block; white-space: nowrap; font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-size: 0.86em; font-weight: 800; line-height: 1; vertical-align: -0.02em; }
.story-process-cards { --story-process-inset: max(0px, calc(var(--paper-margin-x) - var(--landing-content-pad) + 0.75rem)); display: grid; width: calc(100% - var(--story-process-inset)); grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(0.85rem, 2vw, 1.5rem); margin-top: clamp(2.25rem, 5vh, 3.5rem); margin-left: var(--story-process-inset); }
.story-process-card { position: relative; display: grid; min-width: 0; min-height: 12rem; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; align-items: start; gap: 1rem 0.75rem; padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid #df656d; border-radius: 0.2rem; background: #ff898d; box-shadow: 5px 6px 0 rgba(23, 24, 26, 0.55); color: #292b2f; }
.story-process-card::before { position: absolute; top: -0.55rem; left: 50%; width: 4.5rem; height: 1.15rem; transform: translateX(-50%) rotate(-2deg); border-inline: 1px dashed rgba(75, 58, 55, 0.18); background: rgba(255, 224, 203, 0.62); content: ""; }
.story-process-card:nth-child(2) { transform: translateY(0.6rem) rotate(0.65deg); }
.story-process-card:nth-child(3) { transform: rotate(-0.45deg); }
.story-process-number { color: #713940; font-family: "Times New Roman", Times, serif; font-size: clamp(1.15rem, 1.7vw, 1.45rem); }
.story-process-icon { width: clamp(2rem, 3vw, 2.5rem); height: clamp(2rem, 3vw, 2.5rem); fill: none; stroke: #713940; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.story-process-card p { grid-column: 1 / -1; align-self: end; margin: 0; color: #292b2f; font-family: var(--font-hand); font-variation-settings: var(--hand-axes); font-size: clamp(1.05rem, 1.45vw, 1.3rem); line-height: 1.45; }
.hero-info-kicker { margin: 0 0 0.4rem; color: #ff8585; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.16em; text-align: center; }
.hero-info-title { position: relative; isolation: isolate; margin: 0 0 0.65rem; color: var(--ink); font-family: "Times New Roman", Times, serif; font-size: clamp(1.4rem, 2.35vw, 2rem); font-weight: 400; line-height: 1.05; text-align: center; text-decoration: none; }
.hero-story-line { display: flex; width: 100%; min-width: 0; min-height: 0; flex-direction: column; align-items: center; justify-content: center; gap: clamp(1.25rem, 4vh, 2.5rem); margin: 0 auto; padding: clamp(1.25rem, 4vw, 3rem) 0; border: 0; border-radius: 0; background: transparent; color: rgba(245, 239, 241, 0.96); font-size: clamp(1.5rem, 3.1vw, 2.6rem); line-height: 1.42; text-align: center; }
.hero-story-heading { display: flex; align-items: center; justify-content: center; gap: 0.65rem; }
.hero-story-number { color: #ff8585; font-size: 1rem; font-weight: 800; letter-spacing: 0.08em; }
.hero-story-icon { width: clamp(1.75rem, 3vw, 2.5rem); height: clamp(1.75rem, 3vw, 2.5rem); fill: none; stroke: #ff8585; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.hero-story-copy { position: relative; isolation: isolate; width: 100%; min-width: 0; margin: 0; }
#how-it-works-2 .hero-story-reserve { display: block; visibility: hidden; }
#how-it-works-2 .hero-story-live { position: absolute; inset: 0; display: block; }
.hero-info-title::before, .hero-story-copy::before { position: absolute; z-index: -1; inset: 0; color: currentColor; content: attr(data-ghost); opacity: 0.22; pointer-events: none; }
.hero-story-line--cta { align-items: center; }
.hero-narrative-try { flex: 0 0 auto; margin-top: 0.5rem; padding: 0.55rem 1rem; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 250ms ease, transform 250ms ease, visibility 0s linear 250ms; }
.hero-narrative-try.is-ready { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 250ms ease, transform 250ms ease, visibility 0s; }
.hero-narrative-try:hover:not(:disabled) { border-color: var(--marker); }
.hero-narrative-try:hover .hero-button-question { opacity: 1; }
.hero-info-caret { display: none; width: 0.055em; height: 0.9em; margin-left: 0.08em; background: currentColor; vertical-align: -0.08em; }
.hero-info-caret.is-active { display: inline-block; animation: caret-blink 0.9s steps(2, start) infinite; }
.landing-story-section--left .hero-info-kicker,
.landing-story-section--left .hero-info-title { width: 50vw; margin-left: max(0px, calc(var(--paper-margin-x) - var(--landing-content-pad))); margin-right: auto; text-align: left; }
.landing-story-section--left .hero-story-line { width: 50vw; max-width: 50vw; align-self: flex-start; align-items: flex-start; margin-left: max(0px, calc(var(--paper-margin-x) - var(--landing-content-pad))); text-align: left; }
.landing-story-section--left .hero-story-heading { justify-content: flex-start; }
.landing-story-section--right .hero-info-kicker,
.landing-story-section--right .hero-info-title { width: 50vw; margin-left: auto; text-align: right; }
.landing-story-section--right .hero-story-line { width: 50vw; max-width: 50vw; align-self: flex-end; align-items: flex-end; margin-left: auto; margin-right: 0; text-align: right; }
.landing-story-section--right .hero-story-heading { justify-content: flex-end; }
#how-it-works-2 .typing-story-box { align-items: flex-start; }
#how-it-works-2 { min-height: 0; padding-block: clamp(4rem, 8vh, 6rem); }
#how-it-works-2 .typing-story-box { padding-block: 0; }
#how-it-works-2 .hero-story-line { --story-body-inset: max(0px, calc(var(--paper-margin-x) - var(--landing-content-pad) + 0.75rem)); width: calc(100% - var(--story-body-inset)); max-width: none; align-self: flex-start; align-items: flex-start; margin-top: clamp(2rem, 4vh, 3rem); margin-left: var(--story-body-inset); margin-right: 0; padding: 0; text-align: left; }
@media (max-width: 1000px) {
  .story-process-cards { gap: 0.7rem; }
  .story-process-card { min-height: 11rem; padding: 0.9rem; }
}
.hero-button-label { position: relative; }
.hero-button-question { position: absolute; top: 0; left: 100%; opacity: 0; pointer-events: none; }
.scene-actions > .hero-link:hover .hero-button-question,
.scene-actions > button.hero-primary:hover:not(:disabled) .hero-button-question { opacity: 1; }
.landing-edge-shadows {
  position: absolute;
  z-index: 2;
  inset: 0 0 calc(var(--scroll-cue-bottom) + var(--scroll-cue-height) + var(--scroll-cue-divider-gap) + 2px);
  background: linear-gradient(to right, rgba(0, 0, 0, 0.72), transparent var(--edge-shadow-depth)), linear-gradient(to left, rgba(0, 0, 0, 0.72), transparent var(--edge-shadow-depth));
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}
.landing-stage.real-arriving .landing-edge-shadows { opacity: 1; }
.landing-top-shadow {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  right: 0;
  height: clamp(7rem, 15vh, 11rem);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.46) 38%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}
.landing-stage.real-arriving .landing-top-shadow { opacity: 1; }
.landing-bottom-shadow {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: calc(var(--scroll-cue-bottom) + var(--scroll-cue-height) + var(--scroll-cue-divider-gap) + 2px);
  height: clamp(7rem, 15vh, 11rem);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.42) 38%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 700ms ease;
}
.landing-stage.real-arriving .landing-bottom-shadow { opacity: 1; }
.hero-card-carousel {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: calc(var(--scroll-cue-bottom) + var(--scroll-cue-height) + var(--scroll-cue-divider-gap) + 2px);
  left: calc(var(--paper-margin-x) - 7rem);
  width: min(20rem, 28vw);
  overflow: hidden;
  transform: none;
  opacity: 1;
  pointer-events: none;
}
.hero-card-carousel--right { left: auto; right: calc(var(--paper-margin-x) - 7rem); }
.hero-card-track { display: flex; flex-direction: column; gap: 0; transform: translateY(-100%); }
.hero-card-carousel--right .hero-card-track { transform: translateY(100%); }
.hero-card-set { display: flex; flex-direction: column; gap: 0.75rem; padding-bottom: 0.75rem; }
.hero-card {
  display: flex;
  min-height: clamp(8rem, 16vh, 11rem);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1.25rem 1.35rem;
  border: 2px solid var(--marker);
  border-radius: 0.45rem;
  background: #3a3c40;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.2);
  text-align: center;
}
.hero-card span { color: #ff8585; font-size: 0.88rem; font-weight: 750; letter-spacing: 0.12em; }
.hero-card strong { color: #f5eff1; background: none; font-size: clamp(1.35rem, 1.7vw, 1.7rem); font-weight: 700; line-height: 1.1; text-wrap: balance; }
.hero-card--finger { display: grid; grid-template-columns: minmax(0, 1fr) 4rem; align-items: center; gap: 0.5rem; text-align: left; }
.hero-finger-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 0.45rem; }
.hero-card--finger .hero-finger-detail { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.28rem; }
.hero-card--finger .hero-finger-name { color: #f5eff1; font-size: inherit; letter-spacing: normal; }
.hero-card-art-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.hero-finger-hand { grid-column: 2; grid-row: 1; width: 100%; height: 4.8rem; overflow: visible; }
.hero-hand-art { transform-box: fill-box; transform-origin: center; }
.hero-finger-hand[data-side="R"] .hero-hand-art { transform: scaleX(-1); }
.hero-hand-outline { fill: #45474c; stroke: none; }
.hero-finger-hand { --hand-finger-index: rgba(245, 239, 241, 0.18); --hand-finger-middle: rgba(245, 239, 241, 0.18); --hand-finger-ring: rgba(245, 239, 241, 0.18); --hand-finger-pinky: rgba(245, 239, 241, 0.18); }
.hero-finger-hand[data-side="L"][data-target="index"], .hero-finger-hand[data-side="R"][data-target="pinky"] { --hand-finger-index: #ff8585; }
.hero-finger-hand[data-side="L"][data-target="middle"], .hero-finger-hand[data-side="R"][data-target="ring"] { --hand-finger-middle: #ff8585; }
.hero-finger-hand[data-side="L"][data-target="ring"], .hero-finger-hand[data-side="R"][data-target="middle"] { --hand-finger-ring: #ff8585; }
.hero-finger-hand[data-side="L"][data-target="pinky"], .hero-finger-hand[data-side="R"][data-target="index"] { --hand-finger-pinky: #ff8585; }
.hero-hand-finger--index { fill: var(--hand-finger-index); }
.hero-hand-finger--middle { fill: var(--hand-finger-middle); }
.hero-hand-finger--ring { fill: var(--hand-finger-ring); }
.hero-hand-finger--pinky { fill: var(--hand-finger-pinky); }
.hero-hand-separators { fill: none; stroke: rgba(20, 21, 23, 0.46); stroke-linecap: round; stroke-width: 1.2; }
.hero-hand-nails { fill: none; stroke: rgba(245, 239, 241, 0.64); stroke-linecap: round; stroke-width: 1.35; }
.hero-hand-outline-top { fill: none; stroke: rgba(255, 133, 133, 0.78); stroke-linejoin: round; stroke-width: 2; }
.hero-finger-hand .hero-hand-side { fill: #fff8fa; font-family: var(--font-marker); font-size: 23px; font-weight: 800; text-anchor: middle; }
.hero-card .hero-keycap { display: inline-flex; min-width: 1.7em; min-height: 1.55em; align-items: center; justify-content: center; padding: 0.08em 0.34em; border: 2px solid rgba(245, 239, 241, 0.62); border-radius: 0.32rem; background: #292b2f; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.12); color: #fff8fa; font-family: var(--font-marker); font-size: 0.78em; font-weight: 800; line-height: 1; }
.hero-card--punctuation { align-items: stretch; gap: 0.55rem; text-align: left; }
.hero-card--punctuation .hero-punctuation-label { font-size: 0.72rem; }
.hero-card--punctuation .hero-punctuation-message { font-size: clamp(1.15rem, 1.5vw, 1.45rem); }
.hero-punctuation-keys { display: flex; align-items: center; gap: 0.4rem; }
.hero-punctuation-keys .hero-keycap { min-width: 1.6em; min-height: 1.5em; font-size: 1rem; }
.hero-card--numbers { align-items: stretch; gap: 0.48rem; text-align: left; }
.hero-card--numbers .hero-numbers-label { font-size: 0.72rem; }
.hero-card--numbers .hero-numbers-message { font-size: clamp(1.12rem, 1.45vw, 1.4rem); }
.hero-number-keys { display: flex; align-items: center; justify-content: space-between; gap: 0.16rem; }
.hero-number-keys .hero-keycap { box-sizing: border-box; min-width: 0; flex: 1; padding-inline: 0; font-size: 0.78rem; }
.hero-card--drift { align-items: stretch; gap: 0.5rem; text-align: left; }
.hero-drift-topline { display: flex; align-items: center; justify-content: space-between; }
.hero-card--drift .hero-drift-label { color: #ff8585; font-size: 0.76rem; letter-spacing: 0.1em; }
.hero-card--drift .hero-drift-symbol { color: rgba(255, 133, 133, 0.82); font-size: 1.5rem; line-height: 1; }
.hero-card--drift .hero-drift-message { font-size: clamp(1.2rem, 1.5vw, 1.55rem); line-height: 1.08; }
.hero-card--drift .hero-drift-correction { align-self: flex-end; font-size: 0.72rem; letter-spacing: 0.1em; }
.hero-card--underused, .hero-card--rest { display: grid; grid-template-columns: minmax(0, 1fr) 4rem; align-items: center; gap: 0.5rem; text-align: left; }
.hero-underused-copy, .hero-rest-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 0.38rem; }
.hero-card--underused .hero-finger-hand, .hero-card--rest .hero-finger-hand { grid-column: 2; grid-row: 1; }
.hero-card--underused { gap: 0.45rem; }
.hero-card--underused .hero-underused-label { font-size: 0.74rem; }
.hero-card--underused .hero-underused-name { font-size: clamp(1.7rem, 2vw, 2.2rem); }
.hero-card--underused .hero-underused-message { color: rgba(245, 239, 241, 0.82); font-size: 0.9rem; font-weight: 600; letter-spacing: normal; }
.hero-card--rest { gap: 0.38rem; }
.hero-card--rest .hero-rest-label { font-size: 0.72rem; }
.hero-card--rest .hero-rest-finger { font-size: clamp(1.4rem, 1.8vw, 1.8rem); }
.hero-card--rest .hero-rest-status { color: rgba(245, 239, 241, 0.82); font-size: 0.82rem; letter-spacing: normal; }
.hero-rest-target { display: flex; align-items: center; justify-content: flex-start; gap: 0.45rem; color: #ff8585; font-size: 0.7rem; letter-spacing: 0.12em; }
.hero-card--record { display: grid; grid-template-columns: minmax(0, 1fr) 6.25rem; align-items: center; gap: 0.3rem 0.8rem; text-align: left; }
.hero-record-copy { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 0.28rem; }
.hero-card--record .hero-record-label { text-transform: uppercase; }
.hero-card--record .hero-record-score { display: flex; align-items: baseline; justify-content: flex-start; gap: 0.45rem; white-space: nowrap; }
.hero-card--record .hero-record-number { color: #f5eff1; font-family: "Times New Roman", Times, serif; font-size: 3rem; font-weight: 700; letter-spacing: -0.055em; line-height: 0.9; }
.hero-card--record .hero-record-unit { color: #ff8585; font-size: 0.84rem; letter-spacing: 0.12em; }
.hero-card--record .hero-record-duration { color: rgba(245, 239, 241, 0.78); font-size: 0.86rem; font-weight: 600; letter-spacing: 0.02em; }
.hero-record-graph { grid-column: 2; grid-row: 1; width: 100%; height: 5.5rem; overflow: visible; }
.hero-record-graph-axis { fill: none; stroke: rgba(255, 133, 133, 0.24); stroke-width: 1.5; }
.hero-record-graph-line { fill: none; stroke: #ff8585; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.hero-record-graph-dot { fill: #ff8585; stroke: #3a3c40; stroke-width: 2; }
.landing-stage::before, .landing-stage::after { content: ""; position: absolute; z-index: 0; pointer-events: none; border-radius: 50%; }
.landing-stage::before { width: min(24vw, 210px); aspect-ratio: 1; top: 8%; left: calc(var(--paper-margin-x) - var(--landing-content-pad) + 1rem); background: #373438; }
.landing-stage::after { width: min(24vw, 260px); aspect-ratio: 1; right: -10%; bottom: 4%; background: #363338; }
.landing-stage > .hero-heading-group, .landing-stage > .scroll-cue { z-index: 3; }
.landing-copy { display: flex; width: min(100%, 56rem); flex-direction: column; align-items: flex-start; gap: clamp(0.7rem, 2.3vh, 1.4rem); text-align: left; }
.landing-wordmark {
  width: 100%;
  margin: 0;
  color: #fff8fa;
  font-family: var(--font-marker);
  font-size: clamp(4rem, 8vw, 7.5rem);
  font-weight: 800;
  letter-spacing: -0.09em;
  line-height: 0.85;
  text-align: center;
}
.landing-wordmark .logo-circled { color: #ff6b6b; padding: 0 0.2em; margin: 0 0.15em; }
.landing-wordmark .logo-circled::after { border-width: 2.5px; }
.scroll-cue {
  display: flex;
  position: absolute;
  z-index: 2;
  bottom: var(--scroll-cue-bottom);
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: #ff6b6b;
  font-size: 0.9rem;
  text-decoration: none;
}
.scroll-cue::before {
  position: absolute;
  bottom: calc(100% + 0.85rem);
  left: 50%;
  width: 100vw;
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(to right, transparent, rgba(255, 107, 107, 0.42) 18%, rgba(255, 107, 107, 0.58) 50%, rgba(255, 107, 107, 0.42) 82%, transparent);
  content: "";
  pointer-events: none;
  box-shadow: 0 0 0 transparent;
  transition: box-shadow 700ms ease;
}
 .landing-stage.real-arriving .scroll-cue::before { box-shadow: 0 -8px 18px -3px rgba(0, 0, 0, 0.72); }
.scroll-cue span:last-child { color: #ff6b6b; font-size: 1.65rem; line-height: 1; }
.scroll-cue:hover { color: #ff6b6b; }
.scene-overline { margin: 0 0 1.4rem; color: #ff6b6b; font-size: 0.9rem; font-weight: 750; letter-spacing: 0.14em; text-transform: uppercase; }
.typing-headline { width: 100%; margin: 0; color: #fff8fa; font-family: "Times New Roman", Times, serif; font-size: clamp(1.8rem, 4vw, 4rem); font-weight: 400; letter-spacing: -0.045em; line-height: 1; text-align: center; }
.typing-line { position: relative; isolation: isolate; display: block; width: max-content; max-width: 100%; margin-inline: auto; text-align: left; white-space: pre; }
.typing-line::after { position: absolute; top: calc(100% - 1px); left: 50%; width: 100vw; height: 1px; transform: translateX(-50%); background: linear-gradient(to right, transparent 0, rgba(255, 107, 107, 0.04) 22%, rgba(255, 107, 107, 0.2) 34%, rgba(255, 107, 107, 0.2) 66%, rgba(255, 107, 107, 0.04) 78%, transparent 100%); content: ""; pointer-events: none; }
.typing-reserve { color: rgba(255, 248, 250, 0.24); }
.typing-animation { position: absolute; top: 0; left: 0; white-space: pre; }
.typing-error { border-radius: 0.08em; background: rgba(255, 107, 107, 0.2); color: #ff8989; box-shadow: inset 0 -0.045em rgba(255, 107, 107, 0.35); }
.typing-caret { display: inline-block; width: 0.055em; height: 0.86em; margin-left: 0.04em; background: #ff6b6b; vertical-align: -0.04em; animation: caret-blink 0.9s steps(2, start) infinite; }
@keyframes caret-blink { to { visibility: hidden; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.scene-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.7rem 1rem; margin-top: 0.85rem; }
.scene-actions > .hero-link, .scene-actions > button.hero-primary { padding: 0.38rem 0.8rem 0.42rem; font-size: 0.85rem; }
.scene-actions > .hero-link, .scene-actions > button.hero-primary { transition: none; }
.scene-actions > button.hero-primary.hero-link { background: var(--card); color: var(--ink); }
.scene-actions > .hero-link:hover,
.scene-actions > button.hero-primary:hover:not(:disabled) { border-color: var(--marker); }
.landing-stage .scroll-cue { bottom: var(--scroll-cue-bottom); }

/* "step 1" written on a scrap of sticky note before each heading. */
.step-tag {
  display: inline-block;
  margin-right: 0.35em;
  padding: 0.05em 0.5em 0.1em;
  background: var(--postit);
  color: var(--postit-ink);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-sm);
  font-family: var(--font-hand);
  font-variation-settings: var(--hand-axes);
  font-weight: 400;
  font-size: 0.5em;
  vertical-align: 0.45em;
  transform: rotate(-3deg);
}
#screen-setup .step-tag { background: var(--marker); color: var(--shadow-ink); border-color: var(--marker-ink); }
#screen-setup strong { background: none; font-weight: 700; }
#screen-setup,
#screen-calibrate { padding-top: clamp(2.25rem, 4vh, 3.25rem); }
body:has(#screen-setup:not([hidden])) { display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow-y: hidden; background-color: color-mix(in srgb, var(--paper) 95%, var(--marker) 5%); }
body:has(#screen-setup:not([hidden])) .paper-margin-foreground { z-index: -1; }
body:has(#screen-setup:not([hidden])) .app-header { flex: 0 0 auto; width: 100%; }
body:has(#screen-setup:not([hidden])) main { flex: 1 1 auto; min-height: 0; width: 100%; padding-top: 0.35rem; padding-bottom: 0.5rem; }
#screen-setup { display: flex; flex-direction: column; height: 100%; min-height: 0; padding-top: 0.35rem; }
#screen-setup .camera-flow-progress-group { flex: 0 0 auto; margin-bottom: 0.45rem; }
#screen-setup h2 { flex: 0 0 auto; margin: 0 0 0.45rem; font-size: clamp(1.5rem, 2.6vw, 2rem); }
.camera-flow-progress-group { margin: 0 0 clamp(1.4rem, 2.8vh, 2rem); }
.camera-flow-progress-label { display: block; margin-bottom: 0.45rem; color: var(--marker-ink); font-size: 0.92rem; font-weight: 650; }
.camera-flow-progress {
  position: relative;
  height: 0.7rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--erased) 78%, var(--card));
  box-shadow: var(--shadow-soft);
}
.camera-flow-progress-fill { position: relative; z-index: 1; display: block; width: 0; height: 100%; border-radius: inherit; background: var(--marker); transition: width 300ms ease; }
.camera-flow-progress-ticks { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.camera-flow-progress-tick { position: absolute; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); background: color-mix(in srgb, var(--ink) 55%, transparent); }
#screen-setup .two-column {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "controls" "stage";
  align-items: start;
  gap: 0.6rem;
}
#screen-setup .setup-stage-column {
  grid-area: stage;
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
#screen-setup .stage-slot {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.4rem 0.4rem 0.65rem;
}
#screen-setup .stage-slot::before,
#screen-setup .stage-slot::after { content: none; }
#screen-setup .stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}
#screen-setup .stage video,
#screen-setup .stage canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stage.is-rotated > video {
  transform: rotate(180deg);
}
.stage.flipped > video { transform: scale(-1, -1); }
.stage.is-rotated.flipped > video { transform: none; }
.setup-rotate-trigger {
  margin: 0.25rem 0 0.3rem;
  padding: 0.3rem 0.65rem;
  border-color: #ff6b6b;
  color: var(--ink);
  font-size: 0.9rem;
  box-shadow: none;
}
.setup-rotate-trigger:hover:not(:disabled),
.setup-rotate-trigger[aria-pressed="true"] {
  border-color: #ff6b6b;
  background: transparent;
  color: var(--ink);
}

/* Home-row and keyboard calibration keep the live camera large, with compact
   instructions and controls in a strip above it. */
body:has(#screen-calibrate:not([hidden])) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  overflow-y: hidden;
}
body:has(#screen-calibrate:not([hidden])) .app-header { flex: 0 0 auto; width: 100%; }
body:has(#screen-calibrate:not([hidden])) main {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0.35rem 1rem 0.5rem;
}
#screen-calibrate {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding-top: 0.35rem;
}
#screen-calibrate .camera-flow-progress-group { flex: 0 0 auto; margin: 0 0 0.45rem; }
#screen-calibrate h2 { flex: 0 0 auto; margin: 0 0 0.45rem; font-size: clamp(1.45rem, 2.4vw, 1.9rem); }
#screen-calibrate .two-column {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "controls" "camera";
  gap: 0.5rem;
}
#calibrate-stage-slot {
  grid-area: camera;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0.4rem 0.4rem 0.65rem;
}
#calibrate-stage-slot .stage { width: 100%; height: 100%; min-height: 0; }
#screen-calibrate .stage video,
#screen-calibrate .stage canvas { width: 100%; height: 100%; object-fit: contain; }
#calibrate-home-step,
#calibrate-grid-step { grid-area: controls; margin: 0; padding: 0.55rem 0.85rem; }
#calibrate-home-step {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  grid-template-areas: "instructions instructions instructions" "progress progress actions" "countdown status actions";
  align-items: center;
  gap: 0.1rem 1rem;
}
#calibrate-home-step .instructions {
  grid-area: instructions;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.15rem;
  margin: 0 0 0.25rem;
}
#calibrate-home-step .instructions li { margin: 0; }
#calibrate-countdown { grid-area: countdown; min-height: 0; margin: 0; font-size: 2rem; line-height: 1; }
#screen-calibrate #calibrate-progress { grid-area: progress; width: 100%; margin: 0.15rem 0; accent-color: var(--marker); }
#calibrate-status { grid-area: status; margin: 0; }
#calibrate-home-step .button-row { grid-area: actions; display: flex; flex-wrap: nowrap; gap: 0.5rem; margin: 0; }
#calibrate-home-step .button-row button { padding-inline: 0.75rem; }
#calibrate-grid-step {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "title title title" "help help prompt" "tray steps status" "actions actions actions";
  align-items: center;
  gap: 0.2rem 1rem;
}
#grid-title { grid-area: title; margin: 0; }
#calibrate-grid-step > p:not(.grid-prompt):not(.status-line) { grid-area: help; margin: 0; }
#grid-disc-tray { grid-area: tray; display: flex; align-items: center; gap: 0.55rem; }
#grid-disc-tray .grid-map-disc { position: relative; }
#grid-prompt { grid-area: prompt; min-height: 0; margin: 0; }
#grid-steps { grid-area: steps; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 0.5rem; margin: 0.15rem 0; }
#grid-status { grid-area: status; margin: 0; }
#grid-capture-buttons,
#grid-review-buttons { grid-area: actions; justify-content: flex-end; gap: 0.5rem; margin: 0.15rem 0 0; }
#screen-setup .setup-controls-panel {
  grid-area: controls;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(12rem, 0.75fr) minmax(0, 2fr) minmax(13rem, 0.95fr);
  grid-template-areas:
    "error error error"
    "notice notice notice"
    "camera wizard actions";
  align-items: center;
  gap: 0.2rem 0.65rem;
  height: auto;
  min-height: 0;
  max-height: none;
  align-self: start;
  overflow: visible;
  padding: 0.45rem 0.65rem;
}
#screen-setup .setup-controls-panel.is-past-camera {
  grid-template-columns: minmax(0, 2fr) minmax(13rem, 0.95fr);
  grid-template-areas:
    "error error"
    "notice notice"
    "wizard actions";
}
.setup-controls-panel > .message { width: 100%; margin: 0; }
.setup-controls-panel > .message-error { grid-area: error; }
.setup-controls-panel > .message-info { grid-area: notice; }
.setup-control-group { min-width: 0; }
.setup-camera-group { position: relative; grid-area: camera; width: 100%; }
.setup-camera-group.is-required { outline: 2px solid var(--marker); outline-offset: 3px; border-radius: 0.35rem; }
.setup-camera-group .field-label { margin: 0 0 0.15rem; padding-right: 2rem; font-size: 1rem; }
.setup-camera-group .picker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem; }
.setup-camera-group .picker-row select { min-width: 0; width: 100%; }
.setup-camera-group .picker-row button { padding: 0.3rem 0.55rem; font-size: 0.82rem; box-shadow: none; }
.setup-controls-panel .hint { margin: 0.3rem 0 0; line-height: 1.3; font-size: 0.9rem; }
.setup-wizard {
  grid-area: wizard;
  width: 100%;
  min-width: 0;
  padding-left: 0.65rem;
  border-left: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent);
}
.setup-wizard-progress { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.25rem 0.5rem; margin-bottom: 0.2rem; }
#setup-step-count { color: var(--marker-ink); font-weight: 700; white-space: nowrap; }
.setup-step-dots { display: none; }
.setup-step-dots li { padding: 0.2rem 0.55rem; border: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent); border-radius: 999px; color: var(--ink-soft); font-size: 0.85rem; }
.setup-step-dots li[aria-current="step"] { border-color: var(--marker); background: color-mix(in srgb, var(--marker) 17%, var(--card)); color: var(--ink); font-weight: 700; }
.setup-step-dots li.is-complete { border-color: var(--ok); color: var(--ok); }
.setup-wizard-step { min-height: 0; }
.setup-wizard-step.is-entering { animation: setup-step-enter 240ms cubic-bezier(0.2, 0.75, 0.25, 1) both; }
@keyframes setup-step-enter {
  from { opacity: 0; transform: translateY(0.45rem); }
  to { opacity: 1; transform: translateY(0); }
}
.setup-wizard-step h3 { margin: 0 0 0.15rem; font-size: clamp(1.05rem, 1.5vw, 1.3rem); }
.setup-wizard-step p { margin: 0.1rem 0 0.2rem; color: var(--ink-soft); line-height: 1.25; font-size: 0.9rem; }
.setup-platform-copy { margin-top: 0.35rem !important; }
.setup-info-trigger.setup-info-inline-trigger {
  position: static;
  display: inline;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--marker-ink);
  box-shadow: none;
  font: inherit;
  line-height: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.setup-info-trigger.setup-info-inline-trigger:hover:not(:disabled),
.setup-info-trigger.setup-info-inline-trigger[aria-expanded="true"] { border: 0; background: transparent; color: var(--marker-ink); }
.setup-wizard-step .field-group { margin: 0.25rem 0 0; padding: 0.25rem 0.6rem; }
.setup-wizard-step .field-group.is-required { border-color: var(--marker); box-shadow: 0 0 0 2px color-mix(in srgb, var(--marker) 22%, transparent); }
.setup-facing-group { position: relative; padding-right: 2.2rem; }
#screen-setup .setup-angle-choice {
  border: 3px solid #ff6b6b;
  border-radius: 0.55rem;
  background: color-mix(in srgb, #ff6b6b 7%, var(--card));
  box-shadow: 0 0 0 2px color-mix(in srgb, #ff6b6b 25%, transparent);
}
#screen-setup .setup-angle-choice input { accent-color: #ff6b6b; }
.setup-facing-group .setup-info-trigger { top: 0.55rem; right: 0.25rem; }
.setup-confirmation { display: inline-flex !important; align-items: center; gap: 0.5rem; margin: 0.65rem 0 0.25rem !important; padding: 0.5rem 0.75rem; border: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent); border-radius: 6px; background: color-mix(in srgb, var(--card) 88%, var(--paper) 12%); }
.setup-wizard-step .setup-confirmation { margin: 0.2rem 0 !important; padding: 0.25rem 0.5rem; font-size: 0.9rem; }
.setup-wizard-step .setup-confirmation.is-required { border-color: var(--marker); background: color-mix(in srgb, var(--marker) 8%, var(--card)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--marker) 22%, transparent); }
.setup-confirmation input { flex: 0 0 auto; }
.setup-live-status {
  position: absolute;
  z-index: 4;
  right: 0.9rem;
  bottom: 0.9rem;
  left: 0.9rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--marker);
  border-radius: 0.4rem;
  background: rgba(30, 31, 33, 0.9);
  color: #f6f0e9;
  pointer-events: none;
}
.setup-live-status.is-required { box-shadow: 0 0 0 2px color-mix(in srgb, var(--marker) 35%, transparent); }
.setup-live-status .indicators {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.setup-live-status .indicators li { margin: 0; font-size: 0.82rem; }
.setup-live-status [data-on="false"] .indicator-text { color: #d0cbc2; }
.setup-live-status [data-on="true"] .indicator-text { color: #fff; }
.setup-live-status .tip,
.setup-live-status .status-line { margin: 0.1rem 0; font-size: 0.82rem; line-height: 1.2; }
.setup-live-status .tip { color: #a7c6f7; }
.setup-live-status .status-line { color: #d0cbc2; }
#screen-setup .setup-action-bar {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0.25rem;
  margin: 0;
  padding: 0 0 0 0.65rem;
  border-left: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent);
}
.setup-action-bar button { width: 100%; padding: 0.28rem 0.4rem; font-size: 0.85rem; line-height: 1.1; box-shadow: none; }
#setup-back[hidden] + #setup-continue { grid-column: 1 / -1; }
.setup-action-bar button.primary { font-size: 0.95rem; }
#setup-continue { min-height: 3rem; padding: 0.45rem 0.75rem; font-size: 1.15rem; line-height: 1.15; box-shadow: var(--shadow-sm); }
#setup-continue:not(:disabled),
#setup-continue:not(:disabled):hover {
  background: #ff6b6b;
  border-color: #ff6b6b;
  color: #2d2d2d;
}
@media (min-width: 1400px) {
  body:has(#screen-setup:not([hidden])) main { max-width: 1440px; }
  #screen-setup .setup-controls-panel { padding: 0.5rem 0.8rem; }
}

@media (max-width: 1050px) {
  #screen-setup .setup-controls-panel {
    grid-template-columns: minmax(12rem, 0.7fr) minmax(0, 1.3fr);
    grid-template-areas:
      "error error"
      "notice notice"
      "camera wizard"
      "actions actions";
  }
  #screen-setup .setup-controls-panel.is-past-camera {
    grid-template-columns: minmax(0, 1.3fr) minmax(13rem, 0.7fr);
    grid-template-areas:
      "error error"
      "notice notice"
      "wizard actions";
  }
  #screen-setup .setup-action-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; padding: 0.35rem 0 0; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent); }
  .setup-action-bar button { width: auto; flex: 1; }
}

.setup-info-trigger {
  position: absolute;
  top: 0.45rem;
  right: 0;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 2px solid var(--marker-ink);
  border-radius: 50%;
  background: var(--card);
  color: var(--marker-ink);
  box-shadow: none;
  font-family: Arial, sans-serif;
  font-size: 1.05rem;
  line-height: 1;
}
.setup-facing-group .setup-info-trigger { top: 0.15rem; right: 0.45rem; }
.setup-info-trigger:hover:not(:disabled),
.setup-info-trigger[aria-expanded="true"] {
  border-color: var(--marker);
}
.setup-info-panel {
  position: fixed;
  width: min(92vw, 38rem);
  max-width: calc(100vw - 2rem);
  max-height: min(82vh, 44rem);
  margin: auto;
  padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--ink-soft) 40%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--card) 88%, var(--paper) 12%);
  color: var(--ink);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.48);
  overflow: auto;
}
.setup-info-panel::backdrop { background: rgba(12, 13, 15, 0.68); backdrop-filter: blur(2px); }
.setup-info-panel.setup-placement-panel { width: min(92vw, 54rem); }
.setup-info-panel h3 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.setup-info-panel h3 { padding-right: 2.5rem; }
.setup-info-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink-soft) 45%, transparent);
  border-radius: 50%;
  background: var(--erased);
  color: var(--ink);
  box-shadow: none;
  font-size: 1.4rem;
  line-height: 1;
}
.setup-info-close:hover:not(:disabled) { border-color: var(--marker); }
.setup-info-panel p { margin: 0.5rem 0 0; }
.setup-info-panel ul { margin: 0; padding-left: 1.3rem; }
.setup-info-panel li + li { margin-top: 0.4rem; }
.setup-placement-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.setup-placement-options figure { margin: 0; padding: 0.7rem; border: 1px solid color-mix(in srgb, var(--ink-soft) 30%, transparent); border-radius: 6px; }
.placement-diagram { display: block; width: 100%; max-height: 11rem; color: var(--ink); }
.placement-diagram rect { fill: color-mix(in srgb, var(--card) 75%, var(--pen) 25%); stroke: currentColor; stroke-width: 2; }
.placement-diagram circle { fill: var(--marker); stroke: currentColor; stroke-width: 1.5; }
.placement-diagram path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.setup-placement-options figcaption { margin-top: 0.4rem; text-align: center; }

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 1000px) {
  .speed-story-layout { width: 100%; margin-inline: auto; grid-template-columns: minmax(0, 1fr); gap: clamp(1.5rem, 4vh, 2.5rem); }
  .speed-story-context { grid-column: 1; grid-row: 2; max-width: 64rem; margin-inline: auto; }
  .speed-story-rows { grid-column: 1; grid-row: 1; width: min(100%, 72rem); margin-inline: auto; }
  .speed-story-rows { max-width: 72rem; }
}

@media (max-width: 800px) {
  .two-column, .exercise-layout { grid-template-columns: 1fr; }
  #calibrate-home-step {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "instructions instructions" "progress actions" "countdown status";
    gap: 0.25rem 0.75rem;
  }
  #calibrate-home-step .instructions { grid-template-columns: minmax(0, 1fr); }
  #calibrate-home-step .button-row { flex-wrap: wrap; justify-content: flex-end; }
  #calibrate-grid-step {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "title title" "help help" "tray prompt" "steps status" "actions actions";
    gap: 0.25rem;
  }
  #grid-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #screen-setup .stage-slot { padding: 0.55rem 0.55rem 0.85rem; }
  #screen-setup .stage { height: 100%; min-height: 0; }
  #screen-setup .setup-controls-panel { min-width: 0; padding: 0.5rem; gap: 0.3rem; }
  .setup-action-bar { gap: 0.4rem; }
  .setup-action-bar button { padding-inline: 0.5rem; }
  .setup-wizard-progress { align-items: flex-start; }
  .setup-step-dots li { font-size: 0.75rem; padding-inline: 0.4rem; }
  .setup-placement-options { grid-template-columns: 1fr; }
  .typing-test-score { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0.35rem 0.65rem; }
  .typing-test-stats { min-width: 0; }
  .typing-test-score .status-line { grid-column: 1 / -1; }
  .landing-hero { grid-template-columns: 1fr; min-height: 0; }
  .lesson-preview { justify-self: center; }
  .how-grid, .lesson-path { grid-template-columns: 1fr; }
  .how-grid li:nth-child(2), .how-grid li:nth-child(3) { transform: none; }
  .lesson-path article + article::before { content: "↓"; left: 50%; top: -1.6rem; transform: translateX(-50%); }
  .privacy-card { grid-template-columns: auto 1fr; }
  .privacy-card ul { grid-column: 1 / -1; }
  body:has(#screen-landing:not([hidden])) main { padding-inline: 1.1rem; }
}

@media (max-width: 540px) {
  #screen-setup .stage { height: 100%; min-height: 0; }
  #screen-setup .stage-slot { padding: 0.4rem 0.4rem 0.75rem; }
  #screen-setup .setup-controls-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "error"
      "notice"
      "camera"
      "wizard"
      "actions";
    padding: 0.45rem;
  }
  #screen-setup .setup-controls-panel.is-past-camera {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "error"
      "notice"
      "wizard"
      "actions";
  }
  .setup-camera-group .picker-row { grid-template-columns: minmax(0, 1fr) auto; }
  .setup-wizard { padding: 0.45rem 0 0; border-left: 0; border-top: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent); }
  .setup-controls-panel .hint { font-size: 0.8rem; }
  .setup-step-dots li { font-size: 0.68rem; padding: 0.15rem 0.3rem; }
  .setup-wizard-progress { gap: 0.25rem; }
  .setup-live-status { right: 0.5rem; bottom: 0.5rem; left: 0.5rem; padding: 0.2rem 0.4rem; }
  .setup-live-status .indicators { gap: 0.1rem 0.45rem; }
  .setup-live-status .indicators li { gap: 0.25rem; font-size: 0.72rem; }
  .setup-live-status .indicators li:last-child { display: none; }
  .setup-live-status .indicator-icon { width: 1.2rem; height: 1.2rem; border-width: 1px; font-size: 0.8rem; }
  .setup-live-status .tip,
  .setup-live-status .status-line { font-size: 0.72rem; }
}

@media (max-height: 600px) {
  body:has(#screen-setup:not([hidden])) { height: auto; min-height: 100dvh; overflow-y: auto; }
  body:has(#screen-setup:not([hidden])) main { flex: none; }
  #screen-setup { height: auto; }
  #screen-setup .two-column { flex: none; grid-template-rows: auto auto; }
  #screen-setup .setup-stage-column,
  #screen-setup .stage-slot { height: auto; }
  #screen-setup .stage { height: min(40vh, 20rem); min-height: 11rem; }
  body:has(#screen-calibrate:not([hidden])) { height: auto; min-height: 100dvh; overflow-y: auto; }
  body:has(#screen-calibrate:not([hidden])) main { flex: none; }
  #screen-calibrate { height: auto; }
  #screen-calibrate .two-column { flex: none; grid-template-rows: auto minmax(18rem, 55vh); }
  #calibrate-stage-slot { height: min(55vh, 36rem); min-height: 18rem; }
}

@media (max-width: 540px) {
  #calibrate-home-step { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "instructions instructions" "progress actions" "countdown status"; }
  #calibrate-home-step .instructions { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  #calibrate-home-step .button-row { flex-direction: column; align-items: stretch; justify-content: center; }
  #calibrate-grid-step { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "help" "tray" "prompt" "steps" "status" "actions"; }
}

.panel {
  position: relative;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-md);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

/* ---- Messages: little notes stuck to the page ---- */
.message {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-md);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1rem 0.75rem 3rem;
  margin: 0.75rem 0;
  color: var(--ink);
}
.message::before {
  position: absolute;
  left: 0.75rem;
  top: 0.7rem;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border: 2px solid currentColor;
  border-radius: var(--wobbly-blob);
  font-family: var(--font-marker); font-variation-settings: var(--marker-axes);
  font-size: 0.95rem;
  line-height: 1;
}
.message-error { background: var(--bad-bg); }
.message-error::before { content: "!"; color: var(--marker-ink); }
.message-warning { background: var(--warn-bg); }
.message-warning::before { content: "!"; }
.message-info { background: var(--info-bg); }
.message-info::before { content: "i"; color: var(--pen-ink); }
body > .message { max-width: calc(1200px - 2.5rem); margin: 0.75rem auto; }
@media (max-width: 1240px) { body > .message { margin: 0.75rem 1.25rem; } }

/* ---- Form controls ---- */
.field-label { display: block; font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; font-size: 1.15rem; margin: 0.75rem 0 0.3rem; }
select, input[type="file"] {
  font: inherit;
  max-width: 100%;
  padding: 0.35rem 0.75rem;
  background-color: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-sm);
}
select {
  appearance: none;
  padding-right: 2.4rem;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 1rem auto;
  cursor: pointer;
}
select:focus-visible, input[type="file"]:focus-visible {
  outline: none;
  border-color: var(--pen);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pen) 22%, transparent);
}
input[type="radio"], input[type="checkbox"] { accent-color: var(--pen); width: 1.05em; height: 1.05em; vertical-align: -0.1em; }
.field-group {
  border: 2px dashed var(--ink-soft);
  border-radius: var(--wobbly-md);
  margin: 1rem 0;
  padding: 0.5rem 1rem 0.75rem;
}
.field-group legend { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; font-size: 1.15rem; padding: 0 0.4rem; }
.field-group label, .checkbox-label { display: block; margin: 0.3rem 0; cursor: pointer; }
.hint { color: var(--ink-soft); font-size: 0.95rem; }
.tip { font-size: 1.1rem; color: var(--pen-ink); }
.tip::before { content: "\2192  "; }
.status-line { color: var(--ink-soft); font-style: italic; }

/* ---- Buttons: wobbly ovals that press flat ---- */
button {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.45rem 1.3rem 0.5rem;
  border: 3px solid var(--ink);
  border-radius: var(--wobbly);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease, background-color 100ms ease, color 100ms ease, border-color 100ms ease;
}
button:hover:not(:disabled) {
  border-color: var(--marker);
  transform: none;
}
button:active:not(:disabled) { box-shadow: none; transform: translate(4px, 4px); }
button.primary { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; font-size: 1.15rem; }
button.secondary { background: var(--erased); border-width: 2px; }
button:disabled {
  cursor: not-allowed;
  color: var(--pencil);
  border-style: dashed;
  border-color: var(--pencil);
  background: transparent;
  box-shadow: none;
}
.picker-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.picker-row select { flex: 1 1 14rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.9rem 1rem; margin: 1.25rem 0 0.75rem; }

/* Sketched keycaps */
kbd {
  display: inline-block;
  min-width: 1.6em;
  font-family: var(--font-hand);
  font-size: 0.95em;
  line-height: 1.35;
  text-align: center;
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  border-radius: var(--wobbly-sm);
  padding: 0 0.35rem;
  margin: 0.1rem 0;
  background: var(--card);
  color: var(--ink);
}

/* ---- Hand indicators (icon + text, never color alone) ---- */
.indicators { list-style: none; padding: 0; margin: 1rem 0; }
.indicators li { margin: 0.4rem 0; display: flex; align-items: center; gap: 0.5rem; }
.indicator-icon {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 2px solid currentColor;
  border-radius: var(--wobbly-blob);
  font-size: 1rem;
  line-height: 1;
}
[data-on="false"] .indicator-icon { color: var(--marker-ink); transform: rotate(-6deg); }
[data-on="true"] .indicator-icon { color: var(--ok); transform: rotate(4deg); }
.indicator-icon::before { content: "\2717"; }
[data-on="true"] .indicator-icon::before { content: "\2713"; }
[data-on="false"] .indicator-text { color: var(--ink-soft); }
[data-on="true"] .indicator-text { color: var(--ink); text-decoration: underline 2px var(--ok); text-underline-offset: 0.2em; }

/* ---- Camera stage: a taped-down polaroid ---- */
.stage-slot {
  position: relative;
  padding: 0.65rem 0.65rem 1.6rem;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 6px 12px 5px 14px / 12px 5px 14px 6px;
  box-shadow: var(--shadow);
  transform: rotate(-0.6deg);
}
.stage-slot:empty { display: none; }
.stage-slot::before, .stage-slot::after {
  content: "";
  position: absolute;
  top: -0.8rem;
  width: 5.5rem;
  height: 1.6rem;
  background: var(--tape);
  border-left: 1px dashed rgba(0, 0, 0, 0.12);
  border-right: 1px dashed rgba(0, 0, 0, 0.12);
  z-index: 2;
}
.stage-slot::before { left: 1.25rem; transform: rotate(-6deg); }
.stage-slot::after { right: 1.25rem; transform: rotate(5deg); }
#screen-calibrate .stage-slot { transform: none; }
.stage {
  position: relative;
  width: 100%;
  background: #1f2022;
  border-radius: 3px;
  overflow: hidden;
  min-height: 120px;
}
.stage video, .stage canvas {
  display: block;
  width: 100%;
  height: auto;
}
.stage canvas { position: absolute; inset: 0; height: 100%; }
.stage.is-mapping,
.stage.is-mapping video,
.stage.is-mapping canvas { cursor: crosshair; }
.stage.is-mapping::after {
  position: absolute;
  z-index: 3;
  top: 0.7rem;
  left: 0.7rem;
  padding: 0.35rem 0.65rem;
  border: 2px solid var(--marker);
  border-radius: 0.35rem;
  background: rgba(30, 31, 33, 0.88);
  color: #fff;
  content: "Drag the coral discs onto the keys";
  font-size: 0.92rem;
  pointer-events: none;
}
.grid-disc-layer { position: absolute; z-index: 4; inset: 0; pointer-events: none; }
.grid-map-disc {
  display: inline-grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  border: 2px solid #ff6b6b;
  border-radius: 50%;
  background: #ff6b6b;
  color: #2d2d2d;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
  font-family: var(--font-marker);
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.grid-map-disc:active { cursor: grabbing; }
.grid-disc-layer .grid-map-disc { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; }
.grid-map-disc.is-drag-preview {
  position: fixed;
  z-index: 300;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.9;
}
.stage.replay video { display: none; }
.stage.replay canvas { position: static; }
.stage-empty {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  color: #d8d4cb;
  font-size: 1.2rem;
}
.stage.has-video .stage-empty, .stage.replay .stage-empty { display: none; }
.stage-empty { align-content: center; gap: 0.9rem; padding: 1.5rem; text-align: center; }
.stage-empty p { margin: 0; max-width: 32rem; }
.stage:not(.has-video):not(.replay) { min-height: 14rem; }
/* The final build has one progress bar per camera step; the old "step N" tags repeated it. */
#screen-setup .step-tag, #screen-calibrate .step-tag, #screen-typing-test .step-tag, #screen-choose .step-tag { display: none; }
/* The stage lives off screen until a screen slot claims it. */
body > .stage { display: none; }

/* ---- Calibration ---- */
.instructions { padding-left: 1.4rem; }
.instructions li { margin-bottom: 0.6rem; padding-left: 0.25rem; }
.instructions li::marker { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; color: var(--marker-ink); }
.grid-prompt { font-size: 1.35rem; font-weight: 700; min-height: 2.2rem; }
.grid-steps { list-style: none; padding-left: 0; display: grid; gap: 0.4rem; }
.grid-steps li { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-soft); }
.grid-steps li.current { color: var(--ink); font-weight: 700; }
.grid-steps li.done { color: var(--ok); }
.grid-steps .step-mark { display: inline-block; width: 1.2em; text-align: center; font-weight: 700; }
.countdown {
  font-family: var(--font-marker); font-variation-settings: var(--marker-axes);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--marker-ink);
  min-height: 4.5rem;
  margin: 0.25rem 0;
  line-height: 1.2;
}
progress {
  appearance: none;
  width: 100%;
  height: 1.3rem;
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-sm);
  background: var(--card);
  overflow: hidden;
}
progress::-webkit-progress-bar { background: var(--card); }
/* Filled in with pencil hatching */
progress::-webkit-progress-value {
  background: repeating-linear-gradient(-45deg, var(--pen) 0 3px, transparent 3px 7px);
  border-right: 2px solid var(--pen);
}
progress::-moz-progress-bar { background: repeating-linear-gradient(-45deg, var(--pen) 0 3px, transparent 3px 7px); }
#screen-calibrate #calibrate-progress { border-color: var(--marker); }
#screen-calibrate #calibrate-progress::-webkit-progress-value {
  background: repeating-linear-gradient(-45deg, var(--marker) 0 3px, transparent 3px 7px);
  border-right-color: var(--marker);
}
#screen-calibrate #calibrate-progress::-moz-progress-bar {
  background: repeating-linear-gradient(-45deg, var(--marker) 0 3px, transparent 3px 7px);
}

/* ---- Choose screen: sticky notes ---- */
.level-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2rem 1.75rem; padding: 0.75rem 0.25rem; }
.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 9.5rem;
  text-align: left;
  padding: 1.6rem 1.3rem 1.2rem;
  background: var(--postit);
  color: var(--postit-ink);
  border: 2px solid var(--ink);
  border-radius: 4px 6px 30px 4px / 4px 4px 22px 6px;
  box-shadow: var(--shadow);
}
.level-card:nth-child(3n + 1) { transform: rotate(-1.5deg); }
.level-card:nth-child(3n + 2) { transform: rotate(1deg); }
.level-card:nth-child(3n + 3) { transform: rotate(-0.5deg); }
.level-card::before {
  content: "";
  position: absolute;
  top: -0.85rem;
  left: 50%;
  width: 5rem;
  height: 1.5rem;
  margin-left: -2.5rem;
  background: var(--tape);
  transform: rotate(-3deg);
}
.level-card:hover:not(:disabled) {
  border-color: var(--marker);
}
.level-card:nth-child(3n + 1):hover:not(:disabled) { transform: rotate(-1.5deg); }
.level-card:nth-child(3n + 2):hover:not(:disabled) { transform: rotate(1deg); }
.level-card:nth-child(3n + 3):hover:not(:disabled) { transform: rotate(-0.5deg); }
.level-card:active:not(:disabled) { box-shadow: var(--shadow-sm); transform: translate(2px, 2px); }
.level-card strong { display: block; font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; font-size: 1.4rem; line-height: 1.2; background: none; color: inherit; }
.level-card span { color: color-mix(in srgb, var(--postit-ink) 80%, transparent); }

/* ---- Tutorial before each Level 1 and 2 exercise ---- */
.screen-tutorial { max-width: 72rem; margin: 0 auto; padding: 1rem 0 3rem; }
.tutorial-kicker { margin: 0 0 0.3rem; font-weight: 700; color: var(--marker-ink); letter-spacing: 0.03em; text-transform: uppercase; font-size: 0.95rem; }
.screen-tutorial h2 { margin: 0 0 0.4rem; font-size: clamp(1.9rem, 3.6vw, 2.5rem); }
.tutorial-intro { font-size: 1.15rem; max-width: 52rem; margin: 0 0 0.35rem; }
.tutorial-preview { margin: 0 0 1rem; color: var(--ink-soft); }
.tutorial-preview code { font-family: var(--font-type); font-size: 1.1rem; color: var(--ink); background: var(--postit); padding: 0.1rem 0.5rem; border-radius: 6px; }
.tutorial-layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.5rem; align-items: start; }
.tutorial-main { display: grid; gap: 1.1rem; }
.tutorial-main .panel { padding: 1rem 1.3rem; }
.tutorial-keys h3, .tutorial-try h3, .tutorial-coach h3 { margin: 0 0 0.6rem; font-size: 1.25rem; text-decoration: none; }
.tutorial-step { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; margin-right: 0.35rem; border: 2px solid var(--marker); border-radius: var(--wobbly-blob); color: var(--marker-ink); font-size: 1rem; }
/* Finger colors: pastel, with ink text, the same in light and dark mode. */
.finger-L_PINKY { --finger: #f4a3a3; } .finger-L_RING { --finger: #ffc98a; } .finger-L_MIDDLE { --finger: #fbe58a; } .finger-L_INDEX { --finger: #a8dba8; }
.finger-R_INDEX { --finger: #9fd8f2; } .finger-R_MIDDLE { --finger: #c3b2ec; } .finger-R_RING { --finger: #f3a8c9; } .finger-R_PINKY { --finger: #cdb8a8; } .finger-thumbs { --finger: #d5dbe0; }
.tutorial-keyboard { --key: 2.6rem; display: grid; gap: 0.3rem; margin: 0 0 0.9rem; padding: 0.7rem; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); overflow-x: auto; }
.tutorial-kb-row { display: flex; gap: 0.3rem; padding-left: calc(var(--offset, 0) * (var(--key) + 0.3rem)); }
.tutorial-kb-key { position: relative; display: grid; place-items: center; flex: 0 0 var(--key); height: var(--key); border: 2px solid var(--ink-soft); border-bottom-width: 4px; border-radius: 8px; background: var(--card); color: var(--ink-soft); font-family: var(--font-type); font-size: 1rem; opacity: 0.38; }
.tutorial-kb-key.is-space { flex-basis: calc(var(--key) * 5.5); height: calc(var(--key) * 0.8); margin-left: calc((var(--key) + 0.3rem) * 2.6); }
.tutorial-kb-key.is-used { opacity: 1; background: var(--finger); border-color: #2d2d2d; color: #2d2d2d; font-weight: 700; }
.tutorial-kb-key.has-bump::after { content: ""; position: absolute; bottom: 0.45rem; width: 0.9rem; height: 3px; border-radius: 2px; background: currentColor; }
.tutorial-kb-key.is-new { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--marker); }
.tutorial-kb-key.is-current { animation: tutorial-pulse 1.1s ease-in-out infinite; }
.tutorial-kb-key.is-done::before { content: "✓"; position: absolute; top: -0.65rem; right: -0.5rem; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--ok); color: #fff; font-size: 0.8rem; font-family: var(--font-hand); }
@keyframes tutorial-pulse { 0%, 100% { transform: translateY(0); box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--pen); } 50% { transform: translateY(3px); box-shadow: 0 0 0 3px var(--paper), 0 0 0 9px var(--pen); } }
.tutorial-key-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.8rem, 1fr)); gap: 0.6rem; margin: 0; padding: 0.4rem 0 0; }
.tutorial-key-card { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 0.55rem; align-items: center; justify-items: start; padding: 0.4rem 0.6rem; border: 2px solid var(--ink); border-radius: var(--wobbly-sm); background: color-mix(in srgb, var(--finger) 60%, #fff); color: #2d2d2d; }
.tutorial-key-card kbd { grid-row: span 2; font-size: 1.1rem; }
.tutorial-key-finger { line-height: 1.2; }
.tutorial-key-finger { font-weight: 700; }
.tutorial-key-card small { font-size: 0.82rem; line-height: 1.2; color: #4a4642; }
.tutorial-new-badge { position: absolute; top: -0.7rem; right: 0.5rem; padding: 0 0.45rem; border-radius: 6px; background: var(--marker-fill); color: #fff; font-size: 0.78rem; font-weight: 700; }
.tutorial-prompt { margin: 0 0 0.7rem; font-size: 1.55rem; font-weight: 700; min-height: 2.4rem; }
.tutorial-prompt strong { background: none; color: var(--pen-ink); }
.tutorial-prompt kbd { font-size: 1.4rem; }
.tutorial-progress { list-style: none; display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0 0 0.6rem; padding: 0; }
.tutorial-progress li { min-width: 2.4rem; padding: 0.15rem 0.5rem; text-align: center; border: 2px dashed var(--ink-soft); border-radius: 8px; color: var(--ink-soft); font-family: var(--font-type); }
.tutorial-progress li.is-current { border-style: solid; border-color: var(--pen); color: var(--pen-ink); font-weight: 700; }
.tutorial-progress li.is-done { border-style: solid; border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.tutorial-side { display: grid; gap: 1.25rem; position: sticky; top: 5.5rem; }
.tutorial-tip { padding: 1rem 1.2rem; background: var(--postit); color: var(--postit-ink); border: 2px solid var(--ink); border-radius: 4px 6px 26px 4px / 4px 4px 20px 6px; box-shadow: var(--shadow-sm); transform: rotate(-1deg); }
.tutorial-tip strong { display: block; font-size: 1.2rem; margin-bottom: 0.3rem; background: none; color: inherit; font-family: var(--font-marker); font-variation-settings: var(--marker-axes); }
.tutorial-tip p { margin: 0; }
.tutorial-coach ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; font-size: 0.98rem; }
.coach-mark { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; margin-right: 0.4rem; padding: 0 0.3rem; border-radius: 6px; color: #fff; font-weight: 700; font-size: 0.85rem; }
.coach-next { background: var(--pen); }
.coach-good { background: var(--ok); }
.coach-warn { background: #e8860c; }
.coach-bad { background: var(--marker-fill); }
.tutorial-actions { margin: 0; }
@media (max-width: 900px) { .tutorial-layout { grid-template-columns: 1fr; } .tutorial-side { position: static; } }
@media (prefers-reduced-motion: reduce) { .tutorial-kb-key.is-current { animation: none; box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--pen); } }


/* ---- Exercise: compact text area above a large, full-width camera view ---- */
.exercise-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; margin: 0.25rem 0 0.9rem; }
.exercise-bar h2 { font-size: 1.35rem; margin: 0; }
.exercise-bar .live-stats { margin: 0 0 0 auto; }
button.compact { font-size: 0.95rem; padding: 0.2rem 0.9rem 0.25rem; box-shadow: var(--shadow-sm); }
button.compact kbd { font-size: 0.8em; margin-left: 0.25rem; }
.exercise-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.75rem; min-height: 2.4rem; margin: 0.75rem 0 1.1rem; }
.exercise-status .next-finger, .exercise-status .feedback { margin: 0; }
.exercise-status .exercise-camera-status { flex-basis: 100%; margin: 0; }
.stage-slot-wide {
  --stage-height: max(16rem, calc(100dvh - 22rem));
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  transform: none;
}
.stage-slot-wide .stage {
  width: min(calc(100vw - 4.5rem), calc(1200px - 4.5rem), calc(var(--stage-height) * var(--video-aspect, 1.7778)));
}
body:has(#screen-exercise:not([hidden])) .steps { display: none; }
.badge {
  display: inline-block;
  font-size: 0.95rem;
  padding: 0.15rem 0.75rem;
  border-radius: var(--wobbly-sm);
  background: var(--postit);
  color: var(--postit-ink);
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-sm);
  transform: rotate(-2deg);
}
.badge-replay { background: var(--info-bg); color: var(--ink); transform: rotate(1.5deg); }

/* monkeytype-style live numbers: big, quiet, no boxes. */
.live-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 2.25rem;
  margin: 0 0 0.5rem 0.25rem;
}
.live-stats div { display: flex; flex-direction: row-reverse; align-items: baseline; gap: 0.4rem; }
.live-stats dd {
  font-family: var(--font-marker); font-variation-settings: var(--marker-axes);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--pen-ink);
  font-variant-numeric: tabular-nums;
}
.live-stats dt { text-transform: lowercase; color: var(--pencil); font-size: 1.05rem; }

/* A sheet of ruled notebook paper with a red margin line. */
.typing-area {
  --rule: 3.3rem;
  position: relative;
  border: 2px solid var(--ink);
  border-radius: 8px 18px 10px 22px / 18px 8px 22px 10px;
  box-shadow: var(--shadow);
  padding: 1rem 1.5rem 1.3rem 3.6rem;
  background: var(--card);
  cursor: text;
  transition: box-shadow 100ms ease;
}
.typing-area::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.4rem;
  width: 2px;
  background: var(--marker);
  opacity: 0.55;
}
.typing-area:focus { outline: none; box-shadow: var(--shadow-lg); }
.typing-area:focus-visible { outline: 3px dashed var(--pen); outline-offset: 5px; }
.target-text {
  font-family: var(--font-type);
  font-size: 1.7rem;
  line-height: var(--rule);
  margin: 0;
  word-break: break-word;
  white-space: pre-wrap;
  /* Rules sit right under each line of text */
  background-image: linear-gradient(transparent calc(var(--rule) - 0.55rem), var(--rule-line) calc(var(--rule) - 0.55rem), var(--rule-line) calc(var(--rule) - 0.55rem + 2px), transparent calc(var(--rule) - 0.55rem + 2px));
  background-size: 100% var(--rule);
}
.target-text .char-pending { color: var(--pencil); }
.target-text .char-correct { color: var(--ink); }
/* Wrong characters: red, underlined with a wavy line, and shown on a tinted background. */
.target-text .char-wrong {
  color: var(--marker-ink);
  background: var(--bad-bg);
  border-radius: 3px;
  text-decoration: underline wavy var(--marker);
  text-decoration-skip-ink: none;
}
/* Current letter: a highlighter swipe plus a blinking pen caret in front of it. */
.target-text .char-current {
  position: relative;
  color: var(--ink);
  background: linear-gradient(transparent 52%, var(--highlighter) 52%, var(--highlighter) 88%, transparent 88%);
}
.target-text .char-current::before {
  content: "";
  position: absolute;
  left: -2px;
  top: 0.15em;
  bottom: 0.05em;
  width: 3px;
  border-radius: 2px;
  background: var(--pen);
  animation: caret-blink 1s ease-in-out infinite;
}
@keyframes caret-blink {
  0%, 45% { opacity: 1; }
  60%, 90% { opacity: 0; }
}
.next-finger {
  display: inline-block;
  margin: 1.25rem 0 0.25rem;
  font-family: var(--font-marker); font-variation-settings: var(--marker-axes);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--pen-ink);
}
.feedback { min-height: 1.6em; font-size: 1.25rem; margin: 0.25rem 0; }
.feedback[data-status="correct"] { color: var(--ok); }
.feedback[data-status="correct"]::before { content: "\2713  "; }
.feedback[data-status="wrong"] { color: var(--marker-ink); text-decoration: underline wavy var(--marker); text-underline-offset: 0.25em; text-decoration-skip-ink: none; }
.feedback[data-status="wrong"]::before { content: "\2717  "; }
.feedback[data-status="unavailable"] { color: var(--ink-soft); }
.feedback[data-status="wrong-key"] { color: var(--marker-ink); }
.feedback[data-status="wrong-key"]::before { content: "\2260  "; }
.key-hints { color: var(--pencil); }

.collect-layout { align-items: start; }
.screen-collect .stage-slot { width: 100%; min-height: 22rem; }
.collect-prompt { min-height: 4rem; font-size: clamp(1.35rem, 2.5vw, 1.7rem); font-weight: 700; line-height: 1.4; }
.collect-prompt.on-purpose { color: var(--marker-ink); }
.collect-progress-text { margin-bottom: 0.25rem; }
.collect-hands[data-on="true"] { color: var(--ok); }
.collect-hands[data-on="false"] { color: var(--marker-ink); font-weight: 700; }
#debug-collect { margin-bottom: 0.75rem; }

.beat-flash {
  position: fixed;
  z-index: 90;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, var(--beat-color, transparent) 100%);
}
.beat-flash[data-beat="good"] { --beat-color: var(--beat-good); }
.beat-flash[data-beat="bad"] { --beat-color: var(--beat-bad); }
.beat-flash[data-beat="warn"] { --beat-color: var(--beat-warn); }

/* Focus mode, like monkeytype: while the typing area has focus, the chrome fades out of the way. */
body:has(#typing-area:focus) .app-header,
body:has(#typing-area:focus) .exercise-bar,
body:has(#typing-area:focus) .exercise-status,
body:has(#typing-area:focus) .debug-toggle { opacity: 0.4; }
body:has(#typing-area:focus) .app-header:hover,
body:has(#typing-area:focus) .exercise-bar:hover,
body:has(#typing-area:focus) .exercise-status:hover,
body:has(#typing-area:focus) .debug-toggle:hover { opacity: 1; }
.exercise-bar, .exercise-status, .debug-toggle { transition: opacity 200ms ease; }

/* ---- Summary ---- */
.headline {
  font-family: var(--font-marker); font-variation-settings: var(--marker-axes);
  font-weight: 700;
  font-size: 1.5rem;
  max-width: 44rem;
  margin: 0 0 1.5rem;
  transform: rotate(-0.6deg);
}
.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.75rem;
  margin: 1rem 0 2rem;
  max-width: 900px;
}
.summary-stats div {
  position: relative;
  padding: 1.1rem 1.25rem 1rem;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-md);
  box-shadow: var(--shadow);
}
.summary-stats div:nth-child(1) { background: var(--postit); color: var(--postit-ink); transform: rotate(-1.5deg); }
.summary-stats div:nth-child(2) { transform: rotate(0.8deg); }
.summary-stats div:nth-child(3) { transform: rotate(-0.4deg); }
/* Red thumbtack on the speed note */
.summary-stats div:nth-child(1)::before {
  content: "";
  position: absolute;
  top: -0.55rem;
  left: 50%;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: -0.55rem;
  border-radius: 50%;
  background: var(--marker);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 0 var(--shadow-ink);
}
.summary-stats dt { font-size: 1.05rem; color: inherit; opacity: 0.8; text-transform: lowercase; }
.summary-stats dd { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; margin: 0.15rem 0 0; }
.summary-stats div:nth-child(1) dd { color: var(--postit-ink); }

dt { color: var(--ink-soft); font-size: 0.95rem; }
dd { margin: 0; font-size: 1.5rem; font-weight: 700; }

.histogram {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  height: 240px;
  max-width: 900px;
  padding: 0.75rem 1rem 0.5rem;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-md);
  box-shadow: var(--shadow-soft);
  overflow-x: auto;
}
.histogram-bar {
  flex: 1 0 52px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  font-size: 0.9rem;
  text-align: center;
}
/* Bars shaded in with pencil hatching */
.histogram-bar .bar {
  width: 68%;
  min-height: 3px;
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 10px 4px 0 0 / 6px 10px 0 0;
  background: repeating-linear-gradient(-50deg, var(--pen) 0 2.5px, transparent 2.5px 6px);
}
.histogram-bar:nth-child(even) .bar { border-radius: 4px 12px 0 0 / 10px 5px 0 0; }
.histogram-bar .count { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; font-size: 1.1rem; }
.histogram-bar .label {
  width: 100%;
  padding-top: 0.25rem;
  border-top: 2px solid var(--ink);
  color: var(--ink-soft);
  line-height: 1.15;
  min-height: 2.6em;
}

/* Tables look like a ruled ledger page */
#history-choose, #history-summary, #summary-substitutions { overflow-x: auto; padding: 0 8px 8px 0; }
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  max-width: 760px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
th, td { text-align: left; padding: 0.45rem 0.9rem; border-bottom: 1.5px dashed var(--erased); }
th { font-family: var(--font-marker); font-variation-settings: var(--marker-axes); font-weight: 700; border-bottom: 2px solid var(--ink); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* ---- Debug panel ---- */
/* Bottom-left so it never covers the debug panel, which opens on the right. */
.debug-toggle {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 20;
  font-size: 0.95rem;
  padding: 0.25rem 0.9rem;
  background: var(--erased);
  border-width: 2px;
  border-style: dashed;
  box-shadow: var(--shadow-sm);
  transform: rotate(-2deg);
}
.debug-toggle[aria-expanded="true"] { border-style: solid; background: var(--postit); color: var(--postit-ink); }
.debug-panel {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(780px, 100vw);
  overflow-y: auto;
  background: var(--paper);
  border-left: 3px solid var(--ink);
  padding: 1rem 1.5rem 4rem;
  z-index: 15;
  box-shadow: -8px 0 0 0 var(--shadow-ink);
}
.debug-panel h2 { font-size: 2rem; }
.debug-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.debug-stats div { padding: 0.4rem 0.75rem; border: 2px dashed var(--ink-soft); border-radius: var(--wobbly-sm); background: var(--card); }
.debug-stats dd { font-size: 1.05rem; font-weight: 400; word-break: break-word; }
.trace-controls { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.trace-canvas {
  width: 100%;
  height: auto;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--wobbly-sm);
  margin-top: 0.75rem;
}
.trace-legend { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.9rem; margin-top: 0.5rem; }
.trace-legend span::before {
  content: "";
  display: inline-block;
  width: 1.4em;
  height: 0.35em;
  margin-right: 0.35em;
  vertical-align: middle;
  background: var(--swatch);
}

/* Small screens: straighten things up a little and give the text more room. */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .app-header { gap: 0.6rem 1rem; }
  .landing-nav a { display: none; }
  .landing-nav #landing-nav-test { display: block; font-size: 0.78rem; }
  .landing-nav .nav-cta { display: block; font-size: 0.9rem; }
  .landing-nav { gap: 0.35rem 0.85rem; }
  .steps { font-size: 0.95rem; gap: 0.1rem 0.9rem; }
  .screen-landing { padding-top: 2.4rem; }
  .landing-hero { gap: 3.5rem; }
  .hero-copy h1 { font-size: clamp(3.15rem, 16vw, 4.8rem); }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .lesson-preview { padding: 1rem; box-shadow: 7px 7px 0 var(--shadow-ink); }
  .preview-stats { gap: 1rem; }
  .preview-stats dd { font-size: 1.5rem; }
  .home-row-demo span:not(.key-gap) { width: 1.75rem; height: 1.85rem; }
  .landing-note { padding: 2.5rem 1rem; }
  .speed-story-copy { white-space: normal; font-size: clamp(0.92rem, 3.7vw, 1.25rem); }
  .privacy-card { grid-template-columns: 1fr; }
  .privacy-icon { width: 4rem; height: 4rem; }
  .landing-footer { flex-direction: column; }
  .landing-wordmark { font-size: clamp(3.5rem, 9vw, 5rem); }
  .landing-stage { min-height: calc(100svh - 3rem); gap: 1rem; padding-inline: 0.4rem; }
  .typing-headline { font-size: clamp(1.35rem, 5.6vw, 2.3rem); }
  .scene-actions { align-items: center; flex-direction: column; }
  .panel { padding: 1rem 1.1rem; }
  .screen-dashboard { --dashboard-panel-padding: 1rem; }
  .dashboard-start-panel { padding: var(--dashboard-panel-padding); }
  .dashboard-start-heading { grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; }
  .dashboard-camera-icon { width: 3rem; }
  .dashboard-start-actions { grid-column: 1 / -1; justify-self: start; flex-wrap: wrap; }
  .dashboard-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; margin-top: 1rem; }
  .dashboard-checks li { grid-template-columns: auto minmax(0, 1fr); gap: 0.45rem; padding: 0.65rem; }
  .dashboard-check-state { grid-column: 2; }
  .typing-test-intro { font-size: 1rem; }
  .typing-test-editor { --test-type-size: clamp(2rem, 8vw, 2.65rem); }
  .typing-area { padding: 0.75rem 1rem 1rem 2.6rem; --rule: 2.7rem; }
  .typing-area::before { left: 1.6rem; }
  .target-text { font-size: 1.35rem; }
  .live-stats { gap: 0.25rem 1.5rem; }
  .live-stats dd { font-size: 2rem; }
}

@media (max-width: 760px) {
  .dashboard-start-heading { grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; }
  .dashboard-start-actions { grid-column: 1 / -1; justify-self: start; flex-wrap: wrap; }
  .dashboard-checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-hand-card { grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.5rem 0.75rem; padding: 0.75rem; }
  .dashboard-finger-stat { grid-template-columns: minmax(3rem, auto) minmax(1.5rem, 1fr) 2.5rem; gap: 0.35rem; }
}

@media (max-width: 520px) {
  .dashboard-finger-hands { grid-template-columns: 1fr; }
  .typing-test-score { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1500px) {
  .landing-stage { --mobile-carousel-height: clamp(5.75rem, 11vh, 7.25rem); padding-block: calc(1.5rem + var(--mobile-carousel-height)) calc(4.5rem + var(--mobile-carousel-height)); }
  .hero-card-carousel {
    top: 0.5rem;
    right: 0;
    bottom: auto;
    left: 0;
    width: 100%;
    height: var(--mobile-carousel-height);
    visibility: hidden;
  }
  .hero-card-carousel--right { top: auto; right: 0; bottom: calc(var(--scroll-cue-bottom) + var(--scroll-cue-height) + var(--scroll-cue-divider-gap) + 1rem); left: 0; }
  .landing-stage.real-arriving .hero-card-carousel { visibility: visible; }
  .hero-card-track { width: max-content; height: 100%; flex-direction: row; align-items: center; }
  .hero-card-set { height: 100%; flex-direction: row; align-items: center; gap: 0.65rem; padding-right: 0.65rem; padding-bottom: 0; }
  .hero-card { box-sizing: border-box; width: clamp(10rem, 23vw, 15rem); min-height: 0; height: calc(100% - 0.7rem); padding: 0.65rem 0.8rem; gap: 0.3rem; }
  .hero-card span { font-size: 0.7rem; }
  .hero-card strong { font-size: 1.12rem; line-height: 1.08; }
  .hero-card--record { grid-template-columns: minmax(0, 1fr) clamp(3.5rem, 16vw, 4.25rem); gap: 0.2rem 0.45rem; padding-block: 0.35rem; text-align: left; }
  .hero-record-copy { gap: 0.18rem; }
  .hero-card--record .hero-record-label { font-size: 0.62rem; letter-spacing: 0.07em; }
  .hero-card--record .hero-record-number { font-size: 2.1rem; }
  .hero-card--record .hero-record-unit { font-size: 0.62rem; }
  .hero-card--record .hero-record-duration { font-size: 0.68rem; }
  .hero-record-graph { height: 4.5rem; }
  .hero-record-graph-line { stroke-width: 4; }
  .hero-card--finger { grid-template-columns: minmax(0, 1fr) clamp(2.3rem, 14vw, 3rem); gap: 0.3rem; }
  .hero-finger-copy { gap: 0.25rem; }
  .hero-card--finger .hero-finger-detail { gap: 0.18rem; font-size: 0.92rem; }
  .hero-finger-hand { height: 3.2rem; }
  .hero-finger-hand .hero-hand-side { font-size: 27px; }
  .hero-card--punctuation { gap: 0.22rem; padding: 0.35rem 0.55rem; }
  .hero-card--punctuation .hero-punctuation-label { font-size: 0.57rem; letter-spacing: 0.055em; }
  .hero-card--punctuation .hero-punctuation-message { font-size: 0.82rem; line-height: 1.02; }
  .hero-punctuation-keys { gap: 0.23rem; }
  .hero-punctuation-keys .hero-keycap { min-width: 1.42em; min-height: 1.3em; padding: 0.05em 0.2em; font-size: 0.73rem; }
  .hero-card--numbers { gap: 0.2rem; padding: 0.35rem 0.5rem; }
  .hero-card--numbers .hero-numbers-label { font-size: 0.55rem; letter-spacing: 0.045em; }
  .hero-card--numbers .hero-numbers-message { font-size: 0.76rem; line-height: 1.02; }
  .hero-number-keys { gap: 0.12rem; }
  .hero-number-keys .hero-keycap { padding-inline: 0; font-size: 0.62rem; }
  .hero-card--drift { gap: 0.18rem; padding: 0.35rem 0.55rem; }
  .hero-card--underused, .hero-card--rest { grid-template-columns: minmax(0, 1fr) clamp(2.3rem, 14vw, 3rem); gap: 0.3rem; padding: 0.35rem 0.5rem; }
  .hero-underused-copy, .hero-rest-copy { gap: 0.18rem; }
  .hero-card--drift .hero-drift-label, .hero-card--rest .hero-rest-label { font-size: 0.58rem; letter-spacing: 0.06em; }
  .hero-card--drift .hero-drift-symbol { font-size: 1rem; }
  .hero-card--drift .hero-drift-message { font-size: 0.82rem; line-height: 1.02; }
  .hero-card--drift .hero-drift-correction, .hero-rest-target { font-size: 0.55rem; }
  .hero-card--underused { gap: 0.2rem; }
  .hero-card--underused .hero-underused-label { font-size: 0.58rem; }
  .hero-card--underused .hero-underused-name { font-size: 1.25rem; }
  .hero-card--underused .hero-underused-message, .hero-card--rest .hero-rest-status { font-size: 0.68rem; }
  .hero-card--rest .hero-rest-finger { font-size: 1rem; }
}

@media (max-width: 800px) {
  .landing-story-section { min-height: calc(100svh - 3.5rem); padding-block: 2.5rem; }
  .landing-story-section#how-it-works { padding-block: 2.75rem 3.5rem; }
  #how-it-works-2 { padding-block: 3.5rem; }
  .speed-story-layout { width: 100%; min-height: 0; margin-inline: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; gap: clamp(1.5rem, 4vh, 2.5rem); }
  .speed-story-context { grid-column: 1; grid-row: 2; max-width: 64rem; margin-inline: auto; }
  .speed-story-rows { grid-column: 1; grid-row: 1; width: 100%; margin-inline: auto; }
  .speed-story-rows { max-width: 72rem; }
  .speed-story-copy { font-size: clamp(1rem, 2.2vw, 1.2rem); }
  .typing-story-box { padding-block: 1rem; }
  .typing-story-box--intro { padding-top: 1rem; }
  .story-process-cards { grid-template-columns: 1fr; gap: 0.75rem; }
  .story-process-card { min-height: 0; grid-template-columns: 1fr auto; padding: 1rem; }
  .hero-info-kicker { margin-bottom: 0.7rem; font-size: 0.68rem; }
  .hero-info-title { margin-bottom: 0.9rem; font-size: 1.35rem; }
  .hero-story-line { gap: 1.2rem; padding: 1.25rem 0; font-size: clamp(1.35rem, 6.2vw, 1.8rem); line-height: 1.4; }
  .hero-story-icon { width: 1.6rem; height: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .landing-stage.real-arriving .hero-card-track { transform: translateY(0); }
}

/* Respect reduced motion: no transitions or animations anywhere. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Headings receive focus when a screen opens (for screen readers); no ring needed there. */
[tabindex="-1"]:focus { outline: none; }
