/* Civic public-information theme: light chrome that matches the light basemap,
   one typeface (Public Sans), sentence case, colour reserved for severity. The
   only loud element is the pair of order/alert count blocks in the header. */
:root {
  --paper: #ffffff;
  --shelf: #f3f4f6;      /* sidebar + quiet fills */
  --shelf-2: #e9ebee;    /* hover */
  --rule: #d5d9de;
  --ink: #17212b;
  --ink-2: #4a5562;
  --ink-3: #6b7480;
  --order: #b3261e;      /* mandatory — signage red */
  --alert: #eba300;      /* be ready — signage amber (fills) */
  --alert-ink: #8a5a00;  /* amber dark enough for text on white */
  --fire: #d4511b;
  --road: #5b3b8c;       /* road closures — violet, distinct from severity */
  --ok: #2e7d4f;
  --focus: #1f5fbf;
  --shadow: 0 1px 2px rgba(23,33,43,.08), 0 4px 14px rgba(23,33,43,.10);
}
* { box-sizing: border-box; }
html, body {
  /* dvh: on iOS Safari, 100vh includes the area under the toolbar, which would
     hide the bottom of the map. */
  margin: 0; height: 100vh; height: 100dvh; overflow: hidden;
  background: var(--paper); color: var(--ink);
  font-family: "Public Sans", system-ui, sans-serif; font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Header ---------- */
#statusbar {
  display: flex; align-items: stretch; background: var(--paper);
  border-bottom: 1px solid var(--rule); z-index: 10;
}
/* Brand occupies the sidebar column; its right rule lines up with the sidebar's. */
.brand { width: 326px; flex-shrink: 0; border-right: 1px solid var(--rule);
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; }
.brand-logo { height: 26px; width: auto; display: block; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 700; }
.brand-text span { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.bar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 20px;
  padding: 10px 20px; }

/* Signature: solid severity blocks, like the coloured panels on a road sign. */
.stats { display: flex; gap: 8px; }
.stat { display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 12px;
  border-radius: 3px; }
.stat--order { background: var(--order); color: #fff; }
.stat--alert { background: var(--alert); color: #2b1d00; }
.snum { font-size: 26px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; }
.slabel { font-size: 13px; font-weight: 600; line-height: 1.15; }

.sync { margin-left: auto; display: flex; flex-direction: column; gap: 2px;
  align-items: flex-end; text-align: right; }
.sync-line { font-size: 13px; font-weight: 600; color: var(--ink); }
.sources { font-size: 12px; color: var(--ink-3); }
.sources.warn { color: var(--alert-ink); }

/* ---------- Map ---------- */
main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.map-wrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #eceff3; }

/* Hover tooltip (click still opens the full side panel). */
.maplibregl-popup.tip { font-family: "Public Sans", system-ui, sans-serif; }
.tip .maplibregl-popup-content {
  background: var(--paper); color: var(--ink); border: 1px solid var(--rule);
  border-radius: 3px; padding: 8px 11px; box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.35; }
.tip .t-title { font-weight: 700; }
.tip .t-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.tip .t-sub .o { color: var(--order); font-weight: 600; }
.tip .t-sub .a { color: var(--alert-ink); font-weight: 600; }
.tip .t-sub .f { color: var(--fire); font-weight: 600; }
.tip .t-sub .r { color: var(--road); font-weight: 600; }

/* ---------- Legend / layer toggles ---------- */
#legend { position: absolute; top: 12px; left: 12px; z-index: 5; width: 220px;
  display: flex; flex-direction: column; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 3px; box-shadow: var(--shadow);
  padding: 4px; }
.lyr { display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 13px; color: var(--ink-3); background: none; border: 0; border-radius: 2px;
  padding: 6px 10px 6px 8px; text-align: left; }
.lyr .sw { opacity: .35; }
.lyr.on { color: var(--ink); }
.lyr.on .sw { opacity: 1; }
.lyr:hover { background: var(--shelf); }
.sw { width: 14px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.sw--order { background: var(--order); }
.sw--alert { background: var(--alert); }
.sw--fire { width: 15px; height: 15px; background: no-repeat center / contain
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23d4511b' d='M12 1.5C13.2 5 16.5 7.6 17.8 11C19.4 15.2 17.2 21.5 12 21.5C6.8 21.5 4.6 16.8 6.2 12.8C6.9 11 8 10 8.6 8.2C9.4 10 9.2 11.4 10 12.4C10.4 8.6 11.4 5 12 1.5Z'/%3E%3Cpath fill='%23f6a04d' d='M12.3 12C13.6 13.6 15 15 14.6 17.4C14.3 19.2 13.2 20 12 20C10.6 20 9.6 19 9.6 17.5C9.6 15.9 11.2 14.8 12.3 12Z'/%3E%3C/svg%3E"); }
.sw--road { height: 4px; border-radius: 2px; background: var(--road); }
/* ECCC FireWork PM2.5 scale, sampled from its legend: 1–10 … 90–100, 100+.
   Hard stops, so each band reads as a step like the map tiles. */
.sw--smoke, .smoke-bar { background: linear-gradient(90deg,
  #21c5f4 0 9.09%, #1899c9 0 18.18%, #0d6796 0 27.27%, #fefc37 0 36.36%,
  #fecb2e 0 45.45%, #fd993f 0 54.54%, #fc6769 0 63.63%, #fe3b3b 0 72.72%,
  #fe0101 0 81.81%, #ca0713 0 90.9%, #650205 0); }
.smoke-key { padding: 0 10px 8px 31px; font-size: 12px; color: var(--ink-2); }
.smoke-key[hidden] { display: none; }
.smoke-key p { margin: 0; line-height: 1.35; }
.smoke-bar { height: 8px; margin-top: 5px; border-radius: 1px; opacity: .8; }
.smoke-ticks { position: relative; height: 15px; font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; }
.smoke-ticks span { position: absolute; top: 1px; }
.smoke-ticks span:last-child { transform: translateX(-30%); }
.smoke-key .smoke-unit { color: var(--ink-3); font-size: 11px; }
#zoom-all { margin-top: 4px; padding: 7px 10px; cursor: pointer; font-size: 13px;
  color: var(--ink-2); background: none; border: 0; border-top: 1px solid var(--rule);
  border-radius: 0; text-align: left; }
#zoom-all:hover { color: var(--ink); background: var(--shelf); }

/* ---------- Empty / error overlay ---------- */
#overlay { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  pointer-events: none; }
#overlay[hidden] { display: none; }
.overlay-card { background: var(--paper); border: 1px solid var(--rule);
  border-left: 4px solid var(--ink-3); border-radius: 3px; padding: 14px 18px;
  box-shadow: var(--shadow); font-size: 14px; max-width: 420px; line-height: 1.5; }
.overlay-card.warn { border-left-color: var(--alert); }

/* ---------- Detail panel ---------- */
#panel { position: absolute; top: 0; right: 0; bottom: 0; width: 360px; max-width: 86vw;
  z-index: 7; background: var(--paper); border-left: 1px solid var(--rule);
  box-shadow: -6px 0 24px rgba(23,33,43,.12); overflow-y: auto;
  transform: translateX(0); transition: transform .2s ease; }
#panel[hidden] { display: block; transform: translateX(102%); }
#panel-close { position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 30px; height: 30px; border-radius: 3px; cursor: pointer;
  background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; }
#panel-close:hover { color: var(--ink); background: var(--shelf); }
#panel-body { padding: 20px 22px 28px; }
.p-tag { display: inline-block; font-size: 13px; font-weight: 700;
  padding: 3px 9px; border-radius: 2px; margin-bottom: 12px; }
.p-tag.order, .p-tag.tactical { background: var(--order); color: #fff; }
.p-tag.alert { background: var(--alert); color: #2b1d00; }
.p-tag.all_clear { background: var(--ink-3); color: #fff; }
.p-tag.fire { background: var(--fire); color: #fff; }
.p-tag.road-closed { background: var(--road); color: #fff; }
.p-tag.road { background: var(--paper); color: var(--road); box-shadow: inset 0 0 0 1.5px var(--road); }
.p-desc { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink); }
#panel h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; line-height: 1.25;
  padding-right: 34px; }
.p-event { font-size: 14px; color: var(--ink-2); margin: 0 0 14px; }
/* Key/value pairs as a plain definition list, ruled between rows. */
.p-grid { display: flex; flex-direction: column; margin-top: 10px;
  border-top: 1px solid var(--rule); }
.p-cell { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0;
  border-bottom: 1px solid var(--rule); font-size: 14px; }
.p-cell .k { color: var(--ink-3); flex-shrink: 0; }
.p-cell .v { color: var(--ink); font-weight: 600; text-align: right; }
.p-link { display: block; margin-top: 18px; text-align: center; text-decoration: none;
  font-size: 14px; font-weight: 600; color: #fff; background: var(--ink);
  border-radius: 3px; padding: 11px; }
.p-link:hover { background: #2c3a48; }
.p-share { display: block; width: 100%; margin-top: 8px; padding: 10px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink); background: var(--paper);
  border: 1px solid #b9bfc6; border-radius: 3px; }
.p-share:hover { background: var(--shelf); }
.p-note { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.p-precision { color: var(--alert-ink); }

/* ---------- Disclaimer ---------- */
#disclaimer { margin: 0; padding: 6px 14px; font-size: 11.5px; line-height: 1.4;
  color: var(--ink-2); background: var(--paper); border-top: 1px solid var(--rule);
  text-align: center; }

.maplibregl-ctrl-attrib { background: rgba(255,255,255,.85) !important; }
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }

/* ---------- Layout: header / left sidebar / map ---------- */
/* Positioned so the phone drawer opens *below* the header (keeping ☰ reachable). */
#layout { position: relative; flex: 1; display: flex; min-height: 0; }
.scrim, .sidebar-close { display: none; }
.iconbtn { width: 32px; height: 32px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  color: var(--ink-2); cursor: pointer; font-size: 15px; }
.iconbtn:hover { color: var(--ink); background: var(--shelf); }
#about-btn { font-family: Georgia, serif; font-style: italic; font-weight: 700; }
.textbtn { height: 32px; padding: 0 11px; flex-shrink: 0; cursor: pointer;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  color: var(--ink-2); font-size: 13px; font-weight: 600; }
.textbtn:hover { color: var(--ink); background: var(--shelf); }
#menu-toggle { display: none; }   /* shown on mobile */

#sidebar { width: 326px; flex-shrink: 0; background: var(--shelf);
  border-right: 1px solid var(--rule); display: flex; flex-direction: column;
  overflow-y: auto; }
.side-sec { padding: 16px 18px; border-bottom: 1px solid var(--rule); }
.side-sec.list-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column;
  padding-bottom: 8px; border-bottom: 0; }
.side-label { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 10px; }

/* search + locate */
.search-row { display: flex; gap: 6px; align-items: stretch; }
.search-input-wrap { position: relative; flex: 1; min-width: 0; display: flex; }
#place-search { flex: 1; min-width: 0; background: var(--paper); color: var(--ink);
  border: 1px solid #b9bfc6; border-radius: 3px; padding: 9px 34px 9px 11px;
  font-size: 14px; font-family: inherit; }
#place-search::placeholder { color: var(--ink-3); }
#place-search:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: var(--focus); }
#place-search::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; display: grid; place-items: center; cursor: pointer;
  background: var(--shelf); border: 0; border-radius: 50%;
  color: var(--ink-2); font-size: 10px; line-height: 1; }
.search-clear:hover { color: var(--ink); background: var(--shelf-2); }
.search-clear[hidden] { display: none; }
#search-go { width: 40px; height: auto; align-self: stretch; font-size: 17px; }
.suggest { list-style: none; margin: 6px 0 0; padding: 0; border: 1px solid var(--rule);
  border-radius: 3px; overflow: hidden; background: var(--paper); box-shadow: var(--shadow); }
.suggest[hidden] { display: none; }
.suggest li { padding: 8px 11px; font-size: 13px; line-height: 1.35; color: var(--ink-3);
  cursor: pointer; border-bottom: 1px solid var(--rule); }
.suggest li:last-child { border-bottom: 0; }
.suggest li:hover, .suggest li.active { background: var(--shelf); }
.suggest li .sg-main { color: var(--ink); font-weight: 600; }

.locate-btn { width: 100%; margin-top: 8px; padding: 9px; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 1px solid #b9bfc6;
  border-radius: 3px; font-size: 14px; font-weight: 600; }
.locate-btn:hover { background: var(--shelf-2); }
.locate-btn.busy { color: var(--ink-3); }
#locate-result { margin-top: 12px; padding: 11px 13px; border-radius: 3px; font-size: 13.5px;
  line-height: 1.45; background: var(--paper); border: 1px solid var(--rule);
  border-left: 4px solid var(--ink-3); }
#locate-result[hidden] { display: none; }
#locate-result.order { border-left-color: var(--order); }
#locate-result.alert { border-left-color: var(--alert); }
#locate-result.safe { border-left-color: var(--ok); }
#locate-result .lr-title { font-weight: 700; margin-bottom: 3px; display: block; }
#locate-result.order .lr-title { color: var(--order); }
#locate-result.alert .lr-title { color: var(--alert-ink); }
#locate-result .lr-place { display: block; font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
#locate-result .lr-sub { display: block; color: var(--ink-2); }
#locate-result .lr-air { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-2); }
#locate-result .lr-air .air-title { display: block; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
#locate-result .lr-air ul { list-style: none; margin: 0 0 6px; padding: 0; }
#locate-result .lr-air li { display: flex; align-items: center; gap: 7px; padding: 2px 0; }
#locate-result .lr-air li strong { color: var(--ink); font-weight: 600; }
#locate-result .air-sw { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
#locate-result .air-meta { display: block; font-size: 12px; color: var(--ink-3); }
#locate-result .air-link { display: inline-block; margin-top: 4px; font-size: 12.5px;
  font-weight: 600; color: var(--focus); }
#locate-result .air-loading { font-size: 12.5px; color: var(--ink-3); }
#locate-result .lr-link { display: block; margin-top: 8px; color: var(--focus);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: none; border: 0; padding: 0; text-decoration: underline; text-align: left; }

/* province / territory switcher */
label.side-label { display: block; }
.prov-select { width: 100%; padding: 9px 32px 9px 11px; cursor: pointer;
  font-family: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid #b9bfc6; border-radius: 3px; appearance: none;
  background: var(--paper) no-repeat right 11px center / 10px 6px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234a5562' stroke-width='1.5'/%3E%3C/svg%3E"); }
.prov-select:hover { background-color: var(--shelf-2); }

/* active-evacuations list: ruled rows, a severity bar on the left */
#orders-list { overflow-y: auto; flex: 1; min-height: 0; display: flex;
  flex-direction: column; margin: 0 -18px; border-top: 1px solid var(--rule); }
.olist-item { display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--paper); border: 0; border-bottom: 1px solid var(--rule);
  border-left: 4px solid var(--ink-3); padding: 11px 18px 11px 14px; color: var(--ink); }
.olist-item:hover { background: var(--shelf-2); }
.olist-item:focus-visible { outline-offset: -2px; }
.olist-item.order { border-left-color: var(--order); }
.olist-item.alert { border-left-color: var(--alert); }
.olist-item .oi-title { font-size: 14px; font-weight: 600; line-height: 1.3; }
.olist-item .oi-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.olist-item .oi-tag { font-weight: 700; }
.olist-item.order .oi-tag { color: var(--order); }
.olist-item.alert .oi-tag { color: var(--alert-ink); }
/* wildfires of note */
.notable { display: flex; flex-direction: column; gap: 6px; }
.notable-item { display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  cursor: pointer; background: var(--paper); border: 1px solid var(--rule);
  border-left: 4px solid var(--fire); border-radius: 2px; padding: 8px 11px; color: var(--ink); }
.notable-item:hover { background: var(--shelf-2); }
.notable-item .ni-name { font-size: 14px; font-weight: 600; }
.notable-item .ni-sub { font-size: 12.5px; color: var(--ink-3); }
.olist-empty { font-size: 13.5px; color: var(--ink-2); padding: 12px 18px; line-height: 1.5; }

/* fires loading chip */
.loading-chip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 6; display: flex; align-items: center; gap: 8px; font-size: 13px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule);
  border-radius: 3px; box-shadow: var(--shadow); padding: 6px 12px; }
.loading-chip[hidden] { display: none; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--rule);
  border-top-color: var(--fire); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* "me" location marker pin */
.me-marker { width: 16px; height: 16px; border-radius: 50%; background: var(--focus);
  border: 2px solid #fff; box-shadow: 0 0 0 4px rgba(31,95,191,.25), 0 1px 4px rgba(0,0,0,.3); }

/* About dialog */
#about { width: min(560px, 92vw); border: 1px solid var(--rule); border-radius: 4px;
  background: var(--paper); color: var(--ink); padding: 24px 28px 22px; position: relative;
  box-shadow: 0 12px 40px rgba(23,33,43,.25); }
#about::backdrop { background: rgba(23,33,43,.45); }
#about h2 { margin: 0 0 12px; font-size: 21px; font-weight: 700; }
#about h3 { margin: 20px 0 6px; font-size: 15px; font-weight: 700; }
#about p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.55; max-width: 62ch; }
#about ul { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
#about .about-warn { background: #fff7e0; border-left: 4px solid var(--alert);
  border-radius: 2px; padding: 10px 13px; font-size: 14px; }
#about .about-feedlang { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
#about .about-foot { margin-top: 18px; font-size: 12px; color: var(--ink-3); }
#about-close { position: absolute; top: 16px; right: 16px; }

/* ---------- Embed (?embed=1) ---------- */
.embed-open { display: none; }
.embed #statusbar, .embed #sidebar, .embed #zoom-all, .embed .locate-btn { display: none; }
.embed .embed-open { display: block; position: absolute; top: 10px; right: 10px; z-index: 6;
  background: var(--ink); color: #fff; text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 7px 11px; border-radius: 3px; box-shadow: var(--shadow); }
.embed .embed-open:hover { background: #2c3a48; }
.embed #legend { top: 10px; left: 10px; width: 190px; }
#about .about-small { font-size: 13.5px; color: var(--ink-2); }
.embed-row { display: flex; gap: 8px; margin: 8px 0; }
.embed-row .prov-select { flex: 1; }
.embed-code { width: 100%; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-2); background: var(--shelf); border: 1px solid var(--rule);
  border-radius: 3px; padding: 8px; resize: vertical; }

/* ---------- Season statistics dialog ---------- */
#stats { width: min(620px, 94vw); border: 1px solid var(--rule); border-radius: 4px;
  background: var(--paper); color: var(--ink); padding: 24px 28px 22px;
  box-shadow: 0 12px 40px rgba(23,33,43,.25); }
#stats::backdrop { background: rgba(23,33,43,.45); }
#stats h2 { margin: 0 0 14px; font-size: 21px; font-weight: 700; }
#stats h3 { margin: 22px 0 8px; font-size: 15px; font-weight: 700; }
#stats-close { position: absolute; top: 16px; right: 16px; }
.st-hero { display: flex; flex-direction: column; gap: 2px; }
.st-value { font-size: 48px; font-weight: 700; line-height: 1.05; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; }
.st-label { font-size: 15px; color: var(--ink-2); }
.st-sub { font-size: 13px; color: var(--ink-3); }
.st-compare { margin: 12px 0 0; font-size: 15px; font-weight: 600; }
/* Bars = this year (fire orange), ticks = 5-year average (blue). Validated pair. */
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px;
  color: var(--ink-2); margin-bottom: 8px; }
.st-legend span { display: inline-flex; align-items: center; gap: 7px; }
.st-key-bar { width: 14px; height: 10px; background: #d4511b; border-radius: 0 2px 2px 0; }
.st-key-tick { width: 3px; height: 14px; background: #2f6db5; border-radius: 1px; }
.st-chart { position: relative; display: flex; flex-direction: column; gap: 2px; }
/* Values sit in their own right-hand column, so an average tick can never
   cross a label (it did when labels rode the bar tips). */
.st-row { display: grid; grid-template-columns: 175px 1fr 52px;
  grid-template-areas: "name track value"; align-items: center; column-gap: 10px;
  padding: 3px 4px; border-radius: 2px; cursor: default; }
.st-row:hover, .st-row:focus-visible { background: var(--shelf); }
.st-name { grid-area: name; font-size: 13px; color: var(--ink); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.st-track { grid-area: track; position: relative; height: 18px; border-left: 1px solid var(--rule); }
.st-bar { position: absolute; left: 0; top: 3px; height: 12px; background: #d4511b;
  border-radius: 0 4px 4px 0; }
.st-tick { position: absolute; top: 0; width: 3px; height: 18px; margin-left: -1.5px;
  background: #2f6db5; border-radius: 1px; box-shadow: 0 0 0 2px var(--paper); }
.st-val { grid-area: value; text-align: right; font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-tooltip { position: absolute; z-index: 2; max-width: 300px; pointer-events: none;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  box-shadow: var(--shadow); padding: 7px 10px; font-size: 12.5px; line-height: 1.4; }
.st-tooltip[hidden] { display: none; }
.st-table { margin-top: 14px; font-size: 13px; }
.st-table summary { cursor: pointer; color: var(--focus); font-weight: 600; }
.st-table table { width: 100%; margin-top: 8px; border-collapse: collapse;
  font-variant-numeric: tabular-nums; }
.st-table th, .st-table td { text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--rule); }
.st-table th:first-child, .st-table td:first-child { text-align: left; }
.st-note { margin: 14px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-3); }
/* Phones: full name + value on one line, a full-width bar beneath it. */
@media (max-width: 560px) {
  .st-row { grid-template-columns: 1fr auto; grid-template-areas: "name value" "track track";
    row-gap: 3px; padding: 5px 4px; }
  .st-name { white-space: normal; font-size: 13.5px; }
  .st-val { font-size: 13px; }
  .st-value { font-size: 40px; }
  .st-table table { font-size: 12.5px; }
  .st-table th, .st-table td { padding: 5px 4px; }
}

/* ---------- Mobile (iPhone 12 mini 375px … Pro Max ~440px) ---------- */
.legend-toggle { display: none; }
@media (max-width: 760px) {
  /* Header as two rows: [menu logo · Season FR i] / [counts · updated]. */
  #statusbar { display: grid; align-items: center; column-gap: 8px; row-gap: 6px;
    grid-template-columns: auto auto 1fr auto auto auto;
    grid-template-areas: "menu brand . season lang about" "stats stats stats sync sync sync";
    padding: 6px 10px 8px; }
  .bar-main { display: contents; }
  #menu-toggle { grid-area: menu; display: grid; margin: 0; }
  .brand { grid-area: brand; width: auto; border-right: 0; padding: 0; }
  .brand-logo { height: 22px; }
  .brand-text { display: none; }
  .stats { grid-area: stats; }
  .sync { grid-area: sync; margin-left: 0; }
  #stats-btn { grid-area: season; }
  #lang-toggle { grid-area: lang; }
  #about-btn { grid-area: about; }
  .stat { padding: 4px 9px 4px 8px; gap: 6px; }
  .snum { font-size: 20px; }
  .slabel { font-size: 11px; }
  .sources { display: none; }
  .sync-line { font-size: 12px; font-weight: 500; color: var(--ink-2); }
  .textbtn { padding: 0 9px; }

  /* iOS zooms the page when focusing inputs under 16px. */
  #place-search, .prov-select { font-size: 16px; }

  /* Data credits live in About on phones; the bar keeps the disclaimer only. */
  #disclaimer .disc-credit { display: none; }

  #panel { width: 100%; max-width: 100%; }

  /* Legend collapses to one "Layers" button at the bottom-left. */
  #legend { top: auto; bottom: 10px; left: 10px; width: auto; max-width: calc(100% - 70px); }
  .legend-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer;
    font-size: 14px; font-weight: 600; color: var(--ink); background: none; border: 0;
    padding: 7px 10px; }
  #legend:not(.open) > :not(.legend-toggle) { display: none; }
  #legend.open .legend-toggle { border-bottom: 1px solid var(--rule); border-radius: 0; }
  .lyr { padding: 9px 10px 9px 8px; font-size: 14px; }
  #zoom-all { padding: 9px 10px; font-size: 14px; }
  .smoke-key { max-width: 240px; }

  #about, #stats { padding: 20px 18px 18px; max-height: 88dvh; overflow-y: auto; }
  #menu-toggle { display: grid; align-self: center; margin-left: 10px; }
  #sidebar { position: absolute; top: 0; left: 0; bottom: 0; width: 86vw; max-width: 340px;
    z-index: 20; transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: 6px 0 24px rgba(23,33,43,.2); }
  #sidebar.open { transform: translateX(0); }
  .scrim { display: block; position: absolute; inset: 0; z-index: 19;
    background: rgba(23,33,43,.35); }
  .scrim[hidden] { display: none; }
  .sidebar-close { display: block; align-self: flex-end; margin: 10px 12px 0 0;
    padding: 8px 12px; cursor: pointer; font-size: 15px; font-weight: 600;
    color: var(--ink); background: var(--paper); border: 1px solid #b9bfc6; border-radius: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  #panel, #sidebar { transition: none; }
  .spinner { animation-duration: 2s; }
}
