:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --line: #2a313b;
  --text: #e7ecf2;
  --muted: #96a0ad;
  --accent: #ffb02e;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}
#app { display: flex; height: 100vh; }
#map { flex: 1; height: 100%; background: #0b0e12; }

#panel {
  width: 340px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 18px 18px 12px;
  overflow-y: auto;
}
h1 { font-size: 19px; margin: 0 0 2px; letter-spacing: .2px; }
.sub { color: var(--muted); margin: 0 0 14px; font-size: 12.5px; }
.section { padding: 14px 0; border-top: 1px solid var(--line); }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mini-actions { display: flex; gap: 4px; }
.mini {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px; font-size: 11px; cursor: pointer;
}
.mini:hover { color: var(--text); }
.mini.active { color: #101317; background: var(--accent); border-color: var(--accent); }

.months { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mbtn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 7px 0; font-size: 12px; cursor: pointer; text-align: center;
  transition: background .1s, border-color .1s;
}
.mbtn:hover { border-color: #3a4350; }
.mbtn.on { background: var(--accent); border-color: var(--accent); color: #101317; font-weight: 600; }

.legend { margin-top: 8px; }
.legend .bar { height: 12px; border-radius: 6px; margin-bottom: 2px; }
.legend .ticks-abs { position: relative; height: 14px; }
.legend .ticks-abs span {
  position: absolute; transform: translateX(-50%);
  color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums;
}

/* live hovered-location 12-month profile */
.profile { margin: 4px 0 12px; padding: 10px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px; transition: border-color .12s, box-shadow .12s, background .12s; }
/* Wikipedia (measured) mode: unmistakable blue treatment */
.profile.city-mode { border-color: #4aa3ff; background: #142130;
  box-shadow: 0 0 0 1px #4aa3ff, 0 0 16px rgba(74,163,255,.28); }
.p-badge { display: none; }
.profile.city-mode .p-badge {
  display: inline-block; margin-bottom: 8px; padding: 2px 7px; border-radius: 5px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .6px;
  background: #4aa3ff; color: #08131f; }
.profile.city-mode .p-loc { color: #cfe6ff; }
.p-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; }
.p-loc { font-size: 12px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-total { font-size: 11px; color: var(--muted); flex: none; }
.p-total b { color: var(--accent); font-variant-numeric: tabular-nums; }
.p-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; align-items: end; }
.p-col { display: flex; flex-direction: column; align-items: center; }
.p-num { font-size: 8px; color: var(--muted); font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.p-barwrap { height: 52px; width: 100%; display: flex; align-items: flex-end; position: relative; }
.p-bar { width: 100%; min-height: 2px; border-radius: 2px 2px 0 0; }
.p-tick { position: absolute; left: -1px; right: -1px; height: 2px; background: #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,.55); }
.p-mon { font-size: 8px; color: var(--muted); margin-top: 2px; }
.p-pct { font-size: 8px; font-weight: 700; font-variant-numeric: tabular-nums; margin: -1px 0 2px; line-height: 1; }
.p-col.sel .p-num, .p-col.sel .p-mon { color: var(--text); font-weight: 700; }
.p-col.sel .p-barwrap { outline: 1px solid rgba(255,255,255,.28); border-radius: 3px; }
.p-note { font-size: 9.5px; color: var(--muted); margin-top: 6px; min-height: 12px; }

.toggle { display: flex; align-items: center; gap: 7px; font-size: 11.5px;
  color: var(--muted); margin: 0 0 10px; cursor: pointer; }
.toggle input { accent-color: var(--accent); }

.destlist { margin: 6px 0 0; padding: 0 0 0 22px; }
.label.collapsible { cursor: pointer; user-select: none; }
.label.collapsible:hover { color: var(--text); }
.label.collapsible .chev { display: inline-block; font-size: 10px; transition: transform .15s; }
#dest-section.collapsed .chev { transform: rotate(-90deg); }
#dest-section.collapsed .destlist, #dest-section.collapsed .mini-actions { display: none; }
#dest-section.collapsed .row { margin-bottom: 0; }
.destlist li { margin: 4px 0; cursor: pointer; }
.destlist li:hover .dn { color: var(--accent); }
.destlist .dn { color: var(--text); }
.destlist .dv { color: var(--muted); float: right; font-variant-numeric: tabular-nums; }
.destlist .dv b { color: var(--accent); }

.banner {
  background: #3a2c12; border: 1px solid #5a4520; color: #f0d9a8;
  border-radius: 8px; padding: 9px 10px; font-size: 11.5px; margin-bottom: 12px;
}
.banner code { background: rgba(0,0,0,.3); padding: 1px 4px; border-radius: 4px; }
.hidden { display: none; }
.foot { color: var(--muted); font-size: 11px; margin: 14px 0 0; }

.leaflet-container { cursor: crosshair; }
.leaflet-container.leaflet-drag-target,
.leaflet-dragging .leaflet-container { cursor: grabbing; }

#cursor-readout {
  position: fixed; z-index: 1000; pointer-events: none;
  transform: translate(14px, 14px);
  background: rgba(18, 22, 28, .93); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
#cursor-readout b { color: var(--accent); font-size: 15px; font-variant-numeric: tabular-nums; }
#cursor-readout .c { color: var(--muted); font-size: 11px; margin-top: 1px; }
#cursor-readout .p { font-size: 12px; color: var(--text); margin-top: 1px; }
#cursor-readout .p b { font-size: 13px; }
#cursor-readout .p .c { display: inline; }

.leaflet-popup-content-wrapper { background: var(--panel-2); color: var(--text); }
.leaflet-popup-tip { background: var(--panel-2); }
.val-popup b { color: var(--accent); font-size: 16px; }
.dest-marker {
  background: var(--accent); width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid #101317; box-shadow: 0 0 0 1px var(--accent);
}

/* SEO text: readable by search engines and screen readers, not drawn */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* phones: map on top, panel below it (scrolls) */
@media (max-width: 760px) {
  #app { flex-direction: column-reverse; height: 100dvh; }
  #map { flex: 0 0 52dvh; height: 52dvh; }
  #panel { width: 100%; flex: 1 1 auto; border-right: 0; border-top: 1px solid var(--line); padding: 12px 16px; }
}
