:root {
  color-scheme: dark;
  --bg: #111215;
  --panel: #18191d;
  --map: #141519;
  --border: #303238;
  --muted: #aaaeb9;
  --text: #f5f5ee;
  --acid: #E8F52B;
  --blue: #35A5F2;
  --pink: #F16A9F;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --sans: Inter, "Segoe UI", system-ui, sans-serif;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { opacity: .45; cursor: default; }
button:focus-visible, select:focus-visible, #map:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}
button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.page { max-width: 1560px; margin: auto; padding: 0 clamp(16px, 4.2vw, 64px); }
.masthead { min-height: 81px; display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid var(--border); }
.identity { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 650; line-height: 1.2; }
.identity img { flex: none; }
.identity small { display: block; margin-top: 4px; color: var(--muted); font: 11px var(--mono); letter-spacing: .045em; text-transform: uppercase; }
.export { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; border: 1px solid #4c5035; background: #25291a; color: var(--acid); padding: 0 13px; min-height: 42px; border-radius: 7px; font-size: 13px; font-weight: 650; }
.export:hover:enabled { background: #343c19; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: clamp(32px, 5vw, 68px) 0 31px; }
h1 { margin: 0; font-size: clamp(52px, 8.2vw, 125px); font-weight: 780; line-height: .94; letter-spacing: -.082em; }
h1 span { color: var(--acid); }
.intro p { flex: none; padding-left: 15px; margin: 0 0 3px; border-left: 2px solid #626940; color: #c7c9d0; line-height: 1.48; font-size: clamp(13px, 1.4vw, 17px); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(255px, 295px); gap: 16px; align-items: stretch; }
.network, .station-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 13px; min-width: 0; }
.network-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; min-height: 62px; padding: 10px 15px; }
.network-header h2, .station-header h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 680; }
.network-glyph { width: 15px; height: 15px; border: 1px solid var(--acid); border-radius: 50%; display: grid; place-items: center; }
.network-glyph::after { content: ""; width: 5px; height: 5px; background: var(--acid); border-radius: 50%; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filters button { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 0 8px; border-radius: 5px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.filters button:hover { color: var(--text); background: #22242a; }
.filters button[aria-pressed="true"] { border-color: #42454f; background: #282b32; color: var(--text); }
.swatch { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.canvas { position: relative; min-height: 330px; height: clamp(410px, 39vw, 610px); overflow: hidden; background: var(--map); border-block: 1px solid var(--border); }
#map { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; cursor: grab; }
#map.zoomed { touch-action: none; }
#map.dragging { cursor: grabbing; }
#map:focus-visible { outline-offset: -3px; }
#load-error { position: absolute; inset: 20% 16px auto; text-align: center; color: var(--pink); }
.map-tools { position: absolute; z-index: 1; inset: 13px 13px auto auto; display: grid; border: 1px solid #3e414a; border-radius: 7px; overflow: hidden; background: #1c1e23; }
.map-tools button { display: grid; place-items: center; width: 40px; height: 39px; padding: 0; border: 0; background: transparent; }
.map-tools button + button { border-top: 1px solid #3e414a; }
.map-tools button:focus-visible { outline-offset: -3px; }
.map-tools button:hover:enabled, .motion:hover:enabled { background: #343740; }
.motion { position: absolute; inset: auto 13px 11px auto; display: flex; align-items: center; gap: 5px; padding: 0 8px; min-height: 32px; border: 1px solid #3e414a; border-radius: 5px; background: #1c1e23; color: #d1d3dc; font-size: 11px; }
.motion svg { width: 14px; height: 14px; }
.map-key { min-height: 48px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding: 8px 15px; color: #c4c7d0; font-size: 11px; }
.map-key span { display: inline-flex; align-items: center; gap: 7px; }
.key-stop { width: 9px; height: 9px; border: 2px solid var(--text); background: var(--map); border-radius: 50%; }
.key-change { width: 13px; height: 13px; border: 3px double var(--text); background: var(--map); border-radius: 50%; }
.map-key .map-hint { margin-left: auto; color: var(--muted); }
.station-panel { display: flex; flex-direction: column; overflow: hidden; }
.station-header { display: flex; justify-content: space-between; align-items: center; min-height: 62px; gap: 6px; padding: 10px 17px; border-bottom: 1px solid var(--border); }
#station-count { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
#station-detail { flex: 1; padding: 17px; min-width: 0; }
.station-type { color: var(--acid); margin-top: 20px; font: 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
#station-title { font-size: clamp(23px, 2.15vw, 32px); line-height: 1.05; letter-spacing: -.055em; margin: 8px 0 9px; overflow-wrap: anywhere; }
#station-note { color: #c3c5cf; line-height: 1.55; margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.station-lines { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 16px; }
.station-lines span { border: 1px solid #40434b; border-radius: 4px; padding: 4px 6px; display: inline-flex; gap: 5px; align-items: center; font-size: 11px; }
.station-nav { display: flex; gap: 5px; padding: 12px 15px; border-top: 1px solid var(--border); }
.station-nav select, .station-nav button { min-height: 38px; background: #22242a; border: 1px solid #3d4049; border-radius: 5px; }
.station-nav select { min-width: 0; flex: 1; padding: 0 4px; text-overflow: ellipsis; font-size: 12px; }
.station-nav button { display: grid; flex: none; place-items: center; width: 37px; padding: 0; }
.station-nav button:hover:enabled { background: #353842; }
#previous svg { transform: rotate(180deg); }
.page-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 0 25px; color: var(--muted); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.page-footer span { display: inline-flex; align-items: center; gap: 8px; }
.page-footer .draft { color: #d8ce9f; }
.page-footer i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
[hidden] { display: none !important; }

.track { fill: none; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.route { transition: opacity .25s; }
.route.dim { opacity: .12; }
.track.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.55s cubic-bezier(.25,.66,.38,1) both; animation-delay: var(--delay); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.motion-off .track { animation: none; stroke-dasharray: none; }
.station { cursor: pointer; outline: none; }
.station-hit { fill: transparent; }
.station-label { fill: #f5f5ee; stroke: #141519; stroke-width: 5px; stroke-linejoin: round; paint-order: stroke; font: 650 23px var(--sans); }
.station.inactive { opacity: .16; pointer-events: none; }
.station-focus { fill: none; stroke: var(--acid); stroke-width: 2; opacity: 0; }
.station[aria-pressed="true"] .station-focus, .station:hover .station-focus, .station:focus-visible .station-focus { opacity: 1; }
.station:focus-visible .station-focus { stroke: #fff; stroke-dasharray: 3 2; stroke-width: 3; }
.motion-off .train { display: none; }

@media (max-width: 1040px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(225px, 25%); }
  .intro { padding-bottom: 26px; }
}
@media (max-width: 780px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .intro { flex-wrap: wrap; gap: 14px; }
  .wide-only { display: none; }
  .canvas { height: clamp(320px, 62vw, 465px); }
  #station-detail { display: grid; grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: repeat(4, auto); column-gap: 14px; }
  .station-type { margin-top: 0; }
  .station-header { min-height: 48px; }
  .station-lines { margin-top: 12px; }
}
@media (max-width: 460px) {
  .masthead { min-height: 68px; }
  .identity { gap: 7px; font-size: 12px; }
  .identity img { width: 29px; height: 29px; }
  .identity small { font-size: 10px; }
  .export { padding-inline: 8px; font-size: 12px; }
  h1 { font-size: clamp(42px, 11.25vw, 57px); }
  .network-header { padding-inline: 10px; }
  .filters { gap: 2px; }
  .filters button { padding-inline: 5px; min-height: 36px; }
  .map-key { padding-inline: 10px; }
  .map-key .map-hint { display: none; }
  .station-label { font-size: 23px; }
  .map-tools { inset: 8px 8px auto auto; }
  .map-tools button { width: 44px; height: 44px; }
  .motion { inset: auto 8px 8px auto; min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .route { transition: none; }
}


.mast-tools { display: flex; align-items: center; gap: clamp(9px, 2vw, 22px); }
.mast-tools a, .supplement summary { color: #d3d5de; font-size: 13px; font-weight: 650; text-decoration: none; }
.mast-tools a:hover, .supplement summary:hover { color: var(--acid); }
.export-menu { position: relative; z-index: 3; }
.export-menu summary { list-style: none; cursor: pointer; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu summary svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.export-menu > div { position: absolute; inset: calc(100% + 6px) 0 auto auto; min-width: 154px; padding: 4px; background: #24262c; border: 1px solid var(--border); border-radius: 6px; }
.export-menu button { width: 100%; min-height: 36px; padding: 4px 9px; text-align: left; background: transparent; border: 0; border-radius: 4px; font-size: 13px; }
.export-menu button:hover { background: #373a43; }
a:focus-visible, summary:focus-visible, #station-title:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
.network-header { justify-content: start; column-gap: 12px; }
.filters { margin-left: auto; }
.superpowers-toggle { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #494d37; border-radius: 5px; min-height: 34px; padding: 0 8px; background: transparent; color: #eceec7; font-size: 12px; white-space: nowrap; }
.superpowers-toggle:hover, .superpowers-toggle[aria-pressed="true"] { background: #373c1d; border-color: var(--acid); }
.superpowers-toggle span, .key-star { color: var(--acid); font-style: normal; }
.skip { right: 115px; }
.route.context { opacity: .66; }
.route.dim { opacity: .20; }
.station.appear { animation: station-appear .30s ease-out both; animation-delay: var(--station-delay); }
@keyframes station-appear { from { opacity: 0; } }
.highlight-superpowers .station:not(.has-superpower):not(.inactive) .station-label { opacity: .46; }
.highlight-superpowers .has-superpower .superpower-mark { stroke: var(--acid); stroke-width: 3; }
.station:focus .station-focus { opacity: 1; }
.station-panel { height: 100%; position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.station-header h2 { margin-right: auto; }
#station-detail { width: 100%; min-height: 0; position: absolute; inset: 62px 0 63px; overflow-y: auto; scrollbar-color: #555862 var(--panel); }
.station-nav { grid-row: 3; }
.station-type { margin-top: 0; line-height: 1.3; }
#station-note:empty { display: none; }
#station-title { outline-offset: 2px; }
#station-body, #station-related { color: #cdd0da; font-size: 13px; line-height: 1.53; }
#station-body h4, #station-related h4 { margin: 14px 0 6px; color: var(--text); font-size: 13px; }
#station-body ul { padding-left: 16px; margin: 11px 0 0; }
#station-body li + li { margin-top: 5px; }
#station-body .strength-list { color: #f1f3b9; }
#station-related button { display: flex; align-items: center; width: 100%; gap: 6px; margin-top: 5px; min-height: 35px; padding: 4px 8px; text-align: left; border: 1px solid #3d4049; border-radius: 5px; background: #22242a; color: var(--text); }
#station-related button:hover { background: #343740; }
#close-sheet { display: none; }
.supplement { display: grid; margin-top: 17px; gap: 8px; }
.supplement details { border: 1px solid var(--border); border-radius: 7px; background: var(--panel); }
.supplement summary { cursor: pointer; padding: 10px 14px; }
.supplement details > div { padding: 0 14px 8px; color: #cdd0da; font-size: 14px; line-height: 1.55; }
.supplement p { max-width: 72ch; }
#text-content h3 { color: var(--acid); margin: 23px 0 9px; }
#text-content section:nth-child(2) h3 { color: var(--blue); }
#text-content section:nth-child(3) h3 { color: var(--pink); }
#text-content article { border-top: 1px solid var(--border); padding: 0 0 7px; }
#text-content h4, #text-content h5 { font-size: inherit; font-weight: 670; margin: 13px 0 2px; }
#text-content ul { margin: 4px 0; padding-left: 20px; }
#text-content a { color: #c0d8ff; }
#workspace:fullscreen { width: 100%; height: 100%; background: var(--bg); padding: 10px; }
#workspace:fullscreen .network { display: flex; flex-direction: column; }
#workspace:fullscreen .canvas { flex: 1; }
#print-map { display: none; }

@media (max-width: 780px) {
  #station-detail { display: block; inset: auto; position: static; width: auto; padding: 14px 17px; overflow-y: auto; }
  .station-panel { display: none; }
  .station-panel.sheet-open { display: grid; position: fixed; inset: auto 0 0; height: auto; max-height: 55dvh; z-index: 4; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 22px #0009; }
  #close-sheet { display: block; width: 38px; height: 38px; border: 1px solid #3d4049; border-radius: 5px; background: #22242a; font-size: 26px; line-height: 1; }
  .station-nav { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .filters { margin-left: 0; }
  .map-tools { z-index: 1; }
  .canvas { height: clamp(270px, 49vw, 430px); min-height: 270px; }
}
@media (max-width: 460px) {
  .mast-tools a { font-size: 12px; white-space: nowrap; }
  .identity small { font-size: 9px; }
  .network-header { gap: 6px 9px; }
  .network-header h2 { width: 100%; }
  .map-key { gap: 8px 12px; }
  .superpowers-toggle { min-height: 36px; }
}
@media print {
  @page { size: landscape; margin: 12mm; }
  :root { background: white; }
  .page { display: none !important; }
  #print-map { display: block; }
  #print-map svg { display: block; width: 100%; height: auto; }
}
#browse-stations { display: none; }
@media (max-width: 780px) {
  #browse-stations { display: inline-flex; align-items: center; margin-left: auto; padding: 3px 9px; min-height: 35px; border: 1px solid #494d37; border-radius: 5px; background: #242719; color: var(--acid); font-size: 12px; }
  .map-tools { display: flex; }
  .map-tools button + button { border-top: 0; border-left: 1px solid #3e414a; }
}
