@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("./assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #17211b;
  --ink-2: #2b382f;
  --ink-3: #4a574d;
  --muted: #6f7a70;
  --paper: #f6f1e4;
  --paper-2: #efe8d7;
  --panel: #fffdf6;
  --panel-2: #fbf7ec;
  --line: #ded6c4;
  --line-strong: #c9bfa9;
  --forest: #2f7a52;
  --forest-deep: #1d5238;
  --forest-soft: #dfeadb;
  --lime: #b7cf65;
  --lime-soft: #edf2cf;
  --amber: #f2b84b;
  --amber-soft: #fbeac3;
  --coral: #e8664a;
  --coral-soft: #f8ddd4;
  --sky: #5b9bd5;
  --sky-soft: #dce9f2;
  --shadow-sm: 0 1px 0 rgba(23, 33, 27, 0.04), 0 6px 18px rgba(23, 33, 27, 0.06);
  --shadow-md: 0 18px 50px rgba(23, 33, 27, 0.11);
  --shadow-lg: 0 30px 80px rgba(23, 33, 27, 0.16);
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Space Grotesk", "Trebuchet MS", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(183, 207, 101, 0.22), transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, rgba(91, 155, 213, 0.13), transparent 55%),
    linear-gradient(180deg, #f8f4e9 0%, var(--paper) 48%, #f1ebdc 100%);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.in-game {
  background: #0b120e;
  overflow: hidden;
}
body.in-game .topbar,
body.in-game .site-footer { display: none; }
body.in-game .app { padding: 12px; max-width: none; }
body.in-game .stage { min-height: calc(100dvh - 24px); }

::selection { background: var(--lime); color: var(--ink); }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(23, 33, 27, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 27, 0.028) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.75), transparent 70%);
}
body.in-game .ambient { display: none; }

.app {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px;
}
.stage { min-height: calc(100vh - 160px); }

/* ---------------------------------- topbar --------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 82px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}
.brand-mark i {
  display: block;
  width: 6px;
  border-radius: 2px;
  background: var(--forest);
}
.brand-mark i:nth-child(1) { height: 12px; opacity: 0.55; }
.brand-mark i:nth-child(2) { height: 18px; opacity: 0.78; }
.brand-mark i:nth-child(3) { height: 24px; }
.brand-word {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand-word span { color: var(--coral); padding: 0 1px; }
.brand-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mini-badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--forest-deep);
  background: rgba(47, 122, 82, 0.09);
  border: 1px solid rgba(47, 122, 82, 0.18);
  border-radius: 999px;
  padding: 7px 11px;
  white-space: nowrap;
}
.mini-badge.subtle {
  color: var(--muted);
  background: rgba(255, 253, 246, 0.55);
  border-color: var(--line);
}

/* --------------------------------- screens --------------------------------- */
.screen { display: none; padding: 26px 0 44px; }
.screen.active { display: block; animation: screen-in 0.45s var(--ease) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--forest);
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(183, 207, 101, 0.22);
  flex: none;
}
.step-dot {
  display: inline-grid;
  place-items: center;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(40px, 5.4vw, 70px);
  line-height: 0.96;
  letter-spacing: -0.045em;
  font-weight: 600;
  margin-bottom: 22px;
}
h1 em { font-style: normal; color: var(--forest); }
h2 { font-size: 22px; letter-spacing: -0.025em; margin-bottom: 4px; }
h3 { font-size: 16px; letter-spacing: -0.01em; margin-bottom: 4px; }
.lede {
  max-width: 620px;
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1.6;
  margin-bottom: 24px;
}
.lede.narrow { max-width: 560px; font-size: 15.5px; }
.microcopy { color: var(--muted); font-size: 12px; }
.microcopy.centre { text-align: center; margin: 16px 0 0; }

/* --------------------------------- welcome --------------------------------- */
.welcome-grid {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding: 20px 0 30px;
}
.welcome-copy h1 { margin-bottom: 26px; }
.welcome-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 26px;
  max-width: 540px;
}
.fact {
  border-top: 2px solid var(--line-strong);
  padding-top: 10px;
}
.fact strong { display: block; font-size: 17px; letter-spacing: -0.02em; }
.fact span { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.consent-box {
  max-width: 570px;
  background: rgba(255, 253, 246, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px 12px;
  margin-bottom: 22px;
}
.checkline {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
}
.checkline.small { font-size: 12.5px; color: var(--muted); max-width: 360px; }
.checkline input { position: absolute; opacity: 0; pointer-events: none; }
.checkbox {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  display: grid;
  place-items: center;
  transition: 0.2s var(--ease);
}
.checkbox::after {
  content: "";
  width: 10px; height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0.6);
  opacity: 0;
  transition: 0.2s var(--ease);
  margin-top: -2px;
}
.checkline input:checked + .checkbox { background: var(--forest); border-color: var(--forest); }
.checkline input:checked + .checkbox::after { opacity: 1; transform: rotate(-45deg) scale(1); }
.checkline input:focus-visible + .checkbox { outline: 3px solid rgba(47, 122, 82, 0.25); outline-offset: 2px; }
.privacy-note { margin: 10px 0 0 32px; color: var(--muted); font-size: 11.5px; }
.welcome-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* buttons */
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 12px 18px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s, border-color 0.18s, color 0.18s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary {
  background: var(--forest);
  color: #fffdf7;
  border-color: var(--forest);
  box-shadow: 0 8px 22px rgba(47, 122, 82, 0.22);
}
.btn-primary:hover:not(:disabled) { background: var(--forest-deep); transform: translateY(-1px); box-shadow: 0 12px 26px rgba(47, 122, 82, 0.28); }
.btn-ghost {
  background: rgba(255, 253, 246, 0.7);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) { background: var(--panel); border-color: var(--ink-3); transform: translateY(-1px); }
.btn-soft {
  background: var(--forest-soft);
  color: var(--forest-deep);
  border-color: transparent;
}
.btn-soft:hover:not(:disabled) { background: #d3e3cf; transform: translateY(-1px); }
.btn-lg { padding: 15px 24px; font-size: 15px; border-radius: 14px; }
.btn-arrow { font-family: var(--mono); font-weight: 400; transition: transform 0.18s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(3px); }
.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn.danger { color: #a94b38; }

/* welcome visual */
.welcome-visual { min-width: 0; }
.visual-frame {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: #dfe9d2;
  border: 1px solid rgba(23, 33, 27, 0.12);
  box-shadow: var(--shadow-lg);
  transform: rotate(0.6deg);
}
.hero-svg { display: block; width: 100%; height: auto; }
.visual-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.caption-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--coral); }

/* ------------------------------- page headers ------------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}
.page-head h1 { font-size: clamp(34px, 4.2vw, 54px); margin-bottom: 14px; }
.page-head .lede { margin-bottom: 0; }
.progress-card {
  width: 280px;
  flex: none;
  background: rgba(255, 253, 246, 0.68);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.progress-meta { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.progress-meta strong { color: var(--forest); }
.progress-track { height: 6px; border-radius: 99px; background: var(--paper-2); margin: 10px 0 8px; overflow: hidden; }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--forest), #6fa46a); transition: width 0.4s var(--ease); }
.progress-card p { margin: 0; font-size: 11px; color: var(--muted); }

/* --------------------------------- panels ---------------------------------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { font-size: 20px; }
.panel-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--forest-deep);
  background: var(--forest-soft);
  border-radius: 999px;
  padding: 6px 9px;
  white-space: nowrap;
}
.tag.warn { background: var(--amber-soft); color: #8a5b13; }
.tag.bad { background: var(--coral-soft); color: #9a3a28; }
.survey-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

/* ---------------------------------- forms ---------------------------------- */
.form-panel { overflow: hidden; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  padding: 24px;
}
.field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field > span { display: flex; align-items: baseline; gap: 6px; }
.field small { font-weight: 400; color: var(--muted); font-size: 10.5px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--ink);
  padding: 11px 12px;
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--forest);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 122, 82, 0.12);
}
.field input:disabled { opacity: 0.5; background: var(--paper-2); }
.form-error {
  margin: 0 24px 16px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--coral-soft);
  color: #8e3523;
  font-size: 12px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 22px;
  border-top: 1px solid var(--line);
}
.side-note { padding: 22px; position: sticky; top: 20px; }
.side-note h3 { margin-bottom: 14px; }
.note-list { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 16px; }
.note-list li { display: flex; gap: 11px; align-items: flex-start; }
.note-num { font-family: var(--mono); font-size: 9px; color: var(--coral); padding-top: 3px; }
.note-list strong { display: block; font-size: 13px; margin-bottom: 2px; }
.note-list p { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.code-card {
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 16px;
}
.code-card span { display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; color: #a8b3a9; text-transform: uppercase; }
.code-card strong { display: block; font-family: var(--mono); font-size: 20px; letter-spacing: 0.04em; color: var(--lime); margin: 5px 0 6px; }
.code-card small { color: #a8b3a9; font-size: 10px; line-height: 1.4; display: block; }

/* segmented control */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 8px 15px;
  cursor: pointer;
  transition: 0.16s var(--ease);
}
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: var(--forest); color: #fff; box-shadow: 0 3px 10px rgba(47, 122, 82, 0.22); }
.segmented.five button { min-width: 42px; padding: 8px 10px; }

/* state */
.state-panel { overflow: hidden; }
.state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.state-row.split { align-items: center; }
.state-copy h2 { font-size: 17px; margin-bottom: 3px; }
.state-copy p { margin: 0; color: var(--muted); font-size: 12px; }
.state-kicker { display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.13em; color: var(--coral); margin-bottom: 6px; }
.range-wrap { width: min(340px, 46%); flex: none; }
.range-output {
  display: block;
  font-family: var(--mono);
  font-size: 20px;
  color: var(--forest);
  margin-bottom: 8px;
  font-weight: 500;
}
input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--paper-2);
  accent-color: var(--forest);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--forest);
  border: 3px solid var(--panel);
  box-shadow: 0 1px 6px rgba(23, 33, 27, 0.3);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--forest);
  border: 3px solid var(--panel);
  box-shadow: 0 1px 6px rgba(23, 33, 27, 0.3);
}
.range-ends { display: flex; justify-content: space-between; margin-top: 6px; font-family: var(--mono); font-size: 8.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* -------------------------------- briefing -------------------------------- */
.brief-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 22px; align-items: stretch; }
.controls-panel { padding-bottom: 22px; }
.keyboard-tag { transition: 0.2s; }
.keyboard-tag.not-ready { background: var(--amber-soft); color: #8a5b13; }
.control-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  border-bottom: 1px dashed var(--line);
}
.control-label { max-width: 270px; }
.control-label h3 { font-size: 16px; margin: 7px 0 3px; }
.control-label p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.hand-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  background: var(--lime-soft);
  color: #52621f;
  border-radius: 4px;
  padding: 3px 6px;
}
.hand-chip.right { background: var(--sky-soft); color: #2f638f; }
.key-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.key-row.wide { gap: 24px; }
.keycap-group { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.keycap-group > span:last-child { font-family: var(--mono); font-size: 8.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.key-pair { display: flex; gap: 5px; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 7px;
  background: linear-gradient(180deg, #fffdf7, #efe9d9);
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 0 rgba(23, 33, 27, 0.06);
}
kbd.space-key { min-width: 76px; font-size: 9px; letter-spacing: 0.1em; }
.brief-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 24px 0;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--amber-soft);
  color: #6d4c16;
}
.note-icon {
  flex: none;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: #4b320b;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.brief-note p { margin: 0; font-size: 11.5px; line-height: 1.45; }
.sequence-panel { padding: 24px; display: flex; flex-direction: column; }
.sequence-panel h2 { margin-bottom: 18px; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li { display: flex; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline-time { flex: none; width: 62px; font-family: var(--mono); font-size: 10px; color: var(--forest); padding-top: 3px; }
.timeline strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.timeline p { margin: 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.timeline-dual .timeline-time { color: var(--coral); }
.sequence-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.brief-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.start-group { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.device-warning {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--coral-soft);
  color: #8e3523;
  font-size: 13px;
}

/* ---------------------------------- game ----------------------------------- */
.screen-game { padding: 0; }
.screen-game.active { display: block; animation: none; }
.game-wrap {
  position: relative;
  width: 100%;
  height: calc(100dvh - 24px);
  min-height: 540px;
  border-radius: 22px;
  overflow: hidden;
  background: #101814;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 90px rgba(0, 0, 0, 0.4);
  user-select: none;
}
#gameCanvas { display: block; width: 100%; height: 100%; }
.game-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 48%, rgba(5, 10, 7, 0.36) 100%),
    linear-gradient(180deg, rgba(5, 10, 7, 0.24) 0%, transparent 18%, transparent 72%, rgba(5, 10, 7, 0.42) 100%);
}
.impact-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(232, 102, 74, 0.05), rgba(200, 44, 28, 0.55));
  opacity: 0;
}
.impact-flash.hit { animation: impact 0.5s ease-out; }
@keyframes impact {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

.hud { position: absolute; pointer-events: none; z-index: 5; }
.hud-top {
  top: 18px; left: 18px; right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.hud-block {
  min-width: 210px;
  max-width: 300px;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(13, 21, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  color: #fffdf7;
}
.hud-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 253, 247, 0.55);
}
.hud-block strong { display: block; font-size: 14px; letter-spacing: -0.01em; margin: 2px 0 8px; }
.hud-progress { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.hud-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--lime); transition: width 0.15s linear; }
.hud-scenario {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(13, 21, 16, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  color: #fffdf7;
  font-size: 11.5px;
  font-weight: 500;
}
.scenario-swatch { width: 9px; height: 9px; border-radius: 3px; background: var(--lime); }
.hud-clutter {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 253, 247, 0.5);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  padding-left: 8px;
}
.hud-clock-wrap { display: flex; align-items: center; gap: 8px; }
.hud-clock {
  padding: 9px 13px;
  border-radius: 13px;
  background: rgba(13, 21, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  color: #fffdf7;
  text-align: right;
}
.hud-clock span { display: block; font-family: var(--mono); font-size: 16px; letter-spacing: 0.04em; line-height: 1.1; }
.hud-clock small { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 253, 247, 0.5); }
.icon-btn {
  pointer-events: auto;
  width: 39px; height: 39px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(13, 21, 16, 0.72);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.16s;
}
.icon-btn:hover { background: rgba(28, 43, 33, 0.9); }
.icon-btn span { display: block; width: 4px; height: 13px; border-radius: 1px; background: #fffdf7; }

.hud-bottom-left { left: 18px; bottom: 18px; display: flex; align-items: flex-end; gap: 10px; }
.speed-panel {
  padding: 10px 14px 9px;
  border-radius: 13px;
  background: rgba(13, 21, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  color: #fffdf7;
  min-width: 94px;
}
.speed-readout { display: flex; align-items: baseline; gap: 5px; }
.speed-readout strong { font-size: 28px; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.speed-readout span { font-family: var(--mono); font-size: 8px; color: rgba(255, 253, 247, 0.55); }
.lane-panel {
  width: 178px;
  padding: 9px 12px 10px;
  border-radius: 13px;
  background: rgba(13, 21, 16, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  color: #fffdf7;
}
.lane-head { display: flex; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 7px; letter-spacing: 0.07em; color: rgba(255, 253, 247, 0.5); text-transform: uppercase; margin-bottom: 6px; }
.lane-head span:last-child { color: var(--lime); }
.lane-head span:last-child.warn { color: var(--amber); }
.lane-track {
  position: relative;
  height: 18px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.lane-centre { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, 0.28); }
.lane-edge { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(232, 102, 74, 0.65); }
.lane-edge.left { left: 7%; }
.lane-edge.right { right: 7%; }
.lane-car {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 8px; height: 12px;
  border-radius: 2px;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(183, 207, 101, 0.55);
  transform: translateX(-50%);
  transition: left 0.08s linear;
}
.lane-car.warn { background: var(--amber); box-shadow: 0 0 10px rgba(242, 184, 75, 0.6); }

.hud-bottom-right {
  right: 18px; bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px;
  border-radius: 13px;
  background: rgba(13, 21, 16, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  transition: opacity 0.8s;
}
.hud-bottom-right.fade { opacity: 0; }
.hint-group { display: flex; align-items: center; gap: 5px; }
.hint-group > span:last-child { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.06em; color: rgba(255, 253, 247, 0.5); text-transform: uppercase; }
.hint-keys { display: flex; gap: 3px; }
.hud-bottom-right kbd {
  min-width: 21px;
  height: 21px;
  padding: 0 4px;
  font-size: 9px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-width: 2px;
  color: #fffdf7;
  box-shadow: none;
}
.hud-bottom-right kbd.space-key { min-width: 44px; font-size: 6.5px; }

/* prompt card */
.prompt-layer {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 380px));
  z-index: 8;
  pointer-events: none;
}
.prompt-layer.hidden { display: none; }
.prompt-card {
  position: relative;
  border-radius: 17px;
  background: rgba(12, 19, 15, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  color: #fffdf7;
  padding: 14px 18px 17px;
  animation: prompt-in 0.24s var(--ease);
  overflow: hidden;
}
@keyframes prompt-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.prompt-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--lime);
}
.prompt-card.correct { border-color: rgba(183, 207, 101, 0.6); }
.prompt-card.wrong { border-color: rgba(232, 102, 74, 0.65); }
.prompt-card.timeout { border-color: rgba(242, 184, 75, 0.65); }
.prompt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(255, 253, 247, 0.55);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.prompt-time { color: var(--lime); }
.prompt-body { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.prompt-question { margin: 0; font-size: 14px; line-height: 1.35; color: rgba(255, 253, 247, 0.75); max-width: 280px; }
.prompt-display { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; text-align: right; line-height: 1.1; }
.prompt-display .speed-pair { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 16px; font-weight: 500; letter-spacing: 0; }
.prompt-display .speed-pair b { font-size: 26px; letter-spacing: -0.03em; }
.prompt-display .speed-pair i { font-style: normal; color: rgba(255, 253, 247, 0.3); }
.prompt-display .speed-limit { color: var(--amber); }
.prompt-display .speed-now { color: #fffdf7; }
.prompt-display .word-list { display: flex; align-items: center; gap: 9px; font-size: 21px; letter-spacing: -0.01em; }
.prompt-display .word-list i { font-style: normal; color: rgba(255, 253, 247, 0.22); font-weight: 400; }
.prompt-options { display: flex; gap: 8px; margin-top: 12px; }
.prompt-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-weight: 600;
  color: #fffdf7;
  transition: 0.15s;
}
.prompt-option kbd {
  min-width: 20px; height: 20px;
  padding: 0 4px;
  font-size: 9px;
  border-radius: 4px;
  background: rgba(255, 253, 247, 0.92);
  border: 0;
  color: var(--ink);
  box-shadow: none;
}
.prompt-option .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.prompt-option.is-correct { background: rgba(183, 207, 101, 0.2); border-color: rgba(183, 207, 101, 0.6); }
.prompt-option.is-wrong { background: rgba(232, 102, 74, 0.2); border-color: rgba(232, 102, 74, 0.6); }
.prompt-timer { height: 3px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); margin-top: 13px; overflow: hidden; }
.prompt-timer i { display: block; height: 100%; width: 100%; background: var(--lime); border-radius: inherit; }
.prompt-timer i.low { background: var(--coral); }
.prompt-feedback {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(183, 207, 101, 0.18);
  color: var(--lime);
}
.prompt-feedback.bad { background: rgba(232, 102, 74, 0.18); color: #ff9d86; }
.prompt-feedback.warn { background: rgba(242, 184, 75, 0.18); color: var(--amber); }

/* game toast */
.game-toast {
  position: absolute;
  left: 50%;
  top: 84px;
  transform: translate(-50%, -8px);
  z-index: 9;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(12, 19, 15, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fffdf7;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.game-toast.show { opacity: 1; transform: translate(-50%, 0); }
.game-toast.bad { border-color: rgba(232, 102, 74, 0.5); color: #ffb3a1; }

/* overlays */
.block-overlay, .pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 13, 10, 0.6);
  backdrop-filter: blur(7px);
}
.block-overlay.hidden, .pause-overlay.hidden { display: none; }
.block-card, .pause-card {
  width: min(520px, 100%);
  background: var(--panel);
  border-radius: 24px;
  padding: 30px 32px 26px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: card-in 0.35s var(--ease);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.block-kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--forest);
  background: var(--forest-soft);
  border-radius: 999px;
  padding: 5px 10px;
  margin-bottom: 14px;
}
.block-card h2, .pause-card h2 { font-size: 34px; letter-spacing: -0.035em; margin-bottom: 8px; }
.block-card p, .pause-card p { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin-bottom: 18px; }
.block-meta { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }
.block-meta span {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
}
.block-count {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 700;
  line-height: 1;
  color: var(--forest);
  animation: count-pulse 1s var(--ease) infinite;
}
@keyframes count-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.94); }
}
.pause-card .btn { margin-top: 4px; }
.game-loading {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: #0d1511;
  color: rgba(255, 253, 247, 0.6);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: opacity 0.4s;
}
.game-loading.hidden { opacity: 0; pointer-events: none; }
.loader-mark { display: flex; align-items: flex-end; gap: 4px; height: 34px; }
.loader-mark i { display: block; width: 7px; border-radius: 2px; background: var(--lime); animation: loader 0.9s ease-in-out infinite; }
.loader-mark i:nth-child(1) { height: 16px; animation-delay: 0s; }
.loader-mark i:nth-child(2) { height: 24px; animation-delay: 0.12s; }
.loader-mark i:nth-child(3) { height: 34px; animation-delay: 0.24s; }
@keyframes loader {
  0%, 100% { transform: scaleY(0.55); opacity: 0.55; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* --------------------------------- results --------------------------------- */
.results-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}
.results-hero h1 { font-size: clamp(36px, 4.6vw, 58px); margin-bottom: 14px; }
.results-hero .lede { margin-bottom: 0; }
.hero-stamp {
  flex: none;
  min-width: 190px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 18px;
  padding: 16px 18px;
}
.hero-stamp.small { min-width: 140px; }
.hero-stamp span { display: block; font-family: var(--mono); font-size: 8px; letter-spacing: 0.14em; color: #9daa9f; text-transform: uppercase; }
.hero-stamp strong { display: block; font-family: var(--mono); font-size: 21px; color: var(--lime); margin: 5px 0 4px; letter-spacing: 0.03em; }
.hero-stamp small { color: #9daa9f; font-size: 10.5px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 18px 16px;
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: "";
  position: absolute;
  right: -18px; top: -18px;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--lime-soft);
  opacity: 0.65;
}
.metric-label { display: block; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.metric-card strong { display: block; font-size: clamp(28px, 3vw, 38px); letter-spacing: -0.05em; line-height: 1; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; font-size: 10.5px; color: var(--muted); }
.results-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: 22px; align-items: stretch; }
.compare-panel, .scenario-panel { overflow: hidden; display: flex; flex-direction: column; }
.compare-rows { padding: 8px 24px 6px; }
.compare-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.compare-row:last-child { border-bottom: 0; }
.compare-label strong { display: block; font-size: 12.5px; }
.compare-label span { font-family: var(--mono); font-size: 8px; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; }
.compare-bars { display: grid; gap: 5px; }
.bar-line { display: grid; grid-template-columns: 38px minmax(0, 1fr) 46px; align-items: center; gap: 8px; }
.bar-line > span { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; }
.bar-line b { font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--forest); transition: width 0.8s var(--ease); }
.bar-line.dual .bar i { background: var(--amber); }
.delta {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  color: var(--forest);
  background: var(--forest-soft);
  border-radius: 6px;
  padding: 5px 4px;
  font-variant-numeric: tabular-nums;
}
.delta.bad { color: #a94b38; background: var(--coral-soft); }
.delta.flat { color: var(--muted); background: var(--paper-2); }
.panel-footnote { margin: auto 0 0; padding: 12px 24px 16px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); }
.scenario-table-wrap { padding: 8px 18px 0; overflow-x: auto; }
.scenario-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.scenario-table th {
  text-align: right;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 5px;
  border-bottom: 1px solid var(--line);
}
.scenario-table th:first-child, .scenario-table td:first-child { text-align: left; }
.scenario-table td { padding: 10px 5px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.scenario-table tr:last-child td { border-bottom: 0; }
.scenario-table td:first-child { font-weight: 600; font-size: 11.5px; }
.scenario-table .mini-swatch { display: inline-block; width: 6px; height: 6px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }
.hazard-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); margin-top: auto; }
.hazard-summary div { background: var(--panel); padding: 12px 8px; text-align: center; }
.hazard-summary strong { display: block; font-size: 18px; letter-spacing: -0.03em; }
.hazard-summary span { font-family: var(--mono); font-size: 7px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.results-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.export-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------- post survey ------------------------------- */
.post-panel { overflow: hidden; }
.slider-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 34px; padding: 26px 26px 22px; }
.slider-field { display: flex; flex-direction: column; gap: 8px; }
.slider-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.slider-top output { font-family: var(--mono); font-size: 14px; color: var(--forest); background: var(--forest-soft); border-radius: 5px; padding: 2px 7px; }
.strategy-field { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 22px 26px 6px; }
.strategy-field legend { font-size: 12.5px; font-weight: 600; padding: 0 6px 0 0; }
.strategy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.strategy-card { position: relative; cursor: pointer; }
.strategy-card input { position: absolute; opacity: 0; pointer-events: none; }
.strategy-card > span {
  display: block;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  padding: 12px 13px;
  transition: 0.16s;
}
.strategy-card strong { display: block; font-size: 12px; margin-bottom: 2px; }
.strategy-card small { color: var(--muted); font-size: 10.5px; }
.strategy-card:hover > span { border-color: var(--line-strong); background: #fff; }
.strategy-card input:checked + span { border-color: var(--forest); background: var(--forest-soft); box-shadow: 0 0 0 2px rgba(47, 122, 82, 0.08); }
.strategy-card input:focus-visible + span { outline: 3px solid rgba(47, 122, 82, 0.2); outline-offset: 2px; }
.comments-field { margin: 18px 26px 0; }
.post-panel .form-actions { margin-top: 22px; }

/* --------------------------------- thanks ---------------------------------- */
.thanks-card {
  max-width: 720px;
  margin: 30px auto 10px;
  padding: 38px 40px 30px;
  text-align: center;
}
.thanks-mark {
  width: 58px; height: 58px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--forest);
  color: #fff;
  box-shadow: 0 0 0 8px rgba(47, 122, 82, 0.1);
}
.thanks-mark svg { width: 30px; height: 30px; }
.thanks-card h1 { font-size: clamp(34px, 4vw, 46px); margin-bottom: 12px; }
.thanks-card .eyebrow { justify-content: center; }
.thanks-card .lede { margin-left: auto; margin-right: auto; }
.thanks-code {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin: 24px 0 14px;
}
.thanks-code div { background: var(--panel-2); padding: 13px 10px; }
.thanks-code span { display: block; font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.thanks-code strong { display: block; font-family: var(--mono); font-size: 17px; color: var(--ink); margin-top: 3px; }
.thanks-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 22px; }
.thanks-stats div { border-top: 2px solid var(--line-strong); padding-top: 9px; }
.thanks-stats strong { display: block; font-size: 20px; letter-spacing: -0.03em; }
.thanks-stats span { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.04em; color: var(--muted); text-transform: uppercase; }
.thanks-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; }
.thanks-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* --------------------------------- footer ---------------------------------- */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 0 30px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------------------------------- toast ---------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 12px);
  z-index: 100;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #8e3523; }

/* -------------------------------- responsive -------------------------------- */
@media (max-width: 1080px) {
  .welcome-grid { grid-template-columns: 1fr; gap: 34px; }
  .welcome-visual { max-width: 660px; }
  .welcome-copy h1 { font-size: clamp(44px, 8vw, 76px); }
  .survey-layout { grid-template-columns: 1fr; }
  .side-note { position: static; }
  .brief-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app { padding: 0 16px; }
  .topbar { height: auto; padding: 16px 0; align-items: flex-start; }
  .brand-tag { display: none; }
  .topbar-right { gap: 5px; }
  .mini-badge.subtle { display: none; }
  .screen { padding: 16px 0 30px; }
  .page-head { display: block; }
  .progress-card { width: 100%; margin-top: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .state-row { flex-direction: column; align-items: flex-start; gap: 16px; }
  .range-wrap { width: 100%; }
  .control-block { flex-direction: column; align-items: flex-start; }
  .key-row { justify-content: flex-start; }
  .brief-actions { flex-direction: column; align-items: stretch; }
  .start-group { flex-direction: column; align-items: stretch; }
  .results-hero { flex-direction: column; align-items: flex-start; }
  .metric-grid { grid-template-columns: 1fr; }
  .compare-row { grid-template-columns: 1fr 58px; gap: 10px; }
  .compare-label { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; }
  .compare-label span { font-size: 8px; }
  .slider-grid { grid-template-columns: 1fr; }
  .strategy-grid { grid-template-columns: 1fr; }
  .thanks-card { padding: 28px 20px 24px; }
  .thanks-stats { grid-template-columns: 1fr 1fr; }
  .thanks-footer { flex-direction: column; }
  .results-actions { flex-direction: column; align-items: stretch; }
  .export-group { flex-direction: column; }
  .site-footer { flex-direction: column; }
  .hud-bottom-right { display: none; }
  .hud-scenario { display: none; }
  .prompt-layer { width: calc(100% - 36px); bottom: 92px; }
  .game-wrap { min-height: 480px; }
}
@media (max-width: 520px) {
  h1 { font-size: 38px; }
  .welcome-facts { grid-template-columns: 1fr; gap: 8px; }
  .fact { display: flex; align-items: baseline; gap: 8px; }
  .fact strong { font-size: 14px; }
  .welcome-actions { align-items: flex-start; flex-direction: column; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .thanks-code { grid-template-columns: 1fr; }
  .prompt-body { flex-direction: column; align-items: flex-start; gap: 6px; }
  .prompt-display { text-align: left; }
  .prompt-options { flex-direction: column; }
}

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


/* ------------------------------ simplified pages ----------------------------- */
[hidden] { display: none !important; }
body { background: var(--paper); }
.plain-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 0 56px;
  line-height: 1.6;
}
.plain-page.wide { max-width: 940px; }
.plain-page h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 18px; }
.plain-page h2 { font-size: 18px; margin: 26px 0 6px; }
.plain-page h3 { font-size: 15px; margin-bottom: 4px; }
.plain-page p, .plain-page li { font-size: 15px; color: var(--ink-2); }
.plain-page ul { padding-left: 20px; margin: 0 0 12px; }
.plain-page li { margin-bottom: 6px; }
.plain-page kbd { min-width: 26px; height: 26px; font-size: 12px; vertical-align: middle; }
.plain-page kbd.space-key { min-width: 64px; font-size: 10px; }
.consent-line { margin: 28px 0 4px; font-size: 15px; }
.plain-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 24px; }
.plain-actions .btn:only-child { margin-left: auto; }
.plain-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  padding: 8px 0 0;
  margin: 0 0 20px;
}
.plain-fieldset legend { font-weight: 600; font-size: 16px; padding: 0 8px; margin-left: 16px; }
.plain-fieldset .form-grid { padding: 16px 24px 24px; }
.plain-fieldset .state-row { padding: 16px 24px; }
.plain-fieldset .state-row:last-child { border-bottom: 0; }
.plain-fieldset .state-copy h2 { font-size: 15px; font-weight: 500; margin: 0; }
.saved-profile { padding: 12px 24px; margin: 0; }
.plain-page .form-error { margin: 0 0 16px; }
.example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 14px 0 8px; }
.example { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; }
.example p { font-size: 13.5px; margin-bottom: 8px; }
.example-display {
  background: #17211b;
  color: #fffdf7;
  border-radius: 10px;
  text-align: center;
  padding: 12px 8px;
  margin: 10px 0;
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 700;
}
.example-display.small { font-size: 16px; padding: 20px 8px; }
.example-options { white-space: nowrap; overflow-x: auto; }
.example-answer { color: var(--forest-deep) !important; font-weight: 600; margin: 0 !important; }
.plain-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; background: var(--panel); }
.plain-table th, .plain-table td { text-align: left; padding: 10px 12px; border: 1px solid var(--line); vertical-align: top; }
.plain-table th { background: var(--paper-2); font-weight: 600; }
.plain-table td:nth-child(2) { white-space: nowrap; }

/* guided practice coach */
.coach-bar {
  position: absolute;
  left: 50%;
  top: 96px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 40px));
  z-index: 9;
  padding: 14px 20px;
  border-radius: 14px;
  background: rgba(255, 253, 246, 0.96);
  color: var(--ink);
  border-left: 6px solid var(--sky);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
  font-size: 16px;
  line-height: 1.45;
  pointer-events: none;
}
.coach-bar.hidden { display: none; }
.coach-bar.good { border-left-color: var(--forest); }
.coach-bar.bad { border-left-color: var(--coral); }
.practice-card { text-align: left; width: min(600px, 100%); }
.practice-card h2, .practice-card .block-kicker { text-align: center; }
.practice-card .block-kicker { display: table; margin: 0 auto 14px; }
.practice-recap { margin: 0 0 16px; padding-left: 20px; font-size: 14px; color: var(--ink-2); line-height: 1.7; }
.practice-recap kbd { min-width: 24px; height: 24px; font-size: 11px; }
.practice-recap kbd.space-key { min-width: 56px; font-size: 9px; }
.practice-actions { display: flex; justify-content: space-between; gap: 12px; }

/* upload */
.upload-status {
  margin: 8px auto 14px;
  max-width: 520px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--paper-2);
  font-size: 14px;
}
.upload-status.ok { background: var(--forest-soft); color: var(--forest-deep); }
.upload-status.bad { background: var(--coral-soft); color: #8e3523; }
.turnstile-box { min-height: 0; display: flex; justify-content: center; margin: 8px 0; }

@media (max-width: 860px) {
  .example-grid { grid-template-columns: 1fr; }
}


/* ------------------------------- touch / mobile ------------------------------ */
.only-touch { display: none; }
body.touch-mode .only-touch { display: revert; }
body.touch-mode .only-keys { display: none; }
.rotate-hint { background: var(--amber-soft); color: #6d4c16; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.touch-controls { display: none; }

body.touch-mode.in-game { overscroll-behavior: none; }
body.touch-mode.in-game .app { padding: 0; }
body.touch-mode .game-wrap {
  position: fixed;
  inset: 0;
  height: 100dvh;
  min-height: 0;
  border-radius: 0;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
body.touch-mode .hud-bottom-left,
body.touch-mode .hud-bottom-right,
body.touch-mode .hud-scenario { display: none; }
body.touch-mode .icon-btn { width: 46px; height: 46px; }

body.touch-mode .touch-controls { display: block; }
.touch-steer {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  gap: 12px;
  z-index: 12;
}
.touch-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: rgba(13, 21, 16, 0.55);
  color: #fffdf7;
  font: 700 24px/1 var(--font);
  backdrop-filter: blur(6px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.06s, background 0.06s;
}
.touch-btn.is-pressed { background: rgba(183, 207, 101, 0.6); transform: scale(0.94); }
.touch-brake {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 100px;
  height: 100px;
  z-index: 12;
  font-size: 15px;
  letter-spacing: 0.08em;
  background: rgba(201, 74, 56, 0.62);
  border-color: rgba(255, 210, 200, 0.6);
}
.touch-brake.is-pressed { background: rgba(232, 102, 74, 0.95); }

/* answers are tapped directly on the card */
body.touch-mode .prompt-layer {
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(540px, calc(100% - 400px));
}
body.touch-mode .prompt-options { pointer-events: auto; }
body.touch-mode .prompt-option {
  min-height: 46px;
  justify-content: center;
  font-size: 14px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
body.touch-mode .prompt-option:active { background: rgba(255, 255, 255, 0.22); }
body.touch-mode .prompt-option kbd { display: none; }

/* portrait phones: controls along the bottom, question card above them */
@media (orientation: portrait) {
  body.touch-mode .prompt-layer { width: calc(100% - 24px); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 116px); }
  body.touch-mode .prompt-body { flex-direction: column; align-items: flex-start; gap: 6px; }
  body.touch-mode .prompt-display { text-align: left; }
  body.touch-mode .hud-block { min-width: 0; max-width: 58vw; }
}

/* short screens (phones in landscape) */
@media (max-height: 500px) {
  .hud-top { top: 8px; left: 10px; right: 10px; }
  .hud-block { min-width: 0; padding: 7px 10px; }
  .hud-block strong { font-size: 12px; margin: 1px 0 5px; }
  .hud-clock { padding: 6px 10px; }
  .hud-clock span { font-size: 13px; }
  .coach-bar { top: 62px; padding: 8px 14px; font-size: 13px; width: min(620px, calc(100% - 24px)); }
  .game-toast { top: 56px; }
  .prompt-card { padding: 9px 12px 10px; }
  .prompt-head { margin-bottom: 4px; }
  .prompt-question { font-size: 12px; }
  .prompt-display { font-size: 22px; }
  .prompt-display .speed-pair b { font-size: 20px; }
  .prompt-display .word-list { font-size: 16px; }
  .prompt-options { margin-top: 7px; }
  .prompt-timer { margin-top: 8px; }
  .touch-btn { width: 66px; height: 66px; }
  .touch-brake { width: 88px; height: 88px; }
  body.touch-mode .prompt-layer { width: min(520px, calc(100% - 350px)); }
  body.touch-mode .prompt-option { min-height: 40px; }
  .block-overlay, .pause-overlay { padding: 10px; }
  .block-card, .pause-card { max-height: calc(100dvh - 20px); overflow-y: auto; padding: 16px 20px; }
  .block-card h2, .pause-card h2 { font-size: 22px; }
  .block-card p, .pause-card p { font-size: 13px; margin-bottom: 10px; }
  .block-kicker { margin-bottom: 8px; }
  .block-meta { margin-bottom: 10px; }
  .block-count { font-size: 34px; }
  .practice-recap { font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
}

@media (max-width: 520px) {
  .plain-page { padding: 24px 0 40px; }
  .plain-page h1 { font-size: 26px; }
  .plain-table { font-size: 13px; }
  .plain-table th, .plain-table td { padding: 8px; }
  .plain-actions .btn { flex: 1; }
}

body.touch-mode .prompt-options { flex-direction: row; }
body.touch-mode .example kbd { display: none; }

/* ------------------------- plain text instead of badges ------------------------ */
.block-kicker, .tag, .delta, .prompt-feedback {
  background: none !important;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-family: var(--font);
  letter-spacing: 0;
  text-transform: none;
}
.block-kicker { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.block-meta { gap: 0; }
.block-meta span {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-3);
}
.block-meta span + span::before { content: "\00B7"; margin: 0 8px; color: var(--muted); }
.delta { font-size: 14px; font-weight: 600; }
.prompt-feedback { font-size: 13px; font-weight: 600; }
.practice-card .block-kicker { display: block; margin: 0 0 6px; }
.upload-retry { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.upload-status { margin: 0 0 14px; max-width: none; }
.slider-top output { background: none; padding: 0; font-family: var(--font); font-size: 15px; font-weight: 600; }
.range-ends { font-family: var(--font); font-size: 11px; text-transform: none; letter-spacing: 0; }
