:root {
  color-scheme: light;
  font-family: "Avenir Next", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", system-ui, sans-serif;
  --font-display: "Bahnschrift SemiCondensed", "Arial Narrow", "Avenir Next Condensed", sans-serif;
  --font-technical: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --paper: #f2f4f3;
  --surface: #ffffff;
  --ink: #141918;
  --ink-soft: #343b38;
  --muted: #5a6560;
  --hairline: #aeb7b2;
  --soft: #e1e6e3;
  --keio: #d51c57;
  --inokashira: #256ba6;
  --shinjuku: #6cbb5a;
  --ginza: #f39700;
  --chuo: #f15a24;
  --yamanote: #80c241;
  --odakyu: #1682c4;
  --denentoshi: #00a040;
  --yellow: #ffd43b;
  --focus: #0b62ce;
  --success: #06704e;
  --error: #ac2b2b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--paper); }
body { min-width: 320px; margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button, label, input, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 12px; border: 2px solid white; background: var(--ink); color: white; font-weight: 800; text-decoration: none; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header {
  width: 100%;
  min-height: 68px;
  padding: 0 max(16px, calc((100% - 1040px) / 2));
  display: grid;
  grid-template-columns: auto minmax(40px, 1fr) auto;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
}

.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 2px; background: var(--ink); color: white; font-family: var(--font-technical); font-size: .82rem; }
.rail-stripes { height: 6px; overflow: hidden; background: linear-gradient(90deg, var(--keio) 0 12.5%, var(--inokashira) 12.5% 25%, var(--shinjuku) 25% 37.5%, var(--ginza) 37.5% 50%, var(--chuo) 50% 62.5%, var(--yamanote) 62.5% 75%, var(--odakyu) 75% 87.5%, var(--denentoshi) 87.5% 100%); }
.rail-stripes i { display: none; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.prototype-label { color: var(--muted); font-family: var(--font-technical); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.language-toggle { display: grid; grid-template-columns: repeat(2, auto); border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; }
.language-toggle button { min-width: 38px; min-height: 34px; padding: 5px 8px; border: 0; border-right: 1px solid var(--ink); background: white; color: var(--muted); font-family: var(--font-technical); font-size: .62rem; font-weight: 800; }
.language-toggle button:last-child { border-right: 0; }
.language-toggle button[aria-pressed="true"] { background: var(--ink); color: white; }

main { width: min(100% - 32px, 1040px); margin: 0 auto; padding: 28px 0 48px; }
.intro { max-width: 650px; margin-bottom: 28px; }
.eyebrow, .result-label, legend, .field-label, .specific-time > span, .route-heading { font-family: var(--font-technical); font-size: .7rem; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.eyebrow { margin: 0 0 7px; color: var(--muted); }
h1 { max-width: 620px; margin: 0 0 10px; font-family: var(--font-display); font-size: clamp(2.45rem, 9vw, 4.5rem); font-weight: 800; line-height: .95; letter-spacing: 0; }
html[lang="ja"] h1 { max-width: none; font-size: clamp(1.9rem, 8vw, 4rem); white-space: nowrap; }
.intro > p:last-child { max-width: 600px; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.55; }

.workspace { display: grid; gap: 24px; }
.trip-tool { min-width: 0; display: grid; gap: 20px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: var(--muted); }

.segmented-control { display: grid; border: 2px solid var(--ink); border-radius: 3px; background: white; }
.segmented-control input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.segmented-control label { min-width: 0; min-height: 46px; padding: 8px 5px; display: grid; place-items: center; border-right: 1px solid var(--ink); color: var(--ink-soft); font-size: .78rem; font-weight: 800; text-align: center; cursor: pointer; transition: color 150ms ease, background-color 150ms ease; }
.segmented-control label:last-child { border-right: 0; }
.line-control { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--ink); }
.line-control label { min-height: 56px; padding: 7px 6px; display: flex; align-items: center; justify-content: flex-start; gap: 7px; overflow: hidden; border: 0; background: white; font-size: .7rem; line-height: 1.1; white-space: nowrap; }
.line-control label > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.picker-code { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border-radius: 2px; color: white; font-family: var(--font-technical); font-size: .68rem; font-weight: 800; }
.picker-code-all { background: var(--ink); font-size: .56rem; }
#line-all:checked + label { background: #e9eeeb; box-shadow: inset 0 -4px var(--ink); }
#line-keio:checked + label { background: #fcecf1; box-shadow: inset 0 -4px var(--keio); }
#line-inokashira:checked + label { background: #eaf3fa; box-shadow: inset 0 -4px var(--inokashira); }
#line-shinjuku:checked + label { background: #edf8ea; box-shadow: inset 0 -4px var(--shinjuku); }
#line-ginza:checked + label { background: #fff4df; box-shadow: inset 0 -4px var(--ginza); }
#line-chuo:checked + label { background: #fff0eb; box-shadow: inset 0 -4px var(--chuo); }
#line-yamanote:checked + label { background: #eff9e6; box-shadow: inset 0 -4px var(--yamanote); }
#line-odakyu:checked + label { background: #e9f4fb; box-shadow: inset 0 -4px var(--odakyu); }
#line-denentoshi:checked + label { background: #e8f7ef; box-shadow: inset 0 -4px var(--denentoshi); }
.segmented-control input:focus-visible + label,
button:focus-visible, input:focus-visible, summary:focus-visible, .brand:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.route-board { position: relative; z-index: 2; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); }
.line-schematic-panel { position: relative; z-index: 0; min-width: 0; overflow: hidden; border: 2px solid var(--ink); border-radius: 4px; background: var(--surface); --line-accent: var(--ink); }
.schematic-heading { min-height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ink); }
.schematic-heading h2 { margin: 0; font-family: var(--font-technical); font-size: .7rem; font-weight: 700; text-transform: uppercase; }
.schematic-heading span { color: var(--muted); font-family: var(--font-technical); font-size: .64rem; font-weight: 700; text-align: right; text-transform: uppercase; }
.line-schematic { width: 100%; height: 230px; overflow: hidden; background: #dce5e1; touch-action: pan-x pan-y; }
.line-schematic .leaflet-control-zoom a { color: var(--ink); }
.line-schematic .leaflet-control-attribution { font-size: 8px; }
.line-schematic .leaflet-tooltip { border: 1px solid var(--ink); border-radius: 2px; box-shadow: none; font-size: .7rem; line-height: 1.3; }
.route-direction-marker { width: 18px !important; height: 18px !important; pointer-events: none !important; }
.route-direction-chevron { position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; display: block; pointer-events: none; transform: translate(-50%, -50%) rotate(var(--route-angle)); transform-origin: center; }
.route-direction-chevron::before, .route-direction-chevron::after { content: ""; position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; border-style: solid; border-width: 4px 4px 0 0; transform: translate(-50%, -50%) rotate(-45deg); }
.route-direction-chevron::before { border-color: white; }
.route-direction-chevron::after { border-color: var(--ink); border-width: 2px 2px 0 0; }
.map-sun-overlay { width: 260px !important; height: 260px !important; pointer-events: none !important; }
.map-sun-group { --sun-map-angle: 0deg; position: absolute; top: 50%; left: 50%; width: min(260px, 70vw); height: min(260px, 70vw); display: block; opacity: 1; pointer-events: none; transform: translate(-50%, -50%) rotate(var(--sun-map-angle)); transform-origin: center; transition: transform 220ms ease-out, opacity 220ms ease; }
.map-sun-group.is-entering, .map-sun-group.is-night { opacity: 0; }
.map-sun-icon { position: absolute; top: 7%; left: 50%; width: 28px; height: 28px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px rgb(255 255 255 / .9); transform: translateX(-50%); }
.map-sun-icon::before, .map-sun-icon::after { content: ""; position: absolute; top: 50%; left: 50%; width: 42px; height: 3px; background: var(--yellow); box-shadow: 0 0 0 1px var(--ink); transform: translate(-50%, -50%); }
.map-sun-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.map-sun-ray { position: absolute; top: 25%; left: 50%; width: 3px; height: 25%; background: rgb(255 212 59 / .58); box-shadow: 0 0 0 1px rgb(20 25 24 / .55); transform: translateX(-50%); }
.map-sun-ray::after { content: ""; position: absolute; right: 50%; bottom: -1px; width: 8px; height: 8px; border-right: 3px solid var(--yellow); border-bottom: 3px solid var(--yellow); filter: drop-shadow(1px 1px 0 var(--ink)); transform: translateX(50%) rotate(45deg); }
.map-sun-ray-center { width: 5px; background: var(--yellow); box-shadow: 0 0 0 1px var(--ink); }
.map-sun-ray-left { left: 40%; opacity: .68; transform: translateX(-50%) rotate(-7deg); transform-origin: bottom; }
.map-sun-ray-right { left: 60%; opacity: .68; transform: translateX(-50%) rotate(7deg); transform-origin: bottom; }
.station-map-marker { display: grid; place-items: center; background: transparent; }
.station-map-marker span { width: 9px; height: 9px; display: block; border: 2px solid white; border-radius: 50%; background: var(--marker-line); box-shadow: 0 0 0 1px var(--ink); }
.station-map-marker.is-origin span { width: 15px; height: 15px; border: 3px solid var(--ink); background: var(--yellow); box-shadow: 0 0 0 2px white; }
.station-map-marker.is-destination span { width: 15px; height: 15px; border: 3px solid var(--ink); background: var(--marker-line); box-shadow: 0 0 0 2px white; }
.schematic-svg { width: 100%; height: auto; display: block; margin: 0 auto; }
.schematic-track, .schematic-route { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.schematic-track { stroke: #d7ddda; stroke-width: 7; }
.schematic-route { stroke: var(--line-accent); stroke-width: 7; }
.schematic-station { cursor: pointer; outline: none; }
.schematic-hit { fill: transparent; stroke: none; pointer-events: all; }
.schematic-station .station-dot { fill: white; stroke: var(--ink); stroke-width: 2; pointer-events: none; transition: r 120ms ease, fill 120ms ease; }
.schematic-station:hover .station-dot, .schematic-station:focus .station-dot { r: 7px; fill: var(--yellow); stroke-width: 3; }
.schematic-station.is-origin .station-dot { fill: var(--yellow); stroke: var(--ink); stroke-width: 3; }
.schematic-station.is-destination .station-dot { fill: var(--line-accent); stroke: var(--ink); stroke-width: 3; }
.schematic-number { fill: var(--muted); font-family: var(--font-technical); font-size: 7px; font-weight: 700; pointer-events: none; }
.schematic-north { fill: var(--muted); stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.schematic-north text { stroke: none; font-family: var(--font-technical); font-size: 9px; font-weight: 800; }
.schematic-loop-code { fill: var(--line-accent); font-family: var(--font-display); font-size: 30px; font-weight: 800; }
.schematic-loop-name { fill: var(--muted); font-family: var(--font-technical); font-size: 8px; font-weight: 700; text-transform: uppercase; }
.schematic-empty { min-height: 106px; margin: 0; padding: 20px; display: grid; place-items: center; color: var(--muted); font-size: .82rem; text-align: center; }
body[data-line="keio"] .line-schematic-panel { --line-accent: var(--keio); }
body[data-line="inokashira"] .line-schematic-panel { --line-accent: var(--inokashira); }
body[data-line="shinjuku"] .line-schematic-panel { --line-accent: var(--shinjuku); }
body[data-line="ginza"] .line-schematic-panel { --line-accent: var(--ginza); }
body[data-line="chuo"] .line-schematic-panel { --line-accent: var(--chuo); }
body[data-line="yamanote"] .line-schematic-panel { --line-accent: var(--yamanote); }
body[data-line="odakyu"] .line-schematic-panel { --line-accent: var(--odakyu); }
body[data-line="denentoshi"] .line-schematic-panel { --line-accent: var(--denentoshi); }
.route-heading { min-height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ink); color: var(--muted); }
.route-heading span:last-child { max-width: 70%; overflow: hidden; color: var(--ink); text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.route-fields { position: relative; padding: 12px; display: grid; grid-template-rows: auto 0 auto; row-gap: 12px; }
.route-fields > .station-search:first-of-type { grid-row: 1; }
.route-fields > .station-search:last-of-type { grid-row: 3; }
.station-search { position: relative; min-width: 0; }
.station-search:focus-within { z-index: 20; }
.field-label { margin: 0 0 5px 2px; display: flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.field-label span { color: var(--muted); }
.field-label b { font: inherit; }
.combobox-shell { min-height: 56px; padding: 0 7px 0 13px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--hairline); background: #fbfcfb; transition: border-color 150ms ease, background-color 150ms ease; }
.combobox-shell:focus-within { border-color: var(--ink); background: white; }
.combobox-shell svg { flex: 0 0 auto; color: var(--muted); }
.combobox-shell input { width: 100%; min-width: 0; min-height: 52px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; font-weight: 750; -webkit-appearance: none; }
.combobox-shell input::-webkit-search-cancel-button { display: none; }
.combobox-shell input::placeholder { color: #7c8681; font-weight: 500; }
.combobox-shell input[aria-invalid="true"] { color: var(--error); }
.field-code { max-width: min(48%, 150px); margin-left: auto; flex: 0 0 auto; overflow: hidden; padding: 4px 5px; border-radius: 2px; background: var(--ink); color: white; font-family: var(--font-technical); font-size: .58rem; font-weight: 800; line-height: 1.35; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.clear-station { width: 30px; height: 30px; padding: 0; flex: 0 0 30px; display: grid; place-items: center; border: 0; border-radius: 2px; background: transparent; color: var(--muted); }
.clear-station[hidden] { display: none; }
.clear-station:hover, .clear-station:focus-visible { background: var(--soft); color: var(--ink); outline: 0; }
.clear-station svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.swap-button { position: relative; z-index: 25; grid-row: 2; justify-self: end; align-self: center; right: 8px; width: 36px; height: 36px; padding: 0; display: grid; place-items: center; transform: translateY(9px); border: 1px solid var(--hairline); border-radius: 50%; background: var(--surface); color: var(--muted); box-shadow: 0 0 0 4px var(--surface); transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease; }
.swap-button:hover { border-color: var(--ink); background: var(--soft); color: var(--ink); }
.swap-button:active { transform: translateY(9px) scale(.94); }
.swap-button:active svg { transform: rotate(180deg); }
.swap-button svg { width: 17px; height: 17px; display: block; transition: transform 180ms ease; }

.suggestions { position: absolute; z-index: 30; top: calc(100% + 5px); right: 0; left: 0; max-height: 340px; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; border: 2px solid var(--ink); border-radius: 2px; background: white; list-style: none; }
.station-suggestion { min-height: 46px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--soft); cursor: pointer; }
.station-suggestion:last-child { border-bottom: 0; }
.station-suggestion:hover, .station-suggestion.is-active { background: var(--ink); color: white; }
.suggestion-name { min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; font-weight: 800; }
.suggestion-name-ja { color: var(--muted); font-size: .72rem; font-weight: 600; }
.station-suggestion:hover .suggestion-name-ja, .station-suggestion.is-active .suggestion-name-ja { color: #c8d0cc; }
.suggestion-lines { max-width: 48%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
.suggestion-empty { padding: 16px 10px; color: var(--muted); font-size: .86rem; text-align: center; }
.line-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 2px; color: white; font-family: var(--font-technical); font-size: .62rem; font-weight: 700; text-transform: uppercase; }
.line-badge-keio { background: var(--keio); }
.line-badge-inokashira { background: var(--inokashira); }
.line-badge-shinjuku { background: var(--shinjuku); color: #10240c; }
.line-badge-ginza { background: var(--ginza); color: #2a1700; }
.line-badge-chuo { background: var(--chuo); color: white; }
.line-badge-yamanote { background: var(--yamanote); color: #14220a; }
.line-badge-odakyu { background: var(--odakyu); }
.line-badge-denentoshi { background: var(--denentoshi); }

.location-group { display: grid; gap: 7px; }
.secondary-button { width: 100%; min-height: 46px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--hairline); border-radius: 3px; background: transparent; color: var(--ink); font-size: .84rem; font-weight: 800; transition: border-color 150ms ease, background-color 150ms ease; }
.secondary-button:hover { border-color: var(--ink); background: white; }
.secondary-button:disabled { cursor: wait; opacity: .55; }
.secondary-button[data-loading="true"] svg { animation: locate-spin 900ms linear infinite; }
.field-status { min-height: 0; margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.field-status:empty { display: none; }
.field-status[data-state="success"] { color: var(--success); }
.field-status[data-state="error"] { color: var(--error); }

.time-mode { grid-template-columns: 1fr 1fr; }
.time-mode input:checked + label { background: var(--ink); color: white; }
.time-row, .specific-time { display: grid; gap: 10px; }
.specific-time { padding: 12px; gap: 10px; border: 1px solid var(--hairline); border-radius: 3px; background: white; }
.date-time-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 8px; }
.date-time-grid label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-family: var(--font-technical); font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.date-time-grid input { width: 100%; min-width: 0; min-height: 46px; padding: 0 9px; border: 2px solid var(--ink); border-radius: 3px; background: white; color: var(--ink); color-scheme: light; }
.time-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.time-presets button { min-width: 0; min-height: 40px; padding: 7px 6px; border: 1px solid var(--hairline); border-radius: 3px; background: var(--paper); color: var(--ink); font-size: .7rem; font-weight: 800; line-height: 1.2; }
.time-presets button:hover { border-color: var(--ink); background: var(--yellow); }

.recent-routes { border-top: 1px solid var(--hairline); padding-top: 14px; }
.recent-heading { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recent-heading h2 { margin: 0; color: var(--muted); font-family: var(--font-technical); font-size: .7rem; text-transform: uppercase; }
.recent-heading button { min-height: 34px; padding: 4px 8px; border: 1px solid var(--hairline); border-radius: 3px; background: transparent; color: var(--muted); font-family: var(--font-technical); font-size: .62rem; font-weight: 700; }
.recent-heading button:hover { border-color: var(--ink); color: var(--ink); }
.recent-route-list { display: grid; gap: 5px; }
.recent-route { min-width: 0; min-height: 52px; padding: 8px 10px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; border: 1px solid var(--hairline); border-radius: 3px; background: white; color: var(--ink); text-align: left; }
.recent-route:hover { border-color: var(--ink); background: #fbfcfb; }
.recent-route-names { min-width: 0; overflow: hidden; font-size: .82rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.recent-route-time { color: var(--muted); font-family: var(--font-technical); font-size: .62rem; white-space: nowrap; }

.result { min-width: 0; min-height: 290px; padding: 20px; align-self: start; border-top: 5px solid var(--yellow); border-radius: 3px; background: var(--ink); color: white; }
#result-content.is-entering { animation: result-enter 170ms cubic-bezier(.2, .75, .3, 1); }
.result[data-state="error"] { border-top-color: #ff6b6b; }
.result[data-state="night"] { border-top-color: #dce7e2; }
.result-heading { min-height: 25px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result-label { color: #b8c1bd; }
.result-step { color: var(--yellow); font-family: var(--font-technical); font-size: .75rem; font-weight: 700; }
.result-time-control { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid #4d5652; }
.result-time-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.result-time-heading > div { min-width: 0; display: grid; gap: 3px; }
.result-time-label { display: inline-flex; align-items: center; gap: 6px; color: #aeb9b4; font-family: var(--font-technical); font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.result-time-label svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#result-time-output { color: white; font-size: .92rem; font-weight: 750; }
.share-result { min-width: 82px; min-height: 44px; padding: 8px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #6f7a75; border-radius: 3px; background: transparent; color: white; font-family: var(--font-technical); font-size: .68rem; font-weight: 700; text-transform: uppercase; }
.share-result:hover, .share-result:focus-visible { border-color: var(--yellow); background: #252d2a; }
.share-result svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#result-time-slider { width: 100%; height: 32px; margin: 8px 0 0; padding: 0; accent-color: var(--yellow); cursor: ew-resize; }
#result-time-slider::-webkit-slider-runnable-track { height: 5px; border-radius: 0; background: linear-gradient(90deg, #26302c, var(--yellow), #26302c); }
#result-time-slider::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -7px; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 2px white; -webkit-appearance: none; }
.result-time-scale { display: flex; justify-content: space-between; color: #8e9a95; font-family: var(--font-technical); font-size: .55rem; }
.share-status { min-height: 1em; margin: 5px 0 0; color: #b9d9cc; font-size: .66rem; }
.empty-answer, .answer { display: flex; align-items: center; gap: 14px; }
.empty-marker, .side-arrow { flex: 0 0 50px; height: 50px; display: grid; place-items: center; border: 2px solid var(--yellow); border-radius: 50%; color: var(--yellow); font-family: var(--font-technical); font-size: 1.6rem; font-weight: 800; }
.side-arrow { background: var(--yellow); color: var(--ink); }
.night-icon { background: #dce7e2; border-color: #dce7e2; }
.night-icon svg { width: 28px; height: 28px; fill: var(--ink); }
.empty-answer h2, .answer h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 1.65rem; letter-spacing: 0; }
.empty-answer p, .answer p { margin: 0; color: #bdc6c2; font-size: .86rem; line-height: 1.45; }
.route-code { color: var(--yellow); font-family: var(--font-technical); font-size: .68rem; font-weight: 700; }
.result-station-link { padding: 2px 3px; border-radius: 2px; color: inherit; cursor: default; outline: none; transition: color 120ms ease, background-color 120ms ease, box-shadow 120ms ease; }
.result-station-link:hover, .result-station-link:focus-visible { background: #303936; color: white; box-shadow: 0 0 0 1px #77837d; }
.result-station-link:focus-visible { box-shadow: 0 0 0 2px var(--yellow); }
.confidence-row { margin-top: 17px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #bdc6c2; font-family: var(--font-technical); font-size: .7rem; text-transform: uppercase; }
.confidence { padding: 5px 8px; border: 1px solid #93d4bf; border-radius: 2px; color: #c9f0e4; font-weight: 700; }
.confidence-low { border-color: #f0cc78; color: #ffe5ad; }
.night-status { padding: 5px 8px; border: 1px solid #9eaaa5; border-radius: 2px; color: #dce7e2; font-weight: 700; }
.reason { margin: 16px 0 0; color: #e0e5e2; font-size: .9rem; line-height: 1.55; }
.night-fact { margin-top: 18px; padding: 14px 0 0; display: flex; align-items: center; gap: 12px; border-top: 1px solid #4d5652; }
.night-fact > svg { width: 25px; height: 25px; flex: 0 0 auto; fill: none; stroke: var(--yellow); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.night-fact div { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 3px 10px; }
.night-fact span { color: #bdc6c2; font-family: var(--font-technical); font-size: .67rem; text-transform: uppercase; }
.night-fact strong { color: white; font-size: .95rem; }
.night-fact small { grid-column: 1 / -1; color: #9da8a3; font-size: .7rem; }

.result-details { margin-top: 18px; border-top: 1px solid #4d5652; }
.result-details summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; color: white; font-family: var(--font-technical); font-size: .78rem; font-weight: 700; cursor: pointer; list-style: none; text-transform: uppercase; }
.result-details summary::-webkit-details-marker { display: none; }
.result-details summary::after { content: "+"; color: var(--yellow); font-size: 1.25rem; }
.result-details[open] summary::after { content: "−"; }
.orientation-layout { padding: 8px 0 18px; display: grid; justify-items: center; gap: 10px; }
.orientation-plot { position: relative; width: 150px; height: 150px; border: 1px solid #707a75; border-radius: 50%; background: #202725; }
.orientation-plot::before, .orientation-plot::after { content: ""; position: absolute; background: #4e5854; }
.orientation-plot::before { top: 12px; bottom: 12px; left: 50%; width: 1px; }
.orientation-plot::after { top: 50%; right: 12px; left: 12px; height: 1px; }
.compass-label { position: absolute; z-index: 3; color: #9da8a3; font-family: var(--font-technical); font-size: .6rem; font-weight: 700; }
.compass-n { top: 6px; left: 50%; transform: translateX(-50%); }
.compass-e { top: 50%; right: 7px; transform: translateY(-50%); }
.compass-s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.compass-w { top: 50%; left: 7px; transform: translateY(-50%); }
.compass-center { position: absolute; z-index: 5; top: 50%; left: 50%; width: 8px; height: 8px; border: 2px solid var(--ink); border-radius: 50%; background: white; transform: translate(-50%, -50%); }
.compass-vector { position: absolute; z-index: 4; inset: 20px; transform-origin: center; }
.compass-vector::before { content: ""; position: absolute; top: 9px; bottom: 50%; left: calc(50% - 1px); width: 2px; }
.compass-vector::after { content: ""; position: absolute; top: 4px; left: calc(50% - 5px); width: 10px; height: 10px; }
.compass-vector::after { display: none; }
.vector-symbol { position: absolute; z-index: 2; top: -1px; left: 50%; width: 20px; height: 20px; overflow: visible; transform: translate(-50%, -50%); }
.vector-symbol rect, .vector-symbol circle { fill: var(--ink); stroke: currentColor; stroke-width: 2; }
.vector-symbol path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.train-vector { transform: rotate(var(--train-angle)); }
.train-vector::before { background: var(--yellow); }
.train-vector .vector-symbol { color: var(--yellow); }
.sun-vector { transform: rotate(var(--sun-angle)); }
.sun-vector::before { width: 1px; background: #ff8b5c; }
.sun-vector .vector-symbol { color: #ff8b5c; }
.phone-vector { transform: rotate(var(--phone-angle)); }
.phone-vector::before { width: 2px; background: #7ad7c7; }
.phone-vector .vector-symbol { color: #7ad7c7; }
.phone-vector[hidden], #phone-legend[hidden], #phone-direction-row[hidden] { display: none; }
.orientation-side { display: grid; justify-items: center; gap: 10px; }
.orientation-legend { display: flex; gap: 18px; color: #bdc6c2; font-family: var(--font-technical); font-size: .66rem; text-transform: uppercase; }
.orientation-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-icon { width: 17px; height: 17px; overflow: visible; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.train-key { stroke: var(--yellow); }
.sun-key { stroke: #ff8b5c; }
.phone-key { stroke: #7ad7c7; }
.phone-compass-button { min-width: 176px; min-height: 44px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #69736f; border-radius: 3px; background: transparent; color: #e5ebe8; font-family: var(--font-technical); font-size: .68rem; font-weight: 700; text-transform: uppercase; transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease; }
.phone-compass-button:hover, .phone-compass-button:focus-visible { border-color: #7ad7c7; color: #7ad7c7; outline: 0; }
.phone-compass-button:active { background: #234943; }
.phone-compass-button[data-active="true"] { border-color: #7ad7c7; background: #173b35; color: #a7eee2; }
.phone-compass-button:disabled { cursor: wait; opacity: .65; }
.phone-compass-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.phone-compass-status { min-height: 16px; margin: 0; color: #9da8a3; font-size: .68rem; line-height: 1.35; text-align: center; }
.phone-compass-status:empty { display: none; }
.phone-compass-status[data-state="active"] { color: #7ad7c7; }
.phone-compass-status[data-state="denied"], .phone-compass-status[data-state="unsupported"] { color: #ffc3b0; }
.direction-data { display: grid; gap: 0; margin: 0; }
.direction-data > div { padding: 12px 0; display: grid; grid-template-columns: 110px 1fr; gap: 12px; border-top: 1px solid #3e4743; }
.direction-data dt { color: #9da8a3; font-family: var(--font-technical); font-size: .65rem; text-transform: uppercase; }
.direction-data dd { min-width: 0; margin: 0; }
.direction-data strong, .direction-data small { display: block; }
.direction-data strong { color: white; font-size: .87rem; }
.direction-data strong span { color: var(--yellow); font-family: var(--font-technical); font-size: .7rem; }
.direction-data small { margin-top: 3px; color: #aeb8b3; font-family: var(--font-technical); font-size: .65rem; line-height: 1.4; }
.bearing-note { margin: 12px 0 2px; padding-left: 10px; border-left: 2px solid var(--yellow); color: #aeb8b3; font-size: .72rem; line-height: 1.55; }

.limitations { margin-top: 22px; color: var(--muted); }
.limitations summary { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font-family: var(--font-technical); font-size: .72rem; font-weight: 700; cursor: pointer; text-transform: uppercase; }
.limitations div { max-width: 680px; }
.limitations p { margin: 0 0 9px; font-size: .82rem; line-height: 1.55; }

@keyframes locate-spin { to { transform: rotate(360deg); } }
@keyframes result-enter {
  from { opacity: .35; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 780px) {
  main { padding-top: 44px; }
  .site-header { min-height: 72px; }
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(360px, .94fr); gap: 34px; align-items: start; }
  .result { position: sticky; top: 20px; padding: 24px; }
  .orientation-layout { grid-template-columns: 160px 1fr; align-items: center; justify-items: start; }
  .orientation-side { justify-items: start; }
  .orientation-legend { flex-direction: column; }
  .line-schematic { height: 270px; }
}

@media (max-width: 390px) {
  .site-header { gap: 9px; }
  .prototype-label { display: none; }
  .header-actions { gap: 0; }
  .line-control label { font-size: .7rem; }
  .route-heading span:last-child { max-width: 60%; }
  .result { padding: 17px; }
  .time-presets { grid-template-columns: 1fr; }
  .time-presets button { min-height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .route-direction-chevron { transition: none !important; }
}
