/* =====================================================================
   Fahrgastinfo — "Aurora Glass" Design System
   Glassmorphism + animierte Aurora, aufgewertetes Neon-Gruen als Marke.
   Dark & Light Theme ueber [data-theme] am <html>-Element.
   Klassenvertrag zur bestehenden app.js bleibt vollstaendig erhalten.
   ===================================================================== */

/* ---------- Fonts ---------- */
@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap");

/* =====================================================================
   1. Theme-Tokens
   ===================================================================== */
:root {
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", Roboto, Arial, sans-serif;

  /* Marke: aufgewertetes Neon-Gruen (Anker #99C33B) */
  --accent: #a6e22e;
  --accent-hi: #c6ff4d;
  --accent-lo: #4ade80;
  --accent-grad: linear-gradient(135deg, #c6ff4d 0%, #7be88a 45%, #34d399 100%);
  --accent-glow: rgba(166, 226, 46, 0.55);

  /* Rueckwaertskompatible Aliase (werden in CSS/JS referenziert) */
  --bvg-red: var(--accent);
  --bvg-red-tint: rgba(166, 226, 46, 0.14);

  --danger: #ff5a5f;
  --danger-tint: rgba(255, 90, 95, 0.14);
  --warn: #ffb454;

  /* Verkehrsmittel-Farben (semantisch, modernisiert) */
  --vt-bus: #a072ff;
  --vt-sbahn: #22c55e;
  --vt-ubahn: #3b82f6;
  --vt-tram: #ff5a5f;
  --vt-regionalbahn: #f43f5e;
  --vt-faehre: #22d3ee;
}

/* ---------- Dark (Default) ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #060a0b;
  --bg-1: #0b1113;
  --text: #eaf3ec;
  --text-strong: #ffffff;
  --muted: #93a49b;
  --bvg-dark: #eaf3ec;
  --border: rgba(255, 255, 255, 0.10);
  --bg: transparent;

  --glass-bg: rgba(20, 30, 28, 0.55);
  --glass-bg-2: rgba(28, 40, 37, 0.68);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.75), 0 2px 10px rgba(0, 0, 0, 0.4);
  --field-bg: rgba(255, 255, 255, 0.05);
  --field-border: rgba(255, 255, 255, 0.14);

  --aurora-1: #34d399;
  --aurora-2: #a6e22e;
  --aurora-3: #14b8a6;
  --aurora-4: #3b82f6;
  --aurora-alpha: 0.55;
  --grid-alpha: 0.05;
}

/* ---------- Light ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-0: #eef4ee;
  --bg-1: #e4eee6;
  --text: #14251c;
  --text-strong: #06120c;
  --muted: #5d6f64;
  --bvg-dark: #14251c;
  --border: rgba(16, 40, 28, 0.10);
  --bg: transparent;

  --glass-bg: rgba(255, 255, 255, 0.60);
  --glass-bg-2: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 18px 50px -24px rgba(20, 60, 40, 0.45), 0 2px 8px rgba(20, 60, 40, 0.08);
  --field-bg: rgba(255, 255, 255, 0.7);
  --field-border: rgba(16, 40, 28, 0.14);
  --accent: #6cb92e;
  --accent-glow: rgba(108, 185, 46, 0.4);
  --bvg-red-tint: rgba(108, 185, 46, 0.16);

  --aurora-1: #86efac;
  --aurora-2: #d9f99d;
  --aurora-3: #5eead4;
  --aurora-4: #93c5fd;
  --aurora-alpha: 0.7;
  --grid-alpha: 0.04;
}

/* =====================================================================
   2. Reset & Base
   ===================================================================== */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* =====================================================================
   3. Aurora-Hintergrund
   ===================================================================== */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(1200px 800px at 15% -10%, color-mix(in srgb, var(--aurora-2) 22%, transparent), transparent 60%),
    radial-gradient(1000px 700px at 110% 10%, color-mix(in srgb, var(--aurora-4) 18%, transparent), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
}
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: var(--aurora-alpha);
  mix-blend-mode: screen;
  will-change: transform;
}
:root[data-theme="light"] .aurora-blob { mix-blend-mode: multiply; }

.aurora-blob.b1 {
  width: 46vmax; height: 46vmax;
  left: -12vmax; top: -14vmax;
  background: radial-gradient(circle at 30% 30%, var(--aurora-2), transparent 70%);
  animation: drift1 26s ease-in-out infinite alternate;
}
.aurora-blob.b2 {
  width: 40vmax; height: 40vmax;
  right: -14vmax; top: 4vmax;
  background: radial-gradient(circle at 60% 40%, var(--aurora-3), transparent 70%);
  animation: drift2 32s ease-in-out infinite alternate;
}
.aurora-blob.b3 {
  width: 52vmax; height: 52vmax;
  left: 20vmax; bottom: -26vmax;
  background: radial-gradient(circle at 50% 50%, var(--aurora-1), transparent 70%);
  animation: drift3 38s ease-in-out infinite alternate;
}

/* feines technisches Raster + Sternenstaub */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--text) var(--grid-alpha), transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--text) var(--grid-alpha), transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 40%, transparent 100%);
}

@keyframes drift1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(8vmax, 6vmax) scale(1.12); } }
@keyframes drift2 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-7vmax, 8vmax) scale(1.15); } }
@keyframes drift3 { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, -7vmax) scale(1.1); } }

/* =====================================================================
   4. App-Shell (Glass-Panel)
   ===================================================================== */
#app {
  position: relative;
  max-width: 1000px;
  margin: 34px auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  overflow: hidden;
  animation: shellIn 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#app::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, var(--glass-highlight), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

@keyframes shellIn {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* =====================================================================
   5. Topbar
   ===================================================================== */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: linear-gradient(120deg,
      color-mix(in srgb, var(--accent) 22%, transparent),
      transparent 60%);
  border-bottom: 1px solid var(--glass-border);
}
.topbar .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--text-strong);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.topbar .logo::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-grad);
  box-shadow: 0 0 14px 2px var(--accent-glow);
  animation: pulseDot 2.6s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px 1px var(--accent-glow); }
  50% { transform: scale(1.25); box-shadow: 0 0 20px 4px var(--accent-glow); }
}

.topbar-title {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.topbar-titles {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
}
.trip-detail-overview-label { font-size: 12px; color: var(--muted); }
.trip-detail-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--text-strong); }

.back-btn, .gear-btn, .map-pin-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}
.back-btn:hover, .gear-btn:hover, .map-pin-btn:hover:not([disabled]) {
  background: var(--bvg-red-tint);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow), 0 6px 18px -8px var(--accent-glow);
  transform: translateY(-1px);
}
.gear-btn:active, .back-btn:active { transform: scale(0.94); }
.map-pin-btn[disabled] { opacity: 0.4; cursor: default; }

/* =====================================================================
   6. Settings-Panel + Theme-Toggle
   ===================================================================== */
.settings-panel {
  background: var(--glass-bg-2);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 20px;
  animation: dropIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 8px 0;
}
.settings-row + .settings-row { border-top: 1px solid var(--border); }
.hint { color: var(--muted); font-size: 13px; padding: 8px 20px 12px; }
.error-text { color: var(--danger); font-size: 13px; padding: 12px 6px; }
.feed-error {
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 13px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--glass-border);
}

/* iOS-artiger Toggle-Switch (fuer Countdown & Theme) */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.switch .thumb {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch input:checked ~ .track { background: var(--accent-grad); box-shadow: 0 0 14px -2px var(--accent-glow); }
.switch input:checked ~ .thumb { transform: translateX(20px); }

.theme-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--field-bg);
  border: 1px solid var(--field-border);
}
.theme-seg button {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.theme-seg button.active {
  color: #05120b;
  background: var(--accent-grad);
  box-shadow: 0 0 12px -3px var(--accent-glow);
}
:root[data-theme="dark"] .theme-seg button.active { color: #05120b; }

/* =====================================================================
   7. Content & Navigation
   ===================================================================== */
.content { flex: 1; order: 2; padding-bottom: 28px; }

.bottom-nav {
  order: 1;
  position: static;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid var(--glass-border);
}
.nav-item {
  position: relative;
  flex: 0 0 auto;
  border: none;
  background: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.nav-item:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-item.active {
  color: var(--accent);
  background: var(--bvg-red-tint);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent);
}
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 4px;
  width: 18px; height: 3px;
  border-radius: 3px;
  background: var(--accent-grad);
  box-shadow: 0 0 10px 1px var(--accent-glow);
  transform: translateX(-50%);
  animation: navGlow 0.4s ease both;
}
@keyframes navGlow { from { width: 0; opacity: 0; } to { width: 18px; opacity: 1; } }
.nav-item:disabled { color: color-mix(in srgb, var(--muted) 50%, transparent); cursor: default; }

/* Views einblenden */
.content > .view { max-width: 720px; margin: 0 auto; animation: viewIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   8. Formularfelder & Buttons
   ===================================================================== */
.stop-input, .time-input, .date-input {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.stop-input { flex: 1; padding: 13px 14px; font-size: 14px; }
.time-input, .date-input { padding: 8px 10px; font-size: 13px; }
.stop-input::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.stop-input:focus, .time-input:focus, .date-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 18px -6px var(--accent-glow);
  background: color-mix(in srgb, var(--field-bg) 60%, transparent);
}

.search-btn {
  width: 100%;
  margin-top: 16px;
  background: var(--accent-grad);
  color: #05130b;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 30px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.search-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.5); filter: brightness(1.05); }
.search-btn:active { transform: translateY(0) scale(0.99); }

.add-via-btn {
  margin-top: 10px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.add-via-btn:hover { opacity: 0.8; transform: translateX(2px); }

/* =====================================================================
   9. Routes-View
   ===================================================================== */
.routes-view { padding: 24px; }
.route-form { display: flex; gap: 12px; }
.markers-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 26px;
  padding-top: 12px;
}
.stop-marker {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; color: #05130b;
}
.stop-marker.a { background: var(--accent-grad); box-shadow: 0 0 14px -2px var(--accent-glow); }
.stop-marker.b { background: var(--text); color: var(--bg-0); }
.stop-marker.via { background: var(--muted); color: var(--bg-0); }
.connector-line { flex: 1; width: 2px; background: linear-gradient(var(--border), var(--border)); min-height: 20px; }

.inputs-col { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.stop-row { display: flex; align-items: center; gap: 6px; position: relative; }
.via-row { position: relative; }
.remove-via {
  border: none; background: none; color: var(--muted);
  font-size: 18px; cursor: pointer; line-height: 1;
  transition: color 0.2s ease, transform 0.15s ease;
}
.remove-via:hover { color: var(--danger); transform: scale(1.15); }

.time-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; font-size: 13px; color: var(--muted);
}
.time-row-label { flex: 1; font-weight: 500; }

.results-bar {
  margin-top: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

/* ---------- Route-Cards ---------- */
.route-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.route-card {
  position: relative;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px;
  cursor: pointer;
  background: var(--glass-bg-2);
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s ease, box-shadow 0.25s ease;
  animation: cardIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.route-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.route-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 18px 40px -18px var(--accent-glow);
}
.route-card:hover::before { opacity: 1; }
.route-card:active { transform: translateY(-1px) scale(0.995); }
.route-results > .route-card:nth-child(1) { animation-delay: 0.02s; }
.route-results > .route-card:nth-child(2) { animation-delay: 0.08s; }
.route-results > .route-card:nth-child(3) { animation-delay: 0.14s; }
.route-results > .route-card:nth-child(4) { animation-delay: 0.20s; }
.route-results > .route-card:nth-child(5) { animation-delay: 0.26s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.route-times {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; color: var(--text-strong);
}
.route-arrow { color: var(--muted); font-weight: 400; }
.leg-dest { color: var(--muted); flex: 1; }
.leg-platform { font-weight: 700; font-size: 12px; color: var(--muted); }

/* Route-Linie: farbige Signal-Adern mit fliessenden Lichtpulsen */
.route-line { display: grid; align-items: center; margin-top: 16px; }
.route-line-badge {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 9px; font-weight: 700; color: #fff;
  z-index: 1; justify-self: center;
  background: var(--vt, var(--vt-bus));
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--vt, var(--vt-bus)) 16%, transparent),
    0 0 16px -2px var(--vt, var(--vt-bus));
}
.route-line-seg {
  position: relative;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--vt, var(--border)) 38%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--vt, var(--border)) 30%, transparent);
}
.route-line-seg::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: -45%;
  width: 45%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--vt, #fff), #fff, var(--vt, #fff), transparent);
  filter: blur(0.5px);
  animation: segFlow 2s linear infinite;
  animation-delay: var(--flow-delay, 0s);
}
@keyframes segFlow {
  0% { transform: translateX(0); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateX(340%); opacity: 0; }
}
.route-line-end-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg-1);
  border: 3px solid var(--text);
  justify-self: center;
  box-shadow: 0 0 10px -2px color-mix(in srgb, var(--text) 45%, transparent);
}
.route-line-labels { display: grid; margin-top: 7px; }
.line-pill {
  justify-self: center; color: #fff; font-family: var(--font-display);
  font-weight: 700; font-size: 11px; padding: 3px 10px; border-radius: 7px;
  background: var(--vt, var(--vt-bus));
  box-shadow: 0 2px 12px -3px var(--vt, var(--vt-bus));
}

.route-meta-row { display: flex; gap: 18px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.route-meta-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.route-meta-icon { flex-shrink: 0; }

.route-occupancy-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.route-notice-row {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 13px; color: var(--warn); font-weight: 600;
}
.route-notice-icon { flex-shrink: 0; color: var(--warn); }

/* =====================================================================
   10. Route-Detail
   ===================================================================== */
.route-detail-view { padding: 0; }
.route-detail-summary { padding: 20px; }
.route-detail-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.route-detail-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border); cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.route-detail-dot:hover { transform: scale(1.3); }
.route-detail-dot.active { background: var(--accent); box-shadow: 0 0 10px 1px var(--accent-glow); width: 22px; border-radius: 5px; }
.route-detail-timeline { padding: 0 20px; --tl-inset: 20px; }

.trip-timeline-leg-row { padding-top: 8px; padding-bottom: 8px; }
.leg-row-spacer { background: transparent !important; box-shadow: none !important; border: none !important; }
.trip-leg-pill-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trip-leg-meta { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* Aufklappbares Leg + Zwischenhalte */
.leg-expandable { cursor: pointer; }
.leg-expandable .trip-timeline-content {
  border-radius: 12px;
  margin: -6px -8px; padding: 6px 8px;
  transition: background 0.18s ease;
}
.leg-expandable:hover .trip-timeline-content {
  background: color-mix(in srgb, var(--vt, var(--accent)) 12%, transparent);
}
.leg-expand-chevron { display: inline-flex; margin-left: auto; color: var(--muted); transition: transform 0.25s ease; }
.leg-expanded .leg-expand-chevron { transform: rotate(180deg); }
.leg-expand-hint { color: var(--vt, var(--accent)); font-weight: 600; }

.tl-via-row { padding-top: 9px; padding-bottom: 9px; animation: viaIn 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.tl-via-row .trip-timeline-time-name strong { min-width: 52px; font-size: 14px; color: var(--muted); }
.tl-via-row .trip-timeline-time-name span { font-size: 14px; color: var(--text); }
.trip-timeline-dot.tl-via-dot {
  width: 9px; height: 9px; border-width: 2px;
  box-shadow: 0 0 8px -2px var(--vt, var(--accent));
  opacity: 0.92; margin-top: 7px;
}
@keyframes viaIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.trip-transfer-row { padding-top: 10px; padding-bottom: 10px; }
.transfer-dot {
  background: transparent !important; box-shadow: none !important; border: none !important;
  width: 22px !important; height: 22px !important;
  font-size: 14px; display: flex; align-items: center; justify-content: center; margin-top: 0 !important;
}
.trip-transfer-label { font-size: 13px; color: var(--muted); font-style: italic; }

.route-notice-box {
  display: flex; gap: 10px; margin: 6px 0 6px 40px; padding: 14px;
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: 12px;
}
.route-notice-title { font-weight: 700; font-size: 13px; color: var(--warn); }
.route-notice-body { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* =====================================================================
   11. Verkehrsmittel-Badges & Delays (shared)
   ===================================================================== */
.vt-bus { --vt: var(--vt-bus); }
.vt-sbahn { --vt: var(--vt-sbahn); }
.vt-ubahn { --vt: var(--vt-ubahn); }
.vt-tram { --vt: var(--vt-tram); }
.vt-regionalbahn, .vt-ice { --vt: var(--vt-regionalbahn); }
.vt-faehre { --vt: var(--vt-faehre); }

.mode-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 21px; padding: 0 7px; border-radius: 7px;
  font-family: var(--font-display);
  font-size: 11px; font-weight: 700; color: #fff;
  background: var(--vt, var(--vt-bus));
  box-shadow: 0 0 12px -3px var(--vt, var(--vt-bus));
}
.line-number { font-family: var(--font-display); font-weight: 700; font-size: 13px; margin-left: 5px; color: var(--text); }

.delay { font-size: 12px; font-weight: 700; margin-left: 4px; }
.delay.late { color: var(--danger); }
.delay.early { color: var(--accent-lo); }
.delay.cancelled { color: var(--danger); text-decoration: line-through; }

/* =====================================================================
   12. Departures-View
   ===================================================================== */
.departures-view { padding: 24px; }
.stop-search-row { display: flex; gap: 8px; align-items: center; position: relative; }
.stop-search-row .stop-input { flex: 1; }
.departures-search-btn { width: auto; margin-top: 0; padding: 13px 20px; flex: 0 0 auto; }

.tabbar { display: flex; margin-top: 18px; gap: 4px; padding: 4px; border-radius: 14px; background: var(--field-bg); border: 1px solid var(--field-border); }
.tab {
  flex: 1; border: none; background: none; padding: 10px;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.tab.active {
  color: #05130b;
  background: var(--accent-grad);
  box-shadow: 0 0 14px -4px var(--accent-glow);
}
:root[data-theme="dark"] .tab.active { color: #05130b; }

.date-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.date-bar .results-bar { margin: 0; border-bottom: none; padding-bottom: 0; }

.board-group-header {
  color: var(--muted); font-family: var(--font-display);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 14px 4px 6px;
}
.board-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 12px;
  margin: 4px 0;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  background: color-mix(in srgb, var(--glass-bg-2) 55%, transparent);
  transition: transform 0.16s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  animation: rowIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.board-row:hover {
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 10px 26px -16px var(--accent-glow);
}
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.board-dest { flex: 1; font-size: 14px; font-weight: 500; color: var(--text); }
.board-platform { font-size: 13px; font-weight: 700; color: var(--muted); }
.board-platform.cancelled { color: var(--danger); }
/* Pfeile zwischen Badge -> Linie -> Ziel */
.board-arrow { color: var(--muted); font-size: 13px; font-weight: 700; opacity: 0.7; }
.board-row .line-number, .board-row-head .line-number { margin-left: 0; }
/* Sternchen fuer Fahrten am Folgetag + Legende */
.off-day-star { color: var(--accent); font-weight: 800; font-size: 0.72em; margin-left: 1px; }
.board-legend { margin: 10px 4px 2px; font-size: 12px; color: var(--muted); }
.board-legend .off-day-star { font-size: 1em; }

/* Zusammengefasste Zeile (gleiche Linie & Ziel, mehrere Abfahrten) */
.board-row-merged { flex-direction: column; align-items: stretch; gap: 8px; }
.board-row-head { display: flex; align-items: center; gap: 10px; }
.board-count {
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  color: var(--accent);
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.board-merged-times {
  display: flex; flex-wrap: nowrap; align-items: baseline; gap: 2px 4px;
  padding-left: 2px; overflow: hidden; white-space: nowrap;
}
.board-merged-times .time { min-width: 0; text-align: left; }
.board-times-sep { color: var(--muted); }
.time { font-family: var(--font-display); font-size: 14px; font-weight: 700; min-width: 74px; text-align: right; color: var(--text-strong); }
.cancelled-time { text-decoration: line-through; color: var(--danger); }

/* =====================================================================
   13. Trip-Detail (Perlenschnur)
   ===================================================================== */
.trip-detail-view { padding: 0; }
.trip-card { padding: 20px; }

.trip-timeline-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.trip-mode-badge {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%;
  background: var(--vt, var(--vt-bus)); color: #fff;
  font-family: var(--font-display);
  font-weight: 700; font-size: 11px; letter-spacing: 0.02em;
  display: grid; place-items: center;
  box-shadow: 0 0 20px -4px var(--vt, var(--vt-bus));
}
.trip-line-number {
  background: var(--vt, var(--vt-bus)); color: #fff;
  font-family: var(--font-display);
  font-weight: 700; padding: 6px 15px; border-radius: 10px; font-size: 15px;
  box-shadow: 0 2px 14px -4px var(--vt, var(--vt-bus));
}
.trip-line-dest { font-size: 19px; font-weight: 500; color: var(--text-strong); }
.trip-platform { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); }

.trip-info-row { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.trip-info-icon {
  width: 24px; height: 24px; flex-shrink: 0;
  border: 1.5px solid var(--muted); border-radius: 7px;
  display: grid; place-items: center; font-size: 12px; font-style: italic; font-weight: 700;
}
.trip-divider { border-top: 1px solid var(--border); margin: 0 -20px 4px; }

.trip-timeline { position: relative; --tl-pad-x: 20px; }
.trip-timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 16px;
  align-items: start;
  margin: 0 calc(-1 * var(--tl-pad-x));
  padding: 18px var(--tl-pad-x);
  border-bottom: 1px solid var(--border);
}
.trip-timeline-row:last-child { border-bottom: none; }
.trip-timeline-row::before {
  content: "";
  position: absolute; left: calc(var(--tl-pad-x, 20px) + 11px); top: 0; bottom: 0;
  transform: translateX(-50%);
  width: 3px; border-radius: 3px;
  z-index: 0;
  background-color: var(--vt, color-mix(in srgb, var(--muted) 42%, transparent));
  background-image: linear-gradient(180deg, transparent 0%, color-mix(in srgb, #fff 85%, transparent) 50%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 100% 38%;
  background-position: 0 -45%;
  box-shadow: 0 0 8px -2px var(--vt, transparent);
  animation: tlFlow 2.6s linear infinite;
}
@keyframes tlFlow {
  0% { background-position: 0 -45%; }
  100% { background-position: 0 145%; }
}
.trip-timeline-row.tl-row-first::before { top: 29.5px; }
.trip-timeline-row.tl-row-last::before { bottom: auto; height: 29.5px; }
.trip-timeline-row.tl-row-first.tl-row-last::before { display: none; }

/* Umstieg (zu Fuss): gepunktete, neutrale Ader statt Signal-Fluss */
.trip-transfer-row::before {
  background: repeating-linear-gradient(180deg,
    color-mix(in srgb, var(--muted) 60%, transparent) 0 3px,
    transparent 3px 9px);
  box-shadow: none;
  animation: none;
  opacity: 0.75;
}

.trip-timeline-dot {
  position: relative; z-index: 2;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg-1);
  border: 3px solid var(--vt, var(--accent));
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--vt, var(--accent)) 14%, transparent),
    0 0 12px -1px var(--vt, var(--accent));
  margin-top: 5px; justify-self: center;
}

/* ---- Live-Fortschritt der Perlenschnur ---- */
.tl-progress-fill {
  position: absolute;
  left: calc(var(--tl-inset, 0px) + 11px);
  transform: translateX(-50%);
  width: 3px; border-radius: 3px;
  background: color-mix(in srgb, var(--muted) 78%, var(--bg-1));
  z-index: 1;
  pointer-events: none;
  transition: height 0.6s linear, top 0.6s linear;
}
.trip-bus-marker {
  position: absolute;
  left: calc(var(--tl-inset, 0px) + 11px);
  width: 20px; height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--accent-grad);
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent), 0 0 18px 2px var(--accent-glow);
  z-index: 4;
  display: grid; place-items: center;
  pointer-events: none;
  transition: top 0.6s linear;
}
.trip-bus-marker::before {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: busPulse 1.8s ease-out infinite;
}
@keyframes busPulse {
  0% { transform: scale(1); opacity: 0.75; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* aktueller Halt (Bus wartet hier): bleibt voll sichtbar, nicht gedimmt */
.trip-timeline-row.is-current .trip-timeline-content { opacity: 1; }
.trip-timeline-row.is-current .trip-timeline-time-name span { font-weight: 600; }

/* passierter Abschnitt: Halte gedimmt, Punkte neutralgrau */
.trip-timeline-row.is-passed .trip-timeline-content { opacity: 0.5; }
.trip-timeline-row.is-passed > .trip-timeline-dot {
  border-color: color-mix(in srgb, var(--muted) 72%, transparent);
  background: var(--bg-1);
  box-shadow: none;
}
.trip-timeline-row.is-passed.tl-row-first > .trip-timeline-dot,
.trip-timeline-row.is-passed.tl-row-last > .trip-timeline-dot {
  background: color-mix(in srgb, var(--muted) 72%, transparent);
}
.trip-timeline-row.is-passed.tl-row-first > .trip-timeline-dot::after { display: none; }
.trip-timeline-row.tl-row-first > .trip-timeline-dot,
.trip-timeline-row.tl-row-last > .trip-timeline-dot {
  background: var(--vt, var(--accent));
}
.trip-timeline-row.tl-row-first > .trip-timeline-dot::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--vt, var(--accent));
  animation: dotPulse 2.2s ease-out infinite;
}
@keyframes dotPulse {
  0% { transform: scale(0.7); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}
.trip-timeline-content { min-width: 0; }
.trip-timeline-time-name { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.trip-timeline-time-name strong { min-width: 56px; font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text-strong); }
.trip-timeline-time-name span { font-size: 16px; color: var(--text); }
/* Ankunft ueber Abfahrt, wenn sie sich um >= 1 Minute unterscheiden */
.trip-timeline-time-name .tl-time-stack {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  gap: 1px; line-height: 1.12;
}
.tl-time-stack .tl-time-arr,
.tl-time-stack .tl-time-dep { font-size: 16px; font-weight: 700; color: var(--text-strong); }
/* Gestrichene Zeit (nur Ein-/Ausstieg bzw. Halt entfällt) - rot durchgestrichen.
   Hoehere Spezifitaet, damit die rote Farbe die Standard-Zeitfarbe schlaegt. */
.tl-time-struck { text-decoration: line-through; opacity: 0.9; }
.trip-timeline-time-name .tl-time-struck,
.trip-timeline-time-name .tl-time-stack .tl-time-struck { color: var(--danger); }

/* Halt entfällt: Name rot durchgestrichen + Label */
.stop-entfaellt .trip-stop-name { text-decoration: line-through; color: var(--danger); }
.stop-entfaellt .trip-timeline-dot { border-color: var(--danger); }
.trip-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; font-weight: 700; }
.trip-status-entfaellt { color: var(--danger); }
.trip-status-nurEinstieg, .trip-status-nurAusstieg, .trip-status-zusatzhalt { color: var(--warning, #d98a00); font-weight: 600; }
.trip-status .status-icon { flex: 0 0 auto; }

/* Info-Hinweise pro Halt (mit Icon) */
.stop-infos { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.stop-info { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
.stop-info-ic { display: inline-flex; color: var(--accent); }
.trip-stop-name-strong { font-weight: 700; }
.trip-occupancy { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.trip-timeline-note { margin-top: 6px; font-size: 13px; color: var(--muted); }
/* Umschilderung: "Verkehrt ab hier als Linie X in Richtung Y" */
.trip-resign {
  margin-top: 8px; padding: 7px 11px;
  font-size: 13px; line-height: 1.35;
  color: var(--text);
  background: color-mix(in srgb, var(--vt, var(--accent)) 14%, transparent);
  border-left: 3px solid var(--vt, var(--accent));
  border-radius: 8px;
}
.trip-resign strong { color: var(--text-strong); font-weight: 700; }

/* Occupancy-Icon an Theme anpassen */
.trip-occupancy-icon circle, .trip-occupancy-icon path { transition: fill 0.2s ease; }

/* =====================================================================
   14. Custom-Autocomplete (bessere Suche)
   ===================================================================== */
.ac-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 264px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 16px;
  background: var(--glass-bg-2);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  animation: dropIn 0.2s ease both;
}
.ac-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ac-item:hover, .ac-item.active { background: var(--bvg-red-tint); }
.ac-pin { flex: 0 0 auto; color: var(--accent); opacity: 0.9; }
.ac-name { flex: 1; font-size: 14px; color: var(--text); }
.ac-name strong { color: var(--accent); font-weight: 700; }
.ac-lines { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 46%; }
.ac-line-pill {
  font-family: var(--font-display);
  font-size: 9px; font-weight: 700; color: #fff;
  padding: 2px 6px; border-radius: 5px;
  background: var(--vt, var(--vt-bus));
}
.ac-empty { padding: 12px; font-size: 13px; color: var(--muted); text-align: center; }
.ac-panel::-webkit-scrollbar { width: 8px; }
.ac-panel::-webkit-scrollbar-thumb { background: var(--field-border); border-radius: 8px; }

/* =====================================================================
   15. Mobile (Handy)
   ===================================================================== */
@media (max-width: 700px) {
  #app {
    max-width: 520px;
    margin: 0 auto;
    min-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  #app::before { display: none; }
  .topbar { padding: 16px 18px; }

  .content { order: 1; padding-bottom: 88px; }
  .content > .view { max-width: none; margin: 0; }
  .routes-view, .departures-view { padding: 18px; }

  .bottom-nav {
    order: 2;
    position: sticky;
    bottom: 0;
    justify-content: stretch;
    gap: 2px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--glass-border);
    border-bottom: none;
    background: var(--glass-bg-2);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
  }
  .nav-item { flex: 1; padding: 10px 4px; font-size: 11px; border-radius: 10px; }
  .nav-item.active::after { bottom: 2px; }

  .route-results { grid-template-columns: 1fr; }
  .date-bar { flex-wrap: wrap; }
  .route-detail-summary { padding: 16px; }
  .route-detail-timeline { padding: 0 16px; --tl-inset: 16px; }
  .route-notice-box { margin-left: 32px; }
  .route-meta-row { gap: 14px; }
  .trip-card { padding: 16px; }
  .trip-timeline { --tl-pad-x: 16px; }
  .trip-divider { margin: 0 -16px 4px; }
}

/* =====================================================================
   16. Reduced Motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
