/* GrindIndex. Storefront rows: each game is its picture, its own words and
   its vote count. One typeface (Barlow), cool greys, green for voting and a
   dark gold for ranks. */

@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url('/fonts/barlow-400.woff2') format('woff2'); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url('/fonts/barlow-500.woff2') format('woff2'); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url('/fonts/barlow-600.woff2') format('woff2'); }
@font-face { font-family: Barlow; font-weight: 700; font-display: swap; src: url('/fonts/barlow-700.woff2') format('woff2'); }

:root {
  --page: #eef0f3;
  --surface: #ffffff;
  --ink: #15181d;
  --muted: #5d6670;
  --line: #dde1e6;
  --line-strong: #c4cad2;
  --link: #1d4ed8;
  --go: #15803d;
  --go-dark: #116632;
  --gold: #9a6700;
  --warn: #92400e;
  --bad: #b42318;
  --tile-scapelike: #e3e9f4;
  --tile-idle: #e2f0e6;
  --tile-rsps: #f2e8de;
  --font: Barlow, 'Segoe UI', system-ui, sans-serif;
  --r: 8px;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body {
  margin: 0;
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
img { display: block; max-width: 100%; }

h1, h2, h3 { font-weight: 700; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.01em; }
h1 { font-size: 34px; overflow-wrap: anywhere; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0 0 1em; max-width: 68ch; }
small { font-size: 14px; }
code, pre { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13.5px; }
code { background: #f1f3f6; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
pre { background: #f6f7f9; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; overflow-x: auto; line-height: 1.5; margin: 0 0 1em; }
pre code { background: none; border: 0; padding: 0; }

.wrap { width: min(1040px, 100% - 32px); margin-inline: auto; }

/* Header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 4px 28px; min-height: 60px; flex-wrap: wrap; padding: 8px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand img { width: 26px; height: 26px; }
.nav { display: flex; gap: 2px 22px; flex-wrap: wrap; font-weight: 500; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--ink); }
.nav-end { margin-left: auto; }
@media (max-width: 680px) { .nav-end { margin-left: 0; } }

main { flex: 1; padding: 28px 0 56px; }
.lede { color: var(--muted); font-size: 18px; margin: -2px 0 22px; }

/* Ranked lists */
.board { margin-bottom: 40px; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; }
.board-head h2 { margin: 0; }
.board-head a { font-weight: 500; white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.item { display: grid; grid-template-columns: 44px 176px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 14px 18px 14px 10px; }
.item + .item { border-top: 1px solid var(--line); }
.pos { text-align: right; font-size: 22px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.pos-none { color: var(--line-strong); }
.thumb { display: block; text-decoration: none; width: 176px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--page); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile { display: grid; place-items: center; width: 100%; height: 100%; font-size: 30px; font-weight: 700; color: rgba(21, 24, 29, .55); letter-spacing: .02em; }
.tile-scapelike { background: var(--tile-scapelike); }
.tile-idle { background: var(--tile-idle); }
.tile-rsps { background: var(--tile-rsps); }
.info { min-width: 0; }
.name { font-size: 19px; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.2; }
.name:hover { text-decoration: underline; }
.blurb { color: var(--muted); margin: 3px 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; font-size: 14px; color: var(--muted); }
.score { display: flex; align-items: center; gap: 16px; }
.votes { text-align: right; min-width: 72px; }
.votes b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.votes span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.none { color: var(--muted); padding: 18px; margin: 0; }

@media (max-width: 760px) {
  .item { grid-template-columns: 30px 112px minmax(0, 1fr); gap: 12px; padding: 12px 12px 12px 6px; }
  .pos { font-size: 18px; }
  .thumb { width: 112px; }
  .score { grid-column: 3; justify-content: space-between; }
  .votes { text-align: left; display: flex; gap: 6px; align-items: baseline; min-width: 0; }
  .votes b { display: inline; font-size: 18px; }
  .blurb { font-size: 15px; }
  .tile { font-size: 22px; }
}

/* Game page */
.game-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.game-top h1 { margin: 0; }
.game-top .lede { margin: 4px 0 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.banner { border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9; background: var(--page); margin-bottom: 20px; border: 1px solid var(--line); }
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner .tile { font-size: 64px; }
.credit { font-size: 13px; color: var(--muted); margin: -14px 0 20px; }

.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 20px; }
.box > :last-child { margin-bottom: 0; }
.desc { white-space: pre-line; }
.source-note { font-size: 14px; color: var(--muted); }

.facts { width: 100%; border-collapse: collapse; }
.facts th { text-align: left; font-weight: 400; color: var(--muted); padding: 7px 12px 7px 0; vertical-align: top; white-space: nowrap; }
.facts td { padding: 7px 0; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: break-word; }
.facts tr + tr th, .facts tr + tr td { border-top: 1px solid var(--line); }
.facts .big { font-size: 22px; font-weight: 700; }

/* Tables (other toplists, dashboard, admin) */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-weight: 600; font-size: 14px; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .game a { font-weight: 600; }
.tbl .game small { display: block; color: var(--muted); }
.tbl-wrap { overflow-x: auto; }
@media (max-width: 560px) { .hide-sm { display: none; } }
.paid { color: var(--warn); }
.hint { color: var(--muted); }

/* Buttons and forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 600 16px/1 var(--font);
  padding: 11px 18px;
  color: #fff;
  background: var(--go);
  border: 1px solid var(--go-dark);
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--go-dark); }
.btn-line { background: var(--surface); color: var(--go); border-color: #9cc9ab; padding: 8px 16px; }
.btn-line:hover { background: #eef7f1; }
.btn-plain { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn-plain:hover { background: #f3f5f7; }
.btn-red { background: var(--surface); color: var(--bad); border-color: var(--line-strong); font-weight: 500; }
.btn-red:hover { background: #fdf1f0; }
.btn-vote { font-size: 18px; padding: 13px 28px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }

form.form { display: grid; gap: 16px; max-width: 520px; }
label { display: grid; gap: 4px; font-weight: 600; }
label small { font-weight: 400; color: var(--muted); }
input[type='text'], input[type='email'], input[type='password'], input[type='url'], input[type='search'], input[type='number'], select, textarea {
  font: 16px var(--font);
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 140px; resize: vertical; }

.msg { border: 1px solid var(--line-strong); background: #f3f6fb; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }
.msg-good { border-color: #a7d3b5; background: #eef8f1; }
.msg-bad { border-color: #eab0a9; background: #fdf1ef; }
.msg p:last-child { margin: 0; }
.ok { color: var(--go); }
.fail { color: var(--bad); }
.wait { color: var(--warn); }

.narrow > * { max-width: 680px; }
.docs.narrow > * { max-width: 780px; }
.docs h2 { margin-top: 36px; }
.docs table { border-collapse: collapse; margin-bottom: 1em; }
.docs table td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.secret { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.secret code { word-break: break-all; }
.inline { display: inline; }

.sources { list-style: none; padding: 0; margin: 0 0 1em; max-width: 440px; }
.sources li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sources small { color: var(--muted); }

.foot { color: var(--muted); font-size: 15px; padding: 20px 0 32px; border-top: 1px solid var(--line); background: var(--surface); }
.foot .wrap { display: flex; gap: 6px 22px; flex-wrap: wrap; }
.foot a { color: var(--muted); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Facts, tags, gallery and history */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tags li { font-size: 14px; font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 8px; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: -8px 0 20px; }
.gallery a { display: block; border-radius: 6px; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.spark { display: block; color: var(--link); overflow: visible; }
.spark-empty { font-size: 13px; color: var(--muted); }
.facts .sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.facts .spark { margin-top: 4px; }
.linklist { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.board-note { font-size: 14px; color: var(--muted); margin: -6px 0 12px; }
.rise { font-weight: 600; color: var(--go); white-space: nowrap; }

/* Header search */
.search { flex: 1 1 180px; max-width: 280px; margin-left: auto; }
.search input { padding: 6px 10px; font-size: 15px; }
.search + .nav-end { margin-left: 0; }
@media (max-width: 680px) { .search { order: 3; max-width: none; flex-basis: 100%; margin-left: 0; } }

/* Status */
.up { color: var(--go); font-weight: 600; }
.down { color: var(--bad); font-weight: 600; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; }
.filters label { font-size: 14px; min-width: 150px; }
.filters .grow { flex: 1 1 260px; }
.filters .more { flex-basis: 100%; }
.filters .more summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.filters-inner { display: flex; flex-wrap: wrap; gap: 12px 14px; margin-top: 10px; }
label.check { display: flex; align-items: center; gap: 6px; font-weight: 500; min-width: 0; }
label.check input { width: auto; margin: 0; }

.tags a { color: inherit; text-decoration: none; }
.tags a:hover { color: var(--ink); text-decoration: underline; }
.crumbs { font-size: 14px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* Updates and similar games */
.posts { list-style: none; margin: 0 0 1em; padding: 0; }
.posts li { padding: 12px 0; border-top: 1px solid var(--line); }
.posts li:first-child { border-top: 0; padding-top: 0; }
.posts h3 { font-size: 17px; margin: 0 0 2px; }
.posts .hint { font-size: 13px; margin: 0 0 6px; }
.similar { list-style: none; margin: 0 0 1em; padding: 0; }
.similar li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); }
.similar li:first-child { border-top: 0; }
.similar a { font-weight: 600; }
.similar .hint { font-size: 14px; text-align: right; }

.compare th[scope='row'] { color: var(--muted); font-weight: 400; font-size: 15px; white-space: nowrap; border-bottom: 1px solid var(--line); vertical-align: top; padding-top: 9px; }
.compare tr:last-child th { border-bottom: 0; }
.compare thead th a { font-size: 16px; color: var(--ink); }
.nowrap { white-space: nowrap; }

/* Dashboard */
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 14px; margin: 0; display: grid; gap: 12px; }
legend { font-weight: 600; padding: 0 4px; }
fieldset .hint { margin: 0; font-size: 14px; }
.pair { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cover-preview { border-radius: 6px; border: 1px solid var(--line); width: 400px; max-width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
#details > form.inline { display: block; margin-bottom: 14px; }
.facts .spark-empty { display: block; font-weight: 400; }

/* Reddit */
.reddit-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.reddit-head > div { flex: 1 1 260px; }
.reddit-name { font-size: 18px; font-weight: 600; }
.reddit-desc { color: var(--muted); margin: 4px 0 0; }
.reddit-stats { display: grid; gap: 8px; margin: 0; min-width: 180px; }
.reddit-stats dt { font-size: 13px; color: var(--muted); }
.reddit-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.reddit-stats .spark { margin-top: 2px; }
.reddit-sub { font-size: 15px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.posts li > a { font-weight: 600; }
.reddit-stats .spark-empty { display: block; font-weight: 400; }
