:root {
  --bg: #e7edf2;
  --ink: #15202b;
  --muted: #5b6b78;
  --line: #d3dde5;
  --card: #ffffff;
  --brand: #1a5276;
  --brand-deep: #102c40;
  --soft: #e5eef4;
  --death: #8e2f33;
  --alcohol: #6e4a3a;
  --neutral: #8b97a3;
  --shadow: 0 12px 32px rgba(16, 36, 52, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, #f7fafc 0, #f7fafc 220px, var(--bg) 520px);
  color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-size: 1.02rem;
  line-height: 1.65;
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 0.16em; }
a:hover { color: var(--brand-deep); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: white;
  padding: 0.5rem 0.8rem;
  z-index: 6;
}
.skip:focus { top: 0.5rem; }

.wrap { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(247, 250, 252, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  min-height: 4.1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.mark {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 4px;
  background:
    linear-gradient(#f2d36b, #f2d36b) left 3px bottom 3px / calc(100% - 6px) 2px no-repeat,
    var(--brand);
  box-shadow: inset 0 0 0 1px rgba(16, 44, 64, 0.18);
  position: relative;
  flex: 0 0 auto;
}
.mark::before,
.mark::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  height: 2px;
  background: rgba(255, 255, 255, 0.92);
}
.mark::before { top: 3px; }
.mark::after { top: 7px; }
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.15rem 0.15rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 650;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
}
.nav a:hover { color: var(--ink); background: var(--soft); }
.nav a[aria-current="page"] {
  color: var(--brand-deep);
  background: var(--soft);
}

main { padding: 0.4rem 0 3.5rem; }
main > h1 { margin-top: 1.45rem; }
main > p, main > ul { max-width: 44rem; }
main > p.note { max-width: none; }
.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.14em;
}
h1, h2, h3 { letter-spacing: -0.03em; line-height: 1.2; }
main h1 {
  margin: 0.1rem 0 0.7rem;
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  font-weight: 750;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.75fr);
  gap: 1.6rem 2rem;
  align-items: end;
  padding: 2.3rem 0 0.4rem;
}
.hero h1 {
  max-width: 14em;
  margin: 0;
  font-size: clamp(2.25rem, 4.8vw, 3.55rem);
  line-height: 1.12;
}
.lede {
  max-width: 40rem;
  margin: 0.85rem 0 0;
  color: #314250;
  font-size: 1.12rem;
}
.hero-aside {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1rem;
}
.hero-aside strong { display: block; margin-bottom: 0.35rem; }
.hero-aside p:last-child { margin: 0; color: var(--muted); font-size: 0.95rem; }

h2 { font-size: 1.45rem; margin: 2.3rem 0 0.7rem; }
h3 { font-size: 1.02rem; margin: 0 0 0.7rem; }
.section-head { margin: 2.4rem 0 0.85rem; }
.section-head h2 { margin: 0; }
.note {
  margin: 0.85rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  border-left: 3px solid #b7c9d6;
  padding: 0.1rem 0 0.1rem 0.8rem;
}
.note + .note { margin-top: 0.45rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin: 1.5rem 0 0.2rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem 0.9rem;
}
.stat span, .stat small { display: block; color: var(--muted); }
.stat span { font-size: 0.82rem; font-weight: 650; }
.stat strong {
  display: block;
  margin: 0.28rem 0 0.2rem;
  color: var(--brand-deep);
  font-size: clamp(1.35rem, 2.4vw, 2.25rem);
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.stat small { font-size: 0.84rem; }
.stat.death strong { color: var(--death); }

.atlas-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.1fr);
  gap: 1.2rem 1.6rem;
  align-items: start;
  margin-top: 2rem;
}
.atlas-copy { padding-top: 0.8rem; }
.atlas-copy h2 { margin-top: 0; }
.atlas-copy p { color: var(--muted); }
.atlas {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0.4rem 0.5rem 0.2rem;
}
.atlas svg { display: block; width: min(100%, 460px); margin: 0 auto; }

.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
.entry {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem 1.05rem;
  color: inherit;
  text-decoration: none;
}
.entry:hover { border-color: #9eb4c6; color: inherit; }
.entry strong { color: var(--ink); font-size: 1.12rem; }
.entry-kicker { color: var(--brand); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.06em; }
.entry-figure {
  margin: 0.15rem 0;
  color: var(--brand-deep);
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.entry-meta, .entry > span:last-child { color: var(--muted); font-size: 0.92rem; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding: 0.9rem 1rem 0.35rem; font-weight: 700; color: var(--ink); white-space: normal; }
th, td { padding: 0.62rem 0.9rem; border-top: 1px solid var(--line); text-align: right; vertical-align: top; white-space: nowrap; }
th:first-child, td:first-child, th[scope="row"] { text-align: left; }
thead th {
  border-top: 0;
  background: #f4f8fb;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.82rem;
}
tbody tr:hover { background: #f7fafc; }
td a, th a { font-weight: 650; text-decoration: none; }
td a:hover, th a:hover { text-decoration: underline; }

.dist-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0.4rem 0 1rem;
}
.dist-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem 1rem;
}
.dist-card.wide, .dist-grid > .note { grid-column: 1 / -1; }
.bars { display: grid; gap: 0.42rem; }
.bar-row { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto; gap: 0.6rem; align-items: center; }
.bar-row span:first-child { color: var(--ink); font-size: 0.92rem; }
.bar-row span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.track {
  display: block;
  height: 0.48rem;
  background: var(--soft);
  border-radius: 99px;
  overflow: hidden;
}
.bar { display: block; height: 100%; background: var(--brand); border-radius: inherit; min-width: 2px; }
.bar.death { background: var(--death); }

.controls { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; margin: 0.8rem 0 1rem; }
label { display: grid; gap: 0.28rem; font-size: 0.88rem; font-weight: 650; color: var(--muted); }
select, input[type="search"] {
  font: inherit;
  color: var(--ink);
  background: white;
  border: 1px solid #c5d0d8;
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  min-width: 11rem;
  min-height: 2.7rem;
}
.links { display: flex; flex-wrap: wrap; gap: 0.45rem; padding: 0; margin: 0.2rem 0 0.4rem; list-style: none; }
.links a {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--brand-deep);
  text-decoration: none;
  border-radius: 999px;
  padding: 0.22rem 0.72rem;
}
.links a:hover { border-color: #9eb4c6; background: var(--soft); }
.links a span { margin-left: 0.2rem; color: var(--muted); font-weight: 550; }
p.links a { margin: 0 0.35rem 0.35rem 0; }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.88rem;
  padding: 1rem 0 0;
  margin: 0 0 0.9rem;
  list-style: none;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.crumbs li:not(:last-child)::after { content: "/"; margin-left: 0.3rem; color: #9aabba; }

main ul { max-width: 44rem; padding-left: 1.15rem; }
main li { margin: 0.35rem 0; }

#map {
  height: 72vh;
  min-height: 460px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #d9e3ea;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.map-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1rem; align-items: start; }
.map-layout .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.95rem;
}
.map-layout .controls { flex-direction: column; align-items: stretch; margin: 0; }
.map-layout select { width: 100%; min-width: 0; }
#map-status { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; font-weight: 450; }

.site-footer {
  border-top: 1px solid var(--line);
  background: #f7fafc;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto;
  gap: 1.2rem 2rem;
  align-items: start;
  padding: 1.6rem 0 2rem;
}
.footer-name { margin: 0 0 0.35rem; color: var(--ink); font-weight: 750; }
.footer-inner p { margin: 0.25rem 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; }
.footer-links a { color: var(--brand-deep); font-weight: 650; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

.story-lines { list-style: none; max-width: 42rem; margin: 0.2rem 0 1rem; padding: 0; }
.story-lines li { margin: 0.28rem 0; }
.delta { font-weight: 700; }
.delta.up { color: var(--death); }
.delta.down { color: var(--brand); }

.chart, .rank-chart {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem 0.7rem;
  margin: 0.4rem 0 1rem;
  max-width: 100%;
}
.chart figcaption, .rank-chart figcaption, .dist-card figcaption {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}
.chart figcaption strong, .rank-chart figcaption strong, .dist-card figcaption strong {
  color: var(--ink);
  font-size: 1.05rem;
}
.chart figcaption span, .rank-chart figcaption span, .dist-card figcaption span {
  color: var(--muted);
  font-size: 0.92rem;
}
.chart svg { display: block; width: 100%; height: auto; }
.chart-values, .rank-list, .map-legend, .story-lines { max-width: none; }
.chart-values {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  list-style: none;
  margin: 0.75rem 0 0.2rem;
  padding: 0;
}
.chart-values li { font-variant-numeric: tabular-nums; }
.chart-values .is-gap { color: var(--muted); }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.rank-list a, .rank-row {
  display: grid;
  grid-template-columns: 1.6rem minmax(4.5rem, max-content) minmax(0, 1fr) auto;
  gap: 0.45rem 0.6rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.rank-pos { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.88rem; }
.rank-label { color: var(--ink); font-weight: 650; white-space: normal; }
.rank-value { color: var(--brand-deep); font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-track {
  display: block;
  height: 0.5rem;
  background: var(--soft);
  border-radius: 99px;
  overflow: hidden;
  min-width: 0;
}
.rank-bar { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0.4rem 0 1rem;
}
.time-grid .wide { grid-column: 1 / -1; }

.map-legend { list-style: none; margin: 0.35rem 0 0.7rem; padding: 0; display: grid; gap: 0.35rem; }
.map-legend li { color: var(--ink); font-size: 0.9rem; font-weight: 450; }
.swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.35rem;
  border-radius: 99px;
  background: var(--brand);
  box-shadow: 0 0 0 1.5px white, 0 0 0 2.5px var(--brand);
  vertical-align: -0.05rem;
}
.swatch.a1 { background: var(--death); box-shadow: 0 0 0 1.5px white, 0 0 0 2.5px var(--death); }

.reading h1 { margin-top: 1.45rem; }
.reading h2 { padding-top: 0.9rem; border-top: 1px solid var(--line); }
.reading p, .reading li { max-width: 42rem; }

@media (max-width: 860px) {
  .topbar { align-items: stretch; flex-direction: column; gap: 0.15rem; padding-top: 0.7rem; }
  .nav { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 0.55rem; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; font-size: 0.86rem; padding: 0.35rem 0.5rem; }
  .hero, .atlas-layout, .entry-grid, .dist-grid, .time-grid, .map-layout, .footer-inner, .scope-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 1.4rem; }
  #map { height: 68vh; min-height: 360px; }
}
@media (max-width: 560px) {
  .wrap { width: min(1120px, calc(100% - 1.4rem)); }
  .hero h1 { font-size: clamp(1.7rem, 7.4vw, 2.15rem); }
  .rank-list a, .rank-row {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto;
    grid-template-areas:
      "pos label value"
      "pos bar bar";
  }
  .rank-pos { grid-area: pos; }
  .rank-label { grid-area: label; }
  .rank-value { grid-area: value; }
  .rank-track { grid-area: bar; }
}

.cause-top { padding-top: 1.15rem; }
.cause-top h1 { margin-top: 0; }
.cause-stats { margin-top: 1rem; }
.cause-stats .stat small { overflow-wrap: anywhere; }
.stat.is-alcohol { border-top: 3px solid var(--alcohol); }
.stat.is-alcohol strong { color: var(--alcohol); }
.stat.is-neutral strong { color: var(--neutral); }
.theme-entry-label { margin: 1rem 0 0; color: var(--brand); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.08em; }
.theme-entry, .theme-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 100%;
  margin: 0.85rem 0 0.2rem;
}
.theme-entry a, .theme-switch button {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  min-height: 2.75rem;
  max-width: 100%;
  text-align: left;
  text-decoration: none;
  line-height: 1.35;
  cursor: pointer;
}
.theme-entry a:hover, .theme-switch button:hover { border-color: #9eb4c6; background: var(--soft); }
.theme-switch button[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.theme-switch button[data-theme="alcohol"][aria-pressed="true"] {
  background: var(--alcohol);
  border-color: var(--alcohol);
}
.theme-status { margin: 0.35rem 0 0.8rem; color: var(--muted); }
.js-only { display: none; }
html.js .js-only { display: inline; }
html.js .no-js-note { display: none; }
html.js .theme-panel { display: none; }
html.js .theme-panel.is-selected { display: block; }
.theme-panel h3 { margin-top: 0.4rem; font-size: 1.35rem; }
.death-num { color: var(--death); font-weight: 750; }
.cause-list, .compare-list { list-style: none; margin: 0; padding: 0; }
.cause-list li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr) auto;
  grid-template-areas:
    "pos label value"
    "pos bar bar"
    "pos meta meta";
  gap: 0.12rem 0.55rem;
  align-items: center;
  padding: 0.48rem 0;
  border-top: 1px solid var(--line);
}
.cause-list .rank-pos { grid-area: pos; }
.cause-list .rank-label { grid-area: label; white-space: normal; overflow-wrap: anywhere; }
.cause-list .rank-value { grid-area: value; }
.cause-list .rank-track { grid-area: bar; }
.cause-list .rank-meta { grid-area: meta; color: var(--muted); font-size: 0.88rem; }
.city-list li {
  grid-template-areas:
    "pos label value"
    "pos bar bar";
}
.cause-list li.is-neutral .rank-value { color: var(--neutral); }
.cause-list li.is-alcohol .rank-value { color: var(--alcohol); }
.rank-bar.is-neutral, .bar.is-neutral { background: var(--neutral); }
.rank-bar.is-alcohol, .bar.is-alcohol { background: var(--alcohol); }
.compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  align-items: center;
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.legend-swatch {
  width: 0.85rem;
  height: 0.45rem;
  border-radius: 99px;
  background: var(--brand);
  display: inline-block;
}
.legend-swatch.y2024 { background: #8eacbf; }
.legend-swatch.is-neutral { background: var(--neutral); }
.compare-item { padding: 0.75rem 0; border-top: 1px solid var(--line); }
.compare-name { margin: 0 0 0.35rem; font-weight: 750; overflow-wrap: anywhere; }
.compare-year {
  display: grid;
  grid-template-columns: 3.2rem minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
  margin: 0.18rem 0;
}
.compare-year .yr { color: var(--muted); font-size: 0.88rem; }
.compare-year .n { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.bar.y2024 { background: #8eacbf; }
.bar.y2024.is-neutral { background: #c5ced6; }
.bar.y2025.is-neutral { background: var(--neutral); }
.bar.y2024.is-alcohol { background: #b08978; }
.bar.y2025.is-alcohol { background: var(--alcohol); }
.cause-delta { margin: 0.28rem 0 0; font-weight: 750; color: var(--ink); }
.cause-delta.up::before { content: "▲ "; font-size: 0.75em; }
.cause-delta.down::before { content: "▼ "; font-size: 0.75em; }
.cause-page details { margin: 0.8rem 0 1.1rem; }
.cause-page summary { cursor: pointer; font-weight: 750; }
.cause-page summary:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cause-table th:first-child, .cause-table td:first-child { white-space: normal; min-width: 12rem; overflow-wrap: anywhere; }
.scope-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
.scope-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem 0.4rem;
}
.scope-card h3 { font-size: 1.05rem; }
.scope-card p { margin: 0.4rem 0 0.7rem; }
.cause-method ul { max-width: 44rem; }
@media (max-width: 560px) {
  .cause-stats { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
