/* LuND — London Urban Noise Distribution
   White everywhere, black hairlines, cross cursor. Type: Rauschen B (AREA), SoLow (HEALTH),
   ABC Diatype Mono (labels). */

@font-face { font-family: 'Diatype Mono'; src: url('ABCDiatypeMonoVariable-Trial.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Diatype'; src: url('ABCDiatype-Regular-Trial.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'SoLow'; src: url('SoLow-Trial-Regular.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Rauschen B'; src: url('RauschenBTrial-Regular.otf') format('opentype'); font-display: swap; }
@font-face { font-family: 'Rauschen B'; src: url('RauschenBTrial-RegularItalic.otf') format('opentype'); font-style: italic; font-display: swap; }

:root {
  --ink: #000;
  --paper: #fff;
  --grey: #afafaf;
  --soft: #d4d4d4;
  --fill: #c9c9c9;
  --wave: #3a2cff;
  --green: #bcd9b0;
  --water: #d6e3ef;
  --accent: #e07b1a;
  --mono: 'Diatype Mono', ui-monospace, Menlo, monospace;
  --raus: 'Rauschen B', 'Diatype', Helvetica, Arial, sans-serif;
  --solow: 'SoLow', 'Diatype Mono', monospace;
  --cursor: url('Mouse_Cursor.svg') 16 14, crosshair;
  --hatch: repeating-linear-gradient(135deg, #cfcfcf 0 1.5px, transparent 1.5px 4.5px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); overflow: hidden; }
body { font-family: var(--mono); font-variation-settings: 'MONO' 1; -webkit-font-smoothing: antialiased; }
html, body, body *, .maplibregl-canvas, .maplibregl-canvas-container.maplibregl-interactive,
.maplibregl-canvas-container.maplibregl-interactive:active { cursor: var(--cursor) !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }
video { background: var(--paper); display: block; }

/* ---------- shared bits ---------- */
.cd { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); z-index: 2; pointer-events: none; }
.cd.tl { left: 0; top: 0; } .cd.tr { left: 100%; top: 0; } .cd.bl { left: 0; top: 100%; } .cd.br { left: 100%; top: 100%; }
.sep { position: relative; height: 1px; margin: 0 -1px;
  background: repeating-linear-gradient(90deg, transparent 0 20px, var(--ink) 20px 33px); }
.sep > i { position: absolute; top: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transform: translate(-50%, -50%); }
.sep > i:first-child { left: 0; } .sep > i:last-child { left: 100%; }

#fader { position: fixed; inset: 0; background: var(--paper); opacity: 0; pointer-events: none; transition: opacity .7s ease; z-index: 100; }
#fader.on { opacity: 1; }

/* ---------- corner logo ---------- */
/* the logo sits at x26–163, y23–58 inside the 1440×900 frame; show it at ~60% with extra contrast so it reads crisp */
#cornerLogo { --ls: calc(var(--lfit, 1) * .6); position: fixed; left: 8px; top: 6px; width: calc(185px * var(--ls)); height: calc(74px * var(--ls)); overflow: hidden; z-index: 60; background: var(--paper); opacity: 0; transition: opacity .8s; pointer-events: none; }
#cornerLogo video { position: absolute; left: 0; top: 0; width: calc(1440px * var(--ls)); height: auto; filter: grayscale(1) contrast(1.7); }
body.show-logo #cornerLogo { opacity: 1; }

/* ---------- intro ---------- */
#intro { position: fixed; inset: 0; z-index: 50; background: var(--paper); }
body.mode-app #intro { display: none; }
.scene { position: absolute; inset: 0; background: var(--paper); opacity: 0; visibility: hidden; transition: opacity .7s ease; }
.scene.active { opacity: 1; visibility: visible; }
.stage { position: absolute; left: 50%; top: 50%; width: 1440px; height: 900px; transform: translate(-50%, -50%) scale(var(--fit, 1)); background: var(--paper); }
.stage video { width: 1440px; height: 900px; }
.crop-loading { position: absolute; left: 1322px; top: 838px; width: 78px; height: 26px; background: var(--paper); pointer-events: none; }

.audio-test { position: absolute; left: 284px; top: 405px; width: 178px; height: 112px; background: var(--paper); color: var(--grey); transition: color .25s; }
.audio-test svg { position: absolute; overflow: visible; }
.audio-test .at-off { left: .6px; top: 4.4px; width: 98.5px; height: 103.7px; }
.audio-test .at-on { left: 4.8px; top: 7.3px; width: 156.6px; height: 97.6px; display: none; }
.audio-test:hover { color: #6d6d6d; }
.audio-test[aria-pressed="true"] { color: var(--ink); }
.audio-test[aria-pressed="true"] .at-off { display: none; }
.audio-test[aria-pressed="true"] .at-on { display: block; }
.audio-test[aria-pressed="true"] .spk-dots circle { animation: dotPulse 1.2s infinite ease-in-out; }
@keyframes dotPulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

/* story scenes */
.st-wrap { position: absolute; inset: 12vh 6vw 13vh 6vw; display: flex; flex-direction: column; }
.st-wrap.center { align-items: center; justify-content: center; text-align: center; inset: 10vh 6vw 12vh; }
.st-kicker { font: 500 11px/1 var(--mono); letter-spacing: .2em; margin-bottom: 2.2vh; }
.st-h { font: 400 clamp(34px, 5vw, 78px)/.9 var(--raus); margin: 0 0 4vh; letter-spacing: -.005em; }
.st-h-solow { font-family: var(--solow); letter-spacing: .02em; }
.st-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 4vw; min-height: 0; }
.st-chart { position: relative; min-height: 0; display: flex; flex-direction: column; }
.st-chart-title { font: 500 10px/1.3 var(--mono); letter-spacing: .14em; margin-bottom: 14px; }
.st-side { display: flex; flex-direction: column; gap: 2.6vh; padding-top: 1vh; }
.st-p { font: 400 clamp(13px, 1.05vw, 16px)/1.45 var(--mono); letter-spacing: .02em; margin: 0; max-width: 34em; }
.st-p b { font-variation-settings: 'MONO' 1, 'wght' 700; font-weight: 700; }
.st-p.wide { max-width: 60em; margin-top: 3vh; }
.big-stat { display: flex; flex-direction: column; gap: 4px; }
.big-stat .n { font: 400 clamp(40px, 5.4vw, 86px)/.9 var(--raus); }
.big-stat .l { font: 500 11px/1.3 var(--mono); letter-spacing: .18em; }
.big-stat.dim .n { color: var(--grey); }

.cols { flex: 1; display: flex; align-items: flex-end; justify-content: space-between; min-height: 0; padding: 0 30px 70px 0; position: relative; max-width: 1000px; }
.col { display: flex; flex-direction: column-reverse; align-items: center; gap: calc(var(--d) * .3); position: relative; }
.col i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.col.lit i { transform: scale(1); }
.col.low i { background: var(--grey); }
.col .lab { position: absolute; top: calc(100% + 8px); left: 50%; transform-origin: 0 0; transform: rotate(62deg); font: 500 8.5px/1 var(--mono); letter-spacing: .1em; white-space: nowrap; }
.col .val { position: absolute; bottom: calc(100% + 6px); font: 500 8.5px/1 var(--mono); opacity: 0; transition: opacity .3s .2s; }
.col.lit .val { opacity: 1; }

#scatter { width: 100%; height: 100%; max-height: 52vh; overflow: visible; }
#scatter text { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; }
#scatter .pt { transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1); }
#scatter.lit .pt { transform: scale(1); }
#scatter .callout { opacity: 0; transition: opacity .6s; }
#scatter.lit .callout { opacity: 1; transition-delay: 1.4s; }

.ruler { position: relative; height: 150px; margin: 2vh 0 1vh; }
.ruler-track { position: absolute; left: 0; right: 0; top: 74px; height: 1px; background: var(--ink); }
.ruler .tick { position: absolute; top: 70px; width: 1px; height: 9px; background: var(--ink); }
.ruler .tick span { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); font: 500 9px/1 var(--mono); }
.ruler .mark { position: absolute; font: 500 9px/1.25 var(--mono); letter-spacing: .1em; white-space: nowrap; opacity: .25; transition: opacity .4s; }
.ruler .mark.up { bottom: 84px; border-left: 1px solid var(--ink); padding: 0 0 18px 6px; }
.ruler .mark.down { top: 96px; border-left: 1px solid var(--ink); padding: 18px 0 0 6px; }
.ruler .mark.hit { opacity: 1; }
.ruler .band { position: absolute; top: 66px; height: 17px; background: var(--hatch); opacity: .9; }
.ruler-needle { position: absolute; top: 40px; width: 1px; height: 70px; background: var(--wave); left: 0; }
.ruler-needle span { position: absolute; top: -18px; left: 6px; font: 600 11px/1 var(--mono); color: var(--wave); white-space: nowrap; }
.body-read { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 3vw; margin-top: 2vh; align-items: end; }
.br-l { font: 500 10px/1 var(--mono); letter-spacing: .16em; margin-bottom: 10px; }
.br-v { font: 400 clamp(30px, 3.4vw, 54px)/1 var(--raus); }
.br-v small { font: 500 11px var(--mono); letter-spacing: .14em; }
#bodyEcg { width: 100%; max-width: 360px; height: 70px; display: block; }

.howto-grid { list-style: none; padding: 0; margin: 1vh 0 5vh; display: grid; grid-template-columns: repeat(2, minmax(0, 330px)); gap: 22px 48px; text-align: left; }
.howto-grid li { display: flex; align-items: center; gap: 14px; font: 500 10.5px/1.4 var(--mono); letter-spacing: .12em; }
.howto-grid svg, .ico-num { flex: 0 0 auto; }
.ico-num { font: 500 13px var(--mono); letter-spacing: .25em; min-width: 38px; }
.enter-btn { position: relative; border: 1px solid var(--ink); padding: 18px 34px; font: 400 30px/1 var(--raus); display: inline-flex; align-items: center; gap: 16px; background: var(--paper); transition: background .2s; }
.enter-btn:hover { background: #f1f1f1; }

#introNav { position: absolute; left: 0; right: 0; bottom: 22px; display: flex; justify-content: center; align-items: center; z-index: 5; pointer-events: none; }
.ticks { display: flex; gap: 8px; pointer-events: auto; }
.ticks button { width: 30px; height: 12px; position: relative; }
.ticks button::before { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 2px; background: var(--soft); }
.ticks button.done::before { background: var(--ink); }
.ticks button i { position: absolute; left: 0; top: 5px; height: 2px; width: 0; background: var(--ink); }
.nav-btns { position: absolute; right: 28px; display: flex; gap: 22px; pointer-events: auto; }
.click-hint { position: absolute; left: 28px; font: 500 9.5px/1 var(--mono); letter-spacing: .16em; color: #777; animation: hintPulse 2.4s ease-in-out infinite; }
@keyframes hintPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
#intro { cursor: var(--cursor); }
.nav-btns button, .dock-links button { font: 500 10px/1 var(--mono); letter-spacing: .16em; padding: 6px 0; border-bottom: 1px solid transparent; }
.nav-btns button:hover, .dock-links button:hover { border-bottom-color: var(--ink); }

/* ---------- app ---------- */
#app { position: fixed; inset: 0; z-index: 1; background: var(--paper); }
#map { position: absolute; inset: 0; background: var(--paper); }
#waves { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib a { font: 500 9px/1.4 var(--mono) !important; color: #555 !important; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--paper) !important; }

.tag { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; display: flex; align-items: flex-start; opacity: 0; transition: opacity .25s; will-change: transform; }
.tag.on { opacity: 1; }
.tag-line { display: block; margin-top: -2px; overflow: visible; flex: 0 0 auto; }
.tag.flip { flex-direction: row-reverse; }
.tag.flip .tag-line { transform: scaleX(-1); }
.tag.flip .tag-body { text-align: right; padding: 0 4px 0 0; }
.tag-body { margin-top: -6px; padding-left: 4px; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff; }
.tag-borough { font: 600 11px/1.2 var(--mono); letter-spacing: .18em; }
.tag-street { font: 500 9px/1.3 var(--mono); letter-spacing: .12em; color: #333; }
.tag-db { font: 600 9px/1.4 var(--mono); letter-spacing: .12em; color: var(--wave); }

/* borough name tags on the map */
.blabel { font: 700 var(--lblsize, 9.5px)/1.15 var(--mono); letter-spacing: .15em; color: #000; text-align: center; max-width: 92px; white-space: normal;
  text-shadow: 0 0 2px #fff, 0 0 3px #fff, 0 0 6px #fff, 0 0 8px #fff; pointer-events: none !important; transition: opacity .35s, color .2s; }
.blabel.on { color: var(--accent); }
/* !important beats the inline opacity MapLibre puts on markers */
#app.labels-off .blabel, #app.names-off .blabel, body.mode-intro .blabel { opacity: 0 !important; }

.hint { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 4; font: 500 10px/1 var(--mono); letter-spacing: .16em; padding: 7px 12px; background: var(--paper); border: 1px solid var(--ink); transition: opacity .5s; pointer-events: none; white-space: nowrap; }
.hint.off { opacity: 0; }

/* panels */
#panels { position: absolute; top: 34px; right: 34px; width: 330px; z-index: 10; transform-origin: top right; transform: scale(var(--pfit, 1)); }
.lpanel { position: relative; border: 1px solid var(--ink); background: var(--paper); }
#healthPanel { margin-top: 44px; }
.lpanel .collapse { position: absolute; right: -1px; top: -21px; height: 21px; padding: 0 16px; border: 1px solid var(--ink); border-bottom: 0; background: var(--paper); font: 500 10px/20px var(--mono); letter-spacing: .06em; }
.lpanel .cd.tab { display: none; }
.lpanel .collapse::before { content: ''; position: absolute; left: 0; bottom: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transform: translate(-50%, 50%); }
.lpanel .collapse:hover { background: #f1f1f1; }
.p-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 16px 16px; }
.t-area { font: 400 46px/.82 var(--raus); margin: 0; letter-spacing: .005em; }
.t-area.small { font-size: 34px; margin-bottom: 14px; }
.t-health { font: 400 44px/.82 var(--solow); margin: 0; display: flex; align-items: flex-start; gap: 3px; }
.t-health .px-x { margin-top: -1px; }
.p-name { font: 600 11px/1 var(--mono); letter-spacing: .2em; text-align: right; max-width: 150px; padding-bottom: 2px; }
.p-body { overflow: hidden; transition: max-height .45s ease, opacity .3s; max-height: 900px; }
.lpanel.collapsed .p-body { max-height: 0; opacity: 0; }
.lpanel.collapsed .p-head { padding-bottom: 14px; }

.row-audio { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; }
.spk { position: relative; width: 50px; height: 32px; display: flex; align-items: center; }
.spk .spk-on { display: none; }
.spk[aria-pressed="true"] .spk-off { display: none; }
.spk[aria-pressed="true"] .spk-on { display: block; }
.spk-dots circle { transition: opacity .15s; }
.chans { display: flex; gap: 12px; }
.chan { display: flex; align-items: flex-end; gap: 4px; }
.chan .num { width: 21px; height: 21px; border-radius: 50%; border: 1px solid transparent; font: 500 14px/19px var(--mono); text-align: center; }
.chan.on .num { border-color: var(--ink); }
.chan:not(.on) .num { color: var(--grey); }
.chan .meter { display: flex; align-items: flex-end; gap: 1.5px; height: 14px; }
.chan .meter i { width: 2.5px; background: #e1e1e1; }
.chan .meter i:nth-child(1) { height: 3px; } .chan .meter i:nth-child(2) { height: 5px; } .chan .meter i:nth-child(3) { height: 7px; }
.chan .meter i:nth-child(4) { height: 9px; } .chan .meter i:nth-child(5) { height: 11px; } .chan .meter i:nth-child(6) { height: 14px; }
.chan .meter i.on { background: var(--ink); }

.row-main { display: grid; grid-template-columns: 136px 1fr; padding: 6px 0 4px; }
.col-matrix { display: flex; flex-direction: column; align-items: center; padding-top: 10px; }
.matrix { display: grid; grid-template-columns: repeat(5, 8.6px); gap: 2.6px 3.2px; }
.matrix i { width: 8.6px; height: 8.6px; border-radius: 50%; background: #e3e3e3; transition: background .15s; }
.matrix i.on { background: var(--ink); }
.m-name { margin-top: 12px; font: 600 10px/1.25 var(--mono); letter-spacing: .2em; text-align: center; max-width: 124px; min-height: 2.5em; }
.col-db { position: relative; padding-top: 4px; }
.db { padding-left: 14px; height: 44px; display: flex; align-items: baseline; gap: 2px; white-space: nowrap; }
.db .d { font: 400 38px/1 var(--raus); }
.db .b { font: italic 400 38px/1 var(--raus); margin-left: -1px; }
.db .dbv { font: 500 15px/1 var(--mono); letter-spacing: .06em; margin-left: 6px; }
.sep-half { margin: 6px -1px 14px 4px; background: repeating-linear-gradient(90deg, transparent 0 14px, var(--ink) 14px 27px); }
.sep-half > i.l { left: 0; }
.note { font: 400 9.5px/1.45 var(--mono); letter-spacing: .02em; margin: 0 0 12px 30px; }
.note b { font-weight: 700; font-style: italic; font-variation-settings: 'MONO' 1, 'wght' 700, 'slnt' -10; }
.mini { margin: 6px 14px 8px 30px; }
.mini-label { font: 500 8.5px/1 var(--mono); letter-spacing: .14em; margin-bottom: 5px; display: flex; justify-content: space-between; }
.mini-sub { font: 500 8px/1.3 var(--mono); letter-spacing: .1em; margin-top: 4px; color: #444; }
.spectrum { display: flex; align-items: flex-end; gap: 2px; height: 30px; border-bottom: 1px solid var(--ink); }
.spectrum i { flex: 1; background: var(--ink); height: 1px; }
.src-row { display: grid; grid-template-columns: 30px 1fr 22px; align-items: center; gap: 5px; margin-top: 3px; font: 500 8px/1 var(--mono); letter-spacing: .1em; }
.src-row i { position: relative; height: 6px; border: 1px solid var(--ink); }
.src-row b { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); transition: width .3s; }
.src-row em { font-style: normal; text-align: right; }
.greenbar { position: relative; height: 9px; border: 1px solid var(--ink); }
.greenbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--green); transition: width .4s; }
.greenbar b { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink); transition: left .3s; }

.row-key { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 2px; font: 500 9.5px/1 var(--mono); letter-spacing: .16em; }
.key-dot { display: flex; align-items: center; gap: 8px; }
.key-dot i { width: 8.6px; height: 8.6px; border-radius: 50%; background: var(--ink); }
.cmp { display: flex; align-items: center; gap: 10px; }
.cmp-icon svg { display: block; width: 30px; height: 20px; }
.cmp-label { text-align: right; padding: 3px 16px 12px; font: 500 8.5px/1 var(--mono); letter-spacing: .14em; color: #444; }
.row-pop { display: flex; justify-content: space-between; align-items: flex-end; padding: 16px 16px 12px; }
.t-pop { font: 400 27px/.86 var(--raus); margin: 0; }
.pop-num { text-align: right; font: 500 13px/1 var(--mono); letter-spacing: .14em; }
.pop-num small { display: block; margin-top: 5px; font-size: 7px; letter-spacing: .12em; color: #555; }

.zone-key { font: 600 10px/1 var(--mono); letter-spacing: .18em; text-align: right; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.zone-key b { color: var(--wave); margin-left: 4px; }
.zone-key .normal { display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 9px; }
.hatch { display: inline-block; width: 30px; height: 12px; background: var(--hatch); }
.h-row { display: flex; justify-content: space-between; align-items: flex-end; padding: 9px 16px; }
.h-label { font: 500 9.5px/1 var(--mono); letter-spacing: .18em; }
.boxes, .bars { position: relative; display: inline-flex; align-items: flex-end; gap: 4px; height: 26px; }
.hatch-band { position: absolute; left: -4px; bottom: 0; height: 9px; background: var(--hatch); }
.boxes .hatch-band { width: 82px; } .bars .hatch-band { width: 54px; }
.boxes i { position: relative; border: 1px solid var(--ink); background: var(--paper); transition: background .3s; }
.boxes i:nth-child(2) { width: 16px; height: 4px; } .boxes i:nth-child(3) { width: 20px; height: 7px; } .boxes i:nth-child(4) { width: 24px; height: 11px; }
.boxes i:nth-child(5) { width: 28px; height: 17px; } .boxes i:nth-child(6) { width: 32px; height: 24px; }
.boxes i.on { background: var(--fill); }
.bars { gap: 10px; padding-right: 2px; }
.bars i { position: relative; width: 5px; border: 1px solid var(--ink); background: var(--paper); transition: background .3s; }
.bars i:nth-child(2) { height: 4px; } .bars i:nth-child(3) { height: 8px; } .bars i:nth-child(4) { height: 13px; }
.bars i:nth-child(5) { height: 19px; } .bars i:nth-child(6) { height: 26px; }
.bars i.on { background: var(--ink); }
.boxes.big { transform: scale(1.6); transform-origin: left bottom; margin-bottom: 4px; }
.bars.big { transform: scale(1.6); transform-origin: left bottom; margin-bottom: 4px; }
.hr { display: flex; align-items: center; gap: 8px; }
#ecg { width: 100px; height: 22px; }
.bpm { font: 600 10px/1 var(--mono); letter-spacing: .1em; min-width: 52px; text-align: right; }
.risks { padding: 14px 16px 12px; font: 500 9.5px/1 var(--mono); letter-spacing: .18em; }
.r-title { margin-bottom: 14px; }
.r-row { display: grid; grid-template-columns: 1fr 1.9fr; margin-bottom: 10px; }
.r-row span:last-child { font-weight: 600; }
.r-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 8px; letter-spacing: .16em; }

/* dock */
#dock { position: absolute; left: 26px; bottom: 22px; z-index: 6; display: flex; flex-direction: column; gap: 10px; max-width: calc(100vw - 420px); }
.dock-label { font: 600 9px/1 var(--mono); letter-spacing: .18em; margin-right: 4px; }
.places { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.places button { font: 500 9px/1 var(--mono); letter-spacing: .12em; padding: 5px 8px; border: 1px solid var(--ink); background: var(--paper); }
.places button:hover, .places button.on { background: #ececec; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font: 500 9px/1 var(--mono); letter-spacing: .12em; }
.lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-btn { padding: 4px 7px; border: 1px solid var(--soft); }
.lg-btn.on { border-color: var(--ink); }
.sw { display: inline-block; width: 18px; height: 9px; }
.sw-road { height: 2px; background: var(--ink); }
.sw-noise { background: radial-gradient(ellipse at center, rgba(58, 44, 255, .55), rgba(58, 44, 255, 0) 72%); height: 12px; }
.sw-green { background: var(--green); }
.sw-water { background: var(--water); }
.sw-rail { height: 2px; background: repeating-linear-gradient(90deg, var(--ink) 0 3px, transparent 3px 5px); }
.sw-bor { height: 1px; background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 7px); }
.howto { font: 500 8.5px/1.4 var(--mono); letter-spacing: .14em; color: #444; }
.dock-links { display: flex; gap: 18px; }
#dock, #panels { text-shadow: none; }
#dock .places, #dock .legend, #dock .howto, #dock .dock-links { background: rgba(255, 255, 255, .86); padding: 3px 4px; width: fit-content; }
#dock.min .places, #dock.min .legend, #dock.min .howto { display: none; }

/* filters (top-left) */
#filters { position: absolute; left: 24px; top: 62px; z-index: 6; display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.fgroup { display: flex; gap: 5px; }
.fgroup button { font: 500 9.5px/1 var(--mono); letter-spacing: .14em; padding: 7px 10px 6px; border: 1px solid var(--ink); background: var(--paper); position: relative; }
.fgroup button:hover { background: #f0f0f0; }
.fgroup button.on, .ftoggle button.on { background: var(--paper); box-shadow: inset 0 -3px 0 var(--wave); color: var(--wave); border-color: var(--wave); font-weight: 600; }
.ftoggle button { font: 500 9.5px/1 var(--mono); letter-spacing: .14em; padding: 7px 10px 6px; border: 1px solid var(--ink); background: var(--paper); }
.ftoggle button:hover { background: #f0f0f0; }
.ftoggle button:not(.on) { color: #777; border-color: #9a9a9a; text-decoration: line-through; }
.risk-key { background: rgba(255, 255, 255, .92); padding: 7px 8px 6px; border: 1px solid var(--soft); width: 206px; display: none; }
.risk-key.on { display: block; }
.rk-title { font: 600 8.5px/1 var(--mono); letter-spacing: .14em; margin-bottom: 6px; }
.rk-ramp { display: flex; height: 9px; border: 1px solid var(--ink); }
.rk-ramp i { flex: 1; }
.rk-labels { display: flex; justify-content: space-between; padding: 4px 0 0 18%; font: 500 8px/1 var(--mono); letter-spacing: .06em; }
.rk-labels span { flex: 1; text-align: left; }
.rk-labels.ends { justify-content: space-between; padding-left: 0; }
.rk-labels.ends span { flex: none; }
.rk-note { font: 500 8px/1.35 var(--mono); letter-spacing: .08em; color: #444; margin-top: 5px; }
.rk-note:empty { display: none; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(255, 255, 255, .88); display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-box { width: min(680px, 92vw); max-height: 82vh; overflow: auto; padding: 22px 26px; }
.modal-close { position: absolute; right: 12px; top: 8px; font: 400 26px/1 var(--raus); }
.modal-p { font: 400 10.5px/1.55 var(--mono); letter-spacing: .02em; }
#creditList { padding-left: 20px; margin: 10px 0 14px; font: 500 9.5px/1.5 var(--mono); letter-spacing: .04em; }
#creditList li { margin-bottom: 6px; }
#creditList a { color: var(--ink); }
#creditList .lic { color: var(--wave); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .st-wrap { inset: 11vh 16px 12vh 16px; overflow-y: auto; }
  .st-grid { grid-template-columns: 1fr; gap: 3vh; }
  .body-read { grid-template-columns: 1fr; gap: 2vh; }
  .howto-grid { grid-template-columns: 1fr; }
  .nav-btns { right: 16px; }
  #introNav { justify-content: flex-start; padding-left: 16px; }
  .ticks button { width: 16px; }
  #panels { top: auto; bottom: 10px; right: 50%; transform-origin: bottom center; transform: translateX(50%) scale(var(--pfit, 1));
    max-height: calc(48vh / var(--pfit, 1)); overflow-y: auto; padding-top: 22px; scrollbar-width: none; }
  #panels::-webkit-scrollbar { display: none; }
  #healthPanel { margin-top: 34px; }
  #dock { left: 12px; right: 12px; top: 64px; bottom: auto; max-width: none; }
  #dock .legend, #dock .howto, #dock .dock-links { display: none; }
  .places { flex-wrap: nowrap; overflow-x: auto; }
  .hint { bottom: auto; top: 200px; }
  body.key-on .hint { display: none; }
  #filters { top: 102px; left: 12px; gap: 5px; }
  .fgroup button, .ftoggle button { padding: 6px 7px 5px; font-size: 8.5px; }
  .click-hint { display: none; }
  .risk-key { width: 180px; }
}
