/* ── Nightglass: a village at night ─────────────────────────────────────── */

:root {
  --ink-0: #07080f;
  --ink-1: #0b0d17;
  --ink-2: #141827;
  --ink-3: #1d2236;
  --ink-4: #2a304a;
  --line: rgba(220, 226, 255, 0.09);
  --line-strong: rgba(220, 226, 255, 0.18);
  --text: #e8e6df;
  --text-dim: #a19fae;
  --text-faint: #6c6b7d;
  --moon: #f3ecd6;

  --village: #e8a94f;
  --village-soft: rgba(232, 169, 79, 0.14);
  --wolves: #d9475a;
  --wolves-soft: rgba(217, 71, 90, 0.14);
  --solo: #a678e8;
  --solo-soft: rgba(166, 120, 232, 0.14);
  --good: #6fcf97;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink-1);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 80% -10%, rgba(243, 236, 214, 0.10), transparent 60%),
    radial-gradient(90% 50% at 10% 110%, rgba(80, 90, 160, 0.12), transparent 60%),
    linear-gradient(180deg, var(--ink-1), var(--ink-0));
  background-attachment: fixed;
}

/* film grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body.is-day {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(232, 169, 79, 0.16), transparent 60%),
    linear-gradient(180deg, #16131c, var(--ink-0));
}

h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; margin: 0; }
h1 { font-size: 2.2rem; line-height: 1.1; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
button { font: inherit; color: inherit; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(env(safe-area-inset-top), 12px) 18px max(env(safe-area-inset-bottom), 18px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 14px;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.topbar .code { font-family: var(--serif); letter-spacing: 0.25em; color: var(--text); font-size: 1rem; }
.topbar .spacer { flex: 1; }

.screen { flex: 1; display: flex; flex-direction: column; gap: 18px; animation: rise .45s var(--ease); }
.screen-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.center { text-align: center; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 0.85rem; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); }

.panel {
  background: linear-gradient(180deg, rgba(29, 34, 54, 0.7), rgba(20, 24, 39, 0.7));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(6px);
}

/* ── Buttons & inputs ───────────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--ink-3);
  border-radius: 999px;
  min-height: 52px;
  padding: 0 22px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform .12s var(--ease), background .2s, border-color .2s, opacity .2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn-primary { background: var(--moon); color: var(--ink-1); border-color: transparent; }
.btn-danger { background: var(--wolves-soft); border-color: rgba(217, 71, 90, 0.5); color: #ffb3bd; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 0.85rem; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--ink-2);
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.8rem; color: var(--text-dim); }
.input {
  appearance: none;
  width: 100%;
  min-height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--ink-2);
  color: var(--text);
  padding: 0 16px;
  font-size: 1.1rem;
}
.input:focus { outline: 2px solid rgba(243, 236, 214, 0.4); outline-offset: 1px; }
.input-code { text-transform: uppercase; letter-spacing: 0.4em; font-family: var(--serif); text-align: center; font-size: 1.5rem; }
select.input { font-size: 1rem; }

/* ── Boot / home ────────────────────────────────────────────────────────── */

.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-dim); }
.boot-moon, .moon {
  width: 72px; height: 72px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffaf0, var(--moon) 55%, #c9bf9f);
  box-shadow: 0 0 60px rgba(243, 236, 214, 0.35), 0 0 160px rgba(243, 236, 214, 0.12);
}
.boot-moon { animation: pulse 2.4s ease-in-out infinite; }
.boot-title { font-family: var(--serif); font-size: 1.8rem; color: var(--text); }
@keyframes pulse { 50% { opacity: 0.6; transform: scale(0.96); } }

.hero { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 8vh 0 4vh; }
.hero h1 { font-size: 2.8rem; }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs button { appearance: none; border: 0; background: transparent; border-radius: 999px; min-height: 42px; font-weight: 600; white-space: nowrap; padding: 0 10px; font-size: clamp(0.82rem, 3.6vw, 1rem); color: var(--text-dim); cursor: pointer; }
.tabs button.active { background: var(--ink-4); color: var(--text); }

/* ── Status bits ────────────────────────────────────────────────────────── */

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; flex: none; }
.dot.off { background: var(--text-faint); }
.dot.warn { background: var(--village); animation: pulse 1.2s infinite; }

.toast {
  position: fixed; left: 50%; bottom: max(env(safe-area-inset-bottom), 18px); transform: translateX(-50%);
  background: #2a1a22; border: 1px solid rgba(217, 71, 90, 0.5); color: #ffd0d6;
  padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: calc(100% - 36px);
  animation: rise .3s var(--ease); font-size: 0.95rem;
}

.banner { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; border: 1px solid var(--line); background: var(--ink-2); }
.banner.error { border-color: rgba(217, 71, 90, 0.5); background: var(--wolves-soft); color: #ffc4cc; }
.banner.warn { border-color: rgba(232, 169, 79, 0.4); background: var(--village-soft); color: #ffe0b3; }

/* ── Teams ──────────────────────────────────────────────────────────────── */

.team-village { --team: var(--village); --team-soft: var(--village-soft); }
.team-wolves { --team: var(--wolves); --team-soft: var(--wolves-soft); }
.team-solo { --team: var(--solo); --team-soft: var(--solo-soft); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px 0 8px;
  border-radius: 999px; border: 1px solid color-mix(in srgb, var(--team) 45%, transparent);
  background: var(--team-soft); color: var(--text);
  font-size: 0.85rem; font-weight: 600; cursor: pointer; appearance: none;
}
.chip svg { color: var(--team); width: 18px; height: 18px; }
.chip .count { color: var(--text-dim); font-weight: 500; }

.role-icon { width: 28px; height: 28px; color: var(--team, var(--text)); flex: none; }

/* ── Players ────────────────────────────────────────────────────────────── */

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.player {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 6px 8px 6px 14px;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.player .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player.away .name { color: var(--text-faint); }
.tag { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.tag.host { color: var(--moon); border-color: rgba(243, 236, 214, 0.3); }

/* ── Big room code ──────────────────────────────────────────────────────── */

.room-code { display: grid; justify-items: center; gap: 4px; padding: 8px 0; }
.room-code .letters { font-family: var(--serif); font-size: 3rem; letter-spacing: 0.3em; padding-left: 0.3em; line-height: 1; }

/* ── Role card + slide to reveal ────────────────────────────────────────── */

.reveal { display: grid; gap: 12px; }
.card-stage { perspective: 1200px; display: grid; place-items: center; }
.role-card {
  width: min(64vw, 260px); aspect-ratio: 5 / 7;
  position: relative; transform-style: preserve-3d;
  transition: transform .45s var(--ease);
}
.role-card.up { transform: rotateY(180deg); }
.role-card .face {
  position: absolute; inset: 0; border-radius: 18px; backface-visibility: hidden;
  display: grid; place-items: center; padding: 18px; text-align: center;
  border: 1px solid var(--line-strong);
}
.role-card .back {
  background:
    radial-gradient(circle at 50% 38%, rgba(243, 236, 214, 0.18), transparent 32%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.025) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, var(--ink-3), var(--ink-1));
}
.role-card .back .moon { width: 56px; height: 56px; opacity: 0.85; }
.role-card .front {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 30%, var(--team-soft), transparent 60%),
    linear-gradient(160deg, var(--ink-3), var(--ink-1));
  border-color: color-mix(in srgb, var(--team) 55%, transparent);
  box-shadow: 0 0 40px var(--team-soft);
  align-content: center; gap: 10px;
}
.role-card .front .role-icon { width: 64px; height: 64px; }
.role-card .front .role-name { font-family: var(--serif); font-size: 1.7rem; }
.role-card .front .role-team { font-size: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--team); }
.role-card .front .role-summary { font-size: 0.9rem; color: var(--text-dim); }

/* Narrow and centred: a thumb at the screen's left edge starts the browser's swipe-back gesture instead. */
.slider {
  position: relative; height: 58px; border-radius: 999px;
  width: min(72%, 260px); margin-inline: auto;
  background: var(--ink-2); border: 1px solid var(--line-strong);
  touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden;
}
.slider .hint { position: absolute; inset: 0 12px 0 58px; display: grid; place-items: center; text-align: center; color: var(--text-faint); font-size: 0.85rem; letter-spacing: 0.04em; pointer-events: none; }
.slider .fill { position: absolute; inset: 0 auto 0 0; background: rgba(243, 236, 214, 0.08); pointer-events: none; }
.slider .thumb {
  position: absolute; top: 4px; left: 4px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--moon); color: var(--ink-1); display: grid; place-items: center; font-size: 1.2rem;
  box-shadow: 0 0 20px rgba(243, 236, 214, 0.35); cursor: grab;
}
.slider.dragging .thumb { cursor: grabbing; }
.slider:not(.dragging) .thumb, .slider:not(.dragging) .fill { transition: transform .3s var(--ease), width .3s var(--ease); }

/* ── Night ──────────────────────────────────────────────────────────────── */

.night-head { display: grid; gap: 6px; text-align: center; padding-top: 4px; }
.steps { display: flex; justify-content: center; gap: 5px; }
.steps span { width: 18px; height: 3px; border-radius: 2px; background: var(--ink-4); }
.steps span.done { background: rgba(243, 236, 214, 0.45); }
.steps span.now { background: var(--moon); box-shadow: 0 0 10px rgba(243, 236, 214, 0.6); }

.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice {
  appearance: none; min-height: 60px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--ink-2);
  font-weight: 600; font-size: 1rem; cursor: pointer; padding: 8px;
  transition: background .15s, border-color .15s, transform .1s;
  overflow: hidden; text-overflow: ellipsis;
}
.choice:active { transform: scale(0.97); }
.choice.selected { background: rgba(243, 236, 214, 0.14); border-color: var(--moon); box-shadow: inset 0 0 0 1px var(--moon); }
.choice.wide { grid-column: span 2; }
.centers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.centers .choice { aspect-ratio: 5 / 7; min-height: 0; font-family: var(--serif); font-size: 1.4rem; }

.reveal-line {
  padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(243, 236, 214, 0.06); border: 1px solid rgba(243, 236, 214, 0.22);
  font-family: var(--serif); font-size: 1.15rem; animation: fade .5s;
}
.knowledge { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.knowledge li { padding-left: 16px; position: relative; color: var(--text-dim); }
.knowledge li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.knowledge li.fresh { color: var(--text); }
.knowledge li.fresh::before { background: var(--moon); }

/* ── Day & vote ─────────────────────────────────────────────────────────── */

.countdown { font-family: var(--serif); font-size: 4rem; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.countdown.urgent { color: var(--village); animation: pulse 1s infinite; }
.countdown.paused { color: var(--text-faint); }
.countdown-small { font-size: 2rem; }

.order { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.order .arrow { color: var(--text-faint); font-size: 0.8rem; }
.order .chip.mark { outline: 2px solid var(--moon); outline-offset: 2px; }

.lock-meter { display: flex; gap: 4px; justify-content: center; }
.lock-meter span { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-4); }
.lock-meter span.on { background: var(--moon); }

/* ── Results ────────────────────────────────────────────────────────────── */

.verdict { text-align: center; display: grid; gap: 8px; padding: 10px 0; }
.verdict h1 { font-size: 2.4rem; }
.verdict.win h1 { color: var(--moon); text-shadow: 0 0 30px rgba(243, 236, 214, 0.4); }
.verdict.lose h1 { color: var(--text-dim); }

.result-row {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ink-2); border: 1px solid var(--line);
}
.result-row.won { border-color: rgba(243, 236, 214, 0.35); }
.result-row.dead .who { text-decoration: line-through; text-decoration-color: var(--wolves); }
.result-row .who { font-weight: 600; }
.result-row .roles { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 0.85rem; }
.result-row .vote { font-size: 0.8rem; color: var(--text-faint); }

/* ── Bottom sheet ───────────────────────────────────────────────────────── */

.sheet-backdrop { position: fixed; inset: 0; background: rgba(4, 5, 10, 0.6); z-index: 40; animation: fade .2s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 520px; margin: 0 auto; max-height: 85dvh; overflow-y: auto;
  background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 22px 22px 0 0;
  padding: 10px 20px max(env(safe-area-inset-bottom), 20px);
  animation: sheet-up .3s var(--ease);
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--ink-4); margin: 0 auto 14px; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }

.role-sheet-head { display: flex; align-items: center; gap: 14px; }
.role-sheet-head .role-icon { width: 48px; height: 48px; }
.role-sheet-head .team { font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--team); }
.rules h4 { margin: 0 0 4px; font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
  padding: 14px 18px; background: #3a1620; color: #ffd0d6;
}
#blazor-error-ui .reload { color: var(--moon); margin-left: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Table screen (TV / laptop, landscape) ─────────────────────────────── */

.screen-controls { position: fixed; left: 3vw; bottom: 3vh; transition: opacity .4s; z-index: 5; }
body.idle { cursor: none; }
body.idle .screen-controls, body.idle .skip { opacity: 0; pointer-events: none; }

.tv-pair-screen { margin: auto; display: grid; justify-items: center; text-align: center; gap: 1.2em; max-width: 46em; }
.tv-pair-screen .moon { width: 5em; height: 5em; }
.pair-code { font-family: var(--serif); font-size: 9em; line-height: 1; letter-spacing: 0.08em; color: var(--moon); text-shadow: 0 0 60px rgba(243, 236, 214, 0.35); }
.pair-steps { text-align: left; display: grid; gap: 0.5em; font-size: 1.3em; color: var(--text-dim); }
.pair-steps strong { color: var(--text); }

.tv-pair { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.8em 1em; }
.tv-pair summary { cursor: pointer; font-weight: 600; }
.tv-pair[open] summary { margin-bottom: 0.7em; }
.tv-pair .input-code { letter-spacing: 0.4em; }

.table-shell {
  min-height: 100dvh;
  padding: 3vh 4vw;
  display: flex;
  flex-direction: column;
  gap: 2vh;
  font-size: clamp(16px, 1.3vw, 26px);
}
.table-shell .chip { font-size: 0.85em; min-height: 2.1em; }
.table-shell .chip svg { width: 1.2em; height: 1.2em; }
.table-shell h1 { font-size: 3.2em; }
.table-shell h2 { font-size: 1.8em; }
.table-shell h3 { font-size: 1.1em; margin-top: 1.2em; margin-bottom: 0.5em; color: var(--text-dim); }

.table-head { display: flex; align-items: center; gap: 1.2em; color: var(--text-dim); }
.table-head .code { font-family: var(--serif); letter-spacing: 0.3em; color: var(--text); font-size: 1.4em; }
.table-head .phase { letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.85em; }
.table-head .spacer { flex: 1; }
.badge { border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.2em 0.8em; font-size: 0.85em; color: var(--village); }

.table-empty { margin: auto; text-align: center; display: grid; gap: 1em; }

.table-lobby, .table-day { flex: 1; display: grid; grid-template-columns: 1.4fr 1fr; gap: 4vw; align-items: center; }
.table-side { align-self: stretch; display: flex; flex-direction: column; gap: 0.6em; }

.join { display: flex; align-items: center; gap: 3vw; }
.qr { width: min(34vw, 52vh); aspect-ratio: 1; border-radius: 18px; box-shadow: 0 0 80px rgba(243, 236, 214, 0.15); }
.join-text { display: grid; gap: 0.5em; }
.join-text .url { font-family: var(--serif); font-size: 1.8em; }
.join-text .big-code { font-family: var(--serif); font-size: 5em; letter-spacing: 0.25em; line-height: 1; }

/* seats around an ellipse */
.ring { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: 72vh; margin: 0 auto; }
.table-side .ring { aspect-ratio: 4 / 3; }
.ring-center { position: absolute; inset: 22% 18%; display: grid; place-content: center; justify-items: center; text-align: center; gap: 0.5em; }
.seat {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 7em; padding: 0.55em 1em; border-radius: 999px; text-align: center;
  background: var(--ink-2); border: 1px solid var(--line-strong);
  transition: background .4s, border-color .4s, opacity .4s;
}
.seat-name { font-weight: 600; white-space: nowrap; }
.seat-badge { position: absolute; top: -0.6em; right: -0.4em; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--moon); color: var(--ink-1); display: grid; place-items: center; font-size: 0.8em; font-weight: 700; animation: rise .3s var(--ease); }
.seat.away { opacity: 0.45; }
.seat.locked { border-color: var(--moon); background: rgba(243, 236, 214, 0.1); }
.dim-ring .seat { opacity: 0.55; }

.table-night { flex: 1; display: grid; place-items: center; }
.table-night .ring { width: min(100%, 150vh); }
.night-moon {
  width: 7em; height: 7em; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffaf0, var(--moon) 55%, #c9bf9f);
  box-shadow: 0 0 120px rgba(243, 236, 214, 0.35);
  transform: translateY(calc(var(--progress, 0) * 0.6em));
  opacity: calc(1 - var(--progress, 0) * 0.45);
  transition: transform 1.2s var(--ease), opacity 1.2s;
}
.steps.big span { width: 2.2em; height: 0.3em; }
.table-shell .countdown { font-size: 7em; }

/* the dawn reveal */
.reveal-stage { flex: 1; display: grid; grid-template-columns: 1fr 1.2fr; gap: 4vw; align-items: start; }
.reveal-votes { display: grid; gap: 0.5em; }
.vote-line {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.8em; align-items: center;
  padding: 0.5em 1em; border-radius: var(--radius-sm); background: var(--ink-2); border: 1px solid var(--line);
  opacity: 0; transform: translateX(-12px); transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.vote-line.shown { opacity: 1; transform: none; }
.vote-line .from { font-weight: 600; }
.vote-line .arrow { color: var(--text-faint); }
.vote-line .to { font-family: var(--serif); font-size: 1.15em; }

.reveal-side { display: grid; gap: 1em; }
.tally { display: grid; gap: 0.4em; animation: rise .45s var(--ease); }
.tally-row { display: grid; grid-template-columns: 8em 1fr 2em; align-items: center; gap: 0.8em; }
.tally-row .bar { height: 0.7em; border-radius: 999px; background: var(--moon); min-width: 0.7em; animation: grow .6s var(--ease); transform-origin: left; }
.tally-row .num { font-variant-numeric: tabular-nums; text-align: right; }
@keyframes grow { from { transform: scaleX(0); } }

.death {
  display: flex; align-items: center; gap: 0.8em; flex-wrap: wrap;
  padding: 0.8em 1.1em; border-radius: var(--radius); font-size: 1.25em;
  background: var(--wolves-soft); border: 1px solid rgba(217, 71, 90, 0.4);
  animation: rise .5s var(--ease);
}
.death .skull { font-size: 1.4em; }
.table-verdict {
  font-family: var(--serif); font-size: 3em; line-height: 1.1; color: var(--moon);
  text-shadow: 0 0 40px rgba(243, 236, 214, 0.4); animation: rise .6s var(--ease);
}

.final-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(9em, 1fr)); gap: 0.8em; margin-top: 1.5em; }
.final-card {
  display: grid; justify-items: center; gap: 0.3em; padding: 0.9em 0.6em; text-align: center;
  border-radius: 14px; border: 1px solid color-mix(in srgb, var(--team, var(--text)) 45%, transparent);
  background: linear-gradient(160deg, var(--ink-3), var(--ink-1));
  animation: flip-in .6s var(--ease) both;
}
.final-card:nth-child(2) { animation-delay: .08s; } .final-card:nth-child(3) { animation-delay: .16s; }
.final-card:nth-child(4) { animation-delay: .24s; } .final-card:nth-child(5) { animation-delay: .32s; }
.final-card:nth-child(6) { animation-delay: .40s; } .final-card:nth-child(7) { animation-delay: .48s; }
.final-card:nth-child(n+8) { animation-delay: .56s; }
.final-card .role-icon { width: 2.4em; height: 2.4em; }
.final-card .role { font-family: var(--serif); font-size: 1.2em; }
.final-card .was { font-size: 0.75em; color: var(--text-faint); }
.final-card.won { box-shadow: 0 0 30px rgba(243, 236, 214, 0.18); border-color: var(--moon); }
.final-card.dead .who { text-decoration: line-through; text-decoration-color: var(--wolves); }
.final-card.center-cards { --team: var(--text-faint); }
@keyframes flip-in { from { opacity: 0; transform: perspective(600px) rotateY(80deg); } to { opacity: 1; transform: none; } }

.skip { position: fixed; right: 3vw; bottom: 3vh; }

@media (max-aspect-ratio: 1/1) {
  .table-lobby, .table-day, .reveal-stage { grid-template-columns: 1fr; }
  .join { flex-direction: column; }
}

button.link { background: none; border: 0; padding: 0; color: var(--moon); font: inherit; text-decoration: underline; cursor: pointer; margin-left: 0.4em; }
.tv-status { color: var(--moon); }

/* ── Review: replay, who knew what ─────────────────────────────────────── */

.replay { display: grid; gap: 12px; }
.replay-head { min-height: 4.6em; text-align: center; display: grid; gap: 4px; align-content: start; }
.replay-line { margin: 0; font-size: 1rem; line-height: 1.4; }
.replay-board { position: relative; width: 100%; aspect-ratio: 1 / 1.05; cursor: pointer; user-select: none; -webkit-user-select: none; }
.replay-seat {
  position: absolute; transform: translate(-50%, -50%); font-size: 0.72rem; color: var(--text-dim); z-index: 3;
  background: var(--ink-1); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
  white-space: nowrap; max-width: 22%; overflow: hidden; text-overflow: ellipsis; transition: color .3s;
}
.replay-seat.actor { color: var(--moon); font-weight: 700; }
.replay-card {
  position: absolute; transform: translate(-50%, -50%);
  width: var(--card-w, 13%); aspect-ratio: 5 / 7; border-radius: 10px; padding: 3px;
  display: grid; justify-items: center; align-content: center; gap: 2px; text-align: center;
  background: linear-gradient(160deg, var(--ink-3), var(--ink-1));
  border: 1px solid color-mix(in srgb, var(--team, var(--text)) 45%, transparent);
  transition: left .9s var(--ease), top .9s var(--ease), box-shadow .4s, border-color .4s;
}
.replay-card .role-icon { width: 46%; height: auto; color: var(--team); }
.replay-card .name { font-family: var(--serif); font-size: var(--card-text, 0.62rem); line-height: 1.05; max-width: 100%; hyphens: auto; -webkit-hyphens: auto; }
.replay-card .mimic { font-size: 0.5rem; color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; }
.replay-card.looked { box-shadow: 0 0 0 2px var(--moon), 0 0 24px rgba(243, 236, 214, 0.45); }
.replay-card.moved { border-color: var(--moon); box-shadow: 0 0 22px rgba(243, 236, 214, 0.3); z-index: 2; }
.replay-controls { display: flex; justify-content: center; gap: 10px; }
.replay.compact .replay-card .name { display: none; }
.replay.compact .replay-card .role-icon { width: 70%; }
.replay.compact .replay-card { padding: 2px; }
.replay-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.replay-key .chip { font-size: 0.75rem; min-height: 26px; }

.replay.large { font-size: 1.4em; }
.replay.large .replay-board { aspect-ratio: 16 / 9; width: min(100%, 108vh); margin: 0 auto; }
.replay.large .replay-card { width: calc(var(--card-w, 13%) * 0.58); }
.replay.large .replay-card .name { font-size: calc(var(--card-text, 0.62rem) * 1.5); }
.replay.large .replay-card .mimic { font-size: 0.7rem; }
.replay.large .replay-seat { font-size: 1.05rem; padding: 2px 12px; }
.replay.large .replay-line { font-size: 1.5em; font-family: var(--serif); }

.who-picker { gap: 6px; }
.chip-btn { border: 1px solid var(--line-strong); background: var(--ink-2); color: var(--text-dim); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.chip-btn.active { background: var(--moon); color: var(--ink-1); border-color: var(--moon); }
.knew-list:empty::after { content: "Nothing: they didn't wake up."; color: var(--text-faint); }
.share-results { margin-top: 8px; }
.table-replay-actions { display: flex; justify-content: center; gap: 12px; margin-top: 1.5em; }

.version { margin-top: auto; padding-top: 24px; opacity: 0.6; }

.row-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.confirm-box { padding: 12px; border: 1px solid rgba(217, 71, 90, 0.5); border-radius: 12px; gap: 8px; }
