:root {
  --bg: #0c0f13;
  --panel: #14181f;
  --panel-2: #1b212b;
  --line: #242b36;
  --text: #e9ecf1;
  --muted: #8791a1;
  --faint: #4a5361;
  --accent: #8ab4ff;
  --good: #4ade80;
  --ok: #facc15;
  --bad: #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1 { margin: 0; font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 1320px; margin: 0 auto; padding: 36px 24px 72px; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.none { color: var(--faint); }
.soon { color: var(--accent); }
.good { color: var(--good); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

/* controls */
input, button { font: inherit; color: inherit; }
input[type=search], input[type=password] {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}
input::placeholder { color: var(--faint); }
button {
  background: var(--accent);
  color: #0a1020;
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.65; cursor: progress; }
button.ghost { background: none; color: var(--muted); font-weight: 500; padding-inline: 8px; }
button.ghost:hover { color: var(--text); }

.error {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
}
.empty { margin: 0; padding: 48px 16px; text-align: center; color: var(--muted); }

/* list page */
.top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.actions { display: flex; align-items: center; gap: 8px; }
.actions input { width: 240px; }

.table { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; white-space: nowrap; }
th.l, td.l { text-align: left; white-space: normal; }
th button {
  all: unset;
  box-sizing: border-box;
  display: block;
  width: 100%;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
}
th button:hover, th:not([aria-sort=none]) button { color: var(--text); }
th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th[aria-sort=ascending] button::after { content: " ↑"; color: var(--accent); }
th[aria-sort=descending] button::after { content: " ↓"; color: var(--accent); }
td { padding: 10px 14px; border-top: 1px solid var(--line); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }

.g { display: flex; align-items: center; gap: 14px; min-width: 250px; }
.g img { flex: none; width: 120px; height: 45px; object-fit: cover; border-radius: 4px; background: var(--panel-2); }
.g a { font-weight: 600; }
tr:hover .g a { color: var(--accent); }
.tags { display: block; color: var(--muted); font-size: 12.5px; }

.pill {
  display: inline-block;
  min-width: 48px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-align: center;
  background: color-mix(in srgb, currentColor 13%, transparent);
}
.count { display: inline-block; width: 42px; color: var(--muted); font-size: 12.5px; }
td.main { font-weight: 600; }
.off {
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--good);
  background: color-mix(in srgb, var(--good) 13%, transparent);
}
s { margin-right: 8px; color: var(--muted); }

/* game page */
.detail { max-width: 1080px; }
.back { display: inline-block; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.back:hover { color: var(--text); }
.hero { position: relative; aspect-ratio: 31 / 10; min-height: 180px; border-radius: 14px; overflow: hidden; background: var(--panel); }
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, var(--bg) 2%, transparent 70%); }
.title { position: relative; margin-top: -64px; padding: 0 24px; }
.title h1 { font-size: 36px; text-shadow: 0 2px 16px rgb(0 0 0 / 0.6); }
.title .sub { font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 28px 0; }
.card { padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card .k { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.card .v { margin-top: 8px; font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card .d { margin-top: 6px; color: var(--muted); font-size: 13px; }

.desc { max-width: 75ch; margin: 0 0 20px; font-size: 16px; color: #c9ced7; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 28px; padding: 0; list-style: none; }
.chips li { padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 28px; }
.shots img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--panel); }
.shots a:hover img { filter: brightness(1.12); }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.links a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; }
.links a:hover { border-color: var(--accent); color: var(--accent); }
.links a::after { content: " ↗"; color: var(--muted); }
.foot { margin: 28px 0 0; color: var(--faint); font-size: 13px; }

/* sign in */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login form { display: grid; gap: 12px; width: min(360px, 100%); padding: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.login h1 { margin-bottom: 8px; }
.login label { color: var(--muted); font-size: 13px; }
.login .error { margin: 0; }
.login button { margin-top: 4px; padding-block: 10px; }

@media (max-width: 1000px) {
  .hide-m { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 20px 12px 48px; }
  .hide-s, .count, .tags { display: none; }
  .actions { width: 100%; }
  .actions input { flex: 1; width: auto; min-width: 0; }

  /* each game becomes two lines: art + name, then its numbers */
  thead tr, tbody tr { display: grid; grid-template-columns: 1fr 78px 52px 84px; align-items: center; }
  tbody tr { padding: 10px 0; border-top: 1px solid var(--line); }
  th.l, td.l { grid-column: 1 / -1; }
  th:nth-child(2), td:nth-child(2) { grid-column: 2; }
  td { padding: 0 12px; border: 0; }
  td.l { padding-bottom: 6px; }
  th button { padding: 4px 12px; }
  th.l button { padding-top: 12px; }
  thead tr { padding-bottom: 8px; }
  .g { min-width: 0; }
  .g img { width: 96px; height: 36px; }

  .title { margin-top: -40px; padding: 0 12px; }
  .title h1 { font-size: 26px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats .card:first-child { grid-column: 1 / -1; }
  .shots { grid-template-columns: repeat(2, 1fr); }
}
