:root {
  --bg: #ffffff;
  --bg-2: #f3f5f8;
  --bg-3: #e6eaf0;
  --fg: #14181f;
  --fg-2: #4c5563;
  --fg-3: #737d8c;
  --line: #dde2e9;
  --accent: #0b5fa5;
  --accent-fg: #ffffff;
  --live: #0a8a3a;
  --late: #b45309;
  --danger: #b42318;
  --shadow: 0 6px 24px rgba(15, 25, 40, .16);
  --radius: 14px;
  --fs: 16px;
  --panel-w: 400px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #13171d; --bg-2: #1b2028; --bg-3: #262c36; --fg: #eef1f5; --fg-2: #b4bcc8; --fg-3: #8a93a1;
    --line: #2c333e; --accent: #5aa9ff; --accent-fg: #06121f; --live: #3ddc84; --late: #f5a524; --danger: #ff6b5e;
    --shadow: 0 6px 24px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #13171d; --bg-2: #1b2028; --bg-3: #262c36; --fg: #eef1f5; --fg-2: #b4bcc8; --fg-3: #8a93a1;
  --line: #2c333e; --accent: #5aa9ff; --accent-fg: #06121f; --live: #3ddc84; --late: #f5a524; --danger: #ff6b5e;
  --shadow: 0 6px 24px rgba(0, 0, 0, .5); color-scheme: dark;
}
/* High contrast: pure black/white/yellow, thick outlines */
:root.high-contrast {
  --bg: #000; --bg-2: #000; --bg-3: #1a1a1a; --fg: #fff; --fg-2: #fff; --fg-3: #ffe600;
  --line: #fff; --accent: #ffe600; --accent-fg: #000; --live: #00ff7f; --late: #ffb000; --danger: #ff4d4d; color-scheme: dark;
}
:root.large-text { --fs: 21px; --panel-w: 480px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: var(--fs)/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--fg); overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 2000; background: var(--accent); color: var(--accent-fg); padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.high-contrast :focus-visible { outline-width: 4px; }

#app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: var(--bg-3); }

/* ---------- panel ---------- */
#panel {
  position: absolute; z-index: 1000; top: 12px; left: 12px; bottom: 12px; width: var(--panel-w); max-width: calc(100vw - 24px);
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.high-contrast #panel { border: 2px solid var(--line); }
.sheet-handle { display: none; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 6px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.brand svg { width: 28px; height: 28px; }
.brand h1 { margin: 0; font-size: 1.15em; color: var(--fg); letter-spacing: -.01em; }
.brand small { font-weight: 500; color: var(--fg-3); font-size: .75em; margin-left: 4px; }
.icon-btn { background: none; border: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--fg-2); }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn svg { width: 24px; height: 24px; }

.search { position: relative; margin: 4px 12px 8px; }
.search > svg { position: absolute; left: 12px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.search input {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  padding: 0 14px 0 40px; outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--bg); }
.search-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: 50px; max-height: 60vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.search-results h3 { margin: 0; padding: 10px 14px 4px; font-size: .75em; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); }

.tabs { display: flex; gap: 6px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a {
  flex: 1 0 auto; text-align: center; padding: 10px 6px 11px; color: var(--fg-2); text-decoration: none; font-weight: 600; font-size: .9em;
  border-bottom: 3px solid transparent; white-space: nowrap; min-width: 0; padding-left: 4px; padding-right: 4px;
}
.tabs a.tab-icon { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding-left: 10px; padding-right: 10px; }
.tabs a.tab-icon .badge { margin-left: 2px; }
.tabs a[aria-current="page"] { color: var(--accent); border-color: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .72em; line-height: 18px; vertical-align: 1px; }

.panel-body { flex: 1; overflow: auto; overscroll-behavior: contain; outline: none; padding-bottom: 24px; }

/* ---------- generic list items ---------- */
.section-title { margin: 14px 16px 6px; font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-3); font-weight: 700; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px; border: 0; background: none; text-align: left;
  cursor: pointer; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none;
}
.item:hover, .item[aria-selected="true"] { background: var(--bg-2); }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--fg-2); font-size: .86em; overflow: hidden; text-overflow: ellipsis; }
.muted { color: var(--fg-3); }
.empty { padding: 28px 20px; text-align: center; color: var(--fg-2); }
.empty strong { display: block; color: var(--fg); margin-bottom: 4px; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 30px; padding: 0 8px; border-radius: 8px;
  font-weight: 800; font-size: .95em; letter-spacing: -.01em; flex-shrink: 0;
}
.chip.sm { min-width: 30px; height: 22px; font-size: .75em; border-radius: 6px; padding: 0 5px; }
.high-contrast .chip { outline: 2px solid #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- nearby cards ---------- */
.card {
  display: block; width: calc(100% - 24px); margin: 8px 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); text-align: left; cursor: pointer; color: inherit;
}
.card:hover { border-color: var(--accent); }
.card-top { display: flex; align-items: center; gap: 10px; }
.card-top .headsign { flex: 1; font-weight: 700; line-height: 1.2; }
.card-top .headsign small { display: block; font-weight: 500; color: var(--fg-2); font-size: .8em; margin-top: 2px; }
.times { display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; text-align: right; }
.time-big { font-size: 1.6em; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.time-big small { font-size: .45em; font-weight: 700; margin-left: 2px; }
.time-next { color: var(--fg-2); font-weight: 600; font-size: .95em; }
.live { color: var(--live); }
.live-dot { display: inline-block; width: 12px; height: 12px; margin-right: 2px; vertical-align: 2px; }
.live-dot svg { width: 12px; height: 12px; display: block; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot svg { animation: none; } * { transition: none !important; } }

/* ---------- detail header ---------- */
.detail-head { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); }
.detail-head .row { display: flex; align-items: center; gap: 10px; }
.detail-head h2 { margin: 0; font-size: 1.2em; line-height: 1.2; flex: 1; }
.detail-head .meta { color: var(--fg-2); font-size: .88em; margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--accent); font-weight: 600; padding: 4px 0; margin-bottom: 6px; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--bg-2); cursor: pointer; font-weight: 600; font-size: .9em; color: var(--fg);
}
.btn svg { width: 18px; height: 18px; }
a.btn, a.item { text-decoration: none; }
.alert summary { cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.seg { display: flex; margin: 10px 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; padding: 9px 8px; border: 0; background: none; cursor: pointer; font-weight: 600; font-size: .88em; color: var(--fg-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

/* departures list */
.dep { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.dep .main { flex: 1; min-width: 0; }
.dep .title { font-weight: 600; }
.dep .sub { font-size: .84em; color: var(--fg-2); }
.dep .when { text-align: right; min-width: 70px; }
.dep .bell { background: none; border: 0; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; color: var(--fg-3); display: grid; place-items: center; }
.dep .bell svg { width: 22px; height: 22px; }
.dep .bell[aria-pressed="true"] { color: var(--accent); background: var(--bg-2); }
.late { color: var(--late); }
.canceled { color: var(--danger); text-decoration: line-through; }

/* timeline (route / trip / itinerary) */
.timeline { list-style: none; margin: 0; padding: 8px 0 8px; }
.timeline li { position: relative; display: flex; gap: 12px; padding: 8px 16px 8px 46px; cursor: pointer; }
.timeline li:hover { background: var(--bg-2); }
.timeline li::before { content: ""; position: absolute; left: 24px; top: 0; bottom: 0; width: 4px; background: var(--c, var(--accent)); }
.timeline li:first-child::before { top: 50%; }
.timeline li:last-child::before { bottom: 50%; }
.timeline li::after { content: ""; position: absolute; left: 19px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--bg); border: 3px solid var(--c, var(--accent)); box-sizing: border-box; }
.timeline li.passed { opacity: .5; }
.timeline li.bus-here::after { background: var(--c, var(--accent)); width: 18px; height: 18px; left: 17px; margin-top: -9px; }
.timeline .name { flex: 1; }
.timeline .t { font-variant-numeric: tabular-nums; color: var(--fg-2); font-size: .9em; }

/* itineraries */
.itin { display: block; width: calc(100% - 24px); margin: 8px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); text-align: left; cursor: pointer; color: inherit; }
.itin:hover, .itin.selected { border-color: var(--accent); }
.itin .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.itin .dur { font-size: 1.25em; font-weight: 800; }
.itin .span { color: var(--fg-2); font-weight: 600; }
.itin .legs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-top: 8px; color: var(--fg-3); }
.itin .legs svg { width: 18px; height: 18px; }
.itin .info { margin-top: 6px; font-size: .85em; color: var(--fg-2); }
.leg { padding: 10px 16px 10px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.leg .ic { width: 40px; flex-shrink: 0; display: flex; justify-content: center; padding-top: 2px; color: var(--fg-3); }
.leg .ic svg { width: 24px; height: 24px; }
.leg .body { flex: 1; }
.leg .body .title { font-weight: 700; }
.leg .body .sub { color: var(--fg-2); font-size: .88em; }
.leg details summary { cursor: pointer; color: var(--accent); font-size: .88em; margin-top: 4px; }
.leg details ol { margin: 6px 0 0; padding-left: 20px; font-size: .88em; color: var(--fg-2); }

/* forms */
.plan-form { padding: 12px 16px 4px; display: grid; gap: 8px; }
.field { position: relative; display: flex; align-items: center; gap: 8px; }
.field .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.field input, .field select { flex: 1; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg-2); min-width: 0; }
.field input:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.field .suggest { position: absolute; left: 20px; right: 0; top: 48px; z-index: 6; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; }
.swap { position: absolute; right: 16px; top: 34px; }
.plan-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-row select, .plan-row input { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--bg-2); }

.alert { margin: 8px 12px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--late) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--late) 40%, var(--line)); }
.alert h3 { margin: 0 0 4px; font-size: 1em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert p { margin: 6px 0 0; white-space: pre-line; color: var(--fg-2); font-size: .9em; }
.alert details summary { cursor: pointer; font-size: .88em; color: var(--accent); margin-top: 4px; }

.setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.setting .label { font-weight: 600; }
.setting .desc { font-size: .85em; color: var(--fg-2); }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--bg-3); border: 1px solid var(--line); transition: .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--accent-fg); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* guide-to-stop (NaviLens-style wayfinding) */
.guide { text-align: center; padding: 18px 16px; }
.guide .arrow { width: 160px; height: 160px; margin: 6px auto; transition: transform .25s; }
.guide .dist { font-size: 2.4em; font-weight: 800; letter-spacing: -.02em; }
.guide .hint { color: var(--fg-2); }

.note { margin: 10px 16px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); color: var(--fg-2); font-size: .86em; }
.footer-note { margin: 18px 16px; font-size: .78em; color: var(--fg-3); }

/* ---------- map ---------- */
.map-controls { position: absolute; z-index: 900; right: 12px; bottom: 28px; display: flex; flex-direction: column; gap: 10px; }
.fab { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--bg); color: var(--fg-2); box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; }
.fab svg { width: 24px; height: 24px; }
.fab[aria-pressed="true"] { color: var(--accent); }
.pill-btn { position: absolute; z-index: 900; top: 14px; left: calc(var(--panel-w) + 24px + (100vw - var(--panel-w) - 24px) / 2); transform: translateX(-50%); border: 0; border-radius: 22px; padding: 10px 18px; background: var(--bg); color: var(--accent); font-weight: 700; box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; font-size: .9em; }
.toast { position: fixed; z-index: 3000; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 90vw; font-weight: 600; }

.leaflet-container { font: inherit; background: var(--bg-3); }
.dark-tiles .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9); }
.bus-marker { position: relative; }
.bus-marker .b {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 30px; height: 22px; padding: 0 5px; border-radius: 11px;
  display: grid; place-items: center; font: 800 12px/1 system-ui, sans-serif; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.bus-marker .dir { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.bus-marker .dir::before { content: ""; position: absolute; left: -6px; top: -24px; border: 6px solid transparent; border-bottom: 9px solid var(--c); }
.stop-marker { border-radius: 50%; }
.me-marker { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.25); }
.place-pin { width: 20px; height: 20px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.leaflet-popup-content { margin: 10px 12px; font-size: 14px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--bg); color: var(--fg); }
.popup-btn { margin-top: 6px; border: 0; background: var(--accent); color: var(--accent-fg); border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; }

/* ---------- mobile: bottom sheet ---------- */
@media (max-width: 760px) {
  #panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 58vh; border-radius: 18px 18px 0 0; transition: height .2s; padding-bottom: env(safe-area-inset-bottom); }
  #panel.collapsed { height: 168px; }
  #panel.full { height: calc(100vh - 56px); }
  .sheet-handle { display: block; width: 100%; height: 20px; border: 0; background: none; cursor: pointer; padding: 0; }
  .sheet-handle span { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--bg-3); margin: 8px auto 0; }
  .panel-header { padding-top: 0; }
  .map-controls { bottom: calc(58vh + 12px); transition: bottom .2s; }
  #panel.collapsed ~ .map-controls { bottom: 180px; }
  #panel.full ~ .map-controls { display: none; }
  .pill-btn { left: 50%; }
}

/* ---------- closest bus / bunching / flags ---------- */
.bus-line { display: inline-flex; align-items: center; gap: 4px; color: var(--live); font-weight: 600; font-size: .92em; }
.bus-line svg { flex-shrink: 0; }
.flag { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; font-size: .8em; font-weight: 700; line-height: 1.5; }
.flag.bad { background: color-mix(in srgb, var(--danger) 14%, var(--bg)); color: var(--danger); }
.flag.warn { background: color-mix(in srgb, var(--late) 14%, var(--bg)); color: var(--late); }
.flag.ok { background: color-mix(in srgb, var(--live) 14%, var(--bg)); color: var(--live); }
.high-contrast .flag { border: 1px solid currentColor; background: #000; }
.closest.card { cursor: default; border-color: var(--accent); border-width: 2px; }
.bus-marker.hl .b { transform: translate(-50%, -50%) scale(1.25); box-shadow: 0 0 0 4px rgba(26,115,232,.35), 0 1px 4px rgba(0,0,0,.4); }
.seg a { flex: 1; padding: 9px 8px; text-align: center; text-decoration: none; font-weight: 600; font-size: .88em; color: var(--fg-2); }
.seg a[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.seg { overflow-x: auto; scrollbar-width: none; }

/* ---------- day strip ---------- */
.daystrip { display: flex; gap: 6px; padding: 10px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.daystrip a { flex-shrink: 0; padding: 7px 12px; border-radius: 18px; border: 1px solid var(--line); text-decoration: none; color: var(--fg-2); font-weight: 600; font-size: .85em; background: var(--bg-2); }
.daystrip a[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ---------- full timetable ---------- */
.hourrow { display: flex; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.hourrow .hr { width: 52px; flex-shrink: 0; font-weight: 800; color: var(--fg-2); padding-top: 4px; }
.hourrow .mins { display: flex; flex-wrap: wrap; gap: 6px; }
.hourrow .min { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 8px; background: var(--bg-2); color: var(--fg); text-decoration: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.hourrow .min small { color: var(--fg-3); font-weight: 700; }
.hourrow .min.past { opacity: .4; }
.dotc { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- my schedule ---------- */
.summary { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.summary .flag { font-size: .85em; }
.gantt { margin: 10px 12px 4px; padding: 26px 10px 8px; border: 1px solid var(--line); border-radius: 12px; position: relative; }
.gantt-axis { position: absolute; left: 62px; right: 10px; top: 6px; height: 16px; font-size: .68em; color: var(--fg-3); }
.gantt-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.lane { display: flex; align-items: center; gap: 8px; height: 30px; }
.lane-label { width: 44px; flex-shrink: 0; }
.lane-track { position: relative; flex: 1; height: 18px; background: var(--bg-2); border-radius: 4px; }
.lane-track .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.lane-track .now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--danger); z-index: 2; }
.lane-track .bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; opacity: .9; }
.lane-track .bar.bad { outline: 2px solid var(--danger); outline-offset: 1px; z-index: 1; }
.lane-track .bar.warn { outline: 2px solid var(--late); outline-offset: 1px; }
.dep.ride { cursor: pointer; align-items: flex-start; }
.dep.ride .flag { display: block; width: fit-content; }
.dep.is-past { opacity: .5; }
.dep.pulse { background: color-mix(in srgb, var(--accent) 18%, var(--bg)); transition: background .3s; }
.sched-form label { display: grid; gap: 4px; font-weight: 600; font-size: .9em; }
.sched-form select, .sched-form input:not([type="checkbox"]) { height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--bg-2); font-weight: 400; min-width: 0; width: 100%; }
.sched-form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; }
.sched-form legend { font-weight: 600; font-size: .9em; padding: 0 4px; }
.sched-form .plan-row label { flex: 1; }
.days { display: flex; gap: 6px; }
.day { position: relative; }
.day input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.day span[aria-hidden] { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg-2); font-weight: 700; }
.day input:checked + span { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.day input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- nearby: walk-aware cards + pins ---------- */
.card { position: relative; }
.card .times { align-items: flex-start; }
.card .leave { font-size: .78em; font-weight: 700; color: var(--fg-2); text-align: right; margin-top: 2px; white-space: nowrap; }
.card .then { text-align: right; margin-top: 4px; font-size: .85em; }
.card .pin { background: none; border: 0; width: 34px; height: 34px; margin: -6px -8px 0 0; border-radius: 50%; color: var(--fg-3); cursor: pointer; display: grid; place-items: center; align-self: flex-start; opacity: .55; }
.card .pin svg { width: 18px; height: 18px; }
.card .pin:hover, .card .pin:focus-visible { opacity: 1; background: var(--bg-2); }
.card.pinned { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.card.pinned .pin { opacity: 1; color: var(--accent); }

/* ---------- trip options on a shared clock ---------- */
.it-axis { position: relative; height: 22px; margin: 6px 26px 0; }
.it-axis span { position: absolute; top: 2px; transform: translateX(-50%); font-size: .7em; color: var(--fg-3); white-space: nowrap; }
.it-axis i { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--line); }
.itin .top .span b { font-weight: 800; color: var(--fg); }
.itin .top .span b.live { color: var(--live); }
.itin-track { position: relative; height: 30px; margin: 22px 0 4px; }
.itin-track .seg { position: absolute; top: 3px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: .82em; overflow: hidden; white-space: nowrap; }
.itin-track .seg.walk { top: 13px; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--fg-3) 0 4px, transparent 4px 8px); }
.itin-track .seg-alt { position: absolute; top: -20px; font-size: .72em; color: var(--fg-3); white-space: nowrap; display: flex; gap: 3px; align-items: center; }
.itin-track .seg-alt .chip.sm { height: 17px; min-width: 22px; font-size: .9em; }

/* ---------- choose a departure ---------- */
.dep-picker { display: flex; gap: 8px; padding: 2px 16px 12px; overflow-x: auto; scrollbar-width: none; }
.dep-picker .pick { flex: 0 0 auto; min-width: 74px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; display: grid; justify-items: center; line-height: 1.05; color: var(--fg); }
.dep-picker .pick .big { font-size: 1.6em; font-weight: 800; }
.dep-picker .pick small { font-size: .72em; font-weight: 700; color: var(--fg-2); }
.dep-picker .pick .clock { font-size: .72em; color: var(--fg-3); margin-top: 3px; }
.dep-picker .pick[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.dep-picker .pick[aria-pressed="true"] small, .dep-picker .pick[aria-pressed="true"] .clock, .dep-picker .pick[aria-pressed="true"] .live { color: var(--accent-fg); }

/* ---------- trip companion ---------- */
.companion { position: relative; flex-shrink: 0; margin: 0 10px 10px; padding: 12px 14px 10px; border-radius: 14px; background: var(--accent); color: var(--accent-fg); box-shadow: var(--shadow); }
.companion.urgent { background: var(--live); color: #fff; }
.companion a { color: inherit; text-decoration: none; display: block; }
.comp-title { font-size: 1.35em; font-weight: 800; letter-spacing: -.01em; padding-right: 30px; }
.comp-sub { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9em; margin-top: 2px; }
.comp-sub .live { color: inherit; text-decoration: underline dotted; }
.comp-track { position: relative; height: 20px; margin: 10px 0 6px; }
.comp-walk { position: absolute; left: 0; top: 8px; height: 4px; background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 9px); opacity: .8; }
.comp-ride { position: absolute; right: 0; top: 5px; height: 10px; border-radius: 5px; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }
.comp-you { position: absolute; top: -2px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: #fff; color: #1a1a1a; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.35); transition: left .5s; }
.comp-you svg { width: 16px; height: 16px; }
.comp-foot { display: flex; justify-content: space-between; font-weight: 700; font-size: .88em; }
.comp-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: inherit; cursor: pointer; font-size: 1em; z-index: 1; }
.high-contrast .companion { border: 2px solid #fff; }
.it-axis span.first { transform: none; }
.it-axis span.last { transform: translateX(-100%); }
.itin-track .seg.narrow { font-size: 0; box-shadow: 0 0 0 2px var(--bg); }

/* ---------- detours ---------- */
.detour { margin: 10px 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--bg)); }
.detour-title { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--danger); }
.detour .sub { color: var(--fg-2); font-size: .88em; margin-top: 4px; }
.detour .btn { margin-top: 8px; height: auto; min-height: 40px; padding: 6px 14px; text-align: left; }
.high-contrast .detour { background: #000; }
.closed-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 5px; background: var(--danger); color: #fff; font-size: .72em; font-weight: 800; vertical-align: 1px; }
.timeline li.closed .name { text-decoration: line-through; text-decoration-color: var(--danger); color: var(--fg-3); }
.timeline li.closed .closed-tag { text-decoration: none; }
.timeline li.closed::after { border-color: var(--fg-3); background: var(--bg-3); }
.hourrow .min.closed { text-decoration: line-through; text-decoration-color: var(--danger); opacity: .55; }

/* ---------- schedule updates ---------- */
.news { margin: 10px 12px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.news-title { display: flex; justify-content: space-between; align-items: center; font-weight: 800; }
.news-x { background: none; border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--fg-2); }
.news-x:hover { background: var(--bg-2); }
.news .sub { color: var(--fg-2); font-size: .88em; }
.news summary { cursor: pointer; color: var(--accent); font-size: .88em; margin-top: 6px; }
.news ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: .9em; }
.news li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.news li a { text-decoration: none; }
.tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; font-size: .7em; font-weight: 800; vertical-align: 2px; }
.tag.new { background: var(--live); color: #fff; }
.tag.upd { background: var(--late); color: #fff; }

/* ---------- detour paths on the map ---------- */
.detour-pill { display: inline-block; padding: 2px 8px; border-radius: 10px; color: #fff; font: 800 11px/16px system-ui, sans-serif; letter-spacing: .06em; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); white-space: nowrap; }
.legend { margin-top: 8px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, var(--danger) 25%, var(--line)); display: grid; gap: 4px; font-size: .84em; color: var(--fg-2); }
.legend > div { display: flex; align-items: center; gap: 8px; }
.lg-line { width: 28px; height: 6px; border-radius: 3px; flex-shrink: 0; }
.lg-dash { width: 28px; height: 0; border-top: 3px dotted currentColor; flex-shrink: 0; opacity: .8; }
.lg-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #b42318; background: #fff; flex-shrink: 0; margin: 0 8px; }

/* ---------- bus switches (interlining) ---------- */
.becomes { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; font-size: .82em; font-weight: 700; color: var(--fg-2); }
.becomes .chip.sm { height: 18px; min-width: 24px; font-size: .9em; }
.becomes.block { display: flex; margin-top: 8px; }
.card.continue { cursor: default; border-style: dashed; }
.interlines { margin: 8px 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; }
.interlines summary { cursor: pointer; font-size: .92em; }
.interlines .il-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: .9em; }
.interlines .il-row a { text-decoration: none; }
.interlines .sub { margin-top: 8px; font-size: .82em; color: var(--fg-2); }
.itin-track .seg.becomes-next { border-top-right-radius: 0; border-bottom-right-radius: 0; clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, 0 100%); }
.itin-track .seg.stay { border-top-left-radius: 0; border-bottom-left-radius: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 7px 50%); }
