/* Data-tracker look: dark, dense, table first. */
:root {
  --bg: #0f151e;
  --bar: #0b1017;
  --surface: #151d29;
  --row: #131a25;
  --row-alt: #172030;
  --row-hover: #1d2a3d;
  --line: #243045;
  --text: #d3dde8;
  --muted: #8494a8;
  --faint: #5b6b80;
  --accent: #5fb4f0;
  --green: #4cc38a;  --green-bg: rgb(76 195 138 / .14);
  --teal: #3ccfcf;   --teal-bg: rgb(60 207 207 / .13);
  --blue: #6aa8ff;   --blue-bg: rgb(106 168 255 / .14);
  --violet: #b39cff; --violet-bg: rgb(179 156 255 / .14);
  --red: #ff7a72;    --red-bg: rgb(255 122 114 / .14);
  --gold: #f2bf57;   --gold-bg: rgb(242 191 87 / .14);
  --grey: #9aa7b8;   --grey-bg: rgb(154 167 184 / .12);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top bar */
.bar { background: var(--bar); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.bar-row { display: flex; align-items: center; gap: 16px; min-height: 56px; }
h1 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; white-space: nowrap; }
h1 span { color: var(--muted); font-weight: 500; }
.home { color: var(--text); }
.home:hover { text-decoration: none; }
.home:hover span { color: var(--accent); }
#q {
  flex: 1; max-width: 460px; margin-left: auto; font: inherit; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
#q:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.lead { color: var(--muted); margin: 16px 0 12px; }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stat { background: var(--surface); padding: 12px 16px; }
.stat .v { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .k { color: var(--muted); font-size: .8rem; }
.stat .s { color: var(--faint); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin: 18px 0 0; border-bottom: 1px solid var(--line); }
.tab {
  font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 9px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab .n { color: var(--faint); margin-left: 5px; font-variant-numeric: tabular-nums; font-size: .85em; }

/* Table */
.table-wrap { overflow-x: auto; }
.games { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.games th {
  text-align: left; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.games th.sortable { cursor: pointer; }
.games th.sortable:hover { color: var(--text); }
.games th[aria-sort]::after { content: " ▾"; color: var(--accent); }
.games th[aria-sort="ascending"]::after { content: " ▴"; }
.games .num { text-align: right; }
.games td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.games tbody tr.g { background: var(--row); cursor: pointer; }
.games tbody tr.g:nth-child(even) { background: var(--row-alt); }
.games tbody tr.g:hover, .games tbody tr.g.open { background: var(--row-hover); }

.c-img { width: 128px; }
.cap { width: 120px; aspect-ratio: 460 / 215; border-radius: 3px; background: var(--surface); display: block; object-fit: cover; }
.cap.blank { display: grid; place-items: center; color: var(--faint); font-size: .7rem; }
.name { font-weight: 600; color: var(--text); }
.sub { color: var(--faint); font-size: .78rem; }
.c-name { min-width: 220px; }

.badge { display: inline-block; font-size: .74rem; font-weight: 650; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.s-denuvo { color: var(--green); background: var(--green-bg); box-shadow: inset 0 0 0 1px rgb(76 195 138 / .35); }
.s-crack { color: var(--green); background: var(--green-bg); }
.s-gog { color: var(--blue); background: var(--blue-bg); }
.s-repack { color: var(--violet); background: var(--violet-bg); }
.s-workaround { color: var(--red); background: var(--red-bg); }
.s-drm_removed { color: var(--gold); background: var(--gold-bg); }
.s-update { color: var(--grey); background: var(--grey-bg); }

.group { color: var(--text); }
.kind { color: var(--faint); font-size: .76rem; }
.days { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.days .track { width: 64px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.days .fill { display: block; height: 100%; border-radius: 3px; background: var(--teal); }
.days .fill.fast { background: var(--green); }
.days .fill.slow { background: var(--gold); }
.dim { color: var(--faint); }
.rating.good { color: var(--green); }
.rating.mixed { color: var(--gold); }
.rating.bad { color: var(--red); }

/* Expanded row */
tr.detail td { background: var(--surface); padding: 14px 16px 16px 144px; }
.detail .summary { margin: 0 0 8px; max-width: 80ch; font-size: .95rem; }
.detail .links { display: flex; gap: 16px; margin-bottom: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-width: 90ch; }
.timeline li { display: grid; grid-template-columns: 100px 130px 1fr; gap: 10px; align-items: baseline; }
.timeline .t-date { color: var(--muted); }

.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); margin: 12px 0 0; }
.more { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.more:hover { border-color: var(--accent); }
.empty td { text-align: center; color: var(--muted); padding: 40px; }

.term { border-bottom: 1px dashed currentColor; cursor: help; }
.tip {
  position: fixed; z-index: 20; max-width: 280px; padding: 10px 12px; border-radius: 6px; font-size: .85rem;
  background: #e8eef5; color: #101722; pointer-events: none; box-shadow: 0 6px 24px rgb(0 0 0 / .4);
}

.glossary { margin: 40px 0; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.glossary h2 { margin: 0 0 12px; font-size: 1.05rem; }
.glossary dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.glossary dt { font-weight: 650; }
.glossary dd { margin: 0; color: var(--muted); }

.foot { border-top: 1px solid var(--line); background: var(--bar); color: var(--muted); font-size: .82rem; padding: 18px 0 28px; }
.foot p { margin: 6px 0; max-width: 90ch; }
.foot b { color: var(--text); }

/* Narrower screens: drop the less important columns. */
@media (max-width: 1000px) {
  .c-price, .c-rating { display: none; }
}
@media (max-width: 760px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tab { white-space: nowrap; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .c-group, .c-date { display: none; }
  .c-img { width: 80px; }
  .cap { width: 72px; }
  .c-name { min-width: 0; }
  tr.detail td { padding-left: 16px; }
  .timeline li { grid-template-columns: 90px 1fr; }
  .timeline li > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .bar-row { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  #q { max-width: none; flex-basis: 100%; }
  .c-days { display: none; }
  .glossary dl { grid-template-columns: 1fr; }
  .glossary dd { margin-bottom: 6px; }
}
.counter img { vertical-align: middle; height: 20px; margin-left: 4px; }
