:root {
  --bg: #0b0d12;
  --surface: #141821;
  --surface-2: #1b2030;
  --line: #262c3d;
  --text: #e8ebf3;
  --muted: #8a93a8;
  --accent: #8b7bff;
  --accent-2: #b4a9ff;
  --good: #34d399;
  --mid: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6fa; --surface: #ffffff; --surface-2: #eef0f6; --line: #dfe3ec;
    --text: #141821; --muted: #5d667a; --accent: #5b4cf0; --accent-2: #3f31d8;
    --good: #059669; --mid: #b45309; --bad: #dc2626;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font: 700 20px 'Space Grotesk', sans-serif; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.stats { margin-left: auto; display: flex; gap: 20px; }
.stats div { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.stats b { font: 700 20px 'Space Grotesk', sans-serif; font-variant-numeric: tabular-nums; }
.stats small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.stats b.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.3); color: var(--good); } }

.banner {
  margin: 16px 24px 0; padding: 10px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--mid) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--mid) 40%, transparent);
  font-size: 13px;
}

main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 60px; }

/* Prompt */
.prompt { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.prompt p { margin: 0; font: 500 18px/1.4 'Space Grotesk', sans-serif; }
.pill {
  flex: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--accent-2);
  border: 1px solid var(--line);
}

/* Arena */
.arena { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.side {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.tag { font: 700 15px 'Space Grotesk', sans-serif; }
.tag::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; width: 32px; height: 32px; font-size: 16px; line-height: 1; }
.icon-btn:hover { border-color: var(--accent); }

.frame-wrap { position: relative; aspect-ratio: 7 / 5; background: #fff; border-block: 1px solid var(--line); }
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.side.expanded { position: fixed; inset: 12px; z-index: 50; box-shadow: 0 0 0 100vmax rgba(0,0,0,.6); }
.side.expanded .frame-wrap { aspect-ratio: auto; flex: 1; }
.side.expanded .guess, .side.expanded .reveal { display: none; }

/* Guess */
.guess { padding: 12px 14px 16px; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 8px; }
.label small { text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips + .label { margin-top: 14px; }
.chip {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px;
  transition: border-color .15s, background .15s, transform .1s;
}
.chip:active { transform: scale(.96); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--surface-2)); }
.chip:disabled { cursor: default; opacity: .55; }
.chip:disabled[aria-pressed="true"] { opacity: 1; }

/* Reveal */
.reveal { padding: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reveal .who { font: 700 17px 'Space Grotesk', sans-serif; }
.reveal .who small { display: block; font: 400 12px Inter, sans-serif; color: var(--muted); }
.reveal .pts { font: 700 22px 'Space Grotesk', sans-serif; }
.reveal.good { background: color-mix(in srgb, var(--good) 12%, transparent); }
.reveal.good .pts { color: var(--good); }
.reveal.mid { background: color-mix(in srgb, var(--mid) 12%, transparent); }
.reveal.mid .pts { color: var(--mid); }
.reveal.bad { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.reveal.bad .pts { color: var(--bad); }

/* Actions */
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 18px; }
.hint { margin: 0 auto 0 0; color: var(--muted); }
.btn { border: 0; border-radius: 10px; padding: 11px 22px; font-weight: 600; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }

.rules { margin-top: 28px; color: var(--muted); }
.rules summary { cursor: pointer; color: var(--text); font-weight: 500; }
.rules ul { padding-left: 20px; }

.empty { grid-column: 1 / -1; padding: 40px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; }
  .stats { gap: 14px; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; }
  main { padding: 16px 16px 48px; }
  .banner { margin: 12px 16px 0; }
  .arena { grid-template-columns: 1fr; }
  .prompt p { font-size: 16px; }
  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1; }
  .hint { width: 100%; }
}

/* Players & scoreboard */
.player { margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-weight: 500; }
.player:hover { border-color: var(--accent); }
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 20px; }
.score { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 2px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.score.me { border-color: var(--accent); }
.score .rank { color: var(--muted); font: 700 14px 'Space Grotesk', sans-serif; }
.score .name { font-weight: 600; }
.score b { font: 700 22px 'Space Grotesk', sans-serif; font-variant-numeric: tabular-nums; }
.score small { grid-column: 2 / -1; color: var(--muted); font-size: 12px; }
.others { margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: right; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--muted); }
.side-head > div { display: flex; gap: 6px; }
a.icon-btn { display: inline-grid; place-items: center; color: var(--text); text-decoration: none; }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; width: min(380px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 14px; font: 700 22px 'Space Grotesk', sans-serif; }
dialog input { display: block; width: 100%; margin: 12px 0; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
dialog .btn { width: 100%; }
.known { display: flex; flex-wrap: wrap; gap: 6px; }

/* Arena previews: thumbnail that opens the real site in a new tab */
.shot { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; color: var(--text); text-decoration: none; }
.shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; transition: transform .3s ease, filter .3s ease; }
.shot:hover img { transform: scale(1.02); filter: brightness(.7); }
.open-label { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--accent); color: #fff; font-weight: 600; padding: 9px 16px; border-radius: 10px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.shot.no-thumb { display: grid; place-items: center; }
.shot.no-thumb .open-label { position: static; transform: none; }
.side-head .seen { font-size: 12px; color: var(--good); }
.prompt { flex-wrap: wrap; }
.by { color: var(--muted); font-size: 13px; }

/* Lists */
.lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-top: 36px; }
.lists h2 { font: 700 16px 'Space Grotesk', sans-serif; margin: 0 0 10px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 14px; }
.row small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.row small.ready { color: var(--good); }
.row-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.result .pts { font: 700 16px 'Space Grotesk', sans-serif; }
.row.result.good .pts { color: var(--good); }
.row.result.mid .pts { color: var(--mid); }
.row.result.bad .pts { color: var(--bad); }
.empty-line { color: var(--muted); font-size: 13px; margin: 0; }
.rules ol { padding-left: 20px; }
