/* Pass or Fail.
   An exam board's results sheet for Game Pass: a slate-dark page, the title
   rubber-stamped, and every game marked with Metacritic's own colours --
   green for 75 and up, yellow from 50, red below -- set as grades. Distinction
   (90+) is the brighter green, Absent (no Metascore) a dashed grey box. The
   only other colour is the plan pills'. Archivo throughout, its width axis
   doing the work of a second face: expanded for stamps and marks, normal for
   reading, and tabular figures wherever numbers line up. */

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-2: #131a23;
  --bg-3: #1a2330;
  --line: rgba(226, 233, 242, .1);
  --line-strong: rgba(226, 233, 242, .22);
  --text: #e8edf3;
  --muted: #a0aab8;
  --faint: #6f7a89;
  --g-distinction: #2fe39a;
  --g-pass: #6cc644;
  --g-resit: #f3c33c;
  --g-fail: #f2615f;
  --g-absent: #677283;
  --ink: #0b0f14;
  --focus: #8ab4ff;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1180px;
  --radius: 12px;
  --f: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--f);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

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

/* ---- Bar and hero ---- */

.bar, .page, .foot { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.bar-up { color: var(--muted); font-weight: 600; }
.bar-up::before { content: "← "; }
.bar-up:hover { color: var(--text); }
.bar-note { color: var(--faint); font-variant-numeric: tabular-nums; }

.hero { padding: clamp(36px, 7vw, 72px) 0 clamp(24px, 4vw, 36px); }
h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .1em .28em;
  margin: 0 0 18px;
  font-size: clamp(40px, 10.4vw, 84px);
  line-height: 1;
}
.stamp {
  display: inline-block;
  padding: .06em .2em .02em;
  border: .07em solid currentColor;
  border-radius: .1em;
  box-shadow: inset 0 0 0 .025em var(--bg), inset 0 0 0 .05em currentColor;
  font-weight: 900;
  font-stretch: 125%;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.stamp-pass { color: var(--g-pass); transform: rotate(-3deg); }
.stamp-fail { color: var(--g-fail); transform: rotate(2.5deg); }
.or { color: var(--faint); font-size: .42em; font-weight: 500; font-style: italic; font-stretch: 90%; }
.lede { max-width: 56ch; margin: 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); }
.lede span { color: var(--text); }

/* ---- Results by grade ---- */

.report { margin-bottom: 28px; }
.report .label { margin: 0 0 10px; }
.report-bar { display: flex; gap: 3px; height: 12px; margin-bottom: 12px; border-radius: 6px; overflow: hidden; background: var(--bg-2); }
.report-bar i { min-width: 3px; background: var(--grade); transition: opacity .2s, flex-grow .3s; }
.report-bar i.dim { opacity: .22; }
.grades { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.grade {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 8px;
  align-items: baseline;
  padding: 11px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.grade::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--grade); align-self: center; }
.grade:hover { border-color: var(--line-strong); }
.grade[aria-pressed="true"] { border-color: var(--grade); background: color-mix(in srgb, var(--grade) 12%, var(--bg-2)); }
.grade-name { font-weight: 700; font-stretch: 110%; }
.grade-note, .grade-n { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.grade-n { margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.grade-n .n { font-weight: 700; }
.grade-n .pc { color: var(--faint); }

.g-distinction { --grade: var(--g-distinction); }
.g-pass { --grade: var(--g-pass); }
.g-resit { --grade: var(--g-resit); }
.g-fail { --grade: var(--g-fail); }
.g-absent { --grade: var(--g-absent); }

/* ---- Controls ---- */

.controls { margin-bottom: 14px; }
.controls-main { display: flex; flex-wrap: wrap; gap: 10px; }
.search {
  position: relative;
  flex: 1 1 320px;
  display: flex;
  align-items: center;
}
.search svg { position: absolute; left: 14px; width: 18px; height: 18px; fill: none; stroke: var(--faint); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-2);
  font-size: 16px;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { outline: none; border-color: var(--focus); }

.sort { display: flex; gap: 6px; }
.select { position: relative; display: grid; }
.select .label { position: absolute; top: 6px; left: 12px; font-size: 9.5px; pointer-events: none; }
.select select {
  min-height: 46px;
  padding: 16px 34px 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23a0aab8' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 12px center / 11px;
  font-size: 14.5px;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}
.select select:focus-visible { outline: none; border-color: var(--focus); }
.dir {
  display: grid;
  place-items: center;
  width: 46px;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-2);
  cursor: pointer;
}
.dir svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.dir[data-dir="asc"] svg { transform: rotate(180deg); }
.dir:hover, .select select:hover { border-color: var(--muted); }

.filters { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.filters > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(45deg) translateY(-2px); transition: transform .18s; }
.filters[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.filter-count:not(:empty) { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--text); color: var(--ink); font-size: 11.5px; letter-spacing: 0; }
.filter-body { display: grid; gap: 14px; padding: 2px 14px 16px; }
.filter-group { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--ink); font-weight: 600; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filter-row .select select { min-width: 190px; background-color: var(--bg); }
.reset, .link { padding: 0; border: 0; border-bottom: 1px solid var(--line-strong); background: none; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.reset { margin-left: auto; }
.reset:hover, .link:hover { color: var(--text); }

.status { margin: 18px 0 8px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.status b { color: var(--grade); }

/* ---- The sheet ---- */

.sheet { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-align: left;
  text-transform: uppercase;
}
.sheet thead th:not(:has(button)) { padding: 12px 10px; }
.sheet thead button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 12px 10px;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.sheet thead button:hover, .sheet th[aria-sort] { color: var(--text); }
.sheet th[aria-sort] button::after { content: "↓"; font-size: 13px; letter-spacing: 0; }
.sheet th[aria-sort="ascending"] button::after { content: "↑"; }
.sheet .c-score, .sheet .c-user { width: 96px; }
.sheet thead .c-score button, .sheet thead .c-user button { justify-content: center; }
.sheet .c-date { width: 118px; }
.sheet .c-where { width: 236px; }

.sheet tbody tr { border-bottom: 1px solid var(--line); }
.sheet tbody tr:hover { background: var(--bg-2); }
.sheet td { padding: 10px; vertical-align: middle; }
.sheet td.c-score, .sheet td.c-user { text-align: center; }
.c-date { color: var(--muted); font-size: 14px; white-space: nowrap; }
.m-label { display: none; }

.game { display: flex; align-items: center; gap: 14px; min-width: 0; }
.art { flex: none; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--bg-3); }
.art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.who { display: grid; gap: 2px; min-width: 0; }
.name { font-size: 16px; font-weight: 650; line-height: 1.25; }
.game:hover .name { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.by { overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; }
.genre { color: var(--faint); font-size: 12.5px; }
.flag {
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--bg-3);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.flag-new { background: color-mix(in srgb, var(--g-distinction) 18%, transparent); color: var(--g-distinction); }
.flag-leaving { background: color-mix(in srgb, var(--g-fail) 18%, transparent); color: var(--g-fail); }
.flag-soon { background: color-mix(in srgb, var(--focus) 18%, transparent); color: var(--focus); }
.flag-dayone { background: color-mix(in srgb, #b98cff 18%, transparent); color: #c5a3ff; }
.flag-must { background: color-mix(in srgb, var(--g-resit) 16%, transparent); color: var(--g-resit); }

.plats, .plans { display: flex; flex-wrap: wrap; gap: 4px; }
.plans { margin-top: 5px; }
.plat { padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.plan { padding: 2px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.plan-essential { background: rgba(108, 198, 68, .16); color: #9bdc7d; }
.plan-premium { background: rgba(84, 148, 255, .16); color: #8fb8ff; }
.plan-ultimate { background: rgba(176, 132, 255, .16); color: #c5a8ff; }
.plan-pc { background: var(--bg-3); color: var(--muted); }

/* The mark: Metacritic's colour, the grade's name under the number. */
.mark {
  display: inline-grid;
  place-items: center;
  align-content: center;
  width: 72px;
  height: 58px;
  border-radius: 10px;
  background: var(--grade);
  color: var(--ink);
  transition: transform .15s;
}
a.mark:hover { transform: translateY(-2px); }
.mark b { font-size: 25px; font-weight: 800; font-stretch: 112%; line-height: 1; }
.mark span { margin-top: 3px; font-size: 8.5px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.mark.g-distinction { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--g-distinction); }
.mark.g-absent { border: 1.5px dashed var(--g-absent); background: transparent; color: var(--faint); }

.user { display: inline-grid; justify-items: center; min-width: 46px; }
.user b { font-size: 20px; font-weight: 750; font-stretch: 108%; line-height: 1.1; }
.user small { color: var(--faint); font-size: 11.5px; }
.u-good b { color: var(--g-pass); }
.u-mixed b { color: var(--g-resit); }
.u-bad b { color: var(--g-fail); }
.u-none b { color: var(--faint); }
a.user:hover small { color: var(--muted); }
.gap { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 700; }
.sheet:not([data-sort="gap"]) .gap { display: none; }

.empty { padding: 56px 0; text-align: center; color: var(--muted); }
.empty-title { margin: 0 0 6px; color: var(--text); font-size: 22px; font-weight: 800; font-stretch: 115%; }

.foot { padding: 40px 0 calc(40px + env(safe-area-inset-bottom)); margin-top: 32px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }
.foot p { max-width: 80ch; margin: 0; }
.foot a { color: var(--muted); border-bottom: 1px solid var(--line-strong); }

/* ---- Narrower screens ---- */

@media (max-width: 980px) {
  .grades { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sheet .c-where { width: 170px; }
}

/* Phones: each game becomes a card -- art and title, then its marks on the
   right, with the release date and platforms underneath. The sort menu takes
   over from the column headings. */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .bar-note { font-size: 12px; }
  .grades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade { padding: 9px 10px 10px; }
  .grade-note { display: none; }
  .grade:last-child { grid-column: 1 / -1; }
  .search { flex-basis: 100%; }
  .sort { flex: 1; }
  .sort .select { flex: 1; }
  .filter-group { grid-template-columns: 1fr; gap: 6px; }
  .filter-row .select { flex: 1 1 140px; }
  .filter-row .select select { min-width: 0; width: 100%; }
  .reset { margin-left: 0; }

  .sheet, .sheet tbody { display: block; }
  .sheet thead { display: none; }
  /* Flex rather than grid: the platforms line would otherwise widen the
     marks' columns to fit itself. The row's ::after is the line break. */
  .sheet tbody tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; padding: 12px 0; }
  .sheet tbody tr::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
  .sheet tbody tr:hover { background: none; }
  .sheet td { padding: 0; }
  .sheet td.c-game { order: 0; flex: 1 1 0; min-width: 0; }
  .sheet td.c-score { order: 1; width: auto; }
  .sheet td.c-user { order: 2; width: auto; }
  .sheet td.c-date { order: 4; width: auto; margin-top: 10px; font-size: 12.5px; }
  .sheet td.c-where { order: 5; flex: 1 1 auto; width: auto; margin-top: 10px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
  .sheet td.c-where .plans { margin-top: 0; }
  .m-label { display: inline; color: var(--faint); }
  .game { gap: 11px; }
  .art { width: 48px; height: 48px; }
  .name { font-size: 15px; }
  .mark { width: 62px; height: 50px; }
  .mark b { font-size: 21px; }
  .mark span { font-size: 7.5px; letter-spacing: .03em; }
  .user { min-width: 38px; }
  .user b { font-size: 17px; }
}

@media (max-width: 420px) {
  .m-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
