:root {
  --bg: #f3efe6;
  --paper: #fffcf7;
  --paper-2: #f7f2ea;
  --ink: #1c1915;
  --muted: #6b6459;
  --line: #e3dcd0;
  --line-strong: #d4cbbd;
  --accent: #1f4e79;
  --header: #16283c;
  --header-ink: #f8f4ee;
  --header-muted: #cfc4b6;
  --in: #b45309;
  --in-soft: #f3e0c8;
  --out: #0f766e;
  --out-soft: #d7ebe8;
  --warn: #9a3412;
  --warn-bg: #fff4ea;
  --chip: #efe8dc;
  --gold: #c4a574;
  --grid: #ece6db;
  --zero: #8a8073;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.045);
  --radius: 14px;
  --radius-sm: 10px;
  --max: 1120px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 320px at 50% -80px, rgba(22, 40, 60, 0.05), transparent 70%),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--accent); text-underline-offset: 0.18em; transition: color 0.15s ease, opacity 0.15s ease; }
a:hover { text-decoration-thickness: 1px; }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

header {
  background: var(--header);
  color: var(--header-ink);
  padding: 0;
  border-bottom: 2px solid var(--gold);
}

header .wrap,
.stickynav .wrap,
main,
footer .wrap {
  max-width: var(--max);
  margin: 0 auto;
}

.stickynav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header);
  border-bottom: 1px solid rgba(196, 165, 116, 0.28);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.stickynav.is-stuck {
  box-shadow: 0 8px 20px rgba(22, 40, 60, 0.18);
  border-bottom-color: rgba(196, 165, 116, 0.55);
}

.stickynav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 8px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--header-ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  flex: none;
}

.brand img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: block;
}

.brand:hover { color: #fff; }

.hero { padding: 20px 20px 24px; }

main { padding: 0 20px 8px; }

h1 {
  font-size: 1.42rem;
  margin: 0 0 6px;
  font-weight: 650;
  letter-spacing: 0.015em;
  line-height: 1.3;
}

.sub {
  color: var(--header-muted);
  font-size: 0.9rem;
  max-width: 46rem;
}

.meta {
  margin-top: 12px;
  font-size: 0.8rem;
  color: #b9b0a3;
  line-height: 1.55;
}

div.topnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

div.topnav a {
  color: var(--header-ink);
  text-decoration: none;
  font-size: 0.84rem;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(248, 244, 238, 0.08);
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

div.topnav a:hover { background: rgba(255, 255, 255, 0.16); }

div.topnav a.current {
  background: var(--header-ink);
  color: var(--header);
  border-color: var(--header-ink);
  font-weight: 550;
}

.banner {
  background: #fff7eb;
  border: 1px solid #ead8b8;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 20px 0 18px;
  color: #4a3b22;
  font-size: 0.9rem;
}

.banner strong { color: var(--warn); }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 22px;
}

.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px 14px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.kpi:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 18px rgba(28, 25, 21, 0.06);
  transform: translateY(-1px);
}

.kpi .label {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.4;
  font-weight: 550;
}

.kpi .value {
  font-size: 1.05rem;
  font-weight: 650;
  margin-top: 8px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.kpi .hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.45;
}

.pos { color: var(--in); }
.neg { color: var(--out); }

section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 6px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

h3 {
  font-size: 0.9rem;
  margin: 18px 0 8px;
  font-weight: 600;
}

.note {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.6;
}

.warn-note {
  font-size: 0.86rem;
  color: var(--warn);
  background: var(--warn-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0 14px;
  line-height: 1.55;
}

.charts {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 14px;
}

.chart-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 10px 8px;
  background: #fffdf9;
  min-width: 0;
}

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 2px 6px 8px;
}

.chart-box h3,
.chart-head h3 {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.7rem;
  color: var(--muted);
}

.chart-legend .swatch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

.chart-legend i.line {
  height: 2px;
  width: 14px;
  border-radius: 1px;
  background: var(--accent);
}

.chart-legend i.in { background: var(--in); }
.chart-legend i.out { background: var(--out); }

.chart-frame {
  position: relative;
  height: 300px;
  width: 100%;
}

svg.chart {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  font-family: inherit;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.84rem;
}

.chart-tooltip {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  background: var(--header);
  color: var(--header-ink);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(22, 40, 60, 0.22);
  min-width: 148px;
  max-width: 240px;
  border: 1px solid rgba(248, 244, 238, 0.08);
  opacity: 0;
  visibility: hidden;
  will-change: left, top, opacity;
}
.chart-tooltip.is-on {
  opacity: 1;
  visibility: visible;
}

.chart-tooltip .tip-title {
  font-weight: 600;
  margin-bottom: 4px;
  color: #f8f4ee;
}

.chart-tooltip .tip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #d7cfc3;
}

.chart-tooltip .tip-row b {
  font-weight: 650;
  color: #f8f4ee;
  font-variant-numeric: tabular-nums;
}

.chart-tooltip .tip-row.pos b { color: #f0b27a; }
.chart-tooltip .tip-row.neg b { color: #7dcdc4; }

.table-wrap {
  overflow: auto;
  max-height: 440px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffdf9;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

th, td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child { text-align: left; }

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  background: #f3eee5;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid var(--line-strong);
}

tbody tr { transition: background 0.15s ease; }
tbody tr:nth-child(even) { background: #faf7f2; }
tbody tr:hover { background: #f3ebe0; }
tbody tr:last-child td { border-bottom: 0; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.split > div {
  min-width: 0;
}

.panel {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px 12px;
}

.panel h3 { margin-top: 0; }
.panel p { margin: 0 0 8px; }
.panel p:last-child { margin-bottom: 0; }

footer {
  padding: 22px 20px 32px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

footer a { color: var(--accent); }

.src {
  font-size: 0.75rem;
  color: var(--muted);
  word-break: break-all;
  margin: 12px 0 0;
}

.err { color: var(--warn); }

/* Trackers directory */
section.directory {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: 28px;
  border-radius: 0;
}

section.directory h2 { margin-bottom: 12px; }

.list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 800px) {
  .list { grid-template-columns: 1fr 1fr; }
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 15px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 18px rgba(28, 25, 21, 0.07);
  transform: translateY(-1px);
}

.card .head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 4px;
}

.card h3 {
  font-size: 1.02rem;
  margin: 0;
  font-weight: 650;
}

.handle a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 550;
  font-size: 0.9rem;
}

.handle a:hover { text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  background: var(--chip);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
}

.card p { margin: 8px 0 0; font-size: 0.9rem; color: var(--ink); }

.links { margin-top: 10px; font-size: 0.84rem; }
.links a { margin-right: 14px; }

@media (max-width: 960px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .charts,
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 14px; }
  .stickynav .wrap { padding: 8px 16px; min-height: 46px; }
  .hero { padding: 16px 16px 18px; }
  main { padding: 0 16px 8px; }
  .brand span { font-size: 0.86rem; }
  h1 { font-size: 1.22rem; }
  .kpis { grid-template-columns: 1fr; gap: 10px; }
  .kpi .value { font-size: 1rem; }
  section { padding: 16px 14px 14px; }
  .chart-frame { height: 244px; }
  .chart-head { padding-left: 2px; padding-right: 2px; }
  th, td { padding: 7px 8px; }
  footer { padding: 18px 16px 28px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero {
    animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .banner {
    animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both;
  }
  .kpis {
    animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.07s both;
  }
  main > section {
    animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  main > section:nth-of-type(1) { animation-delay: 0.08s; }
  main > section:nth-of-type(2) { animation-delay: 0.12s; }
  main > section:nth-of-type(3) { animation-delay: 0.16s; }
  main > section:nth-of-type(4) { animation-delay: 0.2s; }
  main > section:nth-of-type(5) { animation-delay: 0.24s; }
  footer {
    animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
  }
  .card.enter {
    animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .chart-tooltip.is-on {
    transition: opacity 0.12s ease;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  div.topnav a,
  .card,
  .kpi,
  .stickynav,
  tbody tr,
  .chart-tooltip,
  a { transition: none; }
  .hero, .banner, .kpis, main > section, footer, .card.enter { animation: none; }
  .kpi:hover, .card:hover { transform: none; }
}
