:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #6b6862;
  --border: #e3e0da;
  --fire: #d9480f;
  --fire-soft: #f4b08a;
  --bar-empty: #ece9e3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --surface: #1f1e1b;
    --text: #ece9e3;
    --muted: #9c978e;
    --border: #34322e;
    --fire: #ff7a3d;
    --fire-soft: #8a4426;
    --bar-empty: #2b2926;
  }
}

* { box-sizing: border-box; }

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

body { display: flex; }

.panel {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

#map { flex: 1; }

h1 { margin: 0; font-size: 22px; }
h2 { margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.subtitle { margin: 2px 0 0; color: var(--muted); }

.range input { width: 100%; margin: 10px 0 2px; accent-color: var(--fire); }
.range-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

.stat { display: flex; align-items: baseline; gap: 8px; }
.stat-value { font-size: 44px; font-weight: 700; line-height: 1; color: var(--fire); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); }

.chart { display: flex; align-items: flex-end; gap: 2px; height: 72px; }
.chart .bar { flex: 1; min-height: 2px; background: var(--bar-empty); border-radius: 2px 2px 0 0; }
.chart .bar.has { background: var(--fire); }

.list-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.list li { padding: 8px 0; border-top: 1px solid var(--border); cursor: pointer; }
.list li:hover .where { color: var(--fire); }
.list .where { font-weight: 600; }
.list .when, .list .headline { color: var(--muted); font-size: 13px; }
.list .headline { display: block; }

footer { font-size: 12px; color: var(--muted); }

.popup h3 { margin: 0 0 2px; font-size: 15px; }
.popup .date { color: #6b6862; margin-bottom: 8px; }
.popup ul { margin: 0; padding-left: 16px; }
.popup li { margin-bottom: 6px; }
.popup .source { color: #6b6862; font-size: 12px; }

@media (max-width: 760px) {
  body { flex-direction: column-reverse; }
  .panel { width: 100%; height: 50%; border-right: 0; border-top: 1px solid var(--border); padding: 16px; gap: 14px; }
  #map { min-height: 50%; }
}
