/* Bus Trier – kompaktes, ruhiges Design.
   Grundsatz: wenig Farbe, kleine Abstände, eine klare Hauptinfo pro Block.
   Die vorherige Fassung liegt in backup/ui-vor-redesign/. */

:root {
  --bg: #f2f3f5;
  --card: #ffffff;
  --sunk: #f6f7f9; /* leicht abgesetzte Fläche in einer Karte */
  --text: #15171a;
  --muted: #6b7280;
  --line: #e4e6ea;
  --brand: #0a5c8a;
  --brand-ink: #ffffff;
  --ok: #138a4a;
  --warn: #b86200;
  --bad: #c62828;
  --bus: #0a5c8a;
  --citybus: #c8102e;
  --train: #3a4250;
  --other: #1f7a7a;
  --border: 1px solid var(--line);
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e12;
    --card: #171a20;
    --sunk: #1e222a;
    --text: #e9ebee;
    --muted: #979ea8;
    --line: #272b33;
    --brand: #4ea6dc;
    --ok: #3ccf7d;
    --warn: #ffab4a;
    --bad: #ff6b6b;
    --border: 1px solid transparent;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
b { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); }
.skeleton { color: var(--muted); }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 6px) 12px 6px 16px;
  background: var(--brand); color: var(--brand-ink);
}
.topbar-title { min-width: 0; }
.topbar h1 { font-size: 16px; font-weight: 700; }
.loc-status { font-size: 11px; opacity: .85; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 72vw; }
.icon-btn {
  border: 0; background: transparent; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; font-size: 16px; flex: none;
}
.topbar .icon-btn:active { background: rgba(255, 255, 255, .15); }
.topbar .icon-btn svg { width: 20px; height: 20px; }

main { padding: 10px 12px 24px; max-width: 600px; margin: 0 auto; }

/* ---------- Grundbausteine ---------- */
.card {
  background: var(--card); border: var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px;
}
.text-btn { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 13px; padding: 4px 0; cursor: pointer; }
.small-btn { font-size: 13px; padding: 0; }
.primary-btn {
  display: block; margin-top: 10px; border: 0; background: var(--brand); color: #fff; font-weight: 600; font-size: 15px;
  padding: 10px 14px; border-radius: 10px; width: 100%; cursor: pointer;
}
.secondary-btn {
  display: block; margin: 8px 0 2px; border: var(--border); background: var(--sunk); color: var(--brand); font-weight: 600; font-size: 14px;
  padding: 9px 14px; border-radius: 10px; width: 100%; cursor: pointer;
}
a.primary-btn, a.secondary-btn { text-align: center; text-decoration: none; }
.primary-btn:active, .secondary-btn:active { opacity: .75; }

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin: 16px 4px 6px; }
.section-head h2 { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.section-head .muted { font-size: 12px; }

/* Linienschild */
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px;
  padding: 0 6px; border-radius: 5px; font-weight: 700; font-size: 13px; color: #fff; background: var(--bus);
  font-variant-numeric: tabular-nums; white-space: nowrap; flex: none; line-height: 1;
}
.badge.citybus { background: var(--citybus); }
.badge.train { background: var(--train); }
.badge.other { background: var(--other); }

/* Steig-Schild */
.platform {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-weight: 700; font-size: 12px; line-height: 1.4;
  background: var(--text); color: var(--card); white-space: nowrap; vertical-align: 1px;
}
.platform.changed { background: var(--bad); color: #fff; }

.delay { font-weight: 600; font-variant-numeric: tabular-nums; }
.delay.ok { color: var(--ok); }
.delay.late { color: var(--warn); }
.delay.verylate { color: var(--bad); }
/* Zu früh: auffällig, weil man den Bus sonst verpasst */
.delay.early { color: #fff; background: var(--bad); padding: 0 4px; border-radius: 4px; }
.cancel-tag { color: var(--bad); font-weight: 600; font-size: 12px; }
.rt-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 4px; vertical-align: 1px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.leg-walk { display: inline-flex; align-items: center; font-size: 12px; color: var(--muted); white-space: nowrap; }
.leg-sep { color: var(--muted); font-size: 10px; opacity: .7; }

/* ---------- Start und Ziel ---------- */
.od[hidden] { display: none; }
.od { margin-bottom: 8px; }
.od-box {
  display: flex; align-items: center; gap: 6px; background: var(--card); border: var(--border); border-radius: var(--radius);
  padding: 2px 6px 2px 0;
}
.od-rows { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.od-row {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; color: var(--text); font: inherit;
  padding: 7px 0 7px 12px; text-align: left; cursor: pointer; min-height: 38px;
}
.od-row + .od-row { border-top: 1px solid var(--line); }
.od-row:active { opacity: .7; }
.od-ico { flex: none; width: 18px; text-align: center; font-size: 13px; color: var(--brand); }
.od-k { flex: none; width: 34px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.od-v { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.od-v.def { font-weight: 500; }
.od-auto {
  flex: none; margin-right: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand);
  border: 1px solid currentColor; border-radius: 999px; padding: 1px 6px; vertical-align: 1px;
}
.home2-current { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.home2-current .text-btn[hidden] { display: none; }
.od-swap {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: var(--border); background: var(--sunk); color: var(--text);
  font-size: 17px; cursor: pointer;
}
.od-swap:active { opacity: .7; }
.od-swap[disabled] { opacity: .4; }
.od-reset { border: 0; background: none; color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 2px 0; cursor: pointer; }
#place-quick { margin-top: 8px; }
#place-results { margin-top: 0; }

/* ---------- Planer-Zeile (Ziel, Zeit, Verkehrsmittel, Bus) ---------- */
.planner { display: flex; gap: 6px; overflow-x: auto; margin: 0 -12px 10px; padding: 0 12px 2px; scrollbar-width: none; }
.planner::-webkit-scrollbar { display: none; }
.planner[hidden] { display: none; }
.chip {
  flex: none; border: var(--border); background: var(--card); color: var(--text); font-weight: 600; font-size: 13px;
  padding: 6px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip:active { opacity: .7; }
.chip[disabled] { opacity: .6; }
.chip-static { cursor: default; color: var(--muted); }
.chip-static:active { opacity: 1; }

/* ---------- Routenkarte ---------- */
.route:empty { display: none; }
.route-card.pinned { box-shadow: inset 0 0 0 1.5px var(--brand); }
.rc-pin {
  display: flex; justify-content: space-between; align-items: center; margin: -4px 0 4px;
  font-size: 12px; font-weight: 600; color: var(--brand);
}
.rc-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rc-go { font-size: 22px; font-weight: 750; letter-spacing: -.015em; line-height: 1.15; }
.rc-go.now { color: var(--bad); }
.go-day { font-size: 14px; font-weight: 600; color: var(--muted); }
.rc-arr { font-size: 14px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-arr b { color: var(--text); }
.rc-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; }
.rc-legs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.rc-sub > .muted { white-space: nowrap; }

/* Einstieg: Haltestelle + Steig vorne, Linie und Richtung darunter, Rest klein */
.rc-board {
  margin-top: 10px; padding: 9px 11px; border-radius: 9px; background: var(--sunk);
  border-left: 3px solid var(--c, var(--bus));
}
.rc-board.walk-only { border-left-color: #6a1b9a; }
.rc-stop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; }
.rc-stop b { font-size: 16px; font-weight: 700; }
.rc-k { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; width: 100%; }
.rc-line { display: flex; align-items: center; gap: 7px; margin-top: 5px; min-width: 0; }
.rc-dir { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-dep { margin-top: 5px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; font-variant-numeric: tabular-nums; }

.rc-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.ghost-btn {
  border: var(--border); background: var(--sunk); color: var(--text); font-weight: 600; font-size: 13px;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.ghost-btn.on { background: var(--text); color: var(--card); border-color: var(--text); }
.ghost-btn:active { opacity: .7; }
.rc-stand {
  margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 11px; padding: 4px 0;
  cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums;
}
/* Ganze Route antippen: Karte und Ablauf klappen darunter auf */
.rc-head { cursor: pointer; -webkit-tap-highlight-color: transparent; outline: none; }
.rc-head:active { opacity: .75; }
.rc-head:focus-visible { box-shadow: 0 0 0 2px var(--brand); border-radius: 8px; }
/* Antippen öffnet die Fahrt im Fenster von unten */
.rc-chev { display: inline-block; margin-left: 6px; font-size: 18px; line-height: 1; color: var(--muted); }
/* Weiterfahrt im Bus klappt weiterhin auf */
.onward-card .rc-chev { transform: rotate(90deg); transition: transform .15s; }
.onward-card.open .rc-chev { transform: rotate(-90deg); }
.route-details { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

/* Zwischenhalte: Linie läuft durch, Halte als kleine Punkte */
.tl.via, .tl.via-stop { padding-bottom: 6px; }
.tl.via .tl-dot::after, .tl.via-stop .tl-dot::after {
  content: ''; position: absolute; top: -7px; bottom: -7px; left: 50%; width: 3px; margin-left: -1.5px; background: var(--c);
}
.tl.via-stop .tl-dot::before {
  content: ''; position: relative; z-index: 1; width: 7px; height: 7px; border-radius: 50%; background: var(--card);
  border: 2px solid var(--c); box-sizing: border-box; margin-top: 4px;
}
.tl.via-stop .tl-body { font-size: 13px; color: var(--muted); }
.tl.via-stop .tl-time { font-size: 11px; }
.via-btn {
  border: 0; background: none; padding: 2px 0; color: var(--brand); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.via-chev { display: inline-block; transform: rotate(90deg); font-size: 14px; line-height: 1; }
.via-btn[aria-expanded="true"] .via-chev { transform: rotate(-90deg); }

.home-chip {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px; font-size: 14px;
}
.notice { font-size: 14px; }
.notice p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* Zeitleiste "Ablauf" */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: grid; grid-template-columns: 42px 16px 1fr; gap: 0 8px; position: relative; padding-bottom: 10px; }
.tl:last-child { padding-bottom: 0; }
.tl-time { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; color: var(--muted); padding-top: 1px; }
.tl-time b { color: var(--text); }
.tl-time .delay { display: block; font-size: 11px; }
.tl-dot { display: grid; place-items: start center; font-size: 12px; position: relative; }
.tl-dot.line::before { content: ''; width: 11px; height: 11px; border-radius: 50%; border: 3px solid var(--c); background: var(--card); box-sizing: border-box; margin-top: 3px; }
.tl.board .tl-dot.line::after { content: ''; position: absolute; top: 14px; bottom: -13px; left: 50%; width: 3px; margin-left: -1.5px; background: var(--c); }
.tl-body { font-size: 13px; min-width: 0; }
.tl-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tl-stop { font-size: 14px; font-weight: 700; line-height: 1.3; }
.tl-line { display: flex; align-items: center; gap: 6px; margin: 3px 0 1px; min-width: 0; }
.tl-dir { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-body .badge { height: 19px; min-width: 26px; font-size: 12px; }
.tl-body .muted.small { font-size: 11px; }

/* ---------- Listen ---------- */
.list { list-style: none; margin: 0 0 10px; padding: 0; background: var(--card); border: var(--border); border-radius: var(--radius); overflow: hidden; }
.list:empty { display: none; }
.list li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; border: 0; background: none;
  text-align: left; cursor: pointer; min-height: 48px;
}
.row:active { background: var(--sunk); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--muted); font-size: 16px; opacity: .6; }
.list .info { padding: 11px 14px; color: var(--muted); font-size: 13px; }
.list.compact .row { min-height: 44px; padding: 8px 12px; }

/* Weitere Fahrten */
.alts-section:empty { display: none; }
.alt-row { min-height: 52px; }
.alt-when { flex: none; width: 42px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: 14px; }
.alt-when .delay { font-size: 11px; }
.alt-legs { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.alt-row .badge { height: 20px; min-width: 28px; font-size: 12px; }
.alt-in { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alt-in b { color: var(--text); }

/* Haltestellen in der Nähe */
.nearby-section .section-head > div { display: flex; flex-direction: column; gap: 2px; }
.search { margin-bottom: 8px; }
.search input, .settings-body input, .notice input {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: var(--border);
  background: var(--card); color: var(--text); font-size: 16px; /* 16px verhindert Zoom auf iOS */
  -webkit-appearance: none; appearance: none;
}
@media (prefers-color-scheme: dark) {
  .search input, .settings-body input, .notice input { background: var(--sunk); }
}

/* ---------- Abfahrten ---------- */
.dep { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 52px; }
/* Abfahrten sind Knöpfe: antippen zeigt den Verlauf des Busses */
button.dep { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.dep:active { background: var(--sunk); }
button.dep.dep-static { cursor: default; }
button.dep.dep-static:active { background: none; }
.dep-main { flex: 1; min-width: 0; }
.dep-dir { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dep-when { text-align: right; font-variant-numeric: tabular-nums; flex: none; }
.dep-in { font-weight: 700; font-size: 14px; }
.dep-time { font-size: 11px; color: var(--muted); }
.dep.cancelled .dep-dir, .dep.cancelled .dep-in { text-decoration: line-through; color: var(--muted); }

/* ---------- Bottom Sheets ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); animation: fade .2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; max-height: 88dvh;
  background: var(--bg); border-radius: 16px 16px 0 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom) + 14px); animation: slide .22s ease-out;
  max-width: 600px; margin: 0 auto; overscroll-behavior: contain;
}
/* Kopfzeile bleibt oben stehen und trägt den Griff: an ihr lässt sich das Fenster immer nach unten wegziehen. */
.sheet-head {
  position: sticky; top: 0; z-index: 5; /* über dem Karten-Knopf beim Scrollen */ display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 18px 8px 8px 16px; background: var(--bg); border-radius: 16px 16px 0 0; touch-action: none;
}
.sheet-head::before {
  content: ''; position: absolute; top: 7px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
  border-radius: 3px; background: var(--muted); opacity: .45;
}
.sheet-title { min-width: 0; }
.sheet-title h2, h2.sheet-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head h2 { font-size: 17px; }
.sheet .list { margin: 0 12px 10px; }
.settings-body { padding: 0 16px; }
.settings-body .list { margin: 8px 0 0; }
.field-label { display: block; font-weight: 700; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 14px; }
.home-current { margin: 4px 0 8px; font-size: 15px; font-weight: 600; }
@keyframes slide { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.segmented { display: flex; gap: 2px; padding: 2px; margin: 6px 0 4px; background: var(--line); border-radius: 9px; }
.segmented button { flex: 1; border: 0; background: none; padding: 6px 6px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented button[aria-checked="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.settings-body > .muted.small { margin: 4px 0 14px; }

/* Zeitauswahl */
.time-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 8px; }
.time-fields label { font-size: 11px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.time-fields input { min-height: 40px; }
.quick-times { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }

/* ---------- Karte ---------- */
.map-wrap { position: relative; margin-bottom: 10px; border-radius: var(--radius); overflow: hidden; border: var(--border); background: var(--card); }
.map-wrap[hidden] { display: none; }
.map-wrap.active { box-shadow: 0 0 0 2px var(--brand); }
/* Eigener Stapelkontext, damit Leaflets hohe z-Indizes nicht über Kopfzeile und Sheets liegen. */
.map { height: 240px; height: min(38vh, 300px); position: relative; z-index: 0; isolation: isolate; background: var(--line); }
.map-fit {
  position: absolute; top: 8px; right: 8px; z-index: 1; width: 32px; height: 32px; border-radius: 8px;
  border: 0; background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); font-size: 15px; cursor: pointer;
}
.map-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 6px 12px; font-size: 11px; color: var(--muted); }
.map-legend:empty { display: none; }
.map-legend i { display: inline-block; width: 16px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 4px; border-radius: 2px; }
.map-legend i.walk { border-top: 3px dotted #6a1b9a; }
@media (prefers-color-scheme: dark) { .map-legend i.walk { border-top-color: #ce93d8; } }
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 1px 3px rgba(0, 0, 0, .35); }
.map-pin { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); font-size: 13px; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 9px !important; }
.leaflet-tooltip.stop-tip { font-size: 11px; padding: 2px 6px; }
/* Haltestellennamen an Ein-, Um- und Ausstieg: klein, mit Kasten, damit sie auf jeder Karte lesbar sind */
.leaflet-tooltip.stop-label {
  font-size: 11px; font-weight: 650; line-height: 1.2; padding: 2px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .92); color: #15171a; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); white-space: nowrap;
}
.leaflet-tooltip.stop-label::before { display: none; }
.map-dark .leaflet-tooltip.stop-label { background: rgba(30, 34, 42, .92); color: #e9ebee; }
/* Dunkelmodus: mit CARTO eigene dunkle Kacheln (Dark Matter); ohne Schlüssel helle OSM-Kacheln abdunkeln */
@media (prefers-color-scheme: dark) {
  .map.tiles-osm .leaflet-tile-pane { filter: brightness(.75) contrast(1.1) saturate(.8); }
  .leaflet-control-attribution { background: rgba(20, 22, 27, .75) !important; color: #aab0b8; }
  .leaflet-control-attribution a { color: #8fc3e6; }
  .leaflet-bar a { background: #23272f; color: #e9ebee; border-bottom-color: #33373f; }
}

/* ---------- Im Bus ---------- */
.ride:empty, #ride-top:empty, #ride-list:empty { display: none; }
.ride-suggest .ride-why { margin: 2px 0 6px; }
.ride-option {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin-top: 6px; text-align: left;
  border: var(--border); border-radius: 9px; background: var(--sunk); cursor: pointer;
}
.ride-option:active { opacity: .75; }
.ride-option-main { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.ride-yes { flex: none; font-weight: 700; color: #fff; background: var(--brand); padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.route-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.route-to { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.ride-card { border-left: 3px solid var(--c); }
.ride-line { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 14px; }
.ride-next { margin-top: 10px; padding: 9px 11px; border-radius: 9px; background: var(--sunk); }
.board-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.board-stop { font-size: 17px; font-weight: 700; line-height: 1.25; margin-top: 1px; }
.ride-next-time { margin-top: 3px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 5px; align-items: baseline; font-variant-numeric: tabular-nums; }
.ride-home { margin-top: 8px; font-size: 13px; }
.ride-list-card { padding: 6px 14px; }
.ride-stops { list-style: none; margin: 0; padding: 0; }
.rs { display: grid; grid-template-columns: 42px 16px 1fr; gap: 0 8px; align-items: center; min-height: 30px; position: relative; }
.rs-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); text-align: right; }
.rs-time .delay { display: block; font-size: 10px; }
.rs-dot { position: relative; align-self: stretch; display: grid; place-items: center; }
/* Linie durch alle Halte */
.rs-dot::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px; background: var(--c); }
.rs:first-child .rs-dot::before { top: 50%; }
.rs:last-child .rs-dot::before { bottom: 50%; }
.rs-dot::after { content: ''; position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--c); box-sizing: border-box; }
.rs-name { font-size: 13px; padding: 5px 0; }
.rs.passed .rs-name, .rs.passed .rs-time { color: var(--muted); opacity: .65; }
.rs.passed .rs-dot::before, .rs.passed .rs-dot::after { opacity: .35; }
.rs.next .rs-name { font-weight: 700; font-size: 14px; }
.rs.next .rs-dot::after { width: 13px; height: 13px; background: var(--c); }
.rs.home .rs-name { font-weight: 650; }
.rs.here .rs-name { color: #1a73e8; font-weight: 700; font-size: 12px; }
.rs-dot.me::after { width: 13px; height: 13px; background: #1a73e8; border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .2); }
.rs-more { padding: 4px 0 2px 50px; }
#ride-map-slot .map-wrap { margin-top: 0; }

/* ---------- Sonstiges ---------- */
.attribution { margin-top: 20px; font-size: 11px; color: var(--muted); text-align: center; }
.help-steps { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.help-steps li { margin: 4px 0; }
.help-steps b { color: var(--text); }
.diag { margin-top: 8px; font-size: 11px; color: var(--muted); }
.diag summary { cursor: pointer; }
.diag dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0 0; }
.diag dt { font-weight: 600; }
.diag dd { margin: 0; word-break: break-all; }

/* Namen der Zwischenhalte (nah herangezoomt): kleiner und dezenter als Ein-/Aus-/Umstieg */
.leaflet-tooltip.stop-label.via-label { font-size: 10px; font-weight: 600; padding: 1px 5px; opacity: .9; }

/* ---------- Weiterfahrt aus dem Bus ---------- */
#ride-onward:empty { display: none; }
.onward-card .route-head { margin-bottom: 6px; }
.onward-targets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.onward-msg { margin: 2px 0 0; }
.onward-search { margin: -4px 0 10px; }
.onward-search .list { margin-top: 6px; }
.onward-alts { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.onward-alt {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 7px 0; cursor: pointer;
  text-align: left; color: var(--text); font: inherit;
}
.onward-alt:active { opacity: .7; }
.onward-alt .alt-legs { flex: none; margin: 0; font-size: 12px; }
.onward-alt .badge { height: 19px; min-width: 26px; font-size: 12px; }
.onward-alt .muted { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.onward-card .rc-actions .muted { flex: 1; min-width: 0; }

/* ---------- Weitere Fahrten: Früher/Später, Detail-Blatt ---------- */
.alt-open .alt-row { background: var(--sunk); box-shadow: inset 3px 0 0 var(--brand); }
.more-btn {
  border: 0; background: none; color: var(--brand); font: inherit; font-weight: 600; font-size: 13px;
  padding: 4px 2px; cursor: pointer; white-space: nowrap;
}
.more-btn:active { opacity: .7; }
.more-btn[disabled] { opacity: .5; }
.alts-foot { display: flex; justify-content: flex-end; margin: -6px 4px 4px; }
.trip-body { padding: 0 12px; }
.trip-card { margin-bottom: 0; }
.trip-legs { margin-top: 0; }
.trip-card .rc-board { margin-top: 10px; }
.trip-map-slot .map-wrap { margin: 10px 0 0; }

/* Merken: überall derselbe kleine Knopf, gemerkt = gefüllt */
.pin-btn {
  flex: none; border: 1px solid var(--brand); background: none; color: var(--brand); font: inherit; font-weight: 600; font-size: 13px;
  padding: 4px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.pin-btn.on { background: var(--brand); color: #fff; }
.pin-btn:active { opacity: .7; }

/* ---------- Schnellwahl (gespeicherte Ziele) ---------- */
.od-quick { display: flex; gap: 6px; overflow-x: auto; margin: 8px -12px 0; padding: 0 12px 2px; scrollbar-width: none; }
.od-quick::-webkit-scrollbar { display: none; }
.od-foot { display: flex; flex-wrap: wrap; gap: 0 14px; }
.place-add { margin-top: 8px; }
.place-add input + input { margin-top: 6px; }
.place-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 44px; }

/* ---------- Umstiege und Hinweise ---------- */
.rc-warn { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--warn); }
.rc-warn.bad { color: var(--bad); }
.tl-tight { color: var(--warn); font-weight: 700; }
.tl-note { font-size: 11px; color: var(--warn); margin-top: 2px; }

.notes { margin-top: 8px; border-radius: 9px; background: var(--sunk); }
.notes-btn {
  display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 7px 10px;
  font: inherit; font-size: 13px; color: var(--text); text-align: left; cursor: pointer;
}
.notes-btn:active { opacity: .7; }
.notes-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.notes-more { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); }
.notes-btn .via-chev { color: var(--muted); }
.notes-btn[aria-expanded="true"] .via-chev { transform: rotate(-90deg); }
.notes-body { padding: 0 10px 8px; }
.note { font-size: 13px; padding: 6px 0; }
.note + .note { border-top: 1px solid var(--line); }
.note p { margin: 3px 0 0; white-space: pre-line; color: var(--muted); font-size: 12px; }
.note a { display: inline-block; margin-top: 4px; color: var(--brand); font-weight: 600; font-size: 12px; text-decoration: none; }

/* ---------- Lieblingshaltestellen ---------- */
.sheet-head-btns { display: flex; gap: 2px; flex: none; }
.fav-btn { font-size: 20px; color: var(--brand); }
#dep-extra { margin: 0 12px 10px; }
#dep-extra:empty { display: none; }
#dep-extra .notes { background: var(--card); border: var(--border); }
#dep-extra > .notes:first-child { margin-top: 0; }
.fav-lines + .notes { margin-top: 10px; }
.fav-lines { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fav-lines-k { width: 100%; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.favs-section:empty { display: none; }
.fav-add { margin-top: 8px; }
.fav-edit { border: 0; background: none; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.fav-edit .row-sub { color: var(--brand); }
/* Lieblingshaltestelle in der Nähe: oben, ohne Antippen */
.near-favs:empty { display: none; }
.near-fav {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  box-shadow: inset 3px 0 0 var(--brand);
}
.near-fav:active { opacity: .8; }
.near-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin-bottom: 2px; }
.near-head b { font-size: 15px; }
.near-k { width: 100%; font-size: 11px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; }
.near-dist { margin-left: auto; }
.fav-row .chev { align-self: center; }
.fav-filter { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.fav-dep { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 13px; }
.fav-dep .badge { height: 19px; min-width: 26px; font-size: 12px; }
.fav-dir { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.fav-when { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.fav-when .delay { font-size: 11px; }
.fav-dep.cancelled .fav-dir { text-decoration: line-through; }

/* Ohne Netz: Kopfzeile grau, darunter steht "Offline · nur Fahrplan" (renderStatus) */
body.is-offline .topbar { background: #5b6470; }

/* ---------- Fingerbedienung: Tippflächen ----------
   Alles, was man antippt, ist mindestens etwa 40–44 px hoch (Apple empfiehlt 44 pt). */
.icon-btn { width: 44px; height: 44px; font-size: 18px; }
.close-btn { font-size: 17px; color: var(--muted); }
.text-btn, .more-btn { padding: 10px 4px; min-height: 40px; }
.section-head { align-items: center; margin: 14px 4px 4px; }
.chip { min-height: 36px; padding: 7px 13px; }
.segmented button { min-height: 38px; }
.od-row { min-height: 46px; }
.od-swap { width: 40px; height: 40px; }
.od-reset { padding: 10px 2px 4px; min-height: 40px; }
.pin-btn { min-height: 36px; padding: 6px 13px; }
.rc-stand { padding: 10px 0 10px 8px; font-size: 12px; }
.via-btn { padding: 8px 0; }
.notes-btn { min-height: 40px; }
.map-fit { width: 40px; height: 40px; font-size: 17px; }
.time-fields input { min-height: 44px; }
.primary-btn { min-height: 46px; }
.secondary-btn { min-height: 44px; }

/* Suchknopf auf der Startseite: sieht aus wie ein Feld, öffnet aber die Vollbild-Suche */
.search-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin-bottom: 8px; padding: 0 12px;
  border: var(--border); border-radius: 10px; background: var(--card); color: var(--muted); font: inherit; font-size: 16px;
  text-align: left; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .search-btn { background: var(--sunk); } }
.search-btn:active { opacity: .7; }

/* Einstellungen: Listen mit eigenem Löschen-Knopf rechts */
.set-list .row { min-height: 52px; }
.row-split { display: flex; align-items: stretch; }
.row-split > .row { flex: 1; min-width: 0; }
.row-static { cursor: default; }
.row-static:active { background: none; }
.row-del {
  flex: none; border: 0; border-left: 1px solid var(--line); background: none; color: var(--bad); font: inherit; font-size: 13px;
  font-weight: 600; padding: 0 14px; min-width: 76px; cursor: pointer;
}
.row-del:active { background: var(--sunk); }
.row-del[hidden] { display: none; }
.row-add .row-title { color: var(--brand); }
.logout-title { color: var(--bad); }
.search-ico { flex: none; width: 24px; text-align: center; font-size: 15px; color: var(--brand); }

/* ---------- Suche als Vollbild ----------
   Höhe und Lage folgen der sichtbaren Fläche über der Tastatur (--vvh/--vvtop aus app.js),
   das Feld steht oben, nur die Vorschläge darunter scrollen. */
/* Fester Hintergrund über die ganze Fläche: auch unter und hinter der Tastatur ist nichts von der App zu sehen.
   Nur beim Wegziehen wird er durchsichtig, dann scheint die App abgedunkelt durch. */
.sheet-full { z-index: 30; background: var(--bg); }
.sheet-full.dragging { background: transparent; }
.sheet-full .search-top { touch-action: none; }
.search-top .close-btn { margin-right: -8px; }
.sheet-full .sheet-panel {
  top: 0; bottom: auto; height: var(--vvh, 100dvh); max-height: none; max-width: none; border-radius: 0;
  transform: translateY(var(--vvtop, 0px)); display: flex; flex-direction: column; overflow: hidden;
  padding: 0; animation: fade .15s;
}
.search-head {
  flex: none; padding: calc(env(safe-area-inset-top) + 8px) 12px 10px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.search-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.search-top h2 { font-size: 17px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#search-input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: var(--border);
  background: var(--card); color: var(--text); font-size: 16px; /* 16px: kein Zoom auf iOS */
  -webkit-appearance: none; appearance: none;
}
@media (prefers-color-scheme: dark) { #search-input { background: var(--sunk); } }
.search-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 10px 0 calc(env(safe-area-inset-bottom) + 20px);
}
.search-body .list { margin: 0 12px 10px; }
.search-body .row { min-height: 52px; }
.search-status { margin: 4px 16px 10px; font-size: 13px; color: var(--muted); }
