/* ═══════════════════════════════════════════════════════
   Helsinki Map — Flat UI
   Brand: #1A73B8 · #1FA86A · #E6EBEF · #D8B56A
   ═══════════════════════════════════════════════════════ */

:root {
  /* ── Brand ── */
  --accent: #1A73B8;
  --accent-soft: #e8f1f8;
  --accent-muted: #6da8d2;
  --gold: #D8B56A;
  --gold-soft: #faf5eb;
  --success: #1FA86A;
  --success-soft: #e8f6ee;
  --danger: #d64545;
  --danger-soft: #fce8e8;

  /* Transit */
  --hsl-bus: #1A73B8;
  --hsl-trunk: #FF6319;
  --hsl-tram: #1FA86A;
  --hsl-metro: #FF6319;
  --hsl-rail: #8C4799;
  --hsl-ferry: #00B9E4;

  /* ── Surfaces ── */
  --surface: #ffffff;
  --surface-2: #E6EBEF;
  --surface-3: #cdd5dc;
  --text: #1a2433;
  --text-2: #506070;
  --text-3: #8d99a5;
  --border: #d5dce3;
  --border-light: #E6EBEF;

  /* ── Geometry ── */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* ── Elevation (minimal for flat) ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,.07);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.08);

  /* ── Safe Areas ── */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 56px;

  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
button { border: none; outline: none; -webkit-appearance: none; -moz-appearance: none; appearance: none; }
html, body { height: 100%; overflow: hidden; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; line-height: 1.5; touch-action: pan-x pan-y; -ms-touch-action: pan-x pan-y; }
#app { position: relative; width: 100%; height: 100%; overflow: hidden; touch-action: pan-x pan-y; }
.hide { display: none !important; }

/* ═══ MAP ═══ */
#map { position: absolute; inset: 0; z-index: 0; }
.maplibregl-ctrl-bottom-right { display: none !important; }
.maplibregl-ctrl-bottom-left {
  bottom: calc(var(--tab-h) + var(--safe-b) + 8px) !important;
  left: 12px !important;
}
.maplibregl-ctrl-attrib { font-size: 9px !important; background: rgba(255,255,255,.6) !important; border-radius: 4px; }

/* ═══════════════════════════════════════════════════════
   SEARCH PILL (above zoom pill)
   ═══════════════════════════════════════════════════════ */
#search-card {
  position: absolute; z-index: 10;
  right: 16px;
  bottom: calc(var(--tab-h) + var(--safe-b) + 111px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  width: 44px;
  transition: width .3s cubic-bezier(.32,.72,0,1),
              border-radius .3s ease,
              box-shadow .3s ease;
}

/* ── Collapsed pill ── */
#search-pill {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-3);
  transition: color .15s, opacity .2s ease;
}
#search-pill:hover { color: var(--text-2); }
#search-pill:active { color: var(--accent); }
#search-card:not(.collapsed) #search-pill {
  opacity: 0; pointer-events: none; position: absolute;
}
#search-box:focus-within {
  border-radius: var(--r-xl);
}

/* ── Expand / collapse animation ── */
#search-expanded {
  opacity: 1;
  transition: opacity .2s ease .08s;
}
#search-card.collapsed #search-expanded {
  opacity: 0;
  pointer-events: none;
  height: 0; overflow: hidden;
}

/* ── Expanded card ── */
#search-card:not(.collapsed) {
  width: min(92vw, 360px);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}

#search-box {
  display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 16px;
}
.sb-icon { color: var(--text-3); flex-shrink: 0; }

#search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; font-weight: 500;
  color: var(--text); min-width: 0;
}
#search-input::placeholder { color: var(--text-3); font-weight: 400; }

.clear-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 50%; cursor: pointer;
  color: var(--text-3);
  transition: color .15s;
}
.clear-btn:hover { color: var(--text-2); }

/* Results (dropdown grows upward) */
#search-drop {
  position: absolute; bottom: 100%; left: 0; right: 0;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  max-height: 52vh; overflow-y: auto;
  overscroll-behavior: contain;
}
#results-list { list-style: none; }
#results-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  transition: background-color .15s;
}
#results-list li:last-child { border-bottom: none; }
#results-list li:hover { background: var(--surface-2); }
#results-list li:active { background: var(--accent-soft); }

.r-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--accent); background: var(--accent-soft);
}
.r-body { flex: 1; min-width: 0; }
.r-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-addr { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════════════════
   SCALE BAR (bottom-left) – Google Maps geometric style
   ═══════════════════════════════════════════════════════ */
.maplibregl-ctrl-scale {
  background: transparent !important;
  border: none !important;
  border-bottom: 1.5px solid rgba(0,0,0,.25) !important;
  border-left: 1.5px solid rgba(0,0,0,.25) !important;
  border-right: 1.5px solid rgba(0,0,0,.25) !important;
  border-radius: 0 !important;
  font-size: 9px !important;
  font-weight: 400 !important;
  color: rgba(0,0,0,.35) !important;
  padding: 0 3px 1px !important;
  line-height: 12px !important;
}

/* ═══════════════════════════════════════════════════════
   STYLE PICKER (above zoom pill)
   ═══════════════════════════════════════════════════════ */
#style-picker {
  position: absolute; z-index: 6;
  right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 163px);
}
#style-picker-btn {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  color: var(--text-3);
  transition: color .15s, background .15s;
}
#style-picker-btn:hover { color: var(--text-2); }
#style-picker-btn:active { color: var(--accent); }
#style-picker-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

#style-panel {
  position: absolute;
  right: 52px; bottom: -4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 4px 20px rgba(0,0,0,.14);
  padding: 8px;
  display: flex; gap: 8px;
  white-space: nowrap;
}
#style-panel.hide { display: none; }

.style-opt {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: 2px solid transparent;
  border-radius: 10px; padding: 6px 8px; cursor: pointer;
  transition: border-color .15s;
}
.style-opt:hover { border-color: var(--border); }
.style-opt.active { border-color: var(--accent); }
.style-opt span {
  font-size: 11px; font-weight: 600; color: var(--text-2);
}
.style-thumb {
  width: 52px; height: 52px; border-radius: 8px;
}
.thumb-default  { background: linear-gradient(135deg, #ddeacd 25%, #bee4f8 50%, #f0f1f2 75%); }
.thumb-satellite { background: linear-gradient(135deg, #1a3a1e 20%, #1a3a5c 50%, #2d5a3a 80%); }
.thumb-3d       { background: linear-gradient(135deg, #b8c6d0 10%, #dfe1e8 40%, #a8b4c0 70%); background-image: linear-gradient(135deg, #b8c6d0 10%, #dfe1e8 40%, #a8b4c0 70%), repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(0,0,0,.06) 4px, rgba(0,0,0,.06) 5px); }

/* ═══════════════════════════════════════════════════════
   ZOOM PILL (bottom-right, always visible)
   ═══════════════════════════════════════════════════════ */
#zoom-pill {
  position: absolute; z-index: 5;
  right: 16px; bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
#zoom-pill button {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-3);
  transition: color .15s;
}
#zoom-pill button:hover { color: var(--text-2); }
#zoom-pill button:active { color: var(--accent); }
.zp-div { width: 24px; height: 1px; background: var(--border); }

/* ═══════════════════════════════════════════════════════
   TAB BAR — bottom on mobile, right side on desktop
   ═══════════════════════════════════════════════════════ */
#tab-bar {
  position: absolute; z-index: 10;
  bottom: 12px; left: 50%; transform: translateX(-50%);
  width: auto;
  height: 56px;
  display: inline-flex; align-items: stretch; gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding: 0 8px;
}

.tab {
  flex: 0 0 auto; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  padding: 0 16px;
  background: none; border: none; outline: none; cursor: pointer;
  color: var(--text-3); font-family: inherit;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.tab svg { width: 20px; height: 20px; }
.tab:hover { color: var(--text-2); }
.tab:active { color: var(--accent); }
.tab:focus, .tab:focus-visible { outline: none; box-shadow: none; }

/* ── Active Tab Indicators ── */
.tab.tracking { color: var(--accent); animation: tabTrackPulse 2s ease-in-out infinite; }
.tab.route-active { color: var(--accent); }
.tab.active-tab { color: var(--accent); }
.tab.active-tab::after {
  content: ''; position: absolute; bottom: 4px;
  width: 16px; height: 3px; border-radius: 2px;
  background: var(--accent);
}
@keyframes tabTrackPulse {
  0%, 100% { color: var(--accent); }
  50% { color: var(--accent-muted); }
}

.badge {
  position: absolute; top: 5px; right: calc(50% - 22px);
  min-width: 16px; height: 16px; line-height: 16px;
  font-size: 9px; font-weight: 700; text-align: center;
  color: #fff; background: var(--accent);
  border-radius: var(--r-pill); padding: 0 4px;
  pointer-events: none;
}

/* Desktop: vertical strip on right edge */
@media (min-width: 769px) {
  #tab-bar {
    top: 50%; bottom: auto; left: auto; right: 16px;
    transform: translateY(-50%);
    width: 64px; height: auto;
    flex-direction: column; justify-content: center;
    padding: 10px 0;
    border: 1px solid var(--border);
    border-top: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-md);
    gap: 2px;
  }
  .tab {
    flex: 0 0 auto; padding: 10px 0; min-width: unset;
    gap: 4px; font-size: 10px;
  }
  .tab svg { width: 20px; height: 20px; }
  .tab.active-tab::after {
    bottom: auto; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 16px; border-radius: 0 2px 2px 0;
  }
  .badge { top: 4px; right: 8px; }
  #zoom-pill { bottom: 24px; }
  #style-picker { bottom: 172px; }
  #search-card { bottom: 119px; }
  .maplibregl-ctrl-bottom-left { bottom: 12px !important; }
}

/* ═══════════════════════════════════════════════════════
   SHEETS (shared base — bottom sheets on all screens)
   ═══════════════════════════════════════════════════════ */
.sheet {
  position: absolute; z-index: 12;
  left: 0; right: 0; bottom: 0;
  height: 55vh;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .4s cubic-bezier(.32,.72,0,1), height .35s cubic-bezier(.32,.72,0,1);
}
.sheet.shut { transform: translateY(100%); }
.sheet.dragging { transition: none; will-change: transform, height; }
.sheet.full { height: calc(100vh - 24px); border-radius: var(--r-xl); }

/* Directions panel: content-height until results arrive */
#dir-panel { height: auto; max-height: 55vh; }
#dir-panel.results-shown,
#dir-panel.route-focused { height: 55vh; max-height: none; }
#dir-panel.full { height: calc(100vh - 24px); max-height: none; }

/* Places panel: content-height, grows with list */
#places-sheet { height: auto; max-height: 55vh; }
#places-sheet.full { height: calc(100vh - 24px); max-height: none; }

.sheet-drag { display: flex; justify-content: center; padding: 10px 0 4px; cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.sheet-drag span { width: 36px; height: 4px; background: var(--surface-3); border-radius: var(--r-pill); }

.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border-light);
  cursor: grab; touch-action: none;
  -webkit-user-select: none; user-select: none;
}
.sheet-head h2 { flex: 1; font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -.01em; }

.sheet-action-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--accent); border: none; border-radius: 50%;
  cursor: pointer; color: #fff;
  transition: filter .15s;
}
.sheet-action-btn:hover { filter: brightness(1.12); }

.sheet-action-btn-subtle {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: none; border-radius: 50%;
  cursor: pointer; color: var(--text-2);
  transition: background .15s, color .15s;
}
.sheet-action-btn-subtle:hover { 
  background: var(--surface-3);
  color: var(--text);
}

/* Mosque navigation button - labeled style */
.mosque-nav-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  background: var(--success-soft);
  color: var(--success);
  border: 1.5px solid var(--success);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mosque-nav-btn:hover {
  background: var(--success);
  color: #fff;
}
.mosque-nav-btn:hover svg {
  stroke: #fff;
}
.mosque-nav-btn svg {
  transition: stroke .15s;
}
.sheet-x {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: none; border-radius: 50%;
  cursor: pointer; color: var(--text-3);
  transition: color .15s;
}
.sheet-x:hover { color: var(--text-2); }

/* Desktop: emerge from tab bar */
@media (min-width: 769px) {
  .sheet {
    left: auto; right: 92px;
    top: 0; bottom: 0;
    margin: auto 0;
    transform: none;
    transform-origin: right center;
    height: fit-content !important;
    max-height: calc(100vh - 48px) !important; width: 400px;
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    opacity: 1;
    transition: transform .35s cubic-bezier(.32,.72,0,1), opacity .25s ease;
  }
  .sheet.shut {
    transform: translateX(40px) scale(.92);
    opacity: 0;
    pointer-events: none;
  }
  .sheet-drag { display: none; }
}

/* ═══════════════════════════════════════════════════════
   SCRIM
   ═══════════════════════════════════════════════════════ */
#scrim {
  position: absolute; inset: 0; z-index: 11;
  background: rgba(9,9,11,.12);
  transition: opacity .3s;
  pointer-events: none;
}
#scrim.hide { opacity: 0; }

/* ═══════════════════════════════════════════════════════
   PLACES SHEET CONTENT
   ═══════════════════════════════════════════════════════ */
#places-ct { font-size: 13px; font-weight: 600; color: var(--text-3); }

/* ── Type filter chips ── */
#places-filters {
  padding: 12px 16px 6px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
#places-type-chips {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
}

.pf-chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 4px 4px; border: none;
  background: none; border-radius: var(--r-md);
  font-family: inherit; cursor: pointer;
  transition: background-color .15s;
}
.pf-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--pf-c) 12%, transparent);
  color: var(--pf-c); transition: background-color .2s, color .2s;
}
.pf-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  transition: color .15s;
}
.pf-chip:hover .pf-icon { background: color-mix(in srgb, var(--pf-c) 22%, transparent); }
.pf-chip:hover .pf-label { color: var(--text-2); }
.pf-chip.active .pf-icon {
  background: var(--pf-c); color: #fff;
}
.pf-chip.active .pf-label { color: var(--text); font-weight: 700; }

/* Fallback for browsers without color-mix */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .pf-icon { background: var(--surface-2); }
  .pf-chip.active .pf-icon { background: var(--pf-c); }
}

/* ── Tag filter ── */
#tf-row {
  display: flex; justify-content: flex-start;
  padding: 4px 16px 2px;
}
#tf-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border: 1.5px solid var(--border);
  background: var(--surface); border-radius: var(--r-pill);
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--text-2); cursor: pointer;
  transition: color .15s;
}
#tf-toggle:hover { color: var(--text); }
#tf-toggle.open { background: var(--accent); color: #fff; border-color: var(--accent); }
#tf-toggle.open svg { stroke: #fff; }
.tf-arrow { transition: transform .2s; }
#tf-toggle.open .tf-arrow { transform: rotate(180deg); }
#tf-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  border-radius: var(--r-pill); font-size: 11px; font-weight: 700;
}
#tf-toggle.open #tf-count { background: #fff; color: var(--accent); }
#tag-filter-chips {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 0 16px;
  max-height: 200px; overflow: hidden;
  transition: max-height .25s ease, padding .25s ease, opacity .2s ease;
  opacity: 1; padding-top: 6px; padding-bottom: 8px;
}
#tag-filter-chips.shut {
  max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; pointer-events: none;
}
.tf-chip {
  display: inline-flex; align-items: center;
  padding: 5px 11px; border: 1.5px solid var(--border);
  background: var(--surface); border-radius: var(--r-pill);
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--text-2); cursor: pointer;
  white-space: nowrap; transition: color .15s;
}
.tf-chip:hover { color: var(--text); }
.tf-chip.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}

/* ── Places list ── */
#places-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  scroll-behavior: smooth;
}
#places-scroll::-webkit-scrollbar { width: 3px; }
#places-scroll::-webkit-scrollbar-track { background: transparent; }
#places-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

#places-list { list-style: none; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
#places-list:empty { padding: 0; }
#places-list li,
#places-empty {
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
#places-list li {
  display: grid;
  grid-template: "icon name meta" auto "icon addr meta" auto / auto 1fr auto;
  align-items: center; column-gap: 12px;
  cursor: pointer;
  transition: background-color .15s;
}
#places-list li:hover { background: var(--surface-2); }
#places-list li:active { background: var(--accent-soft); }

.pl-dot {
  grid-area: icon; align-self: center;
  width: 28px; height: 28px; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.pl-dot svg { width: 14px; height: 14px; }
.pl-name {
  grid-area: name; align-self: end;
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.3; min-width: 0;
}
.pl-addr {
  grid-area: addr; align-self: start;
  font-size: 12px; color: var(--text-3); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.pl-meta {
  grid-area: meta; align-self: center;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.pl-type-badge {
  padding: 3px 8px;
  font-size: 11px; font-weight: 700;
  color: var(--type-c, var(--accent));
  background: var(--surface-2);
  border-radius: var(--r-pill);
  white-space: nowrap; letter-spacing: .02em;
  line-height: 1.3;
}
.pl-tags-summary {
  font-size: 11px; font-weight: 600;
  color: var(--text-3); white-space: nowrap; line-height: 1.3;
}
@supports (background: color-mix(in srgb, red 10%, transparent)) {
  .pl-type-badge {
    background: color-mix(in srgb, var(--type-c, var(--accent)) 10%, transparent);
  }
}

#places-empty {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 16px 16px;
}
.empty-anim {
  position: relative; width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.empty-pin {
  color: var(--text-3);
  animation: pinBounce 2s ease-in-out infinite;
}
.empty-ping {
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 3px; border-radius: 50%;
  background: var(--surface-3);
  animation: pingShadow 2s ease-in-out infinite;
}
@keyframes pinBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes pingShadow {
  0%, 100% { width: 8px; opacity: .6; }
  50% { width: 12px; opacity: .3; }
}
.empty-text {
  display: flex; flex-direction: column; gap: 1px; min-width: 0;
}
.empty-title {
  font-size: 14px; font-weight: 600; color: var(--text-2);
}
.empty-sub {
  font-size: 12px; color: var(--text-3); font-weight: 500;
}
.empty-suggest {
  background: none; border: none; padding: 0;
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--accent); cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent;
  transition: text-decoration-color .15s;
}
.empty-suggest:hover { text-decoration-color: var(--accent); }

/* ── Skeleton loading ── */
.pl-skeleton {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.skel-bone {
  background: var(--surface-2); border-radius: var(--r-xs);
  animation: shimmer 1.2s ease-in-out infinite alternate;
}
.skel-icon { width: 38px; height: 38px; border-radius: var(--r-sm); flex-shrink: 0; }
.skel-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skel-line { height: 12px; border-radius: var(--r-xs); }
.skel-line-short { width: 60%; }
.skel-line-long { width: 85%; }
.skel-line-xs { width: 35%; height: 10px; }
.skel-badge { width: 56px; height: 24px; border-radius: var(--r-pill); flex-shrink: 0; }
@keyframes shimmer {
  from { opacity: 1; }
  to { opacity: .45; }
}

/* ═══════════════════════════════════════════════════════
   PLACE MARKERS
   ═══════════════════════════════════════════════════════ */
.place-mk-wrap {
  cursor: pointer;
}
/* Force markers to stay fully visible during MapLibre layer transitions */
.maplibregl-marker { opacity: 1 !important; transition: none !important; }
.place-mk {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--place-c, var(--accent));
  border: 2.5px solid #fff;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: relative;
}
.place-mk svg {
  transform: rotate(45deg);
  flex-shrink: 0;
}
.place-mk-tip { display: none; }

/* ═══════════════════════════════════════════════════════
   PLACE DETAIL POPUP
   ═══════════════════════════════════════════════════════ */
.place-popup-wrap .maplibregl-popup-content {
  padding: 0 !important; overflow: hidden;
  border-radius: var(--r-md) !important;
  width: auto; min-width: 200px; max-width: min(280px, 88vw);
  box-shadow: 0 8px 30px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08) !important;
  background: var(--surface) !important;
}
.place-popup-wrap .maplibregl-popup-close-button {
  color: #fff !important; z-index: 2;
  font-size: 20px !important; top: 8px !important; right: 10px !important;
}
.place-popup-wrap .maplibregl-popup-close-button:hover { color: rgba(255,255,255,.7) !important; }

.pp { display: flex; flex-direction: column; }

.pp-head {
  display: grid; grid-template: "icon title" auto "icon sub" auto / auto 1fr;
  gap: 0 8px; padding: 10px 12px;
  background: var(--pc);
  color: #fff;
}
.pp-type-icon {
  grid-area: icon; align-self: center;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border-radius: 8px;
}
.pp-title {
  grid-area: title; font-size: 14px; font-weight: 600;
  line-height: 1.2; align-self: end;
}
.pp-sub {
  grid-area: sub; font-size: 11px; font-weight: 600;
  opacity: .75; line-height: 1.4;
}

.pp-body { padding: 10px 12px; }

.pp-addr {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2);
  margin-bottom: 10px;
}
.pp-addr svg { flex-shrink: 0; color: var(--text-3); }

/* ── Tag chips ── */
.pp-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-bottom: 10px;
}
.pp-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.pp-chip-yes { background: var(--success-soft); color: var(--success); }
.pp-chip-no { background: var(--danger-soft); color: var(--danger); }

.pp-notes {
  font-size: 12px; color: var(--text-3); line-height: 1.5;
  padding: 6px 0; margin-bottom: 6px;
  border-top: 1px solid var(--border-light);
}

/* ── Actions ── */
.pp-actions {
  display: flex; gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--border-light);
}
.pp-dir-btn, .pp-edit-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border: none;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; font-weight: 700;
  line-height: 1; letter-spacing: .01em;
  cursor: pointer; white-space: nowrap;
  transition: filter .15s;
}
.pp-dir-btn {
  background: var(--accent); color: #fff;
}
.pp-dir-btn svg { flex-shrink: 0; }
.pp-dir-btn:hover { filter: brightness(1.1); }

.pp-edit-btn {
  background: var(--surface); border: 1.5px solid var(--border); color: var(--text-2);
  transition: color .15s;
}
.pp-edit-btn svg { flex-shrink: 0; }
.pp-edit-btn:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════
   SUGGEST PLACE OVERLAY
   ═══════════════════════════════════════════════════════ */
#suggest-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9,9,11,.4);
  padding: 20px;
}
#suggest-overlay.hide { display: none; }

#suggest-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.suggest-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
}
.suggest-head h3 {
  font-size: 18px; font-weight: 600; color: var(--text);
  letter-spacing: -.01em;
}

#suggest-form {
  padding: 16px 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.sg-label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.sg-req { color: var(--danger); margin-left: 1px; }

/* ── Suggest tag chips (tri-state: neutral → yes → no) ── */
.sg-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.sg-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-pill);
  font-family: inherit; font-size: 12px; font-weight: 600;
  color: var(--text-2); cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
  -webkit-user-select: none; user-select: none;
}
.sg-tag:hover { border-color: var(--surface-3); }
.sg-tag .sg-tag-icon { display: none; width: 12px; height: 12px; flex-shrink: 0; }
.sg-tag[data-state="yes"] {
  background: var(--success-soft); border-color: var(--success); color: var(--success);
}
.sg-tag[data-state="yes"] .sg-tag-icon.sg-yes { display: inline-block; }
.sg-tag[data-state="no"] {
  background: var(--danger-soft); border-color: var(--danger); color: var(--danger);
}
.sg-tag[data-state="no"] .sg-tag-icon.sg-no { display: inline-block; }

.sg-hint {
  font-size: 11px; font-weight: 500; color: var(--text-3);
  opacity: .6; letter-spacing: .01em;
}

.sg-label input, .sg-label select, .sg-label textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text);
  transition: border-color .15s;
}
.sg-label input:focus, .sg-label select:focus, .sg-label textarea:focus {
  outline: none; border-color: var(--accent);
}
.sg-label textarea { resize: vertical; min-height: 60px; }
.sg-label select {
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23506070' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

#sg-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 24px;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
#sg-submit:hover { filter: brightness(1.12); }

/* ═══════════════════════════════════════════════════════
   SUGGEST EDIT OVERLAY
   ═══════════════════════════════════════════════════════ */
#edit-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(9,9,11,.4);
  padding: 20px;
}
#edit-overlay.hide { display: none; }

#edit-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: min(600px, 85vh);
  display: flex;
  flex-direction: column;
}

#edit-form {
  padding: 16px 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}

#ed-submit {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 24px;
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
  transition: filter .15s;
}
#ed-submit:hover { filter: brightness(1.12); }

/* ═══════════════════════════════════════════════════════
   DIRECTIONS PANEL CONTENT
   ═══════════════════════════════════════════════════════ */
#dir-inputs {
  padding: 12px 16px 0; display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.dir-fields-col {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px;
}
.dir-field-wrap { position: relative; }
.dir-field {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 14px;
  background: var(--surface-2); border: 2px solid transparent;
  border-radius: var(--r-sm);
}
.dir-field:focus-within { border-color: var(--surface-3); background: var(--surface); }
.dir-field input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 15px; font-weight: 500; color: var(--text); min-width: 0;
}
.dir-field input::placeholder { color: var(--text-3); font-weight: 400; }

.dir-field-btn {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 50%; cursor: pointer; color: var(--text-3);
  transition: color .15s;
}
.dir-field-btn:hover { color: var(--text-2); }

.dir-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  border: 2.5px solid; box-sizing: border-box;
}
.dir-dot.origin { border-color: var(--success); background: var(--success-soft); }
.dir-dot.dest { border-color: var(--danger); background: var(--danger-soft); }

#dir-swap {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; color: var(--text-2);
  transition: color .15s;
}
#dir-swap:hover { color: var(--text); }

/* Autocomplete suggestions */
.dir-suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  list-style: none; background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  box-shadow: var(--shadow-lg); max-height: 200px; overflow-y: auto;
  overscroll-behavior: contain;
}
.dir-suggest li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--border-light);
  transition: background-color .15s;
}
.dir-suggest li:last-child { border-bottom: none; }
.dir-suggest li:hover { background: var(--surface-2); }
.dir-suggest li:active { background: var(--accent-soft); }

.ds-icon {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--surface-2); color: var(--text-2);
}
.ds-icon svg { width: 14px; height: 14px; }
.ds-text { flex: 1; min-width: 0; }
.ds-name { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-addr { font-size: 12px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-none { padding: 16px; text-align: center; color: var(--text-3); font-size: 14px; cursor: default; }

/* Go button */
#dir-go {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 0 16px 14px; height: 46px; min-height: 46px; padding: 0 24px;
  background: var(--accent); color: #fff; border: none; border-radius: var(--r-sm);
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  flex-shrink: 0;
  transition: filter .15s;
}
#dir-go:hover:not(:disabled) { filter: brightness(1.12); }
#dir-go:disabled { opacity: .35; cursor: not-allowed; }

/* ── Transport mode selector ── */
/* Time bar hidden for non-transit modes */
#dir-panel:not([data-travel-mode="transit"]) #dir-time-bar { display: none !important; }

#dir-mode-bar {
  padding: 12px 16px 12px;
  flex-shrink: 0;
}
#dir-mode-toggle {
  display: flex;
  width: 100%;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.mode-opt {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 4px; border: none; background: transparent;
  border-radius: calc(var(--r-sm) - 2px);
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--text-3); cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s, box-shadow .15s;
}
.mode-opt svg { flex-shrink: 0; }
.mode-opt:hover:not(.active) { color: var(--text-2); }
.mode-opt.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── Direct route result card (drive / cycle / walk) ── */
.direct-card { cursor: default; }
.direct-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}
.direct-mode-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--dc) 12%, transparent);
  color: var(--dc);
  border-radius: var(--r-sm);
}
.direct-summary {
  display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0;
}
.direct-dur {
  font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2;
}
.direct-meta {
  font-size: 12px; color: var(--text-3); font-weight: 500;
}
.direct-endpoints {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
  max-width: 120px; overflow: hidden;
}
.direct-ep {
  font-size: 11px; color: var(--text-2); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48px;
}

/* ── Turn-by-turn step list ── */
.direct-steps {
  display: flex; flex-direction: column;
}
.direct-step {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
}
.direct-step { cursor: pointer; transition: background-color .15s; }
.direct-step:hover { background-color: var(--surface-2); }
.direct-step.selected { background-color: var(--accent-soft); }
.direct-step.selected .step-inst { color: var(--accent); }
.direct-step:last-child { border-bottom: none; }
.step-icon-wrap {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-2);
  border-radius: var(--r-sm);
}
.step-icon-wrap.step-depart,
.step-icon-wrap.step-arrive  { background: var(--accent-soft); color: var(--accent); }
.step-icon-wrap.step-roundabout { background: rgba(140,71,153,.12); color: #8C4799; }
.step-text-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.step-inst { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.step-meta { font-size: 12px; font-weight: 500; color: var(--text-3); }

/* ── Time Picker ── */
#dir-time-bar {
  display: flex; flex-direction: column; gap: 6px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}
.time-row {
  display: flex; align-items: center; gap: 6px;
}
#dir-time-toggle {
  display: flex; flex: 1;
  background: var(--surface-2); border-radius: var(--r-sm);
  padding: 3px; gap: 2px;
}
.time-opt {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 10px; border: none; background: none;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--text-3); cursor: pointer;
  border-radius: calc(var(--r-sm) - 2px);
  transition: color .15s;
}
.time-opt svg { flex-shrink: 0; }
.time-opt:not(.active):hover { color: var(--text-2); }
.time-opt.active {
  background: var(--surface); color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.time-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px; border: 1.5px solid var(--border);
  background: var(--surface); border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--text-2); cursor: pointer;
  flex-shrink: 0; white-space: nowrap;
  transition: color .15s;
}
.time-chip svg { flex-shrink: 0; }
.time-chip:not(.active):hover { color: var(--text); }
.time-chip.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
#dir-custom-time-row {
  display: none; gap: 6px; position: relative;
}
#dir-custom-time-row.show {
  display: flex;
}
.custom-date-wrap, .custom-time-wrap {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); height: 38px;
  overflow: hidden; cursor: pointer;
  transition: border-color .15s;
}
.custom-date-wrap:hover, .custom-time-wrap:hover { border-color: var(--surface-3); }
.custom-date-wrap { flex: 1.3; }
.custom-date-wrap:focus-within, .custom-time-wrap:focus-within {
  border-color: var(--surface-3);
}
.field-icon {
  flex-shrink: 0; margin-left: 10px;
  color: var(--text-3); pointer-events: none;
}
.custom-date-wrap:focus-within .field-icon,
.custom-time-wrap:focus-within .field-icon {
  color: var(--text-2);
}
#dir-date, #dir-time {
  flex: 1; min-width: 0; height: 100%; padding: 0 8px 0 6px;
  border: none; background: transparent;
  font-family: inherit; font-size: 14px;
  font-weight: 600; color: var(--text); outline: none;
  -webkit-appearance: none; appearance: none;
  cursor: pointer;
}

/* ── Custom Picker Overlays ── */
.picker-overlay {
  position: fixed; z-index: 999;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 12px;
  font-family: inherit;
}
.picker-overlay.hide { display: none; }

@media (max-width: 768px) {
  .picker-overlay {
    left: 12px !important; right: 12px; bottom: 80px !important;
    top: auto !important; width: auto !important;
    border-radius: var(--r-xl);
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
    padding: 16px;
  }
}

/* Calendar */
.cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.cal-head span {
  font-size: 14px; font-weight: 600; color: var(--text);
}
.cal-nav {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: none; border-radius: 50%;
  cursor: pointer; color: var(--text-3);
  transition: color .15s;
}
.cal-nav:hover { color: var(--text-2); }

.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center; margin-bottom: 4px;
}
.cal-weekdays span {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 0;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.cal-day {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1; border: none; background: none;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); cursor: pointer;
  border-radius: var(--r-sm);
  transition: background-color .12s, color .12s;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.today { color: var(--accent); font-weight: 700; }
.cal-day.selected { background: var(--accent); color: #fff; }
.cal-day.selected:hover { opacity: .88; }
.cal-day.other-month { color: var(--text-3); opacity: .5; }
.cal-day.other-month:hover { opacity: .7; background: var(--surface-2); }

/* Time picker */
.tp-wheels {
  display: flex; align-items: flex-start; gap: 8px;
}
.tp-wheel-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tp-wheel-label {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.tp-colon {
  font-size: 18px; font-weight: 700; color: var(--text-3);
  margin-top: 26px; flex-shrink: 0;
}
.tp-wheel {
  width: 100%; height: 126px; overflow-y: auto;
  background: var(--surface-2); border-radius: var(--r-sm);
  scrollbar-width: none;
}
.tp-wheel::-webkit-scrollbar { display: none; }

.tp-cell {
  display: flex; align-items: center; justify-content: center;
  height: 30px; border: none; background: none; width: 100%;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: var(--text-2); cursor: pointer;
  border-radius: var(--r-xs);
  transition: background-color .12s, color .12s;
}
.tp-cell:hover { background: var(--surface-3); color: var(--text); }
.tp-cell.selected { background: var(--accent); color: #fff; }
.tp-cell.selected:hover { opacity: .88; }

/* Results area */
#dir-results {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
#dir-results::-webkit-scrollbar { width: 3px; }
#dir-results::-webkit-scrollbar-track { background: transparent; }
#dir-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#dir-empty {
  display: none;
}
#dir-loading {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 36px 20px; color: var(--text-3); font-size: 14px;
}
.spinner {
  width: 20px; height: 20px; border: 2.5px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#dir-error {
  margin: 12px 16px; padding: 14px 16px; border-radius: var(--r-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 600;
}
#dir-error::before { content: '⚠ '; }

/* ─── Itinerary Cards ─── */
.fallback-notice {
  margin: 10px 16px 2px;
  padding: 9px 12px;
  font-size: 12px; line-height: 1.4;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--r-sm);
}
.dark .fallback-notice {
  color: #fcd34d;
  background: rgba(253,211,77,.1);
  border-color: rgba(253,211,77,.3);
}
.itin-card {
  margin: 8px 16px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.itin-card:not(.active):not(.focused):hover { background: var(--surface-2); border-color: var(--surface-3); }
.itin-card.active { background: var(--accent-soft); border-color: var(--accent-muted); }

.itin-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.itin-dur { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.itin-card.active .itin-dur { color: var(--accent); }
.itin-time { font-size: 13px; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.itin-walk { font-size: 13px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.itin-walk svg { opacity: .45; }

.itin-chain { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.leg-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--r-xs); font-size: 13px; font-weight: 700;
  color: #fff; line-height: 1.2;
}
.leg-badge svg { flex-shrink: 0; }
.leg-badge.walk { background: #52525b; }
.leg-badge.bus { background: var(--hsl-bus); }
.leg-badge.trunk { background: var(--hsl-trunk); }
.leg-badge.tram { background: var(--hsl-tram); }
.leg-badge.rail, .leg-badge.train { background: var(--hsl-rail); }
.leg-badge.subway, .leg-badge.metro { background: var(--hsl-metro); }
.leg-badge.mode-drive  { background: #FF6319; }
.leg-badge.mode-cycle  { background: #1FA86A; }
.leg-badge.mode-walk   { background: #52525b; }
.leg-badge.ferry { background: var(--hsl-ferry); }
.leg-badge.funicular { background: #71717a; }
.leg-arrow { color: var(--text-3); font-size: 11px; font-weight: 700; }

/* Leg detail (expanded) */
.itin-legs { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-light); }
.itin-card.active .itin-legs { display: block; }

/* Expand / focus button on itin header */
.itin-expand, .direct-expand {
  width: 30px; height: 30px; flex-shrink: 0;
  display: none; align-items: center; justify-content: center;
  background: var(--accent); border: none; border-radius: var(--r-sm);
  cursor: pointer; color: #fff; margin-top: 1px;
  transition: filter .15s;
}
.itin-expand:hover, .direct-expand:hover { filter: brightness(1.12); }
.itin-expand svg, .direct-expand svg { width: 14px; height: 14px; }
.itin-card.active .itin-expand, .direct-card .direct-expand { display: flex; }
.itin-card.focused .itin-expand, .direct-card.focused .direct-expand { display: none; }

/* ── Compact search summary bar (mobile, shown when results visible) ── */
#dir-summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.dir-sum-route {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
}
.dir-sum-text {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 120px;
}
.dir-sum-arrow { flex-shrink: 0; color: var(--text-3); }
#dir-sum-edit {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
#dir-sum-edit:hover { filter: brightness(1.12); }

/* ── Mobile: collapse search when results shown ── */
@media (max-width: 768px) {
  #dir-panel.results-shown #dir-inputs,
  #dir-panel.results-shown #dir-time-bar,
  #dir-panel.results-shown #dir-mode-bar,
  #dir-panel.results-shown #dir-go {
    display: none;
  }
  #dir-panel.results-shown #dir-summary {
    display: flex !important;
  }
  /* When editing, hide summary and show inputs */
  #dir-panel.results-shown.search-editing #dir-inputs,
  #dir-panel.results-shown.search-editing #dir-time-bar,
  #dir-panel.results-shown.search-editing #dir-mode-bar,
  #dir-panel.results-shown.search-editing #dir-go {
    display: flex;
  }
  #dir-panel.results-shown.search-editing #dir-summary {
    display: none !important;
  }
}
/* Desktop: never show summary, always show full inputs */
@media (min-width: 769px) {
  #dir-summary { display: none !important; }
}

/* ── Focused route view ── */
#dir-panel.route-focused #dir-inputs,
#dir-panel.route-focused #dir-time-bar,
#dir-panel.route-focused #dir-mode-bar,
#dir-panel.route-focused #dir-go,
#dir-panel.route-focused #dir-head,
#dir-panel.route-focused #dir-summary {
  display: none !important;
}
#dir-panel.route-focused #dir-results {
  flex: 1;
}
#dir-focused-head {
  display: none; flex-direction: column;
  flex-shrink: 0;
}
#dir-panel.route-focused #dir-focused-head { display: flex; }

.focused-top-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px 11px 14px;
  border-bottom: 1px solid var(--border-light);
}
.focused-od {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
}
.focused-od-text {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100px;
}
.focused-od-arrow { flex-shrink: 0; color: var(--text-3); }
#dir-focused-back {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: none; border-radius: 50%;
  cursor: pointer; color: var(--text-3);
  transition: color .15s;
}
#dir-focused-back:hover { color: var(--text-2); }

.focused-info-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px 11px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border-light);
}
#focused-chain { gap: 5px; flex-shrink: 0; }
.focused-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--text-3);
}
.focused-meta svg { opacity: .5; }

.itin-card.focused {
  margin: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface); cursor: default;
  padding: 16px 18px;
}
.itin-card.focused .itin-header { display: none; }
.itin-card.focused .itin-chain { display: none; }
.itin-card.focused .itin-zones { display: none; }
.itin-card.focused .itin-legs {
  display: block;
  margin-top: 0; padding-top: 0;
  border-top: none;
}
.itin-card.focused .itin-expand { display: none; }

/* Focused leg rows get more breathing room */
.itin-card.focused .leg-row { padding: 8px 0; }
.itin-card.focused .leg-icon { width: 26px; height: 26px; }
.itin-card.focused .leg-icon svg { width: 14px; height: 14px; }
.itin-card.focused .leg-mode-name { font-size: 15px; }
.itin-card.focused .leg-stops { font-size: 14px; }
.itin-card.focused .leg-stop-time { font-size: 12px; min-width: 42px; }
.itin-card.focused .leg-inter-stop { padding: 5px 0 5px 12px; }
.itin-card.focused .leg-inter-name { font-size: 13px; }
.itin-card.focused .leg-expandable { padding: 10px 8px; margin: -4px -8px; }

@media (max-width: 768px) {
  #dir-panel.route-focused {
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    top: 0;
  }
  #dir-panel.route-focused .sheet-drag { display: none; }
}

.leg-row { display: flex; gap: 12px; padding: 6px 0; }
.leg-timeline { width: 24px; display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.leg-icon { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; }
.leg-icon svg { width: 12px; height: 12px; }
.leg-line { flex: 1; width: 2px; border-radius: 2px; margin-top: 4px; min-height: 14px; opacity: .4; }
.leg-info { flex: 1; min-width: 0; }
.leg-mode-name { font-size: 14px; font-weight: 700; color: var(--text); }
.leg-stops { font-size: 13px; color: var(--text-2); margin-top: 3px; display: flex; align-items: baseline; gap: 6px; }
.leg-stop-time { font-size: 12px; color: var(--text-3); font-weight: 700; font-variant-numeric: tabular-nums; min-width: 38px; }
.leg-dist { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ── Expandable transit legs ── */
.leg-expandable { cursor: pointer; border-radius: var(--r-xs); margin: -2px -6px; padding: 8px 6px; transition: background-color .15s; }
.leg-expandable:hover { background: var(--surface-2); }
.leg-expandable.leg-open { background: var(--accent-soft); }
.leg-expand-hint { font-size: 12px; font-weight: 600; color: var(--accent-muted); margin-left: 6px; white-space: nowrap; }
.leg-chevron { display: inline-block; transition: transform .25s; font-size: 12px; }
.leg-expandable.leg-open .leg-chevron { transform: rotate(90deg); }

.leg-intermediate { display: none; margin: 6px 0 2px; border-left: 2px solid var(--border); }
.leg-expandable.leg-open .leg-intermediate { display: block; }
.leg-inter-stop { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 10px; }
.leg-inter-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; opacity: .5; }
.leg-inter-name { font-size: 12px; color: var(--text-2); }
.leg-inter-name small { color: var(--text-3); }

/* ── Zone badges ── */
.itin-zones {
  display: flex; align-items: center; gap: 5px;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border-light);
}
.itin-zones-label {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.zone-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: #fff; line-height: 1;
}
.zone-badge.zone-a { background: #1A73B8; }
.zone-badge.zone-b { background: #1FA86A; }
.zone-badge.zone-c { background: #D8B56A; }
.zone-badge.zone-d { background: #FF6319; }
.zone-badge.zone-default { background: #8d99a5; }
.zone-badge.zone-inline { width: auto; height: 16px; padding: 0 5px; border-radius: 4px; font-size: 10px; vertical-align: middle; margin-left: 2px; }

/* ═══════════════════════════════════════════════════════
   ROUTE SNACKBAR (pill style)
   ═══════════════════════════════════════════════════════ */
#route-snackbar {
  position: absolute; z-index: 10;
  bottom: calc(var(--tab-h) + var(--safe-b) + 14px);
  left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 8px 8px 8px 12px;
  cursor: pointer;
  animation: snackUp .3s ease-out;
  /* Stay narrow enough to never overlap side pills */
  max-width: min(calc(100vw - 128px), 360px);
  min-width: 0;
}
@keyframes snackUp {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#snackbar-body {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
}
.snackbar-icon-wrap {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.18);
  border-radius: var(--r-xs);
  color: #fff;
}
#snackbar-content { flex: 1; min-width: 0; line-height: 1.3; }
#snackbar-title {
  font-size: 13px; font-weight: 600; color: #fff;
  display: flex; align-items: baseline; overflow: hidden;
  white-space: nowrap;
}
#snackbar-from, #snackbar-to {
  flex: 1 1 0; min-width: 0; max-width: max-content;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.snack-arrow { flex-shrink: 0; }
#snackbar-sub {
  font-size: 11.5px; font-weight: 500; color: rgba(255,255,255,.78);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
#snackbar-sub:empty { display: none; }
/* Close button on blue background */
#snackbar-close.sheet-x {
  background: rgba(255,255,255,.18);
  color: #fff;
}
#snackbar-close.sheet-x:hover { background: rgba(255,255,255,.28); color: #fff; }

/* ═══════════════════════════════════════════════════════
   PRAYER TIMES CARD
   ═══════════════════════════════════════════════════════ */
#prayer-snack {
  position: absolute; z-index: 9;
  top: calc(var(--safe-t) + 14px);
  left: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  width: 44px;
  overflow: hidden;
  transition: width .3s cubic-bezier(.32,.72,0,1),
              border-radius .3s ease,
              box-shadow .3s ease;
}

/* ── Collapsed pill ── */
#prayer-pill {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text-3);
  transition: color .15s, opacity .2s ease;
}
#prayer-pill:hover  { color: var(--text-2); }
#prayer-pill:active { color: var(--accent); }
#prayer-snack:not(.collapsed) #prayer-pill {
  position: absolute; top: 0; left: 0;
  pointer-events: none;
}

/* Expand / collapse animation */
#prayer-expanded {
  opacity: 1;
  transition: opacity .2s ease .08s;
  white-space: nowrap;
}
#prayer-snack.collapsed #prayer-expanded {
  opacity: 0;
  pointer-events: none;
  height: 0; overflow: hidden;
}

/* ── Expanded card ── */
#prayer-snack:not(.collapsed) {
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: min(80vw, 240px);
}

/* ── Header ── */
#prayer-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 6px 0 42px;
  height: 44px;
}
.prayer-snack-clickable {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.prayer-hdr-text {
  flex: 1; min-width: 0;
}
#prayer-snack-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Header action buttons */
.prayer-hdr-btn {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: none; border-radius: 50%;
  cursor: pointer; color: var(--text-3);
  transition: color .15s;
}
.prayer-hdr-btn:hover {
  color: var(--text-2);
}
#prayer-chevron {
  transition: transform .25s ease, color .15s, background .15s;
}
#prayer-snack.expanded #prayer-chevron {
  transform: rotate(180deg);
}

/* ── Prayer times list ── */
#prayer-times-list {
  max-height: 0; overflow: hidden;
  transition: max-height .3s cubic-bezier(.32,.72,0,1);
}
#prayer-snack.expanded #prayer-times-list {
  max-height: 320px;
  border-top: 1px solid var(--border);
}
.prayer-time-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 12px;
  transition: background .12s;
  position: relative;
}
.prayer-time-item + .prayer-time-item {
  border-top: 1px solid var(--border-light);
}
.prayer-time-item:last-child {
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}
@media (hover: hover) {
  .prayer-time-item:hover { background: var(--surface-2); }
}

/* Current prayer — gold accent */
.prayer-time-item.current {
  background: var(--gold-soft);
}
.prayer-time-item.current::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--gold);
  border-radius: 0 2px 2px 0;
}
.prayer-time-item.current:hover { background: #f0eadb; }

/* Next prayer — accent */
.prayer-time-item.next {
  background: var(--accent-soft);
}
.prayer-time-item.next::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.prayer-time-item.next:hover { background: #dae8f3; }

/* Prayer name + label */
.prayer-time-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.prayer-time-item.current .prayer-time-name { font-weight: 600; color: var(--gold); }
.prayer-time-item.next .prayer-time-name    { font-weight: 600; color: var(--accent); }



/* Prayer time value */
.prayer-time-value {
  font-size: 13px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

/* ── Origin-needed flash (mosque icon, no origin) ── */
@keyframes origin-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(214,69,69,.5); }
  60%  { box-shadow: 0 0 0 6px rgba(214,69,69,.08); }
  100% { box-shadow: 0 0 0 8px rgba(214,69,69, 0); }
}
#dir-field-from.origin-needed {
  border-color: var(--danger) !important;
  background: var(--danger-soft) !important;
  animation: origin-pulse .65s ease-out 2 !important;
}

/* Clear route button in dir header */
.dir-clear-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border: 1.5px solid var(--danger);
  background: var(--danger-soft); color: var(--danger);
  border-radius: var(--r-pill);
  font-family: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: color .15s;
}
.dir-clear-btn:hover { color: #b33636; }

@media (min-width: 769px) {
  #route-snackbar { bottom: 24px; }
}

/* ═══════════════════════════════════════════════════════
   MARKERS
   ═══════════════════════════════════════════════════════ */
.dir-origin-marker {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--success); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
.dir-dest-marker {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--danger); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}
.map-click-mode { cursor: crosshair !important; }

.dir-field.picking {
  border-color: var(--accent) !important; background: var(--accent-soft) !important;
  animation: pickPulse 1.4s ease-in-out infinite;
}
@keyframes pickPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(26,115,184,.1); }
  50% { box-shadow: 0 0 0 6px rgba(26,115,184,.05); }
}

.loc-marker { width: 22px; height: 22px; position: relative; }
.loc-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(26,115,184,.35);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); z-index: 2;
}
.loc-ring {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(26,115,184,.08);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%); z-index: 1;
  animation: locPulse 2.2s ease-out infinite;
}
@keyframes locPulse {
  0% { transform: translate(-50%,-50%) scale(.5); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(2.4); opacity: 0; }
}

.pin-marker {
  cursor: pointer;
}
@keyframes markerDrop {
  0% { transform: translateY(-16px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.pin-outer {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: var(--surface); border: 2px solid var(--pin-c, var(--accent));
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  position: relative;
}
.pin-outer svg { flex-shrink: 0; }
.pin-arrow {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; background: var(--surface);
  border-right: 2px solid var(--pin-c, var(--accent));
  border-bottom: 2px solid var(--pin-c, var(--accent));
  border-radius: 0 0 2px 0;
  transform: translateX(-50%) rotate(45deg);
}

/* ═══════════════════════════════════════════════════════
   POPUPS
   ═══════════════════════════════════════════════════════ */
.maplibregl-popup-content {
  border-radius: var(--r-lg) !important; padding: 16px 18px !important;
  box-shadow: var(--shadow-lg) !important;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif !important;
}

/* Pin action popup */
.pin-action-popup .maplibregl-popup-content {
  padding: 10px 10px !important;
  border-radius: var(--r-md) !important;
  min-width: 0;
}
.pin-action-popup .maplibregl-popup-close-button { display: none !important; }
.pin-actions { display: flex; gap: 6px; }
.pin-act-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  color: #fff;
  border-radius: var(--r-sm); cursor: pointer;
  transition: filter .15s;
  white-space: nowrap;
}
.pin-act-btn:hover { filter: brightness(1.12); }
.pin-act-btn svg { flex-shrink: 0; }
.pin-act-dir { background: var(--accent); }
.pin-act-rm { background: var(--danger, #d93025); }
.maplibregl-popup-close-button {
  font-size: 18px !important; top: 10px !important; right: 12px !important;
  color: var(--text-3) !important; width: 24px !important; height: 24px !important;
  transition: color .15s !important;
}
.maplibregl-popup-close-button:hover { color: var(--text) !important; }
.pop-title { font-weight: 700; font-size: 15px; color: var(--text); margin-bottom: 3px; }
.pop-coords { font-size: 12px; color: var(--text-3); margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.pop-del {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--danger); color: #fff; border: none;
  border-radius: var(--r-sm); padding: 7px 14px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}
.pop-del:hover { filter: brightness(1.12); }

/* ── Stop popup ── */
.stop-popup-wrap .maplibregl-popup-content {
  padding: 0 !important; overflow: hidden;
  border-radius: var(--r-md) !important;
  width: auto; min-width: 160px; max-width: min(250px, 88vw);
  box-shadow: 0 8px 30px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08) !important;
  background: var(--surface) !important;
}
.stop-popup-wrap .maplibregl-popup-close-button {
  display: none !important;
}

.sp { display: flex; flex-direction: column; }

/* Head ── colored band with icon, name, sub */
.sp-head {
  display: grid; grid-template: "icon title" auto "icon sub" auto / auto 1fr;
  gap: 0 8px; padding: 10px 12px;
  background: var(--sc);
  color: #fff;
}
.sp-icon {
  grid-area: icon; align-self: center;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border-radius: 8px;
}
.sp-icon svg { width: 16px; height: 16px; color: #fff; }
.sp-title {
  grid-area: title; font-size: 14px; font-weight: 600;
  line-height: 1.2; align-self: end;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-sub {
  grid-area: sub; font-size: 11px; font-weight: 600;
  opacity: .75; line-height: 1.4;
  display: flex; align-items: center; gap: 5px;
}
.sp-code {
  background: rgba(255,255,255,.18); padding: 2px 6px;
  border-radius: 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .3px; opacity: 1; line-height: 1;
}

/* Route chips area */
.sp-routes {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 12px;
  max-height: 150px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sp-routes::-webkit-scrollbar { width: 3px; }
.sp-routes::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sp-routes:empty { display: none; }

/* Route chip ── outlined style with color accent */
.sp-chip {
  display: inline-flex; align-items: center; gap: 3px;
  height: 24px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 700; color: #fff;
  background: var(--rc, var(--accent));
  letter-spacing: .15px; cursor: default;
  white-space: nowrap;
  transition: filter .15s;
}
.sp-chip:hover { filter: brightness(1.12); }
.sp-chip small {
  font-weight: 600; font-size: 11px; opacity: .85;
  max-width: 80px; overflow: hidden; text-overflow: ellipsis;
}

/* Mode separator */
.sp-sep {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--border); align-self: center;
  margin: 0 1px;
}

/* Tooltip */
.sp-tip {
  position: fixed; z-index: 9999;
  background: var(--text); color: #fff;
  font-family: inherit;
  font-size: 11px; font-weight: 500; line-height: 1.35;
  padding: 5px 9px; border-radius: var(--r-xs);
  white-space: normal; max-width: 200px; width: max-content;
  box-shadow: 0 3px 12px rgba(0,0,0,.2);
  pointer-events: none;
  opacity: 0; transition: opacity .12s ease;
}
.sp-tip.visible { opacity: 1; }

/* Loading & empty */
.sp-loading {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-3); padding: 6px 10px;
}
.sp-spin {
  width: 12px; height: 12px; border: 2px solid var(--surface-3);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .6s linear infinite;
}
.sp-empty {
  font-size: 11px; color: var(--text-3); padding: 6px 10px;
  display: block;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* ── Search ── */
  #search-card { right: 12px; bottom: 172px; }
  #search-card:not(.collapsed) { width: min(94vw, 360px); }
  #search-box { height: 48px; padding: 0 14px; }
  #search-input { font-size: 16px; } /* ≥16px prevents iOS zoom */
  #search-drop { max-height: 44vh; }

  /* ── Controls ── */
  #zoom-pill { right: 12px; bottom: 80px; }
  #style-picker { right: 12px; bottom: 224px; }

  /* ── Tab bar with safe area ── */
  #tab-bar {
    height: 56px;
    bottom: calc(12px + var(--safe-b));
  }
  .tab { font-size: 11px; }
  .tab svg { width: 20px; height: 20px; }

  /* ── Touch target minimums (44px recommended by Apple/Google) ── */
  .sheet-x { width: 36px; height: 36px; }
  .clear-btn { width: 36px; height: 36px; }
  .dir-field-btn { width: 40px; height: 40px; }
  .cal-nav { width: 38px; height: 38px; }
  #dir-swap { width: 40px; height: 40px; }

  /* ── Inputs: 16px prevents iOS auto-zoom ── */
  .dir-field input { font-size: 16px; }
  .sg-label input, .sg-label select, .sg-label textarea { font-size: 16px; }
  #dir-date, #dir-time { font-size: 16px; }

  /* ── Directions panel ── */
  .itin-card { margin: 6px 12px; padding: 14px; }
  #dir-inputs { padding: 12px 12px 0; gap: 6px; }
  #dir-mode-bar { padding: 10px 12px 10px; }
  #dir-time-bar { padding: 0 12px 10px; }
  #dir-go { margin: 0 12px 12px; height: 48px; font-size: 16px; }
  .dir-suggest { max-height: 180px; }

  /* ── Sheet drag handle ── visual indicator only on mobile ── */
  .sheet-drag { padding: 6px 0 0; }
  .sheet-drag span { width: 32px; height: 3px; }

  /* ── Sheet header ── compact on mobile ── */
  .sheet-head { padding: 6px 12px 10px; gap: 10px; }
  .sheet-action-btn { width: 28px; height: 28px; }
  .sheet-action-btn svg { width: 14px; height: 14px; }
  .sheet-x { width: 30px; height: 30px; }

  /* ── Filter chips ── */
  #tf-toggle { padding: 7px 14px; font-size: 13px; }
  .tf-chip { padding: 7px 14px; font-size: 13px; }

  /* ── Places list touch targets ── */
  #places-list li,
  #places-empty { padding: 12px; }
  #places-empty { margin: 8px 12px 12px; }

  /* ── Snackbar safe area ── */
  #route-snackbar { bottom: calc(var(--tab-h) + var(--safe-b) + 20px); }

  /* ── Suggest overlay: bottom sheet on phone ── */
  #suggest-overlay { padding: 0; align-items: flex-end; }
  #suggest-card {
    max-width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: var(--safe-b);
  }
  #suggest-form { padding-bottom: 24px; }
  .sg-label input, .sg-label select, .sg-label textarea { font-size: 16px; }

  /* ── Sheet safe area for bottom padding ── */
  .sheet { padding-bottom: var(--safe-b); }

  /* ── Place popup mobile sizing ── */
  .place-popup-wrap .maplibregl-popup-content {
    max-width: min(300px, 90vw);
  }

  /* ── Pin action popup: horizontal buttons still ── */
  .pin-act-btn { padding: 9px 16px; font-size: 13px; }

  /* ── Remove sticky hover on touch devices ── */
  .tab:hover { color: var(--text-3); }
  .tab:active { color: var(--accent); }
  #zoom-pill button:hover { color: var(--text-3); }
  #search-pill:hover { color: var(--text-3); }
  .pf-chip:not(.active):hover .pf-icon { background: color-mix(in srgb, var(--pf-c) 12%, transparent); }
  .pf-chip:not(.active):hover .pf-label { color: var(--text-3); }

  .itin-card:not(.active):not(.focused):hover { background: var(--surface); border-color: var(--border); }
  #places-list li:hover { background: var(--surface); }
  #results-list li:hover { background: var(--surface); }
}

@media (max-width: 380px) {
  #search-card:not(.collapsed) { width: min(94vw, 320px); }
  #search-box { gap: 6px; }
  .pf-icon { width: 34px; height: 34px; }
  .pf-label { font-size: 11px; }
  .pin-actions { flex-direction: column; }
  .pin-act-btn { width: 100%; justify-content: center; }
}
