/* Ignopticon Ops: fire list and incident panel beside (desktop) or under (phone/tablet) a satellite map.
   One stylesheet, top to bottom: tokens, page grid, panel, fire card, map controls, map overlays, breakpoints. */

/* ---- Tokens ---- */
:root {
  --bg:#0E1116; --panel:#15231f; --raise:#21332c; --line:#45564d; --text:#F2F4F7; --muted:#B4BEC9;
  --brand-bar:#162c25; --sheet-edge:#98ab94;
  --focus:#5AB0FF; --red:#FF453A; --redtext:#FF8A80; --amber:#FF9F0A; --gold:#FFD27A; --case:#0B0D10; --past:#FFD649;
  --fc:#C75AF5;  /* forecast: the middle band colour, for every forecast frame */
  /* Map pills (search, Home/Back, Labels, 2D | 3D) and map panels (Key, timeline). */
  --pill:#15231ff2; --pill-line:#93a397; --pill-on:#E8EDF3; --pill-on-text:#0E1116; --pill-shadow:0 2px 12px #0005;
  --overlay:rgba(14,17,22,0.92);
  color-scheme:dark;
}
*{box-sizing:border-box}
html{scrollbar-color:var(--line) transparent}
::selection{background:#FF453A55;color:#fff}
button,input,select{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.muted{color:var(--muted)}
.error{color:#FFB4AB}
.ico{width:18px;height:18px;flex:none}
[hidden]{display:none !important}

/* ---- Page grid: brand bar, then map over the panel (phone/tablet) or panel beside the map (desktop) ---- */
body{
  margin:0;height:100dvh;overflow:hidden;display:grid;grid-template-columns:minmax(0,1fr);
  grid-template-rows:auto minmax(0,56fr) minmax(0,44fr);
  background:var(--brand-bar);color:var(--text);font:1rem/1.45 system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
body.selected{grid-template-rows:auto minmax(0,1fr) minmax(0,1fr)}
.fresh{grid-row:1;display:flex;justify-content:space-between;align-items:center;min-height:32px;padding:4px max(22px,env(safe-area-inset-right)) 4px 22px;
  background:var(--brand-bar);color:#e2efe5;font:600 12px/1.4 system-ui}
.fresh-r{display:flex;gap:16px;align-items:center;white-space:nowrap}
.navlink{color:#e2efe5;font-weight:700;text-decoration:none;border-bottom:2px solid #e2efe5aa}.navlink:hover{border-bottom-color:#fff}
.wordmark{font-size:14px;font-weight:800;letter-spacing:.06em}
.refresh-wrap{position:relative;display:grid;justify-items:end}
.app-actions{display:flex;gap:6px}
.refresh-wrap button{min-height:32px;padding:0 10px;border:1px solid var(--pill-line);border-radius:6px;background:var(--raise);color:#fff;font:600 12px system-ui}
.refresh-wrap button:hover{border-color:#cfd8d3}
.refresh-wrap button.offline{border-color:var(--red);box-shadow:0 0 0 1px var(--red)}
.refresh-wrap span{min-height:0;color:var(--redtext);font-size:11px;font-weight:800;letter-spacing:.08em}
/* Phones: the bar keeps one line; the update note gives way to the buttons unless it says OFFLINE. */
@media (max-width:600px){
  .fresh{padding-left:16px;padding-right:max(16px,env(safe-area-inset-right))}
  .fresh-r{gap:10px}
  #fresh:not(.offline){display:none}
}
.mapwrap{grid-row:2;grid-column:1;position:relative;overflow:hidden}
/* z-index 0 makes the map (and the wind canvas inside it) its own layer, so every panel and menu over the map stays on top. */
.map{position:absolute;inset:0;z-index:0;background:#1B2027}
.sidebar{grid-row:3;grid-column:1;overflow-y:auto;background:var(--panel);border-top:3px solid var(--sheet-edge);
  padding:8px max(8px,calc((100% - 960px)/2)) max(14px,env(safe-area-inset-bottom))}

/* ---- Panel: fire overview ---- */
.brand{padding:12px 16px 8px}
.brand h1{margin:0;font-size:1.65rem;letter-spacing:.02em}
/* Date and Sort by: label column, control column. */
.order{display:grid;grid-template-columns:52px minmax(0,1fr);align-items:center;gap:8px;margin:0 16px 8px}
.flabel{font-size:.85rem;color:var(--muted)}
.ctl{display:flex;align-items:center;gap:8px;min-width:0}
.ctl > select{flex:1}
.today{padding:6px 10px;background:none;border:1px solid transparent;border-radius:6px;color:#9FD3FF;font-size:.85rem}
.today:hover{border-color:var(--line)}
.today[aria-pressed="true"]{background:var(--raise);border-color:var(--line);color:var(--text);font-weight:600}
.order select,.ctlrow select{min-width:0;background:var(--raise);border:1px solid var(--line);border-radius:6px;padding:8px;color:inherit}
.count{margin:8px 16px;color:var(--muted);font-size:.9rem}
.count:empty{display:none}
.list{list-style:none;margin:0;padding:0}
.fire{display:grid;gap:2px;width:100%;min-height:44px;margin:0;padding:12px 13px;text-align:left;
  background:transparent;border:0;border-bottom:1px solid var(--line);color:inherit}
.fire:hover{background:#1b2b25}
.fire[aria-current]{background:var(--raise)}
.fire[aria-current] .nm{color:#fff}
.r1,.r2,.r3{display:flex;gap:10px;align-items:baseline;justify-content:space-between}
.r2,.r3{font-size:.9rem}
.r3{justify-content:flex-start;margin-top:3px;color:var(--muted)}
.r3:empty{display:none}
.nm{font-weight:650;font-size:1.05rem}
.st{color:var(--muted);font-weight:600}
.ac{font-size:1.15rem;font-weight:700;font-variant-numeric:tabular-nums}
.ac small{font-size:1rem;font-weight:500;color:var(--muted)}
.gr{color:var(--muted);font-variant-numeric:tabular-nums;text-align:right}
.up{color:var(--redtext);font-weight:600}
.new{color:var(--gold);font-weight:600}
.badge{background:var(--amber);color:#111;font-weight:700;border-radius:4px;padding:0 8px}
/* Overview: Track Fires · Date / Sort by · the fire list · Wind/Model. The panel scrolls as one; on desktop the list
   is its own scroll box (see Breakpoints) so Wind/Model stay in view. */
body:not(.selected) .fires .list{margin:0 16px;border:1px solid var(--line);border-radius:8px}
body:not(.selected) .fires .list:empty{display:none}
.layerctl{display:grid;gap:8px;margin:12px 16px 14px}
.ctlrow{display:grid;grid-template-columns:52px 1fr;align-items:center;gap:2px 8px}
.ctlrow label{color:var(--muted);font-size:.9rem}
.ctlrow select{padding:7px 8px}
.ctlrow select:disabled{opacity:.5}
.ctlrow small{grid-column:2;color:var(--muted);font-size:.8rem}
.ctlrow small:empty{display:none}

/* ---- Panel: selected fire ---- */
.selected .fires,.selected .brand{display:none}  /* the fire's name takes the title's place */
.detail{padding:4px 16px 16px;border-bottom:1px solid var(--line)}
.detail h2{margin:8px 0 0;font-size:1.65rem;line-height:1.2}
.detail p{margin:4px 0}
.back{display:none}
.fc,.nofc{margin:12px 0;padding:12px;border-radius:8px}
.fc{border:2px solid var(--fc);background:#271e2d}
.nofc{border:2px dashed #8A94A3;background:var(--raise)}
.nofc h3{margin:0 0 4px;font-size:1.1rem}
.fc ul{margin:4px 0 8px;padding-left:20px}
.fc summary{min-height:36px;font-weight:600}
/* The warning closes the forecast box: a rule and warm text, not a second box inside it. */
.disclaimer{margin:10px 0 0 !important;padding-top:10px;border-top:1px solid #FFD27A55;color:#FFE3A8}
/* Disclosures (Data sources, Key, Forecast details): a drawn chevron that turns when open. */
.sources{margin:6px 16px 0;color:var(--muted)}
.sources summary,.keybox summary,.fc summary{display:flex;align-items:center;gap:8px;cursor:pointer;list-style:none}
:is(.sources,.keybox,.fc) summary::-webkit-details-marker{display:none}
.sources summary::before,.keybox summary::before,.fc summary::before{content:"";width:6px;height:6px;flex:none;margin:0 2px 0 1px;
  border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:rotate(-45deg);transition:transform .15s ease-out}
.sources details[open] > summary::before,.keybox[open] > summary::before,.fc details[open] > summary::before{transform:rotate(45deg)}
.sources summary{min-height:44px;color:var(--text)}
.sources summary:hover{color:#fff;text-decoration:underline;text-underline-offset:3px}
.sources ul{margin:0 0 8px;padding-left:20px;font-size:.9rem}
.conditions{display:none;margin:14px 16px}
.selected .conditions{display:block}
.conditions h2,.conditions dl,.conditions dd{margin:0}
.conditions h2{font-size:1.17rem}
.conditions h2 small{font-size:.8rem;font-weight:400;color:var(--muted)}
.conditions dl{display:grid;gap:6px;padding:8px 0}
.conditions dl div{display:grid;grid-template-columns:4.5rem minmax(0,1fr);gap:8px;align-items:baseline}
.conditions dt{color:var(--muted);font-size:.9rem}
.upload{position:relative;display:inline-flex;align-items:center;min-height:44px;margin:4px 4px 4px 0;padding:6px 12px;
  background:var(--raise);border:1px solid var(--line);border-radius:6px;cursor:pointer}
.upload input{position:absolute;inset:0;width:100%;opacity:0;cursor:pointer}
.upload:focus-within{outline:2px solid var(--focus)}
/* Incident text is for reading: allow press-and-hold copy on phones. */
.detail,.navpanel,.conditions,.legend{-webkit-user-select:text;user-select:text}

/* ---- Map: search, Home/Back (top left) ---- */
.controls,.mapnav{position:absolute;left:12px;top:12px;right:70px;max-width:640px;z-index:2}
.controls input,.mapnav button{min-height:46px;background:var(--pill);color:#fff;border:1px solid var(--pill-line);border-radius:12px;box-shadow:var(--pill-shadow)}
.controls input{width:100%;padding:0 16px;caret-color:var(--red)}
.mapnav{display:none;gap:6px}
.selected .mapnav{display:flex}
.mapnav button{display:inline-flex;align-items:center;gap:6px;padding:0 14px}

/* ---- Map: zoom group with "My location" (top right), dressed like the other map pills ---- */
.maplibregl-ctrl-top-right{top:0}
.maplibregl-ctrl-top-right .maplibregl-ctrl-group:not(:empty){overflow:hidden;background:var(--pill);border:1px solid var(--pill-line);border-radius:12px;box-shadow:var(--pill-shadow)}
.maplibregl-ctrl-group button{width:44px;height:44px}
.maplibregl-ctrl-group button + button,.maplibregl-ctrl-group #locate{border-top:1px solid var(--line)}
.maplibregl-ctrl-group button .maplibregl-ctrl-icon{filter:invert(1) brightness(1.15)}  /* MapLibre's dark-grey glyphs, made light */
.maplibregl-ctrl-group button:not(:disabled):hover{background:var(--raise)}
.maplibregl-ctrl-group #locate{display:grid;place-items:center;padding:0;border-radius:0;background:none;color:#fff}
/* 2D: rotation is off, so no compass. */
.flat .maplibregl-ctrl-compass{display:none}
.gpsdot{width:19px;height:19px;border-radius:50%;background:#ff3636;border:3px solid #fff;box-shadow:0 0 0 5px #ca23234d}

/* ---- Map: bottom-right row: Labels · 2D | 3D · credit, scale bar above it (right-aligned, grows left) ---- */
.maplibregl-ctrl-bottom-right{display:flex;align-items:center;gap:8px;padding:0 12px 12px 0}
.maplibregl-ctrl-bottom-right > .maplibregl-ctrl{float:none;clear:none;margin:0}
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale{position:absolute;right:12px;bottom:64px;margin:0}
.labelsbtn,.viewtoggle{height:44px;background:var(--pill);border:1px solid var(--pill-line);border-radius:12px;box-shadow:var(--pill-shadow);color:#fff}
.labelsbtn{padding:0 14px;font-weight:600}
.viewtoggle{display:flex;overflow:hidden}
.viewtoggle button{min-width:46px;padding:0 12px;border:0;background:none;color:#fff;font-weight:600}
.labelsbtn[aria-pressed="true"],.viewtoggle button[aria-pressed="true"]{background:var(--pill-on);color:var(--pill-on-text)}
/* The open credit pops up above the row instead of widening it; the ⓘ stays in place. */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib{position:relative}
.maplibregl-ctrl-attrib.maplibregl-compact-show{width:24px;height:24px;min-height:24px;padding:0;background:none}
.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{position:absolute;right:0;bottom:32px;width:max-content;
  max-width:min(320px,calc(100vw - 24px));padding:6px 10px;background:#fff;border-radius:8px;box-shadow:0 2px 8px #0006;white-space:normal}

/* ---- Map: bottom-left stack: Key above the timeline ---- */
.bottom{position:absolute;left:12px;bottom:12px;max-width:calc(100% - 420px);display:flex;flex-direction:column;align-items:flex-start;gap:8px;pointer-events:none}
.bottom > *{pointer-events:auto}
.keybox{max-width:min(360px,calc(100vw - 24px));background:var(--overlay);border:1px solid var(--line);border-radius:10px}
.keybox summary{min-height:36px;padding:6px 12px;font-size:.9rem;font-weight:600}
.legend{max-height:45vh;overflow-y:auto;padding:0 4px 6px}
.legend ul{list-style:none;margin:0;padding:0}
.legend .s{display:none}
.legend .l{font-size:.85rem;line-height:1.3}
.legend li button{display:flex;gap:8px;align-items:center;width:100%;min-height:34px;padding:2px 8px;text-align:left;background:none;border:0;border-radius:6px;font-size:.88rem}
.legend li button:hover{background:var(--raise)}
.legend li button[aria-pressed="false"]{color:var(--muted);text-decoration:line-through}
.legend li button[aria-pressed="false"] :is(.sw,.sw-fc){opacity:.25}
.legend .none button{color:var(--muted)}
.legend .none .sw-fc{opacity:.25}
.sw{flex:none;display:inline-block;width:28px;height:16px;border-radius:3px}
.sw-cur{background:rgba(255,69,58,.2);border:3px solid var(--red);box-shadow:0 0 0 2px var(--case)}
.sw-prev{height:5px;background:linear-gradient(90deg,#995B30,#FFD649)}
.sw-fc{display:inline-flex;gap:2px;flex:none}
.sw-fc .sw{width:14px;border:2px solid var(--case);background-image:repeating-linear-gradient(135deg,rgba(0,0,0,.5) 0 2px,transparent 2px 6px)}
.sw-b0{background-color:#FF45C6}
.sw-b1{background-color:#C75AF5}
.sw-b2{background-color:#9464FF}
.sw-worst{background:rgba(255,69,198,.12);border:2px dashed #ff9be0}
.sw-phys{background:none;border:2px dotted #9aa4b2}
.sw-faint{background:#bb5cf533;border:1px dashed #ce75ef}
.sw-hot{width:12px;height:12px;margin:0 8px;border-radius:50%;background:#fff;border:1px solid var(--case)}
.sw-pop{background:linear-gradient(90deg,#FFEDA0,#FEB24C,#F03B20,#A50F5A,#3C005A)}
.popnote{margin:0 8px 6px;font-size:.72rem;color:var(--muted)}
.popbar{display:block;height:8px;border-radius:2px;background:linear-gradient(90deg,#FFEDA0,#FEB24C,#F03B20,#A50F5A,#3C005A)}
.poptk{display:flex;justify-content:space-between;font-style:normal}
.poptk i{font-style:normal}
.people{margin:4px 0;font-size:.85rem}
.sw-act{background:#FFB02038;border:2px dashed #FFB020}
.tl-mini{display:flex;align-items:center;gap:4px;max-width:100%;min-height:44px;padding:3px;background:var(--overlay);border:1px solid var(--line);border-radius:10px}
.tl-mini .stops{display:flex;gap:4px;margin:0;padding:0;list-style:none;overflow-x:auto;scrollbar-width:none}
.tl-mini button{height:36px;padding:0 10px;border:1px solid var(--line);border-radius:7px;background:none;color:var(--text);font-size:.8rem;white-space:nowrap}
.tl-mini .stop button{border-bottom:3px solid var(--stop-color)}
.tl-mini .stop.now button{font-weight:700}
.tl-mini button[aria-pressed="true"]{background:var(--pill-on);color:var(--pill-on-text)}
.tl-mini .tl-h{padding:0 4px 0 6px;color:var(--muted);font-size:.7rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase}
.tl-mini .showall{font-weight:800}
/* The forecast is its own bar framed in the forecast colour, so it never reads as part of the observed record. */
.fcbar{flex-wrap:wrap;border:2px solid var(--fc)}
.tl-mini #compare:disabled{opacity:.45;cursor:not-allowed}
/* contain: the readout wraps to the buttons' width instead of widening the bar. */
.fc-read{flex-basis:100%;contain:inline-size;margin:0;padding:0 6px 2px;font-size:.75rem;color:var(--muted)}
.fc-read:empty{display:none}
.fc-read span{display:block}
.fc-read b{color:var(--text)}
.fc-read .obs::before{content:"";display:inline-block;width:12px;margin-right:6px;vertical-align:middle;border-top:2px dotted #F0A8FF}

/* ---- Map: wind particles (wind.js), a canvas that never takes clicks ---- */
.wind-canvas{position:absolute;inset:0;z-index:1;pointer-events:none}

/* ---- Breakpoints ---- */
/* Too narrow for the timeline beside the controls row: it sits just above them, and touch targets grow. */
@media (max-width:820px){
  .bottom{bottom:68px;max-width:calc(100% - 24px)}
  .tl-mini button{height:40px}
}
/* Desktop: panel beside the map; in the overview the fire list is its own scroll box between the controls. */
@media (min-width:1100px) and (min-aspect-ratio:4/3){
  body,body.selected{grid-template-columns:minmax(320px,380px) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr)}
  .fresh{grid-column:1/-1}
  .sidebar{grid-column:1;grid-row:2;padding:12px 6px;border-top:0;border-right:1px solid var(--line)}
  .mapwrap{grid-column:2;grid-row:2}
  body:not(.selected) .sidebar{display:flex;flex-direction:column;overflow:hidden}
  body:not(.selected) .sidebar > *{flex:none}
  body:not(.selected) .sidebar > .fires{flex:1 1 auto;min-height:140px;display:flex;flex-direction:column}
  body:not(.selected) .fires .list{flex:1;min-height:0;overflow-y:auto}
}
@media (min-width:1100px) and (min-aspect-ratio:4/3) and (max-width:1240px){.bottom{bottom:68px;max-width:calc(100% - 24px)}}
@media (prefers-reduced-motion:reduce){:is(.sources,.keybox,.fc) summary::before{transition:none}}

/* ---- Navigation (nav.js): the panel in the fire card, the map bar while navigating, alerts, dead-zone key ---- */
.navpanel{position:absolute;z-index:6;top:12px;left:12px;width:min(400px,calc(100% - 24px));max-height:calc(100% - 24px);overflow-y:auto;
  padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:var(--panel);box-shadow:var(--pill-shadow)}
.nav-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.navpanel .nav-x{display:grid;place-items:center;width:36px;min-height:36px;padding:0}
.nav-x svg,.hist-x svg{width:18px;height:18px}
.nav-open{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:52px;margin:12px 0 4px;border:0;border-radius:10px;
  background:#2f7cf6;color:#fff;font-weight:700;font-size:1.05rem;box-shadow:0 2px 8px #0006}
.nav-open:hover{background:#4a8ef8}
.nav-open svg{width:20px;height:20px}
.navpanel h2{margin:0 0 4px;font-size:1.17rem}
.nav-note,.nav-foot{margin:4px 0;color:var(--muted);font-size:.85rem}
.nav-note:empty{display:none}
.nav-note a,.nav-foot a{color:#d0e7cf;text-underline-offset:3px}
.navpanel button,.navpanel .upload{min-height:36px;padding:0 10px;background:var(--raise);border:1px solid var(--line);border-radius:6px;color:var(--text);font-size:.85rem}
.navpanel button[aria-pressed="true"]{background:var(--pill-on);color:var(--pill-on-text);border-color:var(--pill-on)}
.navopts{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;margin:8px 0}
.navseg{display:flex}
.navseg button{border-radius:0;margin-left:-1px}
.navseg button:first-child{border-radius:6px 0 0 6px;margin-left:0}
.navseg button:last-child{border-radius:0 6px 6px 0}
.chk{display:inline-flex;align-items:center;gap:6px;font-size:.85rem;color:var(--muted)}
.nav-rform{display:grid;gap:6px;margin:6px 0;padding:8px 10px;border:1px dashed var(--line);border-radius:6px}
.nav-rform p{margin:0;font-size:.85rem;color:var(--muted)}
.nav-rform label{display:flex;align-items:center;gap:6px;font-size:.85rem;color:var(--muted)}
.nav-rform select,.nav-rform input{min-width:0;flex:1;min-height:32px;padding:0 8px;background:var(--raise);border:1px solid var(--line);border-radius:6px;color:var(--text)}
.rf-nums{display:flex;gap:8px}
.rf-nums input{width:64px;flex:none}
.nav-reps{list-style:none;margin:4px 0;padding:0;font-size:.85rem}
.nav-reps li{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 0;border-bottom:1px solid var(--line)}
.nav-reps small{color:var(--muted)}
.nav-go{width:100%;margin:8px 0 4px;min-height:42px !important;font-weight:700;font-size:.95rem !important;background:var(--pill-on) !important;color:var(--pill-on-text) !important;border-color:var(--pill-on) !important}
.nav-routes{list-style:none;margin:6px 0 0;padding:0;display:grid;gap:6px}
.nav-routes .rt{display:grid;gap:2px;width:100%;padding:8px 10px;text-align:left;background:var(--raise);border:1px solid var(--line);border-left-width:1px;border-radius:8px}
.nav-routes .rt[aria-pressed="true"]{background:#24372f;border-color:#cfd8d3;color:var(--text)}
.rt-head{display:flex;justify-content:space-between;gap:8px}
.rt-head b::before{content:"";display:inline-block;width:14px;height:4px;margin:0 8px 3px 0;border-radius:2px;background:var(--rt)}
.rt-fast{--rt:#4FA3FF}.rt-cover{--rt:#3DDC84}.rt-dispatch{--rt:#5FE0D4}
.rt-cov{font-size:.82rem;color:var(--muted)}
.rt-warn{font-size:.8rem;color:#FFD27A}
.sw-dead{background:repeating-linear-gradient(45deg,#e8ebf0 0 1.5px,transparent 1.5px 6px),repeating-linear-gradient(-45deg,#e8ebf0 0 1.5px,transparent 1.5px 6px),#3a3f47}
.navbar{position:absolute;z-index:3;top:12px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:8px;max-width:calc(100% - 140px);
  padding:6px 6px 6px 14px;background:var(--pill);border:1px solid var(--pill-line);border-radius:12px;box-shadow:var(--pill-shadow)}
.nb-txt{display:grid;line-height:1.25;min-width:0}
.nb-txt b{font-size:1rem}
.nb-txt span{font-size:.82rem;color:var(--muted)}
.navbar button,.navalert button{min-height:38px;padding:0 12px;background:var(--raise);border:1px solid var(--line);border-radius:8px;color:var(--text);font-weight:600}
.navalert{position:absolute;z-index:4;top:70px;left:50%;transform:translateX(-50%);display:flex;flex-wrap:wrap;align-items:center;gap:8px;
  width:min(520px,calc(100% - 24px));padding:10px 12px;background:#2E2410;border:1px solid #FFD27A88;border-radius:10px;box-shadow:var(--pill-shadow)}
.navalert p{flex:1 1 220px;margin:0;font-size:.9rem}
.navalert[data-kind="fire"]{background:#3a1512;border-color:#FF8A8088}
.selected .controls{display:none}

/* ---- Fire history (history.js): calendar panel over the map, daily layer ---- */
.hist{position:absolute;z-index:5;top:12px;left:12px;max-height:calc(100% - 24px);width:min(620px,calc(100% - 24px));display:flex;flex-direction:column;gap:8px;
  padding:12px 14px;background:var(--overlay);border:1px solid var(--line);border-radius:12px;box-shadow:var(--pill-shadow)}
.hist-head{display:flex;align-items:center;gap:8px}
.hist-head h2{margin:0 auto 0 0;font-size:1.17rem}
.hist-x{display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid var(--line);border-radius:8px;background:var(--raise);color:var(--text)}
.hist-ctl{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px}
.hist-ctl select,.hist-ctl input,.hist-ctl button{min-height:34px;padding:0 10px;background:var(--raise);border:1px solid var(--line);border-radius:6px;color:var(--text);font-size:.85rem}
.hist-ctl label{color:var(--muted);font-size:.85rem}
.hist-seg{display:flex}
.hist-seg button{border-radius:0;margin-left:-1px}
.hist-seg button:first-child{border-radius:6px 0 0 6px;margin-left:0}
.hist-seg button:last-child{border-radius:0 6px 6px 0}
.hist-ctl [aria-pressed="true"]{background:var(--pill-on);color:var(--pill-on-text);border-color:var(--pill-on)}
.hist-csv{display:flex;gap:6px;margin-left:auto}
.hist-body{flex:1;min-height:0;display:flex;flex-direction:column;gap:6px}
.hist-msg,.hist-note{margin:0;color:var(--muted);font-size:.82rem}
.hist-note:empty{display:none}
.hist-scroll{flex:1;min-height:0;overflow:auto}
.hist-cal{border-collapse:separate;border-spacing:2px;width:100%;font-variant-numeric:tabular-nums}
.hist-cal th{position:sticky;top:0;background:#14181d;color:var(--muted);font-size:.72rem;font-weight:600;padding:2px}
.hist-cal tbody th{position:sticky;left:0;top:auto;text-align:right;padding-right:6px}
.hist-cal td{padding:0;height:22px}
.hist-cal td button{display:block;width:100%;height:22px;min-width:32px;padding:0;border:0;border-radius:3px;color:#fff;font-size:.66rem;text-shadow:0 0 2px #000,0 0 2px #000}
.hist-cal td button span{opacity:0}
.hist-cal td button:hover span,.hist-cal td button:focus span,.hist-cal.anomaly td button span{opacity:1}
.hist-cal td button:hover{outline:2px solid #fff;outline-offset:-1px}
.hist-cal td.na{background:repeating-linear-gradient(45deg,#1b1f24 0 3px,#14181d 3px 6px);border-radius:3px}
.hist-cal .med td{color:var(--muted);font-size:.66rem;text-align:center}
.hist-legend{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--muted);font-size:.75rem}
.hist-legend i{width:120px;height:8px;border-radius:4px}
.hist-legend .hist-note{margin-left:auto}
.hist-min{min-height:36px;padding:0 12px;border:1px solid var(--line);border-radius:8px;background:var(--raise);color:var(--text);font-size:.85rem}
.hist.min .hist-body,.hist.min .hist-legend{display:none}
.hist.min{width:min(560px,calc(100% - 24px))}

/* ---- Layer key sections ---- */
.kh{margin:8px 8px 0;color:var(--muted);font-size:.7rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase}
.knote{margin:0 8px 4px;color:var(--muted);font-size:.75rem}
.legend .more{margin-top:4px;border-top:1px solid var(--line)}
.legend .more summary{min-height:36px;padding:6px 8px;color:var(--muted);font-size:.8rem;font-weight:600;cursor:pointer}
.sw-wind{height:5px;background:repeating-linear-gradient(90deg,#9fd0ff 0 6px,transparent 6px 9px)}
.detail .dsum{margin:8px 0 0;padding:0;list-style:none;display:grid;gap:4px}
.detail .dsum li{display:flex;justify-content:space-between;gap:8px;font-size:.9rem}
.detail .dsum li span:first-child{color:var(--muted)}
.detail .dsum b{text-align:right}
.detail .dsrc{margin:8px 0 0;color:var(--muted);font-size:.75rem}

/* Date button (opens the fire-history calendar) and the calendar's day strip */
.datebtn{min-height:38px;padding:0 30px 0 12px;background:var(--raise) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 2v2H5a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-2V2h-2v2H9V2zM5 9h14v10H5z' fill='%23B4BEC9'/%3E%3C/svg%3E") right 8px center/16px no-repeat;
  border:1px solid var(--line);border-radius:6px;color:var(--text);font-weight:600;text-align:left}
.datebtn:hover{border-color:#cfd8d3}
.hint{color:var(--muted);font-size:.85rem}
.hist-cal td button[aria-current]{outline:2px solid #fff;outline-offset:-1px}
.hist-days{border-top:1px solid var(--line);padding-top:8px}
.hd-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin-bottom:6px}
.hd-head span{color:var(--muted);font-size:.8rem}
.hd-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px}
.hd-w{color:var(--muted);font-size:.7rem;text-align:center}
.hd-grid button{height:30px;border:0;border-radius:4px;color:#fff;font-size:.78rem;font-weight:600;text-shadow:0 0 2px #000,0 0 2px #000}
.hd-grid button:hover{outline:2px solid #fff;outline-offset:-1px}
.hd-grid button[aria-current]{outline:2px solid #4FA3FF;outline-offset:-1px}

/* Navigation From / To: a text field with a menu (Current location / Recommended, Set on map) */
.navpts{display:grid;grid-template-columns:20px 1fr 36px;align-items:center;gap:8px;margin:10px 0 0}
.np-icons{display:flex;flex-direction:column;align-items:center;gap:5px}
.np-start{width:12px;height:12px;border:2.5px solid #4FA3FF;border-radius:50%}
.np-dots{width:3px;height:16px;background:radial-gradient(circle,var(--muted) 1.3px,transparent 1.6px) 0 0/3px 5.5px repeat-y}
.np-pin{width:18px;height:18px;color:#3DDC84}
.np-fields{display:grid;gap:8px;min-width:0}
.navpanel .np-swap{width:36px;min-height:36px;padding:0;display:grid;place-items:center;background:none;border:0;border-radius:50%;color:var(--text)}
.navpanel .np-swap:hover{background:var(--raise)}
.np-swap svg{width:22px;height:22px}
.rt-legs{display:block;margin-top:2px;font-size:.82rem}
.rt-legs i{font-style:normal;color:var(--muted)}
.combo{position:relative}
.combo input{width:100%;min-height:40px;padding:0 34px 0 12px;background:var(--raise) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23B4BEC9' stroke-width='2'/%3E%3C/svg%3E") right 10px center/16px no-repeat;
  border:1px solid var(--line);border-radius:8px;color:var(--text);font-size:.92rem;caret-color:var(--red)}
.combo input:focus{border-color:#cfd8d3;outline:none;box-shadow:0 0 0 2px #5AB0FF55}
.combo-menu{position:absolute;z-index:3;left:0;right:0;top:calc(100% + 4px);margin:0;padding:4px;list-style:none;background:var(--panel);
  border:1px solid var(--line);border-radius:8px;box-shadow:var(--pill-shadow)}
.navpanel .combo-menu button{display:block;width:100%;min-height:38px;padding:0 10px;text-align:left;background:none;border:0;border-radius:6px;font-size:.9rem}
.navpanel .combo-menu button:hover,.navpanel .combo-menu button:focus{background:var(--raise)}

/* ---- Phones (and short landscape phones): compact everything so the map stays visible ----
   rem-based sizes shrink with the root font; px-based controls are sized down one by one. Same features as desktop. */
@media (max-width:600px), (max-height:500px){
  html{font-size:13px}
  /* Map gets more of the screen than the panel. */
  body{grid-template-rows:auto minmax(0,72fr) minmax(0,28fr)}
  /* Fire open: the sheet is tall enough to show name, size and "Navigate to this fire" without scrolling on a small phone. */
  body.selected{grid-template-rows:auto minmax(0,60fr) minmax(250px,40fr)}
  /* Brand bar: one 30 px line. The freshness line shows only when offline (Refresh also flags it). */
  .fresh{min-height:30px;gap:8px;padding:3px max(10px,env(safe-area-inset-right)) 3px max(10px,env(safe-area-inset-left))}
  .wordmark{font-size:12px}
  .fresh-r{gap:8px;font-size:11px}
  #fresh{display:none}
  #fresh.offline{display:inline;color:#FF8A80;font-weight:800}
  #fresh,.navlink{white-space:nowrap}
  .refresh-wrap button{min-height:24px;padding:0 8px;font-size:11px;border-radius:5px}
  .app-actions{gap:4px}
  /* Map pills (search, Home/Back) */
  .controls,.mapnav{left:8px;top:8px;right:52px}
  .controls input,.mapnav button{min-height:34px;border-radius:9px;font-size:.95rem}
  .controls input{padding:0 12px}
  .mapnav button{padding:0 10px;gap:4px}
  .mapnav .ico{width:15px;height:15px}
  /* Zoom / My location */
  .maplibregl-ctrl-top-right .maplibregl-ctrl{margin:8px 8px 0 0}
  .maplibregl-ctrl-group button,.maplibregl-ctrl-group #locate{width:34px;height:34px}
  .maplibregl-ctrl-group #locate svg{width:18px;height:18px}
  /* Bottom-right row: Labels · 2D | 3D · credit */
  .maplibregl-ctrl-bottom-right{gap:6px;padding:0 8px 8px 0}
  .labelsbtn,.viewtoggle{height:30px;border-radius:8px;font-size:.85rem}
  .labelsbtn{padding:0 9px}
  .viewtoggle button{min-width:34px;padding:0 8px;font-size:.85rem}
  /* Scale bar: in the free space left of that row, clear of the timelines above it. */
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale{right:calc(100% + 2px);bottom:15px;font-size:10px}
  /* Bottom-left, above that row: a small "Key" button on top, then the Time and Observed timelines as two narrow
     vertical columns side by side. Anchored at the bottom, so the opened key grows upward over the map. */
  .bottom{left:8px;bottom:46px;gap:5px;max-width:calc(100% - 16px);flex-direction:row;flex-wrap:wrap;align-items:flex-end}
  .keybox{flex:0 0 100%;max-width:min(320px,calc(100vw - 16px));border-radius:8px;background:none;border:0}
  .keybox summary{display:inline-flex;min-height:28px;padding:3px 10px;font-size:0;background:var(--overlay);border:1px solid var(--line);border-radius:8px}
  .keybox summary::after{content:"Key";font-size:.85rem;font-weight:700}
  .keybox[open] summary::after{content:"Hide key"}
  .keybox[open] .legend{margin-top:4px;background:var(--overlay);border:1px solid var(--line);border-radius:8px}
  .legend{max-height:min(30dvh,220px);padding:2px 4px 6px}
  .legend li button{min-height:28px;padding:1px 6px;gap:6px}
  .legend .l{font-size:.8rem}
  .sw{width:22px;height:12px}
  .sw-prev,.sw-wind{height:4px}
  .sw-hot{width:10px;height:10px;margin:0 6px}
  .kh{margin-top:4px}
  /* Time (forecast) and Observed: vertical columns, stops listed top to bottom, scrolling if a fire has many. */
  .tl-mini{flex-direction:column;align-items:stretch;flex-wrap:nowrap;width:min-content;min-width:72px;max-width:112px;min-height:0;padding:3px;gap:3px;border-radius:8px}
  .tl-mini .stops{flex-direction:column;max-height:min(24dvh,170px);overflow-x:hidden;overflow-y:auto}
  .tl-mini button,.tl-mini .stop button{width:100%;height:26px;padding:0 6px;font-size:.72rem;border-radius:6px}
  .tl-mini .stop button{border-bottom-width:0;border-left:3px solid var(--stop-color);text-align:left}
  .tl-mini #compare{height:auto;min-height:26px;padding:3px 6px;white-space:normal;line-height:1.15}
  .tl-mini .tl-h{padding:1px 2px 0;font-size:.6rem;letter-spacing:.05em;text-align:center}
  .fcbar{border-left-width:1px;border-top:3px solid #C75AF5}
  .fc-read{flex-basis:auto;padding:0 2px 1px;font-size:.66rem;line-height:1.2}
  /* Panel: tighter spacing and smaller headings */
  .sidebar{padding:4px 4px max(10px,env(safe-area-inset-bottom))}
  .brand{padding:8px 12px 4px}
  .brand h1,.detail h2{font-size:1.35rem}
  .detail{padding:2px 12px 12px}
  .detail dl{gap:4px 12px;margin:8px 0}
  .big{font-size:1.25rem}
  .fc .big{font-size:1.1rem}
  .fc,.nofc{margin:8px 0;padding:8px 10px}
  .nav-open{min-height:42px;margin:8px 0 2px;font-size:1rem}
  .order,.layerctl,.conditions,.sources{margin-left:12px;margin-right:12px}
  .order select,.ctlrow select,.datebtn{min-height:34px;padding-top:5px;padding-bottom:5px}
  .fire{min-height:40px;padding:8px 10px}
  .nm{font-size:1rem}.ac{font-size:1.05rem}
  body:not(.selected) .fires .list{margin:0 12px}
  .conditions{margin-top:10px;margin-bottom:10px}
  /* Panels over the map */
  .navpanel,.hist{top:8px;left:8px;width:calc(100% - 16px);max-height:calc(100% - 16px);padding:10px}
  .navbar{top:8px;max-width:calc(100% - 60px);padding:4px 4px 4px 10px}
  .navbar button,.navalert button{min-height:32px;padding:0 9px}
  .navalert{top:52px}
}
