@font-face { font-family: Barlow; src: url('./fonts/barlow-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: Barlow; src: url('./fonts/barlow-600.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: Barlow; src: url('./fonts/barlow-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('./fonts/barlow-condensed-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Doto; src: url('./fonts/doto.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --color-glazing: #0c0e0d;
  --color-rubber: #232826;
  --color-seam: #3a403d;
  --color-lamp: #f3f2ec;
  --color-mist: #a3aba6;
  --color-led: #ffa41c;
  --color-lush: #8dc63f;
  --color-signal: #e3312b;
  --color-sign-white: #fff;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-sans: Barlow, system-ui, sans-serif;
  --font-led: Doto, monospace;
  --tracking-tight: -.01em;
  --tracking-caps: .12em;
  --radius-key: 10px;
  --radius-panel: 14px;
  --panel: rgb(12 14 13 / .88);
  --edge-left: max(20px, env(safe-area-inset-left));
  --edge-right: max(20px, env(safe-area-inset-right));
  --edge-top: max(20px, env(safe-area-inset-top));
  --edge-bottom: max(20px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--color-glazing); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body { font: 500 14px/1.3 var(--font-sans); color: var(--color-lamp); }
button, input { font: inherit; }
button { cursor: pointer; touch-action: none; color: inherit; border: 0; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--color-led); outline-offset: 3px; }
button:active { filter: brightness(1.15); }
button svg { flex: none; }
svg { display: block; }
[hidden] { display: none !important; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#view.can-orbit { cursor: grab; }
#view.camera-dragging { cursor: grabbing; }
/* Loading: the bus's own destination sign, then the departure area's stops with the bus crossing them as it builds. */
.loader { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: 16px; overflow: hidden; background: var(--color-glazing); color: var(--color-lamp); transition: opacity .3s; }
.loader.done { opacity: 0; pointer-events: none; }
.loader-card { width: min(560px, 100%); display: grid; gap: 14px; }
.loader-sign { display: flex; align-items: center; gap: 22px; min-height: 92px; padding: 18px 26px; border-radius: var(--radius-panel); background: #050605; color: var(--color-led); font: 800 30px/1 var(--font-led); letter-spacing: .04em; overflow: hidden; }
.loader-service { font-size: 50px; }
.loader-pages { position: relative; flex: 1; min-width: 0; height: 1.1em; }
/* Pages change abruptly like an LED sign, each lighting column by column as a sign-coloured cover steps away. Only
   opacity and transform animate, so the compositor keeps the sign running while the build holds the page. */
.loader-page { position: absolute; inset: 0; white-space: nowrap; animation: loader-page 6s steps(1, end) infinite; }
.loader-page::after { content: ''; position: absolute; inset: -2px -6px; background: #050605; transform: translateX(101%); animation: loader-wipe 6s infinite; }
.loader-page + .loader-page, .loader-page + .loader-page::after { animation-delay: -3s; }
@keyframes loader-page { 0% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes loader-wipe { 0% { transform: translateX(0); animation-timing-function: steps(14, end); } 7%, 100% { transform: translateX(101%); } }
.loader-road { --bus: 72px; position: relative; height: 40px; margin-top: 6px; }
.loader-road::before, .loader-road::after { content: ''; position: absolute; left: calc(var(--bus) / 2); right: calc(var(--bus) / 2); bottom: 4px; height: 4px; border-radius: 2px; background: var(--color-seam); }
.loader-road::after { background: var(--color-lamp); transform-origin: left; transform: scaleX(var(--loader-p, 0)); transition: transform var(--loader-time, .3s) linear; }
.loader-stops { position: absolute; z-index: 1; left: calc(var(--bus) / 2 - 5px); right: calc(var(--bus) / 2 - 5px); bottom: 1px; display: flex; justify-content: space-between; }
.loader-stops i { width: 10px; height: 10px; border: 2px solid var(--color-seam); border-radius: 50%; background: var(--color-glazing); transition: background-color .2s, border-color .2s; }
.loader-stops i.passed { border-color: var(--color-lamp); background: var(--color-lamp); }
.loader-stops i.next { border-color: var(--color-led); }
.loader-run { position: absolute; z-index: 2; left: calc(var(--bus) / 2); right: calc(var(--bus) / 2); bottom: 7px; transform: translateX(calc(var(--loader-p, 0) * 100%)); transition: transform var(--loader-time, .3s) linear; }
.loader-bus { width: var(--bus); margin-left: calc(var(--bus) / -2); }
.loader-bus .bus-body { fill: var(--color-lush); }
.loader-bus .bus-glass, .loader-bus .bus-tyre { fill: var(--color-glazing); }
.loader-bus .bus-pillars { stroke: var(--color-lush); }
.loader-bus .bus-led { fill: var(--color-led); }
.loader-bus .bus-hub { fill: var(--color-mist); }
.loader-bus .bus-spoke { stroke: var(--color-mist); }
.loader-wheel { transform-box: fill-box; transform-origin: center; animation: loader-wheel .7s linear infinite; }
@keyframes loader-wheel { to { transform: rotate(360deg); } }
.loader-ends { display: flex; justify-content: space-between; gap: 16px; color: var(--color-mist); font: 600 13px/16px var(--font-sans); }
.loader-ends span:last-child { text-align: right; }
.loader-line { min-height: 22px; margin: 4px 0 0; font: 600 16px/22px var(--font-sans); }
.loader-tip { min-height: 18px; margin: 0; color: var(--color-mist); font: 500 14px/18px var(--font-sans); }
.loader.message { cursor: pointer; }
.loader.message .loader-road, .loader.message .loader-ends, .loader.message .loader-tip { display: none; }
.loader.message .loader-line { color: var(--color-led); font: 700 18px/1.5 var(--font-led); letter-spacing: .04em; }
@media (max-width: 480px) {
  .loader-wide { display: none; }
  .loader-sign { gap: 14px; min-height: 72px; padding: 14px 18px; font-size: 22px; }
  .loader-service { font-size: 38px; }
  .loader-road { --bus: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .loader, .loader-road::after, .loader-run { transition: none; }
  .loader-page, .loader-page::after, .loader-wheel { animation: none; }
  .loader-page + .loader-page { display: none; }
}
.hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; }
body.driving .hud { opacity: 1; visibility: visible; }
/* Sheet presence also covers nested dialogs and direct sheet removal. */
body:has(> .sheet) .hud { visibility: hidden; }
/* Folio injects a way home and its feedback pill into the bottom corners, under the wheel, the pedals and the keys.
   The sheets carry the way home instead (menu.js folioLink); the pill waits for the pause, start and summary sheets. */
#folio-home { display: none !important; }
body.driving:not(:has(> .sheet)) > folio-feedback { display: none !important; }
.panel { background: var(--panel); border-radius: var(--radius-panel); }
.headsign { display: flex; align-items: center; gap: 14px; background: #050605; color: var(--color-led); font-family: var(--font-led); white-space: nowrap; }
.headsign .service { font-size: 40px; font-weight: 800; line-height: 40px; letter-spacing: .02em; }
.destination { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.destination b { font-size: 17px; line-height: 18px; letter-spacing: .04em; font-weight: 800; }
.destination .via { font-size: 13px; line-height: 14px; letter-spacing: .05em; opacity: .85; }
.stopbox { position: absolute; top: var(--edge-top); left: var(--edge-left); width: 312px; overflow: hidden; }
.stopbox .headsign { padding: 12px 16px 11px; }
.next-stop { padding: 11px 16px 13px; }
.caps { font-weight: 600; font-size: 11px; letter-spacing: var(--tracking-caps); color: var(--color-mist); }
.stop-label { display: flex; justify-content: space-between; align-items: center; }
.stopcode { color: var(--color-mist); font-size: 12px; font-variant-numeric: tabular-nums; }
.stopname { font: 700 28px/30px var(--font-display); letter-spacing: var(--tracking-tight); margin: 2px 0; }
.stopmeta { display: flex; gap: 10px; font-size: 14px; color: var(--color-mist); white-space: nowrap; }
.stopmeta .distance { color: var(--color-lamp); font-variant-numeric: tabular-nums; }
.stopmeta span:empty { display: none; }
.bell { display: none; align-items: center; gap: 10px; padding: 8px 16px 9px; border-top: 1px solid #3a0f0c; background: #120504; color: #ff5a4a; font: 800 15px/17px var(--font-led); letter-spacing: .08em; }
.bell.on { display: flex; }
.bell i { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--color-signal); box-shadow: 0 0 10px 2px rgb(227 49 43 / .7); }
/* Compact layouts merge the route strip into this card: the two stops after the next one and the road, under a seam
   on upright screens (where the stopping bell takes their place) and beside the next stop on landscape touch screens. */
.stop-then { display: none; align-items: baseline; gap: 8px; min-width: 0; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--color-seam); }
.stop-then .caps { flex: none; font-size: 10px; }
.stop-then-names { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 12px/16px var(--font-sans); }
.stop-road { display: none; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-mist); font-size: 10px; font-weight: 600; line-height: 14px; letter-spacing: .12em; text-transform: uppercase; }
.hud .stop-road:empty { display: none; }
.route-panel { position: absolute; top: var(--edge-top); left: max(calc(var(--edge-left) + 328px), calc(50% - 270px)); width: min(540px, calc(100% - var(--edge-left) - var(--edge-right) - 502px)); border-radius: 14px; background: rgb(12 14 13 / .8); padding: 12px 18px 10px; }
.route-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.route-tools > .caps { font-size: 10px; color: var(--color-mist); letter-spacing: .12em; }
.route-actions { display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.sound-key { display: flex; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--color-seam); border-radius: var(--radius-key); background: var(--color-rubber); color: var(--color-lamp); font: 600 14px/18px var(--font-sans); white-space: nowrap; pointer-events: auto; cursor: pointer; }
.sound-key svg { width: 20px; height: 20px; flex: none; }
.sound-key[data-sound="locked"] { color: var(--color-glazing); background: var(--color-led); border-color: var(--color-led); }
.sound-key[data-sound="off"] { color: var(--color-mist); }
.drive-rate { display: flex; align-items: center; gap: 5px; color: var(--color-mist); font-size: 11px; }
.drive-rate select { min-height: 32px; padding: 4px 6px; color: var(--color-lamp); background: var(--color-rubber); border: 1px solid var(--color-seam); border-radius: 6px; font: 600 13px var(--font-sans); cursor: pointer; }
.upcoming-stops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 8px 0 0; padding: 0; }
.upcoming-stop { position: relative; min-width: 0; padding-top: 13px; }
.upcoming-stop::before { content: ''; position: absolute; top: 3px; left: 0; width: calc(100% + 10px); height: 1px; background: var(--color-seam); }
.upcoming-stop:last-child::before { width: 0; }
.upcoming-stop i { position: absolute; top: 0; left: 0; width: 7px; height: 7px; border: 1px solid var(--color-mist); background: var(--color-glazing); border-radius: 50%; }
.upcoming-stop.next i { border-color: var(--color-led); background: var(--color-led); }
.upcoming-stop.arrival i, .stop-row.arrival .stop-rail i { border-radius: 0; }
.upcoming-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font: 600 13px/15px var(--font-sans); min-height: 30px; }
.upcoming-stop.next .upcoming-name { color: var(--color-led); }
.upcoming-detail { display: block; margin-top: 3px; font-size: 10px; color: var(--color-mist); }
.road { margin-top: 7px; text-align: center; text-transform: uppercase; font-size: 12px; font-weight: 600; letter-spacing: .14em; min-height: 15px; }
.clock-limit { position: absolute; right: var(--edge-right); top: var(--edge-top); display: flex; gap: 12px; align-items: center; }
.clock { border-radius: 14px; background: rgb(12 14 13 / .8); padding: 9px 14px 10px; text-align: center; }
.clock-time { font: 700 26px/28px var(--font-display); font-variant-numeric: tabular-nums; }
.trip-time { font-size: 12px; color: var(--color-mist); }
.limit { border: 7px solid var(--color-signal); border-radius: 50%; background: var(--color-sign-white); width: 58px; height: 58px; display: grid; place-items: center; color: #111; font: 700 24px var(--font-display); }
.inst { position: absolute; left: 50%; transform: translateX(-50%); bottom: var(--edge-bottom); width: 320px; min-height: 118px; padding: 12px 16px 14px; display: grid; grid-template-columns: 30px 1fr 30px; column-gap: 14px; align-items: center; text-align: center; }
.speed-reading { display: flex; align-items: end; justify-content: center; gap: 10px; }
.speed { font: 700 64px/64px var(--font-display); font-variant-numeric: tabular-nums; }
.speed-units { padding-bottom: 3px; text-align: left; }
.unit { font-size: 12px; color: var(--color-mist); font-weight: 600; }
.gear { font: 700 20px/22px var(--font-display); }
.speed-bar { grid-column: 1 / -1; position: relative; height: 3px; margin: 10px 36px 0; border-radius: 2px; background: var(--color-seam); }
.speed-fill { height: 3px; background: var(--color-lamp); border-radius: 2px; }
.speed-fill.over { background: var(--color-signal); }
.limit-tick { position: absolute; top: -3px; width: 3px; height: 9px; background: var(--color-signal); }
.bus-status { grid-column: 1 / -1; color: var(--color-led); font-size: 10px; font-weight: 700; letter-spacing: .08em; margin-top: 6px; }
.bus-status:empty { display: none; }
.dashboard-keys { position: absolute; right: var(--edge-right); bottom: var(--edge-bottom); display: flex; gap: 8px; padding: 8px; border-radius: 14px; background: rgb(12 14 13 / .8); pointer-events: auto; }
.dashboard-key { position: relative; width: 68px; height: 64px; border-radius: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 7px; background: var(--color-rubber); color: var(--color-lamp); font: 700 11px var(--font-sans); letter-spacing: .1em; pointer-events: auto; }
.dashboard-key svg { width: 26px; height: 26px; }
.dashboard-key small { position: absolute; top: 3px; right: 5px; font: 600 10px var(--font-sans); color: var(--color-mist); }
.dashboard-key.on { background: var(--color-led); color: #1a1204; }
.dashboard-key.on small { color: #1a1204; }
.camera-reset { position: absolute; right: var(--edge-right); bottom: calc(var(--edge-bottom) + 88px); }
.camera-hint { position: absolute; left: var(--edge-left); bottom: calc(var(--edge-bottom) + 88px); padding: 8px 12px; border-radius: var(--radius-key); background: var(--panel); color: var(--color-mist); font-size: 12px; }
.cluster-arrow { width: 44px; height: 44px; padding: 10px; border-radius: 0; background: transparent; color: var(--color-seam); display: grid; place-items: center; }
.cluster-arrow svg { width: 24px; height: 24px; }
.cluster-arrow .key-label, .cluster-arrow small { display: none; }
.cluster-arrow.on { color: var(--color-seam); background: transparent; }
.cluster-arrow.lit { color: var(--color-led); }
.left-arrow { justify-self: center; }
.right-arrow { justify-self: center; }
.menu-key { display: none; }
.keys { position: absolute; bottom: var(--edge-bottom); left: var(--edge-left); max-width: 420px; padding: 10px 14px 11px; border-radius: 14px; background: rgb(12 14 13 / .72); font-size: 13px; color: var(--color-mist); line-height: 1.6; transition: opacity .5s; }
.keys b { color: var(--color-lamp); font-weight: 700; }
.keys.faded { opacity: 0; }
/* The drive opens on autopilot: one obvious control above the speed cluster hands over the wheel. */
.autopilot-banner { position: absolute; left: 50%; bottom: calc(var(--edge-bottom) + 132px); transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--radius-panel); background: var(--panel); pointer-events: auto; white-space: nowrap; }
.autopilot-state { display: flex; align-items: center; gap: 8px; color: var(--color-led); font: 800 15px/1 var(--font-led); letter-spacing: .06em; }
.autopilot-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--color-led); }
.take-wheel { min-height: 44px; padding: 0 18px; border-radius: var(--radius-key); background: var(--color-lush); color: #0d1a03; font: 700 20px/1 var(--font-display); }
.take-hint { padding-right: 6px; color: var(--color-mist); font-size: 12px; }
.toast { position: absolute; top: calc(var(--edge-top) + 84px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; width: max-content; max-width: 360px; min-width: 240px; border-radius: 10px; background: rgb(12 14 13 / .92); border-left: 4px solid var(--color-seam); padding: 9px 14px 9px 12px; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.toast.kind-warn { border-color: var(--color-signal); }
.toast.kind-bell { border-color: var(--color-led); color: var(--color-lamp); font-family: var(--font-sans); letter-spacing: normal; }
.toast.kind-good { border-color: var(--color-lush); }
.toast-icon { flex: none; color: var(--color-mist); }
.toast-icon svg { width: 20px; height: 20px; }
.toast.kind-warn .toast-icon { color: var(--color-signal); }
.toast.kind-good .toast-icon { color: var(--color-lush); }
.toast.kind-bell .toast-icon { color: var(--color-led); }
.toast b { display: block; font-size: 15px; font-weight: 700; }
.toast span:not(.toast-icon) { display: block; color: var(--color-mist); font-size: 12px; }
.toast span:empty { display: none; }
.wheelzone, .pedal { display: none; }

/* Sheets use exactly the same controls as the live dashboard. */
.sheet { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: max(40px, env(safe-area-inset-top)) max(40px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(40px, env(safe-area-inset-left)); background: rgb(12 14 13 / .12); }
.card { border-radius: 18px; background: rgb(12 14 13 / .9); overflow: hidden; width: 100%; max-height: 100%; }
.card h1 { margin: 0; font: 700 52px/50px var(--font-display); letter-spacing: -.015em; }
.card p { margin: 0; }
.portrait-scroll { display: contents; }
.portrait-footer { display: none; }
.start-card { max-width: 1200px; height: 640px; display: grid; grid-template-columns: 620fr 580fr; }
.start-left { min-width: 0; display: flex; flex-direction: column; }
.start-card .headsign { padding: 18px 32px 16px; gap: 24px; }
.start-card .headsign .service { font-size: 64px; line-height: 60px; }
.start-card .destination b { font-size: 26px; line-height: 29px; }
.start-card .destination .via { font-size: 16px; line-height: 19px; opacity: .82; }
.start-content { padding: 28px 32px 22px; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.title-row { display: flex; justify-content: space-between; align-items: center; }
.sheet-links { display: flex; align-items: center; gap: 8px; }
.sheet-links button { padding: 4px 0; border: 0; border-radius: 0; min-height: 44px; font: 500 12px var(--font-sans); color: var(--color-mist); text-decoration: underline; }
.start-card .sheet-links button:last-child { display: none; }
.start-card .lede { font-size: 16px; line-height: 22px; color: var(--color-mist); margin-top: 8px; }
.time-control { margin-top: 26px; }
.time-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.time-name { font: 700 18px/20px var(--font-display); }
.time-chips { display: flex; gap: 6px; }
.time-chip { flex: 1; min-width: 0; padding: 8px 0; border-radius: 9px; background: var(--color-rubber); font-size: 13px; font-weight: 600; }
.time-chip.selected, .segmented .selected { color: var(--color-glazing); background: var(--color-lamp); font-weight: 700; }
.option-row { display: flex; align-items: start; gap: 24px; margin-top: 18px; }
.control-group { min-width: 0; }
.control-label { display: block; margin-bottom: 8px; }
.segmented { display: flex; gap: 0; border-radius: 11px; padding: 3px; background: var(--color-rubber); }
.segmented button { padding: 8px 14px; border-radius: 9px; background: transparent; font-weight: 600; font-size: 14px; white-space: nowrap; }
.phone-label { display: none; }
.announcements { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 11px; background: rgb(35 40 38 / .6); position: relative; cursor: pointer; min-height: 58px; }
.announcements b { font-size: 15px; font-weight: 600; }
.announcement-detail { display: block; font-size: 13px; color: var(--color-mist); margin-top: 2px; }
.announcement-input { position: absolute; right: 8px; width: 60px; height: 44px; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.toggle { width: 50px; height: 30px; border-radius: 20px; background: var(--color-seam); position: relative; flex: none; }
.toggle::after { content: ''; width: 24px; height: 24px; position: absolute; top: 3px; left: 3px; border-radius: 50%; background: var(--color-lamp); }
.announcement-input:checked + .toggle { background: var(--color-lamp); }
.announcement-input:checked + .toggle::after { transform: translateX(20px); background: var(--color-glazing); }
.announcement-input:focus-visible + .toggle { outline: 2px solid var(--color-led); outline-offset: 3px; }
.actions { display: flex; gap: 12px; align-items: stretch; margin-top: 24px; }
.primary, .outline { min-height: 50px; border-radius: 12px; padding: 12px 24px; font: 700 20px/24px var(--font-display); background: transparent; color: var(--color-lamp); border: 2px solid var(--color-seam); display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.primary { background: var(--color-lush); color: #0d1a03; border-color: var(--color-lush); font-size: 22px; padding: 12px 26px; }
.primary svg { width: 24px; height: 24px; fill: currentColor; }
.credits { margin-top: auto; padding-top: 14px; font-size: 12px; line-height: 17px; color: var(--color-mist); }
.credits .outline { display: inline; border: 0; padding: 0; min-height: 0; font: inherit; color: inherit; text-decoration: underline; }
.start-route { min-width: 0; min-height: 0; padding: 26px 30px 26px 26px; border-left: 1px solid var(--color-seam); display: flex; flex-direction: column; }
.route-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; min-height: 15px; }
.route-instruction { font-size: 12px; color: var(--color-mist); }
.stop-list { overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; touch-action: pan-y; overscroll-behavior: contain; scroll-padding-block-end: 28px; scrollbar-width: thin; scrollbar-color: var(--color-seam) transparent; }
.stop-list.can-scroll-down { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
.stop-row { width: 100%; height: 34px; min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 0; background: transparent; border-radius: 9px; text-align: left; position: relative; touch-action: pan-y; }
.stop-row.selected { background: var(--color-rubber); }
.section-heading { color: var(--color-led); font: 700 20px/24px var(--font-display); margin: 18px 0 6px; }
.section-heading:first-child { margin-top: 0; }
summary.section-heading { cursor: pointer; min-height: 44px; padding-block: 6px; }
.section-note { color: var(--color-mist); font-size: 13px; line-height: 17px; margin-bottom: 8px; }
.start-sheet .stop-row { height: auto; min-height: 44px; padding-block: 6px; }
.start-sheet .route-stop-name { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.stop-rail { align-self: stretch; flex: none; position: relative; width: 22px; margin-left: 4px; display: grid; place-items: center; }
.stop-rail::before { content: ''; position: absolute; top: 0; bottom: 0; left: 10px; width: 2px; background: var(--color-mist); }
.stop-row:first-child .stop-rail::before { top: 50%; }
.stop-row:last-child .stop-rail::before { bottom: 50%; }
.stop-rail i { position: relative; width: 10px; height: 10px; border: 2px solid var(--color-mist); border-radius: 50%; background: var(--color-glazing); }
.selected .stop-rail i { width: 16px; height: 12px; border-radius: 3px; background: var(--color-lush); border-color: var(--color-glazing); }
.terminus { color: var(--color-mist); }
.terminus .stop-rail i { width: 14px; height: 14px; background: var(--color-mist); }
.route-stop-name { font-size: 15px; font-weight: 600; white-space: nowrap; flex: 1; }
.selected .route-stop-name { font-weight: 700; }
.mrt-badges { display: flex; gap: 3px; }
.mrt { padding: 1px 3px; border-radius: 3px; font-size: 10px; line-height: 12px; font-weight: 700; color: #fff; }
.mrt-cc { background: #fa9e0d; color: #111; }
.mrt-te { background: #9d5b25; }
.mrt-ns { background: #d42e12; }
.mrt-ne { background: #9900aa; }
.route-stop-code { width: 44px; flex: none; text-align: right; color: var(--color-mist); font-size: 12px; font-variant-numeric: tabular-nums; }
.route-stop-road { width: 86px; flex: none; color: var(--color-mist); font-size: 10px; letter-spacing: .1em; font-weight: 600; }
.summary-card { max-width: 720px; background: rgb(12 14 13 / .92); }
.summary-card .headsign { padding: 17px 30px; gap: 22px; }
.summary-card .service { font-size: 46px; line-height: 40px; }
.summary-card .destination b { font-size: 22px; line-height: 24px; }
.summary-card .via { font-size: 14px; line-height: 18px; }
.summary-content { padding: 24px 30px 26px; }
.summary-card h1 { font-size: 44px; line-height: 46px; }
.summary-lede { font-size: 15px; color: var(--color-mist); margin-top: 3px !important; }
.summary-stats { display: grid; grid-template-columns: 1fr .85fr 1.5fr 1.4fr; gap: 16px; margin-top: 24px; }
.summary-stats b { display: block; font: 700 34px/36px var(--font-display); font-variant-numeric: tabular-nums; }
.summary-stats .caps { display: block; margin-top: 2px; font-size: 11px; }
.accuracy-chart { margin-top: 24px; }
.chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--color-mist); font-size: 12px; }
.accuracy-bars { position: relative; display: flex; gap: 6px; height: 62px; align-items: end; margin-top: 10px; border-bottom: 1px solid var(--color-seam); }
.accuracy-bars.journey { gap: 2px; }
.continuation-sheet .actions, .loading-error-sheet .actions { flex-wrap: wrap; }
.continuation-sheet .actions .primary { width: 100%; }
.continuation-error { color: var(--color-led); }
.continuation-error:empty { display: none; }
.accuracy-threshold { position: absolute; left: 0; right: 0; border-top: 1px solid var(--color-signal); }
.accuracy-bar { position: relative; flex: 1; min-width: 0; background: var(--color-lamp); border-radius: 2px 2px 0 0; }
.accuracy-bar.bad { background: var(--color-signal); }
.accuracy-bar.skipped { background: var(--color-seam); }
.chart-labels { display: flex; justify-content: space-between; gap: 8px; color: var(--color-mist); font-size: 11px; margin-top: 10px; }
.chart-labels span { max-width: 45%; }
.chart-labels span:nth-child(2) { text-align: center; }
.penalties { display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); grid-template-columns: 1fr 1fr; column-gap: 28px; margin-top: 24px; }
.penalty { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--color-mist); font-size: 14px; padding: 7px 0; border-bottom: 1px solid var(--color-seam); }
.penalty:nth-child(3n) { border-bottom: 0; }
.penalty.nonzero { color: var(--color-lamp); }
.penalty.collision b { color: var(--color-signal); }
.summary-content .actions { margin-top: 22px; }
.summary-content .primary { font-size: 20px; }
.summary-content .outline { font-size: 18px; padding-inline: 20px; }
.pause-card, .info-card { max-width: 560px; }
.pause-card .headsign { padding: 16px 24px; }
.pause-content, .info-card { padding: 24px; }
.pause-content h1, .info-card h1 { font-size: 36px; line-height: 40px; margin-bottom: 20px; }
.pause-content .title-row { margin-bottom: 20px; }
.pause-content .title-row h1 { margin-bottom: 0; }
.pause-hints { margin-top: 16px; color: var(--color-mist); line-height: 1.8; }
.pause-hints b { color: var(--color-lamp); }
/* The pause actions sit in a footer, so Resume stays in reach while the settings above it scroll. */
.pause-card { display: flex; flex-direction: column; }
.pause-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: var(--color-seam) transparent; }
.pause-content button { touch-action: pan-y; }
.pause-card .portrait-footer { display: block; flex: none; padding: 0 24px 24px; }
.pause-card .portrait-footer .actions { margin-top: 0; }
.pause-guide { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.pause-guide .outline { gap: 8px; }
.pause-guide svg { width: 22px; height: 22px; }
.pause-options { display: grid; gap: 16px; }
.pause-content .announcements { margin-top: 12px; }
/* Wide mouse-and-keyboard screens keep Speed, Map and Photos on the drive. */
@media (min-width: 1051px), (min-width: 761px) and (min-height: 501px) {
  body:not(.touch-ui) .compact-tools { display: none; }
}
.touch-help { display: none; }
.touch-ui .touch-help { display: block; color: var(--color-mist); font-size: 13px; margin-top: 12px; }
.help-copy { font-size: 16px; line-height: 1.6; color: var(--color-mist); margin-bottom: 20px !important; }
.help-copy b { color: var(--color-lamp); }
.help-copy p { margin-top: 16px; }
.info-sheet { z-index: 25; background: rgb(12 14 13 / .7); }

/* Touch controls use the same analog steering and sliding pedal inputs as before. */
.touchmode { --edge-left: max(14px, env(safe-area-inset-left)); --edge-right: max(14px, env(safe-area-inset-right)); --edge-top: max(10px, env(safe-area-inset-top)); --edge-bottom: max(12px, env(safe-area-inset-bottom)); }
.touchmode .stopbox { width: 236px; border-radius: 12px; }
.touchmode .stopbox .headsign { padding: 9px 12px; gap: 12px; }
.touchmode .headsign .service { font-size: 26px; line-height: 22px; }
.touchmode .destination b { font-size: 14px; line-height: 20px; letter-spacing: .01em; }
.touchmode .destination .via, .touchmode .stop-label { display: none; }
.touchmode .next-stop { padding: 8px 12px 9px; }
.touchmode .stopname { font-size: 21px; line-height: 23px; margin: 0 0 2px; }
.touchmode .stopmeta { gap: 8px; font-size: 12px; }
.touchmode .bell { padding: 5px 12px 6px; font-size: 12px; line-height: 12px; gap: 8px; }
.touchmode .bell i { width: 8px; height: 8px; }
/* Phones and narrow windows keep the upcoming stops in the stop card and Sound, Speed, Map and Photos in the menu. The
   strip floats only "Tap for sound" while audio waits for a gesture and Map and Photos as the open guide's tabs. */
.touchmode .route-panel { left: calc(var(--edge-left) + 250px); transform: none; width: min(300px, calc(100% - var(--edge-left) - var(--edge-right) - 390px)); padding: 0; background: none; }
.touchmode .stop-then { display: flex; }
.touchmode .stop-road { display: block; }
/* Landscape phones and tablets: one wide card at the old card's height, so it stays clear of the indicator keys. It
   narrows while "Tap for sound" or the open guide's tabs need the middle of the top edge. */
@media not all and (orientation: portrait) and (max-width: 760px) {
  .touchmode:not(.sound-locked):not([data-guide-open]) .stopbox { width: min(540px, calc(100% - var(--edge-left) - var(--edge-right) - 200px)); }
  .touchmode:not(.sound-locked):not([data-guide-open]) .next-stop { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 14px; align-items: center; }
  .touchmode .stopname, .touchmode .stopmeta { grid-column: 1; }
  .touchmode .stop-then, .touchmode .stop-road { grid-column: 2; align-self: stretch; margin: 0; padding: 0 0 0 14px; border-top: 0; border-left: 1px solid var(--color-seam); }
  .touchmode .stop-then { grid-row: 1; align-items: center; }
  .touchmode .stop-road { grid-row: 2; }
  .touchmode.sound-locked .stop-then, .touchmode.sound-locked .stop-road,
  .touchmode[data-guide-open] .stop-then, .touchmode[data-guide-open] .stop-road { display: none; }
  /* Notifications leave the top middle to the card: right edge, under the clock and dashboard keys. */
  .hud.touchmode .toast { left: auto; right: var(--edge-right); transform: none; top: calc(var(--edge-top) + 106px); }
}
.touchmode .route-tools > .caps, .touchmode .upcoming-stops, .touchmode .road { display: none; }
.touchmode .route-tools { justify-content: flex-end; }
.touchmode .drive-rate, .touchmode .sound-key:not([data-sound="locked"]),
.touchmode:not([data-guide-open]) .route-actions .journey-guide-key,
.touchmode:not(.sound-locked):not([data-guide-open]) .route-panel { display: none; }
.touchmode .clock-limit { gap: 8px; }
.touchmode .clock { padding: 7px 10px; border-radius: 12px; }
.touchmode .clock-time { font-size: 20px; line-height: 22px; }
.touchmode .trip-time { display: none; }
.touchmode .limit { width: 44px; height: 44px; border-width: 5px; font-size: 19px; }
.touchmode .menu-key { display: grid; width: 44px; height: 44px; }
.touchmode .menu-key svg { width: 22px; height: 22px; }
.touchmode .menu-key small, .touchmode .menu-key .key-label { display: none; }
.touchmode .dashboard-keys { display: contents; }
.touchmode .dashboard-keys .dashboard-key { position: absolute; top: calc(var(--edge-top) + 54px); width: 44px; height: 44px; padding: 10px; border-radius: 12px; }
.touchmode .dashboard-keys .key-label, .touchmode .dashboard-keys small { display: none; }
.touchmode .dashboard-keys .key-view { right: calc(var(--edge-right) + 100px); }
.touchmode .dashboard-keys .key-horn { right: calc(var(--edge-right) + 50px); }
.touchmode .dashboard-keys .key-auto { right: var(--edge-right); }
.touchmode .dashboard-keys .key-doors { top: auto; right: calc(var(--edge-right) + 106px); bottom: calc(var(--edge-bottom) + 94px); width: 96px; height: 52px; display: flex; flex-direction: row; gap: 6px; }
.touchmode .dashboard-keys .key-doors .key-label { display: block; font-size: 12px; }
.touchmode .dashboard-keys .key-doors svg { width: 22px; height: 22px; }
.touchmode .wheelzone { position: absolute; left: var(--edge-left); bottom: var(--edge-bottom); width: 200px; height: 150px; display: grid; place-items: center; border-radius: 75px 75px 22px 22px; background: rgb(12 14 13 / .34); pointer-events: auto; touch-action: none; }
.wheel { width: 128px; height: 128px; color: var(--color-lamp); }
.wheel svg { width: 100%; height: 100%; }
.touchmode .indicator-keys { position: absolute; bottom: calc(var(--edge-bottom) + 158px); left: var(--edge-left); width: 200px; display: flex; justify-content: space-between; pointer-events: auto; }
.touchmode .indicator-keys .dashboard-key { width: 52px; height: 44px; border: 2px solid transparent; border-radius: 12px; background: rgb(35 40 38 / .92); color: var(--color-mist); }
.touchmode .indicator-keys .dashboard-key.on { border-color: var(--color-led); }
.touchmode .indicator-keys .dashboard-key.lit { color: var(--color-led); }
.touchmode .pedal { position: absolute; bottom: var(--edge-bottom); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; border: 0; border-radius: 14px; background: rgb(35 40 38 / .92); pointer-events: auto; touch-action: none; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.touchmode .pedal.accel { right: var(--edge-right); width: 62px; height: 132px; }
.touchmode .pedal.brake { right: calc(var(--edge-right) + 72px); width: 96px; height: 84px; }
.ribs { display: flex; flex-direction: column; gap: 5px; width: 65%; }
.ribs i { width: 100%; height: 3px; background: var(--color-seam); border-radius: 2px; }
.touchmode .pedal.on { background: color-mix(in srgb, var(--color-lamp) 18%, var(--color-rubber)); }
.pedal.on .ribs i { background: var(--color-lamp); }
/* Touch lamps are appended after the bar; place each instrument explicitly. */
.touchmode .inst { width: 180px; min-height: 66px; border-radius: 12px; padding: 8px 12px 10px; gap: 0; grid-template-columns: 24px minmax(0, 1fr) 24px; grid-template-areas: "left reading right" "bar bar bar" "status status status"; }
.touchmode .inst .left-arrow { grid-area: left; }
.touchmode .inst .right-arrow { grid-area: right; }
.touchmode .speed { font-size: 40px; line-height: 42px; }
.touchmode .speed-reading { grid-area: reading; min-width: 0; gap: 6px; }
.touchmode .speed-units { padding-bottom: 0; }
.touchmode .unit { font-size: 11px; }
.touchmode .gear { font-size: 17px; line-height: 18px; }
.touchmode .inst .cluster-arrow { width: 24px; height: 24px; padding: 0; }
.touchmode .inst .cluster-arrow svg { width: 20px; height: 20px; }
.touchmode .speed-bar { grid-area: bar; margin: 5px 2px 0; }
.touchmode .bus-status { grid-area: status; font-size: 9px; }
/* Phones while the autopilot drives: the console makes way for the view (and cannot be grabbed by a resting thumb),
   the camera key moves to the bottom-left corner and one control in the bottom-right corner takes the wheel. */
.touchmode .autopilot-banner { left: auto; right: var(--edge-right); top: auto; bottom: var(--edge-bottom); transform: none; gap: 10px; padding: 5px 5px 5px 12px; border-radius: 12px; }
.touchmode .autopilot-state { font-size: 13px; }
.touchmode .take-wheel { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px 0 14px; font-size: 21px; }
.touchmode .take-wheel svg { width: 22px; height: 22px; }
.touchmode .take-hint { display: none; }
.touchmode .wheelzone, .touchmode .pedal, .touchmode .indicator-keys, .touchmode .dashboard-keys .key-doors,
.touchmode .dashboard-keys .key-horn, .touchmode .dashboard-keys .key-auto { transition: opacity .2s, visibility 0s; }
.touchmode.autopilot .wheelzone, .touchmode.autopilot .pedal, .touchmode.autopilot .indicator-keys,
.touchmode.autopilot .dashboard-keys .key-doors, .touchmode.autopilot .dashboard-keys .key-horn,
.touchmode.autopilot .dashboard-keys .key-auto { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s, visibility 0s .2s; }
.touchmode.autopilot .dashboard-keys .key-view { top: auto; right: auto; bottom: var(--edge-bottom); left: var(--edge-left); width: 56px; height: 56px; padding: 14px; }
.touchmode .camera-reset { right: auto; left: calc(var(--edge-left) + 64px); bottom: var(--edge-bottom); width: 56px; height: 56px; }
.touchmode .camera-reset small { display: none; }
.touchmode .camera-hint { bottom: calc(var(--edge-bottom) + 64px); }
.touchmode .keys { display: none; }
.touchmode .toast { top: calc(var(--edge-top) + 64px); min-width: 0; width: 220px; max-width: 220px; }
.touchmode .toast b { font-size: 13px; }
.touchmode .toast-icon svg { width: 18px; height: 18px; }
/* Upright phones (Paper artboard "Drive HUD — phone portrait 390×844"): the destination block reads down from the
   top like the bus front, speed sits beside the limit sign, and the console sits under the thumbs. */
@media (orientation: portrait) and (max-width: 760px) {
  .touchmode { --edge-left: max(12px, env(safe-area-inset-left)); --edge-right: max(12px, env(safe-area-inset-right)); --edge-top: max(10px, env(safe-area-inset-top)); --edge-bottom: max(12px, env(safe-area-inset-bottom)); --column: 118px; display: grid; grid-template-columns: minmax(0, 1fr) var(--column); grid-template-rows: minmax(124px, max-content) max-content 1fr; align-items: start; gap: 8px 12px; padding: var(--edge-top) var(--edge-right) var(--edge-bottom) var(--edge-left); }
  .touchmode .stopbox { position: static; grid-column: 1; grid-row: 1; width: 100%; max-width: 300px; }
  .touchmode .stopmeta { flex-wrap: wrap; }
  .touchmode .clock-limit { display: contents; }
  .touchmode .clock { position: absolute; top: var(--edge-top); left: calc(100% - var(--edge-right) - var(--column)); }
  .touchmode .menu-key { position: absolute; top: var(--edge-top); right: var(--edge-right); }
  .touchmode .limit { position: absolute; z-index: 1; top: calc(var(--edge-top) + 60px); left: calc(100% - var(--edge-right) - var(--column) + 8px); }
  .touchmode .inst { left: auto; right: var(--edge-right); bottom: auto; top: calc(var(--edge-top) + 52px); transform: none; width: var(--column); min-height: 0; padding: 8px 10px 9px 8px; grid-template-columns: 44px minmax(0, 1fr); column-gap: 8px; grid-template-areas: "sign reading" "bar bar" "status status"; }
  .touchmode .inst .cluster-arrow { display: none; }
  .touchmode .speed-reading { grid-area: reading; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; }
  .touchmode .speed { font-size: 36px; line-height: 30px; }
  .touchmode .speed-units { display: flex; align-items: baseline; gap: 6px; }
  .touchmode .gear { font-size: 14px; line-height: 14px; }
  .touchmode .speed-bar { margin: 6px 0 0; }
  /* The doors key turns amber while they are open and the gear reads R in reverse, so the narrow pair drops the status line. */
  .touchmode .bus-status { display: none; }
  .touchmode .route-panel { position: static; grid-column: 1 / -1; grid-row: 2; width: 100%; }
  .touchmode:has(.bell.on) .stop-then, .touchmode:has(.bell.on) .stop-road { display: none; }
  .touchmode .toast { top: calc(var(--edge-top) + 258px); width: min(300px, calc(100% - var(--edge-left) - var(--edge-right))); max-width: none; }
  .touchmode .wheelzone { width: 180px; }
  .touchmode .indicator-keys { width: 180px; }
  .touchmode .dashboard-keys .key-doors { right: var(--edge-right); bottom: calc(var(--edge-bottom) + 140px); width: 168px; }
  .touchmode .dashboard-keys .key-view, .touchmode .dashboard-keys .key-horn, .touchmode .dashboard-keys .key-auto { top: auto; bottom: calc(var(--edge-bottom) + 200px); }
  .touchmode .dashboard-keys .key-view { right: calc(var(--edge-right) + 124px); }
  .touchmode .dashboard-keys .key-horn { right: calc(var(--edge-right) + 62px); }
  .touchmode .dashboard-keys .key-auto { right: var(--edge-right); }
}
@media (max-width: 1199px), (max-height: 500px) {
  .sheet { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .start-card { grid-template-columns: 430fr 362fr; border-radius: 16px; height: 100%; }
  .start-card .headsign { padding: 10px 18px; gap: 16px; height: 48px; flex: none; }
  .start-card .headsign .service { font-size: 32px; line-height: 30px; }
  .start-card .destination b { font-size: 16px; line-height: 20px; }
  .start-card .destination .via { display: none; }
  .start-content { padding: 8px 18px 10px; gap: 4px; }
  .start-card h1 { font-size: 28px; line-height: 32px; white-space: nowrap; }
  .sheet-links { gap: 8px; }
  .sheet-links button { font-size: 10px; min-height: 44px; }
  .start-card .sheet-links button:last-child { display: block; }
  .start-card .lede, .time-name, .credits, .route-stop-road, .route-stop-code { display: none; }
  .time-control { margin-top: 0; }
  .time-label { margin-bottom: 4px; }
  .time-chips { gap: 5px; }
  .time-chip { min-width: 44px; min-height: 44px; padding: 4px 0; font-size: 14px; }
  .desktop-time { display: none; }
  .option-row { margin-top: 6px; gap: 10px; }
  .option-row .control-label { display: none; }
  .segmented { padding: 3px; }
  .segmented button { min-height: 44px; min-width: 44px; font-size: 14px; padding: 5px 12px; }
  .desktop-label { display: none; }
  .phone-label { display: inline; }
  .announcements { margin-top: 6px; min-height: 44px; padding: 0; background: transparent; }
  .announcements b { font-size: 14px; }
  .announcement-detail { display: none; }
  .announcement-input { right: -5px; }
  .toggle { width: 46px; height: 28px; }
  .toggle::after { width: 22px; height: 22px; }
  .announcement-input:checked + .toggle::after { transform: translateX(18px); }
  .start-content .actions { margin-top: auto; padding-top: 4px; gap: 8px; }
  .actions .primary, .actions .outline { min-height: 44px; font-size: 18px; line-height: 20px; padding: 10px 16px; border-radius: 12px; }
  .start-content .actions .primary { min-width: 0; }
  .start-content .primary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .start-content .actions .outline { padding-inline: 14px; }
  .primary svg { width: 20px; height: 20px; }
  .start-route { padding: 14px 14px 0; }
  .route-heading { margin-bottom: 8px; min-height: 14px; }
  .route-heading .caps { font-size: 12px; }
  .stop-row { height: 44px; min-height: 44px; gap: 6px; }
  .route-stop-name { font-size: 14px; white-space: normal; line-height: 15px; }
  .mrt { font-size: 10px; }
  .stop-rail { width: 22px; margin-left: 2px; }
  .summary-card { max-height: 100%; overflow: auto; touch-action: pan-y; }
  .summary-card .headsign { padding: 10px 20px; }
  .summary-card .service { font-size: 32px; line-height: 32px; }
  .summary-card .destination b { font-size: 18px; line-height: 20px; }
  .summary-card .via { font-size: 11px; }
  .summary-content { padding: 12px 20px 16px; }
  .summary-card h1 { font-size: 30px; line-height: 32px; }
  .summary-lede { font-size: 13px; }
  .summary-stats { margin-top: 12px; }
  .summary-stats b { font-size: 27px; line-height: 28px; }
  .summary-stats .caps { font-size: 10px; }
  .accuracy-chart { margin-top: 12px; }
  .accuracy-bars { height: 40px; }
  .chart-labels { margin-top: 4px; }
  .penalties { margin-top: 10px; }
  .penalty { font-size: 12px; padding: 4px 0; }
  .summary-content .actions { margin-top: 12px; }
  .pause-card { max-width: 720px; display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .pause-card .headsign { grid-row: 1 / -1; flex-direction: column; justify-content: center; padding: 20px; }
  .pause-card .destination .via { display: none; }
  .pause-content { padding: 14px 20px 12px; }
  .pause-content h1 { font-size: 32px; line-height: 34px; margin-bottom: 8px; }
  .pause-content .title-row { margin-bottom: 8px; }
  .pause-content .control-label { display: none; }
  .pause-content .announcements { margin-top: 6px; }
  .pause-hints { margin-top: 6px; font-size: 12px; line-height: 1.5; }
  .pause-card .portrait-footer { grid-column: 2; padding: 10px 20px 14px; border-top: 1px solid var(--color-seam); }
  /* A landscape phone's card reaches Folio's feedback pill in the bottom-right corner. */
  body:has(> folio-feedback) .pause-card .portrait-footer { padding-right: 56px; }
  .pause-guide { gap: 8px; margin-bottom: 8px; }
  .pause-guide .outline { min-height: 44px; padding: 8px 14px; font-size: 18px; line-height: 20px; }
  .pause-guide svg { width: 20px; height: 20px; }
  .pause-options { display: flex; flex-wrap: wrap; gap: 8px 12px; }
  .pause-toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .touch-ui .pause-hints { display: none; }
  .touch-ui .touch-help { font-size: 12px; line-height: 1.3; margin-top: 4px; }
  .info-card { overflow: auto; touch-action: pan-y; padding: 18px 24px; }
  .info-card h1 { margin-bottom: 10px; }
  .help-copy { font-size: 14px; }
}
@media (pointer: coarse) {
  .time-chip, .segmented button { min-height: 44px; }
  .stop-row { height: 44px; min-height: 44px; }
}
/* The smallest landscape phones give the pause settings the whole card. */
@media (max-height: 500px) and (max-width: 640px) {
  .pause-card { grid-template-columns: minmax(0, 1fr); }
  .pause-card .headsign { display: none; }
  .pause-card .portrait-footer { grid-column: 1; }
}
@media (max-height: 360px) {
  .start-card .headsign { height: 42px; }
  .start-content { padding-top: 4px; padding-bottom: 8px; gap: 0; }
  .start-content .option-row, .start-content .announcements { margin-top: 2px; }
  .start-content .actions { padding-top: 0; }
  .summary-card .headsign { padding-block: 6px; }
}
@media (prefers-reduced-motion: reduce) { .keys, .toast, .touchmode .wheelzone, .touchmode .pedal, .touchmode .indicator-keys, .touchmode .dashboard-keys .dashboard-key { transition: none; } }

/* Upright phones show the same sheets as one scrolling column. */
@media (max-width: 600px) and (orientation: portrait) {
  .start-card, .summary-card, .pause-card { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
  .portrait-scroll { display: block; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; overscroll-behavior: contain; scroll-padding-block-end: 28px; scrollbar-width: thin; scrollbar-color: var(--color-seam) transparent; }
  .portrait-scroll.can-scroll-down { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
  .start-left { display: block; }
  .start-content { padding: 12px 18px 16px; gap: 12px; }
  .title-row { flex-wrap: wrap; column-gap: 10px; }
  .sheet-links { gap: 12px; flex: none; }
  .sheet-links button { font-size: 12px; white-space: nowrap; }
  .time-label { margin-bottom: 6px; }
  .time-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .option-row { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; gap: 10px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; min-width: 0; }
  .announcements { margin: 0; }
  .start-route { padding: 0 18px 18px; border-left: 0; }
  .stop-list { flex: none; overflow: visible; }
  .route-stop-name { min-width: 0; }
  .portrait-footer { display: block; flex: none; padding: 12px 18px; border-top: 1px solid var(--color-seam); background: var(--color-glazing); }
  /* Folio's feedback pill sits in the bottom-right corner: keep the actions above it. */
  body:has(> folio-feedback) .portrait-footer { padding-bottom: 56px; }
  .portrait-footer .actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0; padding: 0; }
  .portrait-footer .actions button { width: 100%; min-width: 0; min-height: 44px; padding: 10px 16px; font-size: 18px; line-height: 20px; }
  .portrait-footer .primary span { white-space: normal; overflow: visible; text-overflow: clip; }
  .portrait-footer .desktop-label { display: inline; }
  .portrait-footer .phone-label { display: none; }
  .summary-content { padding: 16px 18px; }
  .summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .summary-stats > div { min-width: 0; }
  .chart-heading { flex-direction: column; align-items: flex-start; gap: 4px; }
  .chart-labels { font-size: 10px; }
  .chart-labels span { min-width: 0; overflow-wrap: anywhere; }
  .penalties { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: minmax(0, 1fr); }
  .pause-card .headsign { flex-direction: row; justify-content: flex-start; padding: 10px 18px; gap: 16px; }
  .pause-card .service { font-size: 32px; line-height: 32px; }
  .pause-card .destination b { font-size: 16px; line-height: 20px; }
  .pause-content { padding: 16px 18px; overflow: visible; overscroll-behavior: auto; }
  .pause-content .control-label { display: block; }
  .pause-options { display: grid; gap: 12px; }
  .pause-toggles { display: block; }
  .pause-card .portrait-footer { padding: 12px 18px; }
  body:has(> folio-feedback) .pause-card .portrait-footer { padding: 12px 18px 56px; }
}

/* A failed future download keeps the drive visible and offers an in-place retry. */
.map-status { position:fixed; z-index:12; left:50%; bottom:140px; transform:translateX(-50%); display:flex; gap:14px; align-items:center; max-width:calc(100% - 28px); padding:14px; border:1px solid var(--color-seam); border-radius:14px; background:var(--color-glazing); color:var(--color-lamp); font:500 16px/22px Barlow,sans-serif; }
.map-status[hidden], .map-status button[hidden] { display:none; }
.map-status { overflow:hidden; }
.map-progress { position:absolute; left:0; right:0; bottom:0; height:3px; background:var(--color-seam); }
.map-progress[hidden] { display:none; }
.map-progress b { display:block; height:100%; background:var(--color-led); transform-origin:left; transform:scaleX(0); transition:transform .4s; }
@media (prefers-reduced-motion: reduce) { .map-progress b { transition:none; } }
.map-status button { min-height:44px; padding:0 14px; border:1px solid var(--color-seam); border-radius:10px; background:var(--color-rubber); color:var(--color-lamp); font:inherit; }
@media (max-width:760px) and (orientation:portrait) { .map-status { bottom:300px; width:calc(100% - 28px); } }

@media (min-width: 761px) and (max-width: 1050px) {
  .hud:not(.touchmode) .route-panel { top: calc(var(--edge-top) + 180px); left: var(--edge-left); width: 390px; }
}
/* Viewport layout is independent of input capability: a narrow mouse/keyboard window needs the same clear scene.
   The first two rows stay in flow so a longer stop name or the stopping bell moves the route below the whole header. */
@media (max-width: 760px), (max-width: 1050px) and (max-height: 500px) {
  .hud:not(.touchmode) { --edge-left: max(14px, env(safe-area-inset-left)); --edge-right: max(14px, env(safe-area-inset-right)); --edge-top: max(10px, env(safe-area-inset-top)); --edge-bottom: max(12px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr) 118px; grid-template-rows: max-content max-content 1fr; align-items: start; gap: 8px 12px; padding: var(--edge-top) var(--edge-right) var(--edge-bottom) var(--edge-left); }
  .hud:not(.touchmode) .stopbox { position: static; grid-column: 1; grid-row: 1; width: 100%; max-width: 300px; border-radius: 12px; }
  .hud:not(.touchmode) .stopbox .headsign { padding: 9px 12px; gap: 12px; }
  .hud:not(.touchmode) .headsign .service { font-size: 26px; line-height: 22px; }
  .hud:not(.touchmode) .destination b { font-size: 14px; line-height: 20px; letter-spacing: .01em; }
  .hud:not(.touchmode) .destination .via, .hud:not(.touchmode) .stop-label { display: none; }
  .hud:not(.touchmode) .next-stop { padding: 8px 12px 9px; }
  .hud:not(.touchmode) .stopname { font-size: 21px; line-height: 23px; margin: 0 0 2px; overflow-wrap: anywhere; }
  .hud:not(.touchmode) .stopmeta { gap: 8px; font-size: 12px; flex-wrap: wrap; }
  .hud:not(.touchmode) .bell { padding: 5px 12px 6px; font-size: 12px; line-height: 12px; gap: 8px; }
  .hud:not(.touchmode) .bell i { width: 8px; height: 8px; }
  .hud:not(.touchmode) .clock-limit { position: static; grid-column: 2; grid-row: 1; display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: start; }
  .hud:not(.touchmode) .clock { grid-column: 1; grid-row: 1; padding: 7px 8px; border-radius: 12px; }
  .hud:not(.touchmode) .clock-time { font-size: 20px; line-height: 22px; }
  .hud:not(.touchmode) .trip-time { display: none; }
  .hud:not(.touchmode) .limit { grid-column: 1; grid-row: 2; justify-self: center; width: 44px; height: 44px; border-width: 5px; font-size: 19px; }
  .hud:not(.touchmode) .menu-key { grid-column: 2; grid-row: 1; display: grid; width: 44px; height: 44px; }
  .hud:not(.touchmode) .menu-key svg { width: 22px; height: 22px; }
  .hud:not(.touchmode) .menu-key small, .hud:not(.touchmode) .menu-key .key-label { display: none; }
  .hud:not(.touchmode) .route-panel { position: static; grid-column: 1 / -1; grid-row: 2; width: 100%; transform: none; padding: 0; background: none; }
  .hud:not(.touchmode) .stop-then { display: flex; }
  .hud:not(.touchmode) .stop-road { display: block; }
  .hud:not(.touchmode):has(.bell.on) .stop-then, .hud:not(.touchmode):has(.bell.on) .stop-road { display: none; }
  .hud:not(.touchmode) .route-tools > .caps, .hud:not(.touchmode) .upcoming-stops, .hud:not(.touchmode) .road { display: none; }
  .hud:not(.touchmode) .route-tools { justify-content: flex-end; }
  .hud:not(.touchmode) .drive-rate, .hud:not(.touchmode) .sound-key:not([data-sound="locked"]),
  .hud:not(.touchmode):not([data-guide-open]) .route-actions .journey-guide-key,
  .hud:not(.touchmode):not(.sound-locked):not([data-guide-open]) .route-panel { display: none; }
  .hud:not(.touchmode) .inst { left: var(--edge-left); bottom: var(--edge-bottom); width: min(220px, calc(100% - var(--edge-left) - var(--edge-right) - 118px)); min-height: 0; transform: none; border-radius: 12px; padding: 8px 8px 10px; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 0 4px; }
  .hud:not(.touchmode) .inst .cluster-arrow { width: 44px; height: 44px; padding: 10px; }
  .hud:not(.touchmode) .speed { font-size: 36px; line-height: 38px; }
  .hud:not(.touchmode) .speed-reading { min-width: 0; gap: 6px; }
  .hud:not(.touchmode) .speed-units { padding-bottom: 0; }
  .hud:not(.touchmode) .unit { font-size: 11px; }
  .hud:not(.touchmode) .gear { font-size: 17px; line-height: 18px; }
  .hud:not(.touchmode) .speed-bar { margin: 5px 2px 0; }
  .hud:not(.touchmode) .bus-status { font-size: 9px; }
  .hud:not(.touchmode) .dashboard-keys { display: grid; grid-template-columns: repeat(2, 44px); gap: 6px; padding: 6px; border-radius: 12px; }
  .hud:not(.touchmode) .dashboard-keys .dashboard-key { width: 44px; height: 44px; padding: 10px; }
  .hud:not(.touchmode) .dashboard-keys .dashboard-key svg { width: 22px; height: 22px; }
  .hud:not(.touchmode) .dashboard-keys .key-label, .hud:not(.touchmode) .dashboard-keys small, .hud:not(.touchmode) .keys { display: none; }
  .hud:not(.touchmode) .toast { top: auto; bottom: calc(var(--edge-bottom) + 118px); min-width: 0; width: min(300px, calc(100% - var(--edge-left) - var(--edge-right))); max-width: none; }
  .hud:not(.touchmode) .autopilot-banner { bottom: calc(var(--edge-bottom) + 118px); gap: 10px; padding: 6px 6px 6px 12px; border-radius: 12px; }
  .hud:not(.touchmode) .take-hint { display: none; }
  .hud.autopilot:not(.touchmode) .toast { bottom: calc(var(--edge-bottom) + 176px); }
  .hud:not(.touchmode) .toast b { font-size: 13px; }
}
@media (min-width: 600px) and (max-width: 1050px) and (max-height: 500px) and (orientation: landscape) {
  .hud:not(.touchmode) { grid-template-columns: 236px minmax(0, 1fr) 118px; grid-template-rows: max-content 1fr; }
  .hud:not(.touchmode) .autopilot-banner { bottom: var(--edge-bottom); }
  .hud:not(.touchmode) .clock-limit { grid-column: 3; }
  .hud:not(.touchmode) .route-panel { grid-column: 2; grid-row: 1; }
}

.loader-map-credit { display: block; margin-top: 0.6rem; color: #b4bec0; font-size: 0.8rem; text-align: center; }
