:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --ink: #16202b;
  --muted: #5b6878;
  --line: #dde3ea;
  --accent: #1f4e79;
  --accent-ink: #ffffff;
  --accent-soft: #e3edf7;
  --dot: #d1495b;
  --dot-sel: #1f4e79;
  --state: #e9eef4;
  --state-edge: #9fb1c4;
  --warn: #9a5b00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --card: #182029;
    --ink: #e7edf3;
    --muted: #9aa8b6;
    --line: #2a3542;
    --accent: #7fb2e5;
    --accent-ink: #0f1419;
    --accent-soft: #1d2c3b;
    --dot: #ff7a85;
    --dot-sel: #7fb2e5;
    --state: #1b2530;
    --state-edge: #3d4d5e;
    --warn: #f0b35a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main, .top, .foot { max-width: 760px; margin: 0 auto; padding: 0 16px; }

.top { padding-top: 22px; padding-bottom: 6px; }
.top h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.sub .stale { color: var(--warn); font-weight: 600; }

.controls {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.label { font-size: 0.85rem; font-weight: 600; color: var(--muted); min-width: 108px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .town-filter button {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.chips button[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
select {
  font: inherit;
  font-size: 0.95rem;
  padding: 6px 10px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.map {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
}
.map svg { display: block; width: 100%; height: auto; }
.ct { fill: var(--state); stroke: var(--state-edge); stroke-width: 2; stroke-linejoin: round; }
.dot { fill: var(--dot); fill-opacity: 0.85; stroke: var(--card); stroke-width: 2; cursor: pointer; }
.dot:focus { outline: none; stroke: var(--ink); stroke-width: 3; }
.dot.sel { fill: var(--dot-sel); fill-opacity: 1; }
.dot-count { fill: #fff; font-size: 15px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.dot-label { fill: var(--ink); font-size: 17px; font-weight: 600; paint-order: stroke; stroke: var(--state); stroke-width: 4px; pointer-events: none; }
.origin-mark { fill: var(--accent); }
.origin-label { fill: var(--accent); font-size: 16px; font-weight: 700; paint-order: stroke; stroke: var(--state); stroke-width: 4px; }
.town-filter { margin: 8px 6px 2px; font-size: 0.92rem; color: var(--muted); }

#list { margin: 16px 0 8px; }
.day { margin: 18px 0 8px; }
.day h2 {
  margin: 0 0 8px;
  font-size: 1.05rem;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.day h2 .n { font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.game {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 2px 12px;
  align-items: start;
  padding: 11px 14px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.game .time { font-weight: 700; font-variant-numeric: tabular-nums; padding-top: 1px; white-space: nowrap; }
.game .where { font-weight: 600; }
.game .meta { color: var(--muted); font-size: 0.88rem; }
.game .dist { color: var(--muted); font-size: 0.88rem; white-space: nowrap; padding-top: 2px; font-variant-numeric: tabular-nums; }
.lvl {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  vertical-align: 1px;
}
.need { color: var(--dot); font-weight: 600; }
.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.foot { color: var(--muted); font-size: 0.85rem; padding-top: 8px; padding-bottom: 32px; }
.foot p { margin: 6px 0; }

@media (max-width: 480px) {
  .top h1 { font-size: 1.4rem; }
  .label { min-width: 0; width: 100%; }
  .game { grid-template-columns: 70px 1fr; gap: 2px 10px; padding: 11px 12px; }
  .game .time { font-size: 0.94rem; }
  .chips { gap: 5px; }
  .chips button { padding: 5px 10px; font-size: 0.86rem; }
  .game .dist { grid-column: 2; padding-top: 0; }
}
