:root {
  color-scheme: light;
  --ink: #182d23;
  --muted: #496154;
  --line: #d9e3dc;
  --paper: #f2f6f2;
  --accent: #176444;
  --deep: #123c2b;
  font-family: "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.55; }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 3px solid #007f68; outline-offset: 3px; }
.wrap { width: min(100% - 3rem, 64rem); margin-inline: auto; }
.masthead { background: var(--deep); color: #f7fff9; }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; gap: 1rem; }
.brand { text-decoration: none; letter-spacing: 0.015em; }
.brand strong { font-family: system-ui, sans-serif; }
.source { color: #d9f0e3; font-size: .875rem; text-underline-offset: .22em; }
.masthead a:focus-visible { outline-color: #a7e6c6; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; padding: 3.25rem 0 1.3rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); line-height: 1.15; letter-spacing: -.035em; }
.hero p { margin-top: .75rem; color: var(--muted); }
.leaderboard-link { color: var(--accent); font-weight: 650; text-underline-offset: .2em; }
.controls { display: flex; flex-wrap: wrap; gap: .6rem; }
.controls button, .download {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: .5rem .95rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  font-weight: 650;
  white-space: nowrap;
}
.controls button { background: var(--accent); color: #fff; cursor: pointer; }
.controls button:hover:not(:disabled) { background: var(--deep); }
.controls button:disabled { opacity: .72; cursor: wait; }
.download { background: #fff; border-color: #b9cbbf; text-decoration: none; }
.download:hover:not(.disabled) { background: #e4efe8; }
.download.disabled { color: #566a5e; background: #e8ede9; }
.freshness {
  display: flex;
  justify-content: space-between;
  gap: .55rem 1rem;
  flex-wrap: wrap;
  padding: .82rem 0;
  border-block: 1px solid var(--line);
  font-size: .875rem;
  color: var(--muted);
}
.update-time { display: inline-flex; align-items: center; gap: .3rem; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; margin-right: .3rem; background: #936528; }
.dot.fresh { background: #2c8654; }
.status { color: var(--deep); background: #e0efe5; padding: .75rem 1rem; border-radius: .45rem; margin-top: 1rem; }
.totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .9rem;
  margin: 1.25rem 0;
}
.totals > div, .rankings, .empty { border: 1px solid var(--line); background: #fff; border-radius: .8rem; }
.totals > div { padding: 1rem 1.25rem; }
.totals dt, .empty p { color: var(--muted); }
.totals dd { margin: .2rem 0 0; font: 700 clamp(1.4rem, 4vw, 2.45rem)/1.2 system-ui, sans-serif; }
.totals dd span { font: 500 .875rem system-ui, sans-serif; margin-left: .35rem; color: var(--muted); }
.panel-heading { padding: 1.1rem 1.25rem; }
h2 { font-size: 1.15rem; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; }
thead { background: #e8f0eb; color: #2f5240; }
th, td { padding: .7rem 1.25rem; white-space: nowrap; }
thead th { font-size: .875rem; font-weight: 650; }
th:first-child { text-align: left; }
tbody tr:nth-child(even) { background: #f7faf8; }
tbody tr + tr { border-top: 1px solid #e6eee8; }
.empty { padding: 2rem 1.25rem; margin-top: 1.25rem; }
.empty p { margin-top: .4rem; }
.leaderboard { margin-top: 1.25rem; scroll-margin-top: 1rem; }
.leaderboard p { margin-top: .4rem; color: var(--muted); }
.leaderboard td:first-child { text-align: left; }
.year-filter { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .75rem; }
.year-filter a, .pagination a {
  padding: .42rem .72rem;
  border: 1px solid #b9cbbf;
  border-radius: .55rem;
  color: var(--deep);
  text-decoration: none;
}
.year-filter a:hover, .pagination a:hover { background: #e4efe8; }
.year-filter a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
  padding: .8rem 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
footer { color: var(--muted); padding: 1.2rem 0 2rem; font-size: .875rem; }

@media (max-width: 600px) {
  .wrap { width: calc(100% - 2rem); }
  .hero { flex-direction: column; align-items: flex-start; padding-top: 2rem; }
  .totals { gap: .4rem; }
  .totals > div { padding: .75rem .55rem; }
  .totals dt { font-size: .875rem; }
  .totals dd span { margin-left: .2rem; }
  th, td { padding-inline: .63rem; }
}
