:root {
  --bg: #08070f;
  --panel: #0e0d1a;
  --border: rgba(130, 100, 255, 0.15);
  --accent: #a259ff;
  --text: #e8e4f0;
  --muted: #6b6580;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 54px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  gap: 24px;
  flex-wrap: wrap;
}

#topbar h1 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

#topbar h1 span { color: var(--accent); }

.stats-row {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.stat-pill {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 14px;
  background: rgba(162,89,255,0.07);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.stat-pill .val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #7c3aed;
  line-height: 1;
}

.stat-pill .lbl {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

#toggle-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(162,89,255,0.10);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  transition: background 0.2s;
  flex-shrink: 0;
}

#toggle-palette:hover { background: rgba(162,89,255,0.22); }

.palette-swatch {
  display: flex;
  gap: 2px;
  height: 12px;
}

.swatch-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

#toggle-palette.active {
  border-color: rgba(130, 200, 255, 0.4);
  background: rgba(0, 170, 255, 0.12);
}

#map-wrap {
  position: relative;
  overflow: hidden;
}

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

#hover-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(20, 12, 12, 0.96);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  min-width: 190px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
}

#hover-panel.visible { opacity: 1; }

.hp-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.hp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.hp-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hp-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: #7c3aed;
  font-weight: 500;
}

.hp-geocod {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
}

#legend {
  position: absolute;
  bottom: 28px;
  left: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.leg-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(255, 255, 255);
  margin-bottom: 8px;
}

.leg-bar {
  width: 160px;
  height: 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.leg-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  color: rgb(255, 255, 255);
}