:root {
  --bg: #0b0f17;
  --panel: #101a2b;
  --panel2: #0f1624;
  --text: #e9eef7;
  --muted: #a9b5c7;
  --border: rgba(255, 255, 255, 0.12);
  --btn: #2d6cdf;
  --btn2: #1f57ba;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  height: 100%;
  display: grid;
  grid-template-columns: 380px 1fr;
}

#panel {
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  padding: 16px;
  overflow: auto;
}

#panel h1 {
  margin: 0 0 6px 0;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.sub {
  margin: 0 0 14px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.controls .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 12px 0;
}

.controls label {
  font-size: 12px;
  color: var(--muted);
}

.hint {
  color: rgba(169, 181, 199, 0.9);
  font-size: 11px;
  line-height: 1.35;
}

input[type="range"] {
  width: 100%;
}

button {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(180deg, var(--btn), var(--btn2));
  color: white;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  filter: brightness(1.05);
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  font-size: 12px;
}

#main {
  height: 100%;
  position: relative;
}

#map { height: 100%; width: 100%; }

.map-toolbar {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  left: calc(env(safe-area-inset-left, 0px) + 18px);
  z-index: 1000;
  display: grid;
  gap: 10px;
  justify-items: start;
}

.search-toggle {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(16, 26, 43, 0.92);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  touch-action: manipulation;
}

.search-toggle[aria-expanded="true"] {
  background: linear-gradient(180deg, var(--btn), var(--btn2));
}

.search-overlay {
  position: absolute;
  inset: 0;
  z-index: 1001;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 12px 12px;
  background: rgba(6, 11, 18, 0.18);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.search-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.search-overlay-panel {
  width: min(420px, calc(100% - 12px));
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  background: rgba(16, 26, 43, 0.94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.search-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.search-overlay-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cfe9ff;
}

.search-close {
  min-height: 38px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.08);
  touch-action: manipulation;
}

.map-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background: rgba(16, 26, 43, 0.92);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.map-search input {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 16px;
  padding: 10px 12px;
}

.map-search input::placeholder {
  color: rgba(169, 181, 199, 0.8);
}

.map-mode-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  width: fit-content;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  background: rgba(16, 26, 43, 0.92);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.map-mode-button {
  min-width: 110px;
  background: rgba(255,255,255,0.04);
}

.map-mode-button.is-active {
  background: linear-gradient(180deg, var(--btn), var(--btn2));
}

.search-results {
  display: block;
  margin-top: 10px;
  max-height: 0;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(16, 26, 43, 0.96);
  box-shadow: none;
  overflow-x: hidden;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: max-height 160ms ease, opacity 160ms ease, transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  overscroll-behavior: contain;
}

.search-results.has-results {
  max-height: min(40vh, 320px);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.search-result {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.12);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover,
.search-result:active,
.search-result:focus-visible {
  background: rgba(255,255,255,0.08);
}

.search-result-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.search-result-meta {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.list {
  margin: 10px 0 0 18px;
  padding: 0;
}

.list li {
  margin: 8px 0;
}

.list button {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 4px;
}

.list button:hover {
  background: rgba(255, 255, 255, 0.10);
}

.list-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.list-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

.notes {
  margin: 10px 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.help {
  margin-top: 10px;
  color: rgba(233, 238, 247, 0.88);
  font-size: 12px;
  line-height: 1.45;
}

.help p {
  margin: 8px 0;
  color: var(--muted);
}

.help ul {
  margin: 8px 0 0 18px;
  padding: 0;
}

.help li {
  margin: 6px 0;
}

.small {
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

details {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.20);
  margin: 12px 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

#diagram svg {
  width: 100%;
  height: auto;
  margin-top: 10px;
}

/* Data-freshness status bar (C2 / m6) */
#dataStatus { display: none; }
#dataStatus.data-status {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  margin: 6px 0;
  line-height: 1.35;
}
#dataStatus.data-status--ok   { background: rgba(0, 200, 100, 0.12); color: #7fe8b0; border: 1px solid rgba(0,200,100,0.25); }
#dataStatus.data-status--warn { background: rgba(245, 180, 0, 0.12); color: #f5c542; border: 1px solid rgba(245,180,0,0.30); }
#dataStatus.data-status--info { background: rgba(0, 160, 240, 0.10); color: #7fd4f8; border: 1px solid rgba(0,160,240,0.25); }

.summary {
  margin: 14px 0 10px;
}

.summary-head h2 {
  margin: 0;
  font-size: 13px;
}

.summary-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.summary-grid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.summary-card {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  line-height: 1.1;
}

.summary-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.summary-label {
  color: #9ad3ff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Signal bars in Leaflet popups */
.sig-bars {
  margin-top: 8px;
}

.sig-header {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #c8d3e0;
}

.sig-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
  font-size: 11px;
}

.sig-label {
  width: 100px;
  flex-shrink: 0;
  color: #a9b5c7;
}

.sig-track {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  overflow: hidden;
  min-width: 60px;
}

.sig-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.2s;
}

.sig-val {
  width: 32px;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #e9eef7;
}

/* Help section headings and signal-color labels */
.help-heading {
  margin: 10px 0 6px;
  font-size: 13px;
}

.help-heading:first-child {
  margin-top: 0;
}

.clr-income { color: #7fe8b0; }
.clr-density { color: #9ad3ff; }
.clr-prox { color: #c4b5fd; }
.clr-crowd { color: #f87171; }

/* Popup friendly layout */
.popup-friendly {
  font-size: 12px;
  line-height: 1.45;
  max-width: min(88vw, 390px);
}

.maplibregl-popup-content {
  background: linear-gradient(180deg, rgba(16, 26, 43, 0.98), rgba(15, 22, 36, 0.98));
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  padding: 12px 14px;
}

.maplibregl-popup-close-button {
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.maplibregl-popup-close-button:hover,
.maplibregl-popup-close-button:focus-visible {
  background: rgba(255,255,255,0.16);
  color: #ffffff;
}

.maplibregl-popup-tip {
  border-top-color: rgba(15, 22, 36, 0.98) !important;
}

.maplibregl-ctrl-top-right {
  top: 14px;
  right: 14px;
}

.maplibregl-ctrl-group {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255,255,255,0.08);
}

.maplibregl-ctrl-group button {
  background: rgba(16, 26, 43, 0.94);
}

.maplibregl-ctrl-group button span {
  filter: invert(1);
}

.popup-score {
  font-size: 22px;
  font-weight: 700;
  margin: 2px 0 2px;
}

.popup-score-label {
  font-size: 11px;
  font-weight: 400;
  color: #a9b5c7;
}

.popup-explain {
  font-size: 12px;
  color: #b8c4d4;
  margin-bottom: 2px;
}

.popup-rank {
  font-size: 11px;
  color: #9ad3ff;
  margin-bottom: 4px;
}

.popup-detail {
  font-size: 11px;
  color: #a9b5c7;
  margin: 2px 0;
}

.popup-advisory {
  font-size: 12px;
  font-weight: 600;
  margin: 6px 0 2px;
  color: #e9eef7;
}

.heat-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: currentColor;
}
.popup-actions {
  display: flex;
  gap: 8px;
  margin: 8px 0 2px;
}

.popup-actions--wrap {
  flex-wrap: wrap;
  margin-top: 12px;
}

.popup-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.popup-action--primary {
  background: linear-gradient(180deg, var(--btn), var(--btn2));
  color: #ffffff;
}

.popup-action--secondary {
  background: rgba(255,255,255,0.04);
}

.popup-action:hover,
.popup-action:active,
.popup-action:focus-visible {
  background: rgba(255,255,255,0.14);
}

.popup-sheet {
  display: grid;
  gap: 12px;
}

.popup-header {
  display: grid;
  gap: 4px;
}

.popup-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7fd4f8;
}

.popup-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.popup-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.popup-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.popup-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  color: #dbe7f5;
  font-size: 11px;
  font-weight: 700;
}

.popup-banner {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: #dbe7f5;
  font-size: 11px;
  line-height: 1.45;
}

.popup-banner--warn {
  background: rgba(245, 197, 66, 0.12);
  border-color: rgba(245, 197, 66, 0.22);
  color: #f8dd8a;
}

.popup-banner--accent {
  background: linear-gradient(135deg, rgba(29, 168, 255, 0.16), rgba(127, 232, 176, 0.1));
  border-color: rgba(127, 212, 248, 0.24);
  color: #dff6ff;
}

.popup-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.popup-metric-card {
  min-width: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
}

.popup-metric-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fb7da;
}

.popup-metric-value {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.popup-metric-detail {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.popup-section {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.popup-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.popup-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.popup-section-meta {
  font-size: 11px;
  color: #8fb7da;
  text-align: right;
}

.popup-facts {
  display: grid;
  gap: 8px;
}

.popup-fact-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.popup-fact-label {
  min-width: 82px;
  font-size: 11px;
  color: var(--muted);
}

.popup-fact-value {
  text-align: right;
  font-size: 11px;
  color: var(--text);
  line-height: 1.45;
}

.popup-fact-link {
  color: #9ad3ff;
  text-decoration: none;
}

.popup-fact-link:hover,
.popup-fact-link:focus-visible {
  text-decoration: underline;
}

.popup-nearby-list {
  display: grid;
  gap: 8px;
  max-height: min(34vh, 260px);
  overflow: auto;
  padding-right: 2px;
}

.popup-nearby-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.popup-nearby-item--button {
  width: 100%;
  appearance: none;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.popup-nearby-item--button:hover,
.popup-nearby-item--button:focus-visible {
  background: rgba(127, 212, 248, 0.1);
  border-color: rgba(127, 212, 248, 0.22);
}

.popup-nearby-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(45,108,223,0.2);
  color: #bdddff;
  font-size: 11px;
  font-weight: 800;
}

.popup-nearby-copy {
  min-width: 0;
}

.popup-nearby-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.popup-nearby-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.popup-empty {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 11px;
}

.place-sheet-host {
  position: absolute;
  inset: 0;
  z-index: 1002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
  pointer-events: none;
}

.place-sheet-panel {
  pointer-events: auto;
  width: min(560px, calc(100% - 8px));
  max-height: min(78vh, 760px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(29, 168, 255, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(16, 28, 48, 0.98), rgba(10, 18, 31, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transform: translateY(calc(100% + 24px));
  opacity: 0;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.place-sheet-host.is-open .place-sheet-panel {
  transform: translateY(0);
  opacity: 1;
}

.place-sheet-body {
  display: grid;
  gap: 14px;
  max-height: min(78vh, 760px);
  overflow: auto;
  padding: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
}

.place-sheet-grabber {
  width: 52px;
  height: 5px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
}

.place-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.place-sheet-title {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--text);
}

.place-sheet-close {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: #eef7ff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.place-sheet-close:hover,
.place-sheet-close:focus-visible {
  background: rgba(255,255,255,0.14);
}

.place-sheet-hero {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(127, 212, 248, 0.18);
  background: linear-gradient(145deg, rgba(29, 168, 255, 0.16), rgba(127, 232, 176, 0.08));
}

.place-sheet-hero--empty {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1);
}

.place-sheet-hero-value {
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #f5fbff;
  line-height: 1;
}

.place-sheet-hero-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #98c9e6;
}

.place-sheet-hero-detail {
  font-size: 12px;
  color: #dbe7f5;
  line-height: 1.45;
}

.place-sheet-nav {
  position: sticky;
  top: -12px;
  z-index: 2;
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 4px 0 8px;
  background: linear-gradient(180deg, rgba(11, 19, 32, 0.98), rgba(11, 19, 32, 0.82) 70%, transparent);
}

.place-sheet-nav-pill {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: #dce8f6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.place-sheet-nav-pill:hover,
.place-sheet-nav-pill:focus-visible {
  background: rgba(127, 212, 248, 0.12);
  border-color: rgba(127, 212, 248, 0.24);
}

.place-sheet-section {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  scroll-margin-top: 76px;
}

.place-sheet-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.place-sheet-compare-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.place-sheet-compare-card.is-winner {
  border-color: rgba(127, 232, 176, 0.28);
  background: linear-gradient(160deg, rgba(127, 232, 176, 0.12), rgba(255,255,255,0.04));
}

.place-sheet-compare-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8fb7da;
}

.place-sheet-compare-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.place-sheet-compare-subtitle,
.place-sheet-compare-detail,
.place-sheet-compare-meta {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.place-sheet-compare-range {
  font-size: 18px;
  font-weight: 900;
  color: #f5fbff;
  letter-spacing: -0.03em;
}

@media (max-width: 720px) {
  .maplibregl-popup-content {
    padding: 14px 12px 16px;
  }

  .popup-friendly {
    max-width: min(90vw, 400px);
  }

  .popup-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .popup-fact-row {
    flex-direction: column;
    gap: 4px;
  }

  .popup-fact-value,
  .popup-section-meta {
    text-align: left;
  }

  .place-sheet-host {
    padding: 8px;
  }

  .place-sheet-panel,
  .place-sheet-body {
    max-height: min(82vh, 820px);
  }

  .place-sheet-panel {
    width: calc(100% - 4px);
    border-radius: 24px;
  }

  .place-sheet-body {
    padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 16px);
  }

  .place-sheet-title {
    font-size: 23px;
  }

  .place-sheet-nav {
    top: -10px;
  }

  .place-sheet-compare-grid {
    grid-template-columns: 1fr;
  }
}

.menu-toggle {
  display: none;
}

.locate-me {
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 24px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  z-index: 1000;
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(22, 9, 196, 0.995);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.locate-me[aria-busy="true"] {
  opacity: 0.8;
  cursor: wait;
}

@media (max-width: 768px) {
  .map-toolbar {
    top: calc(env(safe-area-inset-top, 0px) + 62px);
    left: calc(env(safe-area-inset-left, 0px) + 12px);
  }

  .map-search {
    grid-template-columns: 1fr;
  }

  .search-overlay {
    padding: calc(env(safe-area-inset-top, 0px) + 62px) 12px 12px;
  }

  .search-overlay-panel {
    width: min(100%, calc(100% - 12px));
  }

  .search-results {
    width: 100%;
  }

  .search-results.has-results {
    max-height: min(34vh, 260px);
  }

  .map-mode-toggle {
    width: 100%;
  }

  .map-mode-button {
    min-width: 0;
  }
  /* Keep primary navigation high and move zoom to the thumb zone to avoid stacked map controls on phones. */
  html, body {
    height: 100%;
    overflow: hidden;
  }

  #app {
    display: block;
    height: 100dvh;
    min-height: 100svh;
  }

  #main {
    width: 100%;
    height: 100dvh;
    min-height: 100svh;
  }

  #map {
    width: 100%;
    height: 100dvh;
    min-height: 100svh;
  }

  .menu-toggle {
    display: block;
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: calc(env(safe-area-inset-left, 0px) + 12px);
    z-index: 1100;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
    font-size: 24px;
    line-height: 1;
  }

  .locate-me {
    right: calc(env(safe-area-inset-right, 0px) + 12px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
  }

  .maplibregl-ctrl-top-right {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    right: calc(env(safe-area-inset-right, 0px) + 12px);
  }

  #panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 380px;
    height: 100dvh;
    min-height: 100svh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1050;
  }

  #panel.open {
    transform: translateX(0);
  }
}