:root {
  --bg: #0b0f14; --panel: #121820; --line: #243040; --fg: #f2f5f8; --mute: #8fa0b3;
  --g: #34d399; --a: #fbbf24; --r: #f87171; --accent: #60a5fa;
  --hdr: 52px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f4f6f8; --panel: #fff; --line: #d6dde6; --fg: #0b0f14; --mute: #4b5b6d; --g: #059669; --a: #b45309; --r: #dc2626; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button, select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
button { cursor: pointer; min-height: 36px; }
a { color: var(--accent); }

header { height: var(--hdr); display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--panel); gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; }
.logo { color: var(--g); font-size: 18px; }
h1 { font-size: 18px; margin: 0; letter-spacing: -0.01em; }
.controls { display: flex; gap: 6px; align-items: center; }
.units button { border-radius: 0; padding: 6px 8px; }
.units button:first-child { border-radius: 8px 0 0 8px; }
.units button:last-child { border-radius: 0 8px 8px 0; }
.units button.on { background: var(--accent); color: #000; border-color: var(--accent); }
#refresh { font-variant-numeric: tabular-nums; }
#refresh.busy { opacity: .6; }

main { height: calc(100% - var(--hdr)); display: grid; grid-template-rows: 45% 55%; }
#map { background: #1a2430; }
#side { overflow: auto; border-top: 1px solid var(--line); background: var(--bg); }
@media (min-width: 900px) {
  main { grid-template-rows: 1fr; grid-template-columns: 1fr 420px; }
  #side { border-top: 0; border-left: 1px solid var(--line); }
}
.listbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; gap: 8px; position: sticky; top: 0; background: var(--bg); z-index: 2; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--mute); }
#sethome.on { background: var(--accent); color: #000; }

#list { list-style: none; margin: 0; padding: 0; }
#list li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
#list li:active { background: var(--panel); }
#list li.stale { opacity: .55; }
#list .arrow { width: 44px; height: 44px; display: grid; place-items: center; }
#list .arrow svg { width: 40px; height: 40px; }
#list .name { font-weight: 600; font-size: 16px; }
#list .sub { color: var(--mute); font-size: 13px; }
#list .nums { text-align: right; font-variant-numeric: tabular-nums; }
#list .spd { font-size: 28px; font-weight: 700; line-height: 1; }
#list .spd small { font-size: 13px; font-weight: 400; color: var(--mute); }
#list .gst { font-size: 14px; color: var(--mute); }
.age { font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: 6px; color: #000; display: inline-block; }
.age.g { background: var(--g); } .age.a { background: var(--a); } .age.r { background: var(--r); color: #fff; }
.tier { font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--mute); margin-left: 4px; }
.foot { color: var(--mute); font-size: 12px; padding: 12px; }
.foot b.g { color: var(--g);} .foot b.a { color: var(--a);} .foot b.r { color: var(--r);}

/* map markers */
.wm { background: none; border: 0; }
.wm .pin { position: relative; width: 64px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0; filter: drop-shadow(0 1px 2px #0008); }
.wm .pin svg { width: 30px; height: 30px; flex: none; }
.wm .pin .lbl { position: relative; background: var(--panel); color: var(--fg); border: 2px solid var(--line); border-radius: 8px; padding: 2px 6px; font-weight: 700; font-size: 15px; line-height: 1.1; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 34px; }
.wm .pin .lbl small { display: block; font-weight: 400; font-size: 10px; color: var(--mute); }
.wm.g .lbl { border-color: var(--g); } .wm.a .lbl { border-color: var(--a); } .wm.r .lbl { border-color: var(--r); opacity: .6; }
.wm.g svg path { fill: var(--g); } .wm.a svg path { fill: var(--a); } .wm.r svg path { fill: var(--r); }
.leaflet-container { font: inherit; }
.home-pin { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px #000); }

/* detail sheet */
#detail[hidden] { display: none; }
#detail { position: fixed; inset: 0; background: #0009; z-index: 1000; display: grid; place-items: end center; }
#detail .card { width: 100%; max-width: 680px; background: var(--panel); border-radius: 16px 16px 0 0; padding: 16px; position: relative; max-height: 90vh; overflow: auto; }
@media (min-width: 900px) { #detail { place-items: center; } #detail .card { border-radius: 16px; } }
#detail .close { position: absolute; right: 10px; top: 10px; width: 36px; }
#detail h2 { margin: 0 32px 4px 0; font-size: 20px; }
#d-meta { color: var(--mute); font-size: 13px; margin-bottom: 10px; }
#d-now { display: flex; gap: 18px; align-items: baseline; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
#d-now .big { font-size: 40px; font-weight: 700; line-height: 1; }
#d-now .big small { font-size: 14px; font-weight: 400; color: var(--mute); }
#d-chart { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
#d-links { margin-top: 10px; font-size: 13px; color: var(--mute); display: flex; gap: 12px; flex-wrap: wrap; }
