:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #202124;
  --ink2: #5f6368;
  --line: #dadce0;
  --soft: #f1f3f4;
  --accent: #1a73e8;
  --real: #1565c0;
  --virt: #7b1fa2;
  --virt-band: rgba(123, 31, 162, 0.16);
  --s-none: #b0bec5;
  --s-short: #90a4ae;
  --s0: #4f8fb8;
  --s1: #f4b400;
  --s2: #f57c00;
  --s3: #c62828;
  --z1: rgba(244, 180, 0, 0.12);
  --z2: rgba(245, 124, 0, 0.13);
  --z3: rgba(198, 40, 40, 0.12);
  --shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --panel-w: 400px;
  --bar-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

/* top bar */
.bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); display: flex; align-items: center; gap: 16px; padding: 0 12px 0 16px; background: var(--bg); box-shadow: var(--shadow); z-index: 10; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 20px; color: var(--ink2); white-space: nowrap; min-width: calc(var(--panel-w) - 32px); }
.brand svg { width: 28px; height: 28px; fill: var(--accent); }
.brand b { color: var(--ink); font-weight: 500; }
.search { position: relative; flex: 1; max-width: 720px; display: flex; align-items: center; background: var(--soft); border-radius: 8px; padding: 0 12px; height: 44px; }
.search:focus-within { background: #fff; box-shadow: var(--shadow); }
.search svg { width: 20px; height: 20px; fill: var(--ink2); flex: none; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font: inherit; font-size: 16px; padding: 0 10px; color: var(--ink); min-width: 0; }
#results { position: absolute; top: 46px; left: 0; right: 0; margin: 0; padding: 6px 0; list-style: none; background: #fff; border-radius: 8px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
#results li { padding: 8px 14px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
#results li[aria-selected="true"], #results li:hover { background: var(--soft); }
#results li small { color: var(--ink2); margin-left: auto; white-space: nowrap; }
.icon { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.icon:hover { background: var(--soft); }
.icon svg { width: 24px; height: 24px; fill: var(--ink2); }

/* layout */
main { position: fixed; inset: var(--bar-h) 0 24px 0; display: flex; }
#panel { width: var(--panel-w); flex: none; overflow-y: auto; overflow-x: hidden; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 20px 24px; z-index: 2; }
#map { flex: 1; min-width: 0; }
footer { position: fixed; inset: auto 0 0 0; height: 24px; display: flex; align-items: center; padding: 0 12px; font-size: 11px; color: var(--ink2); background: #f8f9fa; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

h1 { font-size: 22px; font-weight: 400; margin: 4px 0 4px; }
h2 { font-size: 13px; font-weight: 500; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.window { color: var(--ink2); margin: 0 0 8px; }
.help { border: 1px solid var(--line); background: #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; line-height: 16px; padding: 0; color: var(--ink2); }
.link { border: 0; background: none; color: var(--accent); padding: 4px 0; font-weight: 500; }

/* legend */
.sev { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.sev li { display: flex; align-items: center; gap: 10px; }
.sev li em { margin-left: auto; font-style: normal; color: var(--ink2); font-variant-numeric: tabular-nums; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.mk { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; vertical-align: -1px; }
.mk.real { background: var(--s0); border: 2px solid #263238; }
.mk.virt { background: #fff; border: 2.5px solid var(--s0); }
.mk.virt.low { border-style: dotted; }
.toggle.sub { padding-left: 42px; }
.toggle:has(input:disabled) { opacity: .45; cursor: default; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw { width: 32px; height: 18px; border-radius: 9px; background: #bdc1c6; position: relative; flex: none; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.toggle input:checked + .sw { background: var(--accent); }
.toggle input:checked + .sw::after { transform: translateX(14px); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle small { color: var(--ink2); }
.toggle em { margin-left: auto; font-style: normal; color: var(--ink2); font-variant-numeric: tabular-nums; }

/* lab credit, at the foot of the home panel */
#home:not([hidden]) { display: flex; flex-direction: column; min-height: 100%; }
.lab { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--ink2); }
.lab img { width: 72px; height: 72px; display: block; }
.empty { color: var(--ink2); padding: 8px 0; }

/* detail */
.back { margin-bottom: 4px; }
.kind { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 3px 10px 3px 8px; border-radius: 12px; }
.kind.real { background: #e3f2fd; color: var(--real); }
.kind.virt { background: #f3e5f5; color: var(--virt); }
.sub { color: var(--ink2); margin: 0 0 10px; }
.status { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--soft); margin-bottom: 12px; }
.status b { font-weight: 500; }
.status small { display: block; color: var(--ink2); }
.charthead { display: flex; align-items: center; justify-content: space-between; color: var(--ink2); font-size: 12px; }
.units { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.units button { border: 0; background: #fff; padding: 2px 10px; font-size: 12px; }
.units button[aria-pressed="true"] { background: #e8f0fe; color: var(--accent); font-weight: 500; }
#chart { margin: 4px 0 0; min-height: 240px; overflow: hidden; }
.ckey { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink2); margin: 2px 0 10px; }
.ckey span { display: inline-flex; align-items: center; gap: 6px; }
.ckey i { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.ckey i.band { height: 10px; border: 0; }
.ckey i.pass { width: 8px; height: 8px; border-radius: 50%; border: 0; }
.ckey i.offpass { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 0; border-bottom: 8px solid #202124; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 8px 0; }
.facts dt { color: var(--ink2); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.facts .go { color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.links { font-size: 13px; }
.u-legend { display: none; }
.tip { position: absolute; pointer-events: none; background: rgba(32,33,36,.92); color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 4px; white-space: nowrap; z-index: 5; transform: translate(-50%, -110%); }

/* map */
.basemap { position: fixed; right: 54px; top: calc(var(--bar-h) + 10px); display: flex; background: #fff; border-radius: 6px; box-shadow: var(--shadow); overflow: hidden; z-index: 3; }
.basemap button { border: 0; background: #fff; padding: 6px 12px; font-size: 13px; }
.basemap button[aria-pressed="true"] { background: #e8f0fe; color: var(--accent); font-weight: 500; }
.maplibregl-popup-content { padding: 8px 10px; font: 13px/1.35 Roboto, system-ui, sans-serif; border-radius: 6px; }
.maplibregl-popup-content small { color: var(--ink2); }

/* about */
dialog { border: 0; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.25); max-width: 560px; width: calc(100% - 32px); padding: 20px 24px; color: var(--ink); max-height: 85vh; }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { text-transform: none; letter-spacing: 0; font-size: 20px; color: var(--ink); font-weight: 400; margin: 0 0 8px; }
dialog h3 { font-size: 15px; font-weight: 500; margin: 14px 0 4px; display: flex; align-items: center; gap: 8px; }
dialog p { margin: 0 0 6px; }
dialog .small { font-size: 12px; color: var(--ink2); margin-top: 12px; }
dialog .close { float: right; font-size: 18px; color: var(--ink2); }

@media (max-width: 760px) {
  :root { --bar-h: 52px; }
  .brand { min-width: 0; font-size: 0; }
  .brand svg { width: 26px; height: 26px; }
  .bar { gap: 8px; padding: 0 8px; }
  main { flex-direction: column-reverse; bottom: 0; }
  #panel { width: 100%; height: 46vh; border-right: 0; border-top: 1px solid var(--line); padding: 12px 16px 20px; box-shadow: 0 -2px 6px rgba(0,0,0,.08); }
  #map { flex: 1; }
  footer { display: none; }
  .basemap { right: 10px; }
  #chart { min-height: 200px; }
}
