:root {
  --bg: #0e1116;
  --panel: rgba(18, 22, 28, 0.92);
  --border: rgba(255, 255, 255, 0.10);
  --fg: #e6eaef;
  --fg-dim: #8b95a5;
  --accent: #46a758;
  --accent-off: #d9634a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#map { position: absolute; inset: 0; }

/* ---------------------------------------------------------------- HUD -- */

#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  width: 190px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
}

.hud-title {
  justify-content: flex-start;
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.hud-title strong { letter-spacing: 0.12em; }

.hud-title span:last-child {
  margin-left: auto;
  color: var(--fg-dim);
  font-size: 11px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-off);
  transition: background 0.3s;
}

.dot.on { background: var(--accent); box-shadow: 0 0 8px rgba(70, 167, 88, 0.7); }

.k { color: var(--fg-dim); font-size: 11px; }

.v { font-variant-numeric: tabular-nums; font-weight: 600; }

.hud-sep {
  height: 1px;
  margin: 9px -12px 8px;
  background: var(--border);
}

.hud-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  font-size: 11.5px;
  color: var(--fg-dim);
  cursor: pointer;
  user-select: none;
}

.hud-toggle:hover { color: var(--fg); }
.hud-toggle input { accent-color: var(--accent); margin: 0; cursor: pointer; }

/* ------------------------------------------------------------- legend -- */

#legend {
  position: absolute;
  bottom: 26px;
  left: 12px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  max-width: 320px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  font-size: 11px;
  color: var(--fg-dim);
}

#legend span { display: inline-flex; align-items: center; gap: 5px; }

#legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  transform: rotate(45deg);
}

/* -------------------------------------------------------------- panel -- */

#panel {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 11;
  width: 268px;
  padding: 14px 16px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

#panel.hidden { display: none; }

#panel h2 {
  margin: 0 22px 2px 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.p-sub {
  margin-bottom: 12px;
  color: var(--fg-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

#panel dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  margin: 0;
  font-size: 12px;
}

#panel dt { color: var(--fg-dim); }

#panel dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#panel-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg-dim);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

#panel-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--fg); }

/* ---------------------------------------------------------- maplibre -- */

.maplibregl-ctrl-attrib {
  background: rgba(14, 17, 22, 0.75) !important;
  color: var(--fg-dim) !important;
  font-size: 10px !important;
}

.maplibregl-ctrl-attrib a { color: var(--fg-dim) !important; }

.maplibregl-ctrl-group {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
}

.maplibregl-ctrl-group button + button { border-top: 1px solid var(--border) !important; }
.maplibregl-ctrl-icon { filter: invert(0.85); }

@media (max-width: 640px) {
  #hud { width: 150px; }
  #panel { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; }
  #legend { display: none; }
}
