* { box-sizing: border-box; }
:root { color-scheme: light; --ink: #24342f; --muted: #637168; --paper: #f4f2eb; --line: #dcded4; --accent: #be4c36; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
main { max-width: 1400px; margin: auto; padding: 24px 32px; }
header { margin-bottom: 20px; }
h1 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 32px); line-height: 1.25; font-weight: 650; }
header p, footer p { margin: 8px 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; }
button { cursor: pointer; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; background: #faf9f4; color: var(--ink); font-size: 13px; }
button:hover { background: #e9ece2; }
button[aria-pressed="true"] { background: var(--ink); color: white; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.experiment { background: #faf9f4; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.controls { padding: 16px 24px 8px; border-bottom: 1px solid var(--line); }
.control-heading { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 650; }
#play { margin-left: auto; min-width: 100px; }
output { font-variant-numeric: tabular-nums; color: var(--accent); }
input[type="range"] { display: block; width: 100%; height: 44px; margin: 0; accent-color: var(--ink); cursor: ew-resize; touch-action: pan-y; }
.range-ends { display: flex; justify-content: space-between; }
.range-ends button { border: none; background: transparent; padding: 8px 0; color: var(--muted); }
.map-toolbar { padding: 12px 20px 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.legend-item { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.line-badge { border-radius: 4px; width: 28px; height: 28px; display: inline-grid; place-items: center; color: white; font-weight: 750; }
.map-options { display: flex; align-items: center; gap: 12px; }
.label-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; min-height: 44px; cursor: pointer; }
.label-toggle input { accent-color: var(--ink); width: 18px; height: 18px; }
.pan-hint { font-size: 12px; color: var(--muted); margin: 8px 20px 12px; }
.map-panel { margin: 0 12px; background: #f4f5ee; border: 1px solid #e7e9df; border-radius: 4px; overflow: auto; -webkit-overflow-scrolling: touch; }
#metro { display: block; width: 100%; height: auto; max-width: none; }
.map-panel.expanded { max-height: 75vh; }
.map-panel.expanded #metro { width: 1800px; }
.route { fill: none; stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.station-dot { fill: #faf9f4; stroke-width: 2; }
.station-hit { fill: transparent; pointer-events: all; }
.station { cursor: pointer; outline: none; }
.station:focus-visible .station-dot, .station.selected .station-dot { stroke: var(--ink); stroke-width: 3; fill: #ffdbb0; }
.station:focus-visible .station-hit { stroke: var(--accent); stroke-width: 1.5; }
.transfer-dot { stroke: var(--ink); stroke-width: 2.5; }
.station-label { font-size: 13px; fill: #35473d; stroke: #f4f5ee; stroke-width: 4; stroke-linejoin: round; paint-order: stroke; pointer-events: none; }
.transfer-label { font-weight: 700; }
.leader { stroke: #a8b1a5; stroke-width: .8; fill: none; pointer-events: none; }
.map-footer { display: flex; padding: 14px 20px; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.map-footer p { margin: 0; }
#stats { white-space: nowrap; }
#error { margin: 20px; color: #962c21; }
footer { margin-top: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 700px) {
  main { padding: 16px 12px; }
  .controls { padding: 12px 12px 6px; }
  .map-toolbar { padding: 10px 12px 0; }
  .legend { gap: 8px; }
  .legend-item { font-size: 11px; }
  .legend-item .line-name { display: none; }
  .map-options { width: 100%; justify-content: space-between; }
  .pan-hint { margin: 8px 12px 12px; }
  .map-panel { margin: 0 6px; }
  .map-footer { flex-direction: column; align-items: start; padding: 12px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
