  :root {
    --bg: #0e1116;
    --panel: #151a22;
    --line: #2a3240;
    --text: #e8ecf2;
    --muted: #9aa5b5;
    --dem: #3b5bdb;
    --rep: #d72f30;
    --oth: #5d6c82;
    --accent: #f2c14e;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
  .app { display: grid; grid-template-columns: 390px 1fr; height: 100vh; }
  aside { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; padding: 22px 22px 32px; }
  main { position: relative; min-width: 0; }
  #stage { position: absolute; inset: 0; }
  #stage canvas { display: block; touch-action: none; }
  h1 { font-size: 22px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.01em; }
  .sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
  h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 24px 0 10px; font-weight: 600; }
  p { margin: 0 0 10px; }
  b.hl { color: var(--accent); font-weight: 650; }
  .bars { display: grid; gap: 12px; }
  .bar-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
  .bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; font-size: 12px; font-weight: 600; }
  .bar span { display: flex; align-items: center; padding: 0 7px; white-space: nowrap; color: #fff; overflow: hidden; }
  .bar .d { background: var(--dem); }
  .bar .r { background: var(--rep); justify-content: flex-end; }
  .bar .o { background: var(--oth); padding: 0; }
  .bar-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
  .legend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; font-size: 11px; color: var(--muted); text-align: center; }
  .legend i { display: block; height: 12px; border-radius: 2px; margin-bottom: 3px; }
  .legend-title { font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
  .controls { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
    background: rgba(21,26,34,.88); border: 1px solid var(--line); border-radius: 999px; padding: 8px 10px 8px 8px; backdrop-filter: blur(6px);
    max-width: calc(100% - 32px); }
  button { font: inherit; font-weight: 600; color: #111; background: var(--accent); border: 0; border-radius: 999px; padding: 9px 18px; cursor: pointer; white-space: nowrap; }
  button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); padding: 8px 14px; }
  button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  input[type=range] { width: 180px; accent-color: var(--accent); }
  .hint { position: absolute; bottom: 76px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; padding: 0 16px; }
  .races { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 4; pointer-events: none; }
  .races button { pointer-events: auto; background: rgba(21,26,34,.88); color: var(--text); border: 1px solid var(--line); padding: 7px 14px; font-size: 14px; }
  .races button[aria-pressed="true"] { background: var(--accent); color: #111; border-color: var(--accent); }
  .races select { pointer-events: auto; font: inherit; font-size: 14px; color: var(--text); background: rgba(21,26,34,.88); border: 1px solid var(--line);
    border-radius: 999px; padding: 7px 12px; max-width: 100%; cursor: pointer; }
  .races select option, .races select optgroup { background: var(--panel); color: var(--text); }
  #tip { position: absolute; pointer-events: none; background: rgba(14,17,22,.95); border: 1px solid var(--line); border-radius: 8px;
    padding: 10px 12px; font-size: 13px; min-width: 230px; display: none; z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
  #tip .n { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
  #tip .row { display: flex; justify-content: space-between; gap: 14px; }
  #tip .m { color: var(--muted); }
  .label { position: absolute; pointer-events: none; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000, 0 0 2px #000;
    transform: translate(-50%, -120%); white-space: nowrap; opacity: 0; }
  .label small { display: block; font-weight: 500; color: #d7dde6; text-align: center; }
  .sources { font-size: 12.5px; color: var(--muted); }
  .sources ol { padding-left: 18px; margin: 0 0 10px; }
  .sources li { margin-bottom: 6px; }
  .sources a { color: #b8c3d4; }
  #loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 16px; }
  @media (max-width: 820px) {
    .app { grid-template-columns: 1fr; grid-template-rows: 62vh auto; height: auto; }
    main { order: -1; height: 62vh; }
    aside { border-right: 0; border-top: 1px solid var(--line); padding: 18px 16px 28px; }
    input[type=range] { width: 90px; }
    .hint { display: none; }
    .races button { display: none; }
    .races select { width: 100%; }
    button { padding: 8px 12px; }
  }
/* "How we got there" link on the 2026 page, and the way back on the history page */
.cta { display: block; margin: 4px 0 6px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 10px; color: var(--text);
  text-decoration: none; background: rgba(242,193,78,.08); }
.cta:hover, .cta:focus-visible { background: rgba(242,193,78,.16); }
.cta b { color: var(--accent); display: block; font-size: 15px; }
.cta span { font-size: 12.5px; color: var(--muted); }
.back { display: inline-block; font-size: 13px; color: var(--accent); margin: 0 0 12px; text-decoration: none; }
.back:hover { text-decoration: underline; }
/* history page: every race in one table */
.races-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.races-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 0 3px 4px 0; white-space: nowrap; }
.races-table td { padding: 4px 3px 4px 0; border-top: 1px solid var(--line); white-space: nowrap; }
.races-table tr.yr td { border-top-color: #4a5568; }
.races-table .n { text-align: right; }
.races-table a { color: var(--text); }
.races-table tr.cur td, .races-table tr.cur a { color: var(--accent); font-weight: 650; }
.table-wrap { overflow-x: auto; }

/* City and town names on the maps (cities.js): a small dot at the place and its name beside it (cities.js places each
   label with a transform, so these have no margins) */
.city-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; transition: opacity .3s; }
.city { position: absolute; left: 0; top: 0; padding-left: 10px; font-size: 11px; line-height: 14px; box-sizing: border-box;
  color: #dfe5ee; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 1px #000; white-space: nowrap; opacity: 0; transition: opacity .25s; }
.city::before { content: ''; position: absolute; left: 0; top: 4px; width: 6px; height: 6px; border-radius: 50%;
  background: #f4f6f9; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.city.on { opacity: .92; }
.city.city-mid { font-size: 12px; font-weight: 600; line-height: 16px; }
.city.city-mid::before { top: 5px; }
.city.city-big { font-size: 13.5px; font-weight: 700; line-height: 18px; }
.city.city-big::before { top: 6px; }
/* name to the left of the dot, above it, or below it */
.city.l { padding-left: 0; padding-right: 10px; }
.city.l::before { left: auto; right: 0; }
.city.a { padding: 0 0 8px; }
.city.a::before { left: calc(50% - 3px); top: auto; bottom: 0; }
.city.b { padding: 8px 0 0; }
.city.b::before { left: calc(50% - 3px); top: 0; }
