:root {
  --bg: #0a0c0f;
  --surface: #121519;
  --surface-2: #171b21;
  --line: #232830;
  --text: #e7ebf0;
  --muted: #8b95a3;
  --accent: #00e59a;
  --up: #00e59a;
  --down: #ff6b6b;
  --radius: 10px;
}

* { box-sizing: border-box; }

/* .empty and .live set a display, which beats the UA sheet's [hidden] rule. */
[hidden] { display: none !important; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 880px; margin: 0 auto; padding: 28px 18px 72px; }

/* --- header ------------------------------------------------------------- */

.top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.top .count { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.search {
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}
.search::placeholder { color: #5c6673; }
.search:focus { outline: none; border-color: #35404d; }

/* --- directory ---------------------------------------------------------- */

.list { display: flex; flex-direction: column; }

.row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line);
}
.row:hover { background: var(--surface); }
.row:last-child { border-bottom: 0; }

.rank {
  width: 34px;
  flex: none;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pic {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  object-fit: cover;
}

.who { min-width: 0; flex: 1; display: flex; align-items: center; gap: 7px; }
.who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.row .num { color: var(--text); font-size: 14px; }

.live {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff4d4d;
  box-shadow: 0 0 0 3px rgba(255, 77, 77, 0.16);
}
.check { flex: none; color: var(--accent); font-size: 11px; }

.more {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.more:hover { color: var(--text); }

/* --- channel ------------------------------------------------------------ */

.back { display: inline-block; margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.back:hover { color: var(--text); }

.hero { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.hero .pic { width: 72px; height: 72px; }
.hero h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.hero .meta { display: flex; align-items: center; gap: 8px; }
.hero .sub { color: var(--muted); font-size: 13px; }

.count-big {
  font-size: clamp(38px, 9vw, 56px);
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.count-label { color: var(--muted); font-size: 13px; margin-top: 2px; }

.deltas { display: flex; gap: 26px; margin: 22px 0 26px; }
.delta .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.delta .v { font-size: 17px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tabs button {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.chart {
  position: relative;
  height: 320px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

.foot { margin-top: 14px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* uPlot fits the dark surface */
.uplot { font-family: inherit; }
.u-axis { color: var(--muted); }
.u-legend { display: none; }
.u-cursor-pt { border-color: var(--bg) !important; }
.u-select { background: rgba(0, 229, 154, 0.08); }

.tip {
  position: absolute;
  pointer-events: none;
  padding: 6px 9px;
  background: #05070a;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transform: translate(-50%, -130%);
  opacity: 0;
  transition: opacity 0.08s;
  z-index: 10;
}
.tip .t { color: var(--muted); }

@media (max-width: 520px) {
  .wrap { padding: 20px 14px 56px; }
  .deltas { gap: 18px; }
  .rank { display: none; }
}
