/* Brand tokens come from the GHM logo:
   blue #1F5FE0 · light blue #7FB3FF · green #3DDC84 · navy #0F172A · slate #64748B */

:root {
  color-scheme: light;
  --brand: #1F5FE0;
  --brand-soft: #7FB3FF;
  --brand-green: #3DDC84;

  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #64748b;
  --grid: #e2e8f0;
  --axis: #cbd5e1;
  --border: rgba(15, 23, 42, 0.10);
  --up: #15803d;
  --up-bg: rgba(21, 128, 61, 0.10);
  --down: #dc2626;
  --down-bg: rgba(220, 38, 38, 0.10);

  /* categorical series: slot 1 is the brand blue; the rest are the validated defaults */
  --s1: #1F5FE0; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  /* extra slots for hand-picked series (9-12) */
  --s9: #0891b2; --s10: #8b5a2b; --s11: #6b8e23; --s12: #5b7fa6;
  --other: #94a3b8;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #3f7ff0;
  --page: #0b1220;
  --surface: #111a2e;
  --surface-2: #172238;
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #8b9bb4;
  --grid: #1e293b;
  --axis: #334155;
  --border: rgba(255, 255, 255, 0.10);
  --up: #3DDC84;
  --up-bg: rgba(61, 220, 132, 0.12);
  --down: #f87171;
  --down-bg: rgba(248, 113, 113, 0.12);
  --s1: #3f7ff0; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --s9: #22b8d6; --s10: #b07a45; --s11: #8fb339; --s12: #7f9fc4;
  --other: #64748b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--brand); }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
button.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 4px 6px; }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 1140px) 1fr; align-items: center;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
/* the inner row shares main's column, so nav, search and buttons line up with the content below */
.top-inner { display: flex; align-items: center; gap: 14px; padding: 0 16px; min-width: 0; }
.top-inner .nav a:first-child { margin-left: -10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 40px; height: 40px; border-radius: 10px; display: block; }
.brand .word { font-size: 22px; letter-spacing: -0.015em; white-space: nowrap; }
.brand .word b { font-weight: 700; color: var(--brand); }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 15px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { color: var(--brand); font-weight: 600; }
.search { position: relative; margin-left: auto; flex: 0 1 380px; min-width: 160px; }
.search input, .pick input {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
}
.search input:focus, .pick input:focus { background: var(--surface); }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 320px; overflow-y: auto;
}
.suggest li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 6px; align-items: baseline; }
.suggest li b { color: var(--brand); font-weight: 600; white-space: nowrap; }
.suggest li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li small { color: var(--muted); white-space: nowrap; }
.suggest li:hover, .suggest li.active { background: var(--surface-2); }
.theme {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.theme:hover { color: var(--ink); background: var(--surface-2); }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }

main { max-width: 1140px; margin: 0 auto; padding: 20px 16px 40px; }

/* ---------------------------------------------------------------- filters */
.page-h1 { margin: 0 0 2px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.intro { margin: 0 0 12px; color: var(--ink-2); font-size: 13px; }
.filters { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.filters.compact { margin: 0; }
.filters label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
.game-pick .pick { position: relative; display: inline-block; width: 280px; max-width: 100%; }
.game-pick input { height: 32px; padding: 0 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--surface); }
.seg button { font: inherit; color: var(--ink-2); background: transparent; border: 0; padding: 6px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { color: var(--ink); }
.seg button.on { color: #fff; font-weight: 600; background: var(--brand); }
.seg.small button { padding: 4px 9px; font-size: 12px; }
.meta { color: var(--muted); margin-left: auto; }
.warn { color: var(--down); font-weight: 600; flex-basis: 100%; }
td .warn { flex-basis: auto; font-size: 12px; margin-left: 8px; font-weight: 600; }
td.botted { color: var(--down); font-weight: 600; }
td a.botted-name { color: var(--down); font-weight: 600; }
td a.nostore-name { color: var(--brand); font-weight: 600; }
.card .sub.info-note { color: var(--brand); margin-top: -8px; }
.card .sub.warn-note { color: var(--down); margin-top: -8px; }
.warn-check { color: var(--down); font-weight: 600; }
.warn-check input { accent-color: var(--down); }
.custom-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-basis: 100%; }
.custom-range input { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 12px; }
.check input { accent-color: var(--brand); }

/* ASN filter */
.card.slim { padding: 10px 14px; }
.asn-filter .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.asn-filter .seg { height: 32px; }
.asn-filter .seg button { padding: 0 12px; font-size: 13px; }
.pick { position: relative; flex: 1 1 260px; max-width: 460px; }
.pick input { height: 32px; padding: 0 10px; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  font-size: 12px; max-width: 320px;
}
.chip.exclude { background: var(--down-bg); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.chip b { color: var(--brand); }
.chip.exclude b { color: var(--down); }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 5px; border-radius: 999px; }
.chip .x:hover { background: rgba(0,0,0,.08); color: var(--ink); }
.asn-filter .hint { margin-top: 6px; font-size: 11.5px; }

/* ---------------------------------------------------------------- tiles & cards */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.tile .k { color: var(--ink-2); font-size: 12px; }
.tile .v { font-size: 24px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .v a { color: inherit; text-decoration: none; }
.tile .v a:hover { color: var(--brand); }
.tile .d { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .d.up { color: var(--up); }
.tile .d.down { color: var(--down); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 18px; }
.card h2 { margin: 0; font-size: 15px; font-weight: 600; }
.card .sub { margin: 2px 0 12px; color: var(--muted); font-size: 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head .opts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-head input[type="search"] { font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; min-width: 200px; }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap.loading { opacity: 0.5; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--ink-2); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.up { color: var(--up); }
td.down { color: var(--down); }
td.empty { text-align: center; }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.gimg { width: 40px; height: 15px; object-fit: cover; border-radius: 3px; vertical-align: -3px; margin-right: 8px; background: var(--surface-2); }
.suggest li .gimg { margin-right: 4px; }
a.steam { display: inline-block; vertical-align: -2px; margin-right: 7px; color: var(--ink-2); line-height: 0; }
a.steam:hover { color: #1b2838; }
:root[data-theme="dark"] a.steam:hover { color: #66c0f4; }
.swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }
.swatch.other { background-image: repeating-linear-gradient(90deg, var(--other) 0 3px, transparent 3px 5px); background-color: transparent !important; }
.ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
td a { color: var(--ink); text-decoration: none; }
td a:hover { color: var(--brand); text-decoration: underline; }

table.sortable th[data-sort] { cursor: pointer; user-select: none; }
table.sortable th[data-sort]:hover { color: var(--ink); }
table.sortable th[data-sort]::after { content: "↕"; display: inline-block; margin-left: 5px; color: var(--axis); font-size: 11px; }
table.sortable th[data-sort].asc::after { content: "▲"; color: var(--brand); }
table.sortable th[data-sort].desc::after { content: "▼"; color: var(--brand); }

.pager { display: flex; align-items: center; gap: 8px; padding-top: 12px; flex-wrap: wrap; }
.pager .muted { margin-right: auto; }
.pager button { font: inherit; padding: 5px 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); border-radius: 6px; cursor: pointer; }
.pager button:disabled { opacity: 0.45; cursor: default; }
.pager button:not(:disabled):hover { background: var(--surface-2); }
.pager input { width: 64px; font: inherit; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink); text-align: center; }

.gbtn {
  font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); white-space: nowrap;
}
.gbtn:hover { background: var(--surface-2); color: var(--ink); }
.gbtn.on { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); font-weight: 600; }
td.ctl, th.ctl { text-align: center; }

/* ---------------------------------------------------------------- ASN page */
.asn-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.asn-head h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.01em; }
.asn-head .sub { margin: 0; color: var(--muted); }
.crumb { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.crumb a { color: var(--muted); }

/* ---------------------------------------------------------------- legal */
.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { font-size: 22px; margin: 0 0 4px; }
.prose h2 { font-size: 15px; margin: 22px 0 6px; }
.prose li { margin: 4px 0; }

footer { max-width: 1140px; margin: 0 auto; padding: 0 16px 30px; color: var(--muted); font-size: 12px; }
.foot-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--border); }
.foot-note { margin: 8px 0 0; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; grid-column: 1 / -1; }

@media (max-width: 720px) {
  .opt { display: none; }                      /* secondary table columns hide on phones */
  #game-q, .game-pick .pick { width: 100%; }
  .filters label.game-pick { width: 100%; }
  .ellipsis { max-width: 180px; }
  #games-table td:first-child { max-width: 190px; white-space: normal; line-height: 1.25; }
  #games-table td:first-child a:not(.steam) { display: inline; }
  .gimg { display: none; }                      /* capsule art is too small to read on phones */
  th, td { padding: 7px 6px; }
  .tile .v { font-size: 20px; }
  .card-head .opts { gap: 8px; }
  .card-head input[type="search"] { min-width: 0; width: 100%; }
  .search input { font-size: 16px; }           /* stops iOS zooming into the field */
  .pick input, #table-q, #games-q, .custom-range input, select { font-size: 16px; }
  .seg button { padding: 8px 10px; }           /* bigger tap targets */
  .gbtn { padding: 6px 10px; }
  .top { grid-template-columns: max-content minmax(0, 1fr); padding: 8px 8px 8px 12px; }
  .top-inner { gap: 6px; padding: 0 4px; flex-wrap: wrap; justify-content: flex-end; }
  .nav { display: none; }
  .brand .word { display: none; }              /* icon only on phones */
  .brand img { width: 34px; height: 34px; }
  .search { flex: 1 1 140px; min-width: 0; }
  .theme { width: 34px; height: 34px; flex: 0 0 auto; }
  .filters .meta { margin-left: 0; flex-basis: 100%; }
  .card { padding: 12px; }
  .card-head { flex-direction: column; }
}

code { font-family: ui-monospace, Consolas, monospace; font-size: 0.95em; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }

.theme.discord { color: #5865F2; text-decoration: none; }
.theme.discord:hover { color: #fff; background: #5865F2; border-color: #5865F2; }
.discord-link { display: inline-flex; align-items: center; gap: 4px; color: #5865F2; text-decoration: none; vertical-align: middle; }
.discord-link svg { width: 14px; height: 14px; }
.discord-link:hover { text-decoration: underline; }
