:root {
  color-scheme: dark;
  --bg: #101923;
  --panel: #172432;
  --panel-strong: #203244;
  --text: #f4f8fb;
  --muted: #a8b8c7;
  --accent: #4db3ff;
  --good: #73d179;
  --warn: #ffd166;
  --bad: #ff6b6b;
  --border: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.network-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px);
}

.network-header,
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.network-header { margin-bottom: 30px; }
.back-link { display: inline-block; margin-bottom: 22px; color: var(--accent); font-weight: 750; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(32px, 5vw, 54px); line-height: 1.05; }
h2 { margin-bottom: 0; font-size: clamp(21px, 3vw, 28px); }
.intro { max-width: 60ch; margin-bottom: 0; color: var(--muted); }

.network-status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 14px;
}

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.network-status.ok .status-dot { background: var(--good); }
.network-status.error .status-dot { background: var(--bad); }

.route-section, .other-section { margin-top: 28px; }
.section-heading { margin-bottom: 14px; }
.updated { color: var(--muted); font-size: 13px; }
.route-list { display: grid; gap: 14px; }

.route-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, .45fr) minmax(0, 1fr);
  align-items: stretch;
  gap: 12px;
}

.station {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.station-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.station-name { margin: 0; font-size: 18px; line-height: 1.25; }
.station-link { color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.station-link:hover { color: var(--accent); }
.train-list { display: grid; gap: 9px; }
.train { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 8px; min-width: 0; }
.train-time { font-size: 20px; font-weight: 850; font-variant-numeric: tabular-nums; }
.line-badge { padding: 3px 7px; border-radius: 5px; background: #e7f4ff; color: #0f4167; font-size: 12px; font-weight: 900; }
.train-destination { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.train-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; }
.delay { color: var(--good); font-weight: 800; }
.delay.late { color: var(--warn); }
.delay.cancelled { color: var(--bad); }
.empty, .station-error { margin: 0; color: var(--muted); font-size: 13px; }

.rail-link { display: grid; align-content: center; justify-items: center; gap: 7px; color: var(--muted); text-align: center; }
.rail-label { font-size: 12px; font-weight: 750; line-height: 1.25; }
.rail-track { position: relative; width: 100%; height: 20px; }
.rail-track::before, .rail-track::after { position: absolute; top: 6px; right: 0; left: 0; height: 4px; background: var(--accent); content: ""; }
.rail-track::after { top: 14px; height: 2px; background: rgba(77,179,255,.35); }
.rail-track span { position: absolute; z-index: 1; top: 2px; left: calc(50% - 8px); width: 16px; height: 16px; border: 3px solid var(--bg); border-radius: 50%; background: var(--accent); }

.station-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.note { margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--warn); background: rgba(255,209,102,.08); color: var(--muted); font-size: 13px; line-height: 1.45; }
.network-note { margin: 24px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.network-footer { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

@media (max-width: 700px) {
  .network-shell { padding: 18px 14px 28px; }
  .network-header { align-items: flex-start; flex-direction: column; gap: 14px; }
  .network-status { font-size: 12px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .updated { font-size: 12px; }
  .route-row { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .rail-link { display: flex; flex-direction: column; gap: 5px; min-height: 45px; }
  .rail-track { width: 12px; height: 20px; }
  .rail-track::before { top: 0; right: auto; bottom: 0; left: 4px; width: 4px; height: auto; }
  .rail-track::after { display: none; }
  .rail-track span { top: 4px; left: 1px; width: 10px; height: 10px; border-width: 2px; }
  .station-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 390px) {
  .station { padding: 14px; }
  .station-head { flex-direction: column; }
  .train { grid-template-columns: auto auto minmax(0, 1fr); gap: 7px; }
  .train-time { font-size: 18px; }
}
