:root {
  --bg: #0C0C0C;
  --panel: #141414;
  --track: #1E1E1E;
  --line: #2E2E2E;
  --grid: #171717;
  --fg: #F4F4EE;
  --soft: #D2D2CA;
  --muted: #A8A8A0;
  --accent: #C6F135;
  --slow: #FF8A57;
  --display: 'Chakra Petch', 'Arial Narrow', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--fg); }
a:hover { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.muted { color: var(--muted); }
.no-js .js-only { display: none; }
.nb { white-space: nowrap; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 30;
  background: var(--accent); color: var(--bg); font-weight: 600;
  padding: 10px 14px; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--bg); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 24px;
  font-family: var(--display); font-weight: 700; font-size: 17px; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  color: var(--bg); background: var(--accent); border: 2px solid var(--accent);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { color: var(--bg); transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--fg); }
.btn:active { transform: none; box-shadow: none; }
.btn-small { min-height: 44px; padding: 0 16px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; }
.btn-ghost { background: transparent; color: var(--fg); border-color: var(--fg); }
.btn-ghost:hover { color: var(--fg); box-shadow: 4px 4px 0 var(--accent); }
.btn-dark { background: var(--bg); color: var(--fg); border-color: var(--bg); }
.btn-dark:hover { color: var(--fg); box-shadow: 4px 4px 0 #4C5E12; }
.btn-outline-dark { background: transparent; color: var(--bg); border-color: var(--bg); }
.btn-outline-dark:hover { color: var(--bg); box-shadow: 4px 4px 0 var(--bg); }

/* HUD */
.hud { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 2px solid var(--line); }
.hud-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 24px;
  padding-top: 8px; padding-bottom: 8px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
}
.brand { font-weight: 700; font-size: 15px; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.status { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 22px; }
.nav > a:not(.btn) { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }

.ach { position: relative; }
.no-js .ach { display: none; }
.ach-btn {
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--fg);
  background: transparent; border: 2px solid var(--line); min-height: 44px; padding: 0 12px; cursor: pointer;
}
.ach-btn:hover { border-color: var(--accent); }
.ach-btn span { color: var(--accent); font-weight: 700; margin-left: 6px; }
.ach-panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: 290px; z-index: 25;
  background: var(--panel); border: 2px solid var(--accent); box-shadow: 6px 6px 0 var(--accent); padding: 16px;
  text-transform: none; letter-spacing: 0;
}
.ach-title { font-family: var(--display); font-weight: 700; font-size: 18px; text-transform: uppercase; margin-bottom: 10px; }
.ach-list li { display: flex; flex-direction: column; padding: 8px 0 8px 26px; border-top: 1px solid var(--line); position: relative; color: var(--muted); }
.ach-list li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 12px; height: 12px; border: 2px solid var(--muted); }
.ach-list li.is-unlocked { color: var(--fg); }
.ach-list li.is-unlocked::before { background: var(--accent); border-color: var(--accent); }
.ach-name { font-family: var(--body); font-weight: 600; font-size: 15px; }
.ach-hint { font-family: var(--body); font-size: 13px; }

/* Hero */
.hero {
  border-bottom: 2px solid var(--line);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
}
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 48px 56px; padding-top: 72px; padding-bottom: 80px; }
.hero-copy { flex: 1 1 420px; min-width: 0; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.eyebrow.muted { color: var(--muted); margin-bottom: 20px; }
h1 {
  font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(44px, 7vw, 84px); line-height: 0.98; margin-bottom: 24px;
}
.hl { color: var(--accent); }
.lede { font-size: 19px; color: var(--soft); max-width: 520px; margin-bottom: 32px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Race */
.race {
  flex: 1 1 420px; min-width: 0; background: var(--bg);
  border: 2px solid var(--accent); box-shadow: 8px 8px 0 var(--accent); padding: 24px;
}
.race-meta {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 6px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.race-title { font-family: var(--display); font-weight: 600; font-size: 22px; line-height: 1.25; margin-bottom: 20px; }
.lane { margin-bottom: 18px; }
.lane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.lane-label { font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.lane-time { font-family: var(--mono); font-weight: 700; font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; }
.lane-before .lane-label, .lane-before .lane-time { color: var(--slow); }
.lane-after .lane-label, .lane-after .lane-time { color: var(--accent); }
.track { height: 18px; background: var(--track); border: 1px solid var(--line); }
.bar { height: 100%; min-width: 2px; }
.lane-before .bar { background: var(--slow); }
.lane-after .bar { background: var(--accent); }
.race-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 20px; }
.race-controls .btn { min-height: 48px; font-size: 16px; }
.race-verdict { flex: 1 1 200px; font-size: 14px; color: var(--soft); }
.race-note { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* Sections */
.section { padding-top: 72px; }
.section-last { padding-bottom: 72px; }
.title { font-family: var(--display); font-weight: 700; font-size: clamp(32px, 4.5vw, 40px); line-height: 1.1; text-transform: uppercase; margin-bottom: 28px; }

/* Leaderboard */
.board { border-top: 2px solid var(--line); }
.board li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; padding: 22px 0; border-bottom: 2px solid var(--line); }
.rank { font-family: var(--mono); font-weight: 700; font-size: 22px; color: var(--accent); }
.run { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; }
.run strong { font-weight: 600; font-size: 19px; }
.run span { color: var(--muted); }
.result { font-family: var(--mono); font-weight: 700; font-size: 26px; }
.result em { font-style: normal; font-size: 16px; color: var(--accent); }

/* Levels */
.level-select { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.level-btn {
  flex: 1 1 200px; text-align: left; font-family: inherit; cursor: pointer;
  background: transparent; color: var(--fg); border: 2px solid var(--line);
  padding: 14px 16px; min-height: 76px; display: flex; flex-direction: column;
}
.level-btn:hover { border-color: var(--accent); }
.level-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.level-tag { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.level-name { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.2; }
.level-years { font-size: 14px; }
.level-panels { display: flex; flex-direction: column; gap: 16px; }
.level-panel { border: 2px solid var(--line); background: var(--panel); padding: 28px; }
.level-panel h3 { font-family: var(--display); font-weight: 700; font-size: 24px; line-height: 1.25; }
.level-panel .muted { margin: 2px 0 16px; }
.level-panel ul { list-style: square; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.level-panel li::marker { color: var(--accent); }
.level-pitch { font-size: 18px; max-width: 640px; margin-bottom: 20px; }
.js .level-panel[hidden] { display: none; }

/* Modes */
.modes { display: flex; flex-wrap: wrap; gap: 16px; }
.mode { flex: 1 1 230px; min-width: 0; border: 2px solid var(--line); padding: 22px; display: flex; flex-direction: column; gap: 10px; transition: border-color 0.12s ease, transform 0.12s ease; }
.mode:hover { border-color: var(--accent); transform: translateY(-3px); }
.mode-no { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: var(--muted); }
.mode h3 { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.2; }
.mode p { color: var(--soft); }
.mode .proof { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--accent); }

/* Loadout */
.loadout { border-bottom: 2px solid var(--line); }
.loadout > div { display: flex; flex-wrap: wrap; gap: 4px 32px; padding: 14px 0; border-top: 2px solid var(--line); }
.loadout dt { flex: 0 0 200px; padding-top: 3px; font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.loadout dd { flex: 999 1 420px; min-width: 0; }

/* Footer */
.start { background: var(--accent); color: var(--bg); padding: 72px 0; }
.start .eyebrow { color: var(--bg); font-weight: 700; }
.start h2 { font-family: var(--display); font-weight: 700; font-size: clamp(40px, 6vw, 72px); line-height: 1; text-transform: uppercase; margin-bottom: 16px; }
.start .lede { color: var(--bg); max-width: 560px; margin-bottom: 28px; }
.start :focus-visible { outline-color: var(--bg); }
.ach-all { margin-top: 28px; font-family: var(--display); font-weight: 700; font-size: 20px; }
.fine { margin-top: 28px; font-family: var(--mono); font-size: 13px; }
.fine + .fine { margin-top: 6px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 40; max-width: calc(100vw - 32px);
  transform: translate(-50%, 140%); opacity: 0;
  background: var(--bg); color: var(--fg); border: 2px solid var(--accent); box-shadow: 6px 6px 0 var(--accent);
  padding: 12px 18px; font-family: var(--mono); font-size: 14px;
  transition: transform 0.25s ease, opacity 0.25s ease; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 720px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  html { scroll-padding-top: 16px; }
  .hud { position: static; }
  .status { order: 3; flex-basis: 100%; min-height: 32px; }
  .nav { gap: 0 16px; }
  .ach-panel { right: auto; left: 0; width: min(290px, calc(100vw - 32px)); }
  .hero-row { padding-top: 40px; padding-bottom: 56px; gap: 40px; }
  .race { padding: 18px; box-shadow: 5px 5px 0 var(--accent); }
  .lane-time { font-size: 28px; }
  .section { padding-top: 56px; }
  .section-last { padding-bottom: 56px; }
  .level-btn { flex-basis: 140px; }
  .level-panel { padding: 20px; }
  .result { font-size: 22px; }
  .loadout dt { flex-basis: 100%; }
  .start { padding: 56px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dot { animation: none; }
  .btn, .mode, .toast { transition: none; }
  .btn:hover, .mode:hover { transform: none; }
}
