/* Dark, technical and restrained: tight corners, hairlines, flat accents (no glows or gradients on controls),
   a mono face for data and labels. Amber is the single accent and is used sparingly. */
:root {
  --bg: #0d1219;
  --glass: rgba(14, 19, 27, .82);
  --glass-strong: rgba(14, 19, 27, .96);
  --fg: #e8edf3;
  --mut: #8b97a8;
  --dim: #5b6677;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .17);
  --acc: #f2a93b;
  --acc-ink: #17110a;
  --r: 6px;                    /* panels */
  --rc: 4px;                   /* controls */
  --mono: Inter, system-ui, "Segoe UI", Roboto, sans-serif;   /* data + labels share the UI face */
  --shadow: 0 12px 32px rgba(0, 0, 0, .38);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --panel-w: 320px;
  --dock-h: 72px;
  --lvl-color: var(--fg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); overflow: hidden;
  font: 14px/1.45 Inter, system-ui, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; }
canvas { display: block; touch-action: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 1.5px solid var(--acc); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: none; }

.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.eyebrow { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--mut); font-weight: 600; }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--rc); border: 1px solid var(--line);
  background: none; color: var(--mut); transition: border-color .15s, color .15s; }
.icon-btn:hover { border-color: var(--line-2); color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; }
.ghost { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; border-radius: var(--rc); border: 1px solid var(--line);
  background: none; font-size: 12.5px; font-weight: 500; transition: border-color .15s, background .15s; }
.ghost:hover { border-color: var(--line-2); background: rgba(255, 255, 255, .04); }
.ghost svg { width: 16px; height: 16px; }

/* ---------------- main panel ---------------- */
#panel { position: fixed; top: 16px; left: 16px; width: var(--panel-w); max-height: calc(100% - var(--dock-h) - 72px); overflow: auto;
  padding: 16px; z-index: 5; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.head { display: flex; align-items: center; gap: 10px; }
.brand { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #ffc56b, #ff6b6b); color: #2a1206; }
.brand .logo { width: 22px; height: 22px; }
.titles { flex: 1; min-width: 0; }
h1 { font-size: 16.5px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.sub { color: var(--mut); font-size: 12px; line-height: 1.35; }
.lang { display: flex; gap: 2px; font: 500 11px var(--mono); }
.lang button { background: none; border: 0; padding: 3px 4px; color: var(--dim); border-bottom: 1px solid transparent; }
.lang button:hover { color: var(--fg); }
.lang button.on { color: var(--fg); border-bottom-color: var(--acc); }
#collapse { display: none; }
#collapse svg { transition: transform .25s; }

.hero { display: flex; align-items: center; gap: 14px; margin: 16px 0 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.gauge { position: relative; width: 88px; height: 88px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(135deg); }
.g-bg, .g-arc { fill: none; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 197.9 263.9; }
.g-bg { stroke: rgba(255, 255, 255, .07); }
.g-arc { stroke: var(--lvl-color); stroke-dashoffset: 197.9; transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1), stroke .4s;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--lvl-color) 45%, transparent)); }
.g-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.g-num b { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.g-num small { font-size: 10px; color: var(--mut); margin-top: 2px; }
.hero-txt { min-width: 0; flex: 1; }
.lvl { font-size: 18px; font-weight: 600; color: var(--lvl-color); margin: 2px 0 4px; letter-spacing: -.01em; }
.meta { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta b { color: var(--fg); font: 500 11.5px var(--mono); }

.scale { position: relative; margin: 4px 0 6px; padding-top: 6px; }
#legend { display: flex; gap: 2px; height: 18px; }
#legend div { flex: 1; font: 600 9.5px var(--mono); display: grid; place-items: center; }
#legMark { position: absolute; top: 2px; width: 2px; height: 26px; background: #fff; left: 0; outline: 1px solid rgba(0, 0, 0, .5);
  transition: left .6s cubic-bezier(.2, .8, .2, 1); transform: translateX(-50%); }

.field { margin-top: 18px; }
.label { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--mut); font-weight: 600; margin-bottom: 8px; }
.label .val { text-transform: none; letter-spacing: 0; color: var(--fg); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
/* segmented choices as underline tabs */
.seg { display: flex; gap: 0; border-bottom: 1px solid var(--line); }
.seg button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 6px 2px 7px;
  font-size: 12.5px; font-weight: 600; color: var(--mut); transition: color .15s, border-color .15s; }
.seg button:hover { color: var(--fg); }
.seg button.on { color: var(--fg); border-bottom-color: var(--acc); }
.seg.small button { font-size: 11.5px; }
.seg.grid2 { display: grid; grid-template-columns: 1fr 1fr; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px;
  background: linear-gradient(90deg, var(--acc) var(--fill, 0%), rgba(255, 255, 255, .14) var(--fill, 0%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px; border-radius: 50%;
  background: var(--fg); border: 0; }
input[type=range]::-moz-range-track { height: 2px; background: rgba(255, 255, 255, .14); }
input[type=range]::-moz-range-progress { height: 2px; background: var(--acc); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--fg); border: 0; }
input[type=range]:disabled { opacity: .5; cursor: default; }

/* layer toggles: outlined like the Statistics button; on = bright text + amber icon, off = dimmed */
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--rc); font-size: 12.5px; font-weight: 500;
  border: 1px solid var(--line); color: var(--dim); cursor: pointer; user-select: none; transition: border-color .15s, color .15s; min-width: 0; }
.chip span { line-height: 1.2; overflow-wrap: anywhere; }
.chip:hover { border-color: var(--line-2); }
.chip svg { width: 17px; height: 17px; color: var(--dim); transition: color .15s; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked) { color: var(--fg); border-color: var(--line-2); }
.chip:has(input:checked) svg { color: var(--acc); }
.chip:has(input:focus-visible) { outline: 1.5px solid var(--acc); outline-offset: 2px; }

.foot { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line);
  font: 11px/1.45 var(--mono); color: var(--mut); }
.dot-live { width: 6px; height: 6px; border-radius: 50%; background: #3ddc97; flex: none; margin-top: 5px; animation: blink 2.4s ease-in-out infinite; }
.dot-live.hist { background: var(--acc); animation: none; }
.dot-live.off { background: var(--dim); animation: none; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------------- detail panel ---------------- */
#detail { position: fixed; top: 16px; right: 16px; width: 316px; max-height: calc(100% - var(--dock-h) - 48px); overflow: auto; padding: 16px;
  z-index: 5; transform: translateX(calc(100% + 32px)); opacity: 0; transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s; }
#detail.open { transform: none; opacity: 1; }
.d-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.d-head h2 { margin: 4px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.d-hero { display: flex; align-items: flex-end; justify-content: space-between; margin: 14px 0 12px; padding-top: 12px; border-top: 1px solid var(--line); }
#dVal { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
/* level as a small square swatch + label (no pill) */
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--fg); }
.pill::before { content: ''; width: 10px; height: 10px; background: var(--lc, var(--fg)); }
#dUnit, #unit { text-transform: none; }
.callout { margin: 0 0 12px; padding: 2px 0 2px 10px; font-size: 13px; color: #cdd5df; border-left: 2px solid var(--lvl-color); }
.cig { margin: 0 0 14px; font-size: 12.5px; color: #cdd5df; display: flex; gap: 8px; align-items: center; }
.cig:empty { display: none; }
.cig svg { width: 20px; height: 20px; color: var(--mut); }
button.primary { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 16px; padding: 10px; border-radius: var(--rc);
  border: 1px solid var(--fg); background: var(--fg); color: #0d1219; font-weight: 600; font-size: 13px; transition: background .15s; }
button.primary:hover { background: #fff; }
button.primary svg { width: 17px; height: 17px; }
.list-h { margin-bottom: 4px; }
#dList { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
#dList li { display: grid; grid-template-columns: 8px 1fr auto 34px; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
#dList .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dList .km { color: var(--mut); font: 11px var(--mono); }
#dList b { text-align: right; font: 500 12px var(--mono); }
.dot { width: 8px; height: 8px; }

/* ---------------- bottom dock: hint + timeline ---------------- */
#dock { position: fixed; left: 16px; right: 16px; bottom: calc(14px + var(--safe-b)); z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
#dock > * { pointer-events: auto; }
#hint { font: 11.5px var(--mono); color: var(--mut); background: rgba(10, 13, 19, .7); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: var(--rc); white-space: nowrap; transition: opacity .8s, transform .8s; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#hint.gone { opacity: 0; transform: translateY(6px); pointer-events: none; }
#timeline { display: flex; align-items: center; gap: 12px; padding: 7px 12px 7px 8px; width: 100%; max-width: 920px; }
.mode { position: relative; display: flex; align-items: center; gap: 7px; padding: 0 28px 0 10px; height: 36px; border-radius: var(--rc);
  border: 1px solid var(--line); color: var(--mut); flex: none; max-width: 270px; }
.mode:hover { border-color: var(--line-2); }
.mode svg { width: 16px; height: 16px; }
.mode select { appearance: none; -webkit-appearance: none; background: none; border: 0; color: var(--fg); font-size: 13px; font-weight: 500;
  height: 100%; cursor: pointer; min-width: 0; text-overflow: ellipsis; padding-right: 4px; }
.mode select:focus-visible { outline: none; } .mode:focus-within { outline: 1.5px solid var(--acc); outline-offset: 1px; }
.mode select option { background: #141b26; color: var(--fg); }
.mode .chev { position: absolute; right: 8px; pointer-events: none; }
#datePick { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 24px; bottom: 0; }
#play { width: 36px; height: 36px; flex: none; border-radius: var(--rc); border: 0; display: grid; place-items: center;
  background: var(--fg); color: #0d1219; transition: background .15s; }
#play:hover { background: #fff; }
#play svg { width: 15px; height: 15px; }
#track { position: relative; flex: 1; min-width: 120px; height: 44px; }
#bars { position: absolute; left: 0; right: 0; top: 3px; height: 26px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line-2); }
.bar { flex: 1; border-radius: 1px 1px 0 0; opacity: .85; transition: height .4s; }
#scrub { position: absolute; left: 0; right: 0; top: 0; height: 32px; }
#scrub::-webkit-slider-runnable-track { height: 32px; background: transparent; }
#scrub::-webkit-slider-thumb { width: 2px; height: 34px; margin-top: -1px; border-radius: 0; background: #fff; box-shadow: none; }
#scrub::-moz-range-track { height: 32px; background: transparent; }
#scrub::-moz-range-progress { background: transparent; }
#scrub::-moz-range-thumb { width: 2px; height: 34px; border-radius: 0; border: 0; background: #fff; }
#ticks { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--dim); }
#tlTime { text-align: right; min-width: 70px; padding-right: 2px; }
#clock { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.1; }
#tlDate { font: 10.5px var(--mono); color: var(--mut); white-space: nowrap; }
#tlStatus { font: 11.5px var(--mono); color: var(--mut); } #tlStatus:empty { display: none; }
#timeline.busy #play { opacity: .4; }
#timeline.busy #tlStatus::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%;
  border: 1.5px solid var(--line-2); border-top-color: var(--acc); animation: sp 1s linear infinite; vertical-align: -1px; }
body:not(.timelapse) #play, body:not(.timelapse) #track { display: none; }
body:not(.timelapse) #timeline { width: auto; }
body.timelapse #winRow { display: none; }

/* Statistics button: a list action – icon, label, chevron */
.ghost.wide { width: 100%; justify-content: flex-start; gap: 9px; padding: 9px 10px; margin-top: 12px; font-weight: 500; font-size: 13px; }
.ghost.wide svg { width: 17px; height: 17px; color: var(--acc); }
.ghost.wide span { flex: 1; text-align: left; }
.ghost.wide .go { color: var(--mut); transform: rotate(-90deg); width: 14px; height: 14px; }

/* ---------------- statistics drawer ---------------- */
#statsDrawer { position: fixed; top: 16px; right: 16px; width: 420px; max-height: calc(100% - var(--dock-h) - 48px); overflow: auto; z-index: 6;
  padding: 0; background: var(--glass-strong); transform: translateX(calc(100% + 32px)); opacity: 0;
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), opacity .3s; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
#statsDrawer.open { transform: none; opacity: 1; }
/* full-width solid header (no fade), so nothing shows through or cuts off at the rounded corners */
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  background: #0f151e; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.cards { padding: 4px 16px 16px; }
.card { padding: 14px 0; border-bottom: 1px solid var(--line); }
.card:last-child { border-bottom: 0; }
.card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.card h3 { margin: 0; font-size: 13px; font-weight: 600; }
.card-sub { font: 10.5px var(--mono); color: var(--mut); margin-top: 3px; } .card-sub:empty { display: none; }
.tbl-btn { flex: none; border: 1px solid var(--line); background: none; color: var(--mut); font: 500 10.5px var(--mono); padding: 2px 7px; border-radius: 3px; }
.tbl-btn:hover { color: var(--fg); border-color: var(--line-2); }
.tbl-btn[aria-pressed=true] { color: var(--fg); border-color: var(--acc); }
.card .body { transition: opacity .2s; } .card .body.stale { opacity: .45; }
.card p { margin: 0; font-size: 12.5px; line-height: 1.55; color: #c6cfda; }
.card .note { margin-top: 10px; font: 11px/1.5 var(--mono); color: var(--mut); } .card .note b { color: var(--fg); }
.card .note a { color: var(--fg); text-decoration-color: var(--acc); text-underline-offset: 2px; }
.muted { color: var(--mut); font: 11.5px var(--mono); }

svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: rgba(255, 255, 255, .07); stroke-width: 1; shape-rendering: crispEdges; }
.chart text { fill: var(--mut); font: 10px var(--mono); }
.chart .xt { fill: var(--dim); }
.chart .ref { stroke: rgba(255, 255, 255, .5); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ref-label { fill: var(--fg); font: 500 10px var(--mono); }
.chart .line { fill: none; stroke: var(--acc); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--acc); opacity: .08; }
.chart .cross { stroke: rgba(255, 255, 255, .45); stroke-width: 1; display: none; }
.chart .dot { stroke: #0f151e; stroke-width: 2; display: none; }
.chart .hit { fill: transparent; cursor: crosshair; outline: none; }
.chart .hit.on, .chart .hit:focus-visible { fill: rgba(255, 255, 255, .05); }
.chart-tip { position: fixed; left: 0; top: 0; z-index: 30; display: none; pointer-events: none; padding: 6px 9px; border-radius: var(--rc);
  background: #0f151e; border: 1px solid var(--line-2); font: 11px var(--mono); white-space: nowrap; }
.chart-tip b { display: block; font-size: 13px; } .chart-tip span { color: var(--mut); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--rc); }
.tile { padding: 8px 10px; min-width: 0; }
.tile + .tile { border-left: 1px solid var(--line); }
.tile-l { font: 10px var(--mono); color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-v { font: 600 15px var(--mono); margin-top: 3px; white-space: nowrap; letter-spacing: -.02em; }
.verdict { margin-top: 10px !important; padding: 2px 0 2px 10px; border-left: 2px solid; }
.verdict.bad { border-color: #ff5050; } .verdict.mid { border-color: #f0e641; } .verdict.good { border-color: #50ccaa; }

.hrow { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; padding: 3px 0; font-size: 12px; }
.hname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #c6cfda; }
.htrack { display: flex; align-items: center; gap: 6px; }
.hbar { height: 10px; border-radius: 0 2px 2px 0; min-width: 2px; }
.hval { font: 500 11px var(--mono); color: var(--fg); }
.tview { width: 100%; border-collapse: collapse; font: 11.5px var(--mono); }
.tview th { text-align: left; color: var(--mut); font-weight: 500; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.tview td { padding: 4px 0; border-bottom: 1px solid var(--line); } .tview td:last-child, .tview th:last-child { text-align: right; }
.card .body:has(.tview) { max-height: 260px; overflow: auto; }

/* pollution source markers + keys */
.src-mk { position: absolute; left: 0; top: 0; display: none; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  background: rgba(11, 15, 22, .9); border: 1px solid currentColor; pointer-events: auto; cursor: pointer; will-change: transform; }
.src-mk svg { width: 14px; height: 14px; }
.src-mk.est { border-style: dashed; }
.src-mk:hover, .src-mk:focus-visible { z-index: 2; background: #1a2230; }
.k-homes { color: #f2a93b; } .k-traffic { color: #8fb7e6; } .k-heating, .k-power { color: #e3c25a; }
.k-steel, .k-cement, .k-chimney, .k-refinery { color: #f08a7a; } .k-landfill { color: #bfa979; }
.src-keys { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 12px 0 2px; }
.src-key { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: #c6cfda; }
.src-ic { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid currentColor; background: rgba(11, 15, 22, .9); }
.src-ic svg { width: 13px; height: 13px; }

/* ---------------- map labels / tooltip ---------------- */
#tip { position: fixed; left: 0; top: 0; pointer-events: none; background: #0f151e; border: 1px solid var(--line-2); border-radius: var(--rc);
  padding: 7px 10px; font-size: 12px; display: none; z-index: 8; max-width: 260px; }
#tip .mut { color: var(--mut); }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.lab { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 11px; font-weight: 500; color: rgba(255, 255, 255, .8);
  text-shadow: 0 1px 2px #000, 0 0 6px rgba(0, 0, 0, .9); will-change: transform; }
.lab.suburb, .lab.town { font-size: 12px; font-weight: 600; color: #fff; letter-spacing: .01em; }
.lab.village { color: rgba(255, 255, 255, .6); }
.lab.mount { font: 500 11px var(--mono); color: #c9d3df; letter-spacing: .24em; text-transform: uppercase; opacity: .8; }
.lab.river { font-style: italic; color: #95c1ea; letter-spacing: .25em; }
.tag { position: absolute; left: 0; top: 0; font: 600 10.5px var(--mono); background: rgba(10, 13, 19, .9); border: 1px solid var(--line-2);
  border-left: 3px solid; border-radius: 2px; padding: 1px 5px; will-change: transform; }
#attr { position: fixed; bottom: calc(4px + var(--safe-b)); right: 10px; font: 10px var(--mono); color: var(--dim); z-index: 3; }
#attr a { color: inherit; }

/* ---------------- street view ---------------- */
#streetHud { position: fixed; left: 16px; top: 16px; width: 320px; padding: 14px 16px; z-index: 6; display: none; }
#streetHud h2 { margin: 12px 0 2px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
#sVal { font-size: 13px; color: var(--mut); } #sVal b { font: 600 22px var(--mono); margin-right: 2px; }
.s-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0 10px; border: 1px solid var(--line); border-radius: var(--rc); }
.stat { display: flex; gap: 8px; align-items: center; padding: 9px 10px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat svg { width: 20px; height: 20px; color: var(--acc); }
.stat b { font: 600 14px var(--mono); }
.s-hint { font-size: 12px; color: var(--mut); }
.s-src { font: 10px var(--mono); color: var(--dim); margin-top: 6px; }
body.street #streetHud { display: block; }
body.street #labels, body.street #detail, body.street #hint, body.street #panel, body.street #statsDrawer { display: none; }
body.street canvas { cursor: grab; } body.street canvas:active { cursor: grabbing; }
#joy { display: none; position: fixed; left: 22px; bottom: calc(var(--dock-h) + 34px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%;
  background: rgba(14, 19, 27, .5); border: 1px solid var(--line-2); z-index: 6; touch-action: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(232, 237, 243, .9); }
body.street.touch #joy { display: block; }

/* ---------------- loader ---------------- */
#loader { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at 50% 40%, #1a2230, var(--bg) 70%); z-index: 20; transition: opacity .7s, visibility .7s; color: var(--mut); font-size: 13px; }
#loader.done { opacity: 0; visibility: hidden; }
.brand.big { width: 64px; height: 64px; border-radius: 20px; animation: float 3s ease-in-out infinite;
  box-shadow: 0 6px 24px rgba(255, 120, 80, .4); }
.brand.big .logo { width: 36px; height: 36px; }
.l-title { color: var(--fg); font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.l-bar { width: 200px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); overflow: hidden; }
#loadBar { height: 100%; width: 5%; background: linear-gradient(90deg, #ffc56b, #ff6b6b); border-radius: 2px; transition: width .4s; }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------------- tablet / phone ---------------- */
@media (max-width: 1000px) {
  :root { --panel-w: 296px; }
  #detail { width: 290px; }
}
@media (max-width: 760px) {
  :root { --dock-h: 104px; }
  #panel { top: calc(10px + var(--safe-t)); left: 10px; right: 10px; width: auto; padding: 12px 14px; max-height: 62%; }
  #collapse { display: grid; }
  #panel.min .body, #panel.min .foot, #panel.min .scale { display: none; }
  #panel.min #statsBtn { margin-top: 10px; padding: 7px 10px; }
  #statsDrawer { top: calc(10px + var(--safe-t)); left: 10px; right: 10px; width: auto; bottom: calc(10px + var(--safe-b)); max-height: none; z-index: 9;
    transform: translateY(calc(100% + 40px)); }
  .cards { padding: 4px 14px 14px; }
  .drawer-head { padding: 12px 14px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile:nth-child(3) { border-left: 0; }
  .tile:nth-child(n+3) { border-top: 1px solid var(--line); }
  .hrow { grid-template-columns: 96px 1fr; }
  #panel:not(.min) #collapse svg { transform: rotate(180deg); }
  .sub { display: none; }
  .hero { margin: 12px 0 8px; padding-top: 12px; gap: 12px; }
  .gauge { width: 68px; height: 68px; } .g-num b { font-size: 21px; } .g-num small { font-size: 9px; }
  .lvl { font-size: 16px; margin: 0 0 2px; }
  #panel.min .hero { margin-bottom: 0; }

  #dock { left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); }
  #timeline { flex-wrap: wrap; gap: 8px 10px; padding: 8px; }
  .mode { flex: 1 1 0; min-width: 0; max-width: none; }
  .mode select { width: 100%; }
  #tlTime { order: 2; min-width: 0; } #clock { font-size: 17px; }
  #play { order: 3; } #track { order: 4; flex-basis: calc(100% - 50px); }
  #tlStatus { order: 5; width: 100%; }
  body:not(.timelapse) #timeline { width: 100%; }
  #hint { font-size: 11px; }

  #detail { top: auto; left: 10px; right: 10px; width: auto; bottom: calc(var(--dock-h) + 18px + var(--safe-b)); max-height: 52%;
    transform: translateY(calc(100% + var(--dock-h) + 40px)); padding: 14px; }
  #detail.open ~ #dock #hint { display: none; }
  .d-hero { margin: 8px 0 10px; } #dVal { font-size: 32px; }

  #streetHud { left: 10px; right: 10px; top: calc(10px + var(--safe-t)); width: auto; padding: 12px 14px; }
  #streetHud h2 { margin-top: 8px; font-size: 18px; }
  .s-hint, .s-src { display: none; }
  .s-stats { margin-bottom: 0; }
  #attr { display: none; }
  .lab { font-size: 10.5px; } .lab.suburb { font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
