/* Secret Hitler XL — mobile-first, dark poster theme matching the card art. */
:root {
  --bg: #1c1a18;
  --bg-deep: #141210;
  --panel: #2b2b2b;
  --panel-2: #363330;
  --line: rgba(244, 227, 193, 0.14);
  --cream: #f4e3c1;
  --text: #f4e3c1;
  --muted: #bfb092;
  --lib: #5bc0c9;
  --lib-d: #1d5c73;
  --fas: #e0473d;
  --fas-d: #7a2016;
  --com: #9b1b1b;
  --com-l: #d23a32;
  --gold: #d9a441;
  --ok: #5cc26b;
  --radius: 12px;
  --display: "Oswald", "Bebas Neue", Impact, "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 16px/1.4 var(--font);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(224, 71, 61, 0.10), transparent 70%),
    var(--bg);
}
img { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--lib); }
h1, h2, h3 { margin: 0 0 0.5em; line-height: 1.15; }
h2 { font: 800 1.15rem/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.6em; }
small, .small { font-size: 0.82rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.center { text-align: center; justify-content: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.display { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.xl { color: var(--fas); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--lib); outline-offset: 2px; }
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); font-family: var(--display); }

/* ------------------------------------------------------------------ buttons & controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 16px; border-radius: 10px;
  background: var(--panel-2); color: var(--cream);
  border: 2px solid rgba(244, 227, 193, 0.22);
  font-weight: 700; text-decoration: none; text-align: center; line-height: 1.15;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
  touch-action: manipulation; user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; }
.btn-primary { background: var(--cream); color: #231f1c; border-color: var(--cream); }
.btn-danger { background: var(--com); border-color: #c6352c; color: #fff4e6; }
.btn-fascist { background: var(--fas); border-color: var(--fas); color: #fff7ea; }
.btn-liberal { background: var(--lib-d); border-color: var(--lib); color: #eafcff; }
.btn-veto { background: #3b1512; border-color: var(--fas); }
.btn-host { background: #3a3120; border-color: var(--gold); color: #ffe9b8; margin-top: 8px; min-height: 48px; }
.btn-block { display: flex; width: 100%; }
.btn-big { min-height: 56px; font-size: 1.1rem; }
.btn-sm { min-height: 42px; padding: 0 12px; font-size: 0.92rem; }
.btn-xs { min-height: 36px; padding: 0 10px; font-size: 0.85rem; }
.btn.armed { background: var(--fas); border-color: #ff8a7f; color: #fff; animation: pulse 0.9s infinite; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: 0; background: transparent; color: var(--cream);
}
.icon-btn:disabled { opacity: 0.3; }
.icon-btn.big { width: 52px; height: 52px; background: var(--panel-2); }
.icon-btn.big.primary { background: var(--cream); color: #231f1c; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 0.9rem; color: var(--muted); }
.field input, .field select, .search, .code-input, .timer-custom {
  min-height: 48px; padding: 0 12px; border-radius: 10px; background: var(--bg-deep);
  border: 2px solid var(--line); color: var(--cream); font-size: 1rem; width: 100%;
}
.field input:focus, .field select:focus, .code-input:focus { border-color: var(--lib); outline: none; }
.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; color: var(--cream); }
.field-inline > span { display: flex; flex-direction: column; font-size: 0.95rem; }
.field-inline small { color: var(--muted); }
.field-inline select { width: auto; max-width: 52%; flex: none; }
.form-error { color: #ffb4a8; background: rgba(155, 27, 27, 0.35); border-left: 4px solid var(--fas); padding: 8px 10px; border-radius: 6px; }
.hint { color: var(--muted); font-size: 0.85rem; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; background: var(--panel-2); color: var(--cream); vertical-align: middle;
}
.chip .ico { width: 1em; height: 1em; }
.chip-cream { background: var(--cream); color: #231f1c; }
.chip-lib { background: var(--lib-d); color: #dff8fb; }
.chip-fas { background: var(--fas); color: #fff; }
.chip-com { background: var(--com); color: #fff; }
.chip-cap { background: #6b5320; color: #ffe9b8; }
.chip-ana { background: #111; color: #eee; border: 1px solid #555; }
.chip-x { background: #4a4540; }
.chip-ready { background: #24452a; color: #d7f2db; }
.count { display: inline-grid; place-items: center; min-width: 1.6em; padding: 0 6px; height: 1.6em; border-radius: 999px; background: var(--fas); color: #fff; font: 700 0.8rem var(--font); vertical-align: middle; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--panel); }
.dot-on { background: var(--ok); }
.dot-off { background: #7d7770; }

/* toggle switch */
.toggle { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { flex: none; width: 46px; height: 28px; border-radius: 999px; background: #4a4540; position: relative; transition: background 0.15s; }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); transition: transform 0.15s; }
.toggle input:checked + .toggle-track { background: var(--lib-d); box-shadow: inset 0 0 0 2px var(--lib); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 3px solid var(--lib); outline-offset: 2px; }
.toggle-text { display: flex; flex-direction: column; }
.toggle-text small { color: var(--muted); }
.toggle.disabled { opacity: 0.45; cursor: not-allowed; }

.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { min-height: 44px; min-width: 52px; padding: 0 10px; border-radius: 8px; border: 2px solid var(--line); background: var(--bg-deep); font-weight: 600; font-size: 0.9rem; }
.seg button.on { background: var(--cream); color: #231f1c; border-color: var(--cream); }
.seg button:disabled { opacity: 0.5; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--bg-deep); padding: 4px; border-radius: 12px; }
.tab { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; color: var(--muted); }
.tab.on { background: var(--panel-2); color: var(--cream); }

.spinner-wrap { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 24px; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--cream); animation: spin 0.8s linear infinite; }

/* ------------------------------------------------------------------ pages */
.page {
  max-width: 720px; margin: 0 auto;
  padding: calc(var(--safe-top) + 4px) calc(12px + var(--safe-right)) calc(28px + var(--safe-bottom)) calc(12px + var(--safe-left));
}
.panel { background: var(--panel); border-radius: 14px; padding: 14px; margin: 12px 0; border: 1px solid var(--line); }
.topnav { display: flex; align-items: center; gap: 4px; min-height: 52px; flex-wrap: wrap; }
.topnav-home { font-size: 1.25rem; text-decoration: none; color: var(--cream); padding: 8px 8px 8px 0; }
.topnav-title { color: var(--muted); font-weight: 600; }
.navlink { color: var(--cream); background: none; border: 0; text-decoration: none; padding: 12px 8px; font-size: 0.9rem; font-weight: 600; min-height: 44px; }
.welcome { margin: 4px 2px 0; color: var(--muted); }
.landing-lead { text-align: center; font-size: 1.1rem; margin: 4px 8px 14px; }
.landing-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.brand { text-align: center; margin: 12px 0 8px; }
.brand-art { width: 100%; max-height: 190px; object-fit: cover; border-radius: 14px; display: block; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.brand h1 { font-size: 2.2rem; margin: 14px 0 0; }
.brand-small .brand-art { max-height: 110px; }
.brand-small h1 { font-size: 1.6rem; margin-top: 10px; }
.auth-page { max-width: 440px; margin: 0 auto; padding: calc(var(--safe-top) + 8px) 14px calc(24px + var(--safe-bottom)); }
.pending-panel { text-align: center; }
.pending-icon { font-size: 2.4rem; color: var(--gold); margin: 6px 0; }
.pending-icon .ico { width: 48px; height: 48px; }
.row { display: flex; gap: 8px; }
.code-input { font: 700 1.3rem var(--mono); letter-spacing: 0.2em; text-transform: uppercase; flex: 1; min-width: 0; text-align: center; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 12px 0; font-size: 0.85rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.list-row:last-child { border-bottom: 0; }
.list-row.wrap { flex-wrap: wrap; }
.search { margin-bottom: 8px; }

.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; padding: 6px 4px; border-bottom: 2px solid var(--line); }
.table td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr.me td { background: rgba(91, 192, 201, 0.12); }
.team-chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.team-chips .chip { font-size: 0.68rem; padding: 1px 6px; }

/* lobby */
.room-code-panel { text-align: center; }
.room-code-label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.room-code { font-size: 2.8rem; font-weight: 800; letter-spacing: 0.18em; margin: 2px 0 10px; color: var(--cream); padding-left: 0.18em; }
.seats { list-style: none; margin: 0; padding: 0; }
.seat-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.seat-no { width: 22px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; flex: none; }
.seat-name { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.seat-nm { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-ctl { display: flex; align-items: center; gap: 0; flex: none; }
.seat-ctl .icon-btn { width: 40px; height: 44px; }
.config fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.config legend { font: 800 0.85rem var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); margin-bottom: 4px; padding: 0; }
.config legend small { font: 400 0.75rem var(--font); text-transform: none; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.timer-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.timer-label { font-size: 0.92rem; }
.timer-custom { width: 120px; }
.lobby-footer {
  position: sticky; bottom: 0; margin: 0 calc(-12px - var(--safe-left)) calc(-28px - var(--safe-bottom));
  padding: 10px calc(12px + var(--safe-right)) calc(12px + var(--safe-bottom)) calc(12px + var(--safe-left));
  background: linear-gradient(to top, var(--bg) 75%, rgba(28, 26, 24, 0)); z-index: 3;
}
.problems { margin-bottom: 8px; }
.problem { padding: 6px 10px; border-radius: 6px; margin: 0 0 4px; font-size: 0.88rem; }
.problem-error { background: #5a1914; border-left: 4px solid var(--fas); }
.problem-warn { background: #3f3320; border-left: 4px solid var(--gold); }

.banner { padding: 6px 12px; text-align: center; font-size: 0.85rem; font-weight: 600; }
.banner small { font-weight: 400; }
.banner-warn { background: var(--gold); color: #2a2110; }
.banner-bad { background: var(--com); color: #fff; }

/* ------------------------------------------------------------------ avatar */
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; flex: none;
  background: hsl(var(--hue, 20) 28% 34%); color: var(--cream); font-weight: 800; letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
}

/* ------------------------------------------------------------------ game layout */
.game {
  height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  padding-left: var(--safe-left); padding-right: var(--safe-right);
}
.topbar { background: var(--bg-deep); padding-top: var(--safe-top); border-bottom: 1px solid #000; z-index: 6; position: relative; }
.topbar-main { display: flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 52px; }
.phase-label {
  flex: 1; min-width: 0; font-weight: 750; font-size: 1rem; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.toolbar { display: flex; gap: 4px; padding: 0 8px 6px; }
.tool {
  flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-size: 0.85rem; font-weight: 600; position: relative;
}
.tool span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool .badge { position: absolute; top: 3px; right: 6px; background: var(--fas); color: #fff; font-size: 0.7rem; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

.game-body { overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.col-center { order: 1; padding: 8px 8px 0; }
.col-left { order: 2; }
.col-right { display: none; }
.game-body > .sheet { order: 3; }

/* countdown + connection */
.countdown { position: relative; width: 40px; height: 40px; flex: none; }
.countdown svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown circle { fill: none; stroke-width: 3.5; }
.cd-bg { stroke: #3d3935; }
.cd-fg { stroke: var(--cream); stroke-linecap: round; } /* no transition: it would repaint at 60 fps (battery) */
.cd-num { position: absolute; inset: 0; display: grid; place-items: center; font: 700 0.85rem var(--font); font-variant-numeric: tabular-nums; }
.countdown.low .cd-fg { stroke: var(--gold); }
.countdown.expired { animation: pulse 1s 6; border-radius: 50%; background: rgba(224, 71, 61, 0.35); }
.countdown.expired .cd-bg { stroke: var(--fas); }
.countdown.paused { opacity: 0.5; }
.conn { display: inline-flex; align-items: center; gap: 3px; flex: none; padding: 4px; }
.conn-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(92, 194, 107, 0.2); }
.conn-reconnecting .conn-dot, .conn-connecting .conn-dot { background: var(--gold); box-shadow: 0 0 0 3px rgba(217, 164, 65, 0.25); animation: blink 1s infinite; }
.conn-offline .conn-dot { background: var(--fas); box-shadow: 0 0 0 3px rgba(224, 71, 61, 0.25); }
.conn-q { font-size: 0.75rem; font-weight: 700; background: var(--gold); color: #2a2110; border-radius: 8px; padding: 0 5px; }

/* ------------------------------------------------------------------ tracks */
.tracks { display: flex; flex-direction: column; gap: 6px; }
.track {
  display: flex; align-items: stretch; gap: 4px; width: 100%; padding: 5px 5px 5px 2px; margin: 0;
  border: 0; border-radius: 10px; text-align: left; color: var(--cream);
}
.track-liberal { background: linear-gradient(135deg, #1d5c73, #174a5d); }
.track-fascist { background: linear-gradient(135deg, #8a2a1a, #6b1f14); }
.track-communist { background: linear-gradient(135deg, #7d1414, #5c0f0f); }
.track-title {
  writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; flex: none; width: 16px;
  font: 800 0.66rem var(--display); text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.9; white-space: nowrap;
}
.track-title b { font-family: var(--font); letter-spacing: 0; }
.track-slots {
  flex: 1; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px;
  max-width: min(calc(var(--n) * 72px), calc((100% + 3px) * var(--n) / var(--m) - 3px));
}
.slot { position: relative; aspect-ratio: 420 / 573; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, 0.2); }
.tile { display: block; width: 100%; height: 100%; object-fit: cover; }
.policy-on-slot {
  position: absolute; left: 9%; top: 8%; width: 82%; height: auto; border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); animation: dealIn 0.35s ease-out;
}
.slot.used::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.45) 0 6px, rgba(0, 0, 0, 0.15) 6px 12px); }
.used-stamp {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-24deg); z-index: 1;
  border: 2px solid var(--cream); color: var(--cream); background: rgba(0, 0, 0, 0.6);
  font: 800 0.62rem var(--display); text-transform: uppercase; padding: 1px 4px; border-radius: 3px; letter-spacing: 0.06em;
}
.track-big { padding: 8px; flex-direction: column; }
.track-big .track-slots { max-width: none; gap: 6px; }
.track-big .track-title { writing-mode: horizontal-tb; transform: none; width: auto; text-align: left; font-size: 0.85rem; }
.power-legend { list-style: none; padding-left: 0; font-size: 0.9rem; margin: 12px 0 0; }
.power-legend li { margin-bottom: 4px; }
.veto-note { color: var(--gold); font-weight: 700; }

.status-strip { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; flex-wrap: wrap; }
.tracker { display: flex; align-items: center; gap: 8px; }
.strip-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.tracker-dots { display: flex; gap: 5px; }
.tdot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--lib); }
.tdot.on { background: var(--lib); }
.tdot.last { border-color: var(--fas); }
.tdot.last.on { background: var(--fas); }
.piles { display: flex; gap: 10px; margin-left: auto; }
.pile { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pile img { width: 22px; height: auto; border-radius: 2px; }
.pile b { font-size: 0.95rem; }
.pile-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
@media (max-width: 420px) { .pile-label { display: none; } }
@media (max-width: 360px) { .status-strip { gap: 6px; } .status-strip .strip-label { font-size: 0.66rem; } .piles { gap: 6px; } }

/* ------------------------------------------------------------------ players */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 10px 6px; padding: 14px 8px 12px; }
.pchip {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 2px 5px; min-height: 86px; min-width: 0; margin: 0;
  background: var(--panel); border: 2px solid transparent; border-radius: 12px; color: var(--cream); font: inherit; text-align: center;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}
.pchip.me { border-color: rgba(244, 227, 193, 0.45); }
.pchip-av { position: relative; display: inline-block; }
.pchip-av .dot { position: absolute; right: -2px; bottom: 0; }
.pchip-name { font-size: 0.78rem; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.pchip-sub { font-size: 0.66rem; color: var(--muted); min-height: 0.9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.placards { position: absolute; top: -8px; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; pointer-events: none; }
.placard {
  font: 800 0.6rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 5px; border-radius: 4px;
  background: var(--cream); color: #231f1c; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.placard-c { background: #231f1c; color: var(--cream); border: 1px solid var(--cream); }
.placard-n { background: #231f1c; color: var(--cream); border: 1px dashed var(--cream); }
.placard-tl { background: #55504a; color: #eee; }
.voted { position: absolute; top: 6px; right: 4px; width: 18px; height: 18px; border-radius: 50%; background: var(--lib); color: #0c2b35; display: grid; place-items: center; }
.voted .ico { width: 13px; height: 13px; }
.vote-pill {
  display: inline-block; margin-top: 1px;
  font: 800 0.66rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 5px; border-radius: 4px; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.vote-pill.ja { background: var(--cream); color: #231f1c; }
.vote-pill.nein { background: #111; color: var(--cream); border: 1px solid var(--cream); }
.marked { position: absolute; top: -4px; left: -6px; color: var(--fas); background: var(--bg-deep); border-radius: 50%; display: grid; place-items: center; width: 20px; height: 20px; }
.marked .ico { width: 16px; height: 16px; }
.pchip-skull { position: absolute; inset: 0; display: grid; place-items: center; color: #eee; background: rgba(0, 0, 0, 0.55); border-radius: 50%; }
.pchip-skull .ico { width: 24px; height: 24px; }
.pchip.dead .avatar { filter: grayscale(1) brightness(0.7); }
.pchip.dead .pchip-name { text-decoration: line-through; color: var(--muted); }
.tint-fas { border-color: var(--fas); background: linear-gradient(to bottom, rgba(224, 71, 61, 0.28), var(--panel) 70%); }
.tint-com { border-color: var(--com-l); background: linear-gradient(to bottom, rgba(155, 27, 27, 0.55), var(--panel) 70%); }
.tint-lib { border-color: var(--lib); background: linear-gradient(to bottom, rgba(91, 192, 201, 0.22), var(--panel) 70%); }
.tint-cap { border-color: var(--gold); background: linear-gradient(to bottom, rgba(217, 164, 65, 0.25), var(--panel) 70%); }
.tint-fas .pchip-sub { color: #ffb0a5; }
.tint-com .pchip-sub { color: #ff9e96; }
.tint-lib .pchip-sub { color: #aee9ee; }
.tint-cap .pchip-sub { color: #ffe0a0; }
.players.selecting .pchip.eligible { border-color: var(--cream); cursor: pointer; box-shadow: 0 0 0 3px rgba(244, 227, 193, 0.18); animation: glow 1.6s ease-in-out 4; }
.players.selecting .pchip.ineligible { opacity: 0.4; }
.players.selecting .pchip.ineligible .pchip-sub { color: var(--cream); font-style: italic; }
.players.selecting .pchip.selected { background: var(--cream); color: #231f1c; animation: none; box-shadow: 0 0 0 3px var(--fas); }
.players.selecting .pchip.selected .pchip-sub { color: #5a4c3a; }

/* ------------------------------------------------------------------ action sheet */
.sheet {
  position: sticky; bottom: 0; margin-top: auto; z-index: 4;
  background: #221f1d; border-top: 3px solid #3d3935; border-radius: 16px 16px 0 0;
  padding: 12px 12px calc(12px + var(--safe-bottom));
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.55);
}
.sheet.your-turn { border-top-color: var(--cream); }
.turn-badge {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--cream); color: #231f1c; font: 800 0.72rem var(--display); text-transform: uppercase; letter-spacing: 0.1em;
  padding: 4px 12px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); white-space: nowrap;
}
.sheet-block { display: flex; flex-direction: column; gap: 8px; }
.sheet-prompt { margin: 0; font-size: 0.95rem; }
.sheet-power { margin: 0; font-family: var(--display); text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold); }
.sheet-power small { font-family: var(--font); text-transform: none; letter-spacing: 0; }
.sheet-wait { margin: 0; color: var(--muted); text-align: center; padding: 6px 0; }
.sheet-busy { position: absolute; right: 12px; top: 6px; font-size: 0.75rem; color: var(--gold); }
.sheet.busy .btn:not(:disabled) { opacity: 0.6; }
.ballot:disabled, .hand-card:disabled, .choice:disabled { opacity: 0.5; }
.ballots { display: flex; gap: 14px; justify-content: center; }
.ballot {
  flex: 1 1 0; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent; border: 3px solid transparent; border-radius: 12px; padding: 4px; font-weight: 800;
  font-family: var(--display); text-transform: uppercase; letter-spacing: 0.08em; transition: transform 0.12s, opacity 0.12s;
}
.ballot img { width: 100%; max-width: 104px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.ballot.chosen { border-color: var(--cream); background: rgba(244, 227, 193, 0.08); transform: translateY(-3px); }
.ballot.faded { opacity: 0.45; }
.hand { display: flex; gap: 8px; justify-content: center; }
.hand-card {
  position: relative; flex: 1 1 0; max-width: 108px; padding: 0; border: 3px solid transparent; border-radius: 10px;
  background: transparent; transition: transform 0.12s, opacity 0.12s;
}
.hand-card img { display: block; width: 100%; border-radius: 7px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.hand-card.chosen { transform: translateY(-6px); border-color: var(--cream); }
.hand-card.discard.chosen { border-color: var(--fas); }
.hand-card.discard.chosen img { filter: grayscale(0.4) brightness(0.8); }
.hand-card.faded { opacity: 0.7; }
.hand-tag {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); background: var(--cream); color: #231f1c;
  font: 800 0.7rem var(--display); text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
}
.discard .hand-tag { background: var(--fas); color: #fff; }
.choice-list { display: grid; gap: 6px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-height: 56px;
  padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel);
}
.choice b { font-size: 0.95rem; line-height: 1.2; }
.choice small { color: var(--muted); font-size: 0.72rem; line-height: 1.25; }
.choice.chosen { border-color: var(--cream); background: #45403a; }
.propaganda { display: flex; gap: 12px; align-items: center; }
.propaganda .card-img { width: 72px; border-radius: 6px; flex: none; }
.result-line { margin: 0 0 4px; font-size: 0.95rem; }
.result-line.ok b { color: var(--lib); }
.result-line.bad b { color: var(--fas); }
.result-policy { display: flex; align-items: center; gap: 12px; }
.result-policy img { width: 50px; border-radius: 4px; }
.result-policy p { margin: 0; }
.fab { position: fixed; right: calc(16px + var(--safe-right)); bottom: calc(16px + var(--safe-bottom)); z-index: 20; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6); }

/* ------------------------------------------------------------------ info panels */
.info-panel { background: var(--panel); border-radius: 12px; padding: 10px 12px; margin: 8px; border: 1px solid var(--line); }
.info-panel h3 { font: 800 0.9rem var(--display); text-transform: uppercase; letter-spacing: 0.06em; display: flex; gap: 8px; align-items: baseline; }
.info-panel h3 small { font: 400 0.72rem var(--font); text-transform: none; letter-spacing: 0; }
.private-list, .log-list { list-style: none; padding: 0; margin: 0; }
.private-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.private-item:last-child { border-bottom: 0; }
.pi-head { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--gold); }
.pi-body { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; margin-top: 4px; }
.pi-cards { display: flex; gap: 6px; margin-top: 6px; }
.pi-card { width: 40px; border-radius: 3px; flex: none; }
.log-list { font-size: 0.88rem; }
.log-list li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.log-list li:last-child { border-bottom: 0; }
.log-enacted { color: var(--cream); font-weight: 600; }
.log-execution, .log-executed { color: #ffb0a5; }
.modal-log .info-panel, .modal .private-panel { margin: 0; border: 0; padding: 0; background: none; }
.modal-log .log-panel > h3 { display: none; }
.modal .private-panel h3 { display: none; }

/* ------------------------------------------------------------------ modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 7, 6, 0.72); display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.15s ease-out;
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100dvh - var(--safe-top) - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0;
  padding: 0 16px calc(16px + var(--safe-bottom)); animation: slideUp 0.2s ease-out; outline: none;
}
.modal-wide { max-width: 900px; }
.modal-head { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; background: var(--panel); z-index: 1; }
.modal-head h2 { flex: 1; margin: 0; }
.modal-body { padding-bottom: 4px; }
.card-img { display: block; border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); }
.host-menu { display: flex; flex-direction: column; gap: 10px; }
.transfer { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; }
.transfer legend { font-weight: 700; padding: 0 4px; }
.seat-ask-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.seat-ask { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.seat-ask:first-child { border-top: 0; padding-top: 0; }
.sheet .btn[data-testid="seat-ask"] { margin-top: 8px; }

/* role reveal */
.hold-reveal { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 14px; }
.hold-cards {
  display: flex; gap: 10px; justify-content: center; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  cursor: pointer; padding: 6px; border-radius: 14px; outline: none;
}
.hold-cards .card-img { width: min(40vw, 180px); pointer-events: none; transition: transform 0.15s; }
.hold-cards.shown .card-img { transform: scale(1.02); }
.hold-cards:focus-visible { outline: 3px solid var(--lib); }
.hold-hint { color: var(--muted); text-align: center; margin: 0; font-size: 0.92rem; }
.hold-info { width: 100%; }
.hold-info h3 { font: 800 1.3rem var(--display); text-transform: uppercase; text-align: center; margin: 0 0 4px; }
.hold-info h3 small { font: 400 0.85rem var(--font); text-transform: none; }
.known-list { margin: 6px 0 0; padding-left: 1.2em; font-size: 0.92rem; }
.flash { text-align: center; }
.flash-card { width: 140px; margin: 8px auto; }
.flash-cards { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.flash-cards .card-img { width: 84px; }

/* game over */
.gameover-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8, 7, 6, 0.8); overflow-y: auto; padding: calc(var(--safe-top) + 12px) 10px calc(var(--safe-bottom) + 12px); animation: fadeIn 0.3s; }
.gameover { max-width: 760px; margin: 0 auto; background: var(--panel); border-radius: 18px; overflow: clip; border: 1px solid var(--line); }
.go-head { padding: 18px 16px 12px; text-align: center; background: #3a3633; }
.gameover-liberal .go-head { background: linear-gradient(160deg, #1d5c73, #174252); }
.gameover-fascist .go-head { background: linear-gradient(160deg, #b8392c, #6b1f14); }
.gameover-communist .go-head { background: linear-gradient(160deg, #9b1b1b, #4d0c0c); }
.gameover-capitalist .go-head { background: linear-gradient(160deg, #8a6a24, #4a3810); }
.gameover-anarchist .go-head { background: linear-gradient(160deg, #333, #111); }
.go-kicker { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.15em; opacity: 0.85; }
.go-head h2 { font-size: 1.9rem; margin: 4px 0 6px; }
.go-head p { margin: 0 0 4px; }
.go-you { font-weight: 800; font-size: 1.05rem; }
.go-you.won { color: #fff3c9; }
.go-roles { list-style: none; margin: 0; padding: 14px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px 8px; }
.go-role { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; opacity: 0.72; }
.go-role img { width: 100%; max-width: 92px; border-radius: 6px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.go-role b { font-size: 0.8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go-role small { color: var(--muted); font-size: 0.7rem; }
.go-role.winner { opacity: 1; }
.go-role.winner img { outline: 3px solid var(--gold); outline-offset: 2px; }
.go-role.dead img { filter: grayscale(0.8); }
.go-actions { position: sticky; bottom: calc(-12px - var(--safe-bottom)); z-index: 1; padding: 10px 12px calc(14px + var(--safe-bottom)); background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.45); }
.go-role small.go-conv { color: var(--cream); }

/* replay */
.replay-bar .replay-step { margin: 0 0 4px; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-slider { width: 100%; height: 36px; accent-color: var(--cream); margin: 0 0 6px; }
.replay-cards { display: flex; justify-content: center; align-items: flex-end; gap: 16px; margin: 0 0 6px; }
.rc-group { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rc-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.rc-cards { display: flex; gap: 4px; min-height: 60px; align-items: center; }
.rc-card { width: 44px; border-radius: 3px; display: block; }
.rc-tossed .rc-card { opacity: 0.45; filter: grayscale(0.6); }
.rc-note { font-size: 0.8rem; color: var(--muted); }
.readonly .topbar-main .icon-btn { margin-left: -6px; }

/* toasts */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 104px); width: min(92vw, 420px); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: #111; color: var(--cream); border-left: 4px solid var(--lib); padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6); animation: slideDown 0.2s ease-out; font-size: 0.92rem; }
.toast-error { border-left-color: var(--fas); }
.toast-warn { border-left-color: var(--gold); }
.toast-ok { border-left-color: var(--ok); }

@media (max-width: 999px) {
  /* many players on a phone: compact chips so the whole table (and the Ja/Nein reveal) fits above the sheet */
  .players-many { gap: 9px 4px; padding: 12px 6px 10px; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
  .players-many .pchip { min-height: 72px; padding: 9px 1px 3px; }
  .players-many .pchip .avatar { width: 32px !important; height: 32px !important; font-size: 12px !important; }
  .phase-label { -webkit-line-clamp: 1; font-size: 0.95rem; }
}
@media (max-width: 360px) {
  .seat-ctl .icon-btn { width: 32px; }
  .seat-row { gap: 6px; }
}
@media (max-width: 400px) {
  .topnav-title { display: none; }
  .navlink { padding: 12px 6px; }
  .tool .ico { display: none; }
  .choice { padding: 6px 8px; min-height: 48px; }
}

/* ------------------------------------------------------------------ larger phones / tablets */
@media (min-width: 560px) {
  .players { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 18px; border-bottom: 1px solid var(--line); max-height: 88dvh; }
  .timer-row { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ------------------------------------------------------------------ desktop: players | board | log */
@media (min-width: 1000px) {
  .game {
    grid-template-columns: 300px minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "top top top" "left center right" "left sheet right";
  }
  .topbar { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; }
  .topbar-main { flex: 1 1 0; min-width: 0; padding: 8px 16px; }
  .phase-label { font-size: 1.2rem; }
  .toolbar { flex: none; padding: 0 16px 0 0; }
  .tool { flex: none; padding: 0 14px; }
  .tool-mobile { display: none; }
  .topbar .banner { flex: 1 0 100%; }
  .game-body { display: contents; }
  .col-left { grid-area: left; overflow-y: auto; border-right: 1px solid var(--line); background: rgba(0, 0, 0, 0.15); }
  .col-center { grid-area: center; overflow-y: auto; padding: 16px 20px 8px; container-type: size; }
  .col-right { grid-area: right; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; border-left: 1px solid var(--line); background: rgba(0, 0, 0, 0.15); }
  /* Secret info, Log, Chat (SidePanes.js): an open pane is its title (+ the chat composer) and its list. The lists
     start at 48px (flex-basis = MIN_LIST) and share the rest of the height by the panes' weights (equal by default).
     Wrappers are 0% so the composer and the 48px count in the pane's base. A short window squeezes Secret info and
     Log down to their titles, never the chat composer. A title folds its pane, the line between open panes resizes. */
  .side-pane { display: flex; flex-direction: column; min-height: 41px; }
  .side-pane:not(:first-child) { border-top: 1px solid var(--line); }
  .side-pane.closed { flex: none; min-height: 0; }
  .side-pane:not(.chat-side) { overflow: hidden; } /* squeezed to its title: nothing spills over the next title */
  .side-head { margin: 0; flex: none; }
  .side-toggle { width: 100%; min-height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 0; background: none;
    text-align: left; font: 800 0.9rem var(--display); text-transform: uppercase; letter-spacing: 0.06em; }
  .side-toggle:hover { background: rgba(255, 255, 255, 0.04); }
  .side-toggle:focus-visible { outline-offset: -3px; }
  .side-toggle small, .side-preview { font: 400 0.72rem var(--font); text-transform: none; letter-spacing: 0; }
  .side-toggle .ico { width: 16px; height: 16px; flex: none; transition: transform 0.15s; }
  .side-pane.closed .side-toggle .ico { transform: rotate(-90deg); }
  .side-title { flex: none; }
  .side-preview { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; }
  .side-toggle .badge { flex: none; margin-left: auto; background: var(--fas); color: #fff; font: 700 0.7rem var(--font); letter-spacing: 0;
    min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
  .side-body { flex: 1 1 0%; min-height: 0; display: flex; flex-direction: column; padding: 0 12px 10px; }
  .side-pane .side-body[hidden] { display: none; }
  .side-body > .info-panel { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; flex: 1 1 0%; min-height: 0;
    display: flex; flex-direction: column; }
  .side-body > .info-panel > h3 { display: none; }
  .side-private .side-body { flex: 1 1 66px; min-height: 0; display: block; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 18px;
    mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent); }
  .side-log .log-list { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 48px; min-height: 0; }
  /* the composer and Send always fit: the chat pane never gets smaller than them, only its list scrolls */
  .side-pane.chat-side:not(.closed) { min-height: min-content; }
  .chat-side .chat { flex: 1; min-height: 0; }
  .chat-side .chat-list { max-height: none; flex: 1 1 48px; min-height: 48px; }
  .side-split { flex: none; position: relative; z-index: 1; height: 12px; margin: -6px 0; cursor: row-resize; touch-action: none; }
  .side-split::after { content: ''; position: absolute; left: 50%; top: 50%; width: 36px; height: 4px; margin: -2px 0 0 -18px;
    border-radius: 2px; background: var(--line); transition: background 0.15s; }
  .side-split:hover::after, .side-split:focus-visible::after, .resizing .side-split::after { background: var(--cream); }
  .side-split:focus-visible { outline: 2px solid transparent; outline-offset: -5px; } /* (visible in forced colors) */
  .side-split:focus-visible::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px;
    background: var(--lib); }
  .resizing { cursor: row-resize; user-select: none; }
  @media (pointer: coarse) { /* a finger gets a 24px line (a touch just below it must not fold the next pane) */
    .side-split { height: 24px; margin: -12px 0; }
    .side-split:focus-visible { outline-offset: -11px; }
  }
  .col-right .talk-card, .col-right .talk-row .btn-xs, .col-right .talk-players .btn-xs { min-height: 36px; }
  .col-right .talk-edit { gap: 6px; padding: 6px 8px; }
  .game-body > .sheet { grid-area: sheet; position: relative; margin: 0 16px 12px; border-radius: 16px; border: 1px solid var(--line); border-top-width: 3px; }
  .players { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); padding: 16px 12px; }
  .track-slots { max-width: min(calc(var(--n) * 110px), calc((100% + 5px) * var(--n) / var(--m) - 5px)); gap: 5px; }
  .track { padding: 8px 8px 8px 4px; }
  .track-title { width: 20px; font-size: 0.78rem; }
  /* fit all tracks + status strip in the column height (the action sheet takes its own grid row) */
  .tracks { gap: 10px; margin: 0 auto;
    max-width: max(380px, min(760px, calc(57px + (100cqh - 74px - 26px * var(--k, 3)) / (0.2273 * var(--k, 3))))); }
  .pchip-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; }
  .ballot img { max-width: 120px; }
  .hand-card { max-width: 128px; }
  .toasts { top: 76px; }
}

/* ------------------------------------------------------------------ motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes blink { 50% { opacity: 0.3; } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 3px rgba(244, 227, 193, 0.12); } 50% { box-shadow: 0 0 0 5px rgba(244, 227, 193, 0.32); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } }
@keyframes slideDown { from { transform: translateY(-12px); opacity: 0; } }
@keyframes dealIn { from { transform: translateY(-14px) scale(1.08); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
/* battery saver (lib/power.js): no motion, near-black backgrounds (OLED pixels that are off cost nothing) */
html.saver *, html.saver *::before, html.saver *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
@media screen { /* (print keeps its own light palette) */
  html.saver { --bg: #000; --bg-deep: #000; --panel: #121110; --panel-2: #1c1a18; }
  html.saver body { background: var(--bg); }
}

/* long usernames must never cause horizontal scroll */
.lb td b, .seat-name, .list-row b { overflow-wrap: anywhere; }
@media (max-width: 360px) { .table { font-size: 0.85rem; } .table th { font-size: 0.7rem; } }

/* ------------------------------------------------------------------ ballots: the art is stored rotated 90° cw — show it upright */
.ballot { position: relative; }
.ballot .ballot-art { position: relative; display: block; width: 100%; max-width: 150px; aspect-ratio: 573 / 420; }
.ballot .ballot-art img {
  position: absolute; top: 50%; left: 50%; width: 73.3%; max-width: none; height: auto;
  transform: translate(-50%, -50%) rotate(-90deg); border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.ballot.chosen { border-color: var(--cream); background: rgba(244, 227, 193, 0.12); box-shadow: 0 0 0 3px rgba(244, 227, 193, 0.25); }
.ballot-ja.chosen { border-color: var(--lib); box-shadow: 0 0 0 3px rgba(91, 192, 201, 0.3); }
.ballot-nein.chosen { border-color: var(--fas); box-shadow: 0 0 0 3px rgba(224, 71, 61, 0.3); }
.ballot-tag {
  position: absolute; top: -10px; right: -6px; display: inline-flex; align-items: center; gap: 3px;
  background: var(--cream); color: #231f1c; font: 800 0.68rem var(--font); letter-spacing: 0.02em; text-transform: none;
  padding: 3px 8px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.ballot-tag .ico { width: 12px; height: 12px; }
@media (min-width: 1000px) { .ballot .ballot-art { max-width: 170px; } }

/* ------------------------------------------------------------------ demo mode */
.demo-badge {
  display: inline-block; vertical-align: middle; background: repeating-linear-gradient(-45deg, #d9a441 0 8px, #b9852c 8px 16px);
  color: #1c1a18; font: 800 0.8rem var(--display); letter-spacing: 0.12em; text-transform: uppercase; padding: 3px 9px; border-radius: 6px;
}
.demo-badge.small { font-size: 0.66rem; padding: 2px 6px; letter-spacing: 0.1em; }
.demo-bar { background: #26211a; border-top: 1px solid rgba(217, 164, 65, 0.35); padding: 4px 0 6px; flex: 1 0 100%; min-width: 0; }
.demo-strip {
  display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 4px 10px;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.demo-chip {
  flex: none; scroll-snap-align: center; display: flex; align-items: center; gap: 6px; min-height: 44px; max-width: 132px;
  padding: 3px 10px 3px 4px; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); position: relative;
}
.demo-chip-av {
  width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #3d3935;
  font: 800 0.72rem var(--font); letter-spacing: 0.02em;
}
.demo-chip-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; text-align: left; }
.demo-chip-name { font-weight: 700; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-chip small { font-size: 0.68rem; color: var(--muted); white-space: nowrap; }
.demo-chip.on { background: var(--cream); color: #231f1c; border-color: var(--cream); }
.demo-chip.on small { color: #5a4c3a; }
.demo-chip.on .demo-chip-av { background: #231f1c; color: var(--cream); }
.demo-chip.acting::after {
  content: ""; position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); border: 2px solid #26211a; animation: pulse 1.4s infinite;
}
.demo-chip.tint-fas:not(.on) .demo-chip-av { background: var(--fas-d); }
.demo-chip.tint-com:not(.on) .demo-chip-av { background: var(--com); }
.demo-chip.tint-lib:not(.on) .demo-chip-av { background: var(--lib-d); }
.demo-chip.tint-cap:not(.on) .demo-chip-av { background: #6b5320; }
.demo-chip.on.tint-fas { box-shadow: inset 0 -4px 0 var(--fas); }
.demo-chip.on.tint-com { box-shadow: inset 0 -4px 0 var(--com-l); }
.demo-chip.on.tint-lib { box-shadow: inset 0 -4px 0 var(--lib-d); }
.demo-chip.on.tint-cap { box-shadow: inset 0 -4px 0 var(--gold); }
.demo-ctl { display: flex; align-items: center; gap: 6px; padding: 2px 10px 0; flex-wrap: wrap; }
.demo-ctl .btn-sm { min-height: 40px; padding: 0 10px; gap: 4px; display: inline-flex; align-items: center; }
.demo-jump { flex: 1 1 auto; min-width: 0; justify-content: center; }
.demo-jump span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-switch {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 10px; border-radius: 10px; font-size: 0.85rem; font-weight: 650;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; user-select: none;
}
.demo-switch input { position: absolute; opacity: 0; pointer-events: none; }
.demo-switch:has(input:checked) { background: var(--gold); color: #1c1a18; border-color: var(--gold); }
.demo-switch:has(input:focus-visible) { outline: 3px solid var(--lib); outline-offset: 2px; }
.demo-speed { flex: 1 1 90px; min-width: 80px; max-width: 180px; accent-color: var(--gold); min-height: 32px; }
.demo-entry { margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; border-style: dashed; }
.demo-entry small { color: var(--muted); font-weight: 500; }
.demo-n { color: var(--cream); font-size: 1.1rem; }
.demo-setup input[type="range"] { width: 100%; accent-color: var(--gold); min-height: 32px; }
.demo-n-seg { margin-bottom: 14px; }
@media (min-width: 1000px) {
  .demo-bar { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
  .demo-strip { flex: 1 1 auto; min-width: 0; }
  .demo-ctl { flex: none; padding: 0 16px 0 0; flex-wrap: nowrap; }
  .demo-jump { flex: none; max-width: 220px; }
}
@media (max-width: 400px) { .demo-switch .ico { display: none; } }

/* lobby one-tap fixes, seat-transfer user picker */
.problem-error { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-fix { background: var(--cream); color: #231f1c; border-color: var(--cream); font-weight: 750; white-space: nowrap; }
.field-label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }
.user-picker { margin-bottom: 12px; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pick-row {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; background: transparent;
  border: 0; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.95rem; overflow-wrap: anywhere;
}
.pick-list li:last-child .pick-row { border-bottom: 0; }
.pick-row.on { background: rgba(244, 227, 193, 0.14); font-weight: 700; }
.round-jump { font-size: 1.5rem; font-weight: 800; line-height: 1; }

/* ------------------------------------------------------------------ option hints (lobby editor + calculator) */
.opt-row { border-bottom: 1px solid var(--line); }
.opt-row:last-child { border-bottom: 0; }
.opt-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.opt-main > .field { margin-bottom: 0; min-height: 52px; }
.info-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; position: relative;
  font: italic 800 0.95rem Georgia, "Times New Roman", serif; color: var(--muted);
}
.info-btn::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; border: 2px solid currentColor; }
.info-btn.on { color: var(--cream); }
.info-btn.on::before { background: rgba(244, 227, 193, 0.14); }
.opt-badges { padding: 0 0 8px 58px; margin-top: -6px; }
.hint-body { margin: 0 0 10px; padding: 8px 10px; border-left: 3px solid var(--gold); background: rgba(0, 0, 0, 0.22); border-radius: 0 8px 8px 0; font-size: 0.88rem; }
.hint-body p { margin: 0 0 6px; }
.hint-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.favours { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip.fav { font-size: 0.7rem; padding: 1px 7px; }
.chip.fav-down { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
/* hurts badges: outlined in the team's colour (helps badges are filled), text lightened for contrast on dark */
.chip.fav-down.chip-lib { color: var(--lib); border-color: var(--lib); }
.chip.fav-down.chip-fas { color: #f2786e; border-color: var(--fas); }
.chip.fav-down.chip-com { color: #f0645b; border-color: var(--com-l); }
.chip.fav-down.chip-cap { color: #e7c46f; border-color: #a8842f; }
.chip.fav-down.chip-ana { color: #ddd; border-color: #888; }
.src-tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.src-pdf { color: var(--gold); border-color: rgba(217, 164, 65, 0.5); }
.tips { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.tip { display: flex; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 10px; background: #2f2a1f; border: 1px solid rgba(217, 164, 65, 0.35); font-size: 0.9rem; }
.tip-ico { flex: none; font: 800 0.66rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: #1c1a18; background: var(--gold); padding: 2px 6px; border-radius: 4px; }

/* ------------------------------------------------------------------ calculator */
.page-wide { max-width: 1240px; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.calc-count { text-align: center; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; }
.stepper-n { font: 800 3rem/1 var(--display); min-width: 2.2ch; text-align: center; font-variant-numeric: tabular-nums; }
.stepper-range { width: 100%; accent-color: var(--cream); min-height: 32px; margin-top: 6px; }
.calc-opts > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; min-height: 44px; }
.calc-opts > summary::-webkit-details-marker { display: none; }
.calc-opts > summary h2 { margin: 0; flex: 1; }
.calc-opts > summary::after {
  content: ""; width: 10px; height: 10px; margin: 0 6px 4px; border: solid var(--muted); border-width: 0 3px 3px 0;
  transform: rotate(45deg); transition: transform 0.15s;
}
.calc-opts[open] > summary::after { transform: rotate(-135deg); margin-bottom: -4px; }
.calc-opts[open] > summary { margin-bottom: 8px; }
.calc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.calc-head h2 { margin: 0; font-size: 1.5rem; }
.calc-code { color: var(--cream); font-size: 1rem; letter-spacing: 0.06em; }
.calc-actions { flex: 1 1 auto; justify-content: flex-end; }
.calc-actions .btn { flex: 0 1 auto; }
.calc-result h3, .calc-fact h3 { font: 800 0.9rem var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--gold); margin: 18px 0 8px; }
.calc-result h3 small { font: 400 0.78rem var(--font); text-transform: none; letter-spacing: 0; margin-left: 4px; }
.deal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px 8px; }
.deal-card { margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.deal-art { position: relative; display: block; width: 100%; max-width: 104px; }
.deal-art img { display: block; width: 100%; border-radius: 7px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.deal-count {
  position: absolute; right: -4px; bottom: -6px; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 16px; display: grid; place-items: center;
  background: var(--cream); color: #231f1c; font: 800 1rem var(--display); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.deal-card figcaption { margin-top: 8px; display: flex; flex-direction: column; font-size: 0.8rem; line-height: 1.2; }
.deal-card figcaption b { overflow-wrap: break-word; }
.deal-card figcaption small { color: var(--muted); font-size: 0.7rem; }
.deal-grid-policy { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.deal-grid-policy .deal-art { max-width: 80px; }
.calc-tracks { display: flex; flex-direction: column; gap: 10px; }
.calc-track { background: rgba(0, 0, 0, 0.22); border-radius: 10px; padding: 8px; }
.calc-track-title { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; }
.calc-track-title small { color: var(--muted); font-weight: 400; }
.calc-tiles { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 4px; max-width: calc(var(--n) * 84px); }
.calc-tile { width: 100%; display: block; border-radius: 4px; }
.calc-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }
.calc-ballots { display: flex; gap: 16px; }
.calc-ballot { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.85rem; }
.calc-ballot .ballot-art { position: relative; display: block; width: 92px; aspect-ratio: 573 / 420; }
.calc-ballot .ballot-art img { position: absolute; top: 50%; left: 50%; width: 73.3%; transform: translate(-50%, -50%) rotate(-90deg); border-radius: 5px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5); }
.calc-list { margin: 0; padding-left: 20px; }
.calc-list li { margin-bottom: 4px; }
@media (min-width: 640px) { .calc-facts { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); } }
@media (min-width: 1000px) {
  .calc-grid { grid-template-columns: 380px minmax(0, 1fr); align-items: start; }
  .calc-side { position: sticky; top: 8px; max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-width: thin; }
  .deal-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .deal-grid-policy { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* ------------------------------------------------------------------ rules */
.rules-title { font-size: 1.3rem; }
.tldr { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tldr-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); min-width: 0; }
.tldr-icon { flex: none; width: 52px; height: 64px; object-fit: contain; border-radius: 5px; }
.tldr-icon[src*="/ballot/"] { transform: rotate(-90deg); } /* ballot art is stored rotated */
.tldr-txt { display: flex; flex-direction: column; min-width: 0; font-size: 0.86rem; line-height: 1.3; }
.tldr-txt > b { font: 800 0.9rem var(--display); text-transform: uppercase; letter-spacing: 0.05em; color: var(--gold); }
.tldr-txt span { overflow-wrap: anywhere; }
.rules-tools { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
.rules-sec { border-top: 1px solid var(--line); }
.rules-sec > summary {
  display: flex; align-items: center; gap: 8px; min-height: 48px; cursor: pointer; list-style: none;
  font: 800 1rem var(--display); text-transform: uppercase; letter-spacing: 0.04em;
}
.rules-sec > summary::-webkit-details-marker { display: none; }
.rules-sec > summary::after { content: "+"; font: 700 1.3rem var(--font); color: var(--muted); width: 24px; text-align: center; }
.rules-sec[open] > summary::after { content: "−"; }
.rules-sec-body { padding: 0 2px 12px; font-size: 0.95rem; }
.rules-sec-body p { margin: 0 0 8px; }
.rules-list { margin: 0 0 8px; padding-left: 20px; }
.rules-list li { margin-bottom: 4px; }
.narrator { margin: 10px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.narrator-scripts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.narrator-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.narrator-line { margin: 8px 0 10px; min-height: 3em; font-size: 1.02rem; line-height: 1.4; color: var(--muted); }
.narrator-line.on { color: var(--cream); }
.narrator-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.narrator-bed { margin-top: 10px; }
.narrator-pause { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.rules-example { margin: 6px 0 10px; padding: 8px 10px; border-left: 3px solid var(--lib); background: rgba(91, 192, 201, 0.08); border-radius: 0 8px 8px 0; font-size: 0.9rem; }
.rules-example p { margin: 0; }
.rules-example-title { display: block; font: 800 0.72rem var(--display); text-transform: uppercase; letter-spacing: 0.1em; color: var(--lib); margin-bottom: 2px; }
.rules-powers { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.rules-power { display: flex; gap: 10px; align-items: flex-start; }
.rules-power p { margin: 2px 0 4px; }
.rules-tile { flex: none; width: 64px; border-radius: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.table-scroll { overflow-x: auto; margin: 0 0 10px; }
.rules-table td, .rules-table th { min-width: 90px; }
@media (max-width: 559px) { /* rules tables as stacked rows on phones: no sideways scrolling */
  .rules-table thead { display: none; }
  .rules-table tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .rules-table td { display: block; border: 0; padding: 1px 2px; min-width: 0; }
  .rules-table td:first-child { font-weight: 700; }
  .rules-table td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.8rem; }
}
.rules-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-toggle {
  min-height: 40px; padding: 0 12px; border-radius: 999px; border: 2px solid var(--line); background: var(--bg-deep);
  font-size: 0.85rem; font-weight: 650; color: var(--muted);
}
.chip-toggle.on { background: var(--cream); color: #231f1c; border-color: var(--cream); }
.chip-toggle.on.team-liberal { background: var(--lib-d); color: #eafcff; border-color: var(--lib); }
.chip-toggle.on.team-fascist { background: var(--fas); color: #fff; border-color: var(--fas); }
.chip-toggle.on.team-communist { background: var(--com); color: #fff; border-color: var(--com-l); }
.chip-toggle.on.team-capitalist { background: #6b5320; color: #ffe9b8; border-color: var(--gold); }
.chip-toggle.on.team-anarchist { background: #111; color: #eee; border-color: #888; }

/* ------------------------------------------------------------------ sound popover */
.sound { position: relative; display: inline-flex; }
.sound-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; width: 220px; padding: 6px 12px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}
.sound-pop .toggle { min-height: 44px; }
.sound-vol { display: flex; flex-direction: column; gap: 2px; }
.sound-vol input { width: 100%; accent-color: var(--cream); min-height: 32px; }
.saver-row { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.saver-row .seg { flex-wrap: nowrap; }
.saver-row .seg button { flex: 1; min-width: 0; }
.topbar-sound .icon-btn { width: 40px; height: 40px; }

/* ------------------------------------------------------------------ small additions */
.sheet-paused { margin: 0 0 8px; padding: 4px 8px; border-radius: 6px; background: #3f3320; color: #ffe9b8; font-size: 0.8rem; text-align: center; }
.irl-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.irl-tools .btn { flex: 1 1 120px; }
.pnp-credit { margin: 8px 0 0; }
.credits { margin: 20px 4px 8px; line-height: 1.45; }
.credits p { margin: 0 0 6px; }
.auth-tools { margin-top: 4px; }
.lb-controls { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 4px; }
.lb-controls .field { flex: 1 1 150px; margin-bottom: 8px; }
.lb-controls .field-inline input { width: 84px; flex: none; }
.lb-controls .field-inline select { max-width: 60%; }
.admin-tabs { margin-top: 8px; }
.toggle-sm { min-height: 42px; gap: 8px; font-size: 0.88rem; }
.toggle-sm .toggle-track { width: 40px; height: 24px; }
.toggle-sm .toggle-track::after { width: 18px; height: 18px; }
.private-toggle { margin-top: 10px; }
.room-code-panel .private-toggle { justify-content: center; }
.toggle-sm input:checked + .toggle-track::after { transform: translateX(16px); }
.audit-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 8px; }
@media (min-width: 560px) { .audit-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.audit-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.audit-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.audit-top b { overflow-wrap: anywhere; }
.audit-detail { margin-top: 2px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ IRL games */
.irl-row { color: var(--cream); text-decoration: none; min-width: 0; }
.irl-row .team-chips { display: inline-flex; vertical-align: middle; }
.chev { color: var(--muted); display: inline-flex; transform: rotate(180deg); }
.irl-calc-link { margin: 10px 0 0; }
.irl-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.irl-head h2 { margin-bottom: 2px; }
.irl-result { margin: 12px 0 6px; }
.irl-board { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); margin: 0; }
.irl-board b { color: var(--cream); }
.irl-players { list-style: none; margin: 0; padding: 0; }
.irl-player { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.irl-player:last-child { border-bottom: 0; }
.irl-player b { overflow-wrap: anywhere; }
.irl-role { width: 40px; flex: none; border-radius: 4px; }
.irl-player.lost .irl-role { filter: grayscale(0.6) brightness(0.8); }
.irl-player.dead b { text-decoration: line-through; }
.irl-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.irl-denied { text-align: center; }
.irl-row2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 10px; }
@media (min-width: 560px) { .irl-row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.irl-form textarea { min-height: 80px; padding: 10px 12px; border-radius: 10px; background: var(--bg-deep); border: 2px solid var(--line); color: var(--cream); font: inherit; width: 100%; resize: vertical; }
.irl-form .field small { color: var(--muted); font-size: 0.75rem; }
.irl-form .row input { min-height: 48px; padding: 0 12px; border-radius: 10px; background: var(--bg-deep); border: 2px solid var(--line); color: var(--cream); font-size: 1rem; min-width: 0; }
.irl-prows { list-style: none; margin: 0 0 10px; padding: 0; counter-reset: prow; }
.irl-prow { padding: 8px 0 8px 26px; border-bottom: 1px solid var(--line); position: relative; counter-increment: prow; }
.irl-prow::before { content: counter(prow); position: absolute; left: 0; top: 20px; color: var(--muted); font-size: 0.85rem; width: 20px; text-align: right; }
.pname { position: relative; display: flex; align-items: center; gap: 6px; }
.pname-input { flex: 1; min-width: 0; min-height: 44px; padding: 0 10px; border-radius: 10px; background: var(--bg-deep); border: 2px solid var(--line); color: var(--cream); font-size: 1rem; }
.pname-input:focus { border-color: var(--lib); outline: none; }
.pname-kind { flex: none; min-width: 44px; justify-content: center; }
.pname-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--panel); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6); }
.irl-pctl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.irl-role-select { min-height: 44px; padding: 0 8px; border-radius: 10px; background: var(--bg-deep); border: 2px solid var(--line); color: var(--cream); font-size: 0.95rem; flex: 1 1 130px; max-width: 200px; }
.mini-check { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; font-size: 0.85rem; cursor: pointer; }
.mini-check input { width: 18px; height: 18px; accent-color: var(--cream); }
.mini-check:has(input:disabled) { opacity: 0.45; }
.won-check.overridden { color: var(--gold); font-weight: 700; }
.irl-pctl .icon-btn { margin-left: auto; color: var(--muted); }
.irl-nums { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0 10px; }
.irl-teams { margin-bottom: 14px; }
.irl-footer { margin-top: 8px; }

/* ------------------------------------------------------------------ print (calculator / rules handout) */
@media print {
  @page { margin: 12mm; }
  :root { --text: #111; --cream: #111; --muted: #555; --line: #ccc; --panel: #fff; --panel-2: #f3f3f3; --gold: #7a4b00; --lib: #0b5566; }
  html, body { background: #fff !important; color: #111; }
  .topnav, .no-print, .toasts, .rules-tools, .info-btn { display: none !important; }
  .page { max-width: none; padding: 0; }
  .panel { border: 0; padding: 0; margin: 0 0 10px; background: #fff; }
  .calc-grid { display: block; }
  .calc-count, .calc-opts, .tips { display: none; }
  .deal-grid, .deal-grid-policy { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
  .deal-art, .deal-grid-policy .deal-art { max-width: 64px; }
  .deal-art img, .calc-ballot img, .rules-tile, .calc-tile { box-shadow: none !important; }
  .deal-count { background: #111; color: #fff; box-shadow: none; }
  .calc-track, .tldr-card, .rules-example, .tip, .hint-body { background: #fff !important; border: 1px solid #ccc; break-inside: avoid; }
  .calc-tiles { max-width: calc(var(--n) * 56px); }
  .deal-card, .rules-power, .calc-fact, .tldr-card { break-inside: avoid; }
  .rules-sec > summary::after { display: none; }
  .rules-sec { break-inside: auto; }
  .tldr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .problem-error, .problem-warn { background: #fff; color: #111; }
  a { color: #111; text-decoration: none; }
}

/* replay: the Log button sits in the top bar (no extra toolbar row) so 16+ players fit above the playback bar */
.tool-inline { flex: none; padding: 0 12px; }
@media (max-width: 999px) {
  .replay-bar { padding-top: 8px; }
  .replay-bar .replay-step { font-size: 0.85rem; }
  .replay-bar .replay-slider { height: 28px; margin-bottom: 2px; }
  .replay-cards { margin-bottom: 4px; }
  .rc-cards { min-height: 38px; }
  .rc-card { width: 28px; }
  .replay-bar .icon-btn.big { width: 48px; height: 48px; }
}

/* ---------------------------------------------------------------- chat (in memory on the server, never saved) */
.chat { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; flex: 1;
  max-height: 55vh; display: flex; flex-direction: column; gap: 2px; }
.chat-compact .chat-list { max-height: 240px; }
/* phone chat drawer: the table-talk options, the claim editor and the composer always fit, only the list gives way
   (down to 48px); the drawer itself scrolls only when even that doesn't fit */
.modal-chat { display: flex; flex-direction: column; }
.modal-chat .modal-head { flex: none; }
.modal-chat .modal-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.modal-chat .chat { flex: 1 1 auto; min-height: 0; }
.modal-chat .chat > * { flex: none; }
.modal-chat .chat > .chat-list { flex: 1 1 auto; max-height: none; min-height: 48px; }
.chat-empty { padding: 8px 0; }
.chat-msg { padding: 4px 6px; border-radius: 8px; }
.chat-msg.mine { background: rgba(244, 227, 193, 0.06); }
.chat-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.chat-name { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.chat-text { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 0.95rem; }
.chat-time { flex: none; font-size: 0.72rem; }
.chat-more { width: 28px; height: 28px; min-height: 28px; flex: none; opacity: 0.6; align-self: center; }
.chat-more .ico { width: 16px; height: 16px; }
.chat-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0 2px; }
.chat-report { display: flex; align-items: center; gap: 6px; }
.chat-report select { min-height: 36px; border-radius: 8px; background: var(--bg-deep); color: var(--cream); border: 2px solid var(--line); padding: 0 8px; }
.chat-form { display: flex; gap: 8px; }
.chat-input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; background: var(--bg-deep);
  border: 2px solid var(--line); color: var(--cream); font-size: 1rem; }
.chat-note { margin: 0; padding: 6px 2px; }

/* ---------------------------------------------------------------- accounts, privacy, reports */
.oauth-buttons { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.oauth-btn { text-decoration: none; justify-content: center; font-weight: 700; }
.oauth-discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.oauth-google { background: #f4f4f4; border-color: #f4f4f4; color: #1f1f1f; }
.oauth-or { text-align: center; margin: 8px 0 12px; }
.danger-zone { border-color: rgba(224, 71, 61, 0.45); }
.prose h3 { margin: 18px 0 4px; font-size: 1rem; }
.prose p { margin: 0 0 8px; line-height: 1.5; }
.report-row { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.report-msgs { margin: 0; padding: 6px 10px 6px 28px; background: var(--bg-deep); border-radius: 8px; font-size: 0.9rem; }
.report-msgs li { padding: 2px 0; overflow-wrap: anywhere; }
.report-msgs li.reported { color: #fff; background: rgba(224, 71, 61, 0.25); border-radius: 4px; }
.show-deleted { display: flex; align-items: center; gap: 6px; margin: 8px 0 4px; }

/* ---------------------------------------------------------------- bots and table talk */
.add-bot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.add-bot-note { flex-basis: 100%; margin: 0; }
.btn-ready.on { background: #24452a; border-color: var(--ok); color: #e6f7e8; }
.ready-count { flex: none; }
.pchip-bot { position: absolute; left: -6px; bottom: -4px; font: 700 0.6rem var(--font); letter-spacing: 0.04em;
  text-transform: uppercase; background: #4a4540; color: var(--cream); padding: 1px 4px; border-radius: 6px; }
.bot-chip { flex: none; font-size: 0.62rem; padding: 0 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.pol { font-size: 0.7rem; padding: 1px 6px; }
.pols { display: inline; }
.pols .pol, .claim .pol { margin: 0 3px 3px 0; }
.claim { line-height: 1.8; }
.chat-claim-body { padding: 0 0 2px 2px; }
.talk { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.talk-row, .talk-players, .talk-cards { display: flex; flex-wrap: wrap; gap: 6px; }
.talk-row .btn-xs, .talk-players .btn-xs { min-height: 44px; }
.talk-edit { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 10px; background: var(--bg-deep); }
.talk-edit p { margin: 0; }
.talk-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.talk-card { min-height: 44px; min-width: 64px; padding: 0 10px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, 0.15);
  font-weight: 700; color: #fff; background: #4a4540; }
.talk-problem { color: #ffb4a8; }
.demo-level { min-height: 36px; border-radius: 8px; background: var(--bg-deep); color: var(--cream); border: 2px solid var(--line); padding: 0 6px; }
.pchip-nh { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.03em; color: #9fe0a8; line-height: 1.2; }
.opt-note { margin: 0; align-self: center; }

/* ---------------------------------------------------------------- lobby: seat order and first President */
.seat-opts { display: flex; flex-direction: column; row-gap: 8px; margin-top: 8px; padding-top: 4px; border-top: 1px solid var(--line); }
.seat-opts .toggle-sm { min-height: 46px; }
.seat-opts-pick { margin: 4px 0 2px; }
@media (min-width: 720px) {
  .seat-opts { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; align-items: start; }
  .seat-opts-pick { grid-column: 2; }
}
