:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4d;
  --text: #e7ecf3;
  --muted: #9aa8bc;
  --accent: #3d9cf0;
  --accent-2: #f0a030;
}

* { box-sizing: border-box; }

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

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

#panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1rem 1rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

header .sub {
  margin: 0.2rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

header .nav-links {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
}

header .nav-links a {
  color: var(--accent);
  text-decoration: none;
}

header .nav-links a:hover {
  text-decoration: underline;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.field.tight span { color: var(--muted); font-size: 0.75rem; }

.field select, .field input[type="range"] {
  width: 100%;
}

.field select {
  background: #0f1722;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
}

.block h2 {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  margin: 0.25rem 0;
  cursor: pointer;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

#date-labels {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

#stats-body {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  background: #0f1722;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  max-height: 180px;
  overflow: auto;
}

.notes ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

footer {
  margin-top: auto;
  display: flex;
  gap: 0.5rem;
}

.btn {
  flex: 1;
  border: 1px solid var(--border);
  background: #0f1722;
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #041018;
  font-weight: 600;
}

a.btn.link {
  display: block;
  text-align: center;
  text-decoration: none;
  border-color: var(--accent-2);
  color: var(--accent-2);
}
a.btn.link:hover {
  background: rgba(240, 160, 48, 0.12);
}

#map {
  height: 100%;
  width: 100%;
  background: #0a1018;
}

.leaflet-container { background: #0a1018; font: inherit; }

.popup-title {
  font-weight: 650;
  margin-bottom: 0.25rem;
}

.popup-meta {
  font-size: 0.85rem;
  line-height: 1.35;
}

.legend {
  background: rgba(26, 35, 50, 0.92);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
}

.legend i {
  width: 10px;
  height: 10px;
  float: left;
  margin-right: 6px;
  margin-top: 4px;
  border-radius: 50%;
  opacity: 0.95;
}

@media (max-width: 800px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto 55vh; }
  #panel { max-height: 45vh; }
}
