/* Layout: one reading column; help banner, header, tab bar, then each section's tiles, charts and tables. */
:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --ink: #16201d;
  --ink-2: #4b5753;
  --ink-3: #5f6b67;
  --line: #dde3e0;
  --grid: #eceff0;
  --accent: #1f6f5c;
  --help-bg: #e6f1ec;
  --s-hk: #2a78d6;
  --s-tw: #eb6834;
  --s-mo: #1baf7a;
  --t-gov: #4a3aa7; --t-ngo: #e87ba4; --t-aca: #eda100; --t-news: #008300;
  --m-diagnostic: #1f6f5c; --m-screening: #8cc3b0; --m-scale: #b7c2be;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121715; --surface: #1a201e; --ink: #eef2f0; --ink-2: #b9c3bf; --ink-3: #8a9591;
    --line: #2c3431; --grid: #242b28; --accent: #6cc3a8; --help-bg: #1c2b26;
    --s-hk: #3987e5; --s-tw: #d95926; --s-mo: #199e70; color-scheme: dark;
    --t-gov: #9085e9; --t-ngo: #d55181; --t-aca: #c98500; --t-news: #2f9e44;
    --m-diagnostic: #6cc3a8; --m-screening: #2f6b5a; --m-scale: #4b5753;
  }
}
/* An explicit theme choice on the root element wins over the system setting. */
:root[data-theme="dark"] {
    --bg: #121715; --surface: #1a201e; --ink: #eef2f0; --ink-2: #b9c3bf; --ink-3: #8a9591;
    --line: #2c3431; --grid: #242b28; --accent: #6cc3a8; --help-bg: #1c2b26;
    --s-hk: #3987e5; --s-tw: #d95926; --s-mo: #199e70; color-scheme: dark;
    --t-gov: #9085e9; --t-ngo: #d55181; --t-aca: #c98500; --t-news: #2f9e44;
    --m-diagnostic: #6cc3a8; --m-screening: #2f6b5a; --m-scale: #4b5753;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.6; padding-inline: 16px; padding-block: 0 48px; }
a { color: var(--accent); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.help { max-width: 960px; margin: 0 auto; background: var(--help-bg); border-radius: 0 0 10px 10px; padding: 10px 16px; font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.help > span { min-width: 0; }
.help .num { white-space: nowrap; }

.top, .tabs, main, .foot { max-width: 960px; margin-inline: auto; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-block: 24px 8px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 5vw, 38px); line-height: 1.15; margin: 4px 0 0; text-wrap: balance; }
h1 small { display: block; font-family: var(--font-body); font-weight: 500; font-size: .5em; color: var(--ink-2); margin-top: 4px; }
.lang { font: inherit; font-size: 13px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 24px; }
.tabs a { text-decoration: none; color: var(--ink-2); padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

main { display: grid; gap: 28px; }
section { display: grid; gap: 12px; min-width: 0; }
h2 { font-family: var(--font-display); font-weight: 500; font-size: 22px; margin: 0; text-wrap: balance; }
h3 { font-size: 15px; font-weight: 700; margin: 0; }
.sub { color: var(--ink-3); font-size: 13px; margin: 0; }
.lead { color: var(--ink-2); max-width: 68ch; margin: 0; }
.note { font-size: 13px; color: var(--ink-2); margin: 0; max-width: 72ch; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 6px; align-content: start; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.who .zh { color: var(--ink-3); font-weight: 400; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.big { font-family: var(--font-mono); font-size: 32px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.big em { font-style: normal; font-size: 13px; color: var(--ink-3); font-family: var(--font-body); margin-left: 4px; }
.meta { font-size: 13px; color: var(--ink-2); }
.pill { font-size: 11.5px; border-radius: 999px; padding: 1px 8px; background: var(--grid); color: var(--ink-2); width: fit-content; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.legend input { accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; background: transparent; color: var(--ink-2); border: 0; padding: 4px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.chartwrap { position: relative; }
.chartwrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chartwrap svg text { fill: var(--ink-3); font-family: var(--font-mono); font-size: 11px; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 170px; z-index: 2; }
.tip b { display: block; font-family: var(--font-mono); margin-bottom: 2px; }
.tip div { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tip .l { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); }

.regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.facts li { display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.facts li:last-child { border-bottom: 0; padding-bottom: 0; }
.facts .v { font-family: var(--font-mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.facts .k { font-size: 13.5px; }
.facts .s { font-size: 12px; color: var(--ink-3); }

.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; color: var(--ink-3); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
td.r, th.r { text-align: right; }
.est { font-size: 11px; color: var(--ink-3); }
.type { font-size: 11.5px; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }

.foot { font-size: 12.5px; color: var(--ink-3); margin-top: 32px; }
.loading { color: var(--ink-3); }

/* Chart-led layout */
.lead { font-size: 16px; }
.sec-head { display: grid; gap: 2px; }
.grid2, .grid3 { display: grid; gap: 16px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }
.chart-card h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; }
.chartwrap svg .gl { stroke: var(--grid); stroke-width: 1; }
.chartwrap svg .axis { stroke: var(--line); stroke-width: 1; }
.chartwrap svg .xh { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.chartwrap svg .track { fill: var(--grid); }
.chartwrap svg text.lbl { fill: var(--ink-2); font-weight: 500; }
.chartwrap svg text.hl { fill: var(--ink); font-family: var(--font-body); font-size: 13px; }
.tip .tn { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 4px; max-width: 240px; }
.cite { font-size: 12px; color: var(--ink-3); margin: 0; line-height: 1.7; }
.cite a { color: var(--ink-2); }
.type { font-size: 11px; border-radius: 999px; padding: 0 7px; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; display: inline-block; line-height: 18px; }
.type::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.t-government::before { background: var(--t-gov); } .t-ngo::before { background: var(--t-ngo); }
.t-academic::before { background: var(--t-aca); } .t-news::before { background: var(--t-news); }
.tile { position: relative; overflow: hidden; }
.tile::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.sparkwrap { height: 40px; }
.sparkwrap svg { width: 100%; height: 40px; display: block; }
.delta { font-family: var(--font-mono); font-size: 12.5px; }
.delta.up { color: var(--ink); } .delta.down { color: var(--ink-2); }
.legend.static { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend.static span { display: inline-flex; align-items: center; gap: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat { display: grid; gap: 2px; align-content: start; padding: 12px; border-radius: 8px; background: var(--bg); }
.stat .big { font-size: 26px; }
.stat .k { font-size: 13.5px; }
.stat .s { font-size: 12px; color: var(--ink-3); }
.stack { display: flex; height: 18px; border-radius: 6px; overflow: hidden; gap: 2px; }
.stack span { display: block; min-width: 4px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 88px auto 1fr; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-3); font-size: 12.5px; }
details.data { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
details.data summary { cursor: pointer; padding: 12px 16px; font-weight: 500; color: var(--ink-2); }
details.data[open] summary { border-bottom: 1px solid var(--line); }
details.data .tablewrap { padding: 4px 8px 8px; }
.note.gap { padding: 12px 16px; border: 1px dashed var(--line); border-radius: 10px; }
.bar h2 { margin: 0; }
.seg { flex-wrap: wrap; }

.datafoot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.datafoot .dl { font: inherit; font-size: 12px; color: var(--ink-2); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.datafoot .dl:hover, .datafoot .dl:focus-visible { color: var(--ink); border-color: var(--ink-3); }

.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--bg); padding: 8px 14px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.about h2 { margin-top: 28px; }
.about p, .about li { max-width: 62ch; line-height: 1.75; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
