/* SuDS design studio — styles (same design system as the Blithe Runoff Simulator).
   Design tokens are the site owner's (hishamnuhu.com): light values on :root, dark values under
   prefers-color-scheme (unless data-theme="light") and under data-theme="dark".
   The --scene-* and --viz-* additions drive the 3D view and the chart and are read by js/theme.js. */

:root {
  --paper:#F3F6F7; --sheet:#FFFFFF; --sheet-2:#F8FAFB; --ink:#0C2230; --ink-2:#33495A; --ink-3:#526676;
  --rule:#D3DDE2; --rule-2:#9FB1BC; --accent:#00768A; --accent-2:#B4570F; --accent-ink:#00768A; --accent-wash:#DDF2F5; --on-accent:#FFFFFF;
  --link:#1E5A84; --act:#B5382B; --inv:#C38812; --ok:#2A7247; --mon:#C6D1D8; --mon-ink:#526676; --mon-wash:#EAEFF2;
  --ground:#D4DCD6; --ground-line:#7E8E84;
  --viz-cat-1:#285B9C; --viz-cat-2:#C8651B; --viz-cat-3:#1E8C6E; --viz-cat-4:#7B5CC4; --viz-cat-5:#A27A00; --viz-cat-6:#C2457E;
  --water-1:#E7F1F5; --water-2:#CBE1EB; --water-3:#A2C8DB; --water-4:#72A8C6; --water-5:#4683AA; --water-6:#275F88; --water-7:#123F5E;
  --viz-seq-1:#DEF5F8; --viz-seq-2:#ABDFE8; --viz-seq-3:#73C3DA; --viz-seq-4:#339CC4; --viz-seq-5:#0B78AC; --viz-seq-6:#12588A; --viz-seq-7:#103962;
  --flood-1:#A6F6FF; --flood-2:#5FE0F5; --flood-3:#23B5E6; --flood-4:#1584CF; --flood-5:#0F57A8; --flood-6:#0B3A7A;
  --night-0:#050D14; --night-1:#081521; --night-2:#0D1F2E; --night-3:#13293B;
  --radius:6px;
  --f-sans:"Archivo","Helvetica Neue","Arial Nova",Arial,system-ui,sans-serif;
  --f-serif:"Newsreader","Iowan Old Style","Charter","Bitstream Charter","Sitka Text",Cambria,Georgia,serif;
  --shadow-1:0 1px 2px rgba(5,13,20,.08),0 8px 24px -12px rgba(5,13,20,.28);
  --shadow-2:0 2px 4px rgba(5,13,20,.1),0 24px 48px -20px rgba(5,13,20,.45);

  /* chart */
  --viz-rain:#A2C8DB; --viz-net:#275F88; --viz-gauge:#0C2230; --viz-obs:#B4570F; --viz-ref:#526676;
  /* 3D scene */
  --stage-a:#FFFFFF; --stage-b:#EDF2F4; --stage-c:#DCE5E9; --stage-grid:rgba(12,34,48,.05);
  --scene-tint-low:#CBD8D0; --scene-tint-high:#F6F3E9;
  --scene-hyp-1:#8FB08C; --scene-hyp-2:#B9CC9B; --scene-hyp-3:#E2DBAE; --scene-hyp-4:#D9BD93; --scene-hyp-5:#C7A68A;
  --scene-outside:#E3E9EB; --scene-outside-amt:.66;
  --scene-fog:#EAF0F2; --scene-fog-amt:.4;
  --scene-contour:#6A5740; --scene-contour-alpha:.6;
  --scene-grid:#0C2230; --scene-grid-alpha:.2;
  --scene-shade-lo:.38; --scene-shade-hi:1.16; --scene-shade-gamma:1;
  --scene-sat-gain:1.08; --scene-wash:.34; --scene-tau-mix:.86;
  --scene-skirt-top:#C4CFCC; --scene-skirt-bottom:#A5B3B2; --scene-skirt-line:#6F8079;
  --scene-shadow:#0C2230; --scene-shadow-alpha:.2;
  --scene-water-deep:#A2C8DB; --scene-water-bright:#3C7CA6;
  --scene-channel:#2F6E9A; --scene-channel-hi:#0B3A7A;
  --scene-boundary:#0C2230; --scene-lake-line:#275F88;
  --scene-drop:#1584CF; --scene-drop-stream:#0B3A7A; --scene-drop-soak:#9A6A2C; --scene-streak:#33495A;
  --scene-additive:0; --scene-ws-boost:.12;
  --scene-town:#BDB2A2; --scene-town-edge:#7C6C58; --scene-town-amt:.85; --scene-town-sat-amt:.22; --scene-town-edge-amt:.7;
  --scene-wood:#A6C8A4; --scene-wood-amt:.85; --scene-open-water:#A9CDE0; --scene-ctx-line:#5F8FAE; --scene-road:#7A6A5A; --scene-wash-sat:.3; --scene-outside-sat:.3;
  --halo:rgba(255,255,255,.9); --map-water-ink:#1E5A84; --map-contour-ink:#6A5740;
  --panel:rgba(255,255,255,.9); --panel-2:rgba(248,250,251,.92);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:#09161E; --sheet:#0F202B; --sheet-2:#0C1B24; --ink:#E2ECF0; --ink-2:#AFC2CC; --ink-3:#8BA2AF;
    --rule:#1F3443; --rule-2:#3B5466; --accent:#6FB0F4; --accent-2:#6FD3A0; --accent-ink:#A3CBF8; --accent-wash:#13294A; --on-accent:#06121F;
    --link:#8CC3E0; --act:#CC4A3A; --inv:#E4AE48; --ok:#6CC08E; --mon:#2B3F4C; --mon-ink:#8BA2AF; --mon-wash:#172832;
    --ground:#22332D; --ground-line:#56695E;
    --viz-cat-1:#4177C7; --viz-cat-2:#D27330; --viz-cat-3:#22A07D; --viz-cat-4:#8E73E0; --viz-cat-5:#B98C00; --viz-cat-6:#D25E92;
    --water-1:#0F2733; --water-2:#133647; --water-3:#1A4C63; --water-4:#266887; --water-5:#3E87AE; --water-6:#73AED0; --water-7:#B4D8EA;
    --viz-seq-1:#21374E; --viz-seq-2:#295273; --viz-seq-3:#2E7199; --viz-seq-4:#2B91B7; --viz-seq-5:#32B2D1; --viz-seq-6:#56D3E7; --viz-seq-7:#92F0F9;
    --shadow-1:0 1px 2px rgba(0,0,0,.4),0 10px 28px -14px rgba(0,0,0,.75);
    --shadow-2:0 2px 6px rgba(0,0,0,.45),0 28px 56px -22px rgba(0,0,0,.9);
    --viz-rain:#266887; --viz-net:#73AED0; --viz-gauge:#E2ECF0; --viz-obs:#6FD3A0; --viz-ref:#8BA2AF;
    --stage-a:#0F2231; --stage-b:#081521; --stage-c:#050D14; --stage-grid:rgba(160,200,230,.055);
    --scene-tint-low:#14283A; --scene-tint-high:#647D8E;
    --scene-hyp-1:#35543F; --scene-hyp-2:#566E49; --scene-hyp-3:#7F8358; --scene-hyp-4:#8E7C5C; --scene-hyp-5:#9D8C7A;
    --scene-outside:#0B1924; --scene-outside-amt:.72;
    --scene-fog:#07131C; --scene-fog-amt:.55;
    --scene-contour:#C5D6DF; --scene-contour-alpha:.42;
    --scene-grid:#A0C8E6; --scene-grid-alpha:.2;
    --scene-shade-lo:.22; --scene-shade-hi:1.5; --scene-shade-gamma:1.1;
    --scene-sat-gain:.82; --scene-wash:.36; --scene-tau-mix:.86;
    --scene-skirt-top:#182C3D; --scene-skirt-bottom:#091620; --scene-skirt-line:#46627A;
    --scene-shadow:#000000; --scene-shadow-alpha:.55;
    --scene-water-deep:#17425A; --scene-water-bright:#7FBBDD;
    --scene-channel:#5E9CC2; --scene-channel-hi:#9BE6F7;
    --scene-boundary:#E2ECF0; --scene-lake-line:#73AED0;
    --scene-drop:#5FE0F5; --scene-drop-stream:#C9F8FF; --scene-drop-soak:#C79A55; --scene-streak:#B5CAD6;
    --scene-additive:1; --scene-ws-boost:.28;
  --scene-town:#6E675C; --scene-town-edge:#B4A68F; --scene-town-amt:.75; --scene-town-sat-amt:.25; --scene-town-edge-amt:.6;
  --scene-wood:#1F4A3E; --scene-wood-amt:.8; --scene-open-water:#1D5069; --scene-ctx-line:#4F7F9E; --scene-road:#9A8E7C; --scene-wash-sat:.3; --scene-outside-sat:.5;
    --halo:rgba(5,13,20,.85); --map-water-ink:#9CCBE6; --map-contour-ink:#B5CAD6;
    --panel:rgba(13,29,40,.86); --panel-2:rgba(10,24,33,.9);
  }
}
:root[data-theme="dark"] {
  --paper:#09161E; --sheet:#0F202B; --sheet-2:#0C1B24; --ink:#E2ECF0; --ink-2:#AFC2CC; --ink-3:#8BA2AF;
  --rule:#1F3443; --rule-2:#3B5466; --accent:#6FB0F4; --accent-2:#6FD3A0; --accent-ink:#A3CBF8; --accent-wash:#13294A; --on-accent:#06121F;
  --link:#8CC3E0; --act:#CC4A3A; --inv:#E4AE48; --ok:#6CC08E; --mon:#2B3F4C; --mon-ink:#8BA2AF; --mon-wash:#172832;
  --ground:#22332D; --ground-line:#56695E;
  --viz-cat-1:#4177C7; --viz-cat-2:#D27330; --viz-cat-3:#22A07D; --viz-cat-4:#8E73E0; --viz-cat-5:#B98C00; --viz-cat-6:#D25E92;
  --water-1:#0F2733; --water-2:#133647; --water-3:#1A4C63; --water-4:#266887; --water-5:#3E87AE; --water-6:#73AED0; --water-7:#B4D8EA;
  --viz-seq-1:#21374E; --viz-seq-2:#295273; --viz-seq-3:#2E7199; --viz-seq-4:#2B91B7; --viz-seq-5:#32B2D1; --viz-seq-6:#56D3E7; --viz-seq-7:#92F0F9;
  --shadow-1:0 1px 2px rgba(0,0,0,.4),0 10px 28px -14px rgba(0,0,0,.75);
  --shadow-2:0 2px 6px rgba(0,0,0,.45),0 28px 56px -22px rgba(0,0,0,.9);
  --viz-rain:#266887; --viz-net:#73AED0; --viz-gauge:#E2ECF0; --viz-obs:#6FD3A0; --viz-ref:#8BA2AF;
  --stage-a:#0F2231; --stage-b:#081521; --stage-c:#050D14; --stage-grid:rgba(160,200,230,.055);
  --scene-tint-low:#14283A; --scene-tint-high:#647D8E;
  --scene-hyp-1:#35543F; --scene-hyp-2:#566E49; --scene-hyp-3:#7F8358; --scene-hyp-4:#8E7C5C; --scene-hyp-5:#9D8C7A;
  --scene-outside:#0B1924; --scene-outside-amt:.72;
  --scene-fog:#07131C; --scene-fog-amt:.55;
  --scene-contour:#C5D6DF; --scene-contour-alpha:.42;
  --scene-grid:#A0C8E6; --scene-grid-alpha:.2;
  --scene-shade-lo:.22; --scene-shade-hi:1.5; --scene-shade-gamma:1.1;
  --scene-sat-gain:.82; --scene-wash:.36; --scene-tau-mix:.86;
  --scene-skirt-top:#182C3D; --scene-skirt-bottom:#091620; --scene-skirt-line:#46627A;
  --scene-shadow:#000000; --scene-shadow-alpha:.55;
  --scene-water-deep:#17425A; --scene-water-bright:#7FBBDD;
  --scene-channel:#5E9CC2; --scene-channel-hi:#9BE6F7;
  --scene-boundary:#E2ECF0; --scene-lake-line:#73AED0;
  --scene-drop:#5FE0F5; --scene-drop-stream:#C9F8FF; --scene-drop-soak:#C79A55; --scene-streak:#B5CAD6;
  --scene-additive:1; --scene-ws-boost:.28;
  --scene-town:#6E675C; --scene-town-edge:#B4A68F; --scene-town-amt:.75; --scene-town-sat-amt:.25; --scene-town-edge-amt:.6;
  --scene-wood:#1F4A3E; --scene-wood-amt:.8; --scene-open-water:#1D5069; --scene-ctx-line:#4F7F9E; --scene-road:#9A8E7C; --scene-wash-sat:.3; --scene-outside-sat:.5;
  --halo:rgba(5,13,20,.85); --map-water-ink:#9CCBE6; --map-contour-ink:#B5CAD6;
  --panel:rgba(13,29,40,.86); --panel-2:rgba(10,24,33,.9);
}

/* --- additions for this app: land cover, buildings, SuDS feature colours, overlays, chart */
:root {
  /* chart */
  --viz-rain:#72A8C6; --viz-inflow:#6E8494; --viz-outflow:#00768A; --viz-limit:#B4570F; --viz-store:#4683AA; --viz-spill:#B5382B;
  /* ground: land cover of the site and its surroundings */
  --lc-outside:#E4E9E6; --lc-open:#D5E2C8; --lc-corridor:#BAD5AC; --lc-pocket:#CBDFBC; --lc-garden:#D4E4C5; --lc-local:#C6CCD0; --lc-cross:#C0C7CC; --lc-main:#B0B9C0;
  --lc-drive:#E5D8BC; --lc-school:#E8E1CB; --lc-centre:#E4DCD2; --lc-park:#B0D29E; --lc-basin:#B9D4A8; --lc-swale:#A9D0A2; --lc-verge:#BFDAAE;
  --ctx-wood:#C2D5BC; --ctx-water:#A9CDE0; --ctx-road:#FBFCFC; --ctx-road-major:#F3E4C6; --ctx-rail:#8E9BA4; --ctx-building:#CBD2D6; --ctx-block:#E2E6E8;
  /* buildings */
  --b-wall:#F5F2EB; --b-wall-2:#EAE3D7; --b-roof-1:#B8705B; --b-roof-2:#94705F; --b-roof-3:#74838F; --b-civic:#ECE8E1;
  /* SuDS feature types (scene, lists, legends) */
  --k-permeable:#C9A25E; --k-raingarden:#3FA66B; --k-bioretention:#1E8C7E; --k-swale:#74B86B; --k-basin:#2B6FA0; --k-greenroof:#8DBB4F;
  --scene-fog:#EDF2F4; --scene-fog-near:3800; --scene-fog-far:12000; --scene-shade-lo:.76; --scene-shade-hi:1.12; --scene-site-shade:.75;
  --scene-skirt-top:#C9D2D0; --scene-skirt-bottom:#AEBABA; --scene-water:#4C9BD0; --scene-water-deep:#1F6FAE; --scene-water-alpha:.9;
  --scene-fail:#C0362C; --scene-off:#B7BEC3; --scene-select:#F2A22E; --scene-boundary:#0C2230; --scene-tree:#79AB70; --scene-tree-2:#568F5F;
  --scene-rain:#4F7390; --scene-flow:#EAF7FF; --scene-dam:#958C7A; --scene-basin-slope:#93BC86; --scene-basin-base:#7DAA84; --scene-headwall:#BDB8AC;
  --scene-sun:1; --scene-amb:1;
  --ov-sw-1:#9CCBEA; --ov-sw-2:#4F9BD8; --ov-sw-3:#1B5FAE; --ov-fz-2:#8FC7E8; --ov-fz-3:#3F86C9;
  --stage-a:#FFFFFF; --stage-b:#EDF2F4; --stage-c:#DCE5E9; --stage-grid:rgba(12,34,48,.05);
  --halo:rgba(255,255,255,.9); --map-water-ink:#1E5A84; --panel:rgba(255,255,255,.92); --panel-2:rgba(248,250,251,.94);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --viz-rain:#3E87AE; --viz-inflow:#8BA2AF; --viz-outflow:#6FB0F4; --viz-limit:#FFB547; --viz-store:#56D3E7; --viz-spill:#FF6A3D;
  --lc-outside:#0E1D27; --lc-open:#14282A; --lc-corridor:#17382F; --lc-pocket:#152F2B; --lc-garden:#19332F; --lc-local:#2D3E4A; --lc-cross:#30424F; --lc-main:#3B4F5E;
  --lc-drive:#4C4737; --lc-school:#2A3437; --lc-centre:#2D3439; --lc-park:#1B4234; --lc-basin:#1A3E36; --lc-swale:#1E4B3C; --lc-verge:#1A3B31;
  --ctx-wood:#133026; --ctx-water:#1D5069; --ctx-road:#263845; --ctx-road-major:#46483C; --ctx-rail:#56687A; --ctx-building:#1B2D39; --ctx-block:#20323E;
  --b-wall:#3D5160; --b-wall-2:#354653; --b-roof-1:#6E4D46; --b-roof-2:#536372; --b-roof-3:#485A6A; --b-civic:#445765;
  --k-permeable:#BF9C5F; --k-raingarden:#4FC088; --k-bioretention:#22B5A0; --k-swale:#7CCB6E; --k-basin:#6FB0F4; --k-greenroof:#A4D05E;
  --scene-fog:#081521; --scene-fog-near:3800; --scene-fog-far:12000; --scene-shade-lo:.68; --scene-shade-hi:1.28; --scene-site-shade:.8;
  --scene-skirt-top:#182C3D; --scene-skirt-bottom:#091620; --scene-water:#45D3EA; --scene-water-deep:#1E9FD6; --scene-water-alpha:.92;
  --scene-fail:#FF6A3D; --scene-off:#46555F; --scene-select:#FFB547; --scene-boundary:#E2ECF0; --scene-tree:#2F6E57; --scene-tree-2:#235847;
  --scene-rain:#A6D8F0; --scene-flow:#E2FCFF; --scene-dam:#77725F; --scene-basin-slope:#27594A; --scene-basin-base:#1C4B4C; --scene-headwall:#7C8790;
  --scene-sun:.9; --scene-amb:1;
  --ov-sw-1:#2B6E9A; --ov-sw-2:#3E9BD6; --ov-sw-3:#7FD6FF; --ov-fz-2:#2B6E9A; --ov-fz-3:#4FAEEA;
  --stage-a:#0F2231; --stage-b:#081521; --stage-c:#050D14; --stage-grid:rgba(160,200,230,.055);
  --halo:rgba(5,13,20,.85); --map-water-ink:#9CCBE6; --panel:rgba(13,29,40,.88); --panel-2:rgba(10,24,33,.92);
  }
}
:root[data-theme="dark"] {
  --viz-rain:#3E87AE; --viz-inflow:#8BA2AF; --viz-outflow:#6FB0F4; --viz-limit:#FFB547; --viz-store:#56D3E7; --viz-spill:#FF6A3D;
  --lc-outside:#0E1D27; --lc-open:#14282A; --lc-corridor:#17382F; --lc-pocket:#152F2B; --lc-garden:#19332F; --lc-local:#2D3E4A; --lc-cross:#30424F; --lc-main:#3B4F5E;
  --lc-drive:#4C4737; --lc-school:#2A3437; --lc-centre:#2D3439; --lc-park:#1B4234; --lc-basin:#1A3E36; --lc-swale:#1E4B3C; --lc-verge:#1A3B31;
  --ctx-wood:#133026; --ctx-water:#1D5069; --ctx-road:#263845; --ctx-road-major:#46483C; --ctx-rail:#56687A; --ctx-building:#1B2D39; --ctx-block:#20323E;
  --b-wall:#3D5160; --b-wall-2:#354653; --b-roof-1:#6E4D46; --b-roof-2:#536372; --b-roof-3:#485A6A; --b-civic:#445765;
  --k-permeable:#BF9C5F; --k-raingarden:#4FC088; --k-bioretention:#22B5A0; --k-swale:#7CCB6E; --k-basin:#6FB0F4; --k-greenroof:#A4D05E;
  --scene-fog:#081521; --scene-fog-near:3800; --scene-fog-far:12000; --scene-shade-lo:.68; --scene-shade-hi:1.28; --scene-site-shade:.8;
  --scene-skirt-top:#182C3D; --scene-skirt-bottom:#091620; --scene-water:#45D3EA; --scene-water-deep:#1E9FD6; --scene-water-alpha:.92;
  --scene-fail:#FF6A3D; --scene-off:#46555F; --scene-select:#FFB547; --scene-boundary:#E2ECF0; --scene-tree:#2F6E57; --scene-tree-2:#235847;
  --scene-rain:#A6D8F0; --scene-flow:#E2FCFF; --scene-dam:#77725F; --scene-basin-slope:#27594A; --scene-basin-base:#1C4B4C; --scene-headwall:#7C8790;
  --scene-sun:.9; --scene-amb:1;
  --ov-sw-1:#2B6E9A; --ov-sw-2:#3E9BD6; --ov-sw-3:#7FD6FF; --ov-fz-2:#2B6E9A; --ov-fz-3:#4FAEEA;
  --stage-a:#0F2231; --stage-b:#081521; --stage-c:#050D14; --stage-grid:rgba(160,200,230,.055);
  --halo:rgba(5,13,20,.85); --map-water-ink:#9CCBE6; --panel:rgba(13,29,40,.88); --panel-2:rgba(10,24,33,.92);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 500 13px/1.35 var(--f-sans); font-stretch: 96%;
  -webkit-font-smoothing: antialiased; overflow: hidden;
  font-variant-numeric: tabular-nums;
}
#app { position: relative; height: 100%; overflow: hidden; --gap: 12px; --left-w: 304px; --right-w: 428px; }
h1, h2, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ stage */
#stage {
  position: absolute; inset: 0;
  background:
    linear-gradient(var(--stage-grid) 1px, transparent 1px) 0 0 / 100% 88px,
    linear-gradient(90deg, var(--stage-grid) 1px, transparent 1px) 0 0 / 88px 100%,
    radial-gradient(120% 90% at 55% 38%, var(--stage-a) 0%, var(--stage-b) 52%, var(--stage-c) 100%);
}
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline-offset: -3px; cursor: grab; }
#gl:active { cursor: grabbing; }
#labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.lbl {
  position: absolute; left: 0; top: 0; white-space: nowrap; visibility: hidden; pointer-events: none;
  will-change: transform; color: var(--ink-2); font-size: 11px; line-height: 1.15;
  text-shadow: 0 0 2px var(--halo), 0 0 4px var(--halo), 0 1px 6px var(--halo);
}
.lbl.place { display: flex; align-items: center; gap: 5px; font-stretch: 92%; letter-spacing: .01em; }
.lbl.place.l { flex-direction: row-reverse; }
.lbl.place .sym { flex: none; box-sizing: border-box; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-2); background: var(--halo); box-shadow: 0 0 0 1.5px var(--halo); }
.lbl.place.village { font-size: 11.5px; font-weight: 550; color: var(--ink-2); }
.lbl.place.town { color: var(--ink); font-weight: 750; font-size: 14px; font-stretch: 100%; letter-spacing: .03em; gap: 6px; }
.lbl.place.town .sym { border-radius: 1px; border: 0; background: var(--ink); }
.lbl.place.out { color: var(--ink-3); }
.lbl.place.village.out .sym { border-color: var(--ink-3); }
.lbl.place.town.out { color: var(--ink); }
.lbl.place.hamlet { font-size: 10px; font-weight: 500; color: var(--ink-3); font-style: italic; }
.lbl.place.hamlet .sym { width: 4px; height: 4px; border: 0; background: var(--ink-3); }
.lbl.river.ctx { font-size: 12.5px; opacity: .75; }
.lbl.river.minor { font-size: 12px; }
.lbl.river { font: italic 400 14px/1.1 var(--f-serif); color: var(--map-water-ink); letter-spacing: .02em; }
.lbl.water { font-size: 13px; }
.lbl.grat { font-size: 10px; color: var(--ink-3); font-stretch: 86%; letter-spacing: .03em; padding: 5px 7px; }
.lbl.contour { font-size: 9.5px; color: var(--map-contour-ink); font-stretch: 86%; }
.lbl.mk {
  display: flex; align-items: center; gap: 7px; padding: 0; border: 0; background: none; pointer-events: auto;
  color: var(--ink); text-align: left; transition: opacity .2s;
}
.lbl.mk .ring {
  --c: var(--ink); flex: none; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%;
  border: 2px solid var(--c); background: radial-gradient(circle, var(--c) 0 2.2px, transparent 2.6px);
  box-shadow: 0 0 0 calc(2.5px * var(--pulse, 1)) color-mix(in srgb, var(--c) 28%, transparent), 0 0 calc(9px * var(--pulse, 1)) color-mix(in srgb, var(--c) 75%, transparent);
  transition: box-shadow .25s linear;
}
.lbl.mk .t { display: flex; flex-direction: column; }
.lbl.mk b { font-weight: 650; font-size: 11.5px; font-stretch: 96%; }
.lbl.mk small { font-size: 10px; color: var(--ink-2); font-stretch: 88%; }
.lbl.mk-gauge b { font-size: 12.5px; }
.lbl.mk.dimmed { opacity: .35; }
.lbl.mk.flip { flex-direction: row-reverse; text-align: right; }
.lbl.mk.flip .ring { margin-left: 0; margin-right: -6.5px; }
.lbl.mk.flip .t { align-items: flex-end; }
.lbl.mk.compact .t { display: none; }
.lbl.mk.up .t { position: absolute; bottom: calc(100% + 2px); left: -4px; }
.lbl.mk.up.flip .t { left: auto; right: -4px; }
.lbl.mk:hover b { text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ panels */
.card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow-1); -webkit-backdrop-filter: blur(10px) saturate(1.1); backdrop-filter: blur(10px) saturate(1.1);
  pointer-events: auto;
}
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent; overscroll-behavior: contain; }
h2 { font-size: 11px; font-weight: 650; font-stretch: 108%; letter-spacing: .05em; color: var(--ink-3); }

#left { position: absolute; top: var(--gap); left: var(--gap); bottom: var(--gap); width: var(--left-w); display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 3; }
#hdr { padding: 12px 14px 10px; border-left: 2px solid var(--accent); flex: none; }
.hdr-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#title { font-size: 17px; line-height: 1.15; font-weight: 750; font-stretch: 112%; letter-spacing: -.005em; }
.chip { flex: none; font-size: 10px; font-stretch: 90%; padding: 1px 6px; border: 1px solid var(--inv); color: var(--inv); border-radius: 99px; white-space: nowrap; }
.sub { margin-top: 3px; color: var(--ink-2); font: 400 14px/1.3 var(--f-serif); }
#factsBox { margin-top: 8px; border-top: 1px solid var(--rule); padding-top: 7px; }
#factsBox > summary, .explain > summary, #about > summary { cursor: pointer; list-style: none; }
#factsBox > summary::-webkit-details-marker, .explain > summary::-webkit-details-marker, #about > summary::-webkit-details-marker { display: none; }
#factsBox > summary { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
#factsBox > summary .chip { margin-left: auto; }
#factsBox > summary::after { margin-left: 0; }
#factsBox > summary::after, .explain > summary::after, #about > summary::after { content: "+"; color: var(--ink-3); font-weight: 400; margin-left: 8px; }
#factsBox[open] > summary::after, .explain[open] > summary::after, #about[open] > summary::after { content: "–"; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 6px; font-size: 12px; font-stretch: 90%; }
.facts dt { color: var(--ink-3); }
.facts dd { text-align: right; font-weight: 600; }
.attrib { margin-top: 7px; font-size: 10px; line-height: 1.35; color: var(--ink-3); font-stretch: 88%; }

#controls { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#ctlTabs { flex: none; display: flex; border-bottom: 1px solid var(--rule); }
#ctlTabs button { flex: 1 1 0; padding: 9px 4px 8px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; font-size: 12px; font-weight: 650; font-stretch: 100%; color: var(--ink-3); }
#ctlTabs button:hover { color: var(--ink); }
#ctlTabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
#ctlBody { flex: 1 1 auto; min-height: 0; padding: 0 14px; -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent); mask-image: linear-gradient(#000 calc(100% - 22px), transparent); }
#ctlBody::after { content: ""; display: block; height: 14px; }
@media (min-width: 761px) {
  body[data-ctl="storm"] .pane:not([data-pane="storm"]), body[data-ctl="res"] .pane:not([data-pane="res"]), body[data-ctl="map"] .pane:not([data-pane="map"]) { display: none; }
  #ctlBody .pane { border-top: 0; }
  #ctlBody .pane + .pane[data-pane="map"] { border-top: 1px solid var(--rule); }
}
.pane { padding: 12px 0 13px; border-top: 1px solid var(--rule); }
.pane:first-child { border-top: 0; }
.pane > h2 { margin-bottom: 9px; }
.field { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 8px; margin-bottom: 9px; }
.field > label { font-size: 12px; color: var(--ink-2); }
.field > output { font-weight: 650; font-size: 12px; font-stretch: 90%; }
.field > input[type=range], .field > select, .field > .hint { grid-column: 1 / -1; }
.hint { font: 400 12.5px/1.35 var(--f-serif); color: var(--ink-3); }
select {
  width: 100%; padding: 5px 26px 5px 8px; border: 1px solid var(--rule-2); border-radius: 4px; background-color: var(--panel-2);
  appearance: none; -webkit-appearance: none; font-size: 12px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
select option { background: var(--sheet); color: var(--ink); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer; --p: 50%; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--accent) var(--p), var(--rule-2) var(--p)); border-radius: 1px; }
input[type=range]::-moz-range-track { height: 2px; background: linear-gradient(90deg, var(--accent) var(--p), var(--rule-2) var(--p)); border-radius: 1px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5.5px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--accent); }
input[type=range]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--accent); }
input[type=range]:disabled { opacity: .45; cursor: default; }
input[type=range]:focus-visible { outline-offset: 0; }

.tg { display: flex; align-items: center; gap: 9px; padding: 3.5px 0; font-size: 12.5px; cursor: pointer; }
.tg input { position: absolute; opacity: 0; width: 0; height: 0; }
.tg .sw { flex: none; position: relative; width: 26px; height: 14px; border-radius: 99px; border: 1px solid var(--rule-2); background: transparent; transition: background .15s, border-color .15s; }
.tg .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); transition: transform .15s, background .15s; }
.tg input:checked + .sw { background: var(--accent); border-color: var(--accent); }
.tg input:checked + .sw::after { transform: translateX(12px); background: var(--on-accent); }
.tg input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.tg input:disabled ~ span { opacity: .5; }
.tg .note { color: var(--ink-3); font-size: 11px; margin-left: auto; font-stretch: 88%; text-align: right; }
.toggles { margin-bottom: 10px; }
.pane > .tg { margin-bottom: 8px; }

.keyfig { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 8px 0 6px; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; background: var(--rule); }
.keyfig > div { background: var(--panel-2); padding: 6px 7px 5px; min-width: 0; }
.keyfig .k { display: block; font-size: 10px; color: var(--ink-3); font-stretch: 88%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keyfig .v { display: block; font-size: 15px; font-weight: 700; font-stretch: 86%; line-height: 1.15; white-space: nowrap; }
.keyfig .v small { font-size: 10px; font-weight: 500; color: var(--ink-3); white-space: normal; }
.keyfig .v:has(small:only-child) { line-height: 1.05; white-space: normal; }
.keyfig .d { display: block; font-size: 10px; font-stretch: 86%; color: var(--accent-ink); min-height: 12px; white-space: nowrap; }
.keyfig .d.none { color: var(--ink-3); }
.tag { display: inline-block; margin-left: 5px; padding: 0 5px; border: 1px solid currentColor; border-radius: 99px; font-size: 9.5px; font-weight: 600; font-stretch: 88%; line-height: 14px; vertical-align: 1px; white-space: nowrap; cursor: help; color: var(--ink-3); }
.tag.sourced { color: var(--ok); }
.tag.derived { color: var(--link); }
.tag.assumed { color: var(--inv); }
.tag.hypothetical { color: var(--act); }
.field > label .tag { margin-left: 6px; }
#resControls { margin-top: 10px; }
#resStart { margin-top: 10px; }
#resControls .field.indent { margin-left: 35px; }
#resControls .gap { margin-top: 12px; }
#resControls p.gap { margin-bottom: 12px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent-ink); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.facts.detail, .facts.sheet { font-size: 11.5px; gap: 3px 10px; }
.facts.detail { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.facts.detail dd { font-stretch: 86%; }
.facts.sheet { grid-template-columns: 84px minmax(0, 1fr); }
.facts.detail dt.grp { grid-column: 1 / -1; margin-top: 7px; color: var(--ink); font-weight: 650; font-size: 11px; }
.facts.sheet dd { font-weight: 500; text-align: left; }
.facts.sheet dd small { display: block; color: var(--ink-3); font-size: 10px; }
.explain { margin-top: 2px; }
.explain + .explain { margin-top: 9px; }
.explain > summary { font-size: 12px; color: var(--accent-ink); display: flex; justify-content: space-between; }
.explain p { margin-top: 7px; font: 400 13px/1.45 var(--f-serif); color: var(--ink-2); }

.ramp { margin-top: 4px; }
.ramp-bar { height: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--viz-seq-1), var(--viz-seq-2), var(--viz-seq-3), var(--viz-seq-4), var(--viz-seq-5), var(--viz-seq-6), var(--viz-seq-7)); border: 1px solid var(--rule); }
.ramp-ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--ink-3); margin: 2px 0 4px; font-stretch: 88%; }

#transport { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 10px; }
.btn { padding: 6px 10px; border: 1px solid var(--rule-2); border-radius: 4px; background: transparent; font-size: 12px; font-weight: 600; font-stretch: 94%; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); min-width: 58px; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.clock { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
#clock { font-weight: 700; font-size: 13px; font-stretch: 88%; }
#phase { font: italic 400 12.5px var(--f-serif); color: var(--ink-3); }

#right { position: absolute; top: var(--gap); right: var(--gap); bottom: var(--gap); width: var(--right-w); display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 3; }
#topbar { display: flex; gap: 6px; align-items: flex-start; justify-content: flex-end; flex: none; }
#topbar .btn { background: var(--panel); pointer-events: auto; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); padding: 8px 10px; }
#about { flex: 1 1 auto; min-width: 0; }
#about > summary { padding: 8px 12px; font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; }
@media (min-width: 761px) {
  #about[open] { position: absolute; top: 0; left: auto; width: min(720px, calc(100vw - 360px)); right: 0; bottom: 0; z-index: 5; display: flex; flex-direction: column; box-shadow: var(--shadow-2); background: var(--sheet); }
  #about[open] > summary { border-bottom: 1px solid var(--rule); flex: none; }
  /* the details content box is not a flex item in every engine, so bound the body explicitly */
  #about[open] .about-body { max-height: calc(100% - 36px); max-height: calc(100dvh - var(--gap) * 2 - 36px); overflow-y: auto; }
}
.about-body { padding: 4px 16px 18px; flex: 1 1 auto; min-height: 0; font: 400 14.5px/1.52 var(--f-serif); color: var(--ink-2); }
.about-body h3 { font: 650 12px/1.3 var(--f-sans); font-stretch: 106%; letter-spacing: .03em; color: var(--ink); margin: 18px 0 6px; }
.about-body p { margin: 0 0 9px; max-width: 62ch; }
.about-body ul, .about-body ol { margin: 0 0 9px; padding-left: 1.15em; max-width: 62ch; }
.about-body ul { list-style: disc; }
.about-body li { margin-bottom: 5px; }
.about-body strong { color: var(--ink); font-weight: 600; }
.about-body .note { border-left: 2px solid var(--inv); padding-left: 10px; color: var(--ink-2); }
.about-body .src { font: 500 11px/1.4 var(--f-sans); color: var(--ink-3); font-stretch: 90%; }
.about-body .aside { font-size: 13px; color: var(--ink-3); }
.about-body .tbl-sub, .about-body .tbl-note { font: 500 11px/1.4 var(--f-sans); color: var(--ink-3); font-stretch: 92%; max-width: none; }
.about-body .tbl-note { margin-top: 6px; }
.tbl-wrap { overflow-x: auto; margin: 4px 0 0; -webkit-overflow-scrolling: touch; }
.tbl { border-collapse: collapse; font: 500 11.5px/1.3 var(--f-sans); font-stretch: 92%; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 100%; }
.tbl th, .tbl td { padding: 5px 7px; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; white-space: nowrap; }
.tbl thead th { font-weight: 650; color: var(--ink-3); font-size: 10.5px; letter-spacing: .02em; border-bottom: 1px solid var(--rule-2); white-space: normal; vertical-align: bottom; }
.tbl thead th:first-child { text-align: left; }
.tbl tbody th { text-align: left; font-weight: 600; color: var(--ink); white-space: normal; min-width: 12em; }
.tbl .txt { text-align: left; white-space: normal; min-width: 11em; }
.tbl td.em { color: var(--ink); font-weight: 650; }
.tbl small { display: block; font-size: 10px; color: var(--ink-3); font-weight: 500; white-space: normal; }
.tbl td:not(.txt) small { white-space: nowrap; }
.tbl .na { color: var(--ink-3); }
.tbl .vs { color: var(--ink-3); padding: 0 1px; }
.tbl sup { font-size: 9px; color: var(--accent-2); margin-left: 1px; }
.tbl sup.pad { visibility: hidden; }

#wsPanel { margin-top: auto; padding: 10px 6px 6px; flex: none; }
#wsPanel > h2 { padding: 0 8px 6px; }
.ws {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 2px 9px; width: 100%;
  padding: 6px 8px; border: 0; border-top: 1px solid var(--rule); background: transparent; text-align: left; border-radius: 0;
}
.ws:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.ws[aria-pressed="true"] { background: var(--accent-wash); box-shadow: inset 2px 0 0 var(--accent); }
.ws .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--c); grid-row: 1 / span 2; }
.ws .sw.g { border-radius: 50%; background: transparent; border: 2px solid var(--viz-gauge); }
.ws .nm { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws .meta { grid-column: 2; font-size: 11px; color: var(--ink-3); font-stretch: 88%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws .pk { grid-row: 1 / span 2; grid-column: 3; text-align: right; font-weight: 700; font-size: 14px; font-stretch: 88%; line-height: 1.05; }
.ws .pk small { display: block; font-weight: 500; font-size: 10px; color: var(--ink-3); }

#flowPanel { flex: 0 1 430px; min-height: 280px; padding: 10px 12px 9px; display: flex; flex-direction: column; }
.flow-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1px 10px; margin-bottom: 6px; }
#flowTitle { font-size: 12.5px; letter-spacing: .01em; color: var(--ink); font-stretch: 100%; }
.readout { flex: none; font-size: 11.5px; color: var(--ink-3); font-stretch: 88%; white-space: nowrap; }
.readout b { color: var(--ink); font-weight: 700; }
.chart-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: ew-resize; }
.tip { position: absolute; z-index: 4; min-width: 150px; padding: 6px 8px; background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 4px; box-shadow: var(--shadow-1); pointer-events: none; font-size: 11px; font-stretch: 90%; }
.tip .tt { font-weight: 700; margin-bottom: 3px; }
.tip .tr { display: grid; grid-template-columns: 9px 1fr auto; gap: 6px; align-items: center; color: var(--ink-2); }
.tip .tr i { width: 9px; height: 3px; border-radius: 1px; }
.tip .tr b { color: var(--ink); font-weight: 650; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 6px; font-size: 10.5px; color: var(--ink-2); font-stretch: 88%; max-height: 122px; overflow: hidden; flex: none; }
.refmore { font-size: 11px; margin-top: 4px; }
.legend li { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend i { flex: none; width: 12px; height: 2.5px; border-radius: 1px; background: var(--c); }
.legend i.bar { height: 8px; width: 6px; opacity: .6; }
.legend i.chip { width: 7px; margin-right: -3px; }
.legend i.chip:last-of-type { margin-right: 0; }
.legend i.dot { width: 7px; height: 7px; border-radius: 50%; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 3px, transparent 3px 5px); }
.legend i.split { height: 8px; width: 8px; background: linear-gradient(var(--viz-net) 55%, var(--viz-rain) 55%); }

/* ------------------------------------------------------------------ map furniture */
#furniture { position: absolute; left: calc(var(--left-w) + var(--gap) * 2 + 4px); bottom: 36px; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; z-index: 2; color: var(--ink-2); }
#compass svg { display: block; overflow: visible; }
.credits { position: absolute; z-index: 2; left: calc(var(--left-w) + var(--gap) * 2 + 4px); right: calc(var(--right-w) + var(--gap) * 2); bottom: 6px;
  border: 0; background: none; padding: 0; text-align: left; font: 500 9.5px/1.3 var(--f-sans); font-stretch: 88%; color: var(--ink-3);
  text-shadow: 0 0 3px var(--halo); white-space: normal; overflow: hidden; max-height: 2.6em; }
.credits:hover { color: var(--ink-2); text-decoration: underline; }
.credits .short { display: none; }
body.panels-off .credits { left: 16px; right: 16px; bottom: 80px; }
#compass .n { fill: var(--ink); }
#compass .s { stroke: var(--ink-3); stroke-width: 1; }
#compass .nl { font: 650 7px var(--f-sans); fill: var(--ink-2); }
#needle { transform-origin: 16px 16px; }
#scale { display: flex; flex-direction: column; gap: 3px; font-size: 10px; font-stretch: 88%; }
#scaleBar { display: block; height: 5px; border: 1px solid var(--ink-2); border-top: 0; }
#readout { font-size: 10.5px; font-stretch: 88%; color: var(--ink-3); min-width: 220px; padding-bottom: 1px; text-shadow: 0 0 3px var(--halo); }

/* ------------------------------------------------------------------ states */
#tabs { display: none; }
#loading { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--paper); transition: opacity .4s; }
#loading.done { opacity: 0; pointer-events: none; }
.load-box { width: min(300px, 80%); }
.load-title { font-size: 16px; font-weight: 750; font-stretch: 112%; }
#loadMsg { margin-top: 4px; font: 400 14px var(--f-serif); color: var(--ink-2); }
.load-bar { margin-top: 12px; height: 2px; background: var(--rule); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 35%; background: var(--accent); animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.notice { position: absolute; z-index: 21; left: 50%; top: 42%; transform: translate(-50%, -50%); width: min(430px, 86%); padding: 16px 18px; background: var(--sheet); border: 1px solid var(--rule-2); border-left: 2px solid var(--act); border-radius: var(--radius); box-shadow: var(--shadow-2); font: 400 15px/1.45 var(--f-serif); color: var(--ink-2); }
.notice b { display: block; font: 700 14px var(--f-sans); color: var(--ink); margin-bottom: 4px; }
.notice .btn { margin-top: 10px; font-family: var(--f-sans); }
#nogl { z-index: 1; }

body.panels-off #hdr, body.panels-off #controls, body.panels-off #wsPanel, body.panels-off #flowPanel, body.panels-off #about { display: none; }
body.panels-off #left { top: auto; }
body.panels-off #furniture { left: 16px; bottom: 104px; }

@media (max-width: 1120px) and (min-width: 761px) {
  #app { --left-w: 280px; --right-w: 360px; }
}

/* ------------------------------------------------------------------ phone: the 3D view stays, panels become a bottom sheet with tabs */
@media (max-width: 760px) {
  #app { --tabs-h: 44px; --sheet-h: min(42%, 340px); --tr-h: 48px; }
  body.sheet-closed #app { --sheet-h: 0px; }
  #left, #right, #topbar { display: contents; }
  .card { border-radius: 0; border-width: 1px 0 0; box-shadow: none; }
  #hdr { position: absolute; top: 0; left: 0; right: 0; z-index: 4; padding: 8px 96px 7px 12px; border-left: 0; border-top: 0; border-bottom: 1px solid var(--rule); }
  #title { font-size: 15px; }
  .sub { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #factsBox { margin-top: 4px; padding-top: 4px; }
  #factsBox[open] { max-height: 260px; overflow: auto; }
  #themeBtn { position: absolute; top: 7px; right: 8px; z-index: 5; padding: 5px 8px; }
  #panelsBtn { display: none; }
  #transport { position: absolute; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--sheet-h)); height: var(--tr-h); z-index: 4; flex-wrap: nowrap; padding: 6px 10px; }
  #transport .btn { padding: 6px 8px; }
  #viewBtn { order: 3; }
  #controls, #wsPanel, #flowPanel, #about {
    position: absolute; left: 0; right: 0; bottom: var(--tabs-h); height: var(--sheet-h); z-index: 4; display: none; margin: 0;
    background: var(--sheet);
  }
  body[data-tab="storm"] #controls, body[data-tab="map"] #controls, body[data-tab="res"] #controls { display: flex; }
  #ctlTabs { display: none; }
  body[data-tab="storm"] .pane:not([data-pane="storm"]), body[data-tab="map"] .pane:not([data-pane="map"]), body[data-tab="res"] .pane:not([data-pane="res"]) { display: none; }
  #ctlBody .pane:first-child, body[data-tab="res"] .pane[data-pane="res"] { border-top: 0; }
  body[data-tab="ws"] #wsPanel { display: block; overflow: auto; }
  body[data-tab="flow"] #flowPanel { display: flex; }
  body[data-tab="about"] #about { display: flex; flex-direction: column; }
  body.sheet-closed #controls, body.sheet-closed #wsPanel, body.sheet-closed #flowPanel, body.sheet-closed #about { display: none; }
  #about > summary { display: none; }
  #tabs { position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabs-h); z-index: 6; display: flex; background: var(--sheet); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom, 0); }
  #tabs button { flex: 1 1 0; border: 0; background: none; font-size: 11.5px; font-stretch: 92%; font-weight: 600; color: var(--ink-3); border-top: 2px solid transparent; padding: 0 2px; }
  #tabs button[aria-selected="true"] { color: var(--ink); border-top-color: var(--accent); }
  #furniture { left: 10px; bottom: calc(var(--tabs-h) + var(--sheet-h) + var(--tr-h) + 8px); gap: 8px; }
  #compass svg { width: 22px; height: 22px; }
  #readout { display: none; }
  .credits { left: 96px; right: 8px; bottom: calc(var(--tabs-h) + var(--sheet-h) + var(--tr-h) + 8px); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
  .credits .long { display: none; } .credits .short { display: inline; }
  .lbl.grat { display: none; }
  .legend { max-height: 32px; overflow-y: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .load-bar i { animation: none; width: 100%; }
}

/* ================================================================== SuDS design studio: components added to the shared look */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#app { --left-w: 316px; --right-w: 436px; }
h3 { margin: 0; }
.tip.hover { position: fixed; z-index: 30; min-width: 0; max-width: 260px; }
.tip .tr1 { color: var(--ink-3); }
input[type=search] { width: 100%; grid-column: 1 / -1; padding: 6px 8px; border: 1px solid var(--rule-2); border-radius: 4px; background: var(--panel-2); font-size: 12px; }
input[type=search]::placeholder { color: var(--ink-3); }
.row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 6px; }
.btn:disabled { opacity: .45; cursor: default; }
.tg.strong > span:nth-of-type(2) { font-weight: 650; }
.pane > .hint, .field + .hint { margin-bottom: 9px; }
.pane h2.gap { margin-top: 14px; }
.tag.choice { color: var(--accent-ink); }

/* header */
#hdr .facts { grid-template-columns: 1fr auto; margin-top: 8px; border-top: 1px solid var(--rule); padding-top: 7px; }
.chip.verdict { border-color: var(--rule-2); color: var(--ink-3); font-weight: 650; font-size: 10.5px; padding: 1px 8px; }
.chip.verdict[data-state="ok"] { border-color: var(--ok); color: var(--ok); }
.chip.verdict[data-state="fail"] { border-color: var(--act); color: var(--on-accent); background: var(--act); }
.chip.verdict[data-state="wait"] { border-color: var(--inv); color: var(--inv); }

/* four control tabs */
@media (min-width: 761px) {
  body[data-ctl="units"] .pane:not([data-pane="units"]), body[data-ctl="scen"] .pane:not([data-pane="scen"]) { display: none; }
}
#ctlTabs button { font-size: 11.5px; padding: 9px 2px 8px; }

/* segmented control */
.seg { grid-column: 1 / -1; display: flex; border: 1px solid var(--rule-2); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.seg button { flex: 1 1 0; padding: 6px 4px; border: 0; border-left: 1px solid var(--rule-2); background: transparent; font-size: 11.5px; font-weight: 600; font-stretch: 92%; color: var(--ink-2); white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:hover:not([aria-checked="true"]) { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.field > .seg { margin: 3px 0 4px; }
#stormKey .v { font-size: 14px; }

/* transport */
#transport select { width: auto; flex: 0 1 112px; padding: 5px 22px 5px 7px; font-size: 11.5px; }
#transport #scrub { flex: 1 1 100%; margin-top: -2px; }
#transport .clock { min-width: 96px; }

/* feature list */
.kinds { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.kchip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px 2px 5px; border: 1px solid var(--rule-2); border-radius: 99px; background: transparent; font-size: 10.5px; font-stretch: 90%; color: var(--ink-2); }
.kchip i, .unit .sw, .insp-head .sw { flex: none; width: 9px; height: 9px; border-radius: 2px; }
.kchip[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); }
.grp { border-top: 1px solid var(--rule); }
.grp > summary { display: flex; align-items: center; gap: 7px; padding: 6px 2px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 650; }
.grp > summary::-webkit-details-marker { display: none; }
.grp > summary small { margin-left: auto; color: var(--ink-3); font-weight: 500; font-size: 10.5px; }
.grp > summary::after { content: "+"; color: var(--ink-3); font-weight: 400; width: 8px; text-align: center; }
.grp[open] > summary::after { content: "–"; }
.grp ul { margin: 0 0 6px; }
.unit { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; width: 100%; padding: 4px 4px 4px 6px; border: 0; background: transparent; text-align: left; border-radius: 3px; font-size: 12px; }
.unit:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.unit.sel { background: var(--accent-wash); box-shadow: inset 2px 0 0 var(--accent); }
.unit .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us { font-size: 10px; font-stretch: 88%; color: var(--ink-3); white-space: nowrap; }
.us.fail { color: var(--act); font-weight: 650; } .us.off { color: var(--ink-3); } .us.wait { color: var(--inv); } .us.edit { color: var(--accent-ink); } .us.ok { color: var(--ok); }
.us.big { font-size: 11px; padding: 1px 8px; border: 1px solid currentColor; border-radius: 99px; font-weight: 650; }
.sdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sdot.fail { background: var(--act); } .sdot.off { background: var(--mon-ink); } .sdot.wait { background: var(--inv); } .sdot.edit { background: var(--accent); }

/* inspector */
#inspector { padding-bottom: 6px; }
.linkbtn.back::before { content: "‹ "; }
.insp-head { display: flex; gap: 9px; align-items: flex-start; margin: 9px 0 5px; }
.insp-head .sw { width: 11px; height: 11px; margin-top: 4px; }
.insp-title { font-size: 14.5px; line-height: 1.2; font-weight: 700; font-stretch: 104%; letter-spacing: 0; color: var(--ink); }
.insp-kind { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.insp-st { margin: 2px 0 7px; }
#inspector .desc { font: 400 13px/1.42 var(--f-serif); color: var(--ink-2); margin-bottom: 9px; }
#inspector h3 { font-size: 11px; font-weight: 650; font-stretch: 106%; letter-spacing: .04em; color: var(--ink-3); margin: 13px 0 6px; padding-top: 9px; border-top: 1px solid var(--rule); }
.ctl-box { border: 1px solid var(--rule); border-radius: 5px; padding: 7px 9px 4px; background: var(--panel-2); }
.ctl-box .field { margin-bottom: 5px; }
.ctl-box .hint { font-size: 11.5px; }
.mini-chart { position: relative; height: 150px; }
.mini-chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: ew-resize; touch-action: none; }
ul.plain { margin: 0 0 6px; } ul.plain li, p.plain { font-size: 12px; color: var(--ink-2); padding: 1.5px 0; }
.warn { margin-top: 9px; padding: 6px 8px; border-left: 2px solid var(--act); background: color-mix(in srgb, var(--act) 9%, transparent); font-size: 12px; color: var(--ink); }
.tbl.mini { font-size: 11px; } .tbl.mini th, .tbl.mini td { padding: 4px 5px; } .tbl.mini tbody th { min-width: 0; white-space: nowrap; font-weight: 600; }
.tbl td.bad, .tbl td[data-bad] { color: var(--act); font-weight: 650; } .tbl td.ok { color: var(--ok); }
.tbl .txt { min-width: 0; }

/* scorecard */
#scorePanel { flex: 1 1 auto; min-height: 150px; display: flex; flex-direction: column; padding: 10px 0 0; }
.score-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 12px 7px; }
.score-head h2 { font-size: 12.5px; letter-spacing: .01em; color: var(--ink); font-stretch: 100%; }
.score-head h2 span { display: block; font-weight: 500; font-size: 10.5px; color: var(--ink-3); letter-spacing: 0; margin-top: 1px; }
.busy { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 10.5px; color: var(--inv); font-stretch: 90%; white-space: nowrap; }
.busy i { display: block; width: 110px; height: 2px; background: var(--rule); } .busy b { display: block; height: 100%; background: var(--inv); transition: width .12s linear; }
#scoreBody { flex: 1 1 auto; min-height: 0; padding: 0 12px 10px; }
.score-top { display: flex; align-items: baseline; gap: 8px; padding: 6px 9px; border-radius: 4px; margin-bottom: 4px; border: 1px solid var(--rule); border-left-width: 3px; }
.score-top b { font-size: 13px; font-weight: 700; } .score-top span { font-size: 11px; color: var(--ink-3); }
.score-top.pass { border-left-color: var(--ok); } .score-top.pass b { color: var(--ok); }
.score-top.fail { border-left-color: var(--act); background: color-mix(in srgb, var(--act) 8%, transparent); } .score-top.fail b { color: var(--act); }
.stds { list-style: none; margin: 0; padding: 0; }
.stds > li { border-bottom: 1px solid var(--rule); }
.stds summary, .by-basin > summary, .not-assessed > summary { display: flex; align-items: center; gap: 9px; padding: 5.5px 2px; cursor: pointer; list-style: none; }
.stds summary::-webkit-details-marker, .by-basin > summary::-webkit-details-marker, .not-assessed > summary::-webkit-details-marker { display: none; }
.stds .no { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--rule-2); display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.stds .nm { flex: 1 1 auto; min-width: 0; font-size: 12.5px; font-weight: 650; line-height: 1.2; }
.stds .nm small { display: block; font-weight: 500; font-size: 10.5px; color: var(--ink-3); font-stretch: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { flex: none; font-size: 10px; font-weight: 700; font-stretch: 92%; padding: 1px 7px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.st.pass { color: var(--ok); } .st.fail { color: var(--on-accent); background: var(--act); border-color: var(--act); } .st.ev { color: var(--ink-3); font-weight: 600; }
.std-body { padding: 2px 2px 9px 29px; font-size: 12px; color: var(--ink-2); }
.std-body ul, .std-body ol, .not-assessed ul { margin: 0 0 6px; padding-left: 1.1em; list-style: disc; } .std-body ol.hier { list-style: decimal; }
.std-body li, .not-assessed li { margin-bottom: 4px; font: 400 12.5px/1.38 var(--f-serif); } .std-body li b { font: 650 11.5px var(--f-sans); color: var(--ink); }
ul.chks { list-style: none !important; padding: 0 !important; margin: 0 0 6px; }
.chk { display: grid; grid-template-columns: 10px 1fr; gap: 8px; padding: 4px 0; align-items: start; font-family: var(--f-sans) !important; }
.chk > i { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; background: var(--ok); } .chk.fail > i { background: var(--act); border-radius: 1px; }
.chk b { display: block; font: 600 11.5px/1.25 var(--f-sans) !important; color: var(--ink); }
.chk .v { display: block; font-size: 11.5px; font-weight: 650; font-stretch: 92%; color: var(--ok); } .chk.fail .v { color: var(--act); }
.chk small { display: block; font-size: 10.5px; color: var(--ink-3); font-stretch: 90%; line-height: 1.3; }
.chk .fails { display: block; font-size: 11px; color: var(--act); } .chk .fails .linkbtn { font-size: 11px; color: var(--act); }
.by-basin, .not-assessed { border-bottom: 1px solid var(--rule); }
.by-basin > summary, .not-assessed > summary { font-size: 12px; font-weight: 650; justify-content: space-between; }
.by-basin > summary::after, .not-assessed > summary::after, .stds summary::after { content: "+"; color: var(--ink-3); font-weight: 400; width: 8px; text-align: center; flex: none; }
.by-basin[open] > summary::after, .not-assessed[open] > summary::after, .stds details[open] > summary::after { content: "–"; }
.not-assessed > summary { color: var(--inv); } .not-assessed > summary span { margin-left: auto; font-weight: 500; font-size: 10.5px; }
.not-assessed ul { padding: 0 4px 8px 1.3em; color: var(--ink-2); }
.tbl.grid td.dot { text-align: center; padding: 4px 2px; } .tbl.grid th { text-align: center; } .tbl.grid thead th:first-child, .tbl.grid tbody th { text-align: left; }
.tbl.grid td.dot i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); } .tbl.grid td.dot.fail i { background: var(--act); border-radius: 1px; }
.tbl.grid tr.stale { opacity: .5; } .tbl.grid .linkbtn { font-size: 11px; text-decoration: none; color: var(--ink); font-weight: 600; } .tbl.grid .linkbtn:hover { text-decoration: underline; }

/* chart panel */
#flowPanel { flex: 0 0 auto; height: clamp(250px, 39vh, 360px); min-height: 0; }
.flow-head select { width: auto; max-width: 170px; padding: 3px 22px 3px 7px; font-size: 11.5px; }
#flowPanel .readout { margin: -2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend.col { flex-direction: column; gap: 3px; max-height: none; margin: 4px 0 8px; font-size: 11.5px; }
.legend i.chipsq { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
#topbar { gap: 5px; } #topbar .btn { padding: 7px 7px; font-size: 11px; font-stretch: 90%; }
.lbl.mk.far small { display: none; } .lbl.mk.far b { font-size: 11px; font-weight: 600; } .lbl.mk.far .ring { width: 9px; height: 9px; margin-left: -4.5px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); }

/* basin markers in the scene */
.lbl.mk .ring { --c: var(--ok); width: 11px; height: 11px; margin-left: -5.5px; }
.lbl.mk[data-state="fail"] .ring { --c: var(--act); } .lbl.mk[data-state="off"] .ring { --c: var(--mon-ink); }
.lbl.mk[data-state="fail"] small { color: var(--act); font-weight: 650; }
.lbl.road { font-size: 10.5px; color: var(--ink-3); font-stretch: 90%; letter-spacing: .03em; }
.lbl.road.site, .lbl.place.site { color: var(--ink-2); font-weight: 600; }
.lbl.place { font-size: 11px; display: block; } .lbl.place.town { font-size: 14px; } .lbl.place.suburb { color: var(--ink-3); font-style: italic; }
.lbl.river { font-size: 12.5px; } .lbl.river.out { font-size: 11.5px; }
.lbl.block { font-size: 10px; font-weight: 650; font-stretch: 90%; color: var(--ink-2); padding: 0 5px; border-radius: 99px; background: var(--halo); text-shadow: none; }
#illus { align-self: flex-end; font-size: 10.5px; font-weight: 650; font-stretch: 94%; letter-spacing: .03em; color: var(--ink-2); padding: 3px 8px; border: 1px solid var(--rule-2); border-radius: 99px; background: var(--panel); }
#illus span { font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
#furniture { align-items: center; }

/* sheet: inputs and outputs, method */
#sheet { position: absolute; z-index: 8; top: var(--gap); bottom: var(--gap); right: var(--gap); width: min(1040px, calc(100vw - var(--left-w) - var(--gap) * 3)); display: flex; flex-direction: column; background: var(--sheet); box-shadow: var(--shadow-2); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--rule); padding: 0 10px 0 4px; }
#sheetTabs { display: flex; } #sheetTabs button { padding: 11px 12px 9px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 12.5px; font-weight: 650; color: var(--ink-3); }
#sheetTabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.sheet-actions { display: flex; gap: 6px; }
#sheetBody { padding: 6px 20px 24px; }
#sheetBody[data-kind="io"] { font: 500 12px/1.4 var(--f-sans); }
.rep-title { font: 750 20px/1.2 var(--f-sans); font-stretch: 110%; color: var(--ink); margin: 12px 0 2px !important; }
.rep-sub { font: 400 15px var(--f-serif); margin-bottom: 2px !important; } .rep-scn { font: 600 12px var(--f-sans); color: var(--accent-ink); }
.rep-head .note { font: 400 13.5px/1.4 var(--f-serif); margin-top: 6px; }
.rep h3 { margin-top: 22px; font-size: 13px; }
.facts.kv { grid-template-columns: minmax(180px, 290px) 1fr; font-size: 12.5px; gap: 4px 14px; max-width: 880px; }
.facts.kv dd { text-align: left; font-weight: 500; color: var(--ink-2); } .facts.kv dd b { color: var(--ink); font-weight: 700; }
.tbl.wide { font-size: 11px; } .tbl.wide thead th { min-width: 62px; }
.tbl tr.total th, .tbl tr.total td { border-top: 1px solid var(--rule-2); font-weight: 700; color: var(--ink); }
#sheetBody .tbl-note { max-width: 96ch; font: 400 12.5px/1.4 var(--f-serif); color: var(--ink-3); }
#sheetBody .tbl td.txt { max-width: 46ch; }
body.sheet-open #right > #scorePanel, body.sheet-open #right > #flowPanel { visibility: hidden; }
body.sheet-open #topbar { position: relative; z-index: 9; visibility: hidden; }

body.panels-off #scorePanel, body.panels-off #sheet { display: none; }
body.panels-off #topbar .btn:not(#panelsBtn):not(#themeBtn):not(#viewBtn) { display: none; }
body.working #verdict { opacity: .8; }

@media (max-width: 1180px) and (min-width: 761px) { #app { --left-w: 290px; --right-w: 372px; } }
@media (max-height: 760px) and (min-width: 761px) { #hdr .facts { display: none; } #flowPanel { height: 240px; } }

/* phone: bottom sheet with tabs */
@media (max-width: 760px) {
  #app { --sheet-h: min(46%, 380px); }
  #hdr { padding: 8px 12px 34px; } #hdr .facts { display: none; } .chip.verdict { position: absolute; right: 64px; top: 9px; }
  #topbar .btn { position: absolute; z-index: 5; top: 49px; padding: 3px 7px; font-size: 10.5px; } #ioBtn { left: 12px; right: auto; } #methodBtn { left: 128px; right: auto; } #viewBtn { display: none; }
  .credits { left: 160px; }
  #themeBtn { top: 7px !important; right: 8px; }
  #scorePanel { position: absolute; left: 0; right: 0; bottom: var(--tabs-h); height: var(--sheet-h); z-index: 4; display: none; margin: 0; background: var(--sheet); }
  body[data-tab="score"] #scorePanel { display: flex; }
  body[data-tab="units"] #controls, body[data-tab="scen"] #controls { display: flex; }
  body[data-tab="units"] .pane:not([data-pane="units"]), body[data-tab="scen"] .pane:not([data-pane="scen"]) { display: none; }
  #flowPanel { height: var(--sheet-h); }
  body.sheet-closed #scorePanel { display: none; }
  #sheet { inset: 0; width: auto; z-index: 12; border: 0; } .sheet-actions .btn { padding: 5px 7px; font-size: 11px; } #printBtn { display: none; }
  #transport select { display: none; } #transport #scrub { flex: 1 1 60px; order: 5; margin: 0; } #transport { flex-wrap: nowrap; } #restartBtn { display: none; }
  #illus span { display: none; } #scale { display: none; }
  #tabs button { font-size: 10.5px; }
}

/* print: a clean drainage summary */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  :root, :root[data-theme="dark"] { --paper:#fff; --sheet:#fff; --ink:#0C2230; --ink-2:#33495A; --ink-3:#526676; --rule:#D3DDE2; --rule-2:#9FB1BC; --ok:#2A7247; --act:#B5382B; --inv:#8a5f00; --link:#1E5A84; --accent-ink:#00768A; --accent:#00768A; }
  html, body { height: auto; overflow: visible; background: #fff; }
  #app { height: auto; overflow: visible; }
  #stage, #left, #right, #furniture, #credits, #tabs, #loading, #fatal, .sheet-head { display: none !important; }
  #sheet { position: static; display: block !important; width: auto; border: 0; box-shadow: none; background: #fff; backdrop-filter: none; }
  #sheetBody { overflow: visible; padding: 0; max-height: none; }
  .tbl-wrap { overflow: visible; } .tbl { font-size: 8.5pt; width: 100%; } .tbl.wide { font-size: 7pt; } .tbl th, .tbl td { padding: 2.5pt 3pt; white-space: normal; }
  .rep { break-inside: avoid; } .rep h3 { break-after: avoid; } .tbl-note { break-before: avoid; } #rep-inputs, #rep-discharge, #rep-storage { break-inside: auto; }
  .tbl tr { break-inside: avoid; }
}

/* ================================================================== revision 2 ================================== */
/* tokens read by js/theme.js: ground classes added by the detailing stage, earthworks, flow grammar, measuring */
:root {
  --lc-footway:#D2D5D4; --lc-path:#DDCFAE; --lc-field:#CFDDBE;
  --scene-wet-floor:#5E8FA0; --scene-track:#CDBE9C; --scene-stone:#A9A294; --scene-pipe:#3B5568; --scene-ditch:#3F7FB0; --scene-hedge:#5C8A58;
  --flow-in:#1F6FAE; --flow-out:#00897B; --flow-spill:#D4491F; --flow-nat:#3F7FB0; --flow-particle:#0B3A7A; --measure:#B4570F;
  --viz-existing:#6B8F3A; --viz-nosuds:#8C5A9E;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --lc-footway:#35444F; --lc-path:#4A4636; --lc-field:#16302A;
  --scene-wet-floor:#17566B; --scene-track:#5B5644; --scene-stone:#6C6A5F; --scene-pipe:#9DB7C8; --scene-ditch:#4FAEEA; --scene-hedge:#2F6E57;
  --flow-in:#45D3EA; --flow-out:#6FE3B4; --flow-spill:#FF6A3D; --flow-nat:#6FB0F4; --flow-particle:#C9F8FF; --measure:#FFB547;
  --viz-existing:#A4D05E; --viz-nosuds:#C99BE0;
  }
}
:root[data-theme="dark"] {
  --lc-footway:#35444F; --lc-path:#4A4636; --lc-field:#16302A;
  --scene-wet-floor:#17566B; --scene-track:#5B5644; --scene-stone:#6C6A5F; --scene-pipe:#9DB7C8; --scene-ditch:#4FAEEA; --scene-hedge:#2F6E57;
  --flow-in:#45D3EA; --flow-out:#6FE3B4; --flow-spill:#FF6A3D; --flow-nat:#6FB0F4; --flow-particle:#C9F8FF; --measure:#FFB547;
  --viz-existing:#A4D05E; --viz-nosuds:#C99BE0;
}

/* labels: the element is a zero-size anchor moved by one transform; the visible box hangs off it here, so text never moves the anchor */
.lbl { width: 0; height: 0; }
.lbl > .lb { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap; }
.lbl.block { padding: 0; background: none; border-radius: 0; }
.lbl.block > .lb { padding: 0 5px; border-radius: 99px; background: var(--halo); }
.lbl.mk { display: block; pointer-events: none; }
.lbl.mk > .lb { transform: none; width: 0; height: 0; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; text-shadow: inherit; pointer-events: auto; cursor: pointer; overflow: visible; }
.lbl.mk .ring, .lbl.mk.flip .ring { position: absolute; left: -5.5px; top: -5.5px; margin: 0; box-sizing: border-box; }
.lbl.mk.far .ring { left: -4.5px; top: -4.5px; margin: 0; }
.lbl.mk .t { position: absolute; left: 13px; top: 0; transform: translateY(-50%); white-space: nowrap; }
.lbl.mk.flip .t { left: auto; right: 13px; align-items: flex-end; text-align: right; }

/* flow markers: a dot on the anchor and a chip beside it */
.lbl.fm { --c: var(--flow-out); }
.lbl.fm > .lb { transform: none; width: 0; height: 0; }
.lbl.fm .dot { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--halo); }
.lbl.fm .t { position: absolute; left: 9px; top: 0; transform: translateY(-50%); white-space: nowrap; font-size: 10.5px; font-weight: 650; font-stretch: 92%; font-variant-numeric: tabular-nums; color: var(--ink); text-shadow: none;
  padding: 1px 6px 1px 5px; border-radius: 99px; background: var(--halo); border: 1px solid color-mix(in srgb, var(--c) 65%, transparent); }
.lbl.fm.flip .t { left: auto; right: 9px; }
.lbl.fm.in { --c: var(--flow-in); } .lbl.fm.spill { --c: var(--flow-spill); } .lbl.fm.to .t { font-weight: 500; font-style: italic; }
.lbl.fm[data-c="spill"] { --c: var(--flow-spill); } .lbl.fm[data-c="nat"] { --c: var(--flow-nat); } .lbl.fm[data-c="out"] { --c: var(--flow-out); }
.lbl.fm.exit .t { font-size: 11px; border-width: 1.5px; }

/* land state switch and compare line */
#stateBar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; padding: 5px; z-index: 3; }
#stateBar .seg { margin: 0; } #stateBar .seg button { padding: 6px 10px; font-size: 11.5px; white-space: nowrap; }
#stateBar.cmp .seg { display: none; }
#splitLine { position: absolute; top: 0; bottom: 0; width: 22px; margin-left: -11px; cursor: ew-resize; touch-action: none; z-index: 2; outline: none; }
#splitLine::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--ink); box-shadow: 0 0 0 1px var(--halo); }
#splitLine i { position: absolute; left: 0; top: 50%; width: 22px; height: 44px; margin-top: -22px; border-radius: 11px; background: var(--ink); box-shadow: 0 0 0 1.5px var(--halo); }
#splitLine i::after { content: "◂▸"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--paper, #fff); font-size: 9px; letter-spacing: -1px; }
#splitLine:focus-visible i { outline: 2px solid var(--accent); outline-offset: 2px; }
.cmp-sel { position: absolute; top: 58px; z-index: 3; width: 176px; max-width: 42%; font-size: 11.5px; padding: 5px 22px 5px 8px; }
#cmpL { transform: translateX(calc(-100% - 16px)); } #cmpR { transform: translateX(16px); }
@media (max-width: 760px) { #stateBar { top: 84px; } .cmp-sel { top: 130px; } #stateBar .seg button { padding: 6px 7px; font-size: 11px; } }

/* water balance bar */
.bal { margin: 6px 0 10px; }
.bal-now { margin: 0 0 4px; font-variant-numeric: tabular-nums; font-size: 12px; }
.bal-bar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--ink-3) 22%, transparent); }
.bal-bar i { display: block; height: 100%; } .bal i.o { background: var(--flow-out); } .bal i.s { background: var(--viz-store); } .bal i.x { background: var(--flow-spill); }
.bal-k { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 2px 6px; margin: 5px 0 0; font-size: 11px; font-variant-numeric: tabular-nums; }
.bal-k dt { color: var(--ink-2); white-space: nowrap; } .bal-k dd { margin: 0; text-align: right; font-weight: 650; } .bal-k dt i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.legend i.arrow { width: 16px; height: 6px; border-radius: 0; background: var(--c); clip-path: polygon(0 20%, 62% 20%, 62% 0, 100% 50%, 62% 100%, 62% 80%, 0 80%); }
#flowPanel .readout { white-space: normal; overflow: visible; }
.lbl.mk small.f { display: none; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.lbl.mk.sum small.f { display: block; } .lbl.mk.far.sum small.f { display: block; }

/* measuring tools */
#toolBar { position: absolute; top: 62px; left: 8px; z-index: 3; display: flex; flex-direction: column; gap: 3px; padding: 4px; width: 92px; }
#toolBar .tool { display: flex; align-items: center; gap: 6px; padding: 5px 6px; font-size: 11px; text-align: left; border: 0; background: none; }
#toolBar .tool b { flex: none; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 4px; border: 1px solid var(--rule-2); font-size: 9.5px; font-weight: 650; color: var(--ink-2); }
#toolBar .tool[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); } #toolBar .tool[aria-pressed="true"] b { border-color: var(--accent); color: var(--accent); }
#toolBar .hint { margin: 2px 4px 2px; font-size: 10px; line-height: 1.25; min-height: 0; } #toolBar .hint:empty { display: none; }
.lbl.ms > .lb { padding: 1px 6px; border-radius: 4px; background: var(--measure); color: #fff; font-size: 10.5px; font-weight: 650; font-variant-numeric: tabular-nums; text-shadow: none; box-shadow: 0 0 0 1.5px var(--halo); }
:root[data-theme="dark"] .lbl.ms > .lb { color: #0B1924; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lbl.ms > .lb { color: #0B1924; } }
.lbl.ms.lv > .lb { background: var(--halo); color: var(--ink); border: 1px solid var(--measure); box-shadow: none; font-weight: 550; }
.lbl.ms.tot > .lb { font-size: 11.5px; }

/* section panel */
#sectionPanel { position: absolute; bottom: 40px; z-index: 3; display: flex; flex-direction: column; padding: 8px 10px 8px; overflow: hidden; }
#sectionPanel[hidden] { display: none; }
.sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; } .sec-head h2 { margin: 0; font-size: 13px; } .sec-head .hint { margin: 0; flex: 1; } .sec-head .btn { padding: 3px 8px; font-size: 11px; }
.sec-body { flex: 1; min-height: 0; display: flex; gap: 10px; } .sec-main { flex: 1; min-width: 0; position: relative; } .sec-main canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sec-side { flex: none; width: 216px; display: flex; flex-direction: column; gap: 4px; } #secCurve { width: 100%; height: 74px; flex: none; }
#sectionPanel[data-kind="swale"] #secCurve, #sectionPanel[data-kind="layers"] #secCurve, #sectionPanel[data-kind="line"] #secCurve, #sectionPanel[data-kind="none"] #secCurve { display: none; }
#secNums { margin: 0; font-size: 11px; grid-template-columns: auto 1fr; gap: 1px 8px; } #secNums dd { text-align: right; font-variant-numeric: tabular-nums; }
#secBal .bal { margin: 4px 0 0; } #secBal .bal-now { font-size: 11px; margin-bottom: 3px; } #secBal .bal-k { font-size: 10.5px; }
#secExtra details { margin-top: 2px; } #secExtra summary { font-size: 11px; cursor: pointer; } #secExtra .tbl-wrap { position: absolute; left: 10px; right: 10px; bottom: 40px; max-height: 150px; overflow: auto; background: var(--panel-2); border: 1px solid var(--rule-2); border-radius: 6px; padding: 4px; }
body.section-open #furniture, body.section-open #credits { visibility: hidden; }
@media (max-width: 760px) {
  #toolBar { top: 128px; left: 6px; width: auto; flex-direction: row; flex-wrap: wrap; max-width: calc(100% - 12px); } #toolBar .tool span { display: none; } #toolBar .hint { display: none; }
  #sectionPanel { position: fixed; left: 0; right: 0; bottom: 48px; width: auto; height: 44vh; z-index: 6; } .sec-side { width: 128px; } .sec-body { gap: 6px; }
}
:root[data-theme="dark"] .lbl.ms.lv > .lb { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lbl.ms.lv > .lb { color: var(--ink); } }

/* walk mode */
#toolBar .tool.walk { margin-top: 4px; border-top: 1px solid var(--rule); border-radius: 0 0 6px 6px; padding-top: 7px; }
#reticle { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; z-index: 2; pointer-events: none; border-radius: 50%; border: 1.5px solid var(--halo); box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 1px var(--halo); }
#reticle::after { content: ""; position: absolute; left: 9px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--measure); }
#walkHud { position: absolute; top: 10px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#walkHud[hidden], #walkMap[hidden], #walkPad[hidden], #walkHelp[hidden], #reticle[hidden], #stateBar[hidden] { display: none; }
#walkHud .chip { font-size: 10.5px; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--rule-2); color: var(--ink-2); } #walkHud .btn { padding: 4px 10px; font-size: 11.5px; }
#walkMap { position: absolute; bottom: 44px; width: 190px; height: 132px; z-index: 3; padding: 0; cursor: crosshair; }
#walkHelp { position: absolute; bottom: 44px; transform: translateX(-50%); z-index: 3; margin: 0; padding: 5px 10px; font-size: 11px; max-width: 46%; text-align: center; }
#walkPad { position: absolute; bottom: 70px; width: 104px; height: 104px; z-index: 4; border-radius: 50%; background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid var(--rule-2); touch-action: none; }
#walkPad i { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px; border-radius: 50%; background: var(--accent); opacity: .85; transform: translate(var(--px, 0%), var(--py, 0%)); }
body.walking #furniture #scale, body.walking #illus { visibility: hidden; }
@media (max-width: 760px) { #walkHud { top: 84px; font-size: 11px; gap: 6px; max-width: calc(100% - 12px); } #walkHud .chip { display: none; } #walkMap { width: 120px; height: 86px; bottom: 100px; left: 6px !important; } #walkHelp { display: none; } #walkPad { bottom: 104px; right: 12px !important; } }

/* ------------------------------------------------------------------ rain: the sky darkens with the rainfall rate (--rain 0..1, set by js/rain.js) */
#stage::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(var(--rain-sky-a), var(--rain-sky-b)); opacity: calc(var(--rain, 0) * .62); transition: opacity .6s linear; }
:root { --rain-sky-a: #6E7F8C; --rain-sky-b: #A9B6BF; }
:root[data-theme="dark"] { --rain-sky-a: #01060B; --rain-sky-b: #050D15; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rain-sky-a: #01060B; --rain-sky-b: #050D15; } }

/* ================================================================== revision 2, design pass (brief item 14)
   One visual language: the owner's type (Archivo, Newsreader) and tokens; ONE colour for action (--accent) and ONE hue for water
   (--flow-in / --flow-out, two tones of the same blue, used alike by the map arrows, the IN / OUT markers, the chart and the
   balance bar); figures in tabular numerals; panels as quiet sheets (no outlines, hairlines only where they separate content). */
:root { --flow-in:#2F7CC0; --flow-out:#143F6B; --flow-nat:#5B8FBF; --flow-particle:#0B3A7A; --viz-inflow:var(--flow-in); --viz-outflow:var(--flow-out); --viz-store:#7FB2DC;
  --sky-top:#D9E5EB; --sky-mid:#EDF2F4; --card-line:rgba(12,34,48,.07); }
:root[data-theme="dark"] { --flow-in:#45D3EA; --flow-out:#C4F3FB; --flow-nat:#58A9C9; --flow-particle:#C9F8FF; --viz-store:#2A93AE; --sky-top:#03080D; --sky-mid:#0A1A26; --card-line:rgba(190,220,240,.09); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --flow-in:#45D3EA; --flow-out:#C4F3FB; --flow-nat:#58A9C9; --flow-particle:#C9F8FF; --viz-store:#2A93AE; --sky-top:#03080D; --sky-mid:#0A1A26; --card-line:rgba(190,220,240,.09); } }
body { font-variant-numeric: tabular-nums lining-nums; }
/* a calm sky: deeper overhead, the colour of the haze at the horizon (the same colour the ground fades to) */
#stage { background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-mid) 34%, var(--scene-fog) 58%, var(--stage-c) 100%); }
/* sheets without outlines */
.card { border: 0; box-shadow: 0 0 0 1px var(--card-line), var(--shadow-1); }
#topbar { gap: 2px; } #topbar .btn { border-color: transparent; box-shadow: 0 0 0 1px var(--card-line); font-weight: 550; }
#topbar .btn:hover { border-color: transparent; background: var(--sheet); }
.btn { border-color: var(--rule); } .seg { border-color: var(--rule); } .seg button { border-left-color: var(--rule); }
.keyfig { border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; gap: 2px 14px; padding-top: 5px; }
.keyfig > div { background: none; padding: 5px 0 4px; }
.keyfig .d { color: var(--ink-3); }
.score-top { border: 0; border-left: 3px solid var(--rule-2); border-radius: 0; padding-left: 10px; }
.stds .no { border: 0; background: color-mix(in srgb, var(--ink) 7%, transparent); }
.st.ev { border: 0; padding: 1px 0; font-weight: 500; font-style: italic; }
#toolBar .tool b { border-color: var(--rule); }

/* phone: the section panel reads top to bottom (title, note, drawing, figures), and the compare selectors sit under the tool row */
@media (max-width: 760px) {
  .sec-head { flex-wrap: wrap; gap: 2px 8px; } .sec-head h2 { flex: 1 1 60%; order: 1; } .sec-head .btn { order: 2; } .sec-head .hint { order: 3; flex: 1 1 100%; font-size: 10.5px; }
  .sec-body { flex-direction: column; gap: 4px; } .sec-main { flex: 1 1 auto; min-height: 120px; } .sec-side { width: auto; flex-direction: row; gap: 8px; align-items: flex-start; } .sec-side #secCurve { width: 120px; height: 62px; }
  .sec-side .facts { flex: 1; font-size: 10.5px; gap: 1px 8px; }
  #sectionPanel { height: 52vh; overflow-y: auto; }
  .cmp-sel { top: 172px; width: 44%; max-width: 44%; }
}

/* ================================================================== the map is the hero (lead's direction, 23 Nov)
   Desktop: the controls, the scorecard and the chart are drawers, closed at first. Closed, the left column is the headline
   figures, a row of tabs and the player; the right column is one verdict line and the storm read-out. */
.tgl { flex: none; padding: 3px 9px; border: 0; border-radius: 99px; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2); font-size: 10.5px; font-weight: 650; font-stretch: 92%; white-space: nowrap; }
.tgl:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--ink); }
@media (max-width: 760px) { .tgl { display: none; } }
@media (min-width: 761px) {
  #app { --left-w: 296px; --right-w: 408px; }
  #controls { position: relative; } #ctlTabs { padding-right: 58px; } #ctlTgl { position: absolute; top: 7px; right: 8px; z-index: 1; }
  body.ctl-min #ctlBody { display: none; } body.ctl-min #controls { flex: none; } body.ctl-min #transport { margin-top: auto; }
  body.ctl-min #ctlTabs button[aria-selected="true"] { border-bottom-color: transparent; color: var(--ink-2); }
  .score-head { align-items: center; } .flow-head { gap: 8px; flex-wrap: nowrap; align-items: center; } .flow-head h2 { flex: 1 1 auto; min-width: 0; } .flow-head select { flex: 0 1 132px; min-width: 0; }
  body.score-min #scorePanel { flex: none; min-height: 0; } body.score-min #scoreBody { overflow: visible; padding-bottom: 9px; }
  body.score-min #scoreBody > :not(.score-top) { display: none; } body.score-min .score-top { margin-bottom: 0; }
  body.score-min #flowPanel { margin-top: auto; }
  body.chart-min #flowPanel { flex: none; height: auto; min-height: 0; } body.chart-min #flowPanel > :not(.flow-head):not(#flowNow) { display: none; }
  body.chart-min #flowPanel .readout { white-space: normal; margin-bottom: 0; }
  /* on foot nothing but the read-out, the tools, the plan and the player */
  body.walking #hdr, body.walking #controls, body.walking #right, body.walking #furniture, body.walking .credits { display: none; }
  body.walking #transport { margin-top: auto; }
}
/* overcast daylight for walking, in either theme */
#stage.daylight { background: linear-gradient(to bottom, #B4C1CA 0%, #D5DEE4 38%, #EDF2F4 58%, #DCE5E9 100%); }
#stage.daylight::before { background: linear-gradient(#6E7F8C, #A9B6BF); }

/* one hue for each family of feature, the same in the map, the legend, the list chips and the section panel:
   paving sand, plot rain gardens heather, street rain gardens teal, swales grass green, basins blue, green roofs olive */
:root { --k-permeable:#C9A25E; --k-raingarden:#9A6FB8; --k-bioretention:#1E8C7E; --k-swale:#6FB060; --k-basin:#2B6FA0; --k-greenroof:#B4AE3C; }
:root[data-theme="dark"] { --k-permeable:#C8A566; --k-raingarden:#B692E6; --k-bioretention:#22B5A0; --k-swale:#7CCB6E; --k-basin:#6FB0F4; --k-greenroof:#D2CC58; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --k-permeable:#C8A566; --k-raingarden:#B692E6; --k-bioretention:#22B5A0; --k-swale:#7CCB6E; --k-basin:#6FB0F4; --k-greenroof:#D2CC58; } }

/* ================================================================== dark is the reference design (owner, 23 Nov)
   The dark map gets the legibility the light one has: paving, planting, buildings and water in separable, calm tones; stronger
   relief and contours; one hue per SuDS feature family. The brightest things on it stay the flow ribbons, the IN / OUT markers,
   measurement lines and the compare handle. */
:root[data-theme="dark"] { --lc-outside:#101F29; --lc-open:#1C3C2D; --lc-corridor:#1F4D37; --lc-pocket:#1E4533; --lc-garden:#27463A; --lc-local:#3C4A56; --lc-cross:#404F5C; --lc-main:#4C5C6A;
  --lc-drive:#6E6147; --lc-school:#363F45; --lc-centre:#3B4148; --lc-park:#20553B; --lc-basin:#214D42; --lc-swale:#255C46; --lc-verge:#214C3B; --lc-footway:#505B65; --lc-path:#6C6249; --lc-field:#1F402F;
  --b-wall:#8E8F89; --b-wall-2:#7C7D79; --b-roof-1:#9C5E4E; --b-roof-2:#786557; --b-roof-3:#5C7186; --b-civic:#9A958A;
  --scene-water:#3F9FD2; --scene-water-deep:#155C93; --scene-tree:#3F8A62; --scene-tree-2:#2F7353; --scene-basin-slope:#2F6A52; --scene-basin-base:#25584E;
  --scene-shade-lo:.5; --scene-shade-hi:1.55; --scene-site-shade:1; --scene-contour:#A9C0CE; --scene-contour-alpha:.6; --scene-shadow-alpha:.75;
  --k-permeable:#D9A85A; --k-raingarden:#C59BEF; --k-bioretention:#2EC4B0; --k-swale:#8FD468; --k-basin:#5FA8F0; --k-greenroof:#E0D85C;
  --dusk-top:#16212C; --dusk-mid:#2B3C4C; --dusk-horizon:#5E7284; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --lc-outside:#101F29; --lc-open:#1C3C2D; --lc-corridor:#1F4D37; --lc-pocket:#1E4533; --lc-garden:#27463A; --lc-local:#3C4A56; --lc-cross:#404F5C; --lc-main:#4C5C6A;
  --lc-drive:#6E6147; --lc-school:#363F45; --lc-centre:#3B4148; --lc-park:#20553B; --lc-basin:#214D42; --lc-swale:#255C46; --lc-verge:#214C3B; --lc-footway:#505B65; --lc-path:#6C6249; --lc-field:#1F402F;
  --b-wall:#8E8F89; --b-wall-2:#7C7D79; --b-roof-1:#9C5E4E; --b-roof-2:#786557; --b-roof-3:#5C7186; --b-civic:#9A958A;
  --scene-water:#3F9FD2; --scene-water-deep:#155C93; --scene-tree:#3F8A62; --scene-tree-2:#2F7353; --scene-basin-slope:#2F6A52; --scene-basin-base:#25584E;
  --scene-shade-lo:.5; --scene-shade-hi:1.55; --scene-site-shade:1; --scene-contour:#A9C0CE; --scene-contour-alpha:.6; --scene-shadow-alpha:.75;
  --k-permeable:#D9A85A; --k-raingarden:#C59BEF; --k-bioretention:#2EC4B0; --k-swale:#8FD468; --k-basin:#5FA8F0; --k-greenroof:#E0D85C;
  --dusk-top:#16212C; --dusk-mid:#2B3C4C; --dusk-horizon:#5E7284; } }
/* walking at dusk in the dark theme: a storm sky that pales to the horizon (the light theme keeps the overcast day) */
#stage.dusk { background: linear-gradient(to bottom, var(--dusk-top) 0%, var(--dusk-mid) 36%, var(--dusk-horizon) 57%, #3A4A58 100%); }
#stage.dusk::before { background: linear-gradient(#0F1923, #2C3B4A); opacity: calc(var(--rain, 0) * .45); }

/* walk mode keeps the land-state switch, below the walk read-out; basin view chooser */
body.walking #stateBar { top: 52px; }
#basinSel { font-size: 11.5px; padding: 6px 8px; max-width: 150px; }
#basinSel[hidden], #cmpBtn[hidden] { display: none; }
@media (max-width: 760px) { body.walking #stateBar { top: 96px; } #basinSel { max-width: 110px; } }
#stateBar .seg, #stateBar #cmpBtn { flex: none; } #stateBar #basinSel { flex: none; width: 118px; }
@media (max-width: 760px) { #stateBar #basinSel { display: none; } }   /* phones: tap a basin, or pick it in the features list */

/* ================================================================== visual pass: basin fill gauge and rising pulse (docs/VISUAL_NOTES.md) */
.lbl.mk .gauge { position: absolute; left: -15px; top: -15px; width: 5px; height: 30px; border-radius: 2px; background: color-mix(in srgb, var(--panel, #0d1d28) 70%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 35%, transparent); overflow: visible; pointer-events: none; }
.lbl.mk .gauge .gf { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 2px 2px; background: linear-gradient(to top, var(--scene-water-deep, #155C93), var(--flow-in)); transition: height .4s linear; }
.lbl.mk .gauge .gt { position: absolute; left: -3px; right: -3px; height: 1.5px; margin-bottom: -.75px; background: var(--ink); }
.lbl.mk.flip .gauge { left: 10px; }
.lbl.mk.far .gauge, .lbl.mk.compact .gauge { display: none !important; }
.lbl.mk.rising .ring { animation: ring-rise 1.6s ease-out infinite; }
@keyframes ring-rise { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--flow-in) 70%, transparent); } 100% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--flow-in) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .lbl.mk.rising .ring { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--flow-in) 45%, transparent); } }
/* visual pass: one colour family for runoff arriving (overland streaks, ditches, IN), the paler one for controlled discharge (OUT),
   the warning colour for spill; quieter basin track (gravel, not a brown frame) */
:root[data-theme="dark"] { --flow-nat:#45C6E0; --scene-track:#4A5549; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --flow-nat:#45C6E0; --scene-track:#4A5549; } }
:root[data-theme="light"] { --flow-nat:#2F7CC0; --scene-track:#C9C3A6; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --flow-nat:#2F7CC0; --scene-track:#C9C3A6; } }

/* ================================================================== visual pass, UI: frosted glass, icons, grouped tools, Play first
   Icons are CSS masks (currentColor), so buttons whose text the script rewrites keep them. No new words here: see copy.js UI_TXT. */
:root { --ic-select: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 2.5l9 5-4 1.2-1.6 4.3z' fill='black'/%3E%3C/svg%3E"); --ic-walk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8.5' cy='2.8' r='1.4' fill='black' stroke='none'/%3E%3Cpath d='M8 5.5l-1 4 2.5 2 .5 3M7 9.5l-2 4.5M8 5.5l3 2.5M8 5.5L5 7.5'/%3E%3C/svg%3E"); --ic-dims: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4v8M14 4v8M2 8h12M4.5 6L2 8l2.5 2M11.5 6L14 8l-2.5 2'/%3E%3C/svg%3E"); --ic-ruler: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.8 10.6l8.8-8.8 3.6 3.6-8.8 8.8z'/%3E%3Cpath d='M5 7.4l1.5 1.5M7 5.4l1 1M9 3.4l1.5 1.5'/%3E%3C/svg%3E"); --ic-level: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3Cpath d='M8 1.5v3M8 11.5v3M1.5 8h3M11.5 8h3'/%3E%3C/svg%3E"); --ic-section: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 13.5h13'/%3E%3Cpath d='M1.5 9l3-3 3 2.5 3-4 4 3' /%3E%3Cpath d='M5.5 13.5v-2.5h5v2.5' /%3E%3C/svg%3E"); --ic-figure: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='2.8' r='1.5' fill='black' stroke='none'/%3E%3Cpath d='M8 5v5M5 7h6M8 10l-2.2 4.5M8 10l2.2 4.5'/%3E%3C/svg%3E"); --ic-clear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 3.5h8v9h-8L1.5 8z'/%3E%3Cpath d='M7.5 6l3 4M10.5 6l-3 4'/%3E%3C/svg%3E"); --ic-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 2.8l9 5.2-9 5.2z' fill='black'/%3E%3C/svg%3E"); --ic-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 3v10M11 3v10' stroke-width='2.6'/%3E%3C/svg%3E"); --ic-restart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8a5 5 0 1 0 1.6-3.7'/%3E%3Cpath d='M3 1.8v3h3' /%3E%3C/svg%3E"); --ic-io: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5h9M8 2l3 3-3 3M14 11H5M8 8l-3 3 3 3'/%3E%3C/svg%3E"); --ic-method: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 3.5c2-1 4-1 5.5.5 1.5-1.5 3.5-1.5 5.5-.5v9c-2-1-4-1-5.5.5-1.5-1.5-3.5-1.5-5.5-.5zM8 4v9'/%3E%3C/svg%3E"); --ic-view: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 6V2h4M10 2h4v4M14 10v4h-4M6 14H2v-4'/%3E%3Ccircle cx='8' cy='8' r='1.6'/%3E%3C/svg%3E"); --ic-panels: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1.8' y='2.5' width='12.4' height='11' rx='1.5'/%3E%3Cpath d='M6 2.5v11'/%3E%3C/svg%3E"); --ic-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='2.8'/%3E%3Cpath d='M8 1.2v1.6M8 13.2v1.6M1.2 8h1.6M13.2 8h1.6M3.2 3.2l1.1 1.1M11.7 11.7l1.1 1.1M3.2 12.8l1.1-1.1M11.7 4.3l1.1-1.1'/%3E%3C/svg%3E"); --ic-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.8 10.2A5.5 5.5 0 0 1 5.8 3.2a5.5 5.5 0 1 0 7 7z'/%3E%3C/svg%3E"); --ic-basin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 4.5l3 7h7l3-7'/%3E%3Cpath d='M4 8.5h8' stroke-dasharray='1.6 1.4'/%3E%3C/svg%3E"); --ic-compare: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1.8' y='2.5' width='12.4' height='11' rx='1.5'/%3E%3Cpath d='M8 1v14'/%3E%3C/svg%3E"); }
/* frosted glass: translucent surface, stronger blur, hairline border. Alpha .84 and a slightly stronger --ink-3 inside cards keep WCAG AA on the worst
   backdrop: dark panel over pure white: --ink 8.6:1, --ink-3 5.0:1; light panel over pure black: --ink-3 5.0:1 (computed, work/visual). Solid fallback where backdrop-filter is unsupported. */
:root { --glass: rgba(255,255,255,.84); --glass-2: rgba(250,252,253,.88); --glass-line: rgba(12,34,48,.12); --glass-hi: rgba(255,255,255,.7); }
:root[data-theme="dark"] { --glass: rgba(11,25,35,.84); --glass-2: rgba(9,21,30,.88); --glass-line: rgba(190,225,245,.13); --glass-hi: rgba(190,225,245,.07); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glass: rgba(11,25,35,.84); --glass-2: rgba(9,21,30,.88); --glass-line: rgba(190,225,245,.13); --glass-hi: rgba(190,225,245,.07); } }
.card, #topbar .btn { background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(1.35); backdrop-filter: blur(16px) saturate(1.35);
  box-shadow: 0 0 0 1px var(--glass-line), inset 0 1px 0 var(--glass-hi), var(--shadow-1); border-color: transparent; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .card, #topbar .btn { background: var(--panel); } }
.lbl.fm > .lb .t, .lbl.block > .lb { background: color-mix(in srgb, var(--glass) 92%, transparent); }
/* consistent hover and focus on every button */
.btn { transition: background-color .12s, border-color .12s, color .12s; }
.btn:focus-visible, .seg button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* icons */
.btn.ic::before, #toolBar .tool i.ic, #playBtn::before, #restartBtn::before, #topbar .btn::before, #cmpBtn::before { content: ''; display: inline-block; flex: none; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; vertical-align: -2px; margin-right: 6px; }
#toolBar .tool i.ic { margin: 0; opacity: .9; }
#playBtn { --ic: var(--ic-play); } #playBtn[aria-pressed="true"] { --ic: var(--ic-pause); } #restartBtn { --ic: var(--ic-restart); }
#ioBtn { --ic: var(--ic-io); } #methodBtn { --ic: var(--ic-method); } #viewBtn { --ic: var(--ic-view); } #panelsBtn { --ic: var(--ic-panels); } #cmpBtn { --ic: var(--ic-compare); }
#themeBtn { --ic: var(--ic-sun); } :root[data-theme="light"] #themeBtn { --ic: var(--ic-moon); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) #themeBtn { --ic: var(--ic-moon); } }
#topbar .btn { display: inline-flex; align-items: center; }
/* Play is the primary action; the storm clock is the most readable thing in the transport bar */
#playBtn { display: inline-flex; align-items: center; justify-content: center; min-width: 84px; padding: 8px 14px; font-size: 13px; border-radius: 6px; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
#restartBtn { display: inline-flex; align-items: center; }
#clock { font-size: 19px; font-weight: 700; font-stretch: 92%; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.1; }
#phase { font-size: 11px; }
/* Basin view: a first-class button with an icon (a select, so the icon is a background) */
#stateBar #basinSel { padding-left: 28px; width: 128px; background-image: var(--ic-basin-img), linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); }
#stateBar #basinSel { font-weight: 650; }
/* tool bar: grouped (look | measure | clear), icon + label, key shown small; the tooltip carries the key */
#toolBar { width: 118px; gap: 1px; }
#toolBar .grp { margin: 5px 6px 1px; font-size: 9.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
#toolBar .grp:first-child { margin-top: 2px; }
#toolBar .tool { gap: 7px; border-radius: 5px; }
#toolBar .tool:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
#toolBar .tool span { flex: 1; }
#toolBar .tool kbd { font: 600 9px/1 var(--f-sans, inherit); color: var(--ink-3); border: 1px solid var(--rule-2); border-radius: 3px; padding: 2px 3px; }
#toolBar .tool[aria-pressed="true"] i.ic { color: var(--accent); opacity: 1; }
#toolBar .tool.walk { margin-top: 0; border-top: 0; padding-top: 5px; border-radius: 5px; }
#toolBar .sep { height: 1px; margin: 3px 4px; background: var(--rule); }
@media (max-width: 760px) { #toolBar { width: auto; } #toolBar .grp, #toolBar .sep, #toolBar .tool kbd { display: none; } #toolBar .tool { padding: 7px; } }
/* first-load hint: fades after the first interaction */
#firstHint { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 4; max-width: min(520px, calc(100% - 24px)); padding: 8px 14px; border-radius: 99px; font-size: 12.5px; line-height: 1.35; text-align: center; color: var(--ink); transition: opacity .6s; pointer-events: none; }
#firstHint.gone { opacity: 0; }
@media (max-width: 760px) { #firstHint { bottom: auto; top: 172px; border-radius: 10px; } }
:root { --ic-basin-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%231E5A84' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 4.5l3 7h7l3-7'/%3E%3Cpath d='M4 8.5h8' stroke-dasharray='1.6 1.4'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] { --ic-basin-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239CCBE6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 4.5l3 7h7l3-7'/%3E%3Cpath d='M4 8.5h8' stroke-dasharray='1.6 1.4'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ic-basin-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%239CCBE6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 4.5l3 7h7l3-7'/%3E%3Cpath d='M4 8.5h8' stroke-dasharray='1.6 1.4'/%3E%3C/svg%3E"); } }
#stateBar #basinSel { background-repeat: no-repeat; background-position: 9px center, calc(100% - 14px) 55%, calc(100% - 9px) 55%; background-size: 14px 14px, 5px 5px, 5px 5px; }
body.section-open #firstHint, body.walking #firstHint { display: none; }
/* narrower screens: the top-bar buttons become icon-only (their names stay for screen readers and in the tooltip) so they never cover the state bar */
@media (max-width: 1420px) { #topbar .btn { font-size: 0; padding: 8px 9px; gap: 0; } #topbar .btn::before { margin-right: 0; width: 15px; height: 15px; } }

.card { --ink-3: #45596A; } :root[data-theme="dark"] .card { --ink-3: #9DB3BF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card { --ink-3: #9DB3BF; } }
