:root {
  --site-header-h: 77px;
  --bg: #090712;
  --panel: rgba(15, 12, 28, 0.96);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f7f3fa;
  --muted: #9b94ad;
  --pink: #ff4d8d;
  --cyan: #2ee6d6;
  --gold: #ffb347;
  --violet: #b589ff;
}

/* The map page is embedded under the site's fixed header, so it fills the
   remaining viewport height and paints below the header's stacking order. */
.map-page {
  position: relative;
  z-index: 0;
  padding-top: var(--site-header-h);
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

.map-page *,
.map-page *::before,
.map-page *::after { box-sizing: border-box; }

.map-page button,
.map-page input { font: inherit; }

#app {
  display: grid;
  grid-template-columns: 372px 1fr;
  width: 100%;
  height: calc(100vh - var(--site-header-h));
  height: calc(100dvh - var(--site-header-h));
  min-height: 420px;
}

#sidebar {
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #110d20 0%, #0a0814 100%);
  border-right: 1px solid var(--panel-border);
  box-shadow: 18px 0 45px rgba(0, 0, 0, 0.35);
}

#sidebar header { padding: 22px 22px 12px; }

.eyebrow {
  color: var(--cyan);
  font: 600 10px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.16em;
}

#sidebar h1 {
  margin: 8px 0 6px;
  font: 700 31px/0.94 "Arial Narrow", Impact, sans-serif;
  letter-spacing: 0.06em;
}

#sidebar h1 span { color: var(--pink); }

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

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 22px 12px;
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px currentColor;
}
.status-dot.ready { background: var(--cyan); }
.status-dot.loading { animation: pulse 1s infinite alternate; }

@keyframes pulse { to { opacity: 0.3; } }

.search-wrap {
  position: relative;
  margin: 0 22px 12px;
}

#searchInput {
  width: 100%;
  padding: 10px 44px 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  outline: none;
}
#searchInput:focus { border-color: rgba(46, 230, 214, 0.55); }

.count {
  position: absolute;
  top: 50%;
  right: 10px;
  min-width: 27px;
  padding: 2px 6px;
  transform: translateY(-50%);
  color: var(--cyan);
  background: rgba(46, 230, 214, 0.1);
  border-radius: 999px;
  font: 600 10px/1.6 ui-monospace, Consolas, monospace;
  text-align: center;
}

.layer-panel {
  display: grid;
  gap: 6px;
  padding: 0 22px 12px;
}

.layer-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7d1e0;
  font-size: 12px;
  cursor: pointer;
}
.layer-panel label b { margin-left: auto; color: var(--muted); font-weight: 500; }

.legend {
  padding: 2px 7px;
  border-radius: 999px;
  font: 700 9px/1.5 ui-monospace, Consolas, monospace;
  letter-spacing: 0.08em;
}
.legend.heist { color: #ffd166; background: rgba(255, 179, 71, 0.17); }
.legend.github { color: #d5b9ff; background: rgba(181, 137, 255, 0.16); }
.legend.leonida { color: #7fffe9; background: rgba(46, 230, 214, 0.14); }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 22px 12px;
}

.filter {
  padding: 5px 9px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}
.filter:hover, .filter.active {
  color: #fff;
  background: rgba(255, 77, 141, 0.14);
  border-color: rgba(255, 77, 141, 0.6);
}

.place-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 18px;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.place-card {
  width: 100%;
  margin: 0 0 6px;
  padding: 10px 11px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid transparent;
  border-left: 3px solid var(--violet);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}
.place-card:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--panel-border); }
.place-card.heist { border-left-color: var(--gold); }
.place-card .title { display: block; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.place-card .meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.empty {
  padding: 28px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

#sidebar footer {
  padding: 11px 18px 13px;
  border-top: 1px solid var(--panel-border);
}

.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
#coordReadout { margin-bottom: 5px; color: var(--cyan); font-size: 10px; }
.attribution { color: #6d667b; font-size: 9px; line-height: 1.45; }

#mapShell { position: relative; min-width: 0; }
#map { width: 100%; height: 100%; background: #0cafca; }

.map-topbar {
  position: absolute;
  z-index: 800;
  top: 14px;
  right: 14px;
  left: 14px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.brand-chip, .zoom-controls {
  pointer-events: auto;
  background: rgba(12, 9, 24, 0.82);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}
.brand-chip { padding: 8px 12px; color: var(--cyan); font: 700 10px ui-monospace, Consolas, monospace; letter-spacing: 0.12em; }
.zoom-controls { display: flex; align-items: center; gap: 3px; padding: 4px; }
.zoom-controls button, .zoom-controls span {
  min-width: 30px;
  height: 28px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 12px;
}
.zoom-controls button:hover { background: rgba(255, 255, 255, 0.12); }
.zoom-controls span { color: var(--cyan); font-size: 10px; line-height: 28px; text-align: center; }

.tile-notice {
  position: absolute;
  z-index: 700;
  right: 14px;
  bottom: 14px;
  max-width: 410px;
  padding: 9px 12px;
  color: #e7dcff;
  background: rgba(38, 15, 58, 0.88);
  border: 1px solid rgba(181, 137, 255, 0.42);
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
}
.tile-notice code { color: var(--cyan); }
.tile-notice.hidden { display: none; }

.leaflet-container { background: #0cafca; font-family: inherit; }
.leaflet-control-attribution { background: rgba(255, 255, 255, 0.78) !important; }

.unified-marker {
  width: 12px;
  height: 12px;
  background: var(--marker-color, #b589ff);
  border: 2px solid rgba(9, 7, 18, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45), 0 0 12px var(--marker-color, #b589ff);
  transition: transform 0.15s ease;
}
.unified-marker.estimated { border-style: dashed; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35); }
.unified-marker.selected { transform: scale(1.65); }
.popup-title { font-weight: 700; margin-bottom: 5px; }
.popup-meta, .popup-coord { font-size: 11px; color: #625570; }
.popup-coord { margin-top: 8px; font-family: ui-monospace, Consolas, monospace; }
.registration-note { padding: 0 22px 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }

@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 50% 50%; }
  #sidebar { border-right: 0; border-bottom: 1px solid var(--panel-border); }
  #sidebar header { padding: 10px 16px 4px; }
  #sidebar h1 { font-size: 21px; }
  #sidebar h1 br { display: none; }
  #sidebar h1 span { margin-left: 5px; }
  .status-row, .search-wrap { margin-right: 16px; margin-left: 16px; }
  .layer-panel, .filter-row { padding-right: 16px; padding-left: 16px; }
  .registration-note { padding: 0 16px 4px; margin: 0; font-size: 10px; }
  .subtitle, #sidebar footer .attribution { display: none; }
  .map-topbar { top: 8px; right: 8px; left: 8px; }
  .tile-notice { right: 8px; bottom: 8px; left: 8px; }
}

/* The site header stacks its logo above the nav on very small screens. */
@media (max-width: 575.98px) {
  :root { --site-header-h: 108px; }
}
