:root {
  color-scheme: light;
  --bg: #eef1f5; --card: #ffffff; --card-2: #f6f8fa; --text: #14181d; --muted: #5b6672; --line: #e1e5ea;
  --accent: #17694a; --accent-text: #ffffff; --warn-bg: #fff3d1; --warn-text: #5a4300; --warn-line: #f0d68a;
  --live: #11823b; --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 1px 3px rgb(16 24 40 / .08);
  --pill-ring: transparent; --tile-filter: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117; --card: #161b22; --card-2: #1c232c; --text: #e8edf2; --muted: #96a2ae; --line: #262e38;
    --accent: #5ccf91; --accent-text: #06150d; --warn-bg: #2e2612; --warn-text: #f1d892; --warn-line: #5a4a1c;
    --live: #4fd187; --shadow: none; --pill-ring: rgb(255 255 255 / .18);
  --tile-filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117; --card: #161b22; --card-2: #1c232c; --text: #e8edf2; --muted: #96a2ae; --line: #262e38;
  --accent: #5ccf91; --accent-text: #06150d; --warn-bg: #2e2612; --warn-text: #f1d892; --warn-line: #5a4a1c;
  --live: #4fd187; --shadow: none; --pill-ring: rgb(255 255 255 / .18);
  --tile-filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9);
}

* { box-sizing: border-box; }
body {
  margin: 0 auto; max-width: 560px; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh; box-sizing: border-box; display: flex; flex-direction: column; /* footer sits at the bottom */
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px; background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
a.brand { color: inherit; text-decoration: none; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
h1 { font-size: 1.15rem; margin: 0; letter-spacing: -.01em; }

button {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 12px; padding: 10px 14px; min-height: 44px; cursor: pointer;
}
button:active { transform: scale(.98); }
.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.icon-btn { min-width: 44px; padding: 0; display: inline-grid; place-items: center; color: var(--muted); }

#offline, #stale {
  display: flex; gap: 10px; align-items: flex-start; background: var(--warn-bg); color: var(--warn-text);
  border: 1px solid var(--warn-line); border-radius: 12px; padding: 10px 12px; margin: 4px 0 8px; font-size: .95rem;
}
#offline[hidden], #stale[hidden] { display: none; }
#stale { align-items: center; justify-content: space-between; }

#add {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px;
  margin: 4px 0 12px; box-shadow: var(--shadow);
}
form { display: flex; gap: 8px; margin-bottom: 8px; }
input {
  flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
}
.hint { color: var(--muted); font-size: .85rem; margin: 8px 2px 0; }
#results { list-style: none; padding: 0; margin: 8px 0 0; }
#results li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 2px; border-top: 1px solid var(--line); }
#results li > span { min-width: 0; }
#results li > button { flex: none; white-space: nowrap; }
#results .group { display: block; padding: 12px 2px 4px; border-top: 0; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
#results .sub { display: block; color: var(--muted); font-size: .85rem; }

.stop {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 14px 10px;
  margin: 12px 0; box-shadow: var(--shadow);
}
.stop-head { display: flex; align-items: center; gap: 8px; padding: 8px 0 6px; }
.stop-head h2 { font-size: 1rem; margin: 0; flex: 1; min-width: 0; }
.stop-head .sub { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 1px; }
.dep { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.route {
  font-weight: 800; border-radius: 8px; padding: 4px 0; min-width: 3em; text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px var(--pill-ring);
}
.head { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; line-height: 1.15; }
.when small { display: flex; justify-content: flex-end; align-items: center; gap: 5px; font-weight: 500; font-size: .72rem; color: var(--muted); }
.when .live { color: var(--live); }
.when .live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
[data-look="material"] .when .live::before { background: var(--led); } /* a bright green LED, even on a coloured card */
@media (prefers-reduced-motion: reduce) { .when .live::before { animation: none; } }
.due { color: var(--live); }
.note { color: var(--muted); font-size: .88rem; margin: 8px 0 2px; }
.alert { margin: 6px 0 8px; padding: 8px 10px; border-radius: 10px; font-size: .9rem; overflow-wrap: anywhere;
  background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }
.flag { display: block; color: var(--warn-text); background: var(--warn-bg); border-radius: 6px; padding: 2px 6px; margin-top: 3px; }
.alert .sub { display: block; font-size: .82rem; opacity: .85; }
.alert p { margin: 4px 0; }
.alert button { margin: 4px 6px 0 0; min-height: 36px; font-size: .88rem; }
.xfer { margin: 6px 0 8px; padding: 8px 10px; border-radius: 10px; font-size: .9rem; background: var(--card-2); }
.xfer.on_track { color: var(--live); }
.xfer.tight, .xfer.missed { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-line); }
.xfer.missed { font-weight: 600; }
.sms {
  display: block; text-align: center; margin: 10px 0 2px; padding: 11px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text); text-decoration: none; font-weight: 600;
}
.settings { display: grid; gap: 10px; padding: 10px 12px 12px; margin: 0 -2px 8px; border-radius: 12px; background: var(--card-2); }
.settings .label { margin: 0; color: var(--muted); font-size: .8rem; font-weight: 600; }
.settings label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.settings > * { min-width: 0; }
.settings select { min-width: 0; max-width: 100%; }
.settings label.check { justify-content: flex-start; }
.settings input[type=number] { width: 4.5em; text-align: right; }
.settings select, .settings input[type=number] { font: inherit; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.settings input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 4px 12px; font-weight: 700; border-radius: 999px; }
#groups { margin: 12px 0 0; }
#groups[hidden] { display: none; }
.board #groups { display: none; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.skeleton { height: 1.1em; border-radius: 6px; background: var(--card-2); margin: 14px 0; }
.updated { color: var(--muted); font-size: .78rem; text-align: center; margin: 4px 0 0; }

#empty { text-align: center; color: var(--muted); padding: 40px 12px 8px; }
#empty[hidden] { display: none; }
#empty img { width: 72px; height: 72px; border-radius: 18px; opacity: .9; }
#empty p { margin: 8px auto 20px; max-width: 26em; }
#empty h2 { color: var(--text); font-size: 1rem; margin: 16px 0 0; }
.big { display: block; width: 100%; max-width: 22em; margin: 10px auto 0; min-height: 48px; font-weight: 600; }
.tips-head { display: flex; align-items: center; justify-content: space-between; }
#tips h2 { font-size: 1.05rem; margin: 10px 0 4px; }
#tips-ok { min-width: 44px; min-height: 44px; font-size: 1.4rem; line-height: 1; background: none; border-color: transparent; color: var(--muted); }
#install { margin: 0 0 8px; }
#tips ul { margin: 0 0 6px; padding-left: 1.2em; line-height: 1.5; }
#tips li { margin: 6px 0; }
#tips[hidden] { display: none; }

footer { color: var(--muted); font-size: .82rem; margin-top: auto; padding-top: 28px; line-height: 1.5; }
footer a { color: var(--accent); }
#intro { text-align: left; max-width: 40rem; margin: 0 auto 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
/* The page uses the app's three sizes only: card title (headings), body (paragraphs), card subtitle (footer). */
#intro h2 { color: var(--text); font-size: 1rem; margin: 0 0 6px; }
#intro p { margin: 0 0 8px; }
.app #intro { display: none; }
[data-look="material"] #intro { background: var(--s3); border: 0; border-radius: 28px; padding: 20px 22px; margin-bottom: 8px; } /* a tonal card, like Settings */
[data-look="material"] #intro h2 { margin-bottom: 10px; }
.policy { line-height: 1.55; max-width: 40rem; }
.policy h2 { font-size: 1.05rem; margin: 22px 0 6px; }
.policy a { color: var(--accent); }
footer select { font: inherit; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
#clock { display: none; }

/* Wall board: read from across the room. */
.board { max-width: none; font-size: clamp(18px, 2.6vw, 34px); }
.board #add-btn, .board #add, .board footer, .board .stop-head button, .board .settings, .board #tips, .board .updated { display: none; }
.board header { position: relative; } /* not sticky, but still the box for the Glass blur layer */
.board .brand img { width: 1.4em; height: 1.4em; }
.board #clock { display: block; font-size: 1.6em; font-weight: 800; font-variant-numeric: tabular-nums; }
.board h1 { font-size: 1em; color: var(--muted); }
.board main { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15em), 1fr)); gap: 0 16px; }
.board .stop-head h2 { font-size: 1em; }
.board .when { font-size: 1.1em; }
.board .when small { font-size: .6em; }

/* Bus map: a sheet from the bottom on phones. */
.dep[data-trip] { cursor: pointer; }
.dep[data-trip]:hover .head { text-decoration: underline; }
#map-sheet { width: min(560px, 100%); max-width: 100%; max-height: 90dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 16px 16px 0 0;
  background: var(--card); color: var(--text); }
#map-sheet::backdrop { background: rgb(0 0 0 / .45); }
#map-sheet .bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
#map-sheet .bar h2 { flex: 1; min-width: 0; margin: 0; font-size: 1rem; }
#map-sheet .bar .sub { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
#map-box { height: min(60dvh, 460px); background: var(--card-2); }
#map-box .leaflet-tile { filter: var(--tile-filter); }
#map-note { margin: 0; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); color: var(--muted); font-size: .82rem; }
.bus-pin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 800; font-size: 13px;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .4); }
.bus-pin.other { width: 22px; height: 22px; font-size: 9px; border-width: 2px; opacity: .55; }

/* Route lines: tap to list that route's buses. */
.grp-head { width: 100%; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; padding: 9px 0;
  text-align: left; font: inherit; color: inherit; min-height: 0; }
.grp-head:active { transform: none; background: var(--card-2); }
.then { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.grp-head .then::after { content: " \25BE"; }
.grp-head[aria-expanded="true"] .then::after { content: " \25B4"; }
.grp-body { padding-left: 12px; border-left: 3px solid var(--line); margin: 0 0 6px 18px; font-size: .92rem; }
.grp-body .route { display: none; }
.map-link { display: block; width: 100%; border: 0; background: none; padding: 8px 0; text-align: left; font: inherit; color: var(--accent); min-height: 0; }
.grp-body .dep { grid-template-columns: 1fr auto; }
.board .grp-body, .board .then::after { display: none; }

/* Search results: whole place rows are tappable; nearby stops get a map with numbered pins. */
#results .grow { flex: 1; min-width: 0; }
#results .pick { cursor: pointer; }
#results .pick:active { background: var(--card-2); }
#results .go { color: var(--muted); font-size: 1.4rem; padding: 0 6px; }
#results .num, .stop-pin { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 13px; }
.stop-pin { border: 2px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .4); }
#results .near-map { display: block; padding: 0 0 8px; border-top: 0; }
#near-map { height: 220px; border-radius: 12px; background: var(--card-2); }
#near-map .leaflet-tile { filter: var(--tile-filter); }
.leaflet-container a { color: var(--accent); }
#add:has(#results li) .hint { display: none; } /* results replace the help text */
#results .note-row { display: block; color: var(--muted); font-size: .9rem; }
/* Search row: the box plus "Near me"; results come as you type, so no Find button. */
#near { width: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
/* The welcome screen's "Find my stop" already opens search. */
body:has(#empty:not([hidden])) #add-btn[aria-expanded="false"] { display: none; }
/* Settings sheet, opened from the gear in the header. */
#prefs h2 { margin: 0 0 10px; font-size: 1.05rem; }
#prefs label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
#prefs select { font: inherit; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
#prefs .hint { margin: 8px 0 0; }
#board-exit { display: none; }
.board #board-exit { display: inline-grid; border-color: transparent; background: none; opacity: .5; }
.board #prefs-btn { display: none; }
.board .adsbygoogle { display: none !important; } /* board switched on after ads loaded */
/* Map pin card */
.stop-pin { width: 30px; height: 30px; font-size: 14px; }
.pin-card { display: grid; gap: 4px; font: 14px/1.35 system-ui, sans-serif; }
.pin-card .sub { color: #5b6675; font-size: 12.5px; }
.pin-card button { margin-top: 6px; min-height: 40px; background: var(--accent); color: var(--accent-text); border: 0; font-weight: 600; }
.pin-card button:disabled { opacity: .6; }
/* Desktop: stops side by side. The page is as wide as the stops it shows, so header, panels and cards line up. */
.mouse { display: none; }
@media (hover: hover) and (pointer: fine) { .mouse { display: inline; } .touch { display: none; } }
@media (min-width: 1000px) {
  body:not(.board) { max-width: 640px; padding-inline: 32px; }
  body:not(.board):has(main > .stop:not([hidden]) ~ .stop:not([hidden])) { max-width: 1000px; }
  body:not(.board):has(main > .stop:not([hidden]) ~ .stop:not([hidden]) ~ .stop:not([hidden])) { max-width: 1320px; }
  body:not(.board) main { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 16px; align-items: start; }
  body:not(.board) :is(#add, #prefs, #tips, #offline, #stale, #empty) { width: min(640px, 100%); margin-inline: auto; }
  body:not(.board) footer { text-align: center; max-width: 720px; margin-inline: auto; }
  #map-sheet { width: min(720px, 90vw); margin: auto; border-radius: 16px; }
  #map-box { height: min(65dvh, 560px); }
}

/* ===== Looks (v52). Material 3 Expressive on Android, Liquid Glass on iPhone; Settings > Look overrides.
   Same markup for both: only tokens, shapes and motion change. The base rules above stay the fallback. ===== */
:root {
  --spring: linear(0, .06 3%, .24 7%, .52 12%, .79 18%, .96 24%, 1.04 30%, 1.06 35%, 1.04 42%, 1.01 52%, .995 65%, 1);
  --spring-fast: linear(0, .2 6%, .6 14%, .95 24%, 1.05 32%, 1.02 45%, 1);
  --pc: var(--card); --on-pc: var(--text); --tc: var(--card); --on-tc: var(--text); --s3: var(--card-2);
  --pc-chip: var(--on-pc); --pc-chip-text: var(--pc); --tc-chip: var(--on-tc); --tc-chip-text: var(--tc);
}
/* Material: colours from the YEG Bus green as the seed. */
:root[data-look="material"] {
  --bg: #f4fbf5; --card: #e9efe9; --card-2: #f4fbf5; --text: #161d19; --muted: #3f4943; --line: #bfc9c1;
  --accent: #17694a; --accent-text: #fff; --live: #17694a; --led: #0f9d58; --shadow: none;
  --pc: #9ff5c6; --on-pc: #002114; --sc: #cfe9d9; --on-sc: #0b1f15; --tc: #b8eafb; --on-tc: #001f27; --s3: #e2e9e3; --tint: rgb(255 255 255 / .55);
  --pc-chip: #17694a; --pc-chip-text: #fff; --tc-chip: #2f6574; --tc-chip-text: #fff; /* green badge, chips and wave, as design sample 5 */
}
@media (prefers-color-scheme: dark) {
  :root[data-look="material"]:not([data-theme="light"]) {
    --bg: #0e1511; --card: #1a211d; --card-2: #0e1511; --text: #dde4de; --muted: #bfc9c1; --line: #3f4943;
    --accent: #84d8ac; --accent-text: #003824; --live: #84d8ac; --led: #5dff9b;
    --pc: #17694a; --on-pc: #f3eee2; --sc: #33493d; --on-sc: #cfe9d9; --tc: #1d5f80; --on-tc: #f3eee2; --s3: #252c27; --tint: rgb(243 238 226 / .14);
    --pc-chip: #9ff5c6; --pc-chip-text: #00391f; --tc-chip: #b8eafb; --tc-chip-text: #00303f; /* colour like light mode, not just cream */
  }
}
:root[data-look="material"][data-theme="dark"] {
  --bg: #0e1511; --card: #1a211d; --card-2: #0e1511; --text: #dde4de; --muted: #bfc9c1; --line: #3f4943;
  --accent: #84d8ac; --accent-text: #003824; --live: #84d8ac; --led: #5dff9b;
  --pc: #17694a; --on-pc: #f3eee2; --sc: #33493d; --on-sc: #cfe9d9; --tc: #1d5f80; --on-tc: #f3eee2; --s3: #252c27; --tint: rgb(243 238 226 / .14);
    --pc-chip: #9ff5c6; --pc-chip-text: #00391f; --tc-chip: #b8eafb; --tc-chip-text: #00303f; /* colour like light mode, not just cream */
}
/* Glass: the page stays plain; controls float on frosted glass. */
:root[data-look="glass"] { --glass: rgb(255 255 255 / .6); --glass-line: rgb(255 255 255 / .85); --glass-shadow: 0 8px 30px rgb(16 24 40 / .14); }
@media (prefers-color-scheme: dark) {
  :root[data-look="glass"]:not([data-theme="light"]) { --glass: rgb(40 46 56 / .6); --glass-line: rgb(255 255 255 / .14); --glass-shadow: 0 8px 30px rgb(0 0 0 / .5); }
}
:root[data-look="glass"][data-theme="dark"] { --glass: rgb(40 46 56 / .6); --glass-line: rgb(255 255 255 / .14); --glass-shadow: 0 8px 30px rgb(0 0 0 / .5); }

/* Shared motion: presses squash and spring back, panels spring in. */
button { transition: transform .45s var(--spring-fast), border-radius .45s var(--spring-fast), background-color .2s, color .2s; }
button:active { transform: scale(.95); }
#prefs:not([hidden]), #add:not([hidden]), #tips:not([hidden]) { animation: spring-in .55s var(--spring) both; }
@keyframes spring-in { from { opacity: 0; transform: translateY(-14px) scale(.98); } }
.grp-body:not([hidden]) { animation: open-down .35s var(--spring) both; }
@keyframes open-down { from { opacity: 0; transform: translateY(-6px); } }
#map-sheet[open] { animation: sheet-up .55s var(--spring) both; }
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
main > .stop { animation: rise .5s var(--spring) both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.lead .when.tick { animation: tick .6s var(--spring); }
@keyframes tick { from { transform: translateY(-35%); opacity: 0; } }
.route.arrive { animation: arrive .9s var(--spring); }
@keyframes arrive { 30% { transform: scale(1.18) rotate(-10deg); } }

/* The lead bus: big on the first card on screen, and on every card of the wall board. */
.wave { display: none; }
:is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead {
  grid-template-columns: auto 1fr; grid-template-areas: "r w" "r h" "v v"; column-gap: 16px; row-gap: 2px; align-items: end;
}
:is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .route { grid-area: r; align-self: center; }
:is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .when {
  grid-area: w; text-align: left; font-size: 3.6rem; line-height: .95; font-weight: 820; letter-spacing: -.03em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
:is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .when small { font-size: .85rem; letter-spacing: 0; }
:is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .head { grid-area: h; align-self: start; font-weight: 600; white-space: normal; }
:is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .wave { display: block; grid-area: v; width: 100%; height: 24px; margin: 18px 0 2px; overflow: visible; }
.when .u { font-size: .6em; font-weight: 650; letter-spacing: 0; }
.wave > path { fill: none; stroke-linecap: round; }
.wave .track { stroke: color-mix(in srgb, currentColor 18%, transparent); stroke-width: 4; }
.wave .fill { stroke: var(--accent); stroke-width: 5; }
.wave .bus .blue { fill: #1f5fbf; }
.wave .bus .white { fill: #f3f5f8; }
.wave .bus .glass { fill: #1b2532; }
.wave .bus .door { fill: #2c3a4c; }
.wave .bus .pillar { stroke: #3d4a5c; stroke-width: .5; }
.wave .bus .mullion { stroke: #f3f5f8; stroke-width: 1; }
.wave .bus .pole { stroke: #8b96a3; stroke-width: .9; }
.wave .bus .bogie { fill: #8b96a3; }
.wave .bus .red { fill: #d23a3a; }
.wave .bus .green { fill: #16a36a; }
.wave .bus .sign { fill: #ffb21a; }
.wave .bus .lamp { fill: #fff6c2; }
.wave .bus .tyre { fill: #15181c; }
.wave .bus .hub { fill: #c3c9d1; }
.wave .bus-body { animation: idle 1.6s ease-in-out infinite; }
@keyframes idle { 50% { transform: translateY(-1px); } }
@media (prefers-reduced-motion: reduce) { .wave .bus-body { animation: none; } }

/* ---- Material ---- */
[data-look="material"] body { font-family: Roboto, system-ui, sans-serif; }
[data-look="material"] h1 { font-size: 1.6rem; font-weight: 750; }
[data-look="material"] .brand img { width: 40px; height: 40px; border-radius: 12px; }
[data-look="material"] button { border: 0; background: var(--s3); border-radius: 999px; }
[data-look="material"] .primary { background: var(--accent); color: var(--accent-text); border-radius: 18px; }
[data-look="material"] .primary:active { border-radius: 26px; }
[data-look="material"] .icon-btn { width: 48px; height: 48px; border-radius: 50%; color: var(--text); }
[data-look="material"] .icon-btn:active { border-radius: 16px; }
[data-look="material"] .stop-head .icon-btn { width: 40px; height: 40px; min-width: 40px; background: none; color: var(--muted); }
[data-look="material"] #groups:not([hidden]) { display: flex; flex-wrap: nowrap; gap: 3px; }
[data-look="material"] #groups .chip { flex: 1; min-height: 48px; border-radius: 8px; font-weight: 600; color: var(--muted); }
[data-look="material"] #groups .chip:first-child { border-radius: 24px 8px 8px 24px; }
[data-look="material"] #groups .chip:last-child { border-radius: 8px 24px 24px 8px; }
[data-look="material"] #groups .chip[aria-pressed="true"] { border-radius: 24px; color: var(--accent-text); }
[data-look="material"] .stop, [data-look="material"] #add, [data-look="material"] #prefs { background: var(--card); border: 0; border-radius: 30px; padding: 8px 14px 12px; box-shadow: none; }
[data-look="material"] :is(.stop-head h2, #empty h2, #intro h2) { font-size: 1.12rem; }
[data-look="material"] .deps { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
[data-look="material"] .deps .dep, [data-look="material"] .deps .grp-head { border: 0; background: var(--card-2); border-radius: 6px; padding: 10px 12px; }
[data-look="material"] .deps > .grp:first-child > .dep { border-radius: 22px 22px 6px 6px; }
[data-look="material"] .deps > .grp:last-child > .dep { border-radius: 6px 6px 22px 22px; }
[data-look="material"] .deps > .grp:only-child > .dep { border-radius: 22px; }
[data-look="material"] .grp-body { border-left: 0; margin: 4px 0 4px 12px; }
[data-look="material"] .grp-body .dep { background: none; }
[data-look="material"] .route { border-radius: 14px; min-width: 3.1em; padding: 9px 4px; }
[data-look="material"] .when { font-size: 1.45rem; font-weight: 800; }
[data-look="material"] .stop.walk { background: var(--tc); color: var(--on-tc); --accent: var(--tc-chip); --accent-text: var(--tc-chip-text); --live: currentColor; }
/* Badges, wave and "Go now" in the card's chip colour: mint on green in dark, green on mint in light. */
[data-look="material"] .stop.walk .sub, [data-look="material"] .stop.walk .then { color: inherit; opacity: .78; }
[data-look="material"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop:not(.walk)) { background: var(--pc); color: var(--on-pc); --accent: var(--pc-chip); --accent-text: var(--pc-chip-text); --live: currentColor; }
[data-look="material"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .sub,
[data-look="material"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .then { color: inherit; opacity: .78; }
/* Rows on a coloured card take a tint of it, not a dark slab. */
:is([data-look="material"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop), [data-look="material"] .stop.walk) .deps .dep { background: var(--tint); color: inherit; }
[data-look="material"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .deps .dep.lead { background: none; padding: 6px 2px 2px; }
[data-look="material"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .route {
  width: 84px; height: 84px; padding: 0; display: grid; place-items: center; font-size: 1.5rem; border-radius: 0; box-shadow: none;
  -webkit-mask: url(cookie.svg) center / contain no-repeat; mask: url(cookie.svg) center / contain no-repeat;
}
[data-look="material"] input { border: 0; background: var(--s3); border-radius: 999px; padding: 12px 18px; }
[data-look="material"] .settings, [data-look="material"] #prefs select, [data-look="material"] .settings select { border-radius: 16px; }
[data-look="material"] #map-sheet { border-radius: 30px 30px 0 0; }
[data-look="material"] .sms { border-radius: 999px; }

/* ---- Glass ---- */
[data-look="glass"] h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
[data-look="glass"] .brand img { width: 36px; height: 36px; border-radius: 10px; }
[data-look="glass"] header { background: none; margin: 0 -16px; padding-inline: 16px; isolation: isolate; }
/* The blur sits on a layer behind the header: a backdrop-filter on the header itself would pin the app's floating add button inside it. */
[data-look="glass"] header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.8); backdrop-filter: blur(20px) saturate(1.8); }
[data-look="glass"] button { border-radius: 999px; }
[data-look="glass"] .icon-btn, [data-look="glass"] #groups {
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(22px) saturate(1.8); backdrop-filter: blur(22px) saturate(1.8);
}
[data-look="glass"] header .icon-btn { width: 44px; height: 44px; color: var(--text); }
[data-look="glass"] .stop-head .icon-btn { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
[data-look="glass"] #groups:not([hidden]) { display: flex; flex-wrap: nowrap; gap: 0; padding: 4px; border-radius: 999px; }
[data-look="glass"] #groups .chip { flex: 1; border: 0; background: none; color: var(--muted); font-weight: 600; min-height: 40px; }
[data-look="glass"] #groups .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
[data-look="glass"] .stop, [data-look="glass"] #add, [data-look="glass"] #prefs { border: 0; border-radius: 26px; padding: 6px 16px 10px; }
[data-look="glass"] :is(.stop-head h2, #empty h2, #intro h2) { font-size: 1.1rem; letter-spacing: -.01em; }
[data-look="glass"] .route { border-radius: 10px; padding: 6px 4px; }
[data-look="glass"] .when { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
[data-look="glass"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead { border-top: 0; padding-top: 4px; }
[data-look="glass"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .route { width: 72px; height: 72px; display: grid; place-items: center; font-size: 1.4rem; border-radius: 22px; padding: 0; }
[data-look="glass"] :is(body:not(.board) main > .stop:not([hidden]):not(.stop:not([hidden]) ~ .stop), body.board main > .stop) .lead .when { color: var(--accent); }
[data-look="glass"] input { border-radius: 999px; padding: 11px 16px; }
[data-look="glass"] #map-sheet { border-radius: 30px 30px 0 0; }
[data-look="glass"] .sms { border-radius: 999px; }

/* Android app only (no ads there): the add button floats bottom-right. */
.native body:not(.board) { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.native body:not(.board) #add-btn { position: fixed; z-index: 5; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); min-height: 64px; padding: 0 24px;
  font-size: 1.05rem; box-shadow: 0 6px 18px rgb(0 0 0 / .22); }
[data-look="glass"].native body:not(.board) #add-btn { border-radius: 999px; }
.native body:not(.board) #add-btn { transition: transform .3s var(--spring); }
.native body.down:not(.board) #add-btn:not([aria-expanded="true"]) { transform: translateY(calc(100% + 40px)); } /* out of the way while reading down */

/* Settings is its own page (v53): everything else steps aside, rows are tiles, the licence lives here. */
body.in-prefs > :is(header, main, #add, #empty, #groups, #tips, #offline, .updated, footer) { display: none !important; }
body.in-prefs #prefs:not([hidden]) { background: none; border: 0; box-shadow: none; padding: 4px 0 24px; margin: 0; animation: page-in .45s var(--spring) both; }
@keyframes page-in { from { opacity: 0; transform: translateX(36px); } }
#prefs .prefs-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 16px -4px; }
#prefs .prefs-bar h2 { margin: 0; font-size: 1.6rem; font-weight: 750; }
#prefs .prefs-bar .icon-btn { background: none; border: 0; box-shadow: none; color: var(--text); }
#prefs label, #prefs .links a { background: var(--card); padding: 12px 14px 12px 18px; margin: 0 0 3px; border-radius: 6px; min-height: 36px; }
#prefs label:first-of-type, #prefs .links a:first-child { border-radius: 22px 22px 6px 6px; }
#prefs label:last-of-type, #prefs .links a:last-child { border-radius: 6px 6px 22px 22px; }
#prefs .hint { margin: 10px 18px 22px; }
#prefs .links { display: flex; flex-direction: column; margin: 0; }
#prefs .links a { display: flex; align-items: center; color: var(--text); text-decoration: none; font-weight: 500; }
#prefs .links a::after { content: "\203A"; margin-left: auto; font-size: 1.4rem; color: var(--muted); }
#prefs .links + .hint { font-size: .75rem; }
[data-look="glass"] #prefs label, [data-look="glass"] #prefs .links a { background: var(--glass); border: 1px solid var(--glass-line); }
#prefs label[hidden] { display: none; } /* the Widget row, outside the app */
[data-look="material"] #prefs label, [data-look="material"] #prefs .links a { background: var(--sc); color: var(--on-sc); } /* green tonal tiles */
[data-look="material"] #prefs .links a::after { color: inherit; opacity: .7; }
/* A wide screen: settings on the left, links and licence on the right. */
@media (min-width: 900px) {
  body.in-prefs:not(.board) { max-width: 960px; }
  body.in-prefs:not(.board) #prefs { width: 100%; }
  body.in-prefs #prefs:not([hidden]) { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; align-content: start; }
  #prefs .prefs-bar { grid-column: 1 / -1; }
  #prefs > label, #prefs > .hint:first-of-type { grid-column: 1; }
  #prefs .links { grid-column: 2; grid-row: 2 / span 6; align-self: start; }
  #prefs .links + .hint { grid-column: 1; }
}
.app footer .legal { display: none; } /* the app keeps it in Settings */
/* Update and out-of-date notes: a small pill floating at the bottom, not a box in the page. */
#stale:not([hidden]) { position: fixed; z-index: 6; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px);
  margin: 0; padding: 4px 4px 4px 16px; gap: 6px; border: 0; border-radius: 999px; font-size: .85rem; background: var(--text); color: var(--bg);
  box-shadow: 0 6px 20px rgb(0 0 0 / .25); animation: pill-up .5s var(--spring) both; }
#stale span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stale button { flex: none; min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: inherit; font-weight: 700; font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; }
.native body:not(.board) #stale:not([hidden]) { bottom: calc(100px + env(safe-area-inset-bottom)); } /* above the floating add button */
@keyframes pill-up { from { opacity: 0; translate: 0 20px; } }

/* A stop's settings page: only that stop's form shows, on the plain page background, rows as tiles. */
body.in-edit > :is(header, #groups, #tips, #offline, #add, #empty, #prefs, .updated, footer), body.in-edit main > .stop:not(.editing) { display: none !important; }
body.in-edit main > .stop.editing { background: none !important; color: var(--text) !important; border: 0; box-shadow: none; padding: 4px 0 24px; margin: 0; animation: page-in .45s var(--spring) both; }
.stop.editing > :not(.settings) { display: none !important; }
.stop.editing .settings { display: block; background: none; padding: 0; margin: 0; }
.settings .prefs-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 16px -4px; }
.settings .prefs-bar h2 { margin: 0; font-size: 1.4rem; font-weight: 750; line-height: 1.2; }
.settings .prefs-bar .sub { display: block; font-size: .85rem; font-weight: 400; color: var(--muted); }
.settings .prefs-bar .icon-btn { background: none; border: 0; box-shadow: none; color: var(--text); flex: none; }
.stop.editing .settings .note { margin: 0 4px 14px; }
.stop.editing .settings .label { margin: 0; padding: 14px 18px 4px; background: var(--card); border-radius: 22px 22px 6px 6px; color: var(--muted); }
.stop.editing .settings .chips { background: var(--card); padding: 6px 14px 14px; margin: 0 0 12px; border-radius: 0 0 22px 22px; }
.stop.editing .settings label { background: var(--card); padding: 10px 14px 10px 18px; margin: 0 0 3px; border-radius: 6px; min-height: 40px; }
.stop.editing .settings label:first-of-type { border-radius: 22px 22px 6px 6px; }
.stop.editing .settings label:last-of-type { border-radius: 6px 6px 22px 22px; margin-bottom: 16px; }
.stop.editing .settings select, .stop.editing .settings input { background: var(--s3, var(--card-2)); color: var(--text); }
.stop.editing .settings > .primary { width: 100%; min-height: 52px; }
[data-look="glass"] .stop.editing .settings :is(label, .label, .chips) { background: var(--glass); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01s !important; }
}
/* Wall board: one column of hero cards, read from across the room. */
.board main { display: flex; flex-direction: column; gap: 14px; width: min(100%, 760px); margin-inline: auto; }
