:root {
  color-scheme: light;
  --background: #f4f5f7;
  --surface: #ffffff;
  --surface-elevated: rgba(255, 255, 255, .88);
  --surface-subtle: #f8f9fb;
  --text: #14161a;
  --muted: #646b76;
  --border: #e1e4e9;
  --border-strong: #cfd4dc;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-bright: #14b8a6;
  --accent-soft: #dff7f3;
  --focus: #005fcc;
  --success: #17613b;
  --success-bg: #e9f8ef;
  --warning: #755600;
  --warning-bg: #fff7dd;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%), 0 4px 12px rgb(15 23 42 / 4%);
  --shadow-md: 0 14px 34px rgb(15 23 42 / 9%);
  --shadow-lg: 0 28px 70px rgb(15 23 42 / 14%);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 40%, transparent); outline-offset: 2px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner, main, footer { width: min(1280px, calc(100% - 32px)); margin-inline: auto; }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: white; font-weight: 800; font-size: 1.25rem; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); }
.status-group { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status-pill { border: 1px solid var(--border); border-radius: 999px; padding: 7px 11px; font-size: .82rem; background: var(--surface); white-space: nowrap; }
.status-pill.ready, .source-state.ready, .data-badge.ready { background: var(--success-bg); color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.status-pill.warning, .source-state.warning, .data-badge.warning { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); }
.status-pill.error, .source-state.error, .data-badge.error { background: var(--accent-soft); color: var(--accent-dark); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }

main { padding-block: 52px 72px; }
.hero { max-width: 820px; margin-bottom: 30px; }
.eyebrow { color: var(--accent-dark); text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 750; margin: 0 0 6px; }
h1 { font-size: clamp(2rem, 6vw, 4rem); line-height: 1.04; letter-spacing: -.04em; margin: 0 0 18px; }
h2 { font-size: 1.35rem; margin: 0; letter-spacing: -.02em; }
h3 { margin: 0 0 12px; font-size: 1.05rem; }
.hero-copy { color: var(--muted); font-size: 1.1rem; max-width: 760px; margin: 0; }

.notice { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--warning-bg); border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); border-radius: 14px; padding: 14px 16px; margin-bottom: 24px; }
.notice code { background: color-mix(in srgb, var(--surface) 80%, var(--warning-bg)); padding: 2px 6px; border-radius: 5px; }
.hidden { display: none !important; }

.search-panel, .detail-panel, .data-summary { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.search-panel { padding: 18px; margin-bottom: 32px; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tab { border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 8px 14px; font-weight: 700; }
.tab.active { background: var(--accent-soft); color: var(--accent-dark); }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.search-field span, .pattern-control span { display: block; font-size: .875rem; font-weight: 700; margin-bottom: 6px; }
.search-field input, .pattern-select { width: 100%; border: 1px solid var(--border-strong); border-radius: 12px; padding: 13px 14px; background: var(--surface); color: var(--text); }
.primary-button { border: 0; border-radius: 12px; background: var(--accent); color: #fff; padding: 13px 20px; font-weight: 750; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 9px 12px; font-weight: 700; }

.content-grid { display: grid; grid-template-columns: minmax(300px, .72fr) minmax(0, 1.28fr); gap: 24px; align-items: start; }
.results-column { min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 14px; }
.section-heading.small { align-items: center; margin-bottom: 10px; }
.result-list { display: grid; gap: 10px; }
.result-card { width: 100%; text-align: left; display: flex; gap: 14px; justify-content: space-between; align-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 15px 16px; color: inherit; }
.result-card:hover, .result-card.selected { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 72%, var(--surface)); }
.result-main { min-width: 0; flex: 1; }
.result-main strong, .result-main span { display: block; }
.result-main span { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.route-badge { flex: 0 0 auto; min-width: 44px; padding: 7px 9px; border-radius: 9px; text-align: center; background: var(--surface-subtle); font-weight: 800; }
.chevron { color: var(--muted); font-size: 1.3rem; }
.empty-state { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 28px; color: var(--muted); text-align: center; display: grid; gap: 5px; }
.empty-state.compact { border: 0; padding: 38px 22px; }

.detail-panel { min-height: 320px; overflow: hidden; position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; }
.detail-panel.route-detail { max-height: none; position: static; overflow: visible; }
.detail-header { padding: 20px; border-bottom: 1px solid var(--border); }
.detail-header p { margin: 5px 0 0; color: var(--muted); }
.route-header { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .55fr); gap: 18px; align-items: end; }
.pattern-control { min-width: 0; }
.detail-body { padding: 20px; }
.route-detail-body { display: grid; grid-template-columns: minmax(0, .8fr) minmax(260px, 1.2fr); gap: 24px; }
.route-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.route-chip { background: var(--surface-subtle); border-radius: 999px; padding: 5px 9px; font-size: .82rem; font-weight: 750; }
.schedule-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 16px; align-items: end; }
.schedule-controls label span { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.schedule-controls input { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 9px; padding: 9px; }
.live-indicator { color: var(--success); background: var(--success-bg); border-radius: 999px; padding: 4px 8px; font-size: .78rem; font-weight: 700; }
.section-divider { height: 1px; background: var(--border); margin: 24px 0; }

.departures { display: grid; gap: 0; }
.departure { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); align-items: center; }
.departure:last-child { border-bottom: 0; }
.departure.is-canceled { opacity: .65; }
.departure-time-block strong, .departure-time-block span { display: block; font-variant-numeric: tabular-nums; }
.departure-time-block strong { font-size: 1.02rem; }
.departure-time-block span { color: var(--muted); font-size: .82rem; }
.departure-details { min-width: 0; }
.departure-details strong, .departure-details > span { display: block; }
.departure-details > span { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.departure-title { display: flex; gap: 8px; align-items: center; min-width: 0; }
.departure-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-route-badge { min-width: 35px; text-align: center; padding: 3px 6px; border-radius: 6px; font-size: .78rem; font-weight: 800; }
.data-badge, .source-state { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 4px 7px; font-size: .72rem; font-weight: 750; white-space: nowrap; }
.data-badge.scheduled { background: var(--surface-subtle); color: var(--muted); }

.alert-list { display: grid; gap: 10px; margin-top: 10px; }
.alert-card { border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--border)); background: var(--warning-bg); color: var(--text); border-radius: 12px; padding: 12px; }
.alert-card strong { display: block; margin: 5px 0; }
.alert-card p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; white-space: pre-line; }
.alert-topline { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.alert-effect { text-transform: uppercase; letter-spacing: .05em; color: var(--warning); font-size: .7rem; font-weight: 800; }

.route-map-wrap { position: relative; border-bottom: 1px solid var(--border); }
.route-map { width: 100%; height: 430px; background: var(--surface-subtle); }
.map-status { position: absolute; left: 12px; bottom: 12px; z-index: 2; }
.map-popup { display: grid; gap: 3px; min-width: 160px; }
.map-popup span { color: var(--muted); font-size: .82rem; }
.maplibregl-popup-content {
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.maplibregl-popup-tip { border-color: var(--surface); }
.maplibregl-popup-close-button { color: var(--muted); font-size: 1.1rem; }
.maplibregl-popup-close-button:hover { color: var(--text); background: var(--surface-subtle); }
.maplibregl-ctrl-group { overflow: hidden; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.maplibregl-ctrl-group button { background-color: var(--surface); }
.maplibregl-ctrl-group button:hover { background-color: var(--surface-subtle); }
.maplibregl-ctrl-attrib { color: var(--muted); background: color-mix(in srgb, var(--surface) 88%, transparent); }
.maplibregl-ctrl-attrib a { color: var(--accent-dark); }
:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) hue-rotate(180deg); }
:root[data-theme="dark"] .maplibregl-popup-content { border-color: var(--border); color: var(--text); background: var(--surface); }
:root[data-theme="dark"] .maplibregl-popup-tip { border-color: var(--surface); }
:root[data-theme="dark"] .maplibregl-popup-anchor-top .maplibregl-popup-tip,
:root[data-theme="dark"] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
:root[data-theme="dark"] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); border-left-color: transparent; border-right-color: transparent; }
:root[data-theme="dark"] .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
:root[data-theme="dark"] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
:root[data-theme="dark"] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); border-left-color: transparent; border-right-color: transparent; }
:root[data-theme="dark"] .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); border-top-color: transparent; border-bottom-color: transparent; }
:root[data-theme="dark"] .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); border-top-color: transparent; border-bottom-color: transparent; }
:root[data-theme="dark"] .maplibregl-ctrl-group { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .maplibregl-ctrl-group button { background-color: var(--surface); }
:root[data-theme="dark"] .maplibregl-ctrl-group button + button { border-top-color: var(--border); }
:root[data-theme="dark"] .maplibregl-ctrl-attrib,
:root[data-theme="dark"] .maplibregl-ctrl-attrib.maplibregl-compact { color: var(--muted); background: color-mix(in srgb, var(--surface) 92%, transparent); }
:root[data-theme="dark"] .maplibregl-ctrl-attrib a { color: var(--accent-dark); }
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button { background-image: none; background-color: transparent; }
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button::after { content: 'i'; display: block; color: var(--muted); font: 700 14px/24px Georgia, serif; }
.stop-sequence { list-style: none; padding: 0; margin: 0; display: grid; }
.stop-sequence li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; position: relative; padding: 0 0 16px; }
.stop-sequence li:not(:last-child)::before { content: ''; position: absolute; left: 16px; top: 29px; bottom: -2px; width: 2px; background: var(--border-strong); }
.sequence-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-dark); font-size: .72rem; font-weight: 800; z-index: 1; }
.stop-sequence strong, .stop-sequence span { display: block; }
.stop-sequence div > span { color: var(--muted); font-size: .8rem; }
.route-stop-list { max-height: 560px; overflow-y: auto; padding-right: 6px; }

.data-summary { margin-top: 42px; padding: 20px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.metric { background: var(--surface-subtle); border-radius: 12px; padding: 13px; }
.metric strong, .metric span { display: block; }
.metric strong { font-size: 1.25rem; }
.metric span { color: var(--muted); font-size: .82rem; }
.source-list { margin-top: 16px; display: grid; gap: 8px; }
.source-row { border-top: 1px solid var(--border); padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.source-row strong, .source-row div span { display: block; }
.source-row div span { color: var(--muted); font-size: .82rem; }
.muted { color: var(--muted); }
footer { color: var(--muted); border-top: 1px solid var(--border); padding-block: 24px 40px; font-size: .9rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .content-grid { grid-template-columns: 1fr; }
  .detail-panel { position: static; max-height: none; }
  .route-detail-body { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .route-header { grid-template-columns: 1fr; }
  .route-map { height: 360px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .header-inner, main, footer { width: min(100% - 20px, 1280px); }
  .header-inner { min-height: 68px; }
  .brand small { display: none; }
  .status-group { gap: 4px; }
  .status-pill { font-size: .72rem; padding: 5px 7px; }
  main { padding-block: 34px 56px; }
  .search-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .schedule-controls { grid-template-columns: 1fr 1fr; }
  .schedule-controls button { grid-column: 1 / -1; }
  .departure { grid-template-columns: 58px 1fr; }
  .departure > .data-badge { grid-column: 2; justify-self: start; }
  .route-map { height: 320px; }
}
.alert-map-indicator { color: var(--warning); background: var(--warning-bg); border-radius: 999px; padding: 4px 8px; font-size: .78rem; font-weight: 700; }
.map-status { display: flex; gap: 6px; flex-wrap: wrap; }

/* Phase 4–5: PWA shell, planner, saved views and accessibility */
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0d0f12;
  --surface: #171a1f;
  --surface-elevated: rgba(23, 26, 31, .88);
  --surface-subtle: #1c2026;
  --text: #f4f6f8;
  --muted: #aab1bb;
  --border: #30353d;
  --border-strong: #444b55;
  --accent: #2dd4bf;
  --accent-dark: #5eead4;
  --accent-bright: #5eead4;
  --accent-soft: #123f3b;
  --focus: #72a9ff;
  --success: #80d7a5;
  --success-bg: #173226;
  --warning: #f1d277;
  --warning-bg: #352e18;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 22%), 0 6px 18px rgb(0 0 0 / 18%);
  --shadow-md: 0 18px 40px rgb(0 0 0 / 28%);
  --shadow-lg: 0 30px 80px rgb(0 0 0 / 38%);
}
:root[data-large-text="true"] { font-size: 112.5%; }
:root[data-reduced-motion="true"] *,
:root[data-reduced-motion="true"] *::before,
:root[data-reduced-motion="true"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
.skip-link { position: fixed; left: 12px; top: 8px; z-index: 100; transform: translateY(-150%); background: var(--surface); color: var(--text); padding: 10px 14px; border: 2px solid var(--focus); border-radius: 8px; }
.skip-link:focus { transform: none; }
.offline-banner { background: var(--warning-bg); color: var(--warning); border-bottom: 1px solid var(--border); padding: 8px 16px; text-align: center; font-weight: 650; }
.header-inner { flex-wrap: wrap; padding-block: 10px; }
.app-nav { display: flex; gap: 4px; background: var(--background); border-radius: 12px; padding: 4px; }
.nav-button { border: 0; background: transparent; color: var(--muted); border-radius: 9px; padding: 8px 13px; font-weight: 750; }
.nav-button.active { color: var(--accent-dark); background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.icon-button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 8px 11px; font-weight: 700; }
.compact-hero { margin-bottom: 24px; }
.compact-hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
.selection-actions { margin: 18px 0 32px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.secondary-button:disabled, .primary-button:disabled { opacity: .55; cursor: not-allowed; }

.planner-layout { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.planner-panel, .planner-results-wrap, .saved-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.location-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: start; }
.location-picker > label, .planner-controls label > span { display: block; font-weight: 750; font-size: .9rem; margin-bottom: 6px; }
.input-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.input-action input, .planner-controls input, .planner-controls select, .setting-row select { width: 100%; border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; background: var(--surface); color: var(--text); }
.swap-button { align-self: center; margin-top: 30px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; width: 42px; height: 42px; font-size: 1.25rem; }
.shortcut-row { display: flex; gap: 10px; margin-top: 6px; }
.text-button { border: 0; background: none; color: var(--accent-dark); padding: 2px; font-weight: 700; }
.place-results { display: grid; gap: 6px; margin-top: 8px; }
.place-result { width: 100%; text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 10px; }
.place-result strong, .place-result small { display: block; }
.place-result small { color: var(--muted); margin-top: 2px; }
.selected-place { min-height: 1.5em; margin: 8px 0 0; }
.planner-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.planner-controls .check-row { display: flex; gap: 9px; align-items: center; align-self: end; min-height: 46px; }
.planner-controls .check-row span { margin: 0; }
.check-row input, .setting-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.planner-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.notice-inline { color: var(--muted); margin-top: 12px; min-height: 1.5em; }
.journey-results { display: grid; gap: 12px; }
.journey-card { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 14px; padding: 15px; text-align: left; width: 100%; }
.journey-card:hover, .journey-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.journey-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.journey-times { font-size: 1.18rem; font-weight: 800; }
.journey-summary { color: var(--muted); margin-top: 4px; }
.journey-badges { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.journey-badge { border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); padding: 4px 8px; font-size: .75rem; font-weight: 750; }
.leg-list { display: grid; gap: 8px; margin-top: 12px; }
.leg-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.mode-label { font-size: .78rem; font-weight: 800; text-transform: uppercase; color: var(--accent-dark); }
.leg-row p { margin: 0; }
.leg-row small { color: var(--muted); }
.journey-map-shell { margin-top: 18px; }
.journey-map { height: 420px; border-radius: 14px; overflow: hidden; background: var(--background); border: 1px solid var(--border); }
.journey-map:empty { display: none; }
.journey-map-shell .secondary-button { margin-top: 10px; }
.saved-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.saved-list { display: grid; gap: 10px; }
.saved-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border-bottom: 1px solid var(--border); padding: 10px 0; }
.saved-row:last-child { border-bottom: 0; }
.saved-row strong, .saved-row small { display: block; }
.saved-row small { color: var(--muted); }
.saved-actions { display: flex; gap: 6px; }
.saved-actions button { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 7px 9px; }
.settings-dialog { width: min(560px, calc(100% - 24px)); border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 0; }
.settings-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.settings-dialog form { padding: 20px; }
.dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 16px; }
.setting-row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; border-top: 1px solid var(--border); padding: 16px 0; }
.setting-row span strong, .setting-row span small { display: block; }
.setting-row span small { color: var(--muted); margin-top: 3px; }

:root[data-theme="dark"] .search-field input,
:root[data-theme="dark"] .pattern-select { background: var(--surface); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .result-card:hover,
:root[data-theme="dark"] .result-card.selected { background: var(--accent-soft); border-color: var(--accent); }

@media (max-width: 1040px) {
  .header-inner { justify-content: center; }
  .brand { margin-right: auto; }
  .app-nav { order: 3; width: 100%; justify-content: center; }
  .planner-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .location-grid { grid-template-columns: 1fr; }
  .swap-button { margin: 0; justify-self: center; transform: rotate(90deg); }
  .planner-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .saved-grid { grid-template-columns: 1fr; }
  .journey-map { height: 340px; }
}
@media (max-width: 560px) {
  .header-actions { width: 100%; justify-content: space-between; }
  .status-group { flex: 1; justify-content: flex-start; }
  .input-action { grid-template-columns: 1fr; }
  .planner-controls { grid-template-columns: 1fr; }
  .planner-actions > * { width: 100%; }
  .journey-card-head { display: grid; }
  .journey-badges { justify-content: flex-start; }
}

/* Phase 6–7: regional agencies, Bike Share and reliability intelligence */
.regional-search-row { grid-template-columns: minmax(130px, .35fr) minmax(220px, 1fr) auto; }
.agency-field, .reliability-control label { display: grid; gap: 6px; font-weight: 750; font-size: .9rem; }
.agency-field select, .reliability-control select, .reliability-control input {
  width: 100%; border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px;
  background: var(--surface); color: var(--text); font: inherit;
}
.bike-badge { border-radius: 8px; padding: 6px 8px; background: var(--success-bg); color: var(--success); font-size: .72rem; font-weight: 850; }
.bike-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.bike-metrics .metric { min-height: 84px; }
.reliability-layout { display: grid; grid-template-columns: minmax(260px, .45fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.reliability-control { display: grid; gap: 14px; }
.reliability-control .section-heading { margin-bottom: 0; }
.reliability-card { border: 1px solid var(--border); border-left-width: 6px; border-radius: 14px; padding: 16px; margin-top: 14px; background: var(--surface); }
.reliability-card.status-good { border-left-color: var(--success); }
.reliability-card.status-watch, .reliability-card.status-unknown { border-left-color: var(--warning); }
.reliability-card.status-disrupted { border-left-color: var(--accent); }
.reliability-card-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.reliability-card h3, .reliability-card p { margin-top: 4px; }
.reliability-score { border-radius: 999px; padding: 8px 11px; white-space: nowrap; font-weight: 850; background: var(--background); }
.reliability-score.status-good { color: var(--success); }
.reliability-score.status-watch, .reliability-score.status-unknown { color: var(--warning); }
.reliability-score.status-disrupted { color: var(--accent-dark); }
.reliability-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.journey-reliability { text-align: left; color: var(--muted); margin: 10px 0 0; font-size: .88rem; }
.journey-warning { text-align: left; color: var(--warning-text, var(--muted)); margin: 10px 0 0; font-size: .9rem; }
.journey-walking-only { color: var(--warning-text, var(--mint-strong)); }
.journey-badge.reliability-high { background: var(--success-bg); color: var(--success); }
.journey-badge.reliability-medium { background: var(--warning-bg); color: var(--warning); }
.journey-badge.reliability-low { background: var(--accent-soft); color: var(--accent-dark); }
.last-trip-result { margin-top: 10px; }
.commute-health-panel { margin-top: 24px; }
#commute-health-results { display: grid; gap: 10px; }

@media (max-width: 760px) {
  .regional-search-row, .reliability-layout { grid-template-columns: 1fr; }
  .regional-search-row .primary-button { width: 100%; }
  .reliability-metrics, .bike-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Modern interface layer — motion, depth and responsive navigation */
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 28rem),
    radial-gradient(circle at 92% 8%, color-mix(in srgb, #2563eb 7%, transparent), transparent 24rem),
    var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .35;
  background-image: linear-gradient(rgb(15 23 42 / 2%) 1px, transparent 1px), linear-gradient(90deg, rgb(15 23 42 / 2%) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 70%);
}
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

.site-header {
  background: var(--surface-elevated);
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow: 0 1px 0 rgb(255 255 255 / 45%);
}
.header-inner { min-height: 78px; padding-block: 10px; }
.brand { gap: 11px; transition: transform .25s var(--ease-out); }
.brand:hover { transform: translateY(-1px); }
.brand-mark {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 45px;
  height: 45px;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--accent-bright), var(--accent-dark));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 28%, transparent), inset 0 1px 0 rgb(255 255 255 / 28%);
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: -55% 40% 40% -35%;
  z-index: -1;
  border-radius: 50%;
  background: rgb(255 255 255 / 20%);
}
.brand-letter { position: relative; z-index: 1; }
.brand-line {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 8px;
  height: 3px;
  border-radius: 999px;
  background: rgb(255 255 255 / 72%);
}
.brand-copy strong { font-size: .98rem; letter-spacing: -.02em; }
.brand-copy small { font-size: .72rem; margin-top: 1px; }

.app-nav {
  position: relative;
  gap: 3px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--background) 80%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%);
}
.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s var(--ease-out);
}
.nav-button > span:first-child { font-size: 1rem; line-height: 1; }
.nav-button:hover { color: var(--text); transform: translateY(-1px); }
.nav-button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.header-actions { gap: 7px; }
.status-pill {
  position: relative;
  padding-left: 24px;
  border-color: color-mix(in srgb, var(--border) 80%, transparent);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 35%);
}
.status-pill::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
}
.status-pill.ready::before { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 13%, transparent); animation: status-pulse 2.4s ease-in-out infinite; }
.status-pill.warning::before { background: var(--warning); }
.status-pill.error::before { background: var(--accent); }
.icon-button, .secondary-button, .primary-button, .text-button, .swap-button,
.saved-actions button, .place-result, .tab, .hero-primary, .hero-secondary {
  transition: transform .2s var(--ease-out), box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease, opacity .2s ease;
}
.icon-button:hover, .secondary-button:hover, .saved-actions button:hover { border-color: var(--border-strong); background: var(--surface-subtle); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-button:active, .secondary-button:active, .primary-button:active, .tab:active, .hero-primary:active, .hero-secondary:active { transform: translateY(0) scale(.98); }
.settings-trigger { display: inline-flex; align-items: center; gap: 6px; }

main { padding-block: 38px 82px; }
.app-view { animation: view-in .42s var(--ease-out); }
.app-view.view-enter { animation: view-in .42s var(--ease-out); }
.hero-dashboard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 34px;
  max-width: none;
  min-height: 360px;
  overflow: hidden;
  padding: clamp(30px, 5vw, 58px);
  margin-bottom: 26px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 28px;
  color: white;
  background:
    radial-gradient(circle at 82% 18%, rgb(255 255 255 / 14%), transparent 24%),
    radial-gradient(circle at 18% 110%, color-mix(in srgb, var(--accent-bright) 48%, transparent), transparent 42%),
    linear-gradient(135deg, #181b21 0%, #232731 52%, #075e59 120%);
  box-shadow: var(--shadow-lg);
}
.hero-dashboard::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .18;
  background-image: linear-gradient(rgb(255 255 255 / 12%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 12%) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(90deg, transparent, black 70%);
}
.hero-content { position: relative; z-index: 2; align-self: center; }
.hero-dashboard .eyebrow { color: #99f6e4; }
.hero-dashboard h1 { max-width: 720px; font-size: clamp(2.35rem, 5.3vw, 4.65rem); margin-bottom: 18px; }
.hero-dashboard .hero-copy { color: rgb(255 255 255 / 72%); max-width: 650px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.hero-primary, .hero-secondary {
  min-height: 46px;
  border-radius: 13px;
  padding: 11px 17px;
  font-weight: 800;
}
.hero-primary { border: 0; color: #111318; background: #fff; box-shadow: 0 12px 28px rgb(0 0 0 / 22%); }
.hero-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgb(0 0 0 / 28%); }
.hero-primary span { display: inline-block; margin-left: 8px; transition: transform .2s var(--ease-out); }
.hero-primary:hover span { transform: translateX(3px); }
.hero-secondary { color: #fff; border: 1px solid rgb(255 255 255 / 20%); background: rgb(255 255 255 / 8%); backdrop-filter: blur(8px); }
.hero-secondary:hover { background: rgb(255 255 255 / 14%); transform: translateY(-2px); }
.hero-visual { position: relative; min-height: 248px; align-self: center; }
.hero-orbit { position: absolute; border: 1px solid rgb(255 255 255 / 13%); border-radius: 50%; animation: orbit-drift 9s ease-in-out infinite alternate; }
.orbit-one { width: 310px; height: 310px; right: -35px; top: -36px; }
.orbit-two { width: 210px; height: 210px; right: 48px; top: 15px; animation-delay: -3s; }
.hero-route-card {
  position: absolute;
  z-index: 2;
  width: min(310px, 88%);
  right: 16px;
  top: 42px;
  padding: 20px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 20px;
  background: rgb(255 255 255 / 11%);
  box-shadow: 0 24px 55px rgb(0 0 0 / 23%);
  backdrop-filter: blur(18px) saturate(1.2);
  transform: rotate(-2deg);
  animation: card-float 5s ease-in-out infinite;
}
.hero-route-card > strong, .hero-route-card > span { display: block; }
.hero-route-card > strong { font-size: 1.35rem; margin-top: 14px; }
.hero-route-card > span { color: rgb(255 255 255 / 68%); margin-top: 2px; }
.hero-route-topline { display: flex; align-items: center; justify-content: space-between; }
.hero-route-number { min-width: 56px; border-radius: 10px; padding: 7px 10px; text-align: center; background: var(--accent); font-weight: 900; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.hero-live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 800; color: #a7f3d0; }
.hero-live-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 5px rgb(52 211 153 / 14%); animation: status-pulse 2s infinite; }
.hero-route-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-top: 22px; }
.hero-route-line i { position: relative; height: 4px; background: rgb(255 255 255 / 25%); }
.hero-route-line i:first-child { border-radius: 99px 0 0 99px; background: #fff; }
.hero-route-line i:nth-child(2) { background: linear-gradient(90deg, #fff 45%, rgb(255 255 255 / 25%) 45%); }
.hero-route-line i:last-child { border-radius: 0 99px 99px 0; }
.hero-route-line i::before { content: ''; position: absolute; top: 50%; left: 0; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #262a33; transform: translate(-50%, -50%); }
.hero-route-line i:last-child::after { content: ''; position: absolute; top: 50%; right: 0; width: 10px; height: 10px; border: 2px solid rgb(255 255 255 / 55%); border-radius: 50%; background: #262a33; transform: translate(50%, -50%); }
.hero-mini-card { position: absolute; z-index: 3; min-width: 112px; padding: 12px 14px; border: 1px solid rgb(255 255 255 / 14%); border-radius: 15px; background: rgb(19 22 27 / 72%); box-shadow: 0 14px 30px rgb(0 0 0 / 22%); backdrop-filter: blur(14px); animation: card-float 5.6s ease-in-out infinite reverse; }
.hero-mini-card span, .hero-mini-card strong { display: block; }
.hero-mini-card span { color: rgb(255 255 255 / 58%); font-size: .72rem; }
.hero-mini-card strong { margin-top: 2px; }
.hero-mini-card-top { left: 0; top: 8px; }
.hero-mini-card-bottom { left: 18px; bottom: 5px; animation-delay: -2s; }

.search-panel, .detail-panel, .data-summary, .planner-panel, .planner-results-wrap, .saved-panel {
  border-color: color-mix(in srgb, var(--border) 88%, transparent);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}
.search-panel { position: relative; z-index: 4; padding: 8px; border-radius: 20px; box-shadow: var(--shadow-md); }
.tabs { gap: 5px; margin: 0 0 8px; padding: 4px; }
.tab { min-height: 38px; padding: 8px 15px; }
.tab:hover { color: var(--text); background: var(--surface-subtle); }
.tab.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent); }
.search-row { padding: 10px; }
.search-field input, .pattern-select, .agency-field select, .reliability-control select, .reliability-control input,
.input-action input, .planner-controls input, .planner-controls select, .setting-row select, .schedule-controls input {
  min-height: 46px;
  border-color: var(--border);
  background: var(--surface-subtle);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s var(--ease-out);
}
.search-field input:hover, .pattern-select:hover, .agency-field select:hover, .reliability-control select:hover, .reliability-control input:hover,
.input-action input:hover, .planner-controls input:hover, .planner-controls select:hover, .setting-row select:hover, .schedule-controls input:hover { border-color: var(--border-strong); }
.search-field input:focus, .pattern-select:focus, .agency-field select:focus, .reliability-control select:focus, .reliability-control input:focus,
.input-action input:focus, .planner-controls input:focus, .planner-controls select:focus, .setting-row select:focus, .schedule-controls input:focus {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--focus) 60%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 11%, transparent);
  outline: none;
}
.primary-button {
  position: relative;
  overflow: hidden;
  min-height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent-dark));
  box-shadow: 0 9px 20px color-mix(in srgb, var(--accent) 20%, transparent), inset 0 1px 0 rgb(255 255 255 / 22%);
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 13px 26px color-mix(in srgb, var(--accent) 26%, transparent); }
.primary-button.is-busy { color: transparent; pointer-events: none; }
.primary-button.is-busy::after, .secondary-button.is-busy::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgb(255 255 255 / 38%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.secondary-button.is-busy { position: relative; overflow: hidden; color: transparent; }
.secondary-button.is-busy::after { border-color: color-mix(in srgb, var(--border-strong) 70%, transparent); border-top-color: var(--accent); }

.content-grid, .planner-layout, .reliability-layout, .saved-grid { gap: 22px; }
.section-heading h2 { font-size: 1.45rem; }
.result-list { gap: 9px; }
.result-card, .journey-card, .place-result {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--border) 90%, transparent);
  box-shadow: 0 1px 0 rgb(255 255 255 / 45%);
}
.result-card::before, .journey-card::before, .place-result::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .22s var(--ease-out);
}
.result-card:hover, .result-card.selected, .journey-card:hover, .journey-card.selected, .place-result:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-md);
}
.result-card:hover::before, .result-card.selected::before, .journey-card:hover::before, .journey-card.selected::before, .place-result:hover::before { transform: scaleY(1); }
.result-card.selected, .journey-card.selected { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); }
.result-card.is-entering, .journey-card.is-entering, .place-result.is-entering, .saved-row.is-entering, .departure.is-entering, .source-row.is-entering, .nearby-card.is-entering, .network-card.is-entering {
  animation: item-in .45s var(--ease-out) both;
  animation-delay: calc(var(--item-index, 0) * 42ms);
}
.route-badge, .bike-badge, .mini-route-badge { box-shadow: inset 0 1px 0 rgb(255 255 255 / 28%); }
.chevron { transition: transform .2s var(--ease-out), color .2s ease; }
.result-card:hover .chevron { color: var(--accent); transform: translateX(3px); }
.empty-state { background: color-mix(in srgb, var(--surface-subtle) 72%, transparent); border-color: var(--border-strong); }
.detail-panel { border-radius: 20px; box-shadow: var(--shadow-md); }
.detail-header { background: linear-gradient(180deg, color-mix(in srgb, var(--surface-subtle) 72%, transparent), transparent); }
.detail-header h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.departure { transition: background .2s ease, transform .2s var(--ease-out); border-radius: 10px; padding-inline: 8px; }
.departure:hover { background: var(--surface-subtle); transform: translateX(2px); }
.live-indicator, .alert-map-indicator { display: inline-flex; align-items: center; gap: 6px; }
.live-indicator::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: status-pulse 2s infinite; }
.route-map, .journey-map { filter: saturate(.92) contrast(1.02); }
.route-map-wrap { overflow: hidden; }
.map-status { padding: 5px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(12px); box-shadow: var(--shadow-sm); }
.metric { border: 1px solid color-mix(in srgb, var(--border) 78%, transparent); background: linear-gradient(145deg, var(--surface-subtle), color-mix(in srgb, var(--surface) 75%, var(--background))); transition: transform .2s var(--ease-out), box-shadow .2s ease, border-color .2s ease; }
.metric:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.metric strong { letter-spacing: -.035em; }
.reliability-card { box-shadow: var(--shadow-sm); }
.reliability-score { font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px var(--border); }
.sequence-dot { box-shadow: 0 0 0 4px var(--surface); }
.stop-sequence li:not(:last-child)::before { background: linear-gradient(var(--accent-soft), var(--border)); }

.planner-panel, .planner-results-wrap, .saved-panel { border-radius: 20px; }
.location-picker { position: relative; }
.swap-button:hover { color: var(--accent); transform: rotate(180deg); box-shadow: var(--shadow-sm); }
.journey-card { padding: 17px; }
.journey-times { letter-spacing: -.025em; }
.journey-map { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 16%); }
.saved-row { border-radius: 11px; padding-inline: 9px; transition: background .2s ease, transform .2s var(--ease-out); }
.saved-row:hover { background: var(--surface-subtle); transform: translateX(2px); }

.settings-dialog {
  overflow: hidden;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.settings-dialog[open] { animation: dialog-in .28s var(--ease-out) both; }
.settings-dialog[open]::backdrop { animation: backdrop-in .25s ease both; }
.setting-row { transition: background .2s ease; padding-inline: 8px; border-radius: 10px; }
.setting-row:hover { background: var(--surface-subtle); }

.toast-region {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 100;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100% - 32px));
  pointer-events: none;
}
.toast {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 13px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  animation: toast-in .35s var(--ease-out) both;
}
.toast::before { content: ''; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.toast.success::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-bg); }
.toast.warning::before { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-bg); }
.toast.is-leaving { animation: toast-out .24s ease forwards; }

.skeleton-card {
  position: relative;
  min-height: 74px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.skeleton-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-subtle) 20%, color-mix(in srgb, var(--border) 62%, var(--surface)) 48%, var(--surface-subtle) 76%);
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
}

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
footer span:last-child { text-align: right; }
footer .data-attribution {
  flex: 0 0 100%;
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes item-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes status-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .52; } }
@keyframes card-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(-1deg); } }
@keyframes orbit-drift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-9px, 8px, 0) scale(1.04); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px) scale(.98); } }

@media (max-width: 1040px) {
  .hero-dashboard { grid-template-columns: minmax(0, 1fr) minmax(260px, .65fr); }
  .status-group { display: none; }
}
@media (max-width: 820px) {
  .hero-dashboard { grid-template-columns: 1fr; min-height: 0; }
  .hero-visual { min-height: 218px; }
  .hero-route-card { top: 24px; }
  footer { display: grid; }
  footer span:last-child { text-align: left; }
}
@media (max-width: 760px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .site-header { top: 0; }
  .header-inner { justify-content: space-between; }
  .brand { margin-right: 0; }
  .app-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 50;
    order: initial;
    width: auto;
    justify-content: stretch;
    padding: 6px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    box-shadow: 0 16px 42px rgb(0 0 0 / 22%), inset 0 1px 0 rgb(255 255 255 / 42%);
    backdrop-filter: blur(20px) saturate(1.4);
  }
  .nav-button { flex: 1; display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 7px 5px; font-size: .72rem; }
  .nav-button > span:first-child { font-size: 1.1rem; }
  .nav-button.active { border-radius: 13px; }
  .header-actions { width: auto; }
  .settings-trigger span:last-child { display: none; }
  .hero-dashboard { border-radius: 23px; padding: 28px 24px; }
  .hero-dashboard h1 { font-size: clamp(2.2rem, 12vw, 3.5rem); }
  .hero-actions > * { flex: 1 1 170px; }
  .search-panel { border-radius: 18px; }
  .swap-button:hover { transform: rotate(90deg) scale(1.04); }
  .toast-region { bottom: calc(88px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  main { padding-top: 24px; }
  .header-inner { min-height: 62px; padding-block: 7px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
  .brand-copy strong { font-size: .9rem; }
  .brand-copy small { font-size: .66rem; }
  .header-actions { width: auto; }
  .icon-button { padding: 8px 10px; }
  .hero-dashboard { margin-inline: -2px; }
  .hero-visual { min-height: 205px; }
  .hero-route-card { right: 0; width: 90%; }
  .hero-mini-card-top { left: -5px; }
  .hero-mini-card-bottom { left: 5px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tab { flex: 1 0 auto; }
  .result-card { padding: 14px; }
  .detail-panel { border-radius: 18px; }
  .journey-card { padding: 14px; }
}

/* LocalMotion product experience: live dashboard, nearby mobility and active journeys */
.hero-live-board {
  position: relative;
  z-index: 2;
  align-self: center;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.hero-live-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-live-card {
  width: 100%;
  min-height: 116px;
  padding: 17px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 18px;
  color: white;
  text-align: left;
  background: rgb(255 255 255 / 9%);
  box-shadow: 0 18px 42px rgb(0 0 0 / 20%);
  backdrop-filter: blur(18px) saturate(1.18);
  transition: transform .22s var(--ease-out), background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.hero-live-card:hover:not(:disabled) { transform: translateY(-3px); background: rgb(255 255 255 / 14%); border-color: rgb(255 255 255 / 25%); box-shadow: 0 24px 52px rgb(0 0 0 / 25%); }
.hero-live-card:disabled { cursor: default; opacity: .82; }
.hero-live-primary { min-height: 140px; background: linear-gradient(145deg, rgb(255 255 255 / 14%), rgb(255 255 255 / 7%)); }
.hero-live-label, .hero-live-card strong, .hero-live-card > span { display: block; }
.hero-live-label { color: rgb(255 255 255 / 58%); font-size: .73rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hero-live-card strong { margin-top: 9px; font-size: clamp(1.18rem, 2vw, 1.7rem); line-height: 1.14; letter-spacing: -.035em; }
.hero-live-card > span:last-child { margin-top: 6px; color: rgb(255 255 255 / 66%); font-size: .87rem; }
.hero-live-updated { margin: 0 3px; color: rgb(255 255 255 / 48%); font-size: .75rem; }

.nearby-panel {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 22px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  animation: view-in .36s var(--ease-out) both;
}
.icon-action-button { display: inline-grid; place-items: center; min-width: 46px; min-height: 46px; padding: 10px; }
.nearby-action-icon { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nearby-location-picker { max-width: 720px; margin: 0 0 12px; }
.nearby-location-picker > label { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 750; }
.nearby-location-picker input { width: 100%; border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; color: var(--text); background: var(--surface); }
.nearby-location-picker .input-action { grid-template-columns: minmax(0, 1fr) repeat(3, auto); }
.nearby-location-picker .input-action button { width: 46px; min-width: 46px; min-height: 46px; padding: 10px; }
.nearby-layout { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr); gap: 18px; }
.nearby-results { display: grid; gap: 14px; min-width: 0; }
.nearby-group { display: grid; gap: 8px; }
.nearby-group-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.nearby-group-title h3 { margin: 0; }
.nearby-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  transition: transform .2s var(--ease-out), border-color .2s ease, box-shadow .2s ease;
}
.nearby-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-sm); }
.nearby-card strong, .nearby-card span { display: block; }
.nearby-card small { color: var(--muted); }
.nearby-card-meta { text-align: right; white-space: nowrap; }
.nearby-card-meta strong { font-size: 1rem; }
.nearby-departures { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.nearby-departure-chip { padding: 3px 7px; border-radius: 999px; background: var(--surface-subtle); color: var(--muted); font-size: .75rem; font-weight: 750; }
.nearby-map-shell { min-height: 420px; }
.nearby-map-stage { position: relative; }
.nearby-map { width: 100%; height: 420px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-subtle); }
.nearby-map:empty { display: none; }
.nearby-map-layers {
  position: absolute;
  /* MapLibre's navigation control owns the upper-right corner. Keep the
     custom control below it while the hint remains in the upper-left. */
  top: 88px;
  right: 12px;
  z-index: 7;
}
.nearby-layers-toggle {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 9px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.nearby-layers-toggle[aria-expanded="true"] { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }
.nearby-layers-icon { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nearby-layers-label, .nearby-layers-caret { display: none; }
.nearby-layers-caret { color: var(--muted); font-size: 1.2rem; line-height: 1; transition: transform .18s var(--ease-out); }
.nearby-layers-toggle[aria-expanded="true"] .nearby-layers-caret { transform: rotate(180deg); }
.nearby-layers-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 12px;
  width: min(230px, calc(100vw - 40px));
  max-height: min(68vh, 360px);
  overflow: auto;
  padding: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-elevated) 97%, transparent);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px) saturate(1.12);
  animation: nearby-layers-in .18s var(--ease-out) both;
}
.nearby-layer-group { display: grid; gap: 3px; min-width: 0; margin: 0; padding: 0; border: 0; }
.nearby-layer-group legend { padding: 0 0 4px; color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.nearby-layer-group label { display: grid; grid-template-columns: 22px 20px minmax(0, 1fr); align-items: center; gap: 7px; min-height: 44px; padding: 4px 5px; border-radius: 8px; cursor: pointer; font-size: .86rem; }
.nearby-layer-group label:hover { background: var(--surface-subtle); }
.nearby-layer-group input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.nearby-layer-icon { display: grid; place-items: center; width: 20px; font-size: 1rem; line-height: 1; }
.nearby-layer-stop-icon .nearby-bus-pin-icon { width: 18px; height: 21px; }
.nearby-layer-group label > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes nearby-layers-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.search-panel { overflow: visible; }
.search-input-wrap { position: relative; display: block; }
.search-input-wrap input { padding-right: 44px; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
  font-size: 1.2rem;
}
.search-clear:hover { color: var(--text); background: var(--surface); }
.recent-searches { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 8px; }
.recent-searches:empty { display: none; }
.recent-search-chip { border: 1px solid var(--border); border-radius: 999px; padding: 5px 9px; color: var(--muted); background: var(--surface-subtle); font-size: .78rem; }
.recent-search-chip:hover { color: var(--text); border-color: var(--border-strong); }
.search-suggestions {
  position: absolute;
  left: 8px;
  right: 8px;
  top: calc(100% - 4px);
  z-index: 20;
  max-height: min(480px, 60vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(20px);
}
.suggestion-heading { padding: 7px 10px 4px; color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.suggestion-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 10px; border: 0; border-radius: 10px; color: var(--text); text-align: left; background: transparent; }
.suggestion-item:hover, .suggestion-item:focus-visible { background: var(--surface-subtle); outline: none; }
.suggestion-item strong, .suggestion-item small { display: block; }
.suggestion-item small { color: var(--muted); }
.suggestion-kind { min-width: 43px; padding: 4px 6px; border-radius: 7px; text-align: center; color: var(--accent-dark); background: var(--accent-soft); font-size: .68rem; font-weight: 850; }
.search-highlight { border-radius: 3px; color: inherit; background: color-mix(in srgb, var(--warning-bg) 88%, transparent); }

.planner-primary-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.planner-primary-controls label > span { display: block; margin-bottom: 6px; font-size: .9rem; font-weight: 750; }
.planner-primary-controls select, .planner-primary-controls input { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; color: var(--text); background: var(--surface-subtle); }
.trip-preferences { margin-top: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-subtle); }
.trip-preferences summary { padding: 12px 14px; cursor: pointer; font-weight: 800; }
.trip-preferences[open] summary { border-bottom: 1px solid var(--border); }
.trip-preferences .planner-controls { margin: 0; padding: 14px; }
.journey-card { display: block; }
.journey-select { display: block; width: 100%; padding: 0; border: 0; color: inherit; text-align: left; background: transparent; }
.journey-route-strip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.journey-route-segment { display: inline-flex; align-items: center; gap: 5px; }
.journey-route-segment::after { content: '→'; color: var(--muted); }
.journey-route-segment:last-child::after { display: none; }
.journey-route-pill { min-width: 34px; padding: 4px 7px; border-radius: 8px; text-align: center; background: var(--accent); color: white; font-size: .76rem; font-weight: 850; }
.journey-details { margin-top: 12px; border-top: 1px solid var(--border); }
.journey-details summary { padding: 10px 0 0; color: var(--accent-dark); cursor: pointer; font-size: .85rem; font-weight: 800; }
.journey-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.journey-card-actions button { min-height: 40px; }

.reliability-breakdown { display: grid; gap: 10px; margin: 18px 0; }
.score-component { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(100px, 1.5fr) auto; gap: 10px; align-items: center; }
.score-component-label { color: var(--muted); font-size: .84rem; }
.score-component-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--background); }
.score-component-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-bright), var(--accent-dark)); transform-origin: left; animation: score-grow .6s var(--ease-out) both; }
.score-component strong { font-variant-numeric: tabular-nums; font-size: .82rem; }
.reliability-history { margin-top: 18px; }
.reliability-chart-card { padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-subtle); }
.reliability-chart-card svg { display: block; width: 100%; height: 170px; overflow: visible; }
.reliability-chart-grid { stroke: var(--border); stroke-width: 1; }
.reliability-chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.reliability-chart-area { fill: color-mix(in srgb, var(--accent) 11%, transparent); }
.reliability-chart-labels { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: .75rem; }
.network-overview-panel { margin-top: 24px; }
.network-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.network-card { padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-subtle); }
.network-card strong, .network-card span { display: block; }
.network-card span { color: var(--muted); font-size: .8rem; }
.network-card.status-disrupted { border-left: 5px solid var(--accent); }
.network-card.status-watch { border-left: 5px solid var(--warning); }
.network-card.status-good { border-left: 5px solid var(--success); }

.active-trip-layout { display: grid; grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr); gap: 22px; align-items: start; }
.active-trip-panel, .active-trip-map-shell { padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-elevated); box-shadow: var(--shadow-md); }
.active-trip-progress { display: grid; gap: 0; margin-bottom: 18px; }
.active-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding-bottom: 15px; opacity: .58; }
.active-step::before { content: ''; position: absolute; left: 16px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.active-step:last-child::before { display: none; }
.active-step.current, .active-step.complete { opacity: 1; }
.active-step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid var(--border-strong); border-radius: 50%; background: var(--surface); font-size: .7rem; font-weight: 850; }
.active-step.current .active-step-dot { color: white; border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.active-step.complete .active-step-dot { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.active-step strong, .active-step span { display: block; }
.active-step span { color: var(--muted); font-size: .82rem; }
.active-trip-next { padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-subtle); }
.active-trip-countdown { font-size: clamp(2.2rem, 6vw, 4.4rem); line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.active-trip-next h2 { margin-top: 12px; }
.active-trip-next p { color: var(--muted); }
.active-trip-map { width: 100%; height: 520px; overflow: hidden; border-radius: 15px; background: var(--surface-subtle); }

@keyframes score-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 980px) {
  .nearby-layout, .active-trip-layout { grid-template-columns: 1fr; }
  .nearby-map, .active-trip-map { height: 390px; }
  .network-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .hero-live-row { grid-template-columns: 1fr; }
  .hero-live-primary { min-height: 122px; }
  .planner-primary-controls { grid-template-columns: 1fr; }
  .score-component { grid-template-columns: 1fr auto; }
  .score-component-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 560px) {
  .nearby-panel { padding: 14px; border-radius: 18px; }
  .nearby-map, .active-trip-map { height: 330px; }
  .network-overview { grid-template-columns: 1fr; }
  .journey-card-actions { display: grid; }
}

.alert-card.severe { border-color: color-mix(in srgb, var(--accent) 42%, var(--border)); border-left: 5px solid var(--accent); background: color-mix(in srgb, var(--accent-soft) 65%, var(--surface)); }
.alert-details { margin-top: 7px; }
.alert-details summary { color: var(--accent-dark); cursor: pointer; font-size: .84rem; font-weight: 800; }
.alert-details p { margin-top: 8px; }
.departure-board-row .departure-time-block strong { font-size: 1.25rem; letter-spacing: -.04em; }
.search-group-heading { margin: 10px 2px 2px; padding-top: 7px; border-top: 1px solid var(--border); }
.network-card { width: 100%; color: var(--text); text-align: left; cursor: pointer; }


/* Nearby-first landing experience */
.planner-intro { margin-bottom: 18px; }
.landing-map { margin-bottom: 24px; }
.landing-nearby-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr);
  align-items: stretch;
}
.landing-nearby-layout .nearby-map-shell { position: relative; }
.landing-nearby-layout .nearby-map { min-height: 520px; height: 100%; }
.nearby-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  max-height: 520px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface-subtle) 76%, transparent);
}
.nearby-sidebar-heading { padding: 1px 2px 10px; border-bottom: 1px solid var(--border); }
.nearby-sidebar-heading h3 { margin: 0; }
.service-disruption-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--warning) 24%, var(--border));
  border-radius: 16px;
  background: color-mix(in srgb, var(--warning-bg) 38%, var(--surface));
}
.service-disruptions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.service-disruptions > .nearby-group-title { grid-column: 1 / -1; margin-bottom: 2px; }
.service-disruptions > .empty-state { grid-column: 1 / -1; background: var(--surface); }
.disruption-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  font-weight: 800;
}
.landing-map .nearby-results { overflow-y: auto; padding-right: 4px; }
.vehicle-map-legend {
  position: absolute;
  z-index: 3;
  left: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  max-width: calc(100% - 68px);
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  font-size: .7rem;
  font-weight: 750;
}
.vehicle-map-legend span { display: inline-flex; gap: 4px; align-items: center; }
.vehicle-map-legend b { font-size: .9rem; line-height: 1; }
.nearby-live-vehicle-status {
  position: relative;
  z-index: 3;
  margin: 8px 12px 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--warning) 42%, var(--border));
  border-radius: 10px;
  color: var(--text);
  background: color-mix(in srgb, var(--warning-bg) 72%, var(--surface));
  font-size: .76rem;
  font-weight: 700;
}
.transit-vehicle-marker {
  position: relative;
  z-index: 5;
  display: block;
  width: 76px;
  height: 72px;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  filter: drop-shadow(0 3px 5px rgb(15 23 42 / 30%));
}
.transit-vehicle-marker:hover .vehicle-marker-body,
.transit-vehicle-marker:focus-visible .vehicle-marker-body { transform: translate(-50%, -50%) scale(1.12); }
.vehicle-direction-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: 20px;
  height: 20px;
  margin: -10px;
  color: var(--vehicle-color, #111827);
  font-size: 0;
  line-height: 0;
  transform: rotate(var(--vehicle-bearing, 0deg));
  transform-origin: 50% 50%;
}
.vehicle-direction-arrow::before {
  content: '';
  position: absolute;
  left: 0;
  top: -38px;
  width: 20px;
  height: 48px;
  color: var(--vehicle-color, #111827);
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  text-shadow: 0 1px 2px var(--surface), 0 -1px 2px var(--surface), 1px 0 2px var(--surface), -1px 0 2px var(--surface);
}
.transit-vehicle-marker.bearing-unknown .vehicle-direction-arrow { display: none; }
.vehicle-marker-body {
  z-index: 1;
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  min-width: 44px;
  max-width: 66px;
  height: 31px;
  margin: 0;
  border: 2px solid var(--surface);
  border-radius: 9px;
  color: var(--vehicle-text-color, white);
  background: var(--vehicle-color, #111827);
  transition: transform .18s var(--ease-out);
  line-height: 1;
  transform: translate(-50%, -50%);
}
.vehicle-mode-icon {
  display: grid;
  flex: 0 0 27px;
  place-items: center;
  align-self: stretch;
  border-right: 1px solid rgb(255 255 255 / 36%);
  border-radius: 7px 0 0 7px;
  background: rgb(255 255 255 / 14%);
  font-size: 15px;
}
.vehicle-route-number {
  min-width: 0;
  padding: 0 7px 1px 6px;
  overflow: hidden;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.transit-vehicle-marker.is-stale { opacity: .58; }
.map-popup.vehicle-popup { min-width: min(260px, 72vw); gap: 7px; }
.vehicle-popup-header { display: flex; gap: 9px; align-items: center; }
.vehicle-popup-icon {
  display: flex;
  align-items: center;
  min-width: 42px;
  height: 34px;
  padding-inline: 6px;
  border-radius: 9px;
  color: white;
  background: var(--vehicle-color, #111827);
  font-size: 16px;
  gap: 4px;
}
.vehicle-popup-icon strong { font-size: .72rem; }
.vehicle-popup-title { display: grid; gap: 0; }
.vehicle-popup-title strong { line-height: 1.15; }
.vehicle-popup-title span { text-transform: capitalize; }
.vehicle-popup-destination { padding-bottom: 7px; border-bottom: 1px solid var(--border); color: var(--text) !important; font-weight: 700; }
.vehicle-popup-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.vehicle-popup-fact { padding: 7px; border-radius: 8px; background: var(--surface-subtle); }
.vehicle-popup-fact small, .vehicle-popup-fact strong { display: block; }
.vehicle-popup-fact small { color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .04em; }
.vehicle-popup-fact strong { overflow: hidden; color: var(--text); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.map-popup-action {
  width: 100%;
  margin-top: 2px;
  border: 0;
  border-radius: 9px;
  padding: 9px 11px;
  color: white;
  background: var(--accent);
  font-weight: 800;
}
.map-popup-action:hover { background: var(--accent-dark); }

@media (max-width: 900px) {
  .landing-nearby-layout { grid-template-columns: 1fr; }
  .landing-nearby-layout .nearby-map { min-height: 430px; }
  .nearby-sidebar { max-height: 440px; }
  .service-disruptions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .landing-nearby-layout .nearby-map { min-height: 360px; }
  .service-disruption-panel { padding: 14px; }
  .service-disruptions { grid-template-columns: 1fr; }
  .vehicle-map-legend span { font-size: 0; }
  .vehicle-map-legend b { font-size: 1rem; }
}

/* Mobile planner polish: keep the five primary destinations reachable while
   preserving a compact, readable order for nearby data and journey planning. */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* Keep the fixed bottom navigation relative to the viewport: a filtered
     sticky header becomes its containing block on mobile browsers. */
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .header-inner { width: calc(100% - 24px); min-height: 60px; flex-wrap: nowrap; gap: 9px; padding-block: 7px; }
  .brand { min-width: 0; gap: 8px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
  .brand-copy { min-width: 0; }
  .brand-copy strong { font-size: .9rem; }
  .brand-copy small { display: none; }
  .header-actions { flex: 0 0 auto; width: auto; margin-left: auto; }
  .settings-trigger { justify-content: center; min-width: 44px; min-height: 44px; padding: 8px; }
  .settings-trigger span:last-child { display: none; }
  .app-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    width: auto;
    min-height: 60px;
    padding: 5px;
    border: 1px solid color-mix(in srgb, var(--border-strong) 72%, transparent);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: 0 16px 42px rgb(0 0 0 / 22%), inset 0 1px 0 rgb(255 255 255 / 42%);
    backdrop-filter: blur(20px) saturate(1.4);
  }
  .nav-button {
    display: grid;
    justify-items: center;
    align-content: center;
    min-width: 0;
    min-height: 48px;
    padding: 6px 4px;
    gap: 2px;
    font-size: .7rem;
    line-height: 1.1;
    white-space: nowrap;
  }
  .nav-button > span:first-child { font-size: 1.1rem; }
  .nav-button.active { border-radius: 13px; }
  main { width: calc(100% - 24px); padding-block: 20px 32px; }
  .compact-hero { margin-bottom: 14px; }
  .compact-hero h1 { margin-bottom: 8px; font-size: clamp(1.9rem, 8vw, 2.8rem); }
  .hero-copy { font-size: .98rem; }
  .nearby-panel { margin-bottom: 16px; padding: 14px; border-radius: 17px; }
  .nearby-location-picker { margin-bottom: 12px; }
  .nearby-location-picker > label { margin-bottom: 5px; }
  .nearby-location-picker input { min-height: 46px; font-size: 16px; }
  .nearby-location-picker .input-action { grid-template-columns: minmax(0, 1fr) repeat(3, auto); }
  .nearby-location-picker .input-action button { width: 46px; min-width: 46px; min-height: 46px; }
  .nearby-location-picker .place-result { min-height: 44px; padding: 10px 12px; }
  .nearby-layout { display: flex; flex-direction: column; gap: 12px; }
  .nearby-map-shell { order: 0; min-height: 0; }
  .landing-nearby-layout .nearby-map { width: 100%; height: min(52vh, 380px); min-height: 280px; max-height: 380px; }
  .nearby-sidebar { order: 1; max-height: none; padding: 12px; border-radius: 14px; }
  .nearby-sidebar-heading { padding-bottom: 8px; }
  .landing-map .nearby-results { max-height: min(44vh, 360px); overflow-y: auto; padding-right: 2px; }
  .nearby-card { min-height: 64px; padding: 12px; }
  .service-disruption-panel { margin-top: 12px; padding: 14px; }
  .planner-layout { gap: 14px; }
  .planner-panel, .planner-results-wrap { padding: 14px; border-radius: 17px; }
  .location-grid { gap: 8px; }
  .location-picker { padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-subtle) 76%, transparent); }
  .location-picker > label { margin-bottom: 6px; font-size: .95rem; }
  .location-picker .input-action input { min-height: 46px; font-size: 16px; }
  .location-picker .input-action button { min-height: 46px; }
  .shortcut-row { flex-wrap: wrap; gap: 2px 8px; margin-top: 7px; }
  .text-button { min-height: 44px; padding: 8px 4px; }
  .selected-place { margin-top: 5px; font-size: .82rem; }
  .swap-button { width: 46px; height: 46px; margin: 0 auto; transform: none; }
  .swap-button:hover { transform: rotate(180deg); }
  .planner-primary-controls { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .planner-primary-controls label:first-child { grid-column: 1 / -1; }
  .planner-primary-controls select, .planner-primary-controls input { min-height: 46px; font-size: 16px; }
  .trip-preferences { margin-top: 10px; }
  .trip-preferences summary { min-height: 44px; padding: 11px 12px; }
  .trip-preferences .planner-controls { margin: 0; padding: 12px; }
  .planner-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 12px; }
  .planner-actions > * { width: 100%; min-height: 46px; }
  .planner-results-wrap .section-heading { margin-bottom: 10px; }
  .journey-card { padding: 13px; }
  .journey-map { height: min(45vh, 320px); min-height: 240px; }
  footer { width: calc(100% - 24px); gap: 10px; padding-block: 18px calc(112px + env(safe-area-inset-bottom)); font-size: .8rem; }
}

@media (max-width: 560px) {
  .header-inner, main, footer { width: calc(100% - 20px); }
  .header-inner { min-height: 56px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: .86rem; }
  .icon-button { padding: 8px 10px; }
  .app-nav { left: 8px; right: 8px; min-height: 62px; border-radius: 16px; }
  .nav-button { min-height: 50px; padding-inline: 2px; font-size: .66rem; }
  .nav-button > span:first-child { font-size: 1.05rem; }
  main { padding-top: 16px; }
  .compact-hero h1 { font-size: clamp(1.75rem, 8.5vw, 2.35rem); }
  .nearby-panel { padding: 12px; }
  .nearby-location-picker .input-action { grid-template-columns: minmax(0, 1fr) repeat(3, auto); }
  .nearby-location-picker .input-action button { width: auto; min-width: 46px; min-height: 46px; padding-inline: 10px; }
  .landing-nearby-layout .nearby-map { height: min(48vh, 320px); min-height: 250px; max-height: 320px; }
  .landing-map .nearby-results { max-height: min(42vh, 300px); }
  .nearby-card { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 11px; }
  .nearby-card-meta { font-size: .82rem; }
  .planner-panel, .planner-results-wrap { padding: 12px; }
  .location-picker { padding: 11px; }
  .planner-primary-controls { gap: 7px; }
  .journey-map { height: min(43vh, 290px); min-height: 220px; }
  footer { padding-bottom: calc(116px + env(safe-area-inset-bottom)); }
}

/* Shared information architecture */
.nav-icon, .settings-icon, .install-icon, .swap-button svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.nav-button { display: inline-flex; align-items: center; }
.nav-button .nav-icon { flex: 0 0 auto; }
.settings-icon { width: 17px; height: 17px; }
.install-button { display: inline-flex; align-items: center; gap: 6px; }
.install-icon { width: 17px; height: 17px; }
.planner-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  max-width: none;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--accent-soft) 35%, var(--surface)));
  box-shadow: var(--shadow-sm);
}
.planner-intro-copy { min-width: 0; }
.planner-intro h1 { max-width: 680px; margin-bottom: 10px; font-size: clamp(2.15rem, 5vw, 4rem); }
.planner-intro .hero-copy { max-width: 650px; font-size: 1.05rem; }
.planner-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 0;
  min-width: min(390px, 42%);
  margin: 0;
  padding: 0;
  list-style: none;
}
.planner-progress li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
  text-align: center;
}
.planner-progress li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(50% + 16px);
  width: calc(100% - 32px);
  height: 2px;
  background: var(--border);
}
.planner-progress li.is-complete { color: var(--success); }
.planner-progress li.is-complete::after { background: var(--success); }
.planner-progress li.is-current { color: var(--accent-dark); }
.planner-progress li > span:first-child {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: inherit;
  font-size: .78rem;
}
.planner-progress li.is-current > span:first-child { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.planner-progress li.is-complete > span:first-child { border-color: var(--success); background: var(--success-bg); }
.plan-workspace { align-items: start; }
.planner-panel-heading { margin-bottom: 20px; }
.planner-panel-heading h2 { margin-bottom: 5px; }
.planner-panel-heading p:last-child { margin: 0; }
.location-picker {
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface-subtle) 58%, var(--surface));
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.location-picker.is-selected { border-color: color-mix(in srgb, var(--accent) 44%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 9%, transparent); }
.location-picker > label { display: flex; align-items: center; gap: 8px; font-size: .96rem; }
.location-step { display: inline-grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: var(--accent-dark); background: var(--accent-soft); font-size: .73rem; font-weight: 850; }
.shortcut-primary { margin-top: 8px; }
.shortcut-disclosure { margin-top: 8px; border-top: 1px solid var(--border); }
.shortcut-disclosure summary { padding: 8px 0 2px; color: var(--muted); cursor: pointer; font-size: .78rem; font-weight: 750; list-style: none; }
.shortcut-disclosure summary::-webkit-details-marker { display: none; }
.shortcut-disclosure summary::after { content: '＋'; float: right; color: var(--accent-dark); font-size: .9rem; }
.shortcut-disclosure[open] summary::after { content: '−'; }
.shortcut-menu { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 3px 0 2px; }
.shortcut-menu .text-button { font-size: .78rem; }
.swap-button { display: grid; place-items: center; }
.swap-button svg { width: 20px; height: 20px; }
.planner-actions { align-items: center; }
.planner-actions .primary-button { min-width: 145px; }
.planner-actions .secondary-button { min-height: 46px; }
.planner-results-wrap {
  min-width: 0;
  align-self: stretch;
  transition: opacity .3s ease, transform .3s var(--ease-out);
}
.planner-results-wrap.is-revealing { opacity: 0; transform: translateY(10px); }
.planner-results-wrap:focus-within { border-color: color-mix(in srgb, var(--focus) 36%, var(--border)); }
.results-status { color: var(--muted); font-size: .78rem; }
.journey-results[aria-busy="true"] { min-height: 160px; }
.journey-results-title:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 40%, transparent); outline-offset: 5px; border-radius: 4px; }
.nearby-disclosure {
  margin-top: 26px;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 20px;
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
}
.nearby-disclosure > summary,
.service-disruption-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 78px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}
details > summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 42%, transparent); outline-offset: -3px; border-radius: 11px; }
.nearby-disclosure > summary::-webkit-details-marker,
.service-disruption-panel > summary::-webkit-details-marker { display: none; }
.nearby-disclosure > summary::after,
.service-disruption-panel > summary::after {
  content: '⌄';
  flex: 0 0 auto;
  color: var(--accent-dark);
  font-size: 1.35rem;
  transition: transform .2s var(--ease-out);
}
.nearby-disclosure[open] > summary::after,
.service-disruption-panel[open] > summary::after { transform: rotate(180deg); }
.nearby-disclosure > summary > span:first-child,
.service-disruption-panel > summary > span:first-child { display: grid; gap: 2px; }
.nearby-disclosure > summary .eyebrow,
.service-disruption-panel > summary .eyebrow { margin: 0; }
.nearby-disclosure > summary strong,
.service-disruption-panel > summary strong { font-size: 1.08rem; }
.disruption-summary { color: var(--muted); font-size: .8rem; text-align: right; }
.nearby-disclosure-content { padding: 0 12px 12px; }
.nearby-disclosure[open] .nearby-disclosure-content { animation: disclosure-in .28s var(--ease-out) both; }
.nearby-disclosure .nearby-panel { margin: 0; border-radius: 16px; box-shadow: none; backdrop-filter: none; animation: none; }
.nearby-disclosure .nearby-map-shell { min-height: 360px; }
.nearby-disclosure .nearby-map { height: 360px; }
.service-disruption-panel {
  margin: 12px 0 0;
  border: 1px solid color-mix(in srgb, var(--warning) 28%, var(--border));
  border-radius: 15px;
  background: color-mix(in srgb, var(--warning-bg) 38%, var(--surface));
}
.service-disruption-panel > summary { min-height: 64px; padding: 13px 16px; }
.service-disruptions { padding: 0 16px 16px; }
.service-disruption-panel[open] .service-disruptions { animation: disclosure-in .25s var(--ease-out) both; }
.service-disruptions .alert-card { min-width: 0; }
.vehicle-map-legend b { color: var(--vehicle-color, var(--accent)); font-size: .72rem; }
.vehicle-map-legend span:nth-child(1) b { color: #2563eb; }
.vehicle-map-legend span:nth-child(2) b { color: #f59e0b; }
.vehicle-map-legend span:nth-child(3) b { color: #7c3aed; }
.vehicle-map-legend span:nth-child(4) b { color: #17613b; }

/* Dense live maps keep a compact mode glyph; the full route badge appears
   when the user zooms in. */
.transit-vehicle-marker.is-compact { width: 34px; height: 34px; }
.transit-vehicle-marker.is-compact .vehicle-marker-body { width: 23px; min-width: 23px; height: 23px; border-width: 2px; border-radius: 7px; }
.transit-vehicle-marker.is-compact .vehicle-mode-icon { display: grid; flex-basis: 19px; border-right: 0; border-radius: 5px; font-size: 11px; }
.transit-vehicle-marker.is-compact .vehicle-route-number { width: 0; min-width: 0; padding: 0; overflow: hidden; font-size: 0; }
.transit-vehicle-marker.is-compact .vehicle-direction-arrow { width: 12px; height: 12px; margin: -6px; }
.transit-vehicle-marker.is-compact .vehicle-direction-arrow::before { top: -23px; width: 12px; height: 29px; }
.vehicle-density-compact .transit-vehicle-marker:hover .vehicle-marker-body,
.vehicle-density-compact .transit-vehicle-marker:focus-visible .vehicle-marker-body { transform: translate(-50%, -50%) scale(1.22); }

@keyframes disclosure-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  main { padding-top: 22px; }
  .planner-intro { display: grid; gap: 22px; margin-bottom: 16px; padding: 22px 18px; border-radius: 20px; }
  .planner-intro h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .planner-intro .hero-copy { font-size: .96rem; }
  .planner-progress { min-width: 0; width: 100%; }
  .planner-progress li { font-size: .66rem; }
  .planner-progress li:not(:last-child)::after { left: calc(50% + 15px); width: calc(100% - 30px); }
  .plan-workspace { gap: 14px; }
  .planner-panel { padding: 16px; border-radius: 18px; }
  .planner-panel-heading { margin-bottom: 14px; }
  .location-grid { grid-template-columns: 1fr; gap: 9px; }
  .swap-button { margin: -2px auto; transform: rotate(90deg); }
  .swap-button:hover { transform: rotate(90deg) scale(1.05); }
  .planner-primary-controls { grid-template-columns: 1fr 1fr; }
  .planner-primary-controls label:first-child { grid-column: 1 / -1; }
  .planner-actions { display: grid; grid-template-columns: 1fr; }
  .planner-actions > * { width: 100%; }
  .planner-results-wrap { padding: 16px; border-radius: 18px; }
  .nearby-disclosure { margin-top: 18px; border-radius: 18px; }
  .nearby-disclosure > summary { min-height: 72px; padding: 14px 16px; }
  .nearby-disclosure-content { padding: 0 7px 7px; }
  .nearby-disclosure .nearby-panel { padding: 14px; }
  .nearby-disclosure .nearby-layout { display: flex; flex-direction: column; }
  .nearby-disclosure .nearby-map-shell { min-height: 0; order: 0; }
  .nearby-disclosure .nearby-map { height: min(54vh, 360px); min-height: 260px; }
  .nearby-disclosure .nearby-sidebar { order: 1; max-height: none; }
  .service-disruption-panel > summary { min-height: 62px; padding: 12px 14px; }
  .disruption-summary { max-width: 40%; }
}

@media (max-width: 420px) {
  .location-grid { grid-template-columns: 1fr; gap: 6px; }
  .location-picker { padding: 11px; }
  .swap-button { width: 32px; height: 32px; margin: -2px auto; transform: rotate(90deg); }
  .swap-button:hover { transform: rotate(90deg) scale(1.05); }
  .shortcut-primary .text-button { max-width: 100%; font-size: .72rem; }
  .selected-place { font-size: .74rem; }
  .planner-progress li > span:last-child { font-size: .61rem; }
  .nearby-disclosure > summary strong, .service-disruption-panel > summary strong { font-size: 1rem; }
  .disruption-summary { font-size: .72rem; }
}

/* The empty result column should not make the initial planner feel unfinished. */
.plan-workspace.planner-results-hidden {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}
.plan-workspace:not(.planner-results-hidden) {
  grid-template-columns: minmax(320px, .92fr) minmax(0, 1.08fr);
}
.selected-place {
  min-height: 0;
  margin-top: 5px;
  line-height: 1.3;
}
.selected-place.is-empty { opacity: .68; }
.nearby-disclosure,
.nearby-disclosure-content,
.nearby-panel,
.nearby-layout,
.nearby-map-shell,
.nearby-sidebar { min-width: 0; max-width: 100%; }
.nearby-disclosure-content { overflow-x: hidden; }

@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .plan-workspace, .plan-workspace:not(.planner-results-hidden) { grid-template-columns: 1fr; }
  .nav-button > span:last-child { white-space: nowrap; }
  .nav-button[data-view="reliability"] > span:last-child { font-size: 0; }
  .nav-button[data-view="reliability"] > span:last-child::after { content: 'Status'; font-size: .7rem; }
  .planner-intro {
    gap: 7px;
    margin-bottom: 12px;
    padding: 11px 15px;
  }
  .planner-intro h1 {
    margin-bottom: 4px;
    font-size: clamp(1.7rem, 8vw, 2.35rem);
    line-height: 1.02;
  }
  .planner-intro .hero-copy { display: none; }
  .planner-progress { gap: 0; }
  .planner-progress li { gap: 3px; font-size: .6rem; }
  .planner-progress li > span:first-child { width: 24px; height: 24px; font-size: .7rem; }
  .planner-progress li:not(:last-child)::after { top: 11px; left: calc(50% + 13px); width: calc(100% - 26px); }
  .planner-panel { padding: 12px; }
  .planner-panel-heading { margin-bottom: 6px; }
  .planner-panel-heading .eyebrow { display: none; }
  .planner-panel-heading > p:last-child { display: none; }
  .location-grid { gap: 6px; }
  .location-picker { padding: 9px; }
  .location-picker > label { margin-bottom: 3px; font-size: .88rem; }
  .location-picker .input-action { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
  .location-picker .input-action input { min-height: 42px; font-size: 16px; }
  .location-picker .input-action button { width: auto; min-width: 54px; min-height: 42px; padding-inline: 9px; }
  .shortcut-row { gap: 2px 7px; margin-top: 2px; }
  .shortcut-primary .text-button { min-height: 34px; padding: 3px 2px; font-size: .75rem; }
  .shortcut-disclosure { margin-top: 3px; }
  .shortcut-disclosure summary { padding: 4px 0 0; }
  .selected-place { margin-top: 3px; font-size: .76rem; }
  .planner-primary-controls { gap: 6px; margin-top: 7px; }
  .planner-primary-controls select, .planner-primary-controls input { min-height: 42px; }
  .trip-preferences { margin-top: 7px; }
  .trip-preferences summary { min-height: 40px; padding: 8px 10px; }
  .planner-actions { gap: 6px; margin-top: 8px; }
  .planner-actions > * { min-height: 44px; }
  .nearby-disclosure-content { overflow-x: hidden; }
}

/* Nearby-first home: the map is an always-visible starting point, with
   arrivals and the planner following in a calm, readable sequence. */
.app-view:focus { outline: none; }
.nearby-home {
  margin: 0 0 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.nearby-panel { position: relative; }
.nearby-map-shell { min-height: 360px; }
.nearby-map { min-height: 360px; }
.nearby-map:empty { display: block; }
.nearby-map-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: inherit;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  background:
    radial-gradient(circle at 24% 20%, color-mix(in srgb, var(--accent-soft) 72%, transparent), transparent 46%),
    linear-gradient(145deg, var(--surface-subtle), var(--surface));
}
.nearby-map-placeholder strong { color: var(--text); font-size: 1.06rem; }
.nearby-map-placeholder > span:last-child { max-width: 300px; font-size: .9rem; }
.map-placeholder-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--border));
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 1.65rem;
  animation: nearby-pulse 2.8s ease-in-out infinite;
}
.nearby-lines {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.nearby-lines-heading { align-items: center; }
.nearby-line-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nearby-line-card {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  transition: transform .22s var(--ease-out), border-color .2s ease, box-shadow .2s ease;
}
.nearby-line-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 44%, var(--border)); box-shadow: var(--shadow-sm); }
.nearby-line-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.line-route-badge { flex: 0 0 auto; min-width: 40px; padding: 5px 7px; border-radius: 8px; text-align: center; font-weight: 850; }
.nearby-line-title { min-width: 0; }
.nearby-line-title strong, .nearby-line-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-line-title span { margin-top: 1px; color: var(--muted); font-size: .74rem; }
.nearby-line-stop { display: -webkit-box; max-height: 2.6em; overflow: hidden; margin: 8px 0 7px; color: var(--muted); font-size: .76rem; line-height: 1.3; overflow-wrap: anywhere; text-overflow: ellipsis; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.nearby-line-arrivals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.line-arrival { display: grid; grid-template-rows: auto auto; align-items: center; gap: 2px; min-width: 0; min-height: 52px; padding: 6px 4px; border-radius: 8px; background: var(--surface-subtle); text-align: center; }
.line-arrival strong { font-size: .95rem; font-variant-numeric: tabular-nums; }
.line-arrival-meta { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; line-height: 1.1; }
.line-arrival-meta > span:first-child { min-width: 0; overflow: hidden; color: var(--muted); font-size: .67rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.line-arrival .data-badge { justify-self: center; margin-top: 0; padding: 1px 4px; font-size: .59rem; }
.line-arrival.is-canceled { opacity: .6; }
.line-arrival-unavailable strong { font-size: .8rem; }
.line-arrival-unavailable .line-arrival-meta > span:first-child { font-size: .65rem; }
.nearby-line-action { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; min-width: 44px; min-height: 44px; margin: 0; border: 1px solid var(--border); border-radius: 9px; padding: 8px; color: var(--accent-dark); background: var(--surface-subtle); font: inherit; font-weight: 800; }
.nearby-line-action-icon { display: block; color: currentColor; font-size: 1.2rem; font-weight: 850; line-height: 1; }
.nearby-line-action:hover { border-color: color-mix(in srgb, var(--accent) 44%, var(--border)); background: var(--accent-soft); transform: translateY(-1px); }
.nearby-line-results > .empty-state.compact { padding: 24px 16px; }
.nearby-cta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.nearby-cta-row button { min-height: 46px; }
.nearby-home .service-disruption-panel { margin-top: 16px; }

@keyframes nearby-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 24%, transparent); }
  50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 0%, transparent); }
}

@media (max-width: 980px) {
  .nearby-line-results { grid-template-columns: 1fr; }
}
@media (min-width: 1100px) {
  .nearby-line-results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nearby-home { margin-bottom: 24px; }
  .nearby-panel { padding: 14px; }
  .nearby-map-shell { min-height: 0; }
  .landing-nearby-layout .nearby-map {
    width: 100%;
    height: clamp(420px, 60vh, 540px);
    height: clamp(420px, 60svh, 540px);
    min-height: clamp(420px, 60svh, 540px);
    max-height: none;
  }
  .nearby-lines { margin-top: 12px; padding-top: 12px; }
  .nearby-lines-heading { display: grid; gap: 3px; align-items: start; }
  .nearby-line-arrivals { gap: 3px; }
  .nearby-cta-row { display: grid; grid-template-columns: 1fr; }
  .nearby-cta-row button { width: 100%; }
  /* Flatten the map/sidebar wrapper only on narrow screens so the
     line-first hierarchy is map → arrivals → secondary stop details. */
  .nearby-panel.landing-map { display: flex; flex-direction: column; }
  .nearby-panel .landing-nearby-layout { display: contents; }
  .nearby-panel .landing-nearby-layout .nearby-map-shell { order: 2; width: 100%; }
  .nearby-panel .nearby-lines { order: 3; }
  .nearby-panel .nearby-cta-row { order: 4; }
  .nearby-panel .landing-nearby-layout .nearby-sidebar { order: 5; width: 100%; }
  .nearby-map-layers {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: 1;
    width: 100%;
    margin-top: 8px;
  }
  .nearby-layers-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 48px;
    padding: 10px 12px;
    text-align: left;
  }
  .nearby-layers-label { display: block; font-size: .9rem; font-weight: 800; }
  .nearby-layers-caret { display: block; }
  .nearby-layers-panel {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-height: min(48svh, 360px);
    margin-top: 6px;
    padding: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-placeholder-icon { animation: none; }
  .nearby-layers-panel { animation: none; }
}

/* Unified nearby map detail surface. It is an anchored card on desktop and a
   draggable, non-modal bottom sheet on touch layouts; the map remains usable
   around the surface in both modes. */
.nearby-map-shell { position: relative; }
.nearby-detail-sheet {
  position: absolute;
  z-index: 60;
  top: 14px;
  right: 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(390px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-elevated) 96%, transparent);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px) saturate(1.15);
  animation: nearby-sheet-in .26s var(--ease-out) both;
}
.nearby-detail-sheet.is-dragging { transition: none; }
.nearby-sheet-handle {
  display: none;
  width: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  touch-action: none;
}
.nearby-sheet-handle span {
  display: block;
  width: 44px;
  height: 4px;
  margin: 10px auto 7px;
  border-radius: 999px;
  background: var(--border-strong);
}
.nearby-sheet-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.nearby-sheet-header h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-sheet-header .eyebrow { margin-bottom: 2px; }
.nearby-detail-close { flex: 0 0 auto; min-width: 44px; min-height: 44px; padding: 7px 10px; font-size: 1.35rem; line-height: 1; }
.nearby-detail-content {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom) + 8px);
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.nearby-detail-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.nearby-detail-action { min-width: 44px; min-height: 44px; padding: 9px 12px; }
.nearby-detail-groups, .nearby-route-directions { display: grid; gap: 9px; }
.nearby-detail-group { padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-subtle); }
.nearby-detail-group-heading { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.nearby-detail-group-heading > div { min-width: 0; }
.nearby-detail-group-heading strong, .nearby-detail-group-heading span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-detail-group-heading span { color: var(--muted); font-size: .74rem; }
.nearby-detail-group-heading .nearby-detail-action { padding: 5px 8px; min-height: 36px; }
.nearby-detail-arrivals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; margin-top: 9px; }
.nearby-sheet-arrival { display: grid; gap: 2px; min-width: 0; min-height: 50px; padding: 6px 3px; border-radius: 8px; text-align: center; background: var(--surface); }
.nearby-sheet-arrival > strong { font-size: .92rem; font-variant-numeric: tabular-nums; }
.nearby-sheet-arrival-meta { display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 0; line-height: 1.05; }
.nearby-sheet-arrival-meta > span:first-child { min-width: 0; overflow: hidden; color: var(--muted); font-size: .66rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.nearby-sheet-arrival .data-badge { padding: 1px 4px; font-size: .58rem; }
.nearby-sheet-arrival.is-canceled, .nearby-vehicle-stop.is-canceled { opacity: .62; }
.nearby-live-vehicle-row, .nearby-vehicle-stop, .nearby-route-direction { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.nearby-live-vehicle-row:first-of-type, .nearby-vehicle-stop:first-child, .nearby-route-direction:first-child { border-top: 0; }
.nearby-live-vehicle-row strong, .nearby-live-vehicle-row span, .nearby-vehicle-stop strong, .nearby-vehicle-stop span, .nearby-route-direction strong, .nearby-route-direction span { display: block; }
.nearby-live-vehicle-row span, .nearby-vehicle-stop div > span, .nearby-route-direction span { color: var(--muted); font-size: .75rem; }
.nearby-vehicle-summary, .nearby-route-state { display: flex; flex-wrap: wrap; gap: 6px 9px; align-items: center; }
.nearby-vehicle-summary > span { color: var(--muted); font-size: .78rem; }
.nearby-vehicle-stops { display: grid; gap: 0; }
.nearby-vehicle-stop { align-items: center; }
.nearby-vehicle-stop > div:first-child { min-width: 0; }
.nearby-vehicle-stop strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-vehicle-stop-eta { display: grid; grid-template-columns: auto auto; align-items: center; justify-items: end; gap: 2px 5px; min-width: 92px; text-align: right; }
.nearby-vehicle-stop-eta strong { font-size: .92rem; font-variant-numeric: tabular-nums; }
.nearby-vehicle-stop-eta > span:not(.data-badge) { color: var(--muted); font-size: .68rem; font-variant-numeric: tabular-nums; }
.nearby-vehicle-stop-eta .data-badge { grid-column: 1 / -1; padding: 1px 5px; font-size: .59rem; }
.nearby-bike-detail-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.nearby-bike-detail-metrics .metric { padding: 10px; }
.nearby-detail-location { margin: 0; }
.nearby-route-directions { padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-subtle); }
.nearby-route-detail-badge { justify-self: start; }
.nearby-route-direction { display: grid; gap: 6px; align-items: start; }
.nearby-route-direction-heading { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
.nearby-route-direction-heading > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-route-arrivals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; min-width: 0; }
@keyframes nearby-sheet-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 760px) {
  .nearby-detail-sheet {
    position: fixed;
    top: auto;
    right: 8px;
    z-index: 60;
    /* Leave the fixed app navigation reachable below the sheet. The nav is
       62px tall with an 8px viewport gap on narrow phones. */
    bottom: calc(78px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: min(74vh, 560px);
    border-radius: 20px 20px 14px 14px;
    transform: translateY(var(--sheet-drag-y, 0));
    transition: transform .22s var(--ease-out), max-height .22s var(--ease-out);
  }
  .nearby-detail-sheet.is-expanded { max-height: min(90%, 700px); }
  .nearby-sheet-handle { display: block; }
  .nearby-sheet-header { padding-top: 1px; }
  .nearby-detail-content { padding-bottom: calc(16px + env(safe-area-inset-bottom) + 8px); }
}
@media (max-width: 420px) {
  .nearby-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nearby-detail-action { width: 100%; }
  .nearby-detail-group-heading { grid-template-columns: auto minmax(0, 1fr); }
  .nearby-detail-group-heading .nearby-detail-action { grid-column: 2; justify-self: start; }
  .nearby-arrivals, .nearby-detail-arrivals { gap: 3px; }
  .nearby-sheet-arrival { min-height: 48px; }
}

/* Phase 3 map/list selection affordances. Canvas geometry stays subtle until
   selected; DOM markers retain a full touch and keyboard target. */
.nearby-map-marker {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 2px solid var(--surface);
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 2px 8px rgb(15 23 42 / 28%);
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  transition: transform .18s var(--ease-out), filter .18s ease, opacity .18s ease, box-shadow .18s ease;
}
.nearby-map-marker-stop,
.nearby-map-marker-bike {
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  box-shadow: none;
  font-size: 0;
}
.nearby-marker-glyph { position: relative; display: grid; place-items: center; }
.nearby-map-marker-stop .nearby-marker-glyph {
  width: 18px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--marker-color, var(--accent)) 82%, var(--surface));
  border-radius: 5px;
  color: var(--marker-text-color, #ffffff);
  background: var(--marker-color, var(--accent));
  box-shadow: 0 1px 4px rgb(15 23 42 / 20%);
  transform: none;
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: -.02em;
}
.nearby-map-marker-stop .nearby-marker-glyph::before,
.nearby-map-marker-stop .nearby-marker-glyph::after {
  content: '';
  position: absolute;
  pointer-events: none;
  background: var(--marker-color, var(--accent));
}
.nearby-map-marker-stop .nearby-marker-glyph::before {
  left: 50%;
  bottom: -5px;
  width: 2px;
  height: 6px;
  transform: translateX(-50%);
  border-radius: 0 0 2px 2px;
}
.nearby-map-marker-stop .nearby-marker-glyph::after {
  left: 50%;
  bottom: -6px;
  width: 8px;
  height: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
}
.nearby-map-marker-stop[data-service="ttc"] .nearby-marker-glyph { border-radius: 5px; }
.nearby-map-marker-stop[data-service="go"] .nearby-marker-glyph { width: 27px; height: 31px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.nearby-map-marker-stop[data-service="up"] .nearby-marker-glyph { width: 21px; height: 21px; border-radius: 50%; }
.nearby-map-marker-stop[data-service="other"] .nearby-marker-glyph { border-radius: 7px; }
.nearby-map-marker-stop[data-mode="bus"] .nearby-marker-glyph {
  width: 27px;
  height: 31px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.nearby-map-marker-stop[data-mode="bus"] .nearby-marker-glyph::before,
.nearby-map-marker-stop[data-mode="bus"] .nearby-marker-glyph::after { display: none; }
.nearby-bus-pin-icon { display: block; width: 27px; height: 31px; overflow: visible; }
.nearby-bus-pin-shell { fill: var(--accent); }
.nearby-bus-pin-body { fill: #ffffff; stroke: var(--accent-dark); stroke-width: .75; }
.nearby-bus-pin-window { fill: var(--accent-dark); }
.nearby-bus-pin-light { fill: var(--accent); }
.nearby-bus-pin-grille { fill: none; stroke: var(--accent-dark); stroke-linecap: round; stroke-width: 1; }
.nearby-bike-pin-icon,
.nearby-go-pin-icon { display: block; width: 27px; height: 31px; overflow: visible; }
.nearby-bike-pin-shell { fill: var(--success); }
.nearby-bike-pin-field { fill: #ffffff; }
.nearby-bike-pin-wheel,
.nearby-bike-pin-frame,
.nearby-bike-pin-handlebar,
.nearby-bike-pin-saddle { fill: none; stroke: var(--success); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.35; }
.nearby-bike-pin-wheel { stroke-width: 1.1; }
.nearby-go-pin-shell { fill: #17613b; }
.nearby-go-pin-field { fill: #ffffff; }
.nearby-go-pin-word { fill: #17613b; font-family: Arial, Helvetica, sans-serif; font-size: 7px; font-weight: 900; letter-spacing: -.4px; }
.nearby-map-marker-stop[data-service="go"] .nearby-marker-glyph::before,
.nearby-map-marker-stop[data-service="go"] .nearby-marker-glyph::after,
.nearby-map-marker-bike .nearby-marker-glyph::before,
.nearby-map-marker-bike .nearby-marker-glyph::after { display: none; }
.nearby-map-marker-bike .nearby-marker-glyph {
  width: 27px;
  height: 31px;
  border: 0;
  border-radius: 0;
  color: var(--success);
  background: transparent;
  box-shadow: none;
  font-size: 0;
}
.nearby-map-marker-location { z-index: 3; background: #2563eb; }
.nearby-map-marker:hover, .nearby-map-marker:focus-visible { transform: scale(1.12); }
.nearby-map-marker:focus-visible, .transit-vehicle-marker:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.nearby-map-marker.is-map-selected, .transit-vehicle-marker.is-map-selected { box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 72%, transparent), 0 3px 12px rgb(15 23 42 / 35%); filter: saturate(1.3); }
.nearby-map-marker-stop.is-map-selected,
.nearby-map-marker-bike.is-map-selected { box-shadow: none; filter: none; }
.nearby-map-marker-stop.is-map-selected .nearby-marker-glyph,
.nearby-map-marker-bike.is-map-selected .nearby-marker-glyph { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 72%, transparent), 0 2px 6px rgb(15 23 42 / 28%); filter: saturate(1.25); }
.nearby-map-marker.is-map-dimmed, .transit-vehicle-marker.is-map-dimmed { opacity: .28; filter: saturate(.55); }
.nearby-map-marker[hidden], .transit-vehicle-marker[hidden] { display: none !important; }
.nearby-card.is-map-selected, .nearby-line-card.is-map-selected { border-color: var(--focus); box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 28%, transparent), var(--shadow-sm); }
.nearby-card.is-map-selected::before, .nearby-line-card.is-map-selected::before { content: ''; display: block; position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: inherit; background: var(--focus); }
.nearby-card, .nearby-line-card { position: relative; }
.nearby-line-card[role='button'] { cursor: pointer; }
.nearby-line-card[role='button']:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.nearby-line-card.is-map-selected .line-route-badge { box-shadow: 0 0 0 2px var(--focus); }
.nearby-map .maplibregl-canvas { cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .nearby-map-marker, .transit-vehicle-marker, .nearby-card, .nearby-line-card { transition: none; }
}

/* UX restructuring: a compact, dark-first system for quick glances while
   walking. The earlier selectors remain available to the data views; these
   tokens and component classes make the Nearby and Planner surfaces share one
   visual language. */
:root {
  --page-bg: #f1f6f5;
  --card-bg: #ffffff;
  --card-bg-muted: #f7faf9;
  --ink-strong: #122022;
  --ink-muted: #607173;
  --line-subtle: #dce8e5;
  --mint: #22cdb8;
  --mint-strong: #0c9788;
  --mint-soft: #dff8f3;
  --route-ink: #ffffff;
  --warning-ink: #9a6b00;
  --warning-surface: #fff7dc;
  --card-radius: 16px;
  --control-radius: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --page-gutter: clamp(16px, 3vw, 28px);
  --control-height: 48px;
}

:root[data-theme="dark"] {
  --page-bg: #080d13;
  --card-bg: #111a22;
  --card-bg-muted: #17232c;
  --ink-strong: #f1f8f6;
  --ink-muted: #9cafb0;
  --line-subtle: #293944;
  --mint: #39ddc8;
  --mint-strong: #72f1dc;
  --mint-soft: #123d3a;
  --warning-ink: #f4ce69;
  --warning-surface: #302a19;
  --border: #293944;
  --border-strong: #3b4e59;
  --background: var(--page-bg);
  --surface: var(--card-bg);
  --surface-subtle: var(--card-bg-muted);
  --text: var(--ink-strong);
  --muted: var(--ink-muted);
  --accent: var(--mint);
  --accent-dark: var(--mint-strong);
  --accent-bright: var(--mint);
  --accent-soft: var(--mint-soft);
  --warning: var(--warning-ink);
  --warning-bg: var(--warning-surface);
}

html { background: var(--page-bg); }
body {
  background: var(--page-bg);
  color: var(--ink-strong);
  overflow-x: hidden;
}

/* Reusable component vocabulary */
.app-card,
.nearby-panel,
.planner-panel,
.planner-results-wrap,
.saved-panel,
.nearby-sidebar,
.nearby-lines {
  border: 1px solid var(--line-subtle);
  border-radius: var(--card-radius);
  background: var(--card-bg);
  box-shadow: 0 10px 26px rgb(4 22 24 / 7%);
}
.section-header,
.section-heading { gap: var(--space-3); }
.section-header > :first-child,
.section-heading > :first-child { min-width: 0; }
.control-label,
.section-count { color: var(--ink-muted); font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.segmented-control {
  display: inline-flex;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line-subtle);
  border-radius: var(--control-radius);
  background: var(--card-bg-muted);
}
.segmented-control > button,
.segmented-control > .nearby-mode-button,
.segmented-control > .planner-time-option {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  padding: 8px 14px;
  color: var(--ink-muted);
  background: transparent;
  font-weight: 800;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease, transform .18s var(--ease-out);
}
.segmented-control > button:hover { color: var(--ink-strong); background: color-mix(in srgb, var(--mint-soft) 55%, transparent); }
.segmented-control > button.is-active,
.segmented-control > button[aria-selected="true"],
.segmented-control > button[aria-pressed="true"] {
  color: var(--ink-strong);
  background: var(--mint-soft);
  box-shadow: 0 1px 4px rgb(0 0 0 / 12%);
}
.route-badge,
.line-route-badge,
.journey-route-pill { border-radius: 9px; }
.arrival-tile,
.line-arrival { border: 1px solid color-mix(in srgb, var(--line-subtle) 80%, transparent); }
.primary-cta,
.primary-button { min-height: var(--control-height); border-radius: var(--control-radius); }
.icon-action,
.icon-action-button,
.icon-button { min-width: 44px; min-height: 44px; }
.primary-button { color: #04221f; background: var(--mint); box-shadow: 0 8px 18px color-mix(in srgb, var(--mint) 20%, transparent); }
.primary-button:hover { background: var(--mint-strong); }

.site-header {
  background: color-mix(in srgb, var(--card-bg) 93%, transparent);
  border-color: var(--line-subtle);
  box-shadow: 0 1px 0 rgb(255 255 255 / 4%);
}
.header-inner { min-height: 70px; width: min(1220px, calc(100% - (var(--page-gutter) * 2))); }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; }
.brand-copy small { display: none; }
.app-nav { border-color: var(--line-subtle); background: color-mix(in srgb, var(--page-bg) 88%, transparent); }
.nav-button { min-height: 44px; }
.nav-button.active { color: var(--ink-strong); background: var(--card-bg-muted); }

main { width: min(1220px, calc(100% - (var(--page-gutter) * 2))); padding-block: 24px 64px; }
.app-view > .hero .hero-copy { display: none; }
.nearby-home { display: block; }
.nearby-panel.landing-map {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: var(--card-bg);
}
.nearby-location-picker {
  order: 0;
  width: auto;
  max-width: none;
  margin: 0;
  padding: var(--space-4) var(--space-4) 0;
}

.planner-nationwide-control {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 2px;
}
.planner-nationwide-control input { margin-top: 4px; accent-color: var(--accent); }
.planner-nationwide-control span, .planner-nationwide-control strong, .planner-nationwide-control small { display: block; }
.planner-nationwide-control small { color: var(--muted); margin-top: 2px; }

.service-directory-panel { margin: 0 0 24px; }
.service-directory-panel > .section-heading { align-items: center; }
.service-directory-panel .section-heading p { margin-block: 5px 0; }
.service-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.service-directory-card { min-width: 0; display: grid; gap: 10px; border: 1px solid var(--border); border-radius: 14px; padding: 15px; background: var(--surface-subtle); }
.service-directory-card[data-coverage="unconfigured"],
.service-directory-card[data-coverage="unknown"],
.service-directory-card[data-coverage="expired"],
.service-directory-card[data-coverage="not_yet_valid"] { border-style: dashed; }
.service-directory-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.service-directory-heading h3 { margin: 0; }
.service-directory-heading p { color: var(--muted); margin: 3px 0 0; font-size: .88rem; }
.service-capabilities { display: flex; flex-wrap: wrap; gap: 6px; }
.service-capability { border: 1px solid var(--border); border-radius: 999px; padding: 4px 8px; font-size: .75rem; font-weight: 700; background: var(--surface); }
.service-capability.available { color: var(--success); border-color: color-mix(in srgb, var(--success) 42%, var(--border)); }
.service-capability.unavailable, .service-capability.expired, .service-capability.not_yet_valid, .service-capability.disabled { color: var(--muted); }
.service-directory-meta { color: var(--muted); font-size: .82rem; margin: 0; }
.service-directory-links { display: flex; flex-wrap: wrap; gap: 8px; }
.service-directory-links a { color: var(--accent-dark); font-weight: 700; }
.service-attribution { padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface); color: var(--muted); font-size: .84rem; }
.service-attribution.translink-legend { color: var(--text); border-color: #005da8; font-weight: 650; }
.runtime-attribution { display: grid; gap: 6px; margin-top: 10px; }
.runtime-attribution:empty { display: none; }
.runtime-attribution > span { display: block; }
.translink-legend { font-size: .9rem !important; }

@media (max-width: 720px) {
  .service-directory { grid-template-columns: 1fr; }
}
.nearby-location-picker input {
  min-height: var(--control-height);
  border-radius: var(--control-radius);
  background: var(--card-bg-muted);
}
.nearby-layout { display: contents; }
.nearby-map-shell {
  order: 1;
  min-height: 0;
  margin: var(--space-3) var(--space-4) 0;
}
.landing-nearby-layout .nearby-map,
.landing-nearby-layout .nearby-map {
  width: 100%;
  height: clamp(430px, 58svh, 600px);
  min-height: 430px;
  max-height: none;
  border: 1px solid var(--line-subtle);
  border-radius: var(--card-radius);
}
.nearby-map-layers {
  position: relative;
  inset: auto;
  z-index: 4;
  width: 100%;
  margin-top: var(--space-2);
}
.nearby-layers-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  height: auto;
  padding: 9px 12px;
  border-radius: var(--control-radius);
  background: var(--card-bg-muted);
  text-align: left;
}
.nearby-layers-label { display: block; color: var(--ink-strong); font-size: .86rem; font-weight: 800; }
.nearby-layers-caret { display: block; }
.nearby-layers-panel {
  position: relative;
  inset: auto;
  width: 100%;
  max-height: min(46svh, 340px);
  margin-top: var(--space-2);
  border-radius: var(--control-radius);
  background: var(--card-bg);
  animation: none;
}
.nearby-lines {
  order: 2;
  margin: var(--space-4) 0 0;
  padding: var(--space-4);
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  box-shadow: none;
  background: color-mix(in srgb, var(--card-bg-muted) 72%, var(--card-bg));
}
.nearby-lines.is-mode-focused { background: color-mix(in srgb, var(--mint-soft) 26%, var(--card-bg)); }
.nearby-lines-heading { align-items: center; margin-bottom: var(--space-3); }
.nearby-lines-heading .eyebrow { margin-bottom: 2px; }
.nearby-lines-heading .nearby-now-kicker { font-size: 0; }
.nearby-lines-heading .nearby-now-kicker::before { content: 'Nearby now'; font-size: .78rem; }
.nearby-line-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
.nearby-line-filter {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--ink-muted);
  background: transparent;
  font-size: .76rem;
  font-weight: 800;
}
.nearby-line-filter:hover,
.nearby-line-filter.is-active { color: var(--ink-strong); border-color: var(--line-subtle); background: var(--card-bg); }
.nearby-line-results { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.nearby-line-card {
  min-height: 0;
  padding: var(--space-3);
  border: 1px solid var(--line-subtle);
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: 0 4px 12px rgb(4 22 24 / 5%);
}
.nearby-line-heading { gap: var(--space-2); }
.nearby-line-title strong { font-size: .92rem; }
.nearby-line-stop { margin: 7px 0; font-size: .73rem; }
.nearby-line-arrivals { gap: 4px; }
.line-arrival { min-height: 54px; padding: 6px 3px; background: var(--card-bg-muted); }
.line-arrival strong { font-size: .9rem; }
.nearby-full-schedule { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; margin-top: var(--space-2); padding-inline: 2px; }
.nearby-cta-row {
  order: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-4);
}
.nearby-cta-row button { width: 100%; min-height: var(--control-height); }
.nearby-sidebar {
  order: 4;
  display: grid;
  gap: var(--space-3);
  max-height: none;
  margin: 0 var(--space-4) var(--space-4);
  padding: var(--space-4);
  background: var(--card-bg);
}
.nearby-sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0; border: 0; }
.nearby-sidebar-heading .eyebrow { margin-bottom: 2px; }
.nearby-sidebar-heading h3 { font-size: 1rem; }
.nearby-mode-control { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.nearby-mode-control button { min-width: 0; padding-inline: 6px; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.nearby-results { gap: var(--space-3); }
.nearby-group { gap: var(--space-2); }
.nearby-group-title { padding-bottom: 2px; }
.nearby-card { min-height: 72px; padding: var(--space-3); border-radius: 13px; background: var(--card-bg-muted); }
.nearby-card strong { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-card-meta strong { font-size: .92rem; }
.nearby-departure-chip { min-height: 26px; padding: 4px 7px; }
.service-disruption-panel { margin: 0; border-radius: var(--card-radius); background: color-mix(in srgb, var(--warning-surface) 35%, var(--card-bg)); }

/* Planner: one focused form, then progressive-disclosure results. */
.planner-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  max-width: none;
  margin-bottom: var(--space-4);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.planner-intro h1 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.55rem); }
.planner-progress { min-width: min(360px, 45%); }
.planner-progress li { font-size: .74rem; }
.planner-layout { display: block; max-width: 920px; margin-inline: auto; }
.planner-panel { padding: clamp(16px, 3vw, 24px); }
.planner-panel-heading { margin-bottom: var(--space-4); }
.planner-panel-heading .eyebrow { margin-bottom: 3px; }
.planner-panel-heading h2 { font-size: 1.25rem; }
.location-grid { gap: var(--space-3); }
.location-picker { padding: var(--space-4); border: 1px solid var(--line-subtle); border-radius: 14px; background: var(--card-bg-muted); }
.location-picker > label { font-size: .95rem; }
.location-picker .input-action input { min-height: var(--control-height); background: var(--card-bg); }
.location-picker .input-action button { min-height: var(--control-height); }
.shortcut-row { margin-top: var(--space-2); }
.shortcut-disclosure { margin-top: 2px; }
.shortcut-disclosure summary { min-height: 36px; padding-top: 7px; color: var(--mint-strong); font-size: .8rem; font-weight: 800; cursor: pointer; }
.planner-primary-controls { grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: var(--space-2); margin-top: var(--space-4); }
.planner-time-control { min-width: 0; }
.planner-time-control .control-label { display: block; margin-bottom: 6px; }
.planner-time-segmented { display: flex; width: 100%; }
.planner-time-option { flex: 1 1 0; min-width: 0; padding-inline: 8px !important; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.planner-primary-controls select,
.planner-primary-controls input { min-height: var(--control-height); background: var(--card-bg-muted); }
.trip-preferences { margin-top: var(--space-3); }
.trip-preferences summary { min-height: 44px; display: flex; align-items: center; padding: 10px 12px; }
.planner-actions { margin-top: var(--space-4); }
.planner-actions .primary-button { min-width: 180px; }
.planner-status, .notice-inline { font-size: .85rem; }
.planner-results-wrap { margin-top: var(--space-4); padding: clamp(16px, 3vw, 24px); }
.planner-results-wrap .section-heading { align-items: center; }
.journey-card { padding: var(--space-4); border-radius: 14px; background: var(--card-bg-muted); }
.journey-card.recommended { border-color: color-mix(in srgb, var(--mint) 46%, var(--line-subtle)); }
.journey-recommended { display: block; margin-bottom: 5px; color: var(--mint-strong); font-size: .76rem; font-weight: 850; letter-spacing: .03em; }
.journey-times { font-size: 1.15rem; }
.journey-summary-metrics { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 8px; }
.journey-metric { display: inline-flex; align-items: baseline; gap: 4px; color: var(--ink-muted); font-size: .78rem; }
.journey-metric small { font-size: .7rem; }
.journey-metric strong { color: var(--ink-strong); font-size: .78rem; }
.journey-metric-status { color: var(--mint-strong); font-weight: 800; }
.journey-map-shell { border-top: 1px solid var(--line-subtle); padding-top: var(--space-3); }
.journey-map-shell .secondary-button { min-height: 44px; }

footer { width: min(1220px, calc(100% - (var(--page-gutter) * 2))); padding-bottom: 32px; font-size: .76rem; }

@media (min-width: 921px) {
  .nearby-line-results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nearby-line-card { min-height: 164px; }
}

@media (max-width: 920px) {
  .planner-primary-controls { grid-template-columns: 1fr 1fr; }
  .planner-time-control { grid-column: 1 / -1; }
  .nearby-line-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
  .header-inner { width: calc(100% - 24px); min-height: 60px; padding-block: 7px; }
  .app-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav-button { min-height: 50px; font-size: .68rem; }
  .nav-button .nav-icon { width: 19px; height: 19px; }
  main { width: calc(100% - 24px); padding-block: 16px 28px; }
  .nearby-panel.landing-map { margin-inline: -1px; }
  .nearby-location-picker { padding: var(--space-3) var(--space-3) 0; }
  .nearby-map-shell { margin-inline: var(--space-3); }
  .landing-nearby-layout .nearby-map { height: clamp(380px, 62svh, 580px); min-height: 380px; }
  .nearby-lines { padding: var(--space-3); }
  .nearby-lines-heading { display: grid; align-items: start; }
  .nearby-line-controls { justify-content: flex-start; }
  .nearby-line-results { grid-template-columns: 1fr; }
  .nearby-line-card { padding: var(--space-3); }
  .nearby-cta-row { grid-template-columns: 1fr; padding: var(--space-3); }
  .nearby-sidebar { margin-inline: var(--space-3); margin-bottom: var(--space-3); padding: var(--space-3); }
  .nearby-mode-control button { font-size: .74rem; }
  .service-disruption-panel { margin-top: var(--space-3); }
  .planner-intro { align-items: flex-start; }
  .planner-progress { min-width: 0; width: 48%; }
  .planner-progress li span:last-child { font-size: .68rem; }
  .planner-panel, .planner-results-wrap { border-radius: 14px; }
  .location-grid { grid-template-columns: 1fr; }
  .swap-button { width: 44px; height: 44px; margin: 0 auto; }
  .planner-primary-controls { grid-template-columns: 1fr 1fr; }
  .planner-time-control { grid-column: 1 / -1; }
  .planner-time-segmented { width: 100%; }
  .planner-time-option { font-size: .73rem; }
  .planner-actions .primary-button { width: 100%; }
  .journey-card-head { display: block; }
  .journey-badges { justify-content: flex-start; margin-top: 8px; }
  .journey-map { height: min(48svh, 340px); }
  footer { width: calc(100% - 24px); padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: .88rem; }
  .nearby-map-shell { margin-inline: 10px; }
  .nearby-sidebar { margin-inline: 10px; }
  .nearby-mode-control button { padding-inline: 4px; }
  .planner-progress { width: 52%; }
  .planner-progress li span:last-child { font-size: .62rem; }
  .planner-primary-controls { grid-template-columns: 1fr; }
  .planner-time-control { grid-column: auto; }
  .scheduled-time-field { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .segmented-control > button,
  .nearby-line-filter,
  .nearby-line-card,
  .nearby-card { transition: none; }
}

/* Compact filter pills still need a comfortable touch target on phones. */
.nearby-line-filter {
  min-height: 44px;
  padding-block: 8px;
}

/* Keep narrow Android viewports from gaining a horizontal scroll strip when
   a long stop name or route destination is rendered. */
html,
body { max-width: 100%; overflow-x: clip; }

/* Mobile navigation and planner progress are intentionally stacked. A
   two-column planner header makes the third step clip on narrow phones, and
   inline nav buttons make the icon/label pairs collide. */
@media (max-width: 760px) {
  .planner-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    width: 100%;
  }
  .planner-intro-copy,
  .planner-progress { width: 100%; min-width: 0; }
  .planner-progress {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .planner-progress li {
    min-width: 0;
    overflow: visible;
  }
  .planner-progress li > span:last-child {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .nav-button {
    display: grid;
    grid-template-rows: 20px minmax(0, auto);
    justify-items: center;
    align-items: center;
    align-content: center;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 6px 2px;
    gap: 3px;
    line-height: 1.05;
    white-space: nowrap;
  }
  .nav-button .nav-icon {
    width: 19px;
    height: 19px;
  }
  .nav-button > span:last-child {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .68rem;
  }
  /* The older Status fallback is retained for compatibility with cached
     styles, but the real label now renders normally in the four-tab nav. */
  .nav-button[data-view="reliability"] > span:last-child { font-size: .68rem; }
  .nav-button[data-view="reliability"] > span:last-child::after { content: none; }
  .nav-button.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mint) 36%, transparent); }

  /* MapLibre's compact control uses a small “i” button when closed. Keep
     that state compact, but never clip the expanded attribution details. */
  .nearby-map .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) {
    width: 24px;
    min-width: 24px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    overflow: hidden;
  }
  .nearby-map .maplibregl-ctrl-attrib.maplibregl-compact-show {
    width: auto;
    min-width: 0;
    max-width: calc(100% - 16px);
    min-height: 20px;
    height: auto;
    padding: 2px 28px 2px 8px;
    overflow: visible;
    white-space: normal;
  }
  .nearby-map .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .nearby-map .maplibregl-ctrl-attrib-button {
    width: 24px;
    height: 24px;
  }

  /* Nearby now is a glanceable horizontal rail on touch screens. Keep one
     complete card plus a peek of the next card in view to invite swiping. */
  .nearby-lines {
    position: relative;
  }
  .nearby-sheet-grab {
    display: block;
    width: 44px;
    height: 4px;
    margin: -4px auto var(--space-2);
    border-radius: 999px;
    background: var(--border-strong);
    opacity: .7;
  }
  .nearby-sheet-grab span { display: none; }
  .nearby-line-results {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-2);
    margin-inline: 0;
    padding: 0 0 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 0;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .nearby-line-results::-webkit-scrollbar { display: none; }
  .nearby-line-card {
    flex: 0 0 min(300px, calc(100% - 36px));
    scroll-snap-align: start;
  }
  .nearby-line-results > .empty-state.compact {
    flex: 0 0 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nearby-line-results { scroll-snap-type: none; }
}
