:root {
  --bg: rgba(255, 255, 255, 0.88);
  --fg: #1d2420;
  --muted: #5f6a64;
  --line: rgba(0, 0, 0, 0.09);
  --brand: #1f8a4c;
  --chip: rgba(0, 0, 0, 0.06);
  --accent: #e07b13;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
:root[data-map-theme="evening"], :root[data-map-theme="night"] {
  --bg: rgba(24, 28, 42, 0.82);
  --fg: #f2eef8;
  --muted: #aeb3c6;
  --line: rgba(255, 255, 255, 0.11);
  --chip: rgba(255, 255, 255, 0.09);
  --accent: #ffb04a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #232838; color: var(--fg); }
#map { position: fixed; inset: 0; }
a { color: inherit; }

#veil { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: #232838; color: #e9e4f2; transition: opacity .5s; text-align: center; font-size: 15px; }
#veil img { border-radius: 15px; }
#veil.gone { opacity: 0; pointer-events: none; }

.panel {
  position: fixed; z-index: 5;
  background: var(--bg);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
}

.top { top: max(12px, env(safe-area-inset-top)); left: 12px; width: min(380px, calc(100vw - 24px)); padding: 10px; display: grid; gap: 8px; grid-template-columns: 1fr auto; align-items: center; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 16px; }
.brand img { border-radius: 7px; }
.brand em { font-style: normal; font-weight: 800; color: var(--accent); }
.seg { display: flex; background: var(--chip); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: none; color: var(--fg); padding: 5px 8px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.search { position: relative; grid-column: 1 / -1; }
.search input { width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--chip); color: var(--fg); font-size: 16px; outline: none; }
#results { list-style: none; margin: 4px 0 0; padding: 0; position: absolute; left: 0; right: 0; background: var(--bg); border-radius: 12px; overflow: hidden; z-index: 2; }
#results:empty { display: none; }
#results li { padding: 8px 12px; cursor: pointer; display: grid; border-top: 1px solid var(--line); }
#results li:first-child { border-top: 0; }
#results small { color: var(--muted); }
.tools { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tools button, .actions button { border: 0; border-radius: 10px; padding: 7px 11px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--chip); color: var(--fg); }
button.primary { background: var(--brand); color: #fff; }
#speed { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); }

.cta { left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); width: min(520px, calc(100vw - 24px)); padding: 10px 12px 8px; }
.get { display: flex; align-items: center; gap: 12px; text-decoration: none; background: var(--brand); color: #fff; border-radius: 14px; padding: 9px 12px; }
.get img { border-radius: 10px; flex: none; }
.get b { display: block; font-size: 17px; }
.get small { display: block; font-size: 12.5px; opacity: 0.9; }
.fine { margin: 7px 2px 0; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.fine b { color: var(--fg); }

#card { left: 12px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 150px); width: min(380px, calc(100vw - 24px)); padding: 13px; max-height: 46vh; overflow: auto; }
.card-head { display: flex; gap: 12px; align-items: center; }
.title { font-weight: 700; font-size: 16px; }
.sub { color: var(--muted); font-size: 13px; }
.svc { background: var(--brand); color: #fff; font-weight: 800; border-radius: 10px; padding: 8px 10px; font-size: 18px; min-width: 48px; text-align: center; }
.svc.sm { font-size: 13px; padding: 4px 6px; min-width: 44px; border-radius: 8px; }
.stopicon { background: var(--chip); border-radius: 10px; padding: 8px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.arrivals { list-style: none; margin: 10px 0 8px; padding: 0; }
.arrivals li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.arrivals li.muted { color: var(--muted); }
.arrivals .dest { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arrivals .eta { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--muted); white-space: nowrap; }
.arrivals .eta b { color: var(--fg); font-size: 15px; }
.arrivals .eta small { font-size: 11px; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; }
.card-foot a { color: var(--accent); font-weight: 700; text-decoration: none; }
.tag { background: var(--chip); padding: 2px 8px; border-radius: 999px; font-size: 11.5px; color: var(--muted); }
.actions { display: flex; gap: 8px; margin-top: 10px; }

.pill { background: #fff; color: #1d2420; border-radius: 999px; padding: 3px 8px; font-size: 12px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.3); border: 2px solid #ffb04a; pointer-events: none; }
.pill b { color: var(--brand); }
.pill.follow { border-color: var(--brand); }

.maplibregl-ctrl-top-right { top: max(0px, env(safe-area-inset-top)); }
body.touring .top .search, body.touring .tools button#ride { opacity: 0.6; }

@media (max-width: 640px) {
  .top { right: 12px; width: auto; }
  .maplibregl-ctrl-top-right { display: none; }
  #card { right: 12px; width: auto; max-height: 34vh; padding: 11px; }
  .get b { font-size: 16px; }
  .top { padding: 8px; gap: 6px; }
}

/* Recording mode: only the map and the stop card, sized for a 9:16 or 4:5 video. */
body.film .top, body.film .cta, body.film #veil, body.film .maplibregl-ctrl, body.film .maplibregl-ctrl-attrib { display: none !important; }
body.film #card { left: 22px; right: 22px; width: auto; bottom: 30px; max-height: none; padding: 16px; border-radius: 22px; font-size: 15px; }
body.film #card .title { font-size: 19px; }
body.film #card .arrivals li { padding: 8px 0; }
@media (min-width: 641px) {
  .cta { left: 12px; transform: none; width: 440px; }
  #card { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 140px); }
}
