/* Wheezair — brand: Ocean Blue #0EA5FF, Cyan #00E5FF, Teal #10D399, Deep Navy #0B1220, Slate #94A3B8.
   Tokens follow the map theme (body[data-ui]); see docs/WHEEZAIR_BRANDING_IMPLEMENTATION.md. */
:root {
  --brand: #0EA5FF;
  --cyan: #00E5FF;
  --teal: #10D399;
  --navy: #0B1220;
  --slate: #94A3B8;
  --aqua: #00E0D6;
  /* brand gradient: logo, selected controls, subtle active states — never AQI data */
  --brand-gradient: linear-gradient(120deg, #1687FF 0%, #0EA5FF 40%, #00E0D6 100%);
  --radius-control: 10px;
  --radius-panel: 13px;
  --t-fast: 150ms;
  --t-ui: 220ms;
  /* AQI bands (the map shader reads these) */
  --good: #22d37a;
  --fair: #a3e04a;
  --mod: #f4cf3a;
  --poor: #f59a2a;
  --bad: #ef4b4b;
  --vbad: #b455e6;

  /* page / header tokens — dark map */
  --bg: #0B1220;
  --ink: #F7FAFC;
  --ink-dim: #8FA1B5;
  --line: rgba(148, 163, 184, .16);
  --line-strong: rgba(148, 163, 184, .34);
  --ctl: rgba(17, 27, 46, .82);
  --ctl-active: rgba(14, 165, 255, .2);
  --fade: rgba(11, 18, 32, .9);
  --space: #101b30;
  --shadow: 0 8px 30px rgba(0, 0, 0, .24);
  /* panels and map controls */
  --panel-bg: rgba(8, 18, 32, .88);
  --panel-line: rgba(77, 163, 218, .2);
  --hover: rgba(148, 163, 184, .12);
  --soft: rgba(148, 163, 184, .07);
  --tab-bg: rgba(148, 163, 184, .08);
  --tab-on: rgba(148, 163, 184, .18);
  --seg-on-bg: rgba(14, 165, 255, .22);
  --seg-on-ink: #ffffff;
  --map-ctl-bg: rgba(8, 18, 32, .88);
  --dialog-bg: #0f1a2c;
  --thumb: #ffffff;
}
body[data-ui="light"] {
  --bg: #F5F8FB;
  --ink: #081220;
  --ink-dim: #64748B;
  --line: rgba(15, 27, 45, .12);
  --line-strong: rgba(15, 27, 45, .26);
  --ctl: rgba(255, 255, 255, .92);
  --ctl-active: rgba(14, 165, 255, .14);
  --fade: rgba(255, 255, 255, .92);
  --space: #f7f9f8;
  --shadow: 0 4px 18px rgba(15, 23, 42, .08);
  --panel-bg: rgba(255, 255, 255, .92);
  --panel-line: rgba(15, 23, 42, .1);
  --hover: rgba(15, 23, 42, .06);
  --soft: rgba(15, 23, 42, .03);
  --tab-bg: rgba(15, 23, 42, .05);
  --tab-on: #ffffff;
  --seg-on-bg: rgba(14, 165, 255, .14);
  --seg-on-ink: #0b6fb0;
  --map-ctl-bg: rgba(255, 255, 255, .92);
  --dialog-bg: #ffffff;
  --thumb: var(--brand-gradient);
}
/* translucent glass: deep navy on the dark map, white on the light one */
.panel {
  color: var(--ink);
  background: var(--panel-bg);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
  transition: background-color var(--t-ui) ease, border-color var(--t-ui) ease, color var(--t-ui) ease;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body, #map { height: 100%; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); overflow: hidden; -webkit-font-smoothing: antialiased; }
#map { background: radial-gradient(ellipse at 50% 45%, var(--space) 0%, var(--bg) 72%); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
noscript .seo { position: fixed; inset: 80px 20px auto; z-index: 30; padding: 20px; background: var(--navy); color: #e6edf5; border-radius: 14px; }
noscript .seo a { color: var(--cyan); }

/* ---- header ---- */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 12;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 76px 14px 20px; pointer-events: none;
  background: linear-gradient(180deg,
    var(--fade) 0%, color-mix(in srgb, var(--fade) 92%, transparent) 30%,
    color-mix(in srgb, var(--fade) 70%, transparent) 50%, color-mix(in srgb, var(--fade) 42%, transparent) 68%,
    color-mix(in srgb, var(--fade) 18%, transparent) 84%, color-mix(in srgb, var(--fade) 5%, transparent) 94%, transparent);
}
header > * { pointer-events: auto; }
.brand { display: block; flex: none; line-height: 0; }
.brand img { height: 34px; width: auto; }
.brand .mark { display: none; }
.logo-on-light { display: none; }
body[data-ui="light"] .logo-on-light { display: block; }
body[data-ui="light"] .logo-on-dark { display: none; }
.hbar { display: flex; align-items: center; gap: 10px; min-width: 0; }
header select {
  appearance: none; -webkit-appearance: none; height: 40px;
  background: var(--ctl) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394A3B8' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center;
  font-size: 14px; border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 0 34px 0 12px; cursor: pointer; width: 170px;
}
header select:hover { border-color: var(--line-strong); }
header select option { background: var(--dialog-bg); color: var(--ink); }
header .meta { font-size: 12.5px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.icons { display: flex; gap: 8px; }
.tools { margin-left: auto; display: flex; gap: 8px; flex: none; }
.ib {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: var(--ctl); border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
/* micro-interactions (150 ms) */
.ib, .btn, .seg button, .tabs button, .menu button, #rankList li button, .results li, header select,
.search input, #tLive, #timeline .play, .linkish, #panel .close, .about .close, .maplibregl-ctrl-group button {
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.ib:hover { border-color: var(--line-strong); }
.ib.active, .ib[aria-pressed="true"], .ib[aria-expanded="true"] { background: var(--ctl-active); border-color: rgba(14, 165, 255, .55); color: var(--brand); }
.ib.txt { font-size: 13px; font-weight: 600; }
#themeBtn .moon, body[data-ui="light"] #themeBtn .sun { display: block; }
#themeBtn .sun, body[data-ui="light"] #themeBtn .moon { display: none; }
#projBtn .flat, #projBtn.is-flat .globe { display: none; }
#projBtn.is-flat .flat { display: block; }

/* menus */
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; min-width: 220px; padding: 6px; }
.menu-title { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); padding: 8px 10px 4px; }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  background: none; border: 0; border-radius: 8px; font-size: 14px; text-align: left;
}
.menu button:hover { background: var(--hover); }
.menu button i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; }
.menu button[aria-checked="true"] i { border-color: var(--brand); background: radial-gradient(circle, var(--brand) 0 38%, transparent 42%); }
.menu button.check i { border-radius: 4px; }
.menu button.check[aria-checked="true"] i { border-color: transparent; background: var(--brand-gradient); }
.menu button.check[aria-checked="true"] i::after { content: ""; display: block; width: 4px; height: 8px; margin: 1.5px auto 0; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }

/* search */
.search { position: relative; width: 240px; flex: none; }
.search .icon { position: absolute; z-index: 1; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-dim); pointer-events: none; width: 16px; height: 16px; }
.search input {
  width: 100%; height: 40px; background: var(--ctl); border: 1px solid var(--line); border-radius: var(--radius-control);
  padding: 0 12px 0 36px; font-size: 14px; outline: none;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.search input::placeholder { color: var(--ink-dim); }
.search input:focus { border-color: var(--brand); }
.search input::-webkit-search-cancel-button { display: none; }
.results { position: absolute; top: calc(100% + 6px); left: 0; width: max(100%, 300px); padding: 4px; list-style: none; max-height: min(360px, 60vh); overflow-y: auto; }
.results li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.results li[aria-selected="true"], .results li:hover { background: var(--hover); }
.results .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .name small { color: var(--ink-dim); margin-left: 6px; }
.results .empty { color: var(--ink-dim); cursor: default; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ink-dim); box-shadow: 0 0 8px currentColor; }
.val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }

/* segmented controls (inside panels) */
.seg { flex: none; display: flex; background: var(--tab-bg); border-radius: 8px; padding: 2px; }
.seg button { background: none; border: 0; color: var(--ink-dim); padding: 4px 10px; font-size: 12.5px; border-radius: 6px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--seg-on-bg); color: var(--seg-on-ink); }
.seg button:hover:not(:disabled) { color: var(--ink); }
.seg button:disabled { opacity: .35; cursor: default; }

/* ---- rankings + legend (left) ---- */
#board { position: fixed; left: 20px; top: 92px; z-index: 10; width: 280px; padding: 14px; font-size: 13.5px; max-height: calc(100vh - 190px); overflow-y: auto; }
.tabs { display: flex; gap: 4px; background: var(--tab-bg); border-radius: 10px; padding: 3px; }
.tabs button { flex: 1; padding: 7px 8px; border: 0; background: none; border-radius: 8px; color: var(--ink-dim); font-weight: 500; font-size: 13.5px; }
.tabs button[aria-pressed="true"] { background: var(--tab-on); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.board-sub { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 2px 4px; }
#rankCaption { font-size: 12.5px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rankList { list-style: none; padding: 0; margin: 4px 0 0; min-height: 30px; }
#rankList li button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 4px; background: none; border: 0; border-radius: 8px; text-align: left; font-size: 14px; }
#rankList li button:hover { background: var(--hover); }
#rankList .n { width: 14px; color: var(--ink-dim); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
#rankList .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rankList .name small { color: var(--ink-dim); margin-left: 5px; font-size: 12px; }
#rankList .none { color: var(--ink-dim); padding: 6px 4px; }
.legend { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; }
.legend strong { font-weight: 600; font-size: 13.5px; }
.legend .scale {
  height: 6px; border-radius: 3px; margin: 10px 0 5px;
  background: linear-gradient(90deg, var(--good) 8.3%, var(--fair) 25%, var(--mod) 41.7%, var(--poor) 58.3%, var(--bad) 75%, var(--vbad) 95.8%);
}
.legend .ticks { position: relative; height: 14px; font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.legend .ticks span { position: absolute; transform: translateX(-50%); }
.legend .ticks span:first-child { transform: none; }
.legend p { color: var(--ink-dim); margin-top: 8px; line-height: 1.45; font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 500; }
.linkish:hover { text-decoration: underline; }

/* ---- timeline ---- */
#timeline {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 11;
  width: min(820px, calc(100% - 640px)); min-width: 560px;
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
}
#timeline .play { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--soft); display: grid; place-items: center; }
#timeline .play svg { width: 12px; height: 12px; fill: currentColor; }
#timeline .play:hover { background: var(--hover); }
.track { position: relative; flex: 1; height: 38px; min-width: 120px; }
.track .rail { position: absolute; left: 0; right: 0; top: 13px; height: 2px; border-radius: 1px; background: rgba(148, 163, 184, .28); }
.track .future { position: absolute; top: 13px; height: 2px; right: 0; background: repeating-linear-gradient(90deg, rgba(148,163,184,.55) 0 3px, transparent 3px 6px); }
.track .now { position: absolute; top: 7px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: var(--teal); }
.track .ticks { position: absolute; left: 0; right: 0; top: 22px; height: 14px; font-size: 10.5px; color: var(--ink-dim); }
.track .ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.track .ticks span::before { content: ""; position: absolute; left: 50%; top: -9px; width: 1px; height: 5px; background: rgba(148,163,184,.35); }
.track input[type="range"] { position: absolute; left: -7px; right: -7px; top: 6px; width: calc(100% + 14px); height: 16px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.track input[type="range"]:focus-visible { outline: none; }
.track input[type="range"]::-webkit-slider-runnable-track { height: 16px; background: transparent; }
.track input[type="range"]::-moz-range-track { height: 16px; background: transparent; }
.track input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--thumb); box-shadow: 0 0 0 4px rgba(14,165,255,.35), 0 0 14px rgba(0,229,255,.5); }
.track input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--thumb); box-shadow: 0 0 0 4px rgba(14,165,255,.35), 0 0 14px rgba(0,229,255,.5); }
.track input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--brand); }
.when { flex: none; width: 170px; text-align: right; line-height: 1.25; }
.when b { display: block; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.when span { font-size: 11.5px; color: var(--ink-dim); }
#tLive { flex: none; display: flex; align-items: center; gap: 7px; background: none; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-dim); padding: 6px 12px; font-size: 13px; font-weight: 500; }
#tLive i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
#tLive[aria-pressed="true"] { color: var(--teal); border-color: rgba(16, 211, 153, .45); background: rgba(16, 211, 153, .08); }
#tLive[aria-pressed="true"] i { box-shadow: 0 0 0 0 rgba(16,211,153,.6); animation: livePulse 2s ease-out infinite; }
@keyframes livePulse { to { box-shadow: 0 0 0 7px rgba(16,211,153,0); } }

/* ---- tooltip ---- */
#tip { position: fixed; z-index: 20; pointer-events: none; padding: 7px 12px; font-size: 14px; white-space: nowrap; transform: translate(16px, -50%); border-radius: 10px; }
#tip b { font-weight: 600; margin-right: 6px; }
#tip span { font-weight: 600; }

/* ---- detail panel ---- */
#panel { position: fixed; right: 76px; top: 92px; z-index: 10; width: 300px; padding: 16px 18px; max-height: calc(100vh - 190px); overflow-y: auto; }
#panel h2 { font-size: 19px; font-weight: 700; padding-right: 26px; line-height: 1.2; }
#panel .sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; }
#panel .verdict { display: flex; align-items: center; gap: 12px; margin: 12px 0 6px; }
#panel .verdict .num { font-size: 40px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
#panel .verdict .label { display: block; font-size: 16px; font-weight: 600; }
#panel .verdict small { display: block; font-size: 12px; color: var(--ink-dim); }
#panel .advice { font-size: 13.5px; line-height: 1.45; margin: 6px 0 12px; }
#panel dl { display: grid; grid-template-columns: auto 1fr auto; gap: 7px 10px; font-size: 13.5px; align-items: center; }
#panel dt { display: contents; color: var(--ink-dim); }
#panel dt span { display: flex; align-items: center; gap: 7px; }
#panel dt .dot { width: 8px; height: 8px; box-shadow: none; }
#panel dt em { font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--ink); background: var(--hover); border-radius: 4px; padding: 1px 5px; }
#panel dt .sel { color: var(--ink); }
#panel dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
#panel dd.bar { text-align: left; }
#panel dd.bar i { display: block; height: 4px; border-radius: 2px; background: currentColor; min-width: 3px; }
#panel .outlook { font-size: 13px; color: var(--ink-dim); margin-top: 14px; line-height: 1.45; }
#panel .outlook b { color: var(--ink); font-weight: 600; }
#panel .spark { margin-top: 10px; min-height: 74px; color: var(--ink); }
#panel .spark svg { display: block; width: 100%; height: 56px; overflow: visible; }
#panel .spark .axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-dim); margin-top: 4px; }
#panel .actions { display: flex; gap: 8px; margin-top: 12px; }
#panel .report { display: block; margin-top: 12px; font-size: 13px; color: var(--brand); text-decoration: none; font-weight: 500; }
#panel .report:hover { text-decoration: underline; }
.btn { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 9px 12px; font-size: 13.5px; font-weight: 500; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; }
.btn:hover { border-color: var(--line-strong); background: var(--hover); }
.btn .icon { width: 15px; height: 15px; }
#panel .close { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; background: none; border: 0; border-radius: 7px; color: var(--ink-dim); font-size: 20px; line-height: 1; }
#panel .close:hover { color: var(--ink); background: var(--hover); }

/* ---- map controls (always dark squares) ---- */
.maplibregl-ctrl-top-right { top: 12px; right: 20px; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 0 8px 0; }
.maplibregl-ctrl-group { background: var(--map-ctl-bg); border: 1px solid var(--panel-line); border-radius: 10px; box-shadow: var(--shadow) !important; overflow: hidden; backdrop-filter: blur(12px); }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
.maplibregl-ctrl-group button + button { border-top-color: var(--panel-line); }
/* zoom icons in the same outline family as the header icons */
.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  background: var(--ink); -webkit-mask: var(--i) center / 18px no-repeat; mask: var(--i) center / 18px no-repeat;
}
.maplibregl-ctrl-zoom-in { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M8 3v10M3 8h10'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-zoom-out { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M3 8h10'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-group button:not(:disabled):hover { background-color: var(--hover); }
.maplibregl-ctrl-group .locate { display: grid; place-items: center; color: var(--ink); }
.maplibregl-ctrl-group .locate.busy .icon { animation: spin 1s linear infinite; }
.maplibregl-ctrl.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib.maplibregl-compact {
  font-size: 10px; color: var(--ink-dim); background: var(--panel-bg); border: 1px solid var(--panel-line); border-radius: 12px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.maplibregl-ctrl-attrib a { color: var(--ink-dim); }
.maplibregl-ctrl-attrib a:hover { color: var(--ink); }
.maplibregl-ctrl-attrib-button, .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
  background: var(--ink-dim);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5.6'/%3E%3Cpath d='M8 7.4v3.4M8 5.3v.1'/%3E%3C/svg%3E") center / 16px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5.6'/%3E%3Cpath d='M8 7.4v3.4M8 5.3v.1'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.maplibregl-ctrl-attrib-button:hover { background: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- status: loader, toast ---- */
#loader { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 15; padding: 12px 18px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
#loader i { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.6); opacity: .6; } 42% { transform: scale(1.3); opacity: 1; } }
#toast { position: fixed; left: 50%; top: 76px; transform: translateX(-50%); z-index: 30; padding: 9px 16px; font-size: 14px; max-width: calc(100% - 32px); }

/* ---- about dialog ---- */
dialog { margin: auto; position: fixed; inset: 0; width: min(660px, calc(100% - 24px)); max-height: min(86vh, 900px); padding: 0; color: var(--ink); background: var(--dialog-bg); border: 1px solid var(--panel-line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(5, 9, 18, .6); backdrop-filter: blur(3px); }
.about { padding: 26px 28px 22px; font-size: 14.5px; line-height: 1.55; }
.about .brandmark { height: 34px; width: auto; margin-bottom: 14px; }
.about h2 { font-size: 24px; font-weight: 700; margin-bottom: 6px; line-height: 1.2; }
.about h3 { font-size: 14px; font-weight: 700; margin: 20px 0 6px; }
.about p + p { margin-top: 8px; }
.about b { font-weight: 600; }
.about a { color: var(--brand); }
.about .close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; background: none; border-radius: 8px; font-size: 22px; color: var(--ink-dim); }
.about .close:hover { background: var(--hover); color: var(--ink); }
.about table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
.about td { padding: 6px; border-top: 1px solid var(--line); vertical-align: top; }
.about td:first-child { white-space: nowrap; font-weight: 600; }
.about td:nth-child(2) { white-space: nowrap; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.about ul { padding-left: 18px; }
.about kbd { font: 12px ui-monospace, monospace; border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 5px; }
.about .links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; }
.about .fine { font-size: 12.5px; color: var(--ink-dim); margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.demo { display: flex; gap: 22px; margin: 14px 0 4px; }
.demo figure { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.demo .glyph { position: relative; width: 44px; height: 44px; }
.demo .glyph i { position: absolute; inset: 0; margin: auto; border-radius: 50%; }
.demo .glyph .c { width: 8px; height: 8px; background: currentColor; box-shadow: 0 0 10px currentColor; }
.demo .glyph .r { border: 1.2px solid currentColor; animation: var(--anim) var(--t) ease-in-out infinite; }
.demo .clean { color: var(--good); --t: 5.1s; --anim: deep; }
.demo .dirty { color: var(--bad); --t: 1.5s; --anim: shallow; }
@keyframes deep { 0%, 100% { width: 12px; height: 12px; opacity: .35; } 42% { width: 42px; height: 42px; opacity: .9; } }
@keyframes shallow { 0%, 100% { width: 30px; height: 30px; opacity: .5; } 42% { width: 40px; height: 40px; opacity: .9; } }

/* panels and menus fade in (220 ms); the tooltip follows the pointer, so it doesn't */
.menu:not([hidden]), .results:not([hidden]), #board:not([hidden]), #panel:not([hidden]) { animation: wzIn var(--t-ui) ease-out; }
#toast:not([hidden]), #loader, dialog[open] { animation: wzFade var(--t-ui) ease-out; }
@keyframes wzIn { from { opacity: 0; translate: 0 -4px; } }
@keyframes wzFade { from { opacity: 0; } }

/* screenshot mode (?shot) for social images */
body.shot header, body.shot #board, body.shot #timeline, body.shot #panel, body.shot .maplibregl-control-container, body.shot #loader { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .demo .glyph .r, #loader i, #tLive[aria-pressed="true"] i { animation: none; }
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

@media (max-width: 1280px) {
  header .meta { display: none; }
  #timeline { width: calc(100% - 40px); min-width: 0; bottom: 16px; }
}
@media (max-width: 1060px) {
  .search { width: 190px; }
  header select { width: 140px; }
}

@media (max-width: 760px) {
  header { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .brand img { height: 28px; }
  .ib { width: 36px; height: 36px; }
  .search { order: 3; flex: 1 1 100%; width: auto; }
  .hbar { order: 4; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .hbar::-webkit-scrollbar { display: none; }
  .menu { position: fixed; top: 110px; left: 12px; right: 12px; }
  header select { width: 130px; height: 36px; font-size: 13px; }
  .maplibregl-ctrl-top-right { top: 152px; right: 10px; }
  .maplibregl-ctrl-top-right .maplibregl-ctrl-group:first-child { display: none; }
  #board { left: 10px; right: 10px; top: auto; bottom: 122px; width: auto; max-height: 46vh; }
  #timeline { flex-wrap: wrap; gap: 4px 10px; bottom: calc(10px + env(safe-area-inset-bottom)); width: calc(100% - 20px); padding: 8px 10px 4px; }
  #timeline .when { order: 0; width: auto; flex: 1 1 calc(100% - 110px); text-align: left; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
  #timeline .when b { display: inline; white-space: nowrap; }
  #timeline .when span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #tLive { order: 1; }
  #tPlay { order: 2; }
  #resSeg { order: 3; }
  .track { order: 4; flex: 1 1 120px; }
  .track .ticks span:nth-child(2n) { display: none; }
  #panel { left: 10px; right: 10px; top: auto; bottom: 122px; width: auto; max-height: 55vh; }
  body.panel-open #board { display: none; }
  #toast { top: auto; bottom: 134px; }
  .about { padding: 20px 18px; }
}
@media (max-width: 359px) {
  .brand img { display: none !important; }
  .brand .mark { display: block !important; height: 32px; width: 32px; }
}
