:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --text: #1b1c1e;
  --muted: #62656b;
  --border: #dcdcd6;
  --accent: #3b5bdb;
  --red: #c92a2a;
  --red-bg: #ffe3e3;
  --blue: #1864ab;
  --blue-bg: #d0ebff;
  --bystander-bg: #efe6d5;
  --assassin-bg: #2b2b2b;
  --assassin-fg: #f1f1f1;
  --good: #2b8a3e;
  --warn: #b35900;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131416;
    --surface: #1c1e21;
    --surface-2: #25282c;
    --text: #e9e9e6;
    --muted: #9a9ea6;
    --border: #33373d;
    --accent: #8aa4ff;
    --red: #ff8787;
    --red-bg: #4a1f1f;
    --blue: #74c0fc;
    --blue-bg: #17324a;
    --bystander-bg: #3a362c;
    --assassin-bg: #000000;
    --assassin-fg: #e9e9e6;
    --good: #69db7c;
    --warn: #ffa94d;
  }
}
* { 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: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code, .mono { font-family: var(--mono); font-size: .85em; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .8rem 16px; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; color: var(--text); display: flex; gap: .45rem; align-items: center; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
nav { display: flex; flex-wrap: wrap; gap: .25rem; }
nav a { padding: .3rem .65rem; border-radius: 999px; color: var(--muted); }
nav a:hover { background: var(--surface-2); text-decoration: none; }
nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; outline: none; }
.site-footer { border-top: 1px solid var(--border); padding: 1rem 16px; color: var(--muted); font-size: .8rem; text-align: center; }

.notice { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); border-bottom: 1px solid var(--border); padding: .55rem 16px; text-align: center; font-size: .88rem; }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 .4rem; }
.tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .4rem .9rem; border-radius: 999px; cursor: pointer; font: inherit;
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .tab[aria-selected="true"] { color: #10131c; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .75rem; margin: 1rem 0; }
.insight { border-left: 3px solid var(--accent); }
.insight .kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td.team { white-space: normal; min-width: 180px; font-weight: 600; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.rank { color: var(--muted); width: 2rem; }
.elo { font-weight: 700; font-size: 1.05rem; }
.badge {
  display: inline-block; font-size: .68rem; font-weight: 600; padding: .05rem .4rem;
  border-radius: 999px; border: 1px solid var(--border); color: var(--muted); margin-left: .35rem;
  vertical-align: middle; white-space: nowrap;
}
.badge.warn { color: var(--warn); border-color: currentColor; }
.ci { width: 170px; height: 18px; display: block; }
.ci .range { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; opacity: .45; }
.ci .dot { fill: var(--accent); }
.ci .axis { stroke: var(--border); stroke-width: 1; }

.h2h td, .h2h th { text-align: center; padding: .4rem .5rem; }
.h2h th.rowhead { text-align: left; white-space: normal; min-width: 140px; }
.h2h .self { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
select, button.plain {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem;
}
button.plain { cursor: pointer; }
button.plain:hover { background: var(--surface-2); }
.pill { font-weight: 600; }
.pill.red { color: var(--red); }
.pill.blue { color: var(--blue); }

.game-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: stretch; margin: 1rem 0; }
.side { flex: 1 1 260px; border-top: 4px solid var(--border); }
.side.red { border-top-color: var(--red); }
.side.blue { border-top-color: var(--blue); }
.side .who { font-weight: 700; }
.side.won::after { content: "winner"; float: right; font-size: .7rem; font-weight: 700; color: var(--good); text-transform: uppercase; letter-spacing: .06em; }

.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 1rem 0; }
.cell {
  border: 1px solid var(--border); border-radius: 8px; padding: .55rem .2rem; text-align: center;
  font-weight: 600; font-size: .78rem; letter-spacing: .02em; background: var(--surface);
  overflow: hidden; text-overflow: ellipsis; position: relative;
}
.cell.redAgent { background: var(--red-bg); color: var(--red); }
.cell.blueAgent { background: var(--blue-bg); color: var(--blue); }
.cell.bystander { background: var(--bystander-bg); }
.cell.assassin { background: var(--assassin-bg); color: var(--assassin-fg); }
.cell.hidden-now { opacity: .38; }
.cell.just { outline: 3px solid var(--accent); outline-offset: 1px; }
.scrub { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.scrub input[type=range] { flex: 1 1 220px; }

.turn { margin: .6rem 0; border-left: 4px solid var(--border); }
.turn.red { border-left-color: var(--red); }
.turn.blue { border-left-color: var(--blue); }
.turn.current { box-shadow: 0 0 0 2px var(--accent); }
.turn .head { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: baseline; }
.clue-word { font-size: 1.15rem; font-weight: 800; letter-spacing: .03em; }
.guess { display: inline-block; margin: .15rem .3rem .15rem 0; padding: .1rem .5rem; border-radius: 6px; font-weight: 600; font-size: .8rem; border: 1px solid var(--border); }
.guess.ok { background: color-mix(in srgb, var(--good) 18%, transparent); }
.guess.bad { background: color-mix(in srgb, var(--red) 16%, transparent); }
.reason { color: var(--muted); font-style: italic; margin-top: .25rem; white-space: pre-wrap; }
.failed { color: var(--warn); font-weight: 600; }

details { margin-top: .5rem; }
summary { cursor: pointer; color: var(--accent); font-size: .85rem; }
pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: .7rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  font: .78rem/1.45 var(--mono); max-height: 420px; overflow-y: auto; margin: .4rem 0;
}
.call { border-top: 1px dashed var(--border); margin-top: .6rem; padding-top: .5rem; }
.label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .5rem; }
.prose { max-width: 70ch; }
.prose li { margin: .3rem 0; }
