:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --bg-2: #11141a;
  --panel: #0e1116;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #24272d;
  --axis: #3a3d44;
  --ring: rgba(255, 255, 255, 0.10);
  --line: rgba(255, 255, 255, 0.08);
  /* categorical, dark steps, validated on --bg (adjacent CVD ΔE ≥ 8.4) */
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #008300;
  --s7: #9085e9;
  --s8: #e66767;
  --s0: #6b6a65; /* other / de-emphasis */
  /* status, reserved */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  /* one grid for the bar, the cover, every section and the footer */
  --maxw: 1600px;
  --gutter: clamp(20px, 4.2vw, 80px);
  --top: 60px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 8px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
button, select, input { font: inherit; color: inherit; }

.wrap {
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.16em;
}
.kicker b { color: var(--ink); font-weight: 600; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.kicker b::after { content: ""; display: inline-block; width: 28px; height: 1px; margin-left: 12px; vertical-align: middle; background: var(--axis); }

/* ---- top bar ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 12, 16, 0.84);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top-inner { display: flex; align-items: center; gap: 24px; height: var(--top); }
.brand { display: flex; flex-direction: column; line-height: 1.15; text-decoration: none; flex: none; }
.brand-cn { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.brand-en { margin-top: 3px; color: var(--muted); font-size: 10px; letter-spacing: 0.26em; }
/* min-width 0: the nav scrolls inside its own box instead of widening the page */
.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; margin-left: auto; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.nav a.on { background: rgba(255, 255, 255, 0.10); color: var(--ink); }
.nav b { color: var(--muted); font-weight: 500; margin-right: 7px; font-variant-numeric: tabular-nums; }

/* ---- cover ---- */
.hero { position: relative; padding: clamp(56px, 9vh, 120px) 0 clamp(56px, 8vh, 96px); overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto 30%;
  height: 90%;
  background: radial-gradient(50% 50% at 60% 40%, rgba(57, 135, 229, 0.14), transparent 70%);
  pointer-events: none;
}
.hero .wrap { position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 4vw, 80px);
  align-items: end;
}
/* headlines break at spaces and punctuation only ("一个月" stays whole);
   anywhere is the fallback for a run too long for the line */
.hero h1, .view-head h2 { word-break: keep-all; overflow-wrap: anywhere; }
.hero h1 { margin: 20px 0 0; font-size: clamp(38px, 4.8vw, 84px); line-height: 1.08; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.hero-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-top: clamp(28px, 4vh, 48px); }
.hero-figure .value { font-size: clamp(72px, 9vw, 168px); font-weight: 700; line-height: 0.95; letter-spacing: -0.035em; }
.hero-figure .unit { font-size: clamp(17px, 1.6vw, 24px); color: var(--ink-2); }
.hero-lede { max-width: 34em; margin: 22px 0 0; color: var(--ink-2); font-size: clamp(16px, 1.15vw, 18px); }
.hero-chart {
  margin: 0;
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(57, 135, 229, 0.07), rgba(14, 17, 22, 0.7) 60%);
}
.hero-chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; color: var(--muted); font-size: 13px; }
.hero-chart figcaption span:last-child { white-space: nowrap; }
.spark { height: clamp(220px, 24vw, 380px); margin-top: 8px; }
.spark svg { display: block; overflow: visible; }
.spark-grid line { stroke: var(--grid); }
.spark-grid text, .spark-x { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.spark-start { fill: var(--ink-2); font-size: 13px; }
.spark-val { fill: var(--ink); font-size: 16px; font-weight: 650; paint-order: stroke; stroke: #0d1016; stroke-width: 4px; }
.spark-end .dot { fill: #ffffff; }
.spark-end .halo { fill: rgba(57, 135, 229, 0.35); }
.spark-hair { stroke: var(--ink-2); stroke-opacity: 0.6; pointer-events: none; }

/* three words to know before reading */
.primer { margin-top: clamp(44px, 6vh, 80px); }
.primer-title { margin: 0; color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0.16em; }
.primer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0 0; }
.primer-item {
  padding: 18px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(57, 135, 229, 0.07), rgba(14, 17, 22, 0.6));
}
.primer-item dt { font-size: 20px; font-weight: 700; letter-spacing: 0.01em; }
.primer-item dd { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.65; }
.primer + .chapters { margin-top: 28px; }

.chapters {
  list-style: none;
  margin: clamp(48px, 7vh, 88px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.chapter {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 18px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  text-decoration: none;
  transition: border-color 200ms, transform 200ms, background 200ms;
}
.chapter:hover { border-color: rgba(255, 255, 255, 0.24); background: #12161c; transform: translateY(-2px); }
.ch-no { color: var(--muted); font-size: 12px; letter-spacing: 0.14em; font-variant-numeric: tabular-nums; }
.ch-name { margin-top: 2px; font-size: 15px; font-weight: 600; }
.ch-val { margin-top: auto; padding-top: 18px; font-size: clamp(26px, 2.2vw, 36px); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; white-space: nowrap; }
/* up to two lines, always two lines tall, so the figures above stay level */
.ch-cap {
  margin-top: 4px;
  min-height: 2.9em;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- sections ---- */
.view { padding: clamp(72px, 11vh, 140px) 0 0; }
.view-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.view-head h2 { margin: 16px 0 0; max-width: 22em; font-size: clamp(28px, 3vw, 50px); line-height: 1.15; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.view-head .lede { margin: 16px 0 0; max-width: 46em; color: var(--ink-2); font-size: clamp(15px, 1.1vw, 17px); }
.view-kpis { display: flex; align-items: flex-end; }
.kpi { min-width: 140px; padding: 0 28px; border-left: 1px solid var(--line); }
.kpi:first-child { padding-left: 0; border-left: 0; }
.kpi:last-child { padding-right: 0; }
.k-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.k-val { margin-top: 6px; font-size: clamp(26px, 2.4vw, 40px); font-weight: 700; line-height: 1.12; letter-spacing: -0.01em; white-space: nowrap; }
.k-val.small { font-size: clamp(20px, 1.6vw, 26px); line-height: 1.25; padding-top: 0.25em; }
.k-sub { margin-top: 4px; color: var(--ink-2); font-size: 13px; white-space: nowrap; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 32px 0 14px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--ring); }
.seg button {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.btn {
  border: 1px solid var(--ring);
  background: var(--bg-2);
  padding: 7px 16px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: #181c23; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); padding: 4px 8px; }
.btn.quiet:hover { color: var(--ink); background: transparent; }
select.pick {
  background: var(--bg-2);
  border: 1px solid var(--ring);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 14px;
  max-width: 100%;
}
input[type="range"] { accent-color: var(--ink-2); }

/* the chart sits on a panel of its own */
.panel {
  position: relative;
  padding: 22px 26px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #0f1218 0%, #0b0d11 100%);
}
.panel + .panel { margin-top: 16px; }
/* how to read the chart, in plain words */
.howto { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.howto-label { padding: 4px 11px; border-radius: 999px; background: rgba(57, 135, 229, 0.20); color: var(--ink); font-weight: 600; }
.howto-item { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.legend .k { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .sw.line { height: 3px; border-radius: 2px; width: 14px; }

.chart { position: relative; margin: 0; }
.chart svg, .chart canvas { display: block; }
.view-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
.view-foot .src { flex: 1; min-width: 220px; }
.view-foot .btn { font-size: 13px; padding: 5px 12px; }
.notes { margin: 10px 0 0; padding: 4px 0 4px 16px; border-left: 2px solid var(--axis); color: var(--ink-2); font-size: 13px; list-style: none; }
.notes li + li { margin-top: 4px; }
.loading { color: var(--muted); padding: 120px 0; min-height: 620px; text-align: center; }

/* svg chrome */
.axis text { fill: var(--muted); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.axis path, .axis line { stroke: var(--axis); }
.grid line { stroke: var(--grid); }
.grid path { display: none; }
.ann line { stroke: var(--ink-2); stroke-opacity: 0.55; }
.ann text { fill: var(--ink-2); font-size: 12px; }
.ann .dot { fill: var(--ink); }

/* tooltip */
.tip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  min-width: 180px;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(17, 20, 26, 0.96);
  border: 1px solid var(--ring);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1.45;
}
.tip .t-head { color: var(--ink-2); margin-bottom: 6px; }
.tip .t-row { display: flex; align-items: center; gap: 8px; }
.tip .t-row .key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tip .t-row .v { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 64px; }
.tip .t-row .n { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip .t-note { color: var(--muted); margin-top: 6px; }

/* table drawer */
.table-wrap { margin-top: 12px; max-height: 420px; overflow: auto; border: 1px solid var(--ring); border-radius: 12px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.table-wrap th, .table-wrap td { padding: 7px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
.table-wrap th:first-child, .table-wrap td:first-child { text-align: left; }
.table-wrap thead th { position: sticky; top: 0; background: var(--bg-2); color: var(--ink-2); font-weight: 600; }

/* ---- footer: about the data ---- */
footer.end { padding: clamp(80px, 12vh, 140px) 0 96px; color: var(--ink-2); }
.end-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 40px 72px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.end h2 { margin: 16px 0 0; color: var(--ink); font-size: clamp(24px, 2.2vw, 34px); line-height: 1.2; }
.end p { margin: 14px 0 0; max-width: 40em; font-size: 14px; }
.end-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.end-table th, .end-table td { padding: 12px 16px 12px 0; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.end-table th { color: var(--muted); font-size: 13px; font-weight: 500; }
.end-table td:first-child { color: var(--ink); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 1280px) {
  .chapters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .primer-grid { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .view-head { grid-template-columns: 1fr; }
  .end-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --top: 54px; }
  .top-inner { gap: 12px; }
  .brand-en { display: none; }
  .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .chapter { padding: 14px 14px 16px; }
  .view-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
  .kpi { min-width: 0; padding: 0 14px; }
  .kpi:nth-child(odd) { padding-left: 0; border-left: 0; }
  .k-label, .k-val, .k-sub { white-space: normal; }
  .panel { padding: 14px 12px 12px; border-radius: 14px; }
  .end-table th, .end-table td { padding-right: 10px; }
}
