/* Velolink — design system */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0b0e13;
  --bg-grad: radial-gradient(1200px 600px at 75% -10%, rgba(70,163,106,0.10), transparent 60%),
             radial-gradient(900px 500px at 5% 110%, rgba(123,107,255,0.08), transparent 60%),
             #0b0e13;
  --surface: #131822;
  --surface-2: #1a2030;
  --surface-3: #232a3a;
  --text: #e6e2d6;
  --text-dim: #9aa2af;
  --text-faint: #6b7180;
  --border: #2a313b;
  --border-strong: #3a4252;
  --accent: #46a36a;
  --accent-warm: #ec8a3b;
  --danger: #e0524a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.45);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --focus-ring: 0 0 0 3px rgba(70,163,106,0.45);

  --line-S1: #e0524a; --line-S2: #3a7bd5; --line-L1: #ec8a3b; --line-L2: #46a36a; --line-F1: #7b6bff;
  --surface-greenway: #46a36a; --surface-protected: #3aa1d5; --surface-sharrow: #caa14b;

  --map-bg: #0e131c;
  --map-park: rgba(70,163,106,0.18);
  --map-water: #122538;
  --map-water-edge: #1c3450;
  --map-hill: rgba(202,161,75,0.10);
  --map-stroke: #2b3344;
}

[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-grad: radial-gradient(1200px 600px at 75% -10%, rgba(70,163,106,0.10), transparent 60%),
             radial-gradient(900px 500px at 5% 110%, rgba(123,107,255,0.08), transparent 60%),
             #f6f3ec;
  --surface: #ffffff;
  --surface-2: #f1ece1;
  --surface-3: #e6e0d2;
  --text: #1a1d22;
  --text-dim: #5a6066;
  --text-faint: #8a8e96;
  --border: #d5cfc1;
  --border-strong: #b5ad9d;
  --accent: #2e7a4d;
  --shadow-md: 0 8px 24px rgba(40,30,10,0.10);
  --shadow-lg: 0 24px 60px rgba(40,30,10,0.18);
  --map-bg: #fbf8ef;
  --map-park: rgba(70,163,106,0.22);
  --map-water: #cfe1ee;
  --map-water-edge: #a4c4d8;
  --map-hill: rgba(202,161,75,0.18);
  --map-stroke: #d5cfc1;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-grad);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }

.skip-link {
  position: absolute; top: -40px; left: 12px; padding: 8px 12px; background: var(--accent); color: #fff;
  border-radius: 6px; z-index: 100;
}
.skip-link:focus { top: 12px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; gap: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { width: 44px; height: 32px; color: var(--accent); flex-shrink: 0; }
.brand-text h1 { font-size: 18px; letter-spacing: 0.02em; }
.brand-text p { font-size: 12px; color: var(--text-dim); margin-top: 2px; letter-spacing: 0.06em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn .icon-moon { display: none; }
[data-theme="light"] .icon-btn .icon-sun { display: none; }
[data-theme="light"] .icon-btn .icon-moon { display: inline-block; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 380px) 1fr;
  gap: 22px;
  padding: 22px;
  max-width: 1600px;
  margin: 0 auto;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; padding: 14px; gap: 14px; }
}

/* ---------- Planner ---------- */
.planner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-md);
  height: fit-content;
  position: sticky;
  top: 22px;
}
@media (max-width: 960px) { .planner { position: static; } }

.tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.tab {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text-dim);
  transition: background 0.15s, color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.panel { display: flex; flex-direction: column; gap: 14px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span {
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 600;
}
.field select, .field input[type="text"], .field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.field textarea { resize: vertical; min-height: 86px; line-height: 1.45; font-family: var(--font-sans); }
.field select { appearance: none; -webkit-appearance: none; background-image:
  linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
  linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.field select:hover, .field input:hover, .field textarea:hover { border-color: var(--border-strong); }
.field select:focus-visible, .field input:focus-visible, .field textarea:focus-visible { border-color: var(--accent); box-shadow: var(--focus-ring); }

.swap-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1px;
  transition: transform 0.25s ease, background 0.15s;
}
.swap-btn:hover { background: var(--surface-3); }
.swap-btn:active { transform: rotate(180deg); }

.slider-group { display: flex; flex-direction: column; gap: 12px; }
.slider { display: flex; flex-direction: column; gap: 6px; }
.slider-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 500; }
.slider-value { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; }
.slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  cursor: pointer;
}
.slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; background: var(--surface-3); border-radius: 4px;
}
.slider input[type="range"]::-moz-range-track {
  height: 4px; background: var(--surface-3); border-radius: 4px;
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  margin-top: -7px; box-shadow: 0 0 0 1px var(--accent);
  transition: transform 0.1s ease;
}
.slider input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}
.slider input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }

.hint { color: var(--text-faint); font-size: 11.5px; }

/* Departure time control */
.time-control { display: flex; flex-direction: column; gap: 6px; }
.time-control .time-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; font-weight: 500; }
.time-control .time-value { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.time-peak { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 9px; border-radius: 99px; background: var(--surface-3); color: var(--text-dim); font-weight: 600; }
.time-peak.is-peak { background: rgba(224,82,74,0.18); color: var(--danger); }
.time-slider-wrap { position: relative; height: 22px; display: flex; align-items: center; }
.time-band {
  position: absolute; height: 4px; top: 50%; transform: translateY(-50%);
  background: rgba(224,82,74,0.40); border-radius: 2px; pointer-events: none;
}
.time-band.band-am { left: 5.88%; width: 14.71%; }
.time-band.band-pm { left: 61.76%; width: 14.71%; }
.time-slider-wrap input[type="range"] {
  position: relative; -webkit-appearance: none; appearance: none;
  width: 100%; background: transparent; cursor: pointer; margin: 0;
}
.time-slider-wrap input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--surface-3); border-radius: 4px; }
.time-slider-wrap input[type="range"]::-moz-range-track { height: 4px; background: var(--surface-3); border-radius: 4px; }
.time-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  margin-top: -7px; box-shadow: 0 0 0 1px var(--accent);
}
.time-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}


.primary-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 600;
  transition: transform 0.05s, filter 0.15s, box-shadow 0.15s;
  box-shadow: 0 6px 20px rgba(70,163,106,0.30), inset 0 1px 0 rgba(255,255,255,0.15);
}
.primary-btn:hover { filter: brightness(1.07); }
.primary-btn:active { transform: scale(0.985); }
.primary-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.ghost-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.ghost-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.parse-result { font-size: 12.5px; color: var(--text-dim); min-height: 18px; }
.parse-result.is-good { color: var(--accent); }

/* ---------- Routes ---------- */
.routes { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.route-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
  text-align: left;
  width: 100%;
  display: flex; flex-direction: column; gap: 6px;
}
.route-card:hover { border-color: var(--border-strong); background: var(--surface-3); }
.route-card.is-selected { border-color: var(--accent); background: rgba(70,163,106,0.07); box-shadow: 0 0 0 1px var(--accent); }
.route-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.route-card-name { font-weight: 600; font-size: 14px; }
.route-card-time { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.route-card-time small { font-size: 11px; font-weight: 500; color: var(--text-dim); margin-left: 2px; }
.route-card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; }
.route-card-meta b { color: var(--text); font-weight: 600; }
.route-pillstrip { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  font-size: 11px; font-weight: 600; border-radius: 11px;
  color: #fff;
  letter-spacing: 0.02em;
}
.mode-pill[data-mode="bike"] { background: var(--accent); }
.mode-pill[data-mode="walk"] { background: var(--text-faint); }
.mode-pill[data-mode="S1"] { background: var(--line-S1); }
.mode-pill[data-mode="S2"] { background: var(--line-S2); }
.mode-pill[data-mode="L1"] { background: var(--line-L1); }
.mode-pill[data-mode="L2"] { background: var(--line-L2); }
.mode-pill[data-mode="F1"] { background: var(--line-F1); }
.mode-pill svg { width: 11px; height: 11px; }

/* ---------- Canvas area ---------- */
.canvas-area { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-md);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; letter-spacing: 0.01em; }
.card-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; max-width: 60ch; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-dim); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.greenway { background: var(--surface-greenway); }
.dot.protected { background: var(--surface-protected); }
.dot.sharrow { background: var(--surface-sharrow); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4); }
.dot.subway { background: var(--line-S1); }
.dot.rail { background: var(--line-L1); }
.dot.ferry { background: var(--line-F1); }

/* ---------- Map ---------- */
.svg-wrap {
  width: 100%; aspect-ratio: 1 / 1; background: var(--map-bg);
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
}
.elev-wrap { aspect-ratio: auto; height: 160px; }
.svg-wrap svg { display: block; width: 100%; height: 100%; }

#map .park { fill: var(--map-park); stroke: none; }
#map .hill { fill: var(--map-hill); stroke: none; }
#map .bay { fill: var(--map-water); stroke: var(--map-water-edge); stroke-width: 0.15; }
#map .river { fill: var(--map-water); stroke: var(--map-water-edge); stroke-width: 0.15; }
#map .grid line { stroke: var(--map-stroke); stroke-width: 0.05; opacity: 0.5; }
#map .bike { fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke-width 0.15s, opacity 0.2s; }
#map .bike.greenway { stroke: var(--surface-greenway); stroke-width: 0.4; opacity: 0.55; }
#map .bike.protected { stroke: var(--surface-protected); stroke-width: 0.4; opacity: 0.55; }
#map .bike.sharrow { stroke: var(--surface-sharrow); stroke-width: 0.4; opacity: 0.5; stroke-dasharray: 0.6 0.5; }
#map .transit-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.85; opacity: 0.95; }
#map .station {
  fill: var(--surface); stroke-width: 0.3; transition: r 0.15s;
}
#map .station-label {
  font-size: 1.6px; fill: var(--text-dim); pointer-events: none; font-family: var(--font-sans); font-weight: 500;
}
#map .station-label.major { font-size: 2.0px; fill: var(--text); font-weight: 600; }
#map .endpoint {
  fill: var(--accent); stroke: var(--surface); stroke-width: 0.5;
  filter: drop-shadow(0 0 1.4px rgba(70,163,106,0.85));
}
#map .endpoint-ring {
  fill: none; stroke: var(--accent); stroke-width: 0.3;
  transform-origin: center; transform-box: fill-box;
  animation: pulseRing 1.8s ease-out infinite;
}
@keyframes pulseRing { 0% { r: 0.6; opacity: 1; } 100% { r: 3.5; opacity: 0; } }
#map .route-stroke {
  fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 0 0;
}
#map .route-stroke.casing { stroke-width: 1.3; stroke: var(--surface); opacity: 0.9; }
#map .route-stroke.live { stroke-width: 0.8; }
#map .route-stroke.live.bike { stroke: var(--accent); stroke-dasharray: 1.2 0.6; animation: dashFlow 3.6s linear infinite; }
#map .route-stroke.live.S1 { stroke: var(--line-S1); }
#map .route-stroke.live.S2 { stroke: var(--line-S2); }
#map .route-stroke.live.L1 { stroke: var(--line-L1); }
#map .route-stroke.live.L2 { stroke: var(--line-L2); }
#map .route-stroke.live.F1 { stroke: var(--line-F1); stroke-dasharray: 0.6 0.6; animation: dashFlow 4.8s linear infinite; }
@keyframes dashFlow { to { stroke-dashoffset: -3.6; } }

#map .rider {
  fill: var(--accent); stroke: var(--surface); stroke-width: 0.3;
  filter: drop-shadow(0 0 1.6px rgba(70,163,106,0.7));
}

/* ---------- Elevation chart ---------- */
#elevation { background: transparent; }
#elevation .elev-fill { fill: rgba(70,163,106,0.18); }
#elevation .elev-stroke { fill: none; stroke: var(--accent); stroke-width: 1.4; }
#elevation .elev-axis { stroke: var(--border); stroke-width: 0.5; }
#elevation .elev-tick { fill: var(--text-faint); font-size: 9px; font-family: var(--font-sans); }
#elevation .elev-leg-bike { fill: rgba(70,163,106,0.10); }
#elevation .elev-leg-S1 { fill: rgba(224,82,74,0.10); }
#elevation .elev-leg-S2 { fill: rgba(58,123,213,0.10); }
#elevation .elev-leg-L1 { fill: rgba(236,138,59,0.10); }
#elevation .elev-leg-L2 { fill: rgba(70,163,106,0.10); }
#elevation .elev-leg-F1 { fill: rgba(123,107,255,0.10); }
#elevation .elev-cursor { stroke: var(--accent); stroke-width: 1; opacity: 0.8; }

/* ---------- Ride Resonance simulator ---------- */
.sim-card { padding-bottom: 14px; }
.sim-controls { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.sim-controls input[type="range"] { flex: 1; }
.play-btn { padding: 8px 14px; min-width: 92px; }
.play-btn .pause-icon { display: none; }
.play-btn.is-playing .play-icon { display: none; }
.play-btn.is-playing .pause-icon { display: inline-block; }

.sim-stage {
  position: relative;
  background: linear-gradient(180deg, #0a1119 0%, #131d2c 60%, #0a1119 100%);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 6;
  min-height: 240px;
}
[data-theme="light"] .sim-stage { background: linear-gradient(180deg, #f3f0e6 0%, #d6e6e9 60%, #f3f0e6 100%); }
#sim-canvas { display: block; width: 100%; height: 100%; }
.sim-overlay {
  position: absolute; inset: 0; pointer-events: none;
  padding: 16px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "now" "spacer" "stats";
  gap: 8px;
}
.now { grid-area: now; font-size: 14px; font-weight: 600; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.7); max-width: 60ch; }
[data-theme="light"] .now { color: #0c1117; text-shadow: 0 1px 4px rgba(255,255,255,0.7); }
.sim-stats {
  grid-area: stats;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 14px;
  align-items: end;
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(6px);
}
[data-theme="light"] .sim-stats { background: rgba(255,255,255,0.55); border-color: rgba(0,0,0,0.06); color: #0c1117; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-k { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
[data-theme="light"] .stat-k { color: #4a5159; }
.stat-v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: #fff; }
[data-theme="light"] .stat-v { color: #0c1117; }
.meter { height: 6px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
[data-theme="light"] .meter { background: rgba(0,0,0,0.08); }
.meter-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--line-L1) 60%, var(--danger) 100%); border-radius: 4px; transition: width 0.25s ease; }
.callout {
  position: absolute;
  right: 18px; top: 50px;
  max-width: 280px;
  padding: 9px 12px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s, transform 0.3s;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
[data-theme="light"] .callout { background: rgba(255,255,255,0.85); color: #0c1117; border-color: rgba(0,0,0,0.08); }
.callout.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Rationale ---------- */
.rationale { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; line-height: 1.55; }
.rationale .empty { color: var(--text-dim); font-style: italic; }
.rationale .empty em { font-style: normal; color: var(--text); font-weight: 600; }
.rationale h3 { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.rationale ul { padding-left: 18px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.rationale li::marker { color: var(--accent); }
.rationale .reason-card {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 10px 10px 0;
}
.rationale .reason-card.warn { border-left-color: var(--accent-warm); }
.rationale .reason-card.danger { border-left-color: var(--danger); }
.rationale .reason-card-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.rationale .reason-card-body { font-size: 13px; color: var(--text-dim); }
.rationale .reason-card-body b { color: var(--text); font-weight: 600; }

/* ---------- Footer ---------- */
.footer {
  padding: 28px 24px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ---------- Help dialog ---------- */
.help-sheet[open] { display: block; }
.help-sheet {
  margin: auto; padding: 0; max-width: 560px; width: calc(100% - 32px);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
}
.help-sheet::backdrop { background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
.help-sheet article { padding: 18px 22px 24px; }
.help-sheet header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.help-sheet h2 { font-size: 18px; }
.help-sheet h3 { font-size: 13px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); margin-top: 18px; margin-bottom: 4px; font-weight: 600; }
.help-sheet p { font-size: 14px; color: var(--text-dim); line-height: 1.55; }

/* ---------- Print + reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto; }
}

/* ---------- Tooltip on station hover ---------- */
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 20;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 8px));
}
.tooltip.is-visible { opacity: 1; }
.tooltip small { display: block; color: var(--text-dim); font-weight: 400; margin-top: 2px; font-size: 11px; }
