:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #dde2e8;
  --text: #1a1e24;
  --text-dim: #5a636e;
  --accent: #35638f;
  --accent-soft: rgba(53, 99, 143, 0.10);
  --green: #2e7d5b;
  --green-bg: rgba(46, 125, 91, 0.13);
  --amber: #9a6b18;
  --amber-bg: rgba(154, 107, 24, 0.14);
  --eol: #6b7078;
  --eol-bg: rgba(107, 112, 120, 0.14);
  --range: #0e8390;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.05), 0 4px 16px rgba(20, 30, 45, 0.05);
  --sans: ui-sans-serif, -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317; --surface: #191d23; --surface-2: #20252c; --border: #2b313a;
    --text: #e6e9ed; --text-dim: #98a1ac; --accent: #6ea3d6; --accent-soft: rgba(110,163,214,0.14);
    --green: #4cbd88; --green-bg: rgba(76,189,136,0.15); --amber: #d3a24a; --amber-bg: rgba(211,162,74,0.15);
    --eol: #8b929c; --eol-bg: rgba(139,146,156,0.15); --range: #4ec4d3;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 18px rgba(0,0,0,0.35);
  }
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }

.wrap {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 40px) 64px;
  min-height: 100vh;
}
.page { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
h1 { font-size: clamp(26px, 4.4vw, 38px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 680; margin: 0 0 12px; text-wrap: balance; }
.lede { font-size: 16px; color: var(--text-dim); max-width: 68ch; margin: 0; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-dim); align-items: center; }
.legend .item { display: inline-flex; align-items: center; gap: 7px; }
.legend-source { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.desktop { background: var(--green); }
.dot.mobile { background: var(--accent); }
.dot.legacy { background: var(--amber); }
.dot.unrecorded { background: var(--eol); }

section { display: flex; flex-direction: column; gap: 16px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
h2 { font-size: 21px; letter-spacing: -0.01em; font-weight: 660; margin: 0; }
h3 { font-size: 17px; letter-spacing: -0.01em; font-weight: 650; margin: 0; }
.sec-head .tag { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 18px 20px; }
.metric .number { font-family: var(--mono); font-size: 27px; line-height: 1; font-weight: 650; color: var(--accent); }
.metric .label { margin-top: 7px; color: var(--text-dim); font-size: 13px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.catalogue-row:hover td { background: var(--accent-soft); }
.v { font-weight: 600; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.count { text-align: right; width: 78px; white-space: nowrap; }
.platform-cell { min-width: 280px; }

.pill { display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; margin: 2px 2px 2px 0; }
.pill.desktop { color: var(--green); background: var(--green-bg); }
.pill.mobile { color: var(--accent); background: var(--accent-soft); }
.pill.legacy { color: var(--amber); background: var(--amber-bg); }
.pill.unrecorded { color: var(--eol); background: var(--eol-bg); }

.coverage-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.bar-track { height: 9px; flex: 1; min-width: 100px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--range); border-radius: inherit; }
.percentage { color: var(--text-dim); font-size: 12px; width: 34px; text-align: right; }

.notes { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; color: var(--text-dim); padding-left: 2px; }
.notes b { color: var(--text); font-weight: 600; }
.notes .k { font-family: var(--mono); font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px; }

.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 12px; }
.toolbar input, .toolbar select { width: 100%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 9px 11px; font: inherit; font-size: 13px; outline: none; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.result-count { font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; padding: 0 4px; }

.release-link { display: inline-flex; flex-direction: column; gap: 3px; color: inherit; text-decoration: none; }
.release-link:hover .release-value { color: var(--amber); }
.release-link:focus-visible { outline: 2px solid var(--amber); outline-offset: 4px; border-radius: 2px; }
.release-value { font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap; transition: color .15s ease; }
.release-source { color: var(--text-dim); font-size: 10px; letter-spacing: .04em; white-space: nowrap; }
.release-missing { color: var(--text-dim); font-family: var(--mono); }

#chronological-catalogue table { table-layout: fixed; min-width: 920px; }
#chronological-catalogue th:nth-child(1), #chronological-catalogue td:nth-child(1) { width: 34%; }
#chronological-catalogue th:nth-child(2), #chronological-catalogue td:nth-child(2) { width: 43%; }
#chronological-catalogue th:nth-child(3), #chronological-catalogue td:nth-child(3) { width: 190px; }

.curated-list { display: flex; flex-direction: column; gap: 28px; }
.curated-section { gap: 12px; }
.curated-section table { table-layout: fixed; min-width: 1000px; }
.curated-section th.list-number, .curated-section td.list-number { width: 58px; text-align: right; color: var(--text-dim); }
.curated-section th:nth-child(2), .curated-section td:nth-child(2) { width: 28%; }
.curated-section th:nth-child(3), .curated-section td:nth-child(3) { width: 34%; }
.curated-section th:nth-child(4), .curated-section td:nth-child(4) { width: 172px; }
.curated-section th:last-child, .curated-section td:last-child { width: 66px; }

footer { border-top: 1px solid var(--border); padding-top: 18px; font-size: 12.5px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }

.home-page { min-height: calc(100vh - 120px); }
.home-page main { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-card {
  min-height: 250px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.home-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.home-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.home-card-featured { border-top: 3px solid var(--accent); padding-top: 22px; }
.home-card-kicker { font-family: var(--mono); color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.home-card-title { margin-top: 12px; font-size: 20px; line-height: 1.2; font-weight: 660; letter-spacing: -.01em; }
.home-card-copy { margin-top: 10px; color: var(--text-dim); font-size: 13.5px; }
.home-card-link { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 24px; color: var(--accent); font-size: 12px; }
.home-arrow { font-size: 20px; line-height: 1; transition: transform .16s ease; }
.home-card:hover .home-arrow { transform: translateX(4px); }

@media (max-width: 720px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: 1fr; }
  .home-card { min-height: 210px; }
}
@media (max-width: 660px) {
  .toolbar { grid-template-columns: 1fr; }
  .platform-cell { min-width: 220px; }
  .legend-source { margin-left: 0; flex-basis: 100%; }
}

@media print {
  :root { --bg:#fff; --surface:#fff; --surface-2:#f1f4f7; --border:#d5dae1; --text:#16191e; --text-dim:#545c66; --accent:#2f5c86; --accent-soft:rgba(47,92,134,.08); --green:#206b4c; --green-bg:rgba(32,107,76,.12); --amber:#855b12; --amber-bg:rgba(133,91,18,.12); --eol:#5f646c; --eol-bg:rgba(95,100,108,.12); --range:#0c6b76; --shadow:none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .wrap { padding: 12px 0; }
  .toolbar { display: none; }
  .card, .metric { box-shadow: none; }
  .home-card { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  section, .card, header, tr, .metric { break-inside: avoid; page-break-inside: avoid; }
  .table-scroll { overflow: visible; }
  thead { display: table-header-group; }
  .catalogue-row[hidden], .group-label[hidden] { display: table-row !important; }
  #chronological-catalogue[hidden], #curated-catalogue[hidden], .game-group[hidden] { display: flex !important; }
}
