/* =====================================================================
   Better Transport
   A plain, civic look for a London journey planner:
   square edges, a deep teal masthead, black type on white, thin grey
   rules, and a yellow keyboard-focus ring. The one decorative element is
   the strip of London line colours under the masthead.
   ===================================================================== */

@font-face { font-family: "Albert Sans"; font-weight: 400; font-display: swap; src: url("vendor/fonts/albert-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Albert Sans"; font-weight: 600; font-display: swap; src: url("vendor/fonts/albert-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Albert Sans"; font-weight: 700; font-display: swap; src: url("vendor/fonts/albert-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Albert Sans"; font-weight: 800; font-display: swap; src: url("vendor/fonts/albert-sans-latin-800-normal.woff2") format("woff2"); }

:root {
  /* Surfaces */
  --bg: #F3F2F1;          /* paper grey page */
  --card: #FFFFFF;        /* panels */
  --field: #FFFFFF;       /* inputs */
  --tint: #F3F2F1;        /* quiet fills inside panels */
  /* Type */
  --text: #000000;
  --muted: #505A5F;
  /* Lines */
  --border: #B1B4B6;
  --rule: #DDDDDD;
  --input-border: #6F777B;
  /* Brand */
  --brand: #08675F;       /* Primary actions and links */
  --brand-dark: #064F48;
  --brand-ink: #FFFFFF;
  --brand-soft: #E5F2EF;
  --mast: #123D3A;
  --mast-ink: #FFFFFF;
  /* Signals */
  --focus: #FFDD00;
  --route: #DC241F;
  --go: #00782A;
  --warn-bg: #FFF7BF;
  --warn: #594D00;
  --danger: #D4351C;
  --info-bg: #E5F2EF;
  --info: #08675F;
  --shadow: none;
  --radius: 0;
  color-scheme: light;
}

/* Dark: teal (default dark style) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #102725; --card: #16322F; --field: #102725; --tint: #1C403C;
    --text: #FFFFFF; --muted: #ADC5C1;
    --border: #496963; --rule: #2F4F49; --input-border: #83A7A0;
    --brand: #79D7C7; --brand-dark: #A7E9DC; --brand-ink: #102725; --brand-soft: #1C413B;
    --mast: #0B201E; --mast-ink: #FFFFFF;
    --go: #4CC27A; --warn-bg: #3A3300; --warn: #FFE680; --danger: #FF8A73;
    --info-bg: #1C413B; --info: #A7E9DC;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #102725; --card: #16322F; --field: #102725; --tint: #1C403C;
  --text: #FFFFFF; --muted: #ADC5C1;
  --border: #496963; --rule: #2F4F49; --input-border: #83A7A0;
  --brand: #79D7C7; --brand-dark: #A7E9DC; --brand-ink: #102725; --brand-soft: #1C413B;
  --mast: #0B201E; --mast-ink: #FFFFFF;
  --go: #4CC27A; --warn-bg: #3A3300; --warn: #FFE680; --danger: #FF8A73;
  --info-bg: #1C413B; --info: #A7E9DC;
  color-scheme: dark;
}
/* Dark: charcoal */
@media (prefers-color-scheme: dark) {
  :root[data-dark="charcoal"]:not([data-theme="light"]) {
    --bg: #121212; --card: #1C1C1C; --field: #121212; --tint: #262626;
    --border: #4A4A4A; --rule: #2E2E2E; --input-border: #8C8C8C; --muted: #B5B5B5;
    --brand: #79D7C7; --brand-soft: #233C38; --brand-ink: #121212; --mast: #0B0B0B;
  }
}
:root[data-dark="charcoal"][data-theme="dark"] {
  --bg: #121212; --card: #1C1C1C; --field: #121212; --tint: #262626;
  --border: #4A4A4A; --rule: #2E2E2E; --input-border: #8C8C8C; --muted: #B5B5B5;
  --brand: #79D7C7; --brand-soft: #233C38; --brand-ink: #121212; --mast: #0B0B0B;
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  font: 400 1rem/1.45 "Albert Sans", "Helvetica Neue", Arial, sans-serif;
  /* iOS colours the status bar of a home-screen app from the body's
     background colour, so that's the masthead colour; the grey page is painted
     over it as an image, which iOS ignores. */
  background-color: var(--mast);
  background-image: linear-gradient(var(--bg), var(--bg));
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
}
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; }
[hidden] { display: none !important; }
a { color: var(--brand); }
h1, h2, h3 { letter-spacing: -.005em; }

/* One focus style everywhere: the yellow block with a black underline. */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 -4px 0 #0B0C0C; }
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: inset 0 0 0 2px #0B0C0C; }

.tab svg, .icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: square; stroke-linejoin: miter; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- masthead ---------- */
/* The masthead stays pinned to the top. That keeps the brand and the status
   strip in reach, and lets iPhone Safari colour the status bar from it: on a
   home-screen app the blue runs up behind the clock, and Safari 26 tints its
   own top bar from whatever is pinned at the top of the page. */
.masthead { background: var(--mast); color: var(--mast-ink); position: sticky; top: 0; z-index: 30; }
html { background: var(--mast); scroll-padding-top: calc(84px + env(safe-area-inset-top)); }
.masthead-inner {
  display: flex; align-items: center; gap: 16px; min-height: 60px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-note { display: none; font-size: .85rem; opacity: .85; }
.masthead-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.net-status { font-size: .8rem; font-weight: 700; background: var(--focus); color: #0B0C0C; padding: 4px 10px; }
.menu-btn {
  width: 42px; height: 42px; border: 0; background: transparent; color: var(--mast-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }
.menu-btn:hover { background: rgba(255, 255, 255, .14); }
/* The strip of London line colours: the one decorative flourish, and a live
   status bar. A line with a problem shows a yellow-and-black hazard band. */
.line-strip {
  display: flex; width: 100%; height: 10px; padding: 0; border: 0; background: #000; position: relative; cursor: pointer;
}
.line-strip::after { content: ""; position: absolute; left: 0; right: 0; top: -4px; bottom: -12px; }
.line-strip:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: none; }
/* Before the app has loaded the strip is empty: show the line colours (same
   order as STATUS_LINES in app.js) rather than a black bar. */
.line-strip:empty { background: linear-gradient(90deg, #B36305 0.0% 5.0%, #E32017 5.0% 10.0%, #FFD300 10.0% 15.0%, #00782A 15.0% 20.0%, #F3A9BB 20.0% 25.0%, #A0A5A9 25.0% 30.0%, #9B0056 30.0% 35.0%, #000000 35.0% 40.0%, #003688 40.0% 45.0%, #0098D4 45.0% 50.0%, #95CDBA 50.0% 55.0%, #6950A1 55.0% 60.0%, #00A4A7 60.0% 65.0%, #61686B 65.0% 70.0%, #FFA600 70.0% 75.0%, #006FE6 75.0% 80.0%, #18A95D 80.0% 85.0%, #9B0058 85.0% 90.0%, #DC241F 90.0% 95.0%, #5FB526 95.0% 100.0%); }
/* While the first line status is on its way, a shine sweeps across. */
.line-strip:empty::before, .line-strip.checking::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, transparent 35%, rgba(255, 255, 255, .7) 50%, transparent 65%) no-repeat;
  background-size: 40% 100%; animation: strip-shine 1.4s ease-in-out infinite;
}
@keyframes strip-shine { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@media (prefers-reduced-motion: reduce) {
  .line-strip:empty::before, .line-strip.checking::before { animation: none; background: none; }
}
.seg { flex: 1; height: 100%; background: var(--c); }
.seg.issue {
  background:
    linear-gradient(var(--c) 0 40%, transparent 40%),
    repeating-linear-gradient(-45deg, #FFDD00 0 3px, #000 3px 6px);
}
.status-link {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--mast-ink);
  font-weight: 700; font-size: .875rem; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px;
}
.status-link:hover { text-decoration-thickness: 3px; }
.status-link .status-long { display: none; }
.status-link:not(.has-issues) { display: none; }
.status-link.checking { display: inline-flex; font-weight: 600; text-decoration: none; cursor: default; }
.status-link.checking .status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: status-pulse 1s ease-in-out infinite alternate; }
@keyframes status-pulse { from { opacity: .25; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .status-link.checking .status-dot { animation: none; } }
/* Keep the top bar on one line: on the narrowest phones the count stands
   alone next to the hazard flag. */
.brand-name, .status-link, .net-status { white-space: nowrap; }
.brand { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.masthead-right { flex: none; gap: 6px; }
@media (max-width: 400px) {
  .masthead-inner { gap: 10px; }
  .brand-name { font-size: 1.1rem; }
}
@media (max-width: 374px) {
  .status-link .status-word { display: none; }
}
@media (max-width: 767px) {
  .masthead-right:has(.net-status:not([hidden])) .status-word { display: none; }
}
@media (max-width: 340px) {
  .brand-name { font-size: 1rem; }
}
.status-flag { flex: none; width: 14px; height: 14px; background: repeating-linear-gradient(-45deg, #FFDD00 0 3px, #000 3px 6px); border: 1px solid #FFDD00; }

/* Line status page */
.status-intro { margin: 0 0 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.status-table { background: var(--card); border: 1px solid var(--border); margin-bottom: 14px; }
.status-row { border-top: 1px solid var(--rule); }
.status-row:first-child { border-top: 0; }
.status-row summary, .status-summary {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 12px 16px 12px 0; list-style: none; cursor: default;
}
.status-row summary { cursor: pointer; }
.status-row summary::-webkit-details-marker { display: none; }
.status-row summary::after { content: "+"; grid-column: 4; font-weight: 800; color: var(--brand); font-size: 1.2rem; width: 16px; text-align: center; }
.status-row[open] summary::after { content: "\2212"; }
details.status-row summary { grid-template-columns: 10px minmax(0, 1fr) auto 16px; }
.status-bar { align-self: stretch; margin: -12px 0; }
.status-name { font-weight: 700; }
.status-desc { font-weight: 700; text-align: right; }
.status-desc.ok { font-weight: 400; color: var(--muted); }
.status-desc.minor { color: var(--text); background: var(--focus); color: #0B0C0C; padding: 2px 6px; }
.status-desc.severe { color: #fff; background: var(--danger); padding: 2px 6px; }
.status-reason { padding: 0 16px 14px 24px; border-left: 10px solid transparent; }
.status-reason p { margin: 0 0 6px; max-width: 70ch; }
details.status-row summary:hover .status-name { color: var(--brand); text-decoration: underline; }
.tab.desk-tab { display: none; }

.page-title { margin: 20px 0 16px; font-size: 1.75rem; font-weight: 800; line-height: 1.15; }

main { max-width: 680px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- bottom nav (phones) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 0 4px env(safe-area-inset-bottom);
}
.tab {
  flex: 1; max-width: 128px; background: none; border: 0; border-top: 4px solid transparent;
  padding: 6px 0 8px; color: var(--muted); position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .74rem; font-weight: 600;
}
.tab.active { color: var(--brand); border-top-color: var(--brand); font-weight: 700; }
.tab.active svg { stroke-width: 2.4; }
.badge {
  position: absolute; top: 4px; left: calc(50% + 8px); background: var(--route); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 0 5px; line-height: 16px; min-width: 16px; text-align: center;
}
.nav-foot, .nav-tools { display: none; }

/* ---------- generic ---------- */
.card, .search-card, .summary-card, .list-card {
  background: var(--card); border: 1px solid var(--border);
}
.card { padding: 16px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.grow { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: .9375rem; margin: 4px 0 12px; }
.loading, .empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.empty-icon { margin: 0 auto 8px; width: 40px; height: 40px; color: var(--brand); font-size: 2rem; line-height: 40px; }
.notice {
  background: var(--warn-bg); color: var(--warn); border-left: 6px solid #FFDD00;
  padding: 12px 14px; margin-bottom: 16px; font-size: .9375rem;
}
.notice.info { background: var(--info-bg); color: var(--info); border-left-color: var(--brand); }
.spinner {
  display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px;
  border: 2px solid var(--rule); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.small-spinner { width: 13px; height: 13px; margin-right: 8px; vertical-align: -2px; flex: none; }
/* Under the masthead while TfL is holding requests back. */
.tfl-wait { display: flex; align-items: center; justify-content: center; gap: 0; padding: 7px 16px; background: #FFDD00; color: #0B0C0C; font-size: .9375rem; text-align: center; }
.tfl-wait[hidden] { display: none; }
.tfl-wait .spinner { border-color: rgba(11, 12, 12, .25); border-top-color: #0B0C0C; }
/* A label over a map: loading, waiting on TfL, or couldn't. */
.map-status {
  /* Top right, clear of the zoom buttons on the left. */
  position: absolute; right: 10px; top: 10px; z-index: 1000; max-width: calc(100% - 74px);
  display: flex; align-items: center; gap: 0; padding: 8px 12px; background: var(--card); color: var(--text);
  border: 2px solid var(--text); font-size: .875rem; font-weight: 600; line-height: 1.3; box-shadow: 0 2px 0 rgba(0, 0, 0, .15);
}
.map-status .text-btn { flex: none; white-space: nowrap; margin: -10px -6px -10px 8px; padding: 10px 6px; font-weight: 700; }
.section-title { font-size: 1.125rem; font-weight: 700; color: var(--text); margin: 28px 0 10px; }
.label-sm { font-size: .9375rem; font-weight: 700; margin: 14px 0 8px; }
.site-note { color: var(--muted); font-size: .8125rem; line-height: 1.5; margin: 28px 0 8px; padding-top: 12px; border-top: 1px solid var(--rule); }

/* ---------- form controls ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--field);
  border: 1px solid var(--input-border); border-radius: 0; padding: 11px 12px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 2px #0B0C0C; }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-height: 46px; }
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
.input-row { display: flex; gap: 8px; }
.icon-btn {
  flex: none; width: 46px; height: 46px; border: 1px solid var(--input-border); background: var(--card);
  font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center; color: var(--brand);
}
.icon-btn.plain { background: transparent; border: 0; }

.primary, .secondary {
  border-radius: 0; padding: 11px 18px; font-weight: 700; font-size: 1rem; line-height: 1.25; border: 2px solid var(--brand);
}
.primary { background: var(--brand); color: var(--brand-ink); }
.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.primary.big { width: 100%; padding: 13px; font-size: 1.0625rem; }
.secondary { background: var(--card); color: var(--brand); }
.secondary:hover { background: var(--brand-soft); }
.secondary.big { padding: 13px; margin-top: 16px; }
.wide { width: 100%; }
.text-btn { background: none; border: 0; padding: 8px 2px; color: var(--brand); font-weight: 700; font-size: .9375rem; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.text-btn:hover { text-decoration-thickness: 3px; }
.text-btn.danger, .danger { color: var(--danger); }
.small-btn { padding: 8px 18px; }

.tag {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 6px;
  background: var(--route); color: #fff; vertical-align: middle;
}
.pill { display: inline-block; font-size: .8125rem; font-weight: 700; padding: 1px 6px; background: var(--tint); color: var(--text); }
.pill.live { background: var(--go); color: #fff; }
.muted-pill { color: var(--muted); }
.warn-text { color: var(--danger); font-weight: 700; }

/* Underlined tabs instead of pill switches */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
  border-bottom: 1px solid var(--border); margin: 16px 0 0;
}
.segmented button {
  border: 0; border-bottom: 4px solid transparent; background: transparent; padding: 10px 4px 8px;
  font-size: .9375rem; font-weight: 600; color: var(--muted); white-space: nowrap; margin-bottom: -1px;
}
.segmented button:hover { color: var(--text); }
.segmented button.on { color: var(--text); border-bottom-color: var(--brand); font-weight: 700; }

/* Square checkbox instead of an iOS switch */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { flex: none; width: 28px; height: 28px; border: 2px solid var(--text); background: var(--field); position: relative; }
/* The tick: a rotated corner, centred in the box. Nudged up a little, since
   a tick's weight sits low once it's turned. */
.toggle input:checked + .toggle-track::after {
  content: ""; position: absolute; box-sizing: border-box; left: 50%; top: 50%; width: 9px; height: 15px;
  border: solid var(--text); border-width: 0 3px 3px 0; transform: translate(-50%, -62%) rotate(45deg);
}
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--focus); outline-offset: 0; }

/* ---------- plan form ---------- */
.search-card { padding: 16px; margin-bottom: 20px; }
/* From and To share one box, split by a line, with an icon at the start of
   each and the swap button sitting over the line. The labels are kept for
   screen readers; the placeholders say what goes where. */
.places { position: relative; border: 1px solid var(--input-border); background: var(--field); }
.place-divider { height: 1px; margin: 0 0 0 44px; background: var(--input-border); }
.dot { position: absolute; left: 16px; top: 50%; width: 12px; height: 12px; margin-top: -6px; z-index: 1; pointer-events: none; }
.from-dot { border: 3px solid var(--brand); border-radius: 50%; }
.to-dot { left: 13px; width: 18px; height: 18px; margin-top: -9px; fill: var(--text); }
.places .clearable { margin-right: 60px; }
.places input { border: 0; background: transparent; min-height: 54px; padding-left: 44px; }
/* Focus marks the whole row, out to the edges of the box. */
.places input:focus { outline: 0; box-shadow: none; }
.places .place-row:focus-within { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 2px #0B0C0C; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.place-row { position: relative; }
.field { position: relative; min-width: 0; }
.field label { display: block; font-size: 1rem; line-height: 1.4; font-weight: 700; margin: 0 0 6px; }
.clearable { position: relative; }
.clearable input { padding-right: 42px; }
.clear-btn {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted);
  font-size: 1.5rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.clear-btn:hover { color: var(--text); }
.swap {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border: 2px solid var(--text); background: var(--card);
  font-size: 1.25rem; color: var(--brand); font-weight: 700;
}
.swap:hover { background: var(--brand-soft); }
.when-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; margin-top: 12px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0; flex-wrap: wrap; }

.suggestions {
  list-style: none; margin: -1px 0 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 30;
  background: var(--card); border: 1px solid var(--text); max-height: 340px; overflow-y: auto; display: none;
  box-shadow: 0 6px 0 rgba(0, 0, 0, .08);
}
.suggestions.open { display: block; }
.suggestions li { padding: 10px 12px; border-bottom: 1px solid var(--rule); cursor: pointer; display: flex; flex-direction: column; }
.suggestions li:last-child { border-bottom: 0; }
.suggestions li:hover { background: var(--brand); color: var(--brand-ink); }
.suggestions li:hover small { color: #fff; }
.suggestions li.here span { color: var(--brand); font-weight: 700; }
.suggestions li.here:hover span { color: #fff; }
.suggestions small { color: var(--muted); }
.suggestions li.sugg-head { cursor: default; padding: 8px 12px 6px; font-size: .875rem; font-weight: 700; color: var(--text); background: var(--tint); }
.suggestions li.sugg-head:hover { background: var(--tint); color: var(--text); }
/* What the search is doing: searching, waiting on TfL, or couldn't. */
.suggestions li.sugg-status { cursor: default; flex-direction: row; align-items: center; gap: 0; font-size: .9375rem; color: var(--muted); background: var(--card); }
.suggestions li.sugg-status:hover { background: var(--card); color: var(--muted); }
.suggestions li.sugg-status.failed { color: var(--text); background: #FFF3B0; box-shadow: inset 4px 0 0 #0B0C0C; }
:root[data-theme="dark"] .suggestions li.sugg-status.failed { background: #3A3300; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .suggestions li.sugg-status.failed { background: #3A3300; } }
.route-sugg span { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.route-sugg .bus-num { min-width: 40px; font-size: .875rem; }

/* ---------- results ---------- */
.results-head { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; }
.results-title { font-weight: 800; font-size: 1.25rem; line-height: 1.2; }
.sort-row { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-weight: 700; }
.sort-row select { flex: 1; max-width: 16rem; padding: 8px 10px; font-weight: 600; }
.best-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.best-tag { font-size: .75rem; font-weight: 700; padding: 1px 6px; background: var(--go); color: #fff; }
.day-head { font-size: .9375rem; font-weight: 700; padding: 10px 16px; background: var(--tint); border-bottom: 1px solid var(--rule); }
.jlist { background: var(--card); border: 1px solid var(--border); }
.jrow {
  display: flex; width: 100%; gap: 12px; text-align: left; background: var(--card); border: 0;
  border-top: 1px solid var(--rule); padding: 14px 16px; position: relative;
}
.jlist > .jrow:first-child, .day-head + .jrow { border-top: 0; }
.jrow:hover { background: var(--tint); }
.jrow:hover .jrow-times { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.jrow.past { background: var(--tint); }
.jrow.past .jrow-times, .jrow.past .chips { opacity: .55; }
.jrow-main { flex: 1; min-width: 0; }
.jrow-times { font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.arrow { font-weight: 400; color: var(--muted); }
.jrow-meta { color: var(--muted); font-size: .9375rem; margin: 2px 0 8px; }
.jrow-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 6px; }
.price { font-weight: 800; font-size: 1.0625rem; }
.chev { color: var(--brand); font-size: 1.6rem; line-height: 1; font-weight: 400; }
.saved-star { color: var(--brand); font-weight: 800; }
.saved-item .jrow, .cat-trip .jrow { border: 1px solid var(--border); }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chip { font-size: .8125rem; font-weight: 700; padding: 2px 7px; white-space: nowrap; }
.chip.walk { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.sep { color: var(--muted); font-size: .8rem; }
.more-btn {
  display: block; width: 100%; margin: 0; padding: 12px; border: 1px solid var(--border); border-top: 0;
  background: var(--card); color: var(--brand); font-weight: 700; text-align: center;
}
#earlier { border-top: 1px solid var(--border); border-bottom: 0; }
.more-btn:hover { background: var(--tint); text-decoration: underline; }
.more-btn:disabled { color: var(--muted); }
#way-back { margin-top: 16px; width: 100%; }

.choices h3 { margin: 0 0 10px; font-size: 1.125rem; }
.choice {
  display: block; width: 100%; text-align: left; background: var(--card); border: 0; border-top: 1px solid var(--rule);
  padding: 12px 0; color: var(--brand); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- journey detail ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto;
  animation: sheetIn .18s ease-out; display: flex; flex-direction: column;
}
@keyframes sheetIn { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px;
  padding: calc(6px + env(safe-area-inset-top)) 6px 6px; background: var(--mast); color: var(--mast-ink);
}
.sheet-bar .icon-btn { font-size: 2rem; line-height: 1; color: var(--mast-ink); border: 0; background: transparent; }
.sheet-bar .icon-btn:hover { background: rgba(255, 255, 255, .14); }
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: center; }
.sheet-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.0625rem; }
.sheet-title .muted { color: rgba(255, 255, 255, .8); }
.sheet-body { flex: 1; width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 24px; }
.sheet-actions {
  position: sticky; bottom: 0; display: flex; gap: 0; padding: 0 0 env(safe-area-inset-bottom);
  background: var(--card); border-top: 1px solid var(--border);
}
.sheet-actions > * { flex: 1; }
.act {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0;
  padding: 10px 4px; border: 0; border-left: 1px solid var(--rule); background: var(--card); color: var(--brand);
  font-weight: 700; font-size: .8125rem;
}
.act:first-child { border-left: 0; }
.act:hover { background: var(--tint); }
.act > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-icon { font-size: 1.2rem; line-height: 1.2; height: 1.4rem; display: flex; align-items: center; }
.act-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: square; }
.act-main { background: var(--brand); color: var(--brand-ink); }
.act-main:hover { background: var(--brand-dark); }
.summary-card { padding: 16px; margin: 0 0 16px; border-left: 6px solid var(--brand); }
.summary-day { color: var(--muted); font-size: .9375rem; font-weight: 600; }
.summary-times { font-size: 2.125rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.jmap-wrap { position: relative; margin-bottom: 16px; }
.jmap { height: 240px; overflow: hidden; border: 1px solid var(--border); z-index: 0; }

.legs { list-style: none; margin: 0; padding: 16px; background: var(--card); border: 1px solid var(--border); }
.leg { display: grid; grid-template-columns: 3.4rem 1fr; gap: 8px; }
.leg-time { font-weight: 800; font-variant-numeric: tabular-nums; }
.leg-body { border-left: 6px solid var(--line, var(--muted)); padding: 0 0 20px 22px; position: relative; min-width: 0; }
.walk-leg .leg-body { border-left: 6px dotted var(--muted); }
.leg-body::before {
  /* 26px across, centred on the 6px line just left of the padding box. */
  content: ""; position: absolute; box-sizing: border-box; left: -16px; top: 2px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--card); border: 4px solid var(--line, var(--muted));
}
.leg.end .leg-body { border-left-color: transparent; padding-bottom: 0; }
.leg.end .leg-body::before { border-color: var(--text); background: var(--text); }
.leg-from { font-weight: 700; font-size: 1.0625rem; }
.plat:empty { display: none; }
.plat { margin-top: 4px; }
.leg-instr { margin-top: 6px; }
.warn { background: var(--warn-bg); color: var(--warn); border-left: 6px solid #FFDD00; font-size: .9375rem; padding: 8px 10px; margin-top: 8px; }
.sub { margin-top: 6px; font-size: .9375rem; }
.sub summary { color: var(--brand); cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.sub ol { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }

/* ---------- lists ---------- */
.saved-item { margin-bottom: 20px; }
.saved-head { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; }
.saved-route { font-weight: 800; }
.saved-foot { margin: 6px 0 0; }
.list-card { overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--card);
  border: 0; border-top: 1px solid var(--rule); padding: 14px 16px;
}
.list-row:first-child { border-top: 0; }
button.list-row:hover { background: var(--tint); }
button.list-row:hover .list-title { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 700; }
#clear-recent { display: block; margin: 16px 0; }
.recent-icon { flex: none; width: 28px; height: 28px; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.recent-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }
.home-recent-head { display: flex; justify-content: space-between; align-items: baseline; }
.home-recent-head .section-title { margin: 8px 0 10px; }

/* ---------- buses ---------- */
#view-buses { padding-top: 12px; }
.bus-search { margin-bottom: 12px; }
.bus-search input { background: var(--field); }
.bus-map { height: min(46vh, 380px); overflow: hidden; background: var(--tint); border: 1px solid var(--border); z-index: 0; }
.stop-pin span {
  display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--route); color: #fff; font: 700 11px/1 "Albert Sans", Arial, sans-serif; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.stop-pin.selected span { background: #000; transform: scale(1.3); }
.stop-card { margin: 0 0 16px; }
.stop-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.stop-title, .stop-destination { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-title { flex: 1; min-width: 0; margin: 0; font-size: 1.25rem; line-height: 1.2; }
.stop-destination { margin: 0 0 4px; }
.stop-actions { display: flex; flex: none; gap: 4px; }
.stop-actions .icon-btn { width: 36px; height: 36px; padding: 0; }
#nearby-locate { display: inline-flex; align-items: center; gap: 4px; }
#nearby-locate svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; }
.fav-label { display: block; background: none; border: 0; padding: 0; text-align: left; color: var(--brand); font-weight: 700; margin-top: 2px; text-decoration: underline; text-underline-offset: 3px; }
.fav-label.inline { display: inline; text-decoration: none; }
/* Bus stop letters keep their round sign shape, as on the street. */
.stop-letter {
  flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--route); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.small-letter { width: 30px; height: 30px; font-size: .8125rem; }
.fav-btn { color: var(--brand); font-size: 1.4rem; }
.fav-btn.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.share-stop svg { width: 20px; height: 20px; }
.stop-close { font-size: 1.5rem; color: var(--muted); }
.arrivals { list-style: none; margin: 0; padding: 0; }
.arrival {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; width: 100%;
  padding: 11px 0; border: 0; border-top: 1px solid var(--rule); background: none; text-align: left;
}
.arrival:hover .bus-dest { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.bus-num {
  min-width: 48px; text-align: center; background: var(--route); color: #fff; font-weight: 800; padding: 3px 6px;
}
.bus-num.big { font-size: 1.5rem; min-width: 72px; padding: 6px 10px; }
.bus-num.mini { min-width: 34px; font-size: .8125rem; padding: 1px 5px; }
.bus-num.dim { opacity: .4; }
.bus-dest { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bus-time { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bus-time.due, .dep .due { color: var(--go); }
.arrivals-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.dir-badge { display: inline-block; font-size: .8125rem; font-weight: 700; padding: 0 6px; border: 1px solid currentColor; }
.dir-badge.out { color: var(--brand); }
.dir-badge.in { color: var(--go); }
.dir-badge.any { color: var(--muted); }
.leaflet-container { font: inherit; background: var(--tint); }
.leaflet-bar, .leaflet-bar a { border-radius: 0 !important; }
.stops-toggle button {
  display: flex; align-items: center; gap: 5px; height: 34px; padding: 0 9px; border: 0;
  background: #fff; color: #0B0C0C; font: 700 13px/1 "Albert Sans", Arial, sans-serif;
}
.stops-toggle button:hover { background: #f4f4f4; }
.stops-toggle button:focus-visible { outline: 3px solid var(--focus); }
.stops-toggle svg { width: 16px; height: 16px; fill: none; stroke: var(--route); stroke-width: 3; }
.stops-toggle button.off { color: #505a5f; }
.stops-toggle button.off svg { stroke: #505a5f; }
/* A route is open: only its stops (dots far out, lettered pins close up). */
.route-only .stop-pin:not(.route-pin):not(.selected) { display: none; }
.leaflet-container:not(.zoomed-in) .route-pin:not(.selected), .zoomed-in .route-dot { display: none; }
/* Hidden stops: keep route lines, buses, your stop and the selected stop. */
.hide-stops .map-stop, .hide-stops .stop-pin:not(.selected) { display: none; }
.leaflet-control-attribution { font-size: 10px; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.72) saturate(.75); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.72) saturate(.75); }
}

/* Route chips: route-number "blinds" like the front of a bus */
.route-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.route-chips::-webkit-scrollbar { display: none; }
.route-chip {
  flex: none; min-width: 46px; padding: 6px 10px; font-weight: 800; font-size: .9375rem;
  background: var(--card); color: var(--text); border: 1px solid var(--input-border);
}
.route-chip:hover { border-color: var(--route); color: var(--route); }
.route-chip.on, .route-chips .route-chip.on { background: var(--route); border-color: var(--route); color: #fff; }
.stop-routes { margin: 8px 0 0; }

/* Nearby stops list */
.buses-mode { margin: 0 0 16px; }
#view-buses[data-mode="list"] .buses-main { display: none; }
#view-buses[data-mode="map"] #nearby-list { display: none; }
.buses-side { display: contents; }
.nearby { margin-bottom: 16px; }
.nearby-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; }
.nearby-head h3 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.nearby-filter { margin-bottom: 8px; }
.nearby-list { background: var(--card); border: 1px solid var(--border); }
.bus-list-more { display: block; width: 100%; min-height: 44px; border-top: 1px solid var(--rule); }
.nearby-row {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left; background: none;
  border: 0; border-top: 1px solid var(--rule); padding: 12px 14px; position: relative;
}
.nearby-row:first-child { border-top: 0; }
.nearby-row:hover { background: var(--tint); }
.nearby-row:hover .list-title { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.nearby-row.on { background: var(--brand-soft); box-shadow: inset 6px 0 0 var(--brand); }
.nearby-row .stop-letter { margin-top: 2px; }
.nearby-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nearby-name { display: flex; align-items: baseline; gap: 8px; }
.nearby-name .list-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-dist { flex: none; font-variant-numeric: tabular-nums; }
.nearby-towards { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nearby-times { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.dep { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 1023px) {
  .nearby-list { max-height: 62vh; overflow-y: auto; }
}

/* Route view */
.route-card { padding: 14px 14px 6px; }
.route-head { display: flex; align-items: center; gap: 12px; }
.route-dirs { margin: 12px 0 0; }
.route-dirs button { overflow: hidden; text-overflow: ellipsis; }
.route-filter { margin: 12px 0 6px; }
.route-stops { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.route-stop { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 2px; position: relative; }
.route-stop:hover .list-title { color: var(--brand); text-decoration: underline; }
.route-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--route); background: var(--card); margin-left: 3px; position: relative; z-index: 1; }
.route-stops li { position: relative; }
.route-stops li::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 4px; background: var(--route); }
.route-stops li:first-child::before { top: 50%; }
.route-stops li:last-child::before { bottom: 50%; }
.route-stop.on .list-title { color: var(--brand); }
.route-dirs button { display: flex; flex-direction: column; align-items: center; gap: 1px; white-space: normal; line-height: 1.2; }
.route-dirs small { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.route-live { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: .9375rem; min-height: 1.5em; }
.route-bus-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--brand-soft); border: 0; padding: 7px 8px 7px 0; margin: 0; }
/* The gap between bus rows is padding on the row, so the route line runs
   through it unbroken (a margin would leave a white break in the line). */
.route-stops .route-bus { padding: 2px 0; }
.route-bus-btn:hover .chev { text-decoration: underline; }
.route-bus-icon { flex: none; width: 24px; height: 24px; margin-left: 0; color: var(--brand); position: relative; z-index: 1; background: var(--card); border: 2px solid var(--brand); display: grid; place-items: center; }
.route-bus-icon svg { width: 16px; height: 16px; }
.plate.small-plate {
  display: inline-block; width: auto; margin: 0 6px 0 0; padding: 1px 6px; vertical-align: 1px; filter: none;
  background: linear-gradient(#FFDB3D, #F2C200); color: #111; border: 1px solid #8A6D00; border-radius: 3px;
  font: 700 .8125rem/1.3 "Arial Narrow", Arial, "Helvetica Neue", sans-serif; letter-spacing: .04em; white-space: nowrap;
}
.route-stop.on .route-dot { background: var(--route); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border-top: 6px solid var(--brand);
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); animation: sheetIn .18s ease-out;
}
@media (min-width: 600px) { .modal-backdrop { align-items: center; } }
.modal h3 { margin: 0 40px 8px 0; font-size: 1.375rem; line-height: 1.2; }
.modal-close { position: absolute; top: 8px; right: 8px; font-size: 1.8rem; color: var(--text); }
.modal .label { font-size: 1rem; font-weight: 700; margin: 18px 0 8px; }
.modal .primary.big { margin-top: 18px; }
.bus-modal-head { display: flex; align-items: center; gap: 14px; margin: 0 40px 22px 0; }
.bus-modal-dest { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.bus-modal-dest strong { font-size: 1.1875rem; overflow-wrap: anywhere; }
/* UK rear number plate, drawn to scale in plateHtml(). It stays yellow and
   black in every theme, like the real thing. */
.bus-plate { margin: 0; padding: 18px 16px 14px; background: var(--brand-soft); text-align: center; }
.plate { display: block; width: min(100%, 20rem); margin: 0 auto; forced-color-adjust: none; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .25)) drop-shadow(0 4px 8px rgba(0, 0, 0, .18)); }
.plate svg { display: block; width: 100%; height: auto; }
.plate text { font: 700 110px "Charles Wright", "Arial Narrow", Arial, "Helvetica Neue", Helvetica, sans-serif; }
.bus-plate figcaption { margin-top: 10px; }
.bus-eta { text-align: center; margin: 16px 0 0; font-size: 1.0625rem; }
.track-btn { text-wrap: balance; }
.track-btn svg { display: inline-block; vertical-align: -4px; margin-right: 8px; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linejoin: round; }
.modal .bus-next-title { margin: 30px 0 10px; padding-top: 20px; border-top: 1px solid var(--rule); }
/* A bus's stops ahead, drawn like the route view: a line with a circle for
   each stop (centred 12px in), the bus at the top and your stop marked. */
.vstops-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin: 0 0 8px; }
.vstops-sum, .vstops-live { margin: 0; }
.vstops-live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.bus-eta.gone-eta { color: var(--muted); }
/* A stop the bus has just passed: struck through, then folds away above it. */
.vstops .vstop.gone { overflow: hidden; color: var(--muted); animation: vstop-gone 1.8s ease-in forwards; }
.vstops .vstop.gone .vstop-name { text-decoration: line-through; }
.vstops .vstop.gone .vstop-name small { color: var(--muted); display: inline-block; margin-left: 8px; }
.vstops .vstop.gone::after { background: var(--line); }
@keyframes vstop-gone {
  0%, 45% { opacity: 1; max-height: 60px; min-height: 44px; }
  100% { opacity: 0; max-height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .vstops .vstop.gone { animation: none; display: none; }
}
.vstops { --line: #DC241F; list-style: none; margin: 0; padding: 0; }
.vstops li { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 0 8px 34px; }
.vstops li::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 4px; background: var(--line); }
.vstops li:first-child::before { top: 50%; }
.vstops li:last-child::before { bottom: 50%; }
.vstops .vstop::after {
  content: ""; position: absolute; box-sizing: border-box; left: 5px; top: 50%; width: 14px; height: 14px; margin-top: -7px; z-index: 1;
  border-radius: 50%; border: 3px solid var(--line); background: var(--card);
}
.vstop-name { min-width: 0; }
.vstop-name small { display: block; font-size: .8125rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.vstop-time { flex: none; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.vstop-time small { display: block; font-size: .8125rem; }
.vstops .vstop.here { font-weight: 800; }
.vstops .vstop.here .vstop-time { color: var(--text); }
.vstops .vstop.here::after { left: 2px; width: 20px; height: 20px; margin-top: -10px; background: var(--line); box-shadow: 0 0 0 3px var(--card); }
.vstops .vstop.after { opacity: .55; }
.vstops .vbus .route-bus-icon { position: absolute; left: 0; top: 50%; margin-top: -12px; }
.vstops .vbus .vstop-name { font-weight: 700; color: var(--brand); }
.vstops .vmore::after { display: none; }
.vstops .vmore::before { background: repeating-linear-gradient(var(--line) 0 4px, transparent 4px 8px); }
/* Timetable buses aren't live: a dashed grey line. */
.vstops.sched { --line: var(--muted); }
.vstops.sched li::before { background: repeating-linear-gradient(var(--line) 0 6px, transparent 6px 10px); }
.vstops.sched .vstop::after { border-style: dashed; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip { border: 1px solid var(--input-border); background: var(--card); padding: 8px 14px; font-weight: 600; }
.cat-chip:hover { border-color: var(--brand); color: var(--brand); }
.cat-chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.new-cat { display: flex; gap: 8px; margin-top: 10px; }
.share-text { min-height: 160px; font-size: .875rem; margin-top: 8px; }
.share-list .list-row { cursor: default; }
.share-list .chips { margin-top: 4px; }

/* Settings */
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
#style-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.theme-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 12px;
  border: 2px solid var(--rule); background: var(--card); font-weight: 700;
}
.theme-opt small { font-weight: 500; font-size: .75rem; text-align: center; }
.theme-opt.on { border-color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.swatch { width: 100%; max-width: 92px; height: 44px; padding: 8px; display: flex; align-items: flex-end; border: 1px solid rgba(127, 127, 127, .4); }
.swatch span { display: block; width: 70%; height: 12px; }
.swatch-light { background: #F3F2F1; } .swatch-light span { background: #08675F; }
.swatch-dark, .swatch-navy { background: #102725; } .swatch-dark span, .swatch-navy span { background: #79D7C7; }
.swatch-charcoal { background: #121212; } .swatch-charcoal span { background: #79D7C7; }
.swatch-auto { background: linear-gradient(90deg, #F3F2F1 50%, #102725 50%); } .swatch-auto span { background: #08675F; }
:root[data-dark="charcoal"] .swatch-dark { background: #121212; }
:root[data-dark="charcoal"] .swatch-auto { background: linear-gradient(90deg, #F3F2F1 50%, #121212 50%); }
.size-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.size-opt { height: 52px; border: 2px solid var(--rule); background: var(--card); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.size-opt.on { border-color: var(--brand); color: var(--brand); box-shadow: inset 0 0 0 2px var(--brand); }
.size-preview { margin: 10px 0 0; padding: 10px 12px; background: var(--tint); font-size: 1rem; border-left: 6px solid var(--brand); }
.install-card { display: flex; gap: 14px; align-items: flex-start; margin: 16px 0 0; padding: 14px; background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--brand); }
.install-card img { flex: none; }
.install-actions { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.install-steps { margin: 0 0 12px; padding-left: 1.4em; line-height: 1.55; }
.install-steps li { margin: 6px 0; }
.share-glyph { width: 1.1em; height: 1.1em; vertical-align: -3px; color: var(--brand); }
.backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.backup-actions > * { padding: 11px; font-weight: 700; text-align: center; border: 2px solid var(--brand); cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--focus); }
.import-actions { display: grid; gap: 10px; margin: 16px 0 8px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; }
.legal-links a { color: inherit; text-underline-offset: 3px; }
.legal-links a:hover { color: var(--brand); text-decoration-thickness: 2px; }
.back-link { display: inline-block; margin: 0 0 14px; }
.legal-list .list-row, .settings-legal .list-row { color: var(--text); text-decoration: none; }
.legal-list .list-row .muted { display: block; margin-top: 2px; }
.legal-list .list-row:hover .list-title, .settings-legal .list-row:hover .list-title { color: var(--brand); text-decoration: underline; }
.settings-legal .list-row { padding: 12px 14px; }
.legal-doc { padding: 4px 20px 16px; max-width: 46rem; line-height: 1.6; }
.legal-doc h3 { font-size: 1.125rem; margin: 22px 0 6px; }
.legal-doc p, .legal-doc li { margin: 8px 0; }
.legal-doc ul { padding-left: 1.3em; margin: 8px 0; }
.legal-doc code { font-size: .875em; background: var(--tint); padding: 0 4px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9375rem; margin: 10px 0; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-top: 1px solid var(--rule); }
.legal-table th { font-weight: 700; border-top: 0; }
@media (max-width: 560px) {
  .legal-table thead { display: none; }
  .legal-table tr { display: block; border-top: 1px solid var(--rule); padding: 8px 0; }
  .legal-table td { display: block; border: 0; padding: 2px 0; }
  .legal-table td:first-child { font-weight: 700; }
}
.legal-updated { margin-top: 20px; }
.legal-more { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 0; font-size: .9375rem; }
.settings-note { color: var(--muted); font-size: .8125rem; margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--rule); }

/* ---------- more below ---------- */
.scroll-cue {
  position: fixed; z-index: 30; width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); color: var(--brand); border: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18); opacity: .92; animation: cueIn .2s ease-out;
}
.scroll-cue:hover { opacity: 1; background: var(--brand-soft); }
.scroll-cue svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: square; stroke-linejoin: miter; }
@keyframes cueIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #000; color: #fff; padding: 12px 16px; font-size: .9375rem; font-weight: 600;
  border-left: 6px solid var(--focus); z-index: 80; width: max-content; max-width: calc(100% - 32px);
}

/* ---------- categories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 8px; }
.cat-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-top: 6px solid var(--brand); padding: 14px; min-height: 104px;
}
.cat-card:hover { background: var(--tint); }
.cat-card:hover .cat-name { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.cat-card.add { border: 2px dashed var(--border); justify-content: center; align-items: center; text-align: center; color: var(--brand); }
.cat-initial { display: none; }
.cat-card.add .cat-initial { display: block; font-size: 1.6rem; font-weight: 400; line-height: 1; }
.cat-name { font-weight: 800; font-size: 1.125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cat-page-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; margin: -8px 0 0; }
.cat-page-head > div { display: flex; gap: 14px; }
.cat-title { font-size: 1.5rem; font-weight: 800; margin: 6px 0 12px; }
.cat-section { margin-top: 18px; }
.cat-section-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; }
.cat-section-head h3 { margin: 0; font-size: 1.125rem; }
.cat-stop { padding: 0; overflow: hidden; margin-bottom: 12px; }
.cat-stop-head { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none; border: 0; padding: 14px 16px 10px; }
.cat-stop-head:hover .list-title { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.cat-arrivals { padding: 0 16px 6px; }
.cat-arrivals .arrival { padding: 10px 0; }
.pad { padding: 10px 0; }
.cat-trip { margin-bottom: 12px; }
.cat-trip-head { display: flex; align-items: center; gap: 6px; font-weight: 700; margin: 0 0 6px; flex-wrap: wrap; }
.cat-add { display: flex; gap: 8px; }
.cat-add > * { flex: 1; }
.section-link { display: flex; justify-content: space-between; align-items: baseline; width: 100%; background: none; border: 0; padding: 0; text-align: left; }
.section-link span { color: var(--brand); font-size: .9375rem; text-decoration: underline; }
.cat-tabs { margin: 0 0 16px; position: sticky; top: calc(70px + env(safe-area-inset-top)); z-index: 4; background: var(--bg); }
.tab-count { display: inline-block; min-width: 22px; padding: 0 5px; margin-left: 4px; background: var(--tint); color: var(--text); font-size: .8125rem; line-height: 20px; }
.cat-tabs button.on .tab-count { background: var(--brand); color: var(--brand-ink); }
#cat-panel { margin-top: 0; min-height: 40vh; }
.hint-row { display: flex; align-items: flex-start; gap: 12px; }
.hint-row .hint { flex: 1; }
.saved-search { margin: 0 0 16px; }

/* Reordering */
.reorder-row { cursor: default; }
.move-btn { flex: none; width: 42px; height: 42px; border: 1px solid var(--input-border); background: var(--card); color: var(--brand); font-size: 1.15rem; font-weight: 800; }
.move-btn:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.move-btn:disabled { color: var(--rule); border-color: var(--rule); background: var(--card); }
.reorder-row .chips { margin-top: 4px; }

/* ---------- tracking ---------- */
.track-card { padding: 12px 14px 8px; margin-bottom: 12px; border-top: 6px solid var(--route); }
.track-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.track-top .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.0625rem; }
.track-row { display: flex; align-items: center; gap: 4px; border-top: 1px solid var(--rule); }
.track-focus { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 0; background: none; border: 0; text-align: left; }
.track-focus:hover .track-line1 { color: var(--brand); }
.track-focus .list-main { display: flex; flex-direction: column; min-width: 0; }
.track-line1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-line2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-remove { width: 38px; height: 38px; font-size: 1.5rem; color: var(--muted); border: 0; }
.track-note { padding-top: 6px; border-top: 1px solid var(--rule); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--route); flex: none; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(220, 36, 31, .6); } 100% { box-shadow: 0 0 0 9px rgba(220, 36, 31, 0); } }
.bus-marker-wrap { background: none; border: 0; }
.bus-marker-wrap.mini .bus-marker { transform: scale(.7); transition: transform .15s; }
.bus-marker-wrap.hl .bus-marker { transform: scale(1.15); }
.bus-marker-wrap.hl .bus-label { background: #000; outline: 4px solid var(--focus); animation: bus-hl 1s ease-in-out infinite alternate; }
@keyframes bus-hl { to { outline-color: #000; } }
.route-bus.hl .route-bus-btn { background: #FFF3B0; box-shadow: inset 4px 0 0 #0B0C0C; }
:root[data-theme="dark"] .route-bus.hl .route-bus-btn { background: #3A3300; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .route-bus.hl .route-bus-btn { background: #3A3300; } }
/* With a route open, the nearby stops list just gets in the way. */
#view-buses.has-route #nearby, #view-buses.has-route[data-mode] #nearby { display: none; }
.bus-marker { position: relative; width: 44px; height: 44px; }
.bus-label {
  position: absolute; inset: 8px; background: var(--bus, #DC241F); color: #fff; border: 3px solid #fff;
  display: flex; align-items: center; justify-content: center; font: 800 12px/1 "Albert Sans", Arial, sans-serif;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 3px 8px rgba(0, 0, 0, .35);
}
.bus-arrow { position: absolute; inset: 0; transition: transform .4s; }
.bus-arrow::before {
  content: ""; position: absolute; left: 50%; top: -4px; transform: translateX(-50%);
  border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 11px solid var(--bus, #DC241F);
}
.track-map-wrap { position: relative; margin-bottom: 12px; }
.track-map { height: min(52vh, 460px); overflow: hidden; background: var(--tint); border: 1px solid var(--border); z-index: 0; }
.map-fs-btn {
  position: absolute; top: 10px; right: 10px; z-index: 500; display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px; border: 2px solid #000; background: #fff; color: #000; font-weight: 700; font-size: .875rem;
}
.map-fs-btn:hover { background: var(--focus); }
.map-fs-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: square; }
.track-mini { display: none; }
.track-map-wrap.fullscreen { position: fixed; inset: 0; z-index: 70; margin: 0; background: var(--bg); }
.track-map-wrap.fullscreen .track-map { height: 100%; height: 100dvh; border: 0; }
.track-map-wrap.fullscreen .map-fs-btn { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
.track-map-wrap.fullscreen .leaflet-top { top: env(safe-area-inset-top); }
.track-map-wrap.fullscreen .track-mini { display: block; position: absolute; left: 12px; right: 12px; z-index: 500; bottom: calc(12px + env(safe-area-inset-bottom)); }
.track-map-wrap.fullscreen .leaflet-bottom.leaflet-right { bottom: auto; top: calc(58px + env(safe-area-inset-top)); }
.track-map-wrap.fullscreen .leaflet-bottom.leaflet-left { bottom: auto; top: calc(96px + env(safe-area-inset-top)); }
.track-mini-card { max-width: 520px; margin: 0 auto; background: var(--card); border: 1px solid var(--border); border-top: 6px solid var(--route); padding: 6px 12px 4px; }
.mini-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 0; background: none; border: 0; text-align: left; }
.mini-row + .mini-row { border-top: 1px solid var(--rule); }
.mini-text { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--rule); }
.track-empty { line-height: 1.55; background: var(--card); border: 1px solid var(--border); padding: 28px 20px; }
.track-empty .primary { margin-top: 16px; }
.track-banner {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-bottom: 12px;
  background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--route); padding: 10px 12px; font-weight: 700;
}
.track-banner:hover { background: var(--tint); }
.track-banner .grow { flex: 1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- desktop placeholders ---------- */
.desk-placeholder { display: none; }

/* Phones: keep the map right under the filter, with the stop's times below it. */
@media (max-width: 1023px) {
  #view-buses:not([hidden]) { display: flex; flex-direction: column; }
  #view-buses .bus-search { order: 1; }
  #view-buses #track-banner { order: 2; }
  #view-buses .buses-mode { order: 3; }
  #view-buses #nearby { order: 4; }
  #view-buses .buses-main { order: 5; margin-bottom: 16px; }
  #view-buses #route-panel { order: 6; }
  #view-buses #stop-panel { order: 7; }
  #view-buses #fav-stops { order: 8; }
}

/* iOS zooms into text fields under 16px on touch devices. */
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: max(16px, 1rem); }
}

/* =====================================================================
   Desktop
   ===================================================================== */
@media (min-width: 1024px) {
  body {
    display: grid; grid-template-columns: 248px minmax(0, 1fr); grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  .masthead { grid-column: 1 / -1; grid-row: 1; position: sticky; top: 0; }
  .cat-tabs { top: 78px; }
  .masthead-inner { min-height: 68px; padding: 10px 32px; gap: 24px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 1.375rem; }
  .brand-note { display: block; padding-left: 24px; border-left: 1px solid rgba(255, 255, 255, .35); }

  /* Sidebar */
  .bottom-nav {
    grid-column: 1; grid-row: 2; position: sticky; top: 74px; height: calc(100vh - 74px); align-self: start;
    flex-direction: column; justify-content: flex-start; gap: 0; padding: 16px 0;
    border-top: 0; border-right: 1px solid var(--border);
  }
  .tab {
    flex: none; max-width: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px 20px; font-size: 1rem; font-weight: 600; color: var(--text);
    border-top: 0; border-left: 6px solid transparent;
  }
  .tab:hover { background: var(--tint); color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
  .tab svg { width: 22px; height: 22px; color: var(--brand); }
  .tab.active { border-left-color: var(--brand); background: var(--brand-soft); color: var(--text); font-weight: 800; }
  .badge { position: static; margin-left: auto; }
  .tab.desk-tab { display: flex; }
  .nav-tools { display: block; height: 1px; background: var(--rule); margin: 10px 20px; }
  .status-link .status-long { display: inline; }
  .status-link .status-short { display: none; }
  .status-link:not(.has-issues) { display: inline-flex; font-weight: 600; }
  .line-strip { height: 10px; }
  #view-status:not([hidden]) { max-width: 820px; }
  .nav-foot { display: block; margin: auto 20px 0; padding-top: 14px; border-top: 1px solid var(--rule); color: var(--muted); font-size: .8125rem; line-height: 1.5; }

  main { grid-column: 2; grid-row: 2; max-width: none; width: 100%; margin: 0; padding: 0 32px 40px; }
  .page-title { margin: 24px 0 20px; font-size: 2.25rem; }
  .toast { left: calc(50% + 124px); bottom: 28px; }
  .site-note { display: none; }

  /* Plan: search on the left, results on the right */
  #view-plan:not([hidden]) { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .plan-side { position: sticky; top: 92px; }
  .plan-main { min-width: 0; max-width: 780px; }
  #results:empty + .desk-placeholder {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px;
    min-height: 420px; border: 1px solid var(--border); background: var(--card); color: var(--muted); padding: 40px;
    border-left: 6px solid var(--brand);
  }
  .desk-placeholder strong { color: var(--text); font-size: 1.5rem; font-weight: 800; }
  .desk-placeholder span { max-width: 420px; font-size: 1.0625rem; }
  .desk-placeholder-art { width: 220px; color: var(--brand); margin-bottom: 16px; }

  /* Journey details: a side panel */
  .sheet {
    top: 74px; left: auto; width: min(560px, 100vw - 248px); border-left: 1px solid var(--border);
    box-shadow: -8px 0 0 rgba(0, 0, 0, .06); animation: sheetSide .18s ease-out;
  }
  @keyframes sheetSide { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
  .sheet-bar { padding: 6px; }
  body.no-scroll { overflow: auto; }
  .sheet-body { max-width: none; }

  /* Buses: list beside a big map; the selected stop floats over the map */
  #view-buses:not([hidden]) { display: grid; grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .buses-side { display: block; position: sticky; top: 92px; max-height: calc(100vh - 196px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
  .buses-mode { display: none; }
  #view-buses[data-mode] .buses-main, #view-buses[data-mode] #nearby, #view-buses[data-mode] #nearby-list { display: block; }
  .buses-main { position: sticky; top: 92px; }
  #view-connect:not([hidden]) { display: grid; grid-template-columns: minmax(360px, 420px) minmax(0, 1fr); gap: 24px; align-items: start; }
  .connect-side { position: sticky; top: 92px; max-height: calc(100vh - 196px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
  .connect-main { position: sticky; top: 92px; }
  .connect-map { height: calc(100vh - 196px); min-height: 460px; }
  .bus-map { height: calc(100vh - 196px); min-height: 460px; }
  .buses-main #stop-panel { position: absolute; top: 12px; left: 56px; z-index: 600; width: min(400px, calc(100% - 80px)); max-height: calc(100% - 64px); overflow-y: auto; }
  .buses-main #stop-panel:empty { display: none; }
  .buses-main #stop-panel .stop-card { margin: 0; border-top: 6px solid var(--route); box-shadow: 0 8px 0 rgba(0, 0, 0, .12); }

  /* Tracking: the bus list sits on top of a full-height map */
  #view-track:not([hidden]) { position: relative; }
  .track-map-wrap { margin: 0; }
  .track-map { height: calc(100vh - 196px); min-height: 460px; }
  #track-panel { position: absolute; top: 12px; left: 56px; z-index: 600; width: min(400px, calc(100% - 200px)); }
  #track-panel .track-card { margin: 0; box-shadow: 0 8px 0 rgba(0, 0, 0, .12); }
  #track-empty { max-width: 640px; text-align: left; }

  /* Saved and Recent */
  #saved-list, #recent-list { max-width: 1120px; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .cat-card { min-height: 120px; }
  .cat-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
  .cat-col-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; padding-bottom: 8px; border-bottom: 4px solid var(--brand); }
  .cat-col-head h3 { margin: 0; font-size: 1.25rem; }
  .cat-columns .cat-section { margin-top: 0; }
  #recent-list .list-card { max-width: 780px; }
  .modal { max-width: 580px; }
}

@media (min-width: 1440px) {
  body { grid-template-columns: 272px minmax(0, 1fr); }
  #view-plan:not([hidden]) { grid-template-columns: 420px minmax(0, 1fr); }
}
.empty-panel { background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--brand); padding: 20px; }
.empty-panel strong { font-size: 1.25rem; }
.empty-panel p { margin: 6px 0 16px; color: var(--muted); max-width: 60ch; }
.track-empty-title { font-size: 1.25rem; color: var(--text); }

/* Touch screens: no hover styling, so a tapped row doesn't stay highlighted. */
@media (hover: none) {
  .jrow:hover, button.list-row:hover, .nearby-row:hover, .cat-card:hover, .act:hover,
  .more-btn:hover, .track-banner:hover, .secondary:hover { background: var(--card); }
  .jrow.past:hover { background: var(--tint); }
  .nearby-row.on:hover { background: var(--brand-soft); }
  .act-main:hover { background: var(--brand); }
  .primary:hover { background: var(--brand); border-color: var(--brand); }
  .jrow:hover .jrow-times, button.list-row:hover .list-title, .nearby-row:hover .list-title,
  .cat-card:hover .cat-name, .arrival:hover .bus-dest, .route-stop:hover .list-title,
  .cat-stop-head:hover .list-title, .track-focus:hover .track-line1 { color: inherit; text-decoration: none; }
  .suggestions li:hover { background: var(--card); color: inherit; }
  .suggestions li:hover small { color: var(--muted); }
  .suggestions li.here:hover span { color: var(--brand); }
  .route-chip:hover { border-color: var(--input-border); color: var(--text); }
  .route-chip.on:hover { border-color: var(--route); color: #fff; }
  .cat-chip:hover { border-color: var(--input-border); color: inherit; }
  .cat-chip.on:hover { color: var(--brand-ink); }
  .move-btn:hover { background: var(--card); color: var(--brand); border-color: var(--input-border); }
  .map-fs-btn:hover { background: #fff; }
}

/* Next departures for each step of a journey */
.next-deps:empty { display: none; }
.next-deps { margin-top: 10px; }
.deps-head { font-size: .875rem; font-weight: 700; margin-bottom: 4px; }
.deps-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); background: var(--card); }
.deps-list li {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 6px 10px; border-top: 1px solid var(--rule); font-size: .9375rem;
}
.deps-list li:first-child { border-top: 0; }
.deps-list li.mine { background: var(--brand-soft); box-shadow: inset 4px 0 0 var(--brand); }
.deps-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.deps-dest { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deps-mins { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deps-mins.due { color: var(--go); }
.mine-tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 0 5px; background: var(--brand); color: var(--brand-ink); vertical-align: 1px; }
.deps-note { margin: 8px 0 0; font-size: .875rem; color: var(--muted); }

/* ---------- welcome pop-up ---------- */
.welcome { text-align: center; }
.welcome img { display: block; margin: 4px auto 12px; }
.welcome h3 { font-size: 1.5rem; margin: 0 0 8px; }
.welcome-list { text-align: left; margin: 14px auto 18px; padding-left: 1.3em; max-width: 26rem; line-height: 1.5; }
.welcome-list li { margin: 4px 0; }
.welcome-skip { display: block; margin: 14px auto 6px; }
.guide-cta {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: 4px 0 8px;
  padding: 12px 14px; background: var(--brand-soft); border: 0; border-left: 6px solid var(--brand); color: var(--text);
}
.guide-cta:hover .list-title { color: var(--brand); text-decoration: underline; }
.guide-cta .list-main { display: flex; flex-direction: column; }
.guide-cta-icon {
  flex: none; width: 32px; height: 32px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink);
  font-weight: 800; font-size: 1.1rem;
}

/* ---------- guide page ---------- */
.guide-lead { font-size: 1.0625rem; max-width: 42rem; margin: 0 0 16px; }
.guide-toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; margin: 0 0 28px; }
.guide-toc a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .9375rem;
}
.guide-toc a:hover { color: var(--brand); text-decoration: underline; }
.guide-toc span, .guide-num {
  flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: .875rem;
}
.guide-sec {
  display: grid; grid-template-columns: 1fr; gap: 18px; padding: 24px 0; border-top: 1px solid var(--rule);
  scroll-margin-top: calc(80px + env(safe-area-inset-top));
}
.guide-num { width: 32px; height: 32px; font-size: 1rem; margin-bottom: 8px; }
.guide-sec h2 { margin: 0 0 6px; font-size: 1.375rem; line-height: 1.2; }
.guide-intro { margin: 0 0 10px; color: var(--muted); }
.guide-steps { margin: 0 0 14px; padding-left: 1.3em; line-height: 1.55; }
.guide-steps li { margin: 6px 0; }
.guide-demo { margin: 0; display: flex; flex-direction: column; align-items: center; }
.g-caption { min-height: 3.2em; max-width: 300px; width: 100%; margin: 10px 0 6px; font-size: .9375rem; line-height: 1.4; }
.g-step { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.g-dots { display: flex; gap: 6px; }
.g-dots i { width: 22px; height: 4px; background: var(--rule); }
.g-dots i.on { background: var(--brand); }
.g-play { margin-top: 6px; font-size: .875rem; }
.guide-end { padding: 20px; margin: 8px 0 0; }
.guide-end h2 { margin: 0 0 6px; }
@media (min-width: 760px) {
  .guide-sec { grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; align-items: start; }
  .guide-sec:nth-of-type(even) .guide-demo { order: -1; }
  .guide-sec:nth-of-type(even) { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (min-width: 1024px) {
  #view-guide { max-width: 980px; }
}

/* ---------- the mock screen in each demo ---------- */
.g-screen {
  --g-bg: var(--bg); --g-card: var(--card); --g-text: var(--text); --g-muted: var(--muted); --g-rule: var(--rule);
  position: relative; width: 100%; max-width: 300px; height: 540px; overflow: hidden; display: flex; flex-direction: column;
  border: 6px solid #0B0C0C; background: var(--g-bg); color: var(--g-text); font-size: 12px; line-height: 1.35;
  user-select: none; -webkit-user-select: none; pointer-events: none;
}
.g-screen.dark { --g-bg: #0B201E; --g-card: #16322F; --g-text: #fff; --g-muted: #ADC5C1; --g-rule: #2F4F49; }
.g-screen.big { font-size: 14px; }
.g-screen * { transition: background-color .3s, color .3s; }
.g-screen [hidden] { display: none !important; }
.g-mast { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 8px; background: #123D3A; color: #fff; font-weight: 800; flex: none; }
.g-logo { width: 16px; height: 16px; background: #fff; position: relative; flex: none; }
.g-logo::after { content: ""; position: absolute; left: 2px; right: 2px; top: 7px; height: 3px; background: #08675F; transform: skewY(-35deg); }
.g-brand { flex: 1; }
.g-menu { font-size: 15px; padding: 2px 4px; }
.g-dis { font-size: 10px; font-weight: 700; text-decoration: underline; padding: 2px 4px; }
.g-strip { display: flex; height: 5px; flex: none; }
.g-strip span { flex: 1; }
.g-strip span.issue { background-image: repeating-linear-gradient(-45deg, #FFDD00 0 3px, #000 3px 6px) !important; }
.g-strip.flash { animation: g-flash 1.2s ease-in-out 2; }
.g-body { flex: 1; overflow: hidden; padding: 10px; position: relative; }
.g-nav { display: flex; flex: none; height: 42px; background: var(--g-card); border-top: 1px solid var(--g-rule); }
.g-nav span { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 9px; color: var(--g-muted); border-top: 3px solid transparent; }
.g-nav span.on { color: #08675F; border-top-color: #08675F; font-weight: 700; }
.g-screen.dark .g-nav span.on { color: #79D7C7; border-top-color: #79D7C7; }
.g-ico { width: 12px; height: 12px; border: 2px solid currentColor; display: block; }
.g-ico-buses { border-radius: 2px; } .g-ico-track { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.g-ico-saved { clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 38% 35%); background: currentColor; border: 0; }
.g-ico-recent { border-radius: 50%; }
.g-h1 { font-size: 1.5em; font-weight: 800; margin: 2px 0 8px; }
.g-card { background: var(--g-card); border: 1px solid var(--g-rule); padding: 10px; }
.g-ghost { height: 220px; background: repeating-linear-gradient(var(--g-card) 0 34px, var(--g-rule) 34px 35px); }
.g-label { font-weight: 700; margin: 4px 0 3px; }
.g-input {
  display: flex; align-items: center; min-height: 30px; padding: 0 8px; border: 1px solid #505a5f; background: var(--g-card);
  margin-bottom: 6px; position: relative; white-space: nowrap; overflow: hidden;
}
.g-input.focus { outline: 2px solid #FFDD00; box-shadow: inset 0 0 0 1px #0B0C0C; }
.g-ph { color: var(--g-muted); }
.g-val:not(:empty) + .g-caret, .g-input.focus .g-caret { display: inline-block; }
.g-val:not(:empty) ~ .g-ph, .g-input:has(.g-val:not(:empty)) .g-ph { display: none; }
.g-caret { display: none; width: 1px; height: 14px; background: var(--g-text); margin-left: 1px; animation: g-blink 1s steps(1) infinite; }
.g-input:not(.focus) .g-caret { display: none; }
/* The demo's From / To box, matching the real one. */
.g-places { position: relative; border: 1px solid #505a5f; background: var(--g-card); margin-bottom: 8px; }
.g-prow { position: relative; }
.g-prow + .g-prow { border-top: 1px solid var(--g-rule); }
.g-places .g-input { border: 0; margin: 0; min-height: 34px; padding-left: 28px; margin-right: 34px; overflow: hidden; }
.g-places .g-input.focus { outline: 2px solid #FFDD00; outline-offset: -2px; box-shadow: none; }
.g-icon { position: absolute; left: 9px; top: 50%; }
.g-icon-from { width: 9px; height: 9px; margin-top: -4.5px; border: 2px solid var(--brand); border-radius: 50%; box-sizing: border-box; }
.g-icon-to { width: 8px; height: 8px; margin-top: -6px; left: 9.5px; background: var(--text); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.g-swap { position: absolute; right: 7px; top: 50%; width: 26px; height: 26px; margin-top: -13px; z-index: 2; display: grid; place-items: center; border: 1.5px solid var(--text); background: var(--g-card); color: var(--brand); font-weight: 700; font-size: .8rem; }
.g-places .g-sugg { position: absolute; left: -1px; right: -1px; top: 100%; z-index: 5; margin: 0; }
.g-sugg { border: 1px solid var(--g-rule); background: var(--g-card); margin: -4px 0 6px; box-shadow: 0 4px 10px rgba(0, 0, 0, .15); }
.g-sugg div { padding: 7px 8px; border-top: 1px solid var(--g-rule); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.g-sugg div:first-child { border-top: 0; }
.g-tabs { display: flex; margin: 8px 0; border-bottom: 1px solid var(--g-rule); }
.g-tabs span { flex: 1; text-align: center; padding: 5px 0; color: var(--g-muted); border-bottom: 3px solid transparent; }
.g-tabs span.on { color: var(--g-text); font-weight: 700; border-bottom-color: #08675F; }
.g-btn { background: #08675F; color: #fff; font-weight: 700; text-align: center; padding: 9px; margin-top: 6px; }
.g-res-head b { display: block; font-size: 1.2em; }
.g-res-head small, .g-row small, .g-stop small, .g-tile small, .g-trackcard small, .g-rbus small { display: block; color: var(--g-muted); }
.g-sort { margin: 6px 0; font-weight: 700; }
.g-sort span { font-weight: 600; border: 1px solid var(--g-rule); background: var(--g-card); padding: 2px 6px; margin-left: 4px; }
.g-list { border: 1px solid var(--g-rule); background: var(--g-card); }
.g-row { display: flex; justify-content: space-between; gap: 6px; padding: 8px; border-top: 1px solid var(--g-rule); background: var(--g-card); }
.g-row:first-child { border-top: 0; }
.g-row b { font-size: 1.15em; }
.g-price { font-weight: 800; }
.g-chip { display: inline-block; font-size: .85em; font-weight: 700; padding: 1px 5px; margin: 3px 3px 0 0; }
.g-sheet {
  position: absolute; inset: 0; background: var(--g-bg); transform: translateY(102%); transition: transform .45s ease; overflow: hidden;
}
.g-sheet.on { transform: none; }
.g-sheet-bar { background: #08675F; color: #fff; padding: 7px 10px; }
.g-sum { margin: 8px 10px; padding: 8px; background: var(--g-card); border-left: 4px solid #08675F; }
.g-sum b { display: block; font-size: 1.4em; }
.g-leg { display: grid; grid-template-columns: 36px 1fr; gap: 6px; margin: 0 10px; padding: 6px 0; border-left: 0; }
.g-leg-time { font-weight: 700; }
.g-plat { display: inline-block; background: #00782A; color: #fff; font-weight: 700; padding: 1px 5px; margin: 3px 0; font-size: .9em; }
.g-deps { margin-top: 6px; border: 1px solid var(--g-rule); background: var(--g-card); }
.g-deps small { display: block; font-weight: 700; padding: 4px 6px; }
.g-deps div { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px; padding: 3px 6px; border-top: 1px solid var(--g-rule); }
.g-deps div.mine { background: #E5F2EF; box-shadow: inset 3px 0 0 #08675F; }
.g-screen.dark .g-deps div.mine { background: #233C38; }
.g-deps i { font-style: normal; font-size: .8em; background: #08675F; color: #fff; padding: 0 3px; margin-left: 3px; }
.g-actions { position: absolute; left: 0; right: 0; bottom: 0; display: flex; border-top: 1px solid var(--g-rule); background: var(--g-card); }
.g-actions span { flex: 1; text-align: center; padding: 10px 0; font-weight: 700; color: #08675F; }
.g-actions span:first-child { background: #08675F; color: #fff; }
.g-modal {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; background: var(--g-card); border-top: 4px solid #08675F;
  padding: 10px; box-shadow: 0 -6px 20px rgba(0, 0, 0, .25); animation: g-up .3s ease-out;
}
.g-modal > b { display: block; font-size: 1.15em; margin-bottom: 6px; }
.g-seg { display: flex; border-bottom: 1px solid var(--g-rule); margin: 6px 0; }
.g-seg span { flex: 1; text-align: center; padding: 5px 2px; color: var(--g-muted); border-bottom: 3px solid transparent; }
.g-seg span.on { color: var(--g-text); border-bottom-color: #08675F; font-weight: 700; }
.g-seg small { display: block; font-size: .75em; font-weight: 700; }
.g-opt { padding: 9px 6px; border-top: 1px solid var(--g-rule); font-weight: 600; }
.g-tile { display: grid; grid-template-columns: 1fr auto; padding: 10px; background: var(--g-card); border: 1px solid var(--g-rule); margin-bottom: 6px; }
.g-tile span { grid-row: 1 / 3; grid-column: 2; align-self: center; color: #08675F; font-size: 1.4em; }
.g-stop { display: flex; gap: 8px; padding: 8px; background: var(--g-card); border: 1px solid var(--g-rule); margin-bottom: 6px; }
.g-pin { flex: none; width: 20px; height: 20px; border-radius: 50%; background: #DC241F; color: #fff; font-weight: 800; font-size: 10px; display: inline-grid; place-items: center; }
.g-time { display: inline-flex; align-items: center; gap: 2px; margin-right: 8px; }
.g-time .g-chip { margin: 3px 2px 0 0; }
.g-subhead { display: flex; align-items: center; gap: 6px; margin: 8px 0 6px; }
.g-subhead b { flex: 1; }
.g-link { color: #08675F; font-weight: 700; text-decoration: underline; }
.g-screen.dark .g-link { color: #79D7C7; }
.g-chips { display: flex; gap: 4px; margin-bottom: 6px; }
.g-chips span { padding: 3px 8px; border: 1px solid var(--g-rule); background: var(--g-card); font-weight: 700; }
.g-chips span.on { background: #DC241F; color: #fff; border-color: #DC241F; }
.g-arr { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px solid var(--g-rule); }
.g-num { background: #DC241F; color: #fff; font-weight: 800; padding: 2px 6px; }
.g-map { position: relative; height: 96px; margin: 6px 0; background: #EFE9E1; border: 1px solid var(--g-rule); overflow: hidden; }
.g-map::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 49%, #fff 49% 51%, transparent 51%) 0 0 / 60px 60px, linear-gradient(transparent 49%, #fff 49% 51%, transparent 51%) 0 0 / 60px 60px; opacity: .8; }
.g-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.g-map-tall { height: 260px; transition: height .4s; }
.g-map-tall.full { height: 360px; }
.g-map svg { overflow: visible; }
.g-map .g-in, .g-map.rev .g-out { display: none; }
.g-map.rev .g-in { display: inline; }
.g-sbus rect { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.g-me { position: absolute; right: 8px; top: 22px; width: 14px; height: 14px; border-radius: 50%; background: #00782A; border: 3px solid #fff; }
.g-fs { position: absolute; right: 6px; bottom: 6px; background: #fff; color: #0B0C0C; border: 2px solid #0B0C0C; padding: 3px 6px; font-weight: 700; }
.g-live { margin: 4px 0; }
.g-live b { color: var(--g-text); }
.g-rstop { display: flex; align-items: center; gap: 8px; padding: 6px 0 6px 4px; font-weight: 700; border-left: 3px solid #DC241F; margin-left: 6px; }
.g-rstop i { width: 9px; height: 9px; border: 2px solid #DC241F; border-radius: 50%; background: var(--g-card); margin-left: -11px; }
.g-rbus { display: flex; align-items: center; gap: 6px; margin-left: 6px; padding: 5px 6px; background: #E5F2EF; border-left: 3px solid #DC241F; }
.g-screen.dark .g-rbus { background: #233C38; }
.g-rbus small { display: inline; }
.g-plate { background: #F7C600; color: #000; border: 2px solid #000; font-weight: 800; padding: 0 4px; }
.g-bigplate { margin: 10px auto 4px; width: fit-content; background: #F7C600; color: #000; border: 3px solid #000; font: 800 22px/1 Arial, sans-serif; padding: 8px 12px; letter-spacing: .05em; }
.g-modal small { display: block; text-align: center; color: var(--g-muted); }
.g-trackcard { background: var(--g-card); border: 1px solid var(--g-rule); border-top: 4px solid #DC241F; padding: 8px; }
.g-status { display: flex; align-items: center; gap: 8px; padding: 9px 8px; background: var(--g-card); border: 1px solid var(--g-rule); margin-bottom: 5px; }
.g-status span { width: 6px; align-self: stretch; }
.g-status b { flex: 1; }
.g-status em { font-style: normal; font-weight: 700; color: #B42318; }
.g-status.ok em { color: #00782A; }
.g-settings small { text-align: left; font-weight: 700; color: var(--g-text); margin: 8px 0 4px; }
.g-sizes { display: flex; gap: 4px; }
.g-sizes span { flex: 1; text-align: center; padding: 7px 0; border: 1px solid var(--g-rule); font-weight: 800; }
.g-sizes span:nth-child(1) { font-size: .8em; } .g-sizes span:nth-child(3) { font-size: 1.25em; } .g-sizes span:nth-child(4) { font-size: 1.5em; }
.g-modes span { font-size: 1em !important; font-weight: 700; }
.g-sizes span.on { outline: 2px solid #08675F; outline-offset: -2px; color: #08675F; }
.g-screen.dark .g-sizes span.on { outline-color: #79D7C7; color: #79D7C7; }
.g-toast { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); z-index: 5; background: #0B0C0C; color: #fff; padding: 7px 10px; font-weight: 700; white-space: nowrap; border-left: 4px solid #FFDD00; }
.g-safari { display: flex; flex-direction: column; height: 100%; position: relative; }
.g-sbar { display: flex; justify-content: space-around; padding: 8px 0 12px; background: #F2F2F7; color: #007AFF; font-size: 18px; border-top: 1px solid #D1D1D6; flex: none; }
.g-sheetlist div { padding: 10px 6px; border-top: 1px solid var(--g-rule); font-weight: 600; }
.g-sheetlist div:first-child { border-top: 0; }
.g-home {
  height: 100%; padding: 30px 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-content: start;
  background: linear-gradient(160deg, #3a6186, #89253e);
}
.g-app { aspect-ratio: 1; border-radius: 14px; }
.g-ours { background: #123D3A; display: grid; place-items: center; }
.g-ours .g-logo { width: 26px; height: 26px; }
.g-ours .g-logo::after { top: 11px; height: 4px; left: 3px; right: 3px; }
.g-home small { grid-column: 4; margin-top: -14px; color: #fff; text-align: center; font-size: 8px; }
.g-pressed { filter: brightness(.88); }
.g-flash { animation: g-flash 1.1s ease-in-out 2; }
.g-finger {
  position: absolute; z-index: 10; left: 50%; top: 110%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: rgba(11, 12, 12, .25); border: 2px solid rgba(255, 255, 255, .95); box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  opacity: 0; transition: left .7s cubic-bezier(.4, 0, .2, 1), top .7s cubic-bezier(.4, 0, .2, 1), opacity .3s;
}
.g-finger.show { opacity: 1; }
.g-finger.tap { animation: g-tap .45s ease-out; }
.g-finger::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 3px solid #FFDD00; opacity: 0; }
.g-finger.tap::after { animation: g-ring .5s ease-out; }
@keyframes g-tap { 40% { transform: scale(.78); } }
@keyframes g-ring { 0% { opacity: 1; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes g-blink { 50% { opacity: 0; } }
@keyframes g-up { from { transform: translateY(100%); } }
@keyframes g-flash { 50% { box-shadow: 0 0 0 4px #FFDD00; background-color: #FFF3B0; } }
@media (prefers-reduced-motion: reduce) {
  .g-finger { transition: opacity .2s; }
  .g-caret, .g-strip.flash, .g-flash { animation: none !important; }
  .g-sheet { transition: none; }
}

/* ---------- routes from here ---------- */
.connect-lead { margin: 0 0 12px; }
.connect-tip { margin: 4px 0 10px; }
.connect-opts { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; }
.connect-walk { margin: 0; flex: 1; min-width: 220px; }
.small-toggle { font-size: .9375rem; }
.small-toggle .toggle-track { width: 24px; height: 24px; }
.small-toggle input:checked + .toggle-track::after { width: 8px; height: 13px; border-width: 0 3px 3px 0; }
.connect-map { margin: 0 0 16px; }
.connect-empty { padding: 16px; }
.connect-empty p { margin: 6px 0 0; }
.connect-sum { padding: 14px 16px; margin: 0 0 14px; }
.connect-sum p { margin: 8px 0 0; }
.connect-rating { font-weight: 700; font-size: 1.0625rem; }
.connect-rating span { display: inline-block; padding: 1px 8px; margin-right: 4px; color: #fff; background: var(--muted); }
.connect-rating.excellent span { background: var(--go); }
.connect-rating.good span { background: #2E7D32; }
.connect-rating.fair span { background: #8A6D00; }
.connect-rating.low span, .connect-rating.none span { background: var(--danger); }
.connect-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.connect-stats div { background: var(--tint); padding: 8px 10px; }
.connect-stats b { display: block; font-size: 1.75rem; line-height: 1; font-variant-numeric: tabular-nums; }
.connect-stats small { color: var(--muted); font-weight: 600; }
.connect-routes { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--border); }
.connect-route { display: flex; align-items: flex-start; gap: 8px; padding: 0 10px 0 0; border-top: 1px solid var(--rule); }
.connect-route:first-child { border-top: 0; }
.connect-route.hl, .connect-route.on { background: var(--brand-soft); }
.connect-route.on { box-shadow: inset 4px 0 0 var(--brand); }
.connect-route-btn { flex: 1; display: flex; align-items: flex-start; gap: 10px; min-width: 0; text-align: left; background: none; border: 0; padding: 10px 0 10px 12px; color: var(--text); }
.connect-route-btn .bus-num { flex: none; min-width: 44px; text-align: center; }
.connect-route-btn .list-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.connect-swatch { flex: none; width: 6px; align-self: stretch; }
.connect-dest { font-weight: 700; }
.connect-dest small { display: block; font-weight: 400; color: var(--muted); font-size: .8125rem; }
.connect-live { flex: none; margin-top: 12px; font-size: .875rem; white-space: nowrap; }
.connect-end { background: none; border: 0; }
.connect-end > span { white-space: nowrap; }
.connect-end-routes { display: inline-flex; gap: 2px; vertical-align: middle; }
.connect-end-routes b { color: #fff; font: 800 11px/1 "Albert Sans", Arial, sans-serif; padding: 3px 4px; border: 1px solid #fff; }
.connect-end-name {
  display: inline-block; vertical-align: middle; margin-left: 3px; padding: 2px 5px; background: #fff; color: #0B0C0C;
  font: 700 11px/1.2 "Albert Sans", Arial, sans-serif; border: 1px solid #0B0C0C; max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
.connect-end { transition: opacity .2s; }
.connect-end.faded { opacity: .15; }
.compact .connect-end:not(.picked) .connect-end-name { display: none; }
.connect-end.picked .connect-end-name { max-width: 220px; }
.connect-line { cursor: pointer; }
@media (max-width: 1023px) {
  #view-connect:not([hidden]) { display: flex; flex-direction: column; }
  .connect-side { display: contents; }
  #connect-summary { order: 3; }
  #connect-list { order: 4; }
  .connect-main { order: 2; }
  .connect-map { height: min(52vh, 420px); }
}
/* guide demo: routes from here */
.g-spider { height: 200px; }
.g-spider svg { overflow: visible; }
.g-spider .sp { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 160; stroke-dashoffset: 160; }
.g-spider.go .sp { animation: g-draw 1.4s ease-out forwards; }
.g-spider.go .sp-1 { animation-delay: .15s; } .g-spider.go .sp-2 { animation-delay: .3s; } .g-spider.go .sp-3 { animation-delay: .45s; } .g-spider.go .sp-4 { animation-delay: .6s; } .g-spider.go .sp-5 { animation-delay: .75s; }
.g-end { position: absolute; display: none; transform: translate(-6px, -9px); white-space: nowrap; font-size: 9px; }
.g-spider.go .g-end { display: block; animation: g-pop .3s 1.2s both; }
.g-end b { color: #fff; padding: 1px 3px; border: 1px solid #fff; }
.g-end i { font-style: normal; font-weight: 700; background: #fff; color: #0B0C0C; border: 1px solid #0B0C0C; padding: 0 3px; margin-left: 2px; }
.g-spider.pick1 .sp:not(.sp-1), .g-spider.pick1 .g-end:not(.g-end-1) { opacity: .12; }
.g-spider.pick1 .sp-1 { stroke-width: 6; }
.g-csum { background: var(--g-card); border: 1px solid var(--g-rule); padding: 7px 8px; margin: 6px 0; font-weight: 700; }
.g-csum > span { background: #00782A; color: #fff; padding: 0 5px; }
.g-csum div { font-weight: 400; margin-top: 3px; } .g-csum div b { font-size: 1.3em; margin-left: 4px; }
.g-crow { display: flex; align-items: center; gap: 6px; padding: 6px; background: var(--g-card); border: 1px solid var(--g-rule); border-top: 0; }
.g-crow.on { background: #E5F2EF; box-shadow: inset 3px 0 0 #08675F; }
.g-screen.dark .g-crow.on { background: #233C38; }
.g-sw { width: 4px; align-self: stretch; }
@keyframes g-draw { to { stroke-dashoffset: 0; } }
@keyframes g-pop { from { opacity: 0; transform: translate(-6px, -9px) scale(.6); } }
@media (prefers-reduced-motion: reduce) { .g-spider .sp { stroke-dashoffset: 0; animation: none !important; } .g-spider.go .g-end { animation: none; } }
/* guide demo: using the maps */
.g-pan { height: 330px; }
.g-maptiles { position: absolute; inset: -40%; transition: transform 1.2s cubic-bezier(.4, 0, .2, 1); transform-origin: 50% 50%;
  background: linear-gradient(90deg, transparent 48%, #fff 48% 52%, transparent 52%) 0 0 / 50px 50px, linear-gradient(transparent 48%, #fff 48% 52%, transparent 52%) 0 0 / 50px 50px, #EFE9E1; }
.g-road { position: absolute; background: #F6CF65; border: 1px solid #E0B44A; }
.g-road.r1 { left: 0; right: 0; top: 46%; height: 9px; transform: rotate(-12deg); }
.g-road.r2 { top: 0; bottom: 0; left: 52%; width: 8px; transform: rotate(18deg); }
.g-road.r3 { left: 10%; right: 30%; top: 30%; height: 6px; transform: rotate(30deg); }
.g-mp { position: absolute; }
.g-mp.p1 { left: 44%; top: 41%; } .g-mp.p2 { left: 57%; top: 53%; } .g-mp.p3 { left: 40%; top: 57%; }
.g-mapname { position: absolute; left: 47%; top: 47%; font-weight: 800; font-size: 13px; color: #333; }
.g-zoom { position: absolute; left: 6px; top: 6px; display: flex; flex-direction: column; background: #fff; border: 2px solid rgba(0, 0, 0, .3); z-index: 2; }
.g-zoom i { font-style: normal; font-weight: 700; width: 22px; height: 22px; display: grid; place-items: center; color: #0B0C0C; }
.g-zoom i + i { border-top: 1px solid #ccc; }
.g-f2 { position: absolute; z-index: 3; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: rgba(11, 12, 12, .28);
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); opacity: 0; transition: left 1.2s cubic-bezier(.4, 0, .2, 1), top 1.2s cubic-bezier(.4, 0, .2, 1), opacity .25s; }
.g-f2.show { opacity: 1; }
.g-gesture { margin-top: 8px; min-height: 1.6em; text-align: center; font-weight: 800; font-size: 1.1em; }
@media (prefers-reduced-motion: reduce) { .g-maptiles, .g-f2 { transition: opacity .2s; } }

/* ---------- share panel with QR code ---------- */
.share-sheet h3 { margin-bottom: 4px; }
.share-what { margin: 0 0 12px; font-weight: 700; }
.qr-box { width: fit-content; max-width: 100%; margin: 8px auto 6px; background: #fff; border: 1px solid var(--border); padding: 6px; }
.qr { display: block; max-width: 100%; height: auto; }
.share-actions { display: grid; gap: 10px; margin: 16px 0 4px; }
.share-actions .text-btn { justify-self: center; margin-top: 2px; }
.share-text { width: 100%; min-height: 90px; margin-top: 10px; font-size: .8125rem; }
.center { text-align: center; }

/* ---------- timetable (scheduled) buses: never mistaken for live ones ---------- */
.arrival.sched { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--tint) 8px 16px); }
.sched-num { background: transparent !important; color: var(--muted) !important; border: 2px dashed var(--muted); }
.sched-tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 1px 6px; border: 1px dashed var(--muted); color: var(--muted); background: var(--card); }
.sched-time { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 700; }
.sched-time svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.sched-head { margin: 12px 0 4px; font-size: .8125rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.route-bus.ghost .route-bus-btn { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--tint) 8px 16px); }
.route-bus.ghost .route-bus-icon { border-style: dashed; border-color: var(--muted); color: var(--muted); }
.route-bus.ghost .route-bus-icon svg { fill: none; stroke: currentColor; stroke-width: 2.4; }
.bus-marker-wrap.ghost .bus-label { background: rgba(255, 255, 255, .85); color: #505a5f; border: 2px dashed #505a5f; box-shadow: none; }
.bus-marker-wrap.ghost .bus-arrow::before { border-bottom-color: #8a9196 !important; opacity: .7; }
.ghost-note { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: .875rem; margin-top: 2px; }
.ghost-key { display: inline-block; width: 14px; height: 12px; border: 2px dashed #505a5f; }

/* ---------- timetable for a stop ---------- */
.timetable-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 11px; font-weight: 700; border: 2px solid var(--brand); }
.timetable-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.timetable-entries-toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.timetable-entries-toggle input { width: 1.125em; height: 1.125em; margin: 0; accent-color: var(--brand); }
.tt h3 { margin: 0 0 4px; }
.tt-stop { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-weight: 700; font-size: 1.0625rem; }
.small-letter { width: 26px; height: 26px; font-size: .75rem; flex: none; }
.tt-routes { margin: 0 0 10px; }
.tt-towards { margin: 0 0 4px; }
.tt-days { margin: 6px 0 12px; }
.tt-days button { display: flex; flex-direction: column; align-items: center; gap: 0; line-height: 1.2; }
.tt-days small { font-size: .6875rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.tt-summary { padding: 10px 12px; background: var(--tint); border-left: 4px solid var(--brand); margin: 0 0 12px; }
.tt-next { font-size: 1.0625rem; }
.tt-next strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.tt-scroll { max-height: min(46vh, 420px); overflow-y: auto; border: 1px solid var(--rule); position: relative; }
.tt-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tt-grid tr:first-child th, .tt-grid tr:first-child td { border-top: 0; }
.tt-grid th { width: 3.2rem; text-align: left; vertical-align: top; padding: 7px 8px; font-weight: 800; background: var(--tint); border-top: 1px solid var(--rule); }
.tt-grid td { padding: 5px 4px; border-top: 1px solid var(--rule); }
.tt-grid td span { display: inline-block; min-width: 2.1em; padding: 2px 4px; margin: 1px 2px; text-align: center; font-weight: 600; }
.tt-grid td span.gone { color: var(--muted); font-weight: 400; }
.tt-grid td span.next { background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.tt-grid tr.now th { background: var(--brand); color: var(--brand-ink); }
.tt-grid tr.now td { background: var(--brand-soft); }
.tt-grid tr.late th::after { content: " +1"; font-size: .6875rem; font-weight: 700; color: var(--muted); }
.tt-grid tr.now.late th::after { color: inherit; }
.tt-foot { margin: 12px 0 0; }
/* guide demo: timetables */
.g-sched { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0, 0, 0, .05) 6px 12px); color: var(--g-muted); }
.g-snum { display: inline-block; border: 2px dashed currentColor; font-weight: 800; padding: 0 4px; margin-right: 4px; }
.g-stag { font-size: .8em; font-weight: 700; border: 1px dashed currentColor; padding: 0 3px; }
.g-btn-out { background: var(--g-card); color: #08675F; border: 2px solid #08675F; margin-top: 10px; }
.g-tt { max-height: 92%; overflow: hidden; }
.g-ttstop { display: flex !important; align-items: center; gap: 4px; text-align: left !important; font-weight: 700; color: var(--g-text) !important; margin: 0 0 6px; }
.g-tt .g-seg small { display: block; font-size: .7em; color: #08675F; }
.g-ttnext { background: rgba(8, 103, 95, .07); border-left: 3px solid #08675F; padding: 5px 7px; margin: 6px 0; }
.g-ttgrid { border: 1px solid var(--g-rule); }
.g-ttrow { display: flex; border-top: 1px solid var(--g-rule); }
.g-ttrow:first-child { border-top: 0; }
.g-ttrow > b { width: 26px; padding: 4px; background: rgba(0, 0, 0, .05); }
.g-ttrow > span { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px 4px; }
.g-ttrow i { font-style: normal; min-width: 18px; text-align: center; font-weight: 600; }
.g-ttrow i.gone { color: var(--g-muted); font-weight: 400; }
.g-ttrow i.nx { background: #08675F; color: #fff; font-weight: 800; }
.g-ttrow.now > b { background: #08675F; color: #fff; }
.g-ttrow.now { background: rgba(8, 103, 95, .07); }

/* ---------- stops on the way, and trips with several legs ---------- */
.via-dot { width: 10px; height: 10px; margin-top: -5px; left: 17px; background: var(--brand); }
.via-del {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 44px; height: 44px; border: 2px solid var(--input-border); background: var(--card);
  font-size: 1.5rem; line-height: 1; color: var(--muted); font-weight: 700;
}
.via-del:hover { color: var(--text); border-color: var(--text); }
/* With stops in the box the swap button sits on the From row, clear of the stops' remove buttons. */
.places.has-vias .swap { top: 27px; }
.add-via { display: block; margin: 8px 0 0; }

.multi-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 16px; }
.mlegs { list-style: none; margin: 0 0 16px; padding: 0; }
.mleg { margin: 0 0 4px; }
.mleg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 10px 0 8px; font-weight: 700; }
.mleg .jlist { margin-top: 0; }
.mleg .jlist.alts { margin-top: 8px; border-style: dashed; }
.alts-btn { margin: 6px 0 0; }
.mleg-wait { margin: 8px 0 12px 12px; padding: 2px 0 2px 14px; border-left: 4px dotted var(--muted); color: var(--muted); font-size: .9375rem; font-weight: 600; list-style: none; }
.wp {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px;
  background: var(--brand); color: var(--brand-ink); font-size: .8125rem; font-weight: 800; border: 2px solid #fff;
  border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.wp-pin { background: none; border: 0; }
.wp-pin .wp { width: 30px; height: 30px; font-size: .9375rem; }

/* The big map: fills the screen, or the window on a computer. */
.map-viewer { position: fixed; inset: 0; z-index: 75; display: flex; flex-direction: column; background: var(--bg); }
.map-viewer[hidden] { display: none; }
.mv-bar {
  display: flex; align-items: center; gap: 4px; flex: none;
  padding: calc(6px + env(safe-area-inset-top)) 6px 6px; background: var(--mast); color: var(--mast-ink);
}
.mv-bar .icon-btn { font-size: 2rem; line-height: 1; color: var(--mast-ink); border: 0; background: transparent; }
.mv-bar .icon-btn:hover { background: rgba(255, 255, 255, .14); }
.mv-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.0625rem; }
.mv-map { flex: 1; min-height: 0; z-index: 0; background: var(--tint); }
.mv-legend {
  flex: none; list-style: none; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap;
  gap: 6px 16px; background: var(--card); border-top: 1px solid var(--border); font-weight: 600; font-size: .9375rem;
}
.mv-legend li { display: flex; align-items: center; gap: 6px; }
.jmap-wrap .map-fs-btn { top: 10px; right: 10px; }

@media (min-width: 1024px) {
  .jmap { height: 340px; }
  .mlegs { max-width: 720px; }
}

/* Drag to reorder the places in the From / stops / To box. */
.drag-handle {
  display: none; position: absolute; left: 2px; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 30px; height: 44px; padding: 0; border: 0; background: none; color: var(--muted);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.drag-handle:hover { color: var(--text); }
.drag-handle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; }
.places.has-vias .drag-handle { display: flex; align-items: center; justify-content: center; }
.places.has-vias input { padding-left: 74px; }
.places.has-vias .dot { margin-left: 30px; }
.places.has-vias .place-divider { margin-left: 74px; }
.place-row.dragging { z-index: 20; background: var(--card); box-shadow: 0 6px 0 rgba(0, 0, 0, .18), 0 0 0 2px var(--brand); cursor: grabbing; }
.place-row.dragging .drag-handle { cursor: grabbing; }
.place-row.drop-before { box-shadow: inset 0 4px 0 var(--brand); }
.place-row.drop-after { box-shadow: inset 0 -4px 0 var(--brand); }
