:root {
  --bg: #0b0f14;
  --card: #151b23;
  --card2: #1b2330;
  --line: #2a3342;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #4f9cf9;
  --accent2: #6ee7b7;
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-top, 0)) 16px;
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font-size: 18px; letter-spacing: 0.3px; }
.logo b { color: var(--accent); }
.status { font-size: 13px; color: var(--muted); text-align: right; max-width: 62%; line-height: 1.35; }
main { max-width: 520px; margin: 0 auto; padding: 10px 16px 16px; }

/* ---- Voice ---- */
.voice { display: flex; flex-direction: column; align-items: center; padding: 6px 0 6px; }
.heard { min-height: 22px; font-size: 15px; color: var(--accent2); margin-bottom: 10px; text-align: center; }
.heard:empty { display: none; } /* no dead box above the mic before the first utterance */

.mic-row { display: flex; gap: 16px; align-items: flex-start; justify-content: center; }
.mic-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mic {
  width: 84px; height: 84px; border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 30% 30%, #6ab0ff, #2f6fd0 60%, #1f4f9e);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 30px rgba(79, 156, 249, 0.35);
  transition: transform 0.15s ease;
}
.mic:active { transform: scale(0.93); }
.mic.listening { animation: pulse 1.4s ease-out infinite; }
.mic.recording {
  background: radial-gradient(circle at 30% 30%, #ff7a6b, #d63c2c 60%, #a02010);
  animation: pulseRed 1.2s ease-in-out infinite;
}
.mic.researching { animation: pulseAmber 1.2s ease-in-out infinite; }
.mic.disabled { opacity: 0.5; }
@keyframes pulseRed {
  0% { box-shadow: 0 0 0 0 rgba(216, 60, 44, 0.6); }
  70% { box-shadow: 0 0 0 26px rgba(216, 60, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(216, 60, 44, 0); }
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 156, 249, 0.55); }
  70% { box-shadow: 0 0 0 26px rgba(79, 156, 249, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 156, 249, 0); }
}
@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(210, 153, 34, 0.55); }
  70% { box-shadow: 0 0 0 22px rgba(210, 153, 34, 0); }
  100% { box-shadow: 0 0 0 0 rgba(210, 153, 34, 0); }
}
.hint { margin-top: 0; font-size: 14px; color: var(--muted); }

/* ---- Chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 10px 0 4px; }
.chip {
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 15px; font-size: 14px; cursor: pointer;
}
.chip:active { background: var(--card2); }

/* ---- Fallback text input ---- */
.fallback { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; }
.fb-note { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; }
input[type="text"] {
  flex: 1; min-width: 0;
  background: var(--card2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 16px;
}
input[type="text"]:focus { outline: none; border-color: var(--accent); }

/* ---- Destination bar ---- */
.dest { margin: 12px 0; }

/* ---- Options row ---- */
.options {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 10px 0; font-size: 13px; color: var(--muted);
}
.toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.opt-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

/* ---- Buttons ---- */
.btn {
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 14px; cursor: pointer;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn.solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 9px 11px; font-size: 13px; }
.btn.ghost { background: transparent; }

/* ---- Spoken transcript ---- */
.spoken {
  background: var(--card); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 10px 12px; margin: 10px 0;
  font-size: 14px; line-height: 1.45;
}

/* ---- Results ---- */
.results { padding-top: 6px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin: 14px 0; position: relative;
}
.card.top { border-color: var(--accent); box-shadow: 0 4px 24px rgba(79, 156, 249, 0.18); }
.badge {
  position: absolute; top: -11px; right: 12px;
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 11px; font-weight: 600; padding: 3px 10px;
}
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.rank-dot {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; margin-top: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.rank {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--card2); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.card.top .rank { background: var(--accent); color: #fff; }
.card-title { flex: 1; min-width: 0; }
.name { font-size: 16px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.score { font-size: 18px; font-weight: 700; color: var(--accent2); }
.why { margin-top: 8px; font-size: 13px; color: var(--accent2); line-height: 1.4; }

.chips2 { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.pill {
  background: var(--card2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 9px; font-size: 12px;
}
.bar { height: 6px; border-radius: 3px; background: var(--card2); overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card-actions .btn { flex: 1; }
.details {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 13px; color: var(--muted); line-height: 1.7;
}
.details a { color: var(--accent); }
.details .yelp-attr { opacity: .6; font-size: 11px; }

.empty { color: var(--muted); text-align: center; padding: 30px 10px; line-height: 1.6; }

/* ---- Analysis panel ---- */
.analysis {
  background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px; margin: 12px 0;
}
.analysis-title { font-weight: 600; font-size: 15px; color: var(--accent2); margin-bottom: 8px; }
.analysis-body { font-size: 14px; line-height: 1.65; color: var(--text); white-space: pre-wrap; }

/* ---- In-app driving directions panel ---- */
.route-panel {
  background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 12px 14px; margin: 12px 0; scroll-margin-top: 56px; /* clear the sticky header */
}
.route-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route-title { font-weight: 600; font-size: 15px; color: var(--accent2); flex: 1; min-width: 0; }
.route-meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.route-google { display: inline-block; font-size: 12.5px; color: var(--accent2); margin: 0 0 6px; text-decoration: none; }
.route-google:hover { text-decoration: underline; }
.route-steps { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.route-steps li {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 4px;
  border-top: 1px dashed var(--line); font-size: 13.5px; line-height: 1.4;
}
.route-steps li:first-child { border-top: 0; }
.rs-ico { flex: none; width: 22px; text-align: center; }
.rs-txt { flex: 1; min-width: 0; }
.rs-dist { flex: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
/* Follow mode active: pulse the button so the driver knows it's live */
#routeFollow.solid { animation: route-follow-pulse 1.6s ease-in-out infinite; }
@keyframes route-follow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 156, 249, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(79, 156, 249, 0); }
}

/* ---- Rate panel (per card) ---- */
.rate { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.rate-row { display: flex; gap: 8px; flex-wrap: wrap; }
.rate select, .rate textarea, .prefs-panel select, .prefs-panel input, .prefs-panel textarea {
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; font-size: 14px;
}
.rate select { flex: 1; min-width: 90px; }
.rate textarea { width: 100%; margin-top: 8px; min-height: 48px; resize: vertical; }
.rate .btn { margin-top: 8px; }

/* ---- Preferences panel ---- */
.prefs-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin: 10px 0; display: flex; flex-direction: column; gap: 10px;
  scroll-margin-top: 56px; /* clear the sticky header when scrolled into view */
}
/* Hidden-gem badge (AI-verified research flag on food/drink picks) */
.gem-badge {
  display: inline-block; margin-top: 3px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: #7c4a03;
  background: linear-gradient(135deg, #fde68a, #fcd34d); border: 1px solid #f59e0b;
}

/* Pinned-favorite button state on cards */
.pin-btn.pinned { color: #fcd34d; border-color: #f59e0b; }

/* Live list filter (name/cuisine/address search over the results) */
.list-filter {
  width: 100%; margin: 10px 0 4px; padding: 10px 12px; border-radius: 10px;
  background: var(--card2); color: var(--text); border: 1px solid var(--line); font-size: 14px;
}
.list-filter:focus { outline: none; border-color: var(--accent); }

.prefs-title { font-size: 14px; font-weight: 600; }
.prefs-title .muted { font-weight: 400; font-size: 12px; color: var(--muted); }
.pref-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pref-row input, .pref-row textarea { margin-top: 2px; }
.pref-row textarea { min-height: 52px; resize: vertical; }

footer {
  max-width: 520px; margin: 24px auto 0; padding: 0 16px 20px;
  font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5;
}

.hidden { display: none !important; }

/* ---- Coverage map (front page) ---- */
.coverage {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 10px 0; overflow: hidden;
}
.coverage-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: 0; color: var(--text);
  padding: 12px 14px; cursor: pointer; text-align: left; font-size: 14px; font-weight: 600;
}
.coverage-head:hover { background: var(--card2); }
.coverage-title { white-space: nowrap; }
.coverage-summary {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: 400; color: var(--muted);
}
.coverage-caret { color: var(--muted); font-size: 12px; }
.coverage-body { padding: 0 12px 12px; }
.coverage-map { height: 240px; border-radius: 12px; border: 1px solid var(--line); background: #0b0f14; }
.coverage-note { font-size: 12px; color: var(--muted); margin: 10px 2px 0; line-height: 1.5; }
.leaflet-container { font-family: inherit; }
.coverage-circle {
  fill: rgba(46, 158, 78, 0.18); stroke: #2e9e44; stroke-width: 1.5; fill-opacity: 0.18;
}
.coverage-route { stroke: #1f6fd6; stroke-width: 2.5; stroke-dasharray: 6 6; opacity: 0.75; }
.coverage-label {
  background: rgba(11, 15, 20, 0.85); color: #9ee7b0; border: 1px solid #2e9e44;
  border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
/* Owner-built pre-trip areas are drawn with the same .coverage-circle /
 * .coverage-label styles as the DB regions (visible at any zoom); the
 * label sits a touch below center so it doesn't stack on a same-spot
 * region label (e.g. “Galveston pre-trip” over “Galveston”). */
.coverage-area-label { transform: translateY(16px); }

/* ---- Paid searches / unlock panel / owner mode ---- */
.credit-pill {
  background: var(--card2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-size: 12px; color: var(--accent2);
}
.unlock {
  background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 16px; margin: 10px 0; text-align: center;
}
.unlock-title { font-size: 15px; font-weight: 700; color: var(--accent2); margin-bottom: 8px; }
.unlock-text { font-size: 13.5px; color: var(--text); line-height: 1.55; margin: 0 0 12px; }
.unlock-packs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 10px; }
.unlock-packs .pack { padding: 10px 16px; font-size: 14px; }
.unlock-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 0 0 12px; }
.owner-login { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.owner-login input {
  background: var(--card2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; font-size: 14px; min-width: 180px;
}
.owner-link { display: inline-block; margin-top: 10px; font-size: 12px; color: var(--muted); text-decoration: underline; }
.coverage-note a { color: var(--accent2); }

/* ---- EVENTULIST link (header) ---- */
.ev-link {
  flex: none;
  color: var(--accent2); text-decoration: none;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 6px 11px; white-space: nowrap;
}
.ev-link:hover { background: var(--accent); color: #0b0f14; }
@media (max-width: 420px) {
  .ev-link { font-size: 11px; padding: 5px 9px; }
}

/* ---- Search radius presets ---- */
.radius-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; margin: 10px 0;
}
.radius-label { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.radius-presets {
  display: flex; gap: 5px; flex-wrap: nowrap; flex: 1 1 100%; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.radius-presets::-webkit-scrollbar { display: none; }
.radius-presets button, .radius-auto {
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 999px; padding: 5px 9px; font-size: 12px; cursor: pointer;
  flex: 0 0 auto; white-space: nowrap;
}
.radius-presets button:hover, .radius-auto:hover { border-color: var(--accent); }
.radius-presets button.on { background: var(--accent); color: #0b0f14; border-color: var(--accent); font-weight: 700; }
.radius-auto.on { background: var(--accent2); color: #0b0f14; border-color: var(--accent2); font-weight: 700; }
.radius-row.auto .radius-label::after { content: " · auto"; color: var(--accent2); font-weight: 700; }

/* ---- Units toggle (km | mi) ---- */
.unit-toggle {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px;
}
.unit-toggle button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; cursor: pointer;
}
.unit-toggle button:hover { color: var(--text); }
.unit-toggle button.on { background: var(--accent); color: #0b0f14; }

/* ---- Open-now / include-closed chip (after the Events chip) ---- */
.opennow-chip { white-space: nowrap; }
.opennow-chip:hover { border-color: var(--accent); }
.opennow-chip.on { background: var(--accent); color: #0b0f14; border-color: var(--accent); font-weight: 700; }

/* ---- Answer mode toggle (🤖 AI | ⚡ Instant) ---- */
.mode-toggle {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px;
}
.mode-toggle button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.mode-toggle button:hover { color: var(--text); }
.mode-toggle button.on { background: var(--accent); color: #0b0f14; }

/* ---- Instant-mode list header ---- */
.list-head {
  font-size: 12.5px; color: var(--muted); text-align: center;
  padding: 8px 10px; margin: 8px 0 4px;
  background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius);
}

/* ---- Load more button (instant-mode dumps) ---- */
.load-more {
  display: block; margin: 12px auto 4px; padding: 10px 20px; font-size: 14px;
}

/* ---- Back-to-list button ---- */
.back-btn { display: block; margin: 10px auto 2px; font-size: 13.5px; }

/* ---- Menu-reading glow: highlights the card whose menu is being read ---- */
.menu-glow {
  border-color: var(--accent) !important;
  animation: menuGlowCard 1.6s ease-in-out infinite;
}
.menu-glow [data-menu] {
  background: var(--accent); color: #0b0f14; border-color: var(--accent);
  animation: menuGlowBtn 1.6s ease-in-out infinite;
}
@keyframes menuGlowCard {
  0%, 100% { box-shadow: 0 0 0 1px rgba(46, 158, 78, 0.35); }
  50% { box-shadow: 0 0 0 2px rgba(46, 158, 78, 0.65), 0 0 20px rgba(46, 158, 78, 0.5); }
}
@keyframes menuGlowBtn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(11, 15, 20, 0); }
  50% { box-shadow: 0 0 14px 4px rgba(46, 158, 78, 0.85); }
}

/* ---- Refresh stale cached menu ---- */
.menu-fresh { display: block; margin: 12px auto 4px; }

/* ---- Results map: desktop split (cards left, sticky map right) and
 * phone layout (map above the list, full width) ---- */
.results-wrap { display: flex; flex-direction: column; gap: 10px; }
/* draggable list↔map divider — desktop only */
.split-handle { display: none; }
.results-map-panel { display: flex; flex-direction: column; gap: 8px; }
.results-map {
  height: 44vh; min-height: 260px;
  border-radius: 14px; border: 1px solid var(--line); background: #0b0f14;
}
.map-legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--muted); }
.map-legend .lg {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
}
/* the always-on trail overlay toggle (legend + coverage button) */
.trails-toggle {
  font: inherit; cursor: pointer; color: var(--muted);
  background: var(--card2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px;
  opacity: 0.75;
}
.trails-toggle:hover { opacity: 1; border-color: var(--muted); }
.trails-toggle.on { color: #f472b6; border-color: #f472b6; opacity: 1; background: rgba(244, 114, 182, 0.08); }
.coverage-layers { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; flex-wrap: wrap; }
.coverage-layers-hint { color: var(--muted); font-size: 11px; }
.map-legend .lg i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-legend .lg i.ring { width: 12px; height: 12px; border-width: 3px; border-style: solid; background: transparent; }
/* phone: the map sits right above the list, both in flow — visible
 * together, nothing overlaps, page scrolls as one */
@media (max-width: 899px) {
  .results-map-panel { order: -1; margin: 10px 0 0; }
  .results-map { height: 44vh; min-height: 300px; border-radius: 12px; }
}
/* Desktop: map + list side by side, sticky map on the right — the
 * eventulist-style split with all the map features (pins, clusters,
 * selection glow, you-dot, routes, legend, pin↔card sync) */
@media (min-width: 900px) {
  /* results reach the page edges; controls stay centered */
  main { max-width: none; padding: 10px 0 16px; }
  main > *:not(.results-wrap):not(#spokenBox) { max-width: 960px; margin-left: auto; margin-right: auto; }
  .results-wrap { flex-direction: row; flex-wrap: wrap; gap: 16px; align-items: flex-start; padding: 0 16px; }
  #results { flex: 1 1 0; min-width: 0; }
  #listFilter { flex: 1 0 100%; } /* its own full-width row above the split */
  /* draggable divider between list and map (resizes the map column) */
  .split-handle {
    display: block; flex: 0 0 12px; cursor: col-resize;
    position: sticky; top: 76px; align-self: flex-start;
    height: calc(100vh - 210px); min-height: 380px;
    touch-action: none; user-select: none;
  }
  .split-handle::after {
    content: ''; position: absolute; left: 50%; top: 18%; bottom: 18%; width: 4px;
    transform: translateX(-50%); border-radius: 2px; background: var(--line);
  }
  .split-handle:hover::after, .split-handle.dragging::after { background: var(--accent); }
  .results-map-panel {
    flex: 0 0 var(--map-w, calc(50% - 8px));
    position: sticky; top: 76px;
  }
  .results-map {
    height: calc(100vh - 210px); min-height: 380px;
  }
}
body.split-dragging { cursor: col-resize; user-select: none; }
@media (min-width: 900px) {
  footer { max-width: 960px; }
}
/* tap a card (not its buttons) → pan the map to it */
@media (min-width: 900px) {
  #results .card { cursor: pointer; }
  #results .card a, #results .card button, #results .card input, #results .card textarea, #results .card select { cursor: pointer; }
}
/* flash when a pin is tapped → scrolls to + highlights the card */
.card-flash { animation: menuGlowCard 1s ease-in-out 1; }

/* ---- Selected venue: persistent glow on the card + pin halo ---- */
.card-selected {
  border-color: var(--accent) !important;
  animation: menuGlowCard 1.5s ease-in-out infinite;
}
/* the halo circle is an SVG path; make it pulse */
.pin-halo {
  animation: pinHaloPulse 1.5s ease-in-out infinite;
}
@keyframes pinHaloPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

/* ---- Results map: light tiles, numbered pins, clustering, show/hide ---- */
.map-head { display: flex; align-items: center; gap: 8px; }
.map-head .map-legend { flex: 1; min-width: 0; }
.map-hide {
  flex: none; border: 1px solid var(--line); background: var(--card2); color: var(--muted);
  border-radius: 999px; width: 30px; height: 30px; font-size: 13px; cursor: pointer;
}
.map-hide:hover { color: var(--text); border-color: var(--accent); }
/* floating “show map” button (phone, when the map is hidden) */
.map-fab {
  position: fixed; right: 14px; bottom: 16px; z-index: 95;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--accent); background: var(--card); color: var(--text);
  font-size: 20px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35); cursor: pointer;
}
@media (min-width: 900px) { .map-fab { display: none !important; } }
/* when the phone map is hidden, the list gets the space back */
body.map-hidden { padding-bottom: 24px !important; }

/* numbered pins: number = position in the list */
.num-pin {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--c, #3b82f6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  position: relative;
}
.num-pin.on-light { color: #0b0f14; }
.num-pin.top { width: 30px; height: 30px; font-size: 13px; }
.num-pin.sel {
  transform: scale(1.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 18px 5px var(--c);
  z-index: 1000;
}
.num-pin .st-dot {
  position: absolute; top: -3px; right: -3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--s, rgba(15, 23, 42, 0.45)); border: 2px solid #fff;
}
/* cluster bubbles (count of merged pins) */
.mc { background: transparent; border: 0; }
.mc .mc-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(37, 99, 235, 0.92); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ---- “You” marker on the maps: smiley with a blue ring ---- */
.you-dot {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 3px solid #2563eb;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  cursor: grab;
}
.you-dot:active { cursor: grabbing; }

/* Blue distance badge beside the you-marker when a route is drawn — a
 * white pill with blue text/border so it reads over any map tile. */
.route-dist-badge { background: transparent; border: 0; box-shadow: none; }
.route-dist-badge .rd-label {
  display: inline-block; margin-left: 34px; transform: translateY(-15px);
  color: #2563eb; font-weight: 700; font-size: 13px; white-space: nowrap;
  background: #fff; border: 2px solid #2563eb; border-radius: 999px;
  padding: 2px 9px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

/* Safety legend pinned to the bottom of the coverage map — the bar is the
 * you-dot ring gradient (green = safest, red = least safe). */
.safety-legend {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; align-items: center; gap: 10px;
  background: rgba(11, 15, 20, 0.85); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 10px; color: #fff;
  font-size: 10.5px; line-height: 1.1; pointer-events: none; white-space: nowrap;
}
/* the bar + its labels share one column so “Safest/Least safe” span only
 * the bar, never the blue “No data” swatch beside it */
.safety-legend-main { display: flex; flex-direction: column; gap: 3px; }
.safety-legend-bar {
  width: 140px; height: 7px; border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, #4ade80, #f59e0b, #f97316, #dc2626);
}
.safety-legend-nodata {
  display: flex; align-items: center; gap: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.25); padding-left: 10px;
}
.safety-legend-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2563eb; display: inline-block;
}
.safety-legend-labels { display: flex; justify-content: space-between; }

/* One-click “back to live location” button, top-right of the maps —
 * appears only while the you-dot is detached from real GPS */
.locate-btn {
  position: absolute; top: 10px; right: 10px; z-index: 1000;
  background: rgba(11, 15, 20, 0.9); color: var(--text);
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.locate-btn:hover { border-color: var(--accent2); color: #fff; }

/* Handsfree toggle pinned to the radius pill's top-right corner — it
 * never pushes the pill onto a second line */
.radius-row { position: relative; }
.radius-toggle.corner {
  margin-left: auto; /* flow after the presets row (its own line), never
                        overlaying the chips like the old absolute pin did */
  white-space: nowrap;
  border: 1px solid var(--line); background: var(--card2);
  border-radius: 999px; padding: 6px 11px; font-size: 12.5px;
}
.radius-toggle.corner:hover { border-color: var(--accent); }
/* Covered-areas dropdown (radius row, before Handsfree) */
.covered-select {
  max-width: 160px; min-width: 0;
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 999px; padding: 6px 8px; font-size: 12px; cursor: pointer;
}
.covered-select:hover { border-color: var(--accent); }
/* Active search-area pill: shows the current Covered area (or dragged
 * point) stays locked across category clicks */
.area-active {
  white-space: nowrap;
  border: 1px solid var(--accent2); background: var(--card2);
  border-radius: 999px; padding: 5px 11px; font-size: 12.5px; color: var(--accent2);
}
.radius-presets { padding-right: 112px; } /* keep the last presets clear of the corner toggle */

/* Quiet (yellow) and Stop (red) control buttons — same size as the mic */
.mic.quiet {
  background: radial-gradient(circle at 30% 30%, #ffe08a, #f5b301 60%, #c98f00);
  box-shadow: 0 8px 30px rgba(245, 179, 1, 0.35); font-size: 32px;
}
/* quiet OFF: white-green (sound on) */
.mic.quiet.off {
  background: radial-gradient(circle at 30% 30%, #ffffff, #e6f6ea 60%, #b7e4c7);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.28);
  color: #166534;
}
.mic.stop {
  background: radial-gradient(circle at 30% 30%, #ff9d8f, #e03320 60%, #a01200);
  box-shadow: 0 8px 30px rgba(224, 51, 32, 0.35); font-size: 32px;
}

/* back button slot — above the spoken box and the analysis */
.analysis-back { margin: 10px 0 0; }
.analysis-back .back-btn { margin: 0 auto; }

.analysis a { color: var(--accent2); text-decoration: underline; word-break: break-all; }
.spoken a { color: var(--accent2); text-decoration: underline; word-break: break-all; }

/* Owner button lights up when signed in */
#ownerBtn.on { background: var(--accent); color: #0b0f14; border-color: var(--accent); font-weight: 700; }

/* ---- Search bar (add a new search) ---- */
.searchbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 10px 0; }
.searchbar-row { display: flex; gap: 8px; }
.searchbar-row input {
  flex: 1; min-width: 0; font-size: 16px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card2); color: var(--text);
}
.searchbar-row input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.searchbar-row .btn { padding: 11px 18px; font-size: 15px; border-radius: 10px; }
.searchbar-recent { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.recent-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.recent-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.recent-chip { font-size: 11.5px; padding: 4px 8px; }
.searchbar-hint { margin: 8px 2px 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.searchbar-hint .eg { color: var(--accent); cursor: pointer; text-decoration: underline dotted; }

/* ---- Category tiles ---- */
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card2); color: var(--text);
  border-radius: 10px; padding: 10px 6px; font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px; text-align: center;
}
.chip.opennow-chip { grid-column: span 3; }
@media (min-width: 640px) { .chips { grid-template-columns: repeat(5, 1fr); } }

/* ---- Pre-trip area map popup ---- */
.pretrip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
.pretrip-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pretrip-head h3 { margin: 0; font-size: 16px; }
.pretrip-field { margin: 10px 0; }
.pretrip-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.pretrip-row { display: flex; gap: 6px; }
.pretrip-row input { flex: 1; min-width: 0; padding: 9px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card2); color: var(--text); }
.pretrip-row .btn { white-space: nowrap; }
.pretrip-hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.pretrip-est { font-size: 13.5px; margin: 10px 0 8px; line-height: 1.5; }
.pretrip-progress { margin: 10px 0; }
.pretrip-msg { font-size: 12.5px; color: var(--muted); display: block; margin-top: 4px; }
.pretrip-note { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.pretrip #ptRadius button.on { background: var(--accent); color: #0b0f14; border-color: var(--accent); font-weight: 700; }
.pretrip-status { font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.pretrip-price { font-size: 12.5px; margin: 8px 0 6px; color: var(--text); }
.pretrip-warn { color: #dc2626; font-size: 13px; }

/* Pre-trip place-picker (Photon suggestions) */
.pt-suggest { position: relative; margin-top: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--card); z-index: 20; }
.pt-opt { display: block; width: 100%; text-align: left; padding: 9px 11px; border: 0; background: transparent; color: var(--text); font-size: 13.5px; cursor: pointer; border-bottom: 1px solid var(--line); }
.pt-opt:last-child { border-bottom: 0; }
.pt-opt.on, .pt-opt:hover { background: var(--card2); }
.pt-type { color: var(--muted); font-size: 11.5px; }
/* admin pre-trip box uses the same picker — dropdown overlays the input */
.adm-pt-wrap { flex: 1; min-width: 180px; position: relative; }
.adm-pt-wrap input { width: 100%; }
.adm-pt-wrap .pt-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; }
.pretrip-est-line { margin: 4px 0; font-size: 13.5px; }
.adm-pretrip { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
