:root {
  --bg: #faf8fc;
  --surface: #ffffff;
  --ink: #1d1626;
  --muted: #6b6477;
  --line: #e6e0ee;
  --accent: #6d3fc4;
  --accent-soft: #efe8fb;
  --hero-a: #3b1d6e;
  --hero-b: #7b3fb8;
  --good: #1f9d61;
  --mid: #d99a1c;
  --bad: #d2483c;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14101b;
    --surface: #1d1727;
    --ink: #efeaf6;
    --muted: #a49bb3;
    --line: #322a40;
    --accent: #b592f2;
    --accent-soft: #2b2140;
    --hero-a: #24123f;
    --hero-b: #4c2780;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.hero {
  background: linear-gradient(135deg, var(--hero-a), var(--hero-b));
  color: #fff;
  padding: 44px 0 34px;
}
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
h1 { margin: 6px 0 4px; font-size: clamp(32px, 6vw, 52px); line-height: 1.05; letter-spacing: -.02em; text-wrap: balance; }
.sub { margin: 0; opacity: .88; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 34px; margin: 26px 0 0; }
.facts div { min-width: 96px; }
.facts dt { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .72; }
.facts dd { margin: 0; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }

section { margin: 38px 0; }
h2 { font-size: 22px; margin: 0 0 10px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 22px 0 8px; }
.lede { margin: 0 0 14px; max-width: 78ch; }
.hint, .legend, footer { color: var(--muted); font-size: 13px; }
footer { padding-bottom: 40px; }
code { font-size: 13px; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tablewrap.tall { max-height: 520px; overflow-y: auto; margin-top: 14px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { color: var(--muted); display: block; }
#ranking tbody tr, #chargers tbody tr { cursor: pointer; }
#ranking tbody tr:hover, #chargers tbody tr:hover { background: var(--accent-soft); }
#ranking tr.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
#chargers tr.planned td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.tag { display: inline-block; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); vertical-align: 1px; }
.tag.est { border-color: var(--mid); color: var(--mid); }
.tag.have { border-color: var(--accent); color: var(--accent); }

.params { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 18px; }
.params label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.params span { color: var(--ink); font-size: 14px; }
input[type=number], select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px;
}
input[type=number] { width: 78px; }
.passes { border: 1px solid var(--line); border-radius: var(--radius); margin: 18px 0 0; padding: 10px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 16px; background: var(--surface); }
.passes legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.passes label { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.passes small { color: var(--muted); }

.legs { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; }
.stops { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.stops li { position: relative; padding: 0 0 16px 20px; }
.stops li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.stops li.end::before { background: var(--muted); }
.stops b { font-weight: 650; }
.stops .meta { color: var(--muted); font-size: 13px; }
.stops .cost { float: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.filters .count { margin-left: auto; }
#map { height: 480px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.legend { margin: 8px 0 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 12px; }
.dot:first-child { margin-left: 0; }
.dot.ring { background: transparent; border: 3px solid var(--accent); }
.leaflet-popup-content { font: 13px/1.45 system-ui, sans-serif; }
.leaflet-popup-content b { font-size: 14px; }

#caveats ul { padding-left: 20px; max-width: 86ch; }
#caveats li { margin-bottom: 6px; }

@media (max-width: 600px) {
  #map { height: 360px; }
  th, td { padding: 7px 9px; }
}
