[hidden] { display: none !important; }
@font-face { font-family: "Geist"; src: url(vendor/fonts/Geist-Regular.ttf) format("truetype"); font-weight: 400; }
@font-face { font-family: "Geist"; src: url(vendor/fonts/Geist-Medium.ttf) format("truetype"); font-weight: 500 700; }
@font-face { font-family: "Geist Mono"; src: url(vendor/fonts/GeistMono-Regular.otf) format("opentype"); }
:root {
  --bg: var(--rx-bg, #0E0F11); --bg1: var(--rx-bg-1, #131416); --bg2: var(--rx-bg-2, #17191C); --bg3: var(--rx-bg-3, #1B1D21);
  --line: var(--rx-line, #1F2125); --line2: var(--rx-line-2, #2B2E33); --line3: var(--rx-line-3, #33363C);
  --text: var(--rx-text, #E6E4DF); --text2: var(--rx-text-2, #8A8E96); --text3: var(--rx-text-3, #5D6168);
  --gold: var(--rx-gold, #C8B68A); --golddim: var(--rx-gold-dim, #1C1A15); --red: var(--rx-red, #C0504A);
  --font: "Geist", var(--rx-font, system-ui), sans-serif; --mono: "Geist Mono", var(--rx-mono, ui-monospace), monospace;
  --r: 6px; --t: 150ms ease;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; overflow: hidden; }
#map { position: absolute; inset: 0 0 0 300px; background: var(--bg); }
.maplibregl-ctrl-attrib { background: rgba(14,15,17,.7) !important; color: var(--text3); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--text3); }
.maplibregl-ctrl-group { background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line2); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.8); }

#side { position: absolute; left: 0; top: 0; bottom: 0; width: 300px; background: var(--bg1); border-right: 1px solid var(--line);
  padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 4px; }
.brand .title { font-size: 15px; font-weight: 500; letter-spacing: -.01em; }
.cur { margin-right: auto; }
.rx-cursor { display: inline-block; width: 7px; height: 14px; background: var(--gold); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .rx-cursor { animation: none; } * { transition: none !important; } }
button { font-family: var(--font); }
.rx-btn, .seg button { background: var(--bg2); color: var(--text2); border: 1px solid var(--line2); border-radius: var(--r); cursor: pointer; transition: color var(--t), border-color var(--t), background var(--t); }
.rx-btn:hover, .seg button:hover { color: var(--text); border-color: var(--line3); }
.small { width: 24px; height: 24px; padding: 0; font-family: var(--mono); }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }
.rx-input { background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: var(--r); padding: 7px 9px; font-family: var(--font); font-size: 13px; width: 100%; transition: border-color var(--t); }
.rx-input:focus { border-color: var(--line3); outline: none; }
select.rx-input { appearance: none; cursor: pointer; }
.rx-label { color: var(--text3); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; margin-top: 4px; }

.search { position: relative; }
#results { position: absolute; top: 36px; left: 0; right: 0; z-index: 5; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); max-height: 320px; overflow-y: auto; }
#results div { padding: 7px 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; border-left: 1px solid transparent; }
#results div span { color: var(--text3); font-family: var(--mono); font-size: 11px; }
#results div.sel, #results div:hover { background: var(--bg3); border-left-color: var(--gold); }

.row { display: flex; gap: 8px; }
.seg { display: flex; }
.seg button { padding: 6px 10px; font-size: 12px; }
.seg button:first-child { border-radius: var(--r) 0 0 var(--r); }
.seg button:last-child { border-radius: 0 var(--r) var(--r) 0; border-left: none; }
.seg button.on { color: var(--gold); }
#scope { flex: 1; }

#metrics { display: flex; flex-direction: column; gap: 1px; }
#metrics .grp { color: var(--text3); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; margin: 8px 0 3px; }
#metrics button { text-align: left; background: none; border: none; border-left: 1px solid transparent; color: var(--text2); padding: 5px 8px; cursor: pointer; display: flex; justify-content: space-between; font-size: 13px; transition: color var(--t), border-color var(--t); border-radius: 0; }
#metrics button kbd { font-family: var(--mono); font-size: 10px; color: var(--text3); }
#metrics button:hover { color: var(--text); }
#metrics button.on { color: var(--gold); border-left-color: var(--gold); }

#legend { margin-top: 6px; }
#legend .bar { display: flex; height: 8px; border-radius: 2px; overflow: hidden; }
#legend .bar i { flex: 1; }
#legend .lab { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--text3); margin-top: 4px; }
#legend .desc { color: var(--text2); font-size: 12px; margin-top: 8px; line-height: 1.45; }
.asof { margin-top: auto; color: var(--text3); font-size: 11px; line-height: 1.5; font-family: var(--mono); }

#detail { position: absolute; top: 12px; right: 12px; width: 340px; max-height: calc(100% - 24px); overflow-y: auto; background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r); padding: 16px; }
#detail h1 { font-size: 18px; font-weight: 500; margin: 2px 0 10px; letter-spacing: -.01em; }
.big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
#dBig { font-family: var(--mono); font-size: 30px; color: var(--gold); }
.big-l { color: var(--text3); font-size: 12px; }
.x { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--text3); font-size: 18px; cursor: pointer; transition: color var(--t); }
.x:hover { color: var(--text); }
.chart-tabs { display: flex; gap: 2px; flex-wrap: wrap; margin-bottom: 4px; }
.chart-tabs button { background: none; border: 1px solid transparent; border-radius: var(--r); color: var(--text3); font-size: 11px; padding: 3px 7px; cursor: pointer; transition: color var(--t), border-color var(--t); }
.chart-tabs button:hover { color: var(--text); }
.chart-tabs button.on { color: var(--text); border-color: var(--line2); }
#chart svg { display: block; width: 100%; height: 130px; }
#chart .none { color: var(--text3); font-size: 12px; padding: 30px 0; text-align: center; }
#dTable { width: 100%; border-collapse: collapse; margin-top: 10px; }
#dTable td { padding: 5px 0; border-top: 1px solid var(--line); }
#dTable td:first-child { color: var(--text2); }
#dTable td:last-child { text-align: right; font-family: var(--mono); color: var(--text); }
#dTable tr.on td:first-child { color: var(--gold); }
#dTable small { color: var(--text3); }
.score-break { margin-top: 10px; color: var(--text3); font-size: 11px; line-height: 1.5; font-family: var(--mono); }

#tip { position: absolute; pointer-events: none; z-index: 10; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 9px; font-size: 12px; white-space: nowrap; }
#tip b { font-weight: 500; }
#tip span { font-family: var(--mono); color: var(--gold); margin-left: 8px; }

#about { position: absolute; inset: 0; background: rgba(14,15,17,.75); display: flex; align-items: center; justify-content: center; z-index: 20; }
.about-card { position: relative; width: min(680px, 92vw); max-height: 86vh; overflow-y: auto; background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r); padding: 20px 24px; line-height: 1.55; color: var(--text2); }
.about-card h2 { color: var(--text); font-size: 16px; font-weight: 500; margin: 0 0 8px; }
.about-card h3 { color: var(--text); font-size: 13px; font-weight: 500; margin: 16px 0 4px; }
.about-card code, .about-card pre { font-family: var(--mono); font-size: 12px; color: var(--text); }
.about-card pre { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; white-space: pre-wrap; }
.about-card a { color: var(--text2); }
.about-card td { padding: 2px 12px 2px 0; font-family: var(--mono); font-size: 12px; }

#legend .lab b { font-weight: 500; font-family: var(--font); }
#legend .lab b.cold { color: #5B9BD5; }
#legend .lab b.hot { color: #EE7A3F; }
#legend .lab.sub { margin-top: 1px; }

.mono { font-family: var(--mono); }
.sub { color: var(--text3); font-size: 12px; font-weight: 400; }
.tools { display: flex; gap: 6px; }
.tools .rx-btn { flex: 1; padding: 6px 0; font-size: 12px; }
#cmpN { font-family: var(--mono); color: var(--gold); }
.d-actions { display: flex; gap: 6px; margin-top: 10px; }
.d-actions .rx-btn { padding: 5px 10px; font-size: 12px; }
.d-note { color: var(--text2); font-size: 12px; margin-top: 10px; line-height: 1.5; }
.d-note b { color: var(--text); font-weight: 500; }
#dTable tr.grp td { color: var(--text3); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; padding-top: 10px; border-top: none; }
#timebar { position: absolute; left: 340px; right: 380px; bottom: 12px; display: flex; align-items: center; gap: 10px; background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r); padding: 8px 12px; }
#timebar input[type=range] { flex: 1; accent-color: #C8B68A; }
#tMonth { min-width: 64px; color: var(--text); }
#tNow { padding: 4px 9px; font-size: 12px; }
.t-note { color: var(--text3); font-size: 11px; }
#timebar.off input, #timebar.off #tMonth { opacity: .35; }
.overlay { position: absolute; inset: 0; background: rgba(14,15,17,.75); display: flex; align-items: center; justify-content: center; z-index: 20; }
.ov-card { position: relative; width: min(560px, 94vw); max-height: 88vh; overflow-y: auto; background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r); padding: 18px 22px; }
.ov-card.wide { width: min(1180px, 96vw); }
.ov-card h2 { font-size: 16px; font-weight: 500; margin: 0 0 10px; color: var(--text); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.presets button { background: var(--bg2); color: var(--text2); border: 1px solid var(--line2); border-radius: var(--r); padding: 4px 9px; font-size: 12px; cursor: pointer; transition: color var(--t), border-color var(--t); }
.presets button:hover { color: var(--text); }
.presets button.on { color: var(--gold); border-color: var(--line3); }
.tv-wrap { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
#tv, #cmpTable { width: 100%; border-collapse: collapse; font-size: 12px; }
#tv th, #cmpTable th { position: sticky; top: 0; background: var(--bg2); color: var(--text2); font-weight: 400; text-align: right; padding: 7px 8px; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--line2); }
#tv th:first-child, #tv th:nth-child(2), #cmpTable th:first-child { text-align: left; }
#tv th.on { color: var(--gold); }
#tv td, #cmpTable td { padding: 5px 8px; border-top: 1px solid var(--line); text-align: right; font-family: var(--mono); white-space: nowrap; }
#tv td:first-child, #tv td:nth-child(2) { text-align: left; font-family: var(--font); color: var(--text3); }
#tv td:nth-child(2) { color: var(--text); }
#cmpTable td:first-child { text-align: left; font-family: var(--font); color: var(--text2); }
#tv tbody tr { cursor: pointer; }
#tv tbody tr:hover { background: var(--bg3); }
.cell-c { display: inline-block; width: 6px; height: 6px; border-radius: 1px; margin-right: 6px; vertical-align: middle; }
.tv-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--text3); font-size: 12px; }
.tv-foot .rx-btn { padding: 5px 10px; font-size: 12px; }
#cmpChart svg { width: 100%; height: 180px; display: block; margin-bottom: 10px; }
.ana-form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.row3 { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
#aGo { padding: 7px; }
#aOut table { width: 100%; border-collapse: collapse; margin-top: 8px; }
#aOut td { padding: 5px 0; border-top: 1px solid var(--line); }
#aOut td:last-child { text-align: right; font-family: var(--mono); }
#aOut .verdict { font-size: 20px; font-family: var(--mono); margin: 8px 0 2px; }
#aOut .why { color: var(--text3); font-size: 11px; line-height: 1.5; margin-top: 10px; }
.legend-key { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin: 0 4px 0 10px; }

/* ---- compare v2 ---- */
#topbar { position: absolute; top: 10px; left: 350px; right: 12px; display: flex; gap: 8px; align-items: center; z-index: 6; pointer-events: none; }
#topbar > * { pointer-events: auto; }
body:not(.cmp-on) #detail:not([hidden]) ~ #topbar { right: 364px; }
#cmpTop { white-space: nowrap; background: var(--bg1); color: var(--text); border: 1px solid var(--line3); border-radius: var(--r); padding: 7px 12px; font-size: 13px; cursor: pointer; display: flex; gap: 8px; align-items: center; transition: border-color var(--t), color var(--t); }
#cmpTop:hover { border-color: var(--gold); }
#scnTop { white-space: nowrap; color: var(--text2); font-size: 12px; text-decoration: none; padding: 7px 6px; background: rgba(14,15,17,.6); border-radius: var(--r); display: inline-flex; align-items: center; }
#scnTop:hover { color: var(--gold); }
#cmpTop .ct::before { content: "⇆ "; color: var(--gold); }
#cmpN { font-family: var(--mono); color: var(--rx-gold-ink, #0A0A0A); background: var(--gold); border-radius: 3px; padding: 0 5px; font-size: 11px; }
#cmpN:empty { display: none; }
body.cmp-on #cmpTop { border-color: var(--gold); color: var(--gold); }
#chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r); padding: 4px 6px; }
.chips-l { color: var(--text3); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; margin: 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); padding: 3px 4px 3px 8px; font-size: 12px; }
.chip i { width: 8px; height: 8px; border-radius: 2px; }
.chip button { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; padding: 0 4px; transition: color var(--t); }
.chip button:hover { color: var(--text); }
#flash { position: absolute; top: 54px; left: 350px; z-index: 30; background: var(--bg2); border: 1px solid var(--line3); border-radius: var(--r); padding: 6px 10px; font-size: 12px; }
#cmpPanel { position: absolute; left: 300px; right: 0; bottom: 0; height: 58vh; background: var(--bg1); border-top: 1px solid var(--line3); z-index: 15; overflow-y: auto; padding: 12px 16px 16px; }
body.cmp-on #timebar { display: none; }
body.cmp-on #detail { max-height: calc(42vh - 24px); }
.cmp-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; position: relative; padding-right: 30px; margin-bottom: 10px; }
.cmp-head h2 { font-size: 16px; font-weight: 500; margin: 0; color: var(--text); }
.cmp-head .rx-btn { padding: 4px 10px; font-size: 12px; margin-left: auto; }
.cmp-head .x { top: -4px; right: 0; }
#cmpEmpty p { color: var(--text2); margin: 4px 0 10px; }
#cmpQuick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
#cmpQuick .rx-btn { padding: 6px 10px; font-size: 12px; }
.cmp-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
#cmpTable { border-collapse: collapse; width: 100%; min-width: 760px; font-size: 13px; }
#cmpTable th, #cmpTable td { padding: 7px 10px; border-top: 1px solid var(--line); }
#cmpTable thead th { border-top: none; background: var(--bg2); vertical-align: top; text-align: left; font-weight: 400; }
#cmpTable .rowh { text-align: left; color: var(--text2); font-weight: 400; white-space: nowrap; position: sticky; left: 0; background: var(--bg1); z-index: 1; width: 170px; }
#cmpTable thead .rowh { background: var(--bg2); }
#cmpTable td { text-align: right; font-family: var(--mono); white-space: nowrap; width: 22%; }
#cmpTable td small { color: var(--text3); }
#cmpTable td.na { color: var(--text3); }
#cmpTable .ghost { background: transparent; }
.slot-h { display: flex; align-items: center; gap: 6px; }
.slot-h i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.slot-n { color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.slot-n:hover { color: var(--gold); }
.slot-k { color: var(--text3); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; margin: 2px 0 0 14px; }
.slot .rm { margin-left: auto; background: none; border: 1px solid var(--line2); border-radius: var(--r); color: var(--text2); cursor: pointer; width: 22px; height: 22px; transition: color var(--t), border-color var(--t); }
.slot .rm:hover { color: var(--text); border-color: var(--line3); }
.ac { position: relative; }
.ac input { font-size: 12px; padding: 6px 8px; }
.ac-res { position: absolute; top: 32px; left: 0; min-width: 240px; z-index: 40; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r); max-height: 260px; overflow-y: auto; }
.ac-res div { padding: 7px 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; border-left: 1px solid transparent; font-family: var(--font); color: var(--text); }
.ac-res div span { color: var(--text3); font-family: var(--mono); font-size: 11px; }
.ac-res div.sel, .ac-res div:hover { background: var(--bg3); border-left-color: var(--gold); }
.tag { font-family: var(--font); font-size: 10px; letter-spacing: .03em; text-transform: uppercase; border-radius: 3px; padding: 1px 4px; margin-right: 8px; vertical-align: 1px; }
.tag.best { color: #8FA37E; border: 1px solid #8FA37E66; }
.tag.worst { color: #C0504A; border: 1px solid #C0504A66; }
.cmp-foot { margin: 8px 0 12px; }
.cmp-foot .rx-btn { padding: 4px 10px; font-size: 12px; }
#cmpChart svg { width: 100%; height: 170px; display: block; }
.rx-pop .maplibregl-popup-content { background: var(--bg2); border: 1px solid var(--line3); border-radius: var(--r); padding: 10px; box-shadow: none; color: var(--text); }
.rx-pop .maplibregl-popup-tip { display: none; }
.cmp-pop .pn { font-size: 13px; margin-bottom: 8px; }
.cmp-pop .pb { display: flex; gap: 6px; }
.cmp-pop .rx-btn { padding: 5px 9px; font-size: 12px; }
.cmp-pop .add { color: var(--gold); }
@media (max-width: 900px) {
  #side { width: 220px; }
  #map { left: 220px; }
  #cmpPanel { left: 0; height: 70vh; }
  #topbar, #flash { left: 230px; }
}
#chipsOpen { padding: 3px 9px; font-size: 12px; color: var(--gold); margin-left: 2px; }


/* ---------- phones and portrait tablets: bottom sheets ---------- */
#sheetHead, .handle { display: none; }
@media (hover: none) { #tip { display: none !important; } }
@media (max-width: 820px) {
  :root { --peek: 112px; }
  html, body { overscroll-behavior: none; }
  #map { inset: 0; }
  .maplibregl-ctrl-top-left { display: none; }
  .maplibregl-ctrl-bottom-left { bottom: calc(var(--peek) + 58px); max-width: calc(100vw - 16px); }
  body.sheet-open .maplibregl-ctrl-bottom-left { display: none; }
  .maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100vw - 60px); font-size: 9.5px; }
  body.detail-on .maplibregl-ctrl-bottom-left, body.cmp-on .maplibregl-ctrl-bottom-left { display: none; }
  .handle { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line3); margin: 8px auto 6px; }
  /* metric / controls sheet */
  #side { top: auto; right: 0; width: auto; max-height: var(--peek); height: var(--peek); overflow: hidden; z-index: 12;
    border-right: none; border-top: 1px solid var(--line3); border-radius: 12px 12px 0 0; padding: 0 14px calc(10px + env(safe-area-inset-bottom));
    gap: 8px; transition: height 180ms ease, max-height 180ms ease; box-shadow: 0 -8px 24px rgba(0,0,0,.35); }
  #side.open { height: 80dvh; max-height: 80dvh; overflow-y: auto; }
  #sheetHead { display: block; order: -2; position: sticky; top: 0; background: var(--bg1); z-index: 2; padding-bottom: 2px; touch-action: none; }
  .sh-row { display: flex; gap: 8px; }
  #shMetric { flex: 1; min-height: 44px; display: flex; justify-content: space-between; align-items: center; padding: 0 12px; color: var(--text); font-size: 14px; text-align: left; }
  #shMetric b { color: var(--gold); font-weight: 400; transition: transform 180ms ease; }
  #side.open #shMetric b { transform: rotate(180deg); }
  #shAbout { width: 44px; min-height: 44px; font-family: var(--mono); }
  #side .brand { display: none; }
  #legend { order: -1; margin-top: 0; }
  #side:not(.open) #legend .desc, #side:not(.open) #legend .lab.sub { display: none; }
  #side:not(.open) > :not(#sheetHead):not(#legend) { display: none !important; }
  body.detail-on #side, body.cmp-on #side { display: none; }
  /* bigger touch targets */
  #side .rx-input, #side .seg button, #side .tools .rx-btn { min-height: 44px; font-size: 14px; }
  #side .seg button { padding: 0 14px; }
  #metrics button { min-height: 44px; align-items: center; font-size: 14px; padding: 0 10px; }
  #metrics button kbd { display: none; }
  #results div { min-height: 44px; display: flex; align-items: center; }
  #slider { height: 44px; -webkit-appearance: none; appearance: none; background: transparent; }
  #slider::-webkit-slider-runnable-track { height: 4px; background: var(--line3); border-radius: 2px; }
  #slider::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: var(--gold); border: 3px solid var(--bg1); }
  #slider::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--gold); border: 3px solid var(--bg1); }
  .th-h .rx-btn { min-height: 36px; padding: 0 12px; }
  /* top bar + chips */
  #topbar { left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top)); flex-wrap: nowrap; }
  body:not(.cmp-on) #detail:not([hidden]) ~ #topbar { right: 8px; }
  #cmpTop, #scnTop { min-height: 44px; }
  #chips { flex-wrap: nowrap; overflow-x: auto; max-width: calc(100vw - 130px); scrollbar-width: none; }
  #chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .chip button { min-width: 32px; min-height: 32px; }
  #chipsOpen { min-height: 36px; white-space: nowrap; }
  #flash { left: 8px; top: calc(60px + env(safe-area-inset-top)); }
  /* history bar sits just above the sheet */
  #timebar { left: 8px; right: 8px; bottom: calc(var(--peek) + 8px); padding: 2px 10px; gap: 8px; }
  #timebar .rx-label, .t-note { display: none; }
  #tNow { min-height: 36px; }
  body.detail-on #timebar, body.sheet-open #timebar { display: none; }
  /* detail: swipe-up bottom sheet */
  #detail { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 46dvh; max-height: none; border-radius: 12px 12px 0 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom));
    border-left: none; border-right: none; border-bottom: none; z-index: 13; transition: height 180ms ease; box-shadow: 0 -8px 24px rgba(0,0,0,.35); overscroll-behavior: contain; }
  #detail.full { height: 90dvh; }
  #dHandle { position: sticky; top: 0; margin: 0 -16px 4px; width: auto; height: 22px; background: var(--bg1); border-radius: 12px 12px 0 0; touch-action: none; z-index: 2; }
  #dHandle::after { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line3); margin: 9px auto 0; }
  #detail .x { top: 10px; right: 8px; width: 44px; height: 44px; z-index: 3; }
  .d-actions .rx-btn { min-height: 44px; flex: 1; }
  .chart-tabs button { min-height: 36px; padding: 0 10px; }
  body.cmp-on #detail { display: none; }
  /* compare: full screen */
  #cmpPanel { position: fixed; inset: 0; left: 0; height: auto; z-index: 25; padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom)); }
  .cmp-head .x { width: 44px; height: 44px; top: -10px; }
  .cmp-head .rx-btn, #cmpQuick .rx-btn, .cmp-foot .rx-btn { min-height: 40px; }
  #cmpTable { min-width: 560px; font-size: 12px; }
  #cmpTable .rowh { width: 120px; white-space: normal; min-width: 110px; }
  .slot-n { max-width: 120px; }
  .slot .rm { width: 32px; height: 32px; }
  .ac input { min-height: 40px; font-size: 16px; }
  /* overlays full screen */
  .overlay, #about { align-items: stretch; }
  .about-card { overflow-y: auto; }
  .ov-card, .ov-card.wide, .about-card { width: 100vw; max-width: 100vw; max-height: none; height: 100dvh; border-radius: 0; border: none; padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)); }
  .ov-card .x, .about-card .x { width: 44px; height: 44px; }
  .presets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .presets button { white-space: nowrap; min-height: 40px; }
  .tv-wrap { max-height: calc(100dvh - 190px); -webkit-overflow-scrolling: touch; }
  #tv th, #tv td { padding: 9px 8px; }
  .row3 { grid-template-columns: 1fr; }
  .rx-input { font-size: 16px; }   /* stops iOS zooming into inputs */
  .cmp-pop .rx-btn { min-height: 44px; padding: 0 14px; }
}

/* legend editor */
.lg-edit { display: block; width: 100%; background: none; border: 1px solid transparent; border-radius: var(--r); padding: 4px; margin: -4px; cursor: pointer; text-align: left; color: inherit; transition: border-color var(--t); width: calc(100% + 8px); }
.lg-edit:hover { border-color: var(--line2); }
.lg-hint { color: var(--text3); }
#legend b.cust { color: var(--gold); font-weight: 500; }
#rangeEd { position: absolute; left: 312px; bottom: 16px; width: 300px; z-index: 30; background: var(--bg1); border: 1px solid var(--line3); border-radius: var(--r); padding: 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.re-h { display: flex; justify-content: space-between; align-items: center; position: relative; margin-bottom: 8px; }
.re-h .x { position: static; }
.re-bar { display: flex; height: 10px; border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
.re-bar i { flex: 1; }
.re-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.re-grid label { display: grid; grid-template-columns: 1fr 18px; grid-template-rows: auto auto; gap: 3px 4px; font-size: 12px; color: var(--text2); }
.re-grid label span { grid-column: 1 / 3; }
.re-grid b.cold { color: #5B9BD5; font-weight: 500; } .re-grid b.hot { color: #EE7A3F; font-weight: 500; }
.re-grid input { background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 8px; font-family: var(--mono); font-size: 13px; width: 100%; }
.re-grid input:focus { border-color: var(--gold); outline: none; }
.re-grid em { font-style: normal; color: var(--text3); align-self: center; font-family: var(--mono); }
.re-note { color: var(--text3); font-size: 11px; margin: 10px 0; line-height: 1.4; }
.re-b { display: flex; gap: 8px; justify-content: flex-end; }
.re-b .rx-btn { padding: 6px 12px; font-size: 12px; }
.re-b .rx-btn.on { color: var(--gold); border-color: var(--line3); }
@media (max-width: 820px) {
  #rangeEd { position: fixed; left: 0; right: 0; bottom: 0; width: auto; border-radius: 12px 12px 0 0; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); z-index: 40; }
  .re-grid input, .re-grid select { min-height: 44px; font-size: 16px; }
  .re-b .rx-btn, .re-h .x { min-height: 44px; min-width: 44px; }
  body.re-on #side { display: none; }
  #side:not(.open) .lg-hint { display: none; }
}
