:root {
  --bg: #11151c;
  --panel: #161b24;
  --panel-2: #1d2530;
  --ink: #e8edf2;
  --muted: #93a1b0;
  --line: #2a3340;
  --accent: #4ea1d3;
  --goal: #f4c245;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }
#map { position: absolute; inset: 0; }

#panel {
  position: absolute; top: 0; left: 0; bottom: 0; width: 360px; max-width: 88vw;
  background: var(--panel); border-right: 1px solid var(--line);
  overflow-y: auto; padding: 20px 20px 40px; z-index: 5;
  transition: transform .25s ease;
}
#panel.hidden { transform: translateX(-100%); }
#panel header h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
#panel .sub { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 0 0 18px; }
#panel section { border-top: 1px solid var(--line); padding: 16px 0; }
#panel h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }

/* Gauge */
#gauge-section { border-top: none; padding-top: 0; }
.gauge-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
#gauge-multiple { color: var(--accent); font-weight: 700; font-size: 15px; }
.gauge-track { position: relative; height: 12px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
#gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #2f6f9e, var(--accent)); transition: width .5s ease; }
#gauge-marker { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--goal); }
.readout { font-size: 19px; font-weight: 600; margin: 12px 0 2px; }
.readout .num { color: var(--accent); }
.footprint { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 6px 0 0; }
.footprint b { color: var(--goal); }

/* Mode toggle */
#mode-toggle { display: flex; gap: 6px; }
.mode-btn { flex: 1; padding: 9px 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .15s; }
.mode-btn:hover { border-color: #3a4a5c; color: var(--ink); }
.mode-btn.active { background: var(--accent); border-color: var(--accent); color: #0b1118; }

#scenario-section { transition: opacity .2s; }

/* Growth slider */
#growth-section { border-top: none; padding-top: 0; }
#growth-far { color: var(--accent); font-weight: 700; font-size: 14px; }
#growth-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #2b5a7a, var(--goal)); outline: none; margin: 10px 0 4px; }
#growth-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
#growth-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
#slider-ticks { position: relative; height: 16px; font-size: 10px; color: var(--goal); margin-bottom: 8px; }
#slider-ticks .tick { position: absolute; transform: translateX(-50%); white-space: nowrap; }
#slider-ticks .tick::before { content: "▲"; display: block; text-align: center; font-size: 7px; margin-bottom: 1px; }
#burden-grid { margin: 10px 0 2px; }
.brow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.brow b { color: var(--ink); font-variant-numeric: tabular-nums; }
.brow .chg { color: #5fc27e; font-size: 11px; font-weight: 600; min-width: 34px; text-align: right; }

/* Scenarios */
.scn { display: block; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.scn:hover { border-color: #3a4a5c; }
.scn.active { border-color: var(--accent); background: var(--panel-2); }
.scn .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.scn .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.scn.active .dot { border-color: var(--accent); background: var(--accent); }
.scn .blurb { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 0; }

/* Legend */
#legend { display: flex; flex-direction: column; gap: 5px; }
.lg-row { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--ink); }
.lg-swatch { width: 16px; height: 16px; border-radius: 3px; flex: none; border: 1px solid rgba(255,255,255,.12); }
.hint { color: var(--muted); font-size: 11.5px; line-height: 1.5; margin: 12px 0 0; }

#assumptions { border-top: 1px solid var(--line); padding-top: 14px; }
#assumptions summary { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); cursor: pointer; }
#assumptions ul { font-size: 12px; color: var(--muted); line-height: 1.6; padding-left: 18px; margin: 10px 0; }
#assumptions .caveat { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

#panel-toggle { position: absolute; top: 12px; left: 12px; z-index: 6; display: none; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 18px; cursor: pointer; }
body.panel-hidden #panel-toggle { display: block; }

/* Popup */
.maplibregl-popup-content { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 12.5px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.pop-addr { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.pop-use { color: var(--muted); margin-bottom: 8px; }
.pop-grid { display: grid; grid-template-columns: auto auto; gap: 2px 14px; }
.pop-grid .k { color: var(--muted); }
.pop-grid .v { text-align: right; font-variant-numeric: tabular-nums; }
.pop-gain { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; }
.pop-gain b { color: var(--accent); font-size: 15px; }

@media (max-width: 640px) {
  #panel { width: 320px; }
  #panel:not(.hidden) ~ #panel-toggle { display: none; }
}
