/* ═══════════════════════════════════════════════════════════════════════════
   karte.bayern Navigation UI  –  complete redesign
   Map-first layout: map is always full-screen, all chrome floats on top
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #0a0e1a;
  color: #e8eaed;
}

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --surface-1:     rgba(12, 16, 30, 0.94);
  --surface-2:     rgba(22, 27, 46, 0.97);
  --surface-3:     rgba(31, 37, 58, 0.98);
  --border:        rgba(255,255,255,0.08);
  --text-1:        #f0f4ff;
  --text-2:        #c4cce0;
  --text-3:        #7a8aaa;
  --radius-sm:     8px;
  --radius-md:     12px;
  --radius-lg:     18px;
  --radius-xl:     22px;
  --shadow-sm:     0 4px 12px rgba(0,0,0,0.24);
  --shadow-md:     0 8px 24px rgba(0,0,0,0.34);
  --shadow-lg:     0 16px 40px rgba(0,0,0,0.46);
  --topbar-h:      56px;
  --panel-w:       380px;
}

/* Themed variants */
.theme-einsatz { --primary: #b91c1c; }
.theme-wellness { --primary: #0d9488; }
.theme-speise   { --primary: #d97706; }

/* Utility */
.hidden { display: none !important; }

/* ── Root layout ────────────────────────────────────────────────────────── */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Full-screen map */
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOP BAR  – frosted glass pill/bar sitting above the map
   ═══════════════════════════════════════════════════════════════════════════ */
.topbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  height: var(--topbar-h);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 0 8px;
  transition: box-shadow 0.2s;
}

/* Hamburger / menu button */
.topbar-menu {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-1);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.topbar-menu:hover { background: rgba(255,255,255,0.06); }
.topbar-menu:active { background: rgba(255,255,255,0.1); }
.topbar-menu:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Search pill (expands to fill remaining space) */
.topbar-search-pill {
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  color: var(--text-3);
  font-size: 14px;
  cursor: text;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}
.topbar-search-pill:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.12);
  color: var(--text-2);
}
.topbar-search-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Settings gear button */
.topbar-settings {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.topbar-settings:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-1);
}
.topbar-settings:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.settings-panel {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + var(--topbar-h) + 8px);
  right: 12px;
  z-index: 1300;
  width: min(320px, calc(100vw - 24px));
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideDown 0.2s ease both;
}
.settings-panel.hidden { display: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.settings-header h3 { font-size: 14px; font-weight: 600; color: var(--text-1); }
.settings-content { padding: 16px; display: grid; gap: 18px; }
.setting-group label:first-child {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.setting-group select {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
}
.setting-group input {
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
}
.map-mode-switcher { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-btn {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-2); }
.mode-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.toggle-list { display: grid; gap: 10px; }
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.toggle input { width: 15px; height: 15px; accent-color: var(--primary); }
.ab-variant-list { display: grid; gap: 8px; }
.ab-reset-btn { width: 100%; }
.anna-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.setting-help {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.btn-icon {
  background: rgba(255,255,255,0.04);
  border: none;
  border-radius: 6px;
  padding: 5px;
  cursor: pointer;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.btn-icon:hover { background: rgba(255,255,255,0.08); }

/* ═══════════════════════════════════════════════════════════════════════════
   ROUTE PANEL  (slide-over from left on mobile; always visible on desktop)
   ═══════════════════════════════════════════════════════════════════════════ */
.route-panel {
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + var(--topbar-h) + 12px);
  left: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: var(--panel-w);
  max-width: calc(100vw - 24px);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), box-shadow 0.28s ease;
}

/* Mobile: hidden off-screen by default */
@media (max-width: 900px) {
  .route-panel {
    top: 0;
    left: 0;
    bottom: 0;
    width: min(360px, 88vw);
    max-width: none;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    border-left: none;
    transform: translateX(-105%);
    box-shadow: none;
  }
  .route-panel.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg), 8px 0 60px rgba(0,0,0,0.5);
  }
}

/* Panel header */
.rp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--primary) 0%,
    color-mix(in srgb, var(--primary) 75%, #060b1a 25%) 100%);
  flex-shrink: 0;
}
.rp-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rp-logo img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255,255,255,0.12);
}
.rp-logo-text { display: flex; flex-direction: column; }
.rp-logo-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.rp-logo-sub { font-size: 11px; color: rgba(255,255,255,0.7); }
.rp-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  color: rgba(255,255,255,0.9);
  cursor: pointer;
  transition: background 0.15s;
}
.rp-close:hover { background: rgba(255,255,255,0.22); }
/* Hide close button on desktop (panel is always visible) */
@media (min-width: 901px) { .rp-close { display: none; } }

/* Scrollable body */
.rp-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.14) transparent;
}
.rp-body::-webkit-scrollbar { width: 8px; }
.rp-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Cards inside panel */
.rp-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.rp-nav-card {
  background: linear-gradient(135deg,
    rgba(37,99,235,0.1) 0%, rgba(16,30,60,0.14) 100%);
  border-color: rgba(37,99,235,0.22);
}

/* ── Waypoint input stack ────────────────────────────────────────────────── */
.wp-stack { display: grid; gap: 0; position: relative; }

.wp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* Dot / pin indicators */
.wp-dot {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.wp-dot-start::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  display: block;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.22);
}
.wp-dot-end { color: #ef4444; }

.wp-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.wp-input::placeholder { color: var(--text-3); }
.wp-input:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

/* Vertical connector with swap button */
.wp-connector {
  display: flex;
  align-items: center;
  padding: 3px 0 3px 9px;
  position: relative;
  gap: 0;
}
.wp-vline {
  width: 1px;
  height: 18px;
  background: linear-gradient(to bottom, rgba(34,197,94,0.5), rgba(239,68,68,0.5));
  margin-right: auto;
}
.wp-swap {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.wp-swap:hover {
  background: rgba(37,99,235,0.18);
  border-color: rgba(37,99,235,0.4);
  color: var(--text-1);
}

/* ── Suggestions dropdown ──────────────────────────────────────────────── */
.suggestions { position: relative; }

.suggestions-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 30px;
  right: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 280px;
  overflow-y: auto;
  z-index: 2000;
  box-shadow: var(--shadow-md);
}
.suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: rgba(37,99,235,0.16); }
.suggestion-item.is-active {
  background: rgba(37,99,235,0.18);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.28);
}
.suggestion-item.is-preview { background: rgba(37,99,235,0.16); box-shadow: inset 0 0 0 1px rgba(96,165,250,0.24); }
.suggestion-label { font-size: 14px; font-weight: 500; color: var(--text-1); }
.suggestion-tags  { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.suggestion-extra { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.suggestion-coords { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── Quick action row ──────────────────────────────────────────────────── */
.rp-quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.rp-qbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.rp-qbtn:hover {
  background: rgba(37,99,235,0.14);
  border-color: rgba(37,99,235,0.3);
  color: var(--text-1);
}

/* ── Primary action buttons ────────────────────────────────────────────── */
.rp-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-primary {
  flex: 1;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,0.35);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 18px rgba(37,99,235,0.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--text-2);
  border: 1px solid rgba(255,255,255,0.09);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.09);
  color: var(--text-1);
}
.btn-ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Square clear / icon button */
.rp-clear {
  flex: none;
  width: 42px;
  padding: 0;
}

/* ── Options ───────────────────────────────────────────────────────────── */
.rp-opts { display: grid; gap: 8px; }

.opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.opt-row input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }
.opt-label { line-height: 1.3; }

.follow-row {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.follow-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-3);
}
.follow-badge.active { background: rgba(34,197,94,0.18); color: #86efac; }

.map-mode-hint {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  max-width: min(560px, calc(100% - 32px));
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(15,23,42,0.88);
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  border: 1px solid rgba(148,163,184,0.2);
  box-shadow: 0 10px 25px rgba(15,23,42,0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 1120;
}

.map-mode-hint.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Tradeoff slider */
.tradeoff-wrap { display: grid; gap: 6px; }
.tradeoff-label { font-size: 12px; color: var(--text-3); }
.rp-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ── Route result & steps ──────────────────────────────────────────────── */
.result {
  display: none;
  padding: 12px;
  background: rgba(37,99,235,0.08);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
}
.result-title { font-size: 14px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; }
.result-stats { font-size: 13px; color: var(--text-3); line-height: 1.6; }
.result-stats strong { color: var(--text-1); }
.result-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.result-kpi {
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.28);
  border: 1px solid rgba(148,163,184,0.16);
}
.result-kpi-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 5px;
}
.result-kpi-value {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}
.route-help {
  display: none;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148,163,184,0.16);
}
.route-help-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 6px;
}
.route-help-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}
.route-alt-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.route-alt-card {
  width: 100%;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(255,255,255,0.04);
  color: var(--text-1);
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.route-alt-card:hover {
  border-color: rgba(96,165,250,0.4);
  background: rgba(37,99,235,0.1);
}
.route-alt-card.active {
  border-color: rgba(96,165,250,0.65);
  background: rgba(37,99,235,0.16);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.28);
}
.route-alt-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--route-color, #60a5fa);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.route-alt-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.route-alt-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.route-alt-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.route-alt-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #dbeafe;
  background: rgba(37,99,235,0.2);
  border: 1px solid rgba(96,165,250,0.28);
}
.route-alt-meta {
  font-size: 12px;
  color: var(--text-3);
}
.route-result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.shared-route-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15,23,42,0.92), rgba(30,41,59,0.96));
  border: 1px solid rgba(96,165,250,0.24);
  box-shadow: 0 10px 28px rgba(15,23,42,0.18);
}
.shared-route-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 6px;
}
.shared-route-title {
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
}
.shared-route-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #cbd5e1;
}
.shared-route-copy {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #e2e8f0;
}
.route-steps { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.route-steps-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 6px;
}
.route-steps ol { margin: 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.route-steps li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148,163,184,0.08);
}
.route-steps li:last-child { border-bottom: none; }
.route-steps li.active {
  background: rgba(37,99,235,0.12);
  border-radius: 12px;
  padding-left: 8px;
  padding-right: 8px;
  border-bottom-color: transparent;
}
.route-steps li.active .step-icon {
  background: rgba(37,99,235,0.24);
  color: #dbeafe;
}
.route-steps li.active .step-text {
  color: var(--text-1);
}
.route-steps li.done {
  opacity: 0.55;
}
.step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37,99,235,0.12);
  color: #93c5fd;
  font-size: 13px;
}
.step-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.step-text { color: var(--text-2); font-weight: 600; }
.step-meta { color: var(--text-3); font-size: 11px; }
.step-dist { color: var(--text-3); white-space: nowrap; }
.error { background: rgba(220,38,38,0.12); border-left-color: #dc2626; }
.error .result-title, .error .result-stats { color: #fca5a5; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Keep old .btn-secondary / .btn-tertiary for JS compatibility ─────── */
.btn-secondary { background: #374151; color: #e8eaed; }
.btn-secondary:hover { background: #4b5563; }
.btn-tertiary { background: #1f2937; color: #e8eaed; }
.btn-tertiary:hover { background: #374151; }

/* ═══════════════════════════════════════════════════════════════════════════
   FAB CLUSTER  –  floating action buttons (bottom-right)
   ═══════════════════════════════════════════════════════════════════════════ */
.fab-cluster {
  position: absolute;
  right: 14px;
  bottom: max(80px, calc(24px + env(safe-area-inset-bottom)));
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: var(--shadow-md);
}
.fab-locate {
  background: rgba(12, 16, 30, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-1);
}
.fab-locate:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: rgba(37,99,235,0.25);
  border-color: rgba(37,99,235,0.5);
}
.fab-locate:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.fab-locate.active { color: #22c55e; border-color: rgba(34,197,94,0.5); }

/* Re-center button: appears during active TBT navigation when follow was manually paused */
.fab-recenter {
  background: var(--primary);
  color: #fff;
  border-color: rgba(37,99,235,0.6);
  box-shadow: 0 4px 16px rgba(37,99,235,0.45);
  animation: recenter-pulse 2s ease-in-out infinite;
}
.fab-recenter:hover {
  transform: translateY(-2px);
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(37,99,235,0.6);
}
.fab-recenter:active { transform: scale(0.94); }
@keyframes recenter-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(37,99,235,0.45); }
  50%       { box-shadow: 0 4px 22px rgba(37,99,235,0.75); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SEARCH OVERLAY  (full-screen, managed by poi-sheet.js)
   ═══════════════════════════════════════════════════════════════════════════ */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease both;
}
.search-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.so-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.so-back {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-1);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.so-back:hover { background: rgba(255,255,255,0.05); }

.so-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.so-input::placeholder { color: var(--text-3); }
.so-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

.so-clear {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border: none;
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.12s;
}
.so-clear:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }

.so-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.so-results .result-entry {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 5px;
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: background 0.12s;
}
.so-results .result-entry:hover { background: rgba(37,99,235,0.1); }
.so-results .result-entry.is-preview { background: rgba(37,99,235,0.12); box-shadow: inset 0 0 0 1px rgba(96,165,250,0.28); }
.so-results .r-label { font-weight: 600; color: var(--text-1); font-size: 14px; }
.so-results .r-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.so-results .r-dist { font-size: 11px; color: #60a5fa; margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   INFO / RESULTS PANEL  (right-side results list)
   ═══════════════════════════════════════════════════════════════════════════ */
.info-panel {
  display: none;
  position: absolute;
  top: calc(max(12px, env(safe-area-inset-top)) + var(--topbar-h) + 12px);
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: 340px;
  z-index: 1050;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  flex-direction: column;
}
.info-panel.open { display: flex; }

.info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.info-header h3 { font-size: 14px; font-weight: 600; color: var(--text-1); margin: 0; }
.info-controls { display: flex; gap: 6px; align-items: center; }

.results-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.result-entry {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 5px;
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: all 0.15s;
}
.result-entry:hover { background: rgba(37,99,235,0.1); transform: translateX(2px); }
.result-entry.is-preview { background: rgba(37,99,235,0.14); box-shadow: inset 0 0 0 1px rgba(96,165,250,0.3); transform: translateX(2px); }
.result-entry .r-label { font-weight: 600; color: var(--text-1); font-size: 13px; }
.result-entry .r-sub  { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.result-entry.is-coordinate {
  border: 1px dashed rgba(96,165,250,0.4);
  background: rgba(96,165,250,0.06);
}
.result-entry.is-address { border-left: 3px solid rgba(148,163,184,0.6); }
.result-entry.is-poi     { border-left: 3px solid rgba(37,99,235,0.7); }
.r-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.r-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text-3);
}

/* POI detail area */
.poi-details {
  padding: 14px;
  background: rgba(255,255,255,0.02);
  overflow-y: auto;
  max-height: calc(100vh - 200px);
}
.poi-details.hidden { display: none !important; }
.poi-details .poi-title { font-size: 17px; font-weight: 600; margin-bottom: 10px; color: var(--text-1); }
.poi-details .poi-sub   { font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.poi-details .item-detail { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.poi-details .detail-label { font-weight: 600; color: var(--text-3); margin-right: 4px; }
.poi-details .poi-desc {
  margin-top: 12px;
  color: var(--text-2);
  line-height: 1.6;
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.poi-details a { color: #60a5fa; text-decoration: none; }
.poi-details a:hover { text-decoration: underline; }
.poi-actions {
  display: flex; gap: 8px; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.poi-actions .btn { flex: 1; justify-content: center; font-size: 13px; }
.btn-back { background: rgba(255,255,255,0.04); color: var(--text-1); border: 1px solid var(--border); }
.btn-back:hover { background: rgba(255,255,255,0.07); }

/* ═══════════════════════════════════════════════════════════════════════════
   POI BOTTOM SHEET  (Google Maps style, mobile-first)
   ═══════════════════════════════════════════════════════════════════════════ */
.poi-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 2800;
  background: #121826;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.55);
  max-height: 72vh;
  transform: translateY(0);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  overflow: hidden;
}
.poi-sheet.hidden { transform: translateY(100%); pointer-events: none; }

.poi-sheet-handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.18);
  margin: 10px auto 0;
}
.poi-sheet-content {
  padding: 14px 18px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  max-height: calc(72vh - 22px);
}
.poi-sheet-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.poi-sheet-cat-icon {
  font-size: 30px;
  width: 46px; height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37,99,235,0.12);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
.poi-sheet-title-block { flex: 1; min-width: 0; }
.poi-sheet-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  line-height: 1.3;
}
.poi-sheet-category { font-size: 12px; color: var(--text-3); margin: 2px 0 0; }
.poi-sheet-close {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 50%;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.poi-sheet-close:hover { background: rgba(255,255,255,0.1); color: var(--text-1); }
.poi-sheet-details { display: grid; gap: 9px; margin-bottom: 14px; }
.poi-sheet-detail-row {
  display: flex; align-items: flex-start;
  gap: 10px; font-size: 13px; color: var(--text-2);
}
.poi-sheet-detail-row .detail-icon {
  flex-shrink: 0; width: 18px; text-align: center;
}
.poi-sheet-detail-row a { color: #60a5fa; text-decoration: none; }
.poi-sheet-detail-row a:hover { text-decoration: underline; }

/* Distance badge */
.poi-sheet-distance-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37,99,235,0.14);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Opening hours status badge */
.poi-oh-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}
.poi-oh-open {
  background: rgba(34,197,94,0.18);
  color: #86efac;
}
.poi-oh-closed {
  background: rgba(220,38,38,0.15);
  color: #fca5a5;
}
.poi-sheet-actions {
  display: flex; gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.poi-sheet-route-btn {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poi-sheet-share-btn { flex: 1; }

/* ── Nearby results section headers ─────────────────────────────────────── */
.nearby-section-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  padding: 10px 4px 5px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 3px;
  margin-top: 6px;
}
.nearby-section-header:first-child { margin-top: 0; }

/* Distance badge in result entries */
.result-dist-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(37,99,235,0.12);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  flex-shrink: 0;
}
  .poi-sheet {
    left: auto; right: 14px; bottom: 14px;
    width: 360px;
    border-radius: var(--radius-lg);
    max-height: 60vh;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAP POPUP  (kb-popup / poi-popup)
   ═══════════════════════════════════════════════════════════════════════════ */
.maplibregl-popup-content {
  background: #181e2f;
  color: var(--text-1);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: 0 18px 44px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.07);
  overflow: hidden;
}
.maplibregl-popup-tip { border-top-color: #181e2f !important; }
.maplibregl-popup-close-button { color: var(--text-2); font-size: 17px; }
.maplibregl-popup.kb-popup .maplibregl-popup-content {
  min-width: 260px; max-width: 340px;
}
.maplibregl-popup.kb-popup .maplibregl-popup-close-button {
  right: 8px; top: 6px;
}

.poi-popup { padding: 14px 14px 12px; }
.poi-popup-header {
  display: flex; align-items: flex-start; gap: 10px; padding-right: 20px;
}
.poi-popup-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(96,165,250,0.14);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 17px;
}
.poi-popup-headline { min-width: 0; flex: 1; }
.poi-popup .poi-title {
  font-size: 15px; 
  font-weight: 700;
  margin-bottom: 3px; 
  color: #111827; 
  line-height: 1.3;
}
.poi-popup .poi-sub { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.poi-popup-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 9px 0 11px; }
.poi-popup-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 7px; border-radius: 999px;
  background: rgba(255,255,255,0.07); color: #c4cce0;
}
.poi-popup .item-detail { font-size: 12px; color: var(--text-2); margin-top: 7px; }
.poi-popup-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 11px;
}
.poi-popup-actions .btn { width: 100%; padding: 9px 11px; font-size: 12px; }
.poi-popup-actions .btn-primary { grid-column: 1 / -1; }

/* ═══════════════════════════════════════════════════════════════════════════
   MAPLIBRE CONTROL BUTTONS  (zoom, compass)
   ═══════════════════════════════════════════════════════════════════════════ */
.maplibregl-ctrl-top-right {
  top: calc(max(12px, env(safe-area-inset-top)) + var(--topbar-h) + 12px) !important;
  right: 14px !important;
}
.maplibregl-ctrl-top-right .maplibregl-ctrl {
  margin: 8px 0 0 !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  box-shadow: var(--shadow-sm) !important;
  border: 1px solid rgba(15,23,42,0.1) !important;
}
.maplibregl-ctrl-top-right .maplibregl-ctrl-group {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.maplibregl-ctrl-top-right .maplibregl-ctrl button {
  width: 38px; height: 38px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TURN-BY-TURN OVERLAY  (immersive navigation)
   ═══════════════════════════════════════════════════════════════════════════ */
.tbt-overlay {
  position: fixed; inset: 0; z-index: 3000;
  pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
}
.tbt-overlay.hidden { display: none; }
.tbt-overlay > * { pointer-events: auto; }

/* ── TBT Phase-based color transitions ───────────────────────────────────── */
/* Default (far away, > 600 m): calm blue-green */
.tbt-top-bar {
  margin: calc(14px + env(safe-area-inset-top)) 14px 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1e6b3a 0%, #15803d 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  cursor: pointer;
  transition: background 0.5s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

/* Alert phase (medium distance): calm blue — driver needs to prepare */
.tbt-overlay.phase-alert .tbt-top-bar {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
}

/* Pre-turn phase (close): amber — get ready now */
.tbt-overlay.phase-pre .tbt-top-bar {
  background: linear-gradient(135deg, #92400e 0%, #b45309 100%);
}

/* Turn phase (very close / now): strong green — act immediately */
.tbt-overlay.phase-now .tbt-top-bar {
  background: linear-gradient(135deg, #065f46 0%, #059669 100%);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.4), var(--shadow-lg);
}

/* Route progress bar */
.tbt-progress {
  height: 4px;
  background: rgba(255,255,255,0.18);
  margin: 0;
  overflow: hidden;
}
.tbt-progress-fill {
  height: 100%;
  background: rgba(255,255,255,0.7);
  border-radius: 2px;
  transition: width 1s linear;
  min-width: 4px;
}
.tbt-overlay.phase-now .tbt-progress-fill { background: #a7f3d0; }
.tbt-overlay.phase-pre .tbt-progress-fill { background: #fcd34d; }
.tbt-overlay.phase-alert .tbt-progress-fill { background: #93c5fd; }
.tbt-top-bar:hover {
  transform: translateY(-1px);
}
.tbt-top-bar:active {
  transform: translateY(0);
}
.tbt-top-bar:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.92);
  outline-offset: 2px;
}
.tbt-maneuver {
  display: flex; align-items: center;
  gap: 16px; padding: 18px 22px;
}
.tbt-maneuver-icon {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff;
}
.tbt-maneuver-info { flex: 1; min-width: 0; }
.tbt-maneuver-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.76;
  margin-bottom: 4px;
}
.tbt-distance {
  font-size: 34px; font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.1;
}
.tbt-street {
  font-size: 15px; font-weight: 500;
  opacity: 0.98; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tbt-subline {
  font-size: 12px;
  line-height: 1.45;
  opacity: 0.82;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Lane indicator strip */
.tbt-lanes {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 0 14px 8px;
  padding: 7px 12px;
  background: rgba(0,0,0,0.55);
  border-radius: var(--radius-md);
  backdrop-filter: blur(6px);
}
.tbt-lanes.hidden { display: none; }
.tbt-lane {
  width: 22px;
  height: 36px;
  border-radius: 4px;
  background: #374151;
  border: 2px solid #6b7280;
  position: relative;
}
.tbt-lane::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: #9ca3af;
  border-radius: 1px;
}
.tbt-lane.tbt-lane-active {
  background: #1d4ed8;
  border-color: #60a5fa;
}
.tbt-lane.tbt-lane-active::after {
  background: #bfdbfe;
}

.tbt-bottom-bar {
  margin: 0 14px calc(14px + env(safe-area-inset-bottom));
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: #111827;
  color: var(--text-1);
  box-shadow: 0 -2px 20px rgba(0,0,0,0.45);
  display: flex; align-items: center; gap: 14px;
}
.tbt-speed-indicator { flex-shrink: 0; }
.tbt-speed-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 3px solid #22c55e;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(34,197,94,0.07);
}
.tbt-speed-value { font-size: 20px; font-weight: 800; color: var(--text-1); line-height: 1; }
.tbt-speed-unit  { font-size: 9px; color: var(--text-3); }
.tbt-route-info { flex: 1; min-width: 0; }
.tbt-eta-row { display: flex; align-items: baseline; gap: 10px; }
.tbt-remaining-time { font-size: 19px; font-weight: 700; color: #22c55e; }
.tbt-remaining-dist { font-size: 13px; color: var(--text-3); }
.tbt-eta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.tbt-status-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
}
.tbt-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(34,197,94,0.14);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.tbt-status-pill-secondary {
  background: rgba(255,255,255,0.08);
  color: #d1d5db;
}
.tbt-controls { display: flex; gap: 8px; flex-shrink: 0; }
.tbt-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.18s;
}
.tbt-btn-overview { background: #374151; color: var(--text-1); }
.tbt-btn-overview:hover { background: #4b5563; }
.tbt-btn-reroute { background: #0f766e; color: #f0fdfa; }
.tbt-btn-reroute:hover { background: #115e59; }
.tbt-btn-stop { background: #dc2626; color: #fff; }
.tbt-btn-stop:hover { background: #b91c1c; }

.tbt-overlay.off-route .tbt-top-bar {
  background: linear-gradient(135deg, #7c2d12 0%, #9a3412 100%);
}
.tbt-overlay.off-route .tbt-speed-circle { border-color: #fb923c; }
.tbt-overlay.off-route .tbt-remaining-time { color: #fb923c; }
.tbt-overlay.off-route .tbt-status-pill {
  background: rgba(251,146,60,0.18);
  color: #fed7aa;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY TURN BANNER  (compat shim, hidden by default)
   ═══════════════════════════════════════════════════════════════════════════ */
.turn-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; align-items: center; gap: 12px;
  background: #1a1d29; color: var(--text-1);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg); padding: 10px 18px;
  box-shadow: var(--shadow-lg); min-width: 220px; max-width: 400px;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.turn-banner.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(-10px); }
.turn-banner.off-route { background: #7c2d12; border-color: rgba(251,146,60,0.35); }
.turn-arrow { font-size: 28px; line-height: 1; flex-shrink: 0; width: 36px; text-align: center; }
.turn-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.turn-instruction { font-size: 14px; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-distance { font-size: 20px; font-weight: 800; color: #60a5fa; letter-spacing: -0.02em; }
.turn-banner.off-route .turn-distance { color: #fb923c; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE  –  smaller screens
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* On mobile, topbar stretches to edges (handled by body inset) */
  .topbar { left: 8px; right: 8px; }

  /* Map controls move to accommodate the topbar */
  .maplibregl-ctrl-top-right {
    top: calc(max(8px, env(safe-area-inset-top)) + var(--topbar-h) + 10px) !important;
    right: 10px !important;
  }

  /* FAB moves in from right edge */
  .fab-cluster { right: 10px; }

  /* POI/Search overlay results scroll well */
  .so-results { padding: 6px 8px; }

  /* TBT mobile spacing */
  .tbt-top-bar { margin: calc(8px + env(safe-area-inset-top)) 8px 0; border-radius: var(--radius-md); }
  .tbt-maneuver { padding: 13px 15px; gap: 12px; }
  .tbt-maneuver-icon { width: 42px; height: 42px; }
  .tbt-maneuver-icon svg { width: 34px; height: 34px; }
  .tbt-distance { font-size: 26px; }
  .tbt-street { font-size: 13px; }
  .tbt-subline { font-size: 11px; }
  .tbt-progress { height: 3px; }
  .tbt-bottom-bar { margin: 0 8px calc(8px + env(safe-area-inset-bottom)); padding: 10px 13px; border-radius: var(--radius-md); }
  .tbt-speed-circle { width: 48px; height: 48px; }
  .tbt-speed-value { font-size: 17px; }
  .tbt-remaining-time { font-size: 16px; }
  .tbt-btn { width: 38px; height: 38px; }

  /* Hide info panel inline; show as full-screen instead */
  .info-panel {
    top: 0; right: 0; bottom: 0;
    width: 100%;
    border-radius: 0;
    border-left: none;
  }

  .turn-banner { top: calc(var(--topbar-h) + 18px); }
}

@media (max-width: 520px) {
  :root { --topbar-h: 52px; }
  .topbar-search-label { font-size: 13px; }
  .route-panel { width: 100vw; }

  .wp-input { font-size: 15px; }
  .btn { font-size: 13px; padding: 10px 12px; }

  .poi-sheet-title { font-size: 17px; }
  .tbt-distance { font-size: 22px; }
  .result-summary { grid-template-columns: 1fr; }
}


