
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1d1c1a;
  --muted: #6b6860;
  --line: #dcd9d0;
  --accent: #e4572e;
  --accent-ink: #ffffff;
  --good: #2e8b57;
  --bad: #c0392b;
  --add-bg: #e3f4e8;
  --del-bg: #fbe6e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1d1c1b;
    --surface-2: #262523;
    --text: #edebe6;
    --muted: #9a968c;
    --line: #34322f;
    --accent: #ff7a4d;
    --accent-ink: #1a0d08;
    --good: #5fcf8f;
    --bad: #ff6b5b;
    --add-bg: #17301f;
    --del-bg: #3a1b18;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); font-size: .88em; }
pre { background: var(--surface-2); padding: 12px; border-radius: 8px; overflow-x: auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 16px; }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 18px; height: 56px; }
.logo { font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -.02em; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 14px; align-items: center; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover, .nav a.on { color: var(--text); }
main { padding: 28px 0 64px; }
footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .85rem; }

/* controls */
.btn, button {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover, button:hover { border-color: var(--muted); color: var(--text); }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover, button.primary:hover { filter: brightness(1.05); }
.btn.small, button.small { padding: 4px 10px; font-size: .85rem; }
.btn.on { border-color: var(--accent); color: var(--accent); }
button.link { border: 0; background: none; padding: 0; color: var(--muted); font-weight: 500; }
button.link:hover { color: var(--bad); }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=file] { padding: 6px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 4px; }
form.inline { display: inline; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.narrow { max-width: 560px; }
.alert { border: 1px solid var(--bad); color: var(--bad); background: var(--del-bg); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.notice { border: 1px solid var(--line); background: var(--surface-2); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.agent { color: var(--accent); border-color: var(--accent); background: transparent; }
.badge.open { color: var(--good); border-color: var(--good); background: transparent; }
.badge.accepted { color: var(--accent-ink); background: var(--good); border-color: var(--good); }
.badge.rejected, .badge.withdrawn { color: var(--muted); }
.tag { font-size: .8rem; color: var(--muted); text-decoration: none; }
.tag::before { content: "#"; }

/* browse */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters form { display: flex; gap: 8px; flex: 1; min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { text-decoration: none; font-size: .85rem; padding: 4px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.game-card { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.game-card:hover { border-color: var(--accent); color: inherit; }
.thumb { aspect-ratio: 16 / 10; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph { font-size: 2.4rem; font-weight: 800; color: var(--muted); opacity: .5; }
.game-card .body { padding: 12px 14px; }
.game-card h3 { margin: 0 0 2px; font-size: 1rem; }
.stats { display: flex; gap: 12px; font-size: .82rem; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* game page */
.game-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.game-head .info { flex: 1; min-width: 240px; }
.player { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; max-height: 78vh; width: 100%; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-bar { display: flex; gap: 8px; align-items: center; margin: 10px 0 24px; flex-wrap: wrap; }
.toast { font-size: .85rem; color: var(--muted); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.vote { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vote button { border: 0; border-radius: 0; }
.vote button + button { border-left: 1px solid var(--line); }
.vote button.on.up { color: var(--good); }
.vote button.on.down { color: var(--bad); }
.comments { list-style: none; padding: 0; margin: 0; }
.comments li { padding: 12px 0; border-top: 1px solid var(--line); }
.comments .meta { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: 2px; }
.comments .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.side > section { margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 8px 0; border-top: 1px solid var(--line); }
.description { white-space: pre-wrap; }

/* diff */
.diff-file { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; overflow: hidden; background: var(--surface); }
.diff-file header { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .85rem; flex-wrap: wrap; }
.diff-body { overflow-x: auto; font-family: var(--mono); font-size: .8rem; line-height: 1.45; }
.diff-body div { white-space: pre; padding: 0 12px; min-width: max-content; }
.diff-body .add { background: var(--add-bg); }
.diff-body .del { background: var(--del-bg); }
.diff-body .hunk { color: var(--muted); background: var(--surface-2); }
.diff-file .note { padding: 10px 12px; color: var(--muted); font-size: .85rem; }

.token-secret { font-family: var(--mono); word-break: break-all; background: var(--surface-2); padding: 10px; border-radius: 8px; user-select: all; }
@media (max-width: 600px) {
  .top .wrap { gap: 10px; }
  .nav { gap: 10px; font-size: .9rem; }
  .nav .hide-sm { display: none; }
  h1 { font-size: 1.4rem; }
}
