:root{
  --bg:#f6f7f8; --panel:#fff; --ink:#1b1f23; --mut:#5b636b; --line:#e3e6e9;
  --green:#02A95B;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  display:flex; flex-direction:column;
}

/* header */
#hdr{display:flex; gap:24px; align-items:center; flex-wrap:wrap;
     padding:12px 18px; background:var(--panel); border-bottom:1px solid var(--line)}
#hdr h1{margin:0; font-size:17px; letter-spacing:-.01em}
.sub{margin:2px 0 0; color:var(--mut); font-size:12px}
.headline{display:flex; gap:8px; flex-wrap:wrap; margin-left:auto}
.chip{display:flex; align-items:baseline; gap:6px; padding:5px 10px; border-radius:999px;
      background:#f0f2f4; border:1px solid var(--line); font-size:12px}
.chip b{font-size:14px}
.chip .dot{width:8px;height:8px;border-radius:50%;display:inline-block}

/* toolbar */
#toolbar{display:flex; align-items:center; gap:12px; padding:8px 18px;
         background:var(--panel); border-bottom:1px solid var(--line); flex-wrap:wrap}
.spacer{flex:1}
#crumbs{display:flex; align-items:center; gap:6px; font-size:13px; flex-wrap:wrap}
#crumbs a{color:#0b6bcb; cursor:pointer; text-decoration:none}
#crumbs a:hover{text-decoration:underline}
#crumbs .sep{color:var(--mut)}
#crumbs .cur{font-weight:600}
.ctl{display:flex; align-items:center; gap:6px; font-size:12px; color:var(--mut)}
select,.btn{font:inherit; padding:5px 8px; border:1px solid var(--line);
            border-radius:6px; background:#fff; color:var(--ink)}
.btn{cursor:pointer}
.btn:hover{background:#f0f2f4}
.btn:disabled{opacity:.45;cursor:default}
.btn:disabled:hover{background:#fff}

/* layout */
#main{flex:1; display:flex; min-height:0}
#mapwrap{flex:1; position:relative; min-width:0; background:#eef1f3}
#map{position:absolute; inset:0}          /* MapLibre canvas fills the wrap */
/* keep the overlays above the WebGL canvas + map controls */
#legend,.tip,.loading{z-index:3}
.maplibregl-ctrl-top-left{z-index:2}

#panel{width:330px; flex:none; background:var(--panel); border-left:1px solid var(--line);
       padding:14px; overflow:auto}
.hint{color:var(--mut); font-size:12px}
#panel h2{margin:0 0 2px; font-size:15px}
#panel .code{color:var(--mut); font-size:11px; font-family:ui-monospace,Menlo,Consolas,monospace}
.kv{display:flex; justify-content:space-between; gap:10px; padding:3px 0; font-size:12px}
.kv span:last-child{font-variant-numeric:tabular-nums}
.sec{margin-top:14px; padding-top:10px; border-top:1px solid var(--line)}
.sec h3{margin:0 0 8px; font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--mut)}
.bar{display:grid; grid-template-columns:92px 1fr 46px; gap:8px; align-items:center; margin:4px 0; font-size:12px}
.bar > span:first-child{overflow-wrap:anywhere}
.bar .track{background:#eef1f3; border-radius:4px; height:9px; overflow:hidden}
/* CRITICAL: .fill is a span nested inside .track, so unlike .track it is NOT a grid
   item and is not blockified. An inline box ignores width/height, so without an
   explicit display it renders 0x0 and every bar looks empty. */
.bar .fill{display:block; height:100%; border-radius:4px}
.bar .val{text-align:right; font-variant-numeric:tabular-nums; color:var(--mut)}
.band{font-size:11px; color:var(--mut); margin-top:2px}
.band.gap{margin-top:6px}
.err{color:#b00; font-size:12px; line-height:1.5}
.trc{font:11px Consolas,ui-monospace,monospace; color:#036}

/* legend + tooltip */
.legend{position:absolute; left:12px; bottom:12px; background:rgba(255,255,255,.95);
        border:1px solid var(--line); border-radius:8px; padding:8px 10px; font-size:11px;
        max-width:260px; box-shadow:0 1px 4px rgba(0,0,0,.06)}
.legend .lgttl{font-weight:600; margin-bottom:4px}
.legend .row{display:flex; align-items:center; gap:6px; margin:2px 0}
.legend .sw{width:12px;height:12px;border-radius:3px;border:1px solid rgba(0,0,0,.12)}
.legend .ramp{height:10px;border-radius:3px;margin:4px 0 2px}
.legend .ends{display:flex; justify-content:space-between; color:var(--mut)}
.legend .ramp-note{margin-top:5px; color:var(--mut)}
/* catseq swatches carry a light->dark gradient, so they need width to read as a ramp */
.legend .sw.swg{width:34px}
.tip{position:absolute; pointer-events:none; background:#111; color:#fff; padding:6px 8px;
     border-radius:6px; font-size:11.5px; transform:translate(-50%,-140%); white-space:nowrap; z-index:5}
.loading{position:absolute; inset:0; display:grid; place-items:center; background:rgba(255,255,255,.6);
         font-size:13px; color:var(--mut)}
/* CRITICAL: an author-level `display` beats the UA's [hidden]{display:none}, so the
   overlay must opt back in explicitly or it can never hide. */
.loading[hidden]{display:none}
.tip[hidden]{display:none}

/* footer */
#foot{padding:6px 18px; background:var(--panel); border-top:1px solid var(--line);
      color:var(--mut); font-size:11px}
#credits{margin-top:3px; font-size:10.5px; line-height:1.45; color:var(--mut)}
#credits a{color:inherit; text-decoration:underline}

/* Desktop: the credits read as a plain paragraph, so hide the disclosure marker. */
@media (min-width:901px){ #credits > summary{display:none} }
#credits > summary{cursor:pointer; font-weight:600; padding:2px 0; list-style-position:inside}

@media (max-width:900px){
  /* Phone: let the PAGE scroll instead of squeezing everything into one screen — the map
     was getting 41% of the viewport with 501px of chrome around it. */
  html,body{height:auto}
  #main{flex-direction:column}
  #mapwrap{min-height:58vh}                     /* the map is the point; give it the space */
  #panel{width:auto; border-left:0; border-top:1px solid var(--line);
         max-height:none; overflow:visible}
  .headline{margin-left:0}
}
@media (max-width:600px){
  #hdr{padding:8px 12px; gap:8px}
  #hdr h1{font-size:15px}
  .sub{font-size:11px}
  #toolbar{padding:6px 12px; gap:8px}
  #foot{padding:6px 12px}
}

#scslider{width:130px;accent-color:#02A95B}
#sclabel{min-width:34px;font-variant-numeric:tabular-nums}
#scwrap.dim{opacity:.45;pointer-events:none}
