:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2129;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --faint: #6e7681;
  --link: #58a6ff;
  --pos: #3fb950;
  --neg: #f85149;
  --grid: #21262d;
  --zero: #484f58;
  /* 图表系列色 (dark 校验通过) */
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --s4: #c98500; --s5: #d55181; --s6: #9085e9;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: var(--link); text-decoration: none; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* header */
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13,17,23,.92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.hwrap {
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 8px; }
.logo { font-size: 20px; }
.title { font-weight: 700; font-size: 16px; }
.title .sub { color: var(--muted); font-weight: 500; font-size: 13px; margin-left: 4px; }
nav#tabs { display: flex; gap: 4px; }
nav#tabs a {
  color: var(--muted); padding: 5px 12px; border-radius: 6px; font-weight: 600;
}
nav#tabs a .en { font-weight: 400; font-size: 11px; color: var(--faint); }
nav#tabs a.active { color: var(--text); background: var(--panel2); }
nav#tabs a:hover { color: var(--text); }
.hstatus { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); display: inline-block; }
.dot.bad { background: var(--neg); }
.dot.live { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.stale {
  background: #3d1d1f; color: #ffb3ad; border-bottom: 1px solid #6e2c2f;
  text-align: center; padding: 6px; font-size: 13px;
}
.hidden { display: none !important; }

main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.loading { color: var(--muted); text-align: center; padding: 60px 0; }

/* controls */
.controls {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px;
}
.pills { display: flex; gap: 4px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
  padding: 4px 11px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.pill:hover { color: var(--text); }
.pill.on { background: #1f3a5f; border-color: #2f5f9e; color: #cae2ff; }
.controls input[type=text], .controls select {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 10px; font-size: 13px; outline: none;
}
.controls input[type=text]:focus { border-color: #2f5f9e; }
.controls .chk { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.spacer { flex: 1; }
.count { color: var(--faint); font-size: 12px; }

/* tables */
.tblwrap {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  overflow-x: auto;
}
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 12px; text-align: right; white-space: nowrap; font-size: 13px; }
th:first-child, td:first-child { text-align: left; }
th.l, td.l { text-align: left; }
thead th {
  position: sticky; top: 0; background: var(--panel2); color: var(--muted);
  font-size: 12px; font-weight: 600; cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border); z-index: 5;
}
thead th:hover { color: var(--text); }
thead th .arr { color: var(--link); }
tbody tr { border-bottom: 1px solid var(--grid); cursor: pointer; }
tbody tr:hover { background: #1a2029; }
tbody tr:last-child { border-bottom: none; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.dim { color: var(--faint); }
.coincell { font-weight: 700; }
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 6px;
  vertical-align: 1px;
}
.badge.xyz { color: #d2a8ff; border-color: #4a3a68; }

/* rank layout */
.rankgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 980px) { .rankgrid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.panel h3 {
  margin: 0; padding: 10px 14px; font-size: 13.5px; border-bottom: 1px solid var(--border);
  background: var(--panel2);
}
.panel h3 .en { color: var(--faint); font-weight: 400; font-size: 12px; }
.panel .tblwrap { border: none; border-radius: 0; }

/* coin page */
.crumb { margin-bottom: 10px; font-size: 13px; }
.coinhead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.coinhead h2 { margin: 0; font-size: 24px; }
.coinhead .px { font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
.tile .k { color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.tile .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.chartbox { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px 8px; margin-bottom: 14px; }
.chartbox h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.chartbox h4 .note { font-weight: 400; color: var(--faint); font-size: 11.5px; }
.chartbox canvas { width: 100%; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.actions { display: flex; gap: 10px; margin: 4px 0 14px; }
.btn {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 5px 13px; border-radius: 6px; cursor: pointer; font-size: 12.5px; font-weight: 600;
}
.btn:hover { border-color: #2f5f9e; }

/* compare */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: 13px;
}
.chip .sw { width: 10px; height: 10px; border-radius: 2px; }
.chip .x { cursor: pointer; color: var(--faint); font-weight: 400; }
.chip .x:hover { color: var(--neg); }
.empty { color: var(--muted); padding: 40px; text-align: center; }

/* tooltip */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none;
  background: #1c2129; border: 1px solid var(--border); border-radius: 6px;
  padding: 7px 10px; font-size: 12px; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 16px rgba(0,0,0,.5); max-width: 320px;
}
.tooltip .t { color: var(--muted); margin-bottom: 3px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; }

footer {
  max-width: 1280px; margin: 10px auto 30px; padding: 0 16px;
  color: var(--faint); font-size: 12px; display: flex; flex-direction: column; gap: 4px;
}

@media (max-width: 720px) {
  .hwrap { gap: 10px; }
  th, td { padding: 6px 8px; font-size: 12px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
