/* Desktop-first, per the decision on 2026-07-27; the board is a wide table
   and the wide table is the point. It still degrades: the board scrolls
   sideways inside .scroll rather than breaking the page. */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666;
  --line: #e2e2e2;
  --panel: #fafafa;
  --accent: #0b57d0;
  --good: #0a7d33;
  --warn-bg: #fff3cd;
  --warn-fg: #7a5c00;
  --bad: #b00020;
  --rec: #e8f0fe;
  --used: #999;
  --peak: #e6f4ea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111417;
    --fg: #e6e6e6;
    --muted: #9aa0a6;
    --line: #2c3136;
    --panel: #191d21;
    --accent: #8ab4f8;
    --good: #6ddb8f;
    --warn-bg: #3a3000;
    --warn-fg: #ffd75e;
    --bad: #ff7b8a;
    --rec: #1c2a40;
    --used: #777;
    --peak: #16301e;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }

header {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 0.6rem; }
h2 .tt { color: var(--muted); font-weight: normal; font-size: 0.85rem; }

#races a {
  margin-right: 0.9rem;
  text-decoration: none;
  padding: 0.15rem 0;
}
#races a.active {
  border-bottom: 2px solid var(--accent);
  font-weight: 600;
}
#asof { margin-left: auto; color: var(--muted); font-size: 0.9rem; }

#stale {
  background: var(--warn-bg);
  color: var(--warn-fg);
  padding: 0.6rem 1.2rem;
  font-weight: 600;
}

main { padding: 1rem 1.2rem; max-width: 1400px; }
.cols { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  flex: 1 1 420px;
}
.panel.wide { flex-basis: 100%; }
.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 0.28rem 0.55rem; border-bottom: 1px solid var(--line); }
th { text-align: right; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
th.l, td.l { text-align: left; }
td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.l { white-space: normal; }

.board .pk { font-weight: 700; }
.board td.l { white-space: nowrap; }
.board .peak { background: var(--peak); font-weight: 700; }
.board .best { background: var(--peak); }
.board tr.rec { background: var(--rec); }
.board tr.used td { color: var(--used); }
.board tr.used .badge {
  background: var(--used);
  color: var(--bg);
  border-radius: 4px;
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
}
.thin { color: var(--bad); font-size: 0.78rem; cursor: help; }
.today { color: var(--good); font-weight: 700; }

.rec-line { margin-top: 0.7rem; }
.rec-line p { margin: 0.25rem 0; }
.save, .note { color: var(--muted); font-size: 0.9rem; }

/* Panels are prose-and-status tables, not number grids: left-align and wrap,
   or long reasons walk off the right edge of the viewport. */
.sens th, .sens td, .inputs th, .inputs td {
  text-align: left;
  white-space: normal;
}
.sens td:nth-child(3), .inputs td { font-variant-numeric: normal; }
.inputs td.num { text-align: right; }

.ok { color: var(--good); }
.miss, .warn { color: var(--bad); }
p.warn { font-weight: 600; }
.why { color: var(--muted); font-size: 0.85rem; }
.na td { color: var(--muted); }
.scen { font-size: 0.9rem; }
.scen.flip { color: var(--bad); font-weight: 600; }

details { margin-top: 0.6rem; font-size: 0.9rem; }
summary { cursor: pointer; color: var(--muted); }

#pick-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  margin-bottom: 1rem;
}
.pick-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin: 0.6rem 0 0.3rem;
  flex-wrap: wrap;
}
.pick-row select, .pick-row button {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
}
.pick-row button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  font-weight: 600;
  cursor: pointer;
}

footer {
  padding: 0.8rem 1.2rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
}

.loading { color: var(--muted); }

body.login main {
  max-width: 26rem;
  margin: 18vh auto;
  text-align: center;
}
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 0.55rem 1.4rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
}
