:root {
  /* Speed ramp: stopped -> red, amber at half the equilibrium speed, green at
     the equilibrium, blue past it (escaping a jam). One OKLCH sweep at fixed
     L=0.70 and C=0.150, hue 29/70/145/264 — only the hue moves, so every stop
     carries the same weight. Kept in sync with RED/AMBER/GREEN/BLUE in
     nagel.js — the canvas can't read CSS vars. */
  --red: #ed7666;
  --amber: #d98b09;
  --green: #5bb661;
  --blue: #6e9bfb;

  /* UI accent, deliberately separate from the ramp above: the controls are
     chrome and should stay quiet when the ramp colours change. */
  --accent: #9dc0ee;
  --bg: #fafafa;
  --panel: #ffffff;
  --ink: #222;
  --muted: #666;
  --line: #e2e2e2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 16px;
}

p {
  max-width: 62ch;
}

/* --- Widget ----------------------------------------------------------- */

.layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  margin: 28px 0;
}

.board {
  flex: 1 1 460px;
  min-width: 300px;
}

#road {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 0.95rem;
  color: var(--muted);
}

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

.hint {
  margin: 10px 0 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 0.85rem;
}

.panel {
  flex: 1 1 280px;
  min-width: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.control { margin-bottom: 18px; }

.control label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.control small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.buttons {
  display: flex;
  gap: 8px;
  margin: 22px 0 0;
}

button {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover { background: #f4f4f4; }

button.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

button.primary:hover { background: #eba960; }

#spacetime {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  image-rendering: pixelated;
}

