/* PlayerCharts — palette values are the validated data-viz reference set. */

:root {
  color-scheme: dark;
  --plane: #0d0d0d;
  --surface: #141416;
  --surface-2: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --series-1: #3987e5;
  --series-2: #d95926;
  --up: #0ca30c;
  --down: #d03b3b;
  --chip: rgba(255, 255, 255, 0.06);
  --chip-on: #3987e5;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.12);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --up: #006300;
  --down: #d03b3b;
  --chip: rgba(11, 11, 11, 0.05);
  --chip-on: #2a78d6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--plane);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ── Header ──────────────────────────────────────────────────────────── */

header.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
  font-weight: 650;
}

.brand p {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 13.5px;
  max-width: 62ch;
  line-height: 1.5;
}

.head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.updated {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.icon-btn {
  background: var(--chip);
  border: 1px solid var(--border);
  color: var(--ink-2);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.icon-btn:hover { color: var(--ink); }

/* ── Honesty banner ──────────────────────────────────────────────────── */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--series-1);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin: 18px 0 20px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.notice b { color: var(--ink); font-weight: 600; }
.notice .x {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}

/* ── Controls ────────────────────────────────────────────────────────── */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.ctl-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.ctl-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

.chip {
  background: var(--chip);
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--chip-on);
  border-color: var(--chip-on);
  color: #fff;
  font-weight: 550;
}
.chip .n {
  font-size: 10.5px;
  opacity: .7;
  font-variant-numeric: tabular-nums;
}

.seg {
  display: inline-flex;
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  background: none;
  border: 0;
  color: var(--ink-2);
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
}
.seg button[aria-pressed="true"] {
  background: var(--chip-on);
  color: #fff;
  font-weight: 550;
}

.search {
  flex: 1 1 190px;
  min-width: 150px;
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  padding: 7px 11px;
  font-size: 13px;
  font-family: inherit;
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }

.result-line {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 2px 12px;
  font-variant-numeric: tabular-nums;
}

/* ── Table ───────────────────────────────────────────────────────────── */

.table-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

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

thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  text-align: right;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  z-index: 2;
}
thead th:hover { color: var(--ink); }
thead th.rank, thead th.game { text-align: left; }
thead th.plat { text-align: left; cursor: default; }
thead th.trend { text-align: left; }
thead th .arrow { opacity: .95; margin-left: 3px; }

tbody tr {
  border-bottom: 1px solid var(--grid);
  cursor: pointer;
}
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--chip); }

td {
  padding: 9px 12px;
  text-align: right;
  font-size: 13.5px;
  white-space: nowrap;
}

td.rank {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  width: 42px;
}

td.game { text-align: left; min-width: 210px; }

.game-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* 16:9 — matches Steam header art and Roblox thumbnails, so neither is
   center-cropped into mush. */
.art {
  width: 52px;
  height: 29px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex: none;
}
.art.ph {
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.gname {
  font-weight: 550;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.gsub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

td.plat { text-align: left; }

.badges { display: flex; gap: 4px; }
.badge {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--ink-2);
  background: var(--chip);
  font-weight: 600;
}

.big { font-weight: 600; color: var(--ink); font-size: 14px; }

/* Estimates are deliberately drawn unlike measured counts: lighter, italic,
   prefixed with ≈ and tagged. Nobody should confuse the two at a glance. */
.est {
  color: var(--ink-2);
  font-style: italic;
  font-size: 13.5px;
  cursor: help;
  white-space: nowrap;
}
.esttag {
  font-style: normal;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 3px;
  margin-left: 5px;
  vertical-align: 1px;
}
/* The non-ranking measure sits secondary, so the eye follows one column. */
.vnum { color: var(--ink-2); font-size: 13px; }
.dim { color: var(--muted); }

/* Separates the ranked games from those with no number for that measure. */
tr.divider { cursor: default; background: none !important; }
tr.divider td {
  text-align: left;
  padding: 18px 12px 9px;
  border-top: 1px solid var(--border);
}
tr.divider span {
  display: block;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 88ch;
}

.delta { font-weight: 600; display: inline-flex; align-items: center; gap: 3px; justify-content: flex-end; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.delta.flat { color: var(--muted); font-weight: 500; }

td.trend { text-align: left; width: 112px; }

/* Share of the game's own peak — replaces the 48h sparkline. */
.peakcell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: help;
}
.peakcell svg { display: block; flex: none; }
.peakpct {
  font-size: 11.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
}
/* Sitting at its own record right now is worth noticing. */
.peakpct.at { color: var(--up); font-weight: 600; }

.verified {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--series-1);
  margin-right: 5px;
  vertical-align: 1px;
}

/* ── Detail view ─────────────────────────────────────────────────────── */

.detail-back {
  background: none;
  border: 0;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 0;
  margin-bottom: 14px;
}
.detail-back:hover { color: var(--ink); }

.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.detail-head .art { width: 128px; height: 72px; border-radius: 8px; }
.detail-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
.detail-head .gsub { font-size: 12.5px; margin-top: 3px; }

.gdesc {
  margin: -4px 0 18px;
  max-width: 78ch;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.tile .k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.tile .v {
  font-size: 21px;
  font-weight: 600;
  margin-top: 5px;
  color: var(--ink);
}
.tile .v.small { font-size: 15px; font-weight: 550; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 10px;
  margin-bottom: 14px;
}
.panel h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
}
.panel .sub {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 10px;
}

.range { display: flex; gap: 6px; margin-bottom: 12px; }

.panel.estimate { border-left: 3px solid var(--muted); }
.panel.estimate h3 { font-size: 16px; }
.panel.estimate h3 em { color: var(--ink-2); font-weight: 500; }
.panel.estimate .sub { max-width: 84ch; margin-bottom: 10px; }
.panel.estimate b { color: var(--ink); }

/* Dated publisher statements, shown where no live count can exist. */
.panel.official { border-left: 3px solid var(--series-2); }
.panel.official .sub { max-width: 82ch; }
.figures { list-style: none; margin: 4px 0 12px; padding: 0; }
.figures li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 2px 10px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--grid);
}
.figures .fv {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.figures .fl { color: var(--ink-2); font-size: 13px; }
.figures .fd {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  white-space: nowrap;
}
.figures .fn {
  grid-column: 2 / -1;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
}
.figures .fs {
  grid-column: 2 / -1;
  font-size: 11.5px;
  color: var(--series-1);
  text-decoration: underline;
  justify-self: start;
}

/* Hour-of-day heat strip. Fixed height so the 24 cells stay square-ish
   however wide the panel gets. */
svg.heat {
  display: block;
  width: 100%;
  height: 54px;
  margin-top: 4px;
}

.chart-host { position: relative; }
.chart-host svg { display: block; width: 100%; height: auto; }

.tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .1s;
  z-index: 5;
  font-variant-numeric: tabular-nums;
}
.tip.on { opacity: 1; }
.tip .tk { color: var(--muted); font-size: 11px; display: block; }

.empty, .loading {
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
  font-size: 14px;
}

.setup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--series-2);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-top: 14px;
}
.setup h3 { margin: 0 0 8px; font-size: 15px; }
.setup p { margin: 0 0 10px; color: var(--ink-2); font-size: 13px; line-height: 1.6; max-width: 78ch; }
.setup ol { margin: 0 0 12px; padding-left: 20px; color: var(--ink-2); font-size: 13px; line-height: 1.75; max-width: 78ch; }
.setup li { margin-bottom: 3px; }
.setup a { color: var(--series-1); text-decoration: underline; }
.setup code {
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12px;
}
.setup pre {
  background: var(--plane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--ink);
  overflow-x: auto;
  margin: 0 0 10px;
}
.setup .fine { font-size: 12px; color: var(--muted); margin: 0; }

footer.foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
}
footer.foot b { color: var(--ink-2); font-weight: 600; }

@media (max-width: 980px) {
  td.peak, thead th.peak { display: none; }
}
@media (max-width: 820px) {
  td.plat, thead th.plat { display: none; }
}
@media (max-width: 680px) {
  td.trend, thead th.trend { display: none; }
  .brand h1 { font-size: 21px; }
  .wrap { padding: 16px 12px 60px; }
  td, thead th { padding: 8px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ── top streams ───────────────────────────────────────────────────────
 * The only clickable-through content on the site: the live streams each
 * viewer total is summed from. Laid out as name / platform / count so the
 * numbers form a column that can be scanned without reading the names.
 */
.streams { list-style: none; margin: 0 0 8px; padding: 0; }
.stream {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 4px 10px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}
.stream:first-child { border-top: 0; }
.stream > a {
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
}
.stream > a:hover { color: var(--chip-on); text-decoration: underline; }
.son {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.scount {
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
/* The title spans the full width on its own line — stream titles are long, and
 * squeezing them into the name column would push the numbers out of alignment. */
.stitle {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
