:root {
  color-scheme: light;
  --ink: #1F2328; --muted: #5F6670; --grid: #E3E5E8; --bg: #FFFFFF; --panel: #F7F8F9; --accent: #1F2328;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.5; }
header, main, footer, nav { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
header { padding-top: 20px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
.stamp { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.summary { margin: 6px 0 0; font-size: 14px; }
.live { margin: 2px 0 0; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2E9E4F; display: inline-block; }
.dot.stale { background: #C0392B; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--grid); margin-top: 14px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: inherit; font-size: 15px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--grid); border-radius: 8px; background: var(--bg); min-width: 120px; }
.chip .sw { width: 10px; height: 28px; border-radius: 3px; }
.chip b { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.chip span { font-size: 12px; color: var(--muted); display: block; }
.chip .nm { font-size: 13px; color: var(--ink); }
@media (max-width: 520px) {
  .chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .chip { min-width: 0; padding: 6px 8px; gap: 6px; }
  .chip b { font-size: 18px; }
  .chip .sw { height: 22px; width: 6px; }
}

.grid { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 28px; align-items: start; }
@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } }
.mapwrap { position: sticky; top: 52px; }
@media (max-width: 880px) { .mapwrap { position: static; } }
.map svg { width: 100%; height: auto; display: block; touch-action: manipulation; }
.map path { stroke-linejoin: round; }
.seg { display: inline-flex; border: 1px solid var(--grid); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.seg button { border: 0; background: var(--bg); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.note { font-size: 12px; color: var(--muted); margin: 6px 0; }

.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 118px; gap: 10px; align-items: center; font-size: 13px; padding: 2px 0; cursor: default; }
.row:hover, .row.sel { background: var(--panel); }
.row .nm { font-weight: 600; }
.row .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 26px; border-radius: 4px; overflow: hidden; background: #EEEEEE; position: relative; }
.bar div { height: 100%; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 2px solid #fff; min-width: 0; }
.bar div:last-child { border-right: 0; }
.bar .half { position: absolute; left: 50%; top: -2px; bottom: -2px; border-left: 1px dashed var(--muted); border-right: 0; width: 0; }
.row .ld { font-variant-numeric: tabular-nums; }
.row .ld small { color: var(--muted); display: block; font-size: 11px; }
@media (max-width: 520px) { .row { grid-template-columns: 62px minmax(0, 1fr); } .row .ld { grid-column: 2; margin-top: -4px; } }

.pick { font-size: 14px; }
.pick select { font: inherit; padding: 4px 8px; margin-left: 6px; }
.district { margin: 14px 0 20px; scroll-margin-top: 60px; }
.pick { scroll-margin-top: 60px; display: inline-block; }
.district h3 { font-size: 14px; margin: 0 0 6px; }
.district h3 small { font-weight: 400; color: var(--muted); margin-left: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--grid); }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.win td { background: #F3F6FA; }
.tag { font-size: 11px; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.tag.ok { background: var(--ink); color: #fff; }
.tag.proj { border: 1px solid var(--muted); color: var(--muted); }
.pdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

.downloads a { margin-right: 14px; font-size: 13px; color: var(--ink); }
footer { color: var(--muted); font-size: 12px; padding: 24px 16px 40px; border-top: 1px solid var(--grid); margin-top: 28px; }
footer p { margin: 0 0 8px; }
footer a { color: var(--muted); }
.cc0 { display: inline-block; font-weight: 700; font-size: 10px; letter-spacing: .5px; border: 1.5px solid var(--muted); border-radius: 3px; padding: 0 4px; margin-right: 4px; vertical-align: 1px; }

.tip { position: fixed; z-index: 20; background: #fff; border: 1px solid var(--grid); box-shadow: 0 6px 24px rgba(0,0,0,.12); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; max-width: 300px; pointer-events: none; }
.tip h4 { margin: 0 0 2px; font-size: 14px; }
.tip .sub { color: var(--muted); font-size: 11.5px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.tip table td { border: 0; padding: 2px 4px; }
.tip .mini { height: 5px; background: #EEE; border-radius: 3px; width: 54px; }
.tip .mini i { display: block; height: 100%; border-radius: 3px; }
