:root {
  --bg: #f7f7f5;
  --fg: #111;
  --muted: #666;
  --border: #ddd;
  --bike-default: #111;
  --arc-default: #1f77b4;
  --bike-full: #c0392b;
  --arc-full: #c0392b;
  --bike-empty: #e8a0a0;
  --arc-empty: #e8a0a0;
  --actual: #111;
  --predicted: #1f77b4;
  --ci: #1f77b4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

main {
  max-width: 420px;
  margin: 0 auto;
  padding: 0 0 24px;
}

header {
  padding: 12px 14px 6px;
}
header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
header .sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}
header .sub.updated {
  font-variant-numeric: tabular-nums;
}

#map {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #e7e9eb;
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  touch-action: none;
}
#map svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* markers */
.station { cursor: pointer; }
.station .halo {
  fill: white;
  fill-opacity: 0.85;
  stroke: rgba(0, 0, 0, 0.12);
  stroke-width: 0.5;
}
.station .arc {
  fill: var(--arc-default);
}
.station .bike path {
  fill: var(--bike-default);
}
.station.risk-full .arc { fill: var(--arc-full); }
.station.risk-full .bike path { fill: var(--bike-full); }
.station.risk-empty .arc { fill: var(--arc-empty); }
.station.risk-empty .bike path { fill: var(--bike-empty); }
.station .selection-ring {
  fill: none;
  stroke: none;
  pointer-events: none;
}
.station.selected .selection-ring {
  stroke: #111;
  stroke-width: 2.5;
}
.station.selected .halo {
  fill-opacity: 1;
}

.tap-hint {
  margin: 12px 14px 0;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.tap-hint[hidden] { display: none; }

/* info card */
#info-card {
  position: relative;
  margin: 12px 14px 0;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}
#info-card[hidden] { display: none; }
#info-card h2 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  padding-right: 24px;
}
#info-card p {
  margin: 2px 0;
  font-size: 13px;
}
#info-occ { color: var(--fg); }
#info-probs { color: var(--muted); }
#info-probs .danger { color: var(--bike-full); font-weight: 600; }
#info-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

/* charts */
.chart {
  margin: 12px 14px 0;
  padding: 8px 12px 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.chart[hidden] { display: none; }
.chart h3 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}
.chart .axis text { font-size: 10px; fill: var(--muted); }
.chart .axis path, .chart .axis line { stroke: var(--border); }

/* chart 1 specifics — pips (one rect per dock) + CI whisker */
#chart-current svg { width: 100%; height: auto; }
#chart-current .row-label { font-size: 11px; fill: var(--muted); }
#chart-current .row-value { font-size: 11px; fill: var(--fg); font-weight: 600; }
#chart-current .track { fill: #e6e6e6; stroke: #d0d0d0; stroke-width: 0.5; }
#chart-current .fill-now { fill: var(--actual); }
#chart-current .fill-pred { fill: var(--predicted); }
/* CI in a contrasting colour so it stands out against the blue +30 row */
#chart-current .ci-bar { stroke: #c0392b; stroke-width: 1.5; }
#chart-current .ci-cap { stroke: #c0392b; stroke-width: 1.5; }
#chart-current .ci-caption { font-size: 10px; fill: #c0392b; }

/* chart 2 specifics */
#chart-history svg { height: 140px; }
#chart-history .actual { fill: none; stroke: var(--actual); stroke-width: 1.5; }
#chart-history .predicted { fill: none; stroke: var(--predicted); stroke-width: 1.5; stroke-dasharray: 3 3; }
#chart-history .ci-band { fill: var(--ci); fill-opacity: 0.15; }
#chart-history .cap-line { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 2 3; }
#chart-history .legend { font-size: 11px; color: var(--muted); margin: 4px 0 0; }
.chart .legend .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  vertical-align: middle;
  margin: 0 4px 0 8px;
  border-radius: 2px;
}
.chart .legend .swatch.actual { background: var(--actual); }
.chart .legend .swatch.predicted { background: var(--predicted); }
.chart .legend .swatch.ci { background: var(--ci); opacity: 0.3; }
.chart .legend .swatch.cap {
  background: transparent;
  border-top: 2px dashed #999;
  border-radius: 0;
  height: 0;
  margin-top: 4px;
}

footer {
  margin: 16px 14px 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
footer p { margin: 2px 0; }
footer a { color: var(--muted); }
