:root {
  color-scheme: dark;
  --bg: #0e1016;
  --panel: #171a23;
  --line: #262b38;
  --text: #e7e9ef;
  --dim: #8d93a5;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
body.playing { overflow: hidden; }
a { color: #9cc0ff; }

header { max-width: 1200px; margin: 0 auto; padding: 32px 24px 8px; }
h1 { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; font-size: 40px; letter-spacing: -0.03em; }
/* The console's four colours, as a mark beside the name. */
.mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 30px; height: 30px; transform: rotate(45deg); }
.mark i { border-radius: 3px; }
.mark i:nth-child(1) { background: #e4312b; }
.mark i:nth-child(2) { background: #f6c400; }
.mark i:nth-child(3) { background: #009e49; }
.mark i:nth-child(4) { background: #1d6fe0; }
header p { color: var(--dim); margin: 8px 0; }
header .warning {
  color: #f2d27a; background: rgb(242 184 75 / 0.1); border: 1px solid rgb(242 184 75 / 0.35); border-radius: 8px;
  padding: 8px 12px;
}
header .warning::before { content: "⚠ "; }
header .tagline { color: var(--text); font-size: 18px; }

main { max-width: 1200px; margin: 0 auto; padding: 12px 24px 32px; }
/* How it is made, under the games. The source link stays whole, on the next line when it doesn't fit. */
footer { max-width: 1200px; margin: 0 auto; padding: 0 24px 32px; color: var(--dim); font-size: 13px; }
footer p { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); }
footer .source { white-space: nowrap; }
.note { color: var(--dim); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.tile {
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; transition: transform 0.15s, border-color 0.15s;
}
.tile:hover { transform: translateY(-3px); border-color: #3a4152; }

.art {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer;
  background:
    radial-gradient(circle at 80% 20%, hsl(calc(var(--h) + 40) 80% 60% / 0.55), transparent 55%),
    linear-gradient(135deg, hsl(var(--h) 65% 32%), hsl(calc(var(--h) + 60) 55% 14%));
}
/* The title card: hidden behind art that names the game, beside an icon. */
.card-title small { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.8; }
.card-title {
  padding: 0 18px; text-align: center; font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em;
  text-wrap: balance; text-shadow: 0 2px 12px rgb(0 0 0 / 0.45);
}
.art img { display: block; transition: transform 0.3s; }
.art.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art.logo img { position: absolute; inset: 10% 8%; width: 84%; height: 80%; object-fit: contain;
  filter: drop-shadow(0 4px 14px rgb(0 0 0 / 0.45)); }
.art.cover .card-title, .art.logo .card-title { display: none; }
.art.icon { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 0 14px; }
.art.icon img { height: 62%; width: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 4px 14px rgb(0 0 0 / 0.45)); }
.art.icon .card-title { padding: 0; text-align: left; font-size: 22px; }
.tile:hover .art img { transform: scale(1.04); }
.art::after {
  content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px;
  background: rgb(0 0 0 / 0.45); opacity: 0; transition: opacity 0.15s;
}
.art:hover::after, .art:focus-visible::after { opacity: 1; }
.art:focus-visible { outline: 2px solid #9cc0ff; outline-offset: -2px; }
/* The name over art that doesn't show it. */
.art.unnamed .card-title {
  display: block; position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 10px; text-align: left; font-size: 20px;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.7)); text-shadow: 0 2px 8px rgb(0 0 0 / 0.6);
}
.body { padding: 8px 10px; flex: 1; }

/* The credit in two lines on every tile, used or not, so the tiles line up. */
.recomp { flex: 1; min-width: 0; margin: 0; font-size: 12px; line-height: 1.4; height: 2.8em; color: var(--dim); overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.recomp a { color: var(--dim); }
.recomp .whole { white-space: nowrap; }  /* a name with a hyphen, never broken at it */

button {
  font: inherit; color: var(--text); background: #2a3040; border: 1px solid #3a4152; border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
}
button:hover { background: #343b4e; }

.player { position: fixed; inset: 0; background: #000; z-index: 10; }
.player[hidden] { display: none; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
/* Over the game's top-right corner, faint until the pointer is over them. */
.player .controls { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0.35; transition: opacity 0.2s; }
.player .controls:hover, .player .controls:focus-within { opacity: 1; }
.player .controls button { width: 34px; height: 34px; padding: 0; background: rgb(0 0 0 / 0.6); border-color: rgb(255 255 255 / 0.25); }
