:root {
  --bg: #0e0b14; --panel: #1b1626; --panel2: #262033; --line: #3d3352;
  --text: #f1e9d8; --muted: #a89f90; --amber: #e6ab45; --amber2: #b9781f; --blood: #d6493a; --good: #7cc08c;
  --glow: rgba(230, 171, 69, .16); --tint: #2c1f45;
  --display: 'Cinzel', Georgia, 'Times New Roman', serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
body[data-mood='night'] { --tint: #0f1f4a; --glow: rgba(130, 160, 255, .14); }
body[data-mood='tense'] { --tint: #3a1a2c; --glow: rgba(230, 171, 69, .12); }
body[data-mood='blood'] { --tint: #5a1210; --glow: rgba(214, 73, 58, .22); }
body[data-mood='dawn'] { --tint: #5a3320; --glow: rgba(255, 190, 120, .2); }
body[data-mood='calm'] { --tint: #1d4030; --glow: rgba(124, 192, 140, .16); }
body[data-mood='gold'] { --tint: #5a431a; --glow: rgba(230, 171, 69, .28); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: contain; }
body {
  background-color: var(--bg);
  color: var(--text); font: 17px/1.45 var(--sans); -webkit-tap-highlight-color: transparent;
}
/* Atmosphere: a tinted glow from above, a vignette, and a candle flicker. */
body::before, body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
body::before {
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, var(--tint) 0%, transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 120%, #000 0%, transparent 60%);
  transition: background 1.5s;
}
body::after {
  background: radial-gradient(ellipse 50% 35% at 50% 0%, var(--glow), transparent 70%);
  animation: flicker 5s infinite;
}
body[data-mood='night']::after {
  background:
    radial-gradient(circle at 82% 16%, rgba(220, 230, 255, .5) 0, rgba(220, 230, 255, .12) 4vmin, transparent 12vmin),
    radial-gradient(1.5px 1.5px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 28% 9%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 61% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 38%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 91% 44%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 52%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 36% 58%, #fff 50%, transparent 51%);
  animation: twinkle 6s infinite;
}
@keyframes flicker { 0%, 100% { opacity: 1; } 42% { opacity: .82; } 47% { opacity: 1; } 53% { opacity: .7; } 60% { opacity: .95; } 78% { opacity: .85; } }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .55; } }
#app { position: relative; z-index: 1; min-height: 100%; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0 0 .4em; line-height: 1.15; text-wrap: balance; }
h1 { font-size: 2.3rem; }
h2 { font-size: 1.5rem; letter-spacing: .02em; }
h3 { font-size: .95rem; color: var(--amber); letter-spacing: .12em; text-transform: uppercase; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.amber { color: var(--amber); }
.blood { color: var(--blood); }
.good { color: var(--good); }
.center { text-align: center; }

.logo, .brand {
  font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .18em;
  background: linear-gradient(180deg, #ffe2a3, var(--amber) 45%, var(--amber2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo { font-size: 2.5rem; margin-right: -.18em; }
.emblem { width: 120px; height: 120px; display: block; margin: 0 auto 10px; filter: drop-shadow(0 0 18px rgba(230, 171, 69, .35)); }
.emblem .flame { transform-origin: 60px 44px; animation: flame 2.4s ease-in-out infinite; }
@keyframes flame { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.08, .94) rotate(3deg); } }

.shell { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
header.bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 0 10px; border-bottom: 1px solid var(--line); font-size: .9rem; }
header.bar .brand { font-size: 1rem; }
header.bar .meta { color: var(--muted); display: flex; gap: 12px; white-space: nowrap; }
main { flex: 1; padding: 20px 0 100px; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(10, 8, 15, .96); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.tabs button { flex: 1; background: none; border: 0; box-shadow: none; color: var(--muted); padding: 12px 4px 10px; font: inherit; font-size: .8rem; border-radius: 0; text-transform: none; letter-spacing: 0; margin: 0; min-height: 0; }
nav.tabs button .ic { display: block; font-size: 1.3rem; }
nav.tabs button.on { color: var(--amber); box-shadow: inset 0 2px 0 var(--amber); }

.card {
  background: linear-gradient(180deg, rgba(38, 32, 51, .92), rgba(24, 19, 34, .92)); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 226, 163, .07);
}
.hero { text-align: center; padding: 18px 0 6px; }
.hero .big { font-size: 3.4rem; line-height: 1; margin-bottom: 10px; filter: drop-shadow(0 0 22px var(--glow)); }
/* A small flourish under every big heading. */
.hero h2::after { content: ''; display: block; width: 150px; height: 9px; margin: 12px auto 4px; background:
  linear-gradient(90deg, transparent, var(--amber) 35%, transparent 47%, transparent 53%, var(--amber) 65%, transparent) center / 100% 1px no-repeat,
  linear-gradient(45deg, transparent 38%, var(--amber) 38%, var(--amber) 62%, transparent 62%) center / 9px 9px no-repeat; opacity: .8; }
.verdict { font-family: var(--display); font-weight: 700; font-size: 2rem; letter-spacing: .06em; text-transform: uppercase; margin: .3em 0; animation: slam .7s cubic-bezier(.2, 1.4, .4, 1) both; text-shadow: 0 0 28px currentColor; }
@keyframes slam { 0% { transform: scale(2.4); opacity: 0; filter: blur(6px); } 100% { transform: scale(1); opacity: 1; filter: blur(0); } }
@keyframes rise { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }

button, .btn {
  font: inherit; font-weight: 700; color: #20160a; border: 0; border-radius: 12px; padding: 14px 18px; min-height: 50px; cursor: pointer; width: 100%; display: block; text-align: center; text-decoration: none; margin: 0 0 10px;
  background: linear-gradient(180deg, #f5c66a, var(--amber) 50%, #cf9230); box-shadow: 0 4px 14px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .08s, filter .15s;
}
button:active:not(:disabled) { transform: translateY(2px) scale(.99); filter: brightness(.92); }
button:disabled { opacity: .45; cursor: default; }
button.ghost, .btn.ghost { background: rgba(255, 255, 255, .02); color: var(--text); border: 1px solid var(--line); box-shadow: none; font-weight: 600; }
button.danger { background: linear-gradient(180deg, #e8604f, var(--blood) 50%, #a83024); color: #fff; }
button.inline { width: auto; display: inline-block; min-height: 0; padding: 6px 12px; font-size: .85rem; margin: 0; }
input, select { font: inherit; color: var(--text); background: #0c0a12; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; width: 100%; margin: 0 0 10px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
label.check { display: flex; gap: 10px; align-items: center; font-size: 1rem; color: var(--text); margin: 4px 0 12px; }
label.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--amber); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 8px; }
.chip.dead { opacity: .4; text-decoration: line-through; }
.av { font-size: 1.25em; line-height: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 12px 0; }
.grid button { background: var(--panel2); color: var(--text); border: 2px solid var(--line); margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; font-weight: 500; overflow-wrap: anywhere; box-shadow: none; }
.grid button .av { font-size: 1.9rem; }
.grid button.sel { border-color: var(--amber); background: #3a2f1c; box-shadow: 0 0 18px rgba(230, 171, 69, .3); }
.grid button .tag { font-size: .75rem; color: var(--amber); }
.avgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 0 0 14px; }
.avgrid button { background: var(--panel2); border: 2px solid transparent; padding: 0; min-height: 40px; font-size: 1.3rem; margin: 0; box-shadow: none; }
.avgrid button.sel { border-color: var(--amber); }

.timer { font-family: var(--display); font-variant-numeric: tabular-nums; }
.timer.huge { display: block; font-size: 4.5rem; text-align: center; color: var(--amber); margin: 10px 0; text-shadow: 0 0 40px rgba(230, 171, 69, .45); }
.wait { color: var(--muted); font-size: .9rem; text-align: center; margin: 10px 0; }

.peek { background: repeating-linear-gradient(135deg, #1f1a2c, #1f1a2c 10px, #262033 10px, #262033 20px); color: var(--text); border: 1px dashed var(--amber); min-height: 170px; font-weight: 500; box-shadow: none; }
.peek.show { background: radial-gradient(ellipse at 50% 0%, #2a2038, #0c0a12 75%); border-style: solid; animation: flip .45s ease-out both; box-shadow: 0 0 30px var(--glow); }
.peek .role { font-family: var(--display); font-weight: 700; font-size: 1.7rem; letter-spacing: .1em; text-transform: uppercase; display: block; margin: 6px 0; text-shadow: 0 0 24px currentColor; }
@keyframes flip { 0% { transform: perspective(700px) rotateY(80deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

.opts button { background: var(--panel2); color: var(--text); border: 2px solid var(--line); text-align: left; box-shadow: none; font-weight: 500; }
.opts button.chosen { border-color: var(--amber); background: #3a2f1c; }
.opts button.right { border-color: var(--good); background: #1d3324; opacity: 1; }
.opts button.wrong { border-color: var(--blood); background: #3a1d1a; opacity: 1; }

.tally { list-style: none; padding: 0; margin: 14px auto; max-width: 420px; }
.tally li { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tally .n { font-family: var(--display); font-size: 1.4rem; color: var(--amber); }
.callout { font-family: var(--serif); font-style: italic; font-size: 1.7rem; line-height: 1.2; text-align: center; min-height: 3.4em; margin: 14px 0; animation: rise .5s ease-out both; }
.callout b { font-family: var(--display); font-style: normal; color: var(--amber); display: inline-block; animation: slam .7s .5s cubic-bezier(.2, 1.4, .4, 1) both; text-shadow: 0 0 26px rgba(230, 171, 69, .5); }

.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border: 0; }
.rows .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rows .dead { opacity: .55; }
.pill { font-size: .75rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--muted); white-space: nowrap; }
.pill.con { color: var(--blood); border-color: var(--blood); }
.pill.loy { color: var(--good); border-color: var(--good); }

.hostbar { margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--line); }
.hostbar .in { max-width: 560px; margin: 0 auto; }
.hostbar .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }

.chat { max-height: 260px; overflow-y: auto; margin: 0 0 10px; }
.chat p { margin: 0 0 6px; overflow-wrap: anywhere; }
.chat b { color: var(--blood); }
.chatrow { display: flex; gap: 8px; }
.chatrow input { margin: 0; }
.chatrow button { width: auto; margin: 0; }

#toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); background: var(--blood); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; text-align: center; }

/* ---------- TV ---------- */
body.tv { font-size: clamp(18px, 1.7vw, 30px); }
.tvwrap { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 2vh 3vw; }
.tvwrap header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 1vh; }
.tvwrap header .brand { font-size: 1.5em; }
.tvmain { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 2vh 0; }
.tvmain h2 { font-size: 2.4em; }
.tvmain .hero p { font-family: var(--serif); font-size: 1.35em; max-width: 34em; margin-left: auto; margin-right: auto; }
.tvmain .hero .verdict { font-family: var(--display); font-size: 3.2em; }
.tvmain .callout { font-size: 2.6em; }
.tvmain .timer.huge { font-size: 9em; }
.tvmain .hero .big { font-size: 5em; }
.tvmain .hero h2::after { width: 300px; }
.tvmain .opts { display: grid; grid-template-columns: 1fr 1fr; gap: .6em; width: min(90%, 50em); }
.tvmain .opts button { margin: 0; font-size: 1em; }
.tvmain .tally { font-size: 1.1em; min-width: 16em; }
.tvmain .wait { font-size: .9em; }
/* On the TV, players are shown as portrait medallions. */
.tv .chips { gap: 1.1em; }
.tv .chip { flex-direction: column; background: none; border: 0; padding: 0; gap: .25em; font-size: .8em; position: relative; }
.tv .chip .av { font-size: 2em; width: 1.9em; height: 1.9em; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 50% 30%, #3a3050, #17121f); border: 2px solid var(--amber2); box-shadow: 0 0 18px var(--glow), inset 0 0 12px rgba(0, 0, 0, .6); }
.tv .chip.dead { opacity: .5; text-decoration: none; }
.tv .chip.dead .av { filter: grayscale(1); border-color: #5a2a26; background: linear-gradient(135deg, transparent 46%, var(--blood) 46%, var(--blood) 54%, transparent 54%), #17121f; }
.qr { background: #fff; padding: 12px; border-radius: 14px; width: min(36vh, 320px); margin: 1vh auto; box-shadow: 0 0 60px rgba(230, 171, 69, .3); }
.qr svg { display: block; width: 100%; height: auto; }
.codebig { font-family: var(--display); font-weight: 700; font-size: 3em; letter-spacing: .25em; color: var(--amber); text-shadow: 0 0 30px rgba(230, 171, 69, .5); }

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

/* ---------- selfies ---------- */
img.av.ph { width: 1.5em; height: 1.5em; border-radius: 50%; object-fit: cover; vertical-align: middle; border: 1px solid var(--amber2); flex: none; }
.chip img.av.ph { margin: -2px 0 -2px -4px; }
.grid button img.av.ph { width: 68px; height: 68px; font-size: 1rem; border-width: 2px; }
.rows img.av.ph { width: 38px; height: 38px; }
.tv .chip img.av.ph { width: 1.9em; height: 1.9em; border-width: 2px; margin: 0; }
.tv .chip.dead img.av.ph { filter: grayscale(1) brightness(.6); border-color: var(--blood); }
.tv .tally img.av.ph { width: 1.6em; height: 1.6em; }
.portrait { text-align: center; margin: 6px 0 16px; }
.portrait .frame { position: relative; display: grid; place-items: center; width: 172px; height: 172px; margin: 6px auto 0; border-radius: 50%; cursor: pointer; color: var(--amber); -webkit-tap-highlight-color: transparent; }
.portrait .ring { position: absolute; inset: 0; border-radius: 50%; padding: 4px; background: conic-gradient(from 0deg, #ffe2a3, var(--amber2) 25%, transparent 40%, transparent 60%, var(--amber2) 75%, #ffe2a3); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); animation: spin 7s linear infinite; }
.portrait.has .ring { background: linear-gradient(160deg, #ffe2a3, var(--amber) 40%, var(--amber2) 70%, #ffe2a3); animation: none; box-shadow: 0 0 34px rgba(230, 171, 69, .45); }
.portrait .inner, .portrait .frame img { width: 152px; height: 152px; border-radius: 50%; }
.portrait .inner { display: grid; place-content: center; justify-items: center; gap: 8px; background: radial-gradient(circle at 50% 30%, #332a47, #120e1b 78%); box-shadow: inset 0 0 26px rgba(0, 0, 0, .7); transition: transform .12s; }
.portrait .frame:active .inner, .portrait .frame:active img { transform: scale(.96); }
.portrait .cam { width: 46px; height: 46px; filter: drop-shadow(0 0 10px rgba(230, 171, 69, .5)); }
.portrait .hint { font-size: .82rem; line-height: 1.25; color: var(--text); font-weight: 600; }
.portrait .frame img { object-fit: cover; box-shadow: inset 0 0 0 2px #120e1b; transition: transform .12s; }
.portrait .retake { display: inline-block; position: relative; margin-top: -18px; padding: 7px 16px; border-radius: 999px; background: #120e1b; border: 1px solid var(--amber2); color: var(--amber); font-size: .85rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .5); }
.portrait .plaque { display: block; width: fit-content; max-width: 90%; margin: 14px auto 8px; padding: 6px 22px; font-family: var(--display); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #20160a; background: linear-gradient(180deg, #f5d48a, var(--amber) 55%, #b9812a); clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); overflow-wrap: anywhere; }
.portrait p { margin: 0 0 6px; }
.portrait .pick { display: inline-block; padding: 8px; color: var(--muted); font-size: .88rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- night modes ---------- */
.modebadge { display: inline-block; font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: .08em; text-transform: uppercase; padding: 8px 18px; border-radius: 999px; margin: 0 0 14px; border: 2px solid currentColor; }
.modebadge.phone { color: #9fb6ff; background: rgba(90, 120, 255, .12); }
.modebadge.plain { color: var(--blood); background: rgba(214, 73, 58, .14); box-shadow: 0 0 26px rgba(214, 73, 58, .35); }
.modebadge.recruit { color: var(--amber); background: rgba(230, 171, 69, .12); }
.steps { text-align: left; max-width: 34em; margin: 10px auto; padding-left: 1.4em; }
.steps li { margin: 0 0 .5em; }
.tvmain .steps { font-family: var(--serif); font-size: 1.15em; }
.tvmain .modebadge { font-size: 1.3em; }
button.choice { background: var(--panel2); color: var(--text); border: 2px solid var(--line); text-align: left; box-shadow: none; font-weight: 500; }
button.choice b { display: block; font-size: 1.1rem; margin-bottom: 2px; }
button.choice span { color: var(--muted); font-size: .9rem; }
.method { font-family: var(--serif); font-size: 1.35rem; line-height: 1.25; }
.method b { color: var(--blood); }
.tv[data-mood='night'] .tvmain .timer.huge { font-size: 4.6em; margin: 0; }
.tv[data-mood='night'] .tvmain .hero { padding: 0; }
.tv[data-mood='night'] .tvmain .steps { margin: 0 auto; font-size: 1em; }

/* ---------- human check ---------- */
#human { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(8, 6, 12, .86); }
#human .card { width: min(100%, 360px); text-align: center; }
#human-w { min-height: 70px; display: grid; place-items: center; margin: 0 0 12px; }

/* ---------- touch ---------- */
button, .btn, label.btn, summary { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
header.bar .meta { flex-wrap: wrap; justify-content: flex-end; row-gap: 0; }
.offline { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 25; background: #3a2f1c; color: var(--amber); border: 1px solid var(--amber2); border-radius: 999px; padding: 6px 14px; font-size: .85rem; }
#toast { top: calc(14px + env(safe-area-inset-top)); }
@media (max-width: 360px) { .logo { font-size: 2rem; } h2 { font-size: 1.3rem; } .timer.huge { font-size: 3.6rem; } }
#app { overflow-x: clip; }
button.inline { min-height: 40px; padding: 8px 14px; }

/* ---------- host options ---------- */
.hostopts { margin-top: 26px; text-align: center; }
button.textbtn { width: auto; display: inline-block; min-height: 44px; margin: 0 0 8px; padding: 8px 14px; background: none; box-shadow: none; color: var(--muted); font-weight: 500; font-size: .88rem; }
.hostopts .card { text-align: left; }

/* ---------- reactions ---------- */
.reacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 18px 0 8px; }
.reacts .lbl { flex-basis: 100%; text-align: center; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.reacts button { width: 52px; min-height: 52px; padding: 0; margin: 0; border-radius: 50%; font-size: 1.5rem; background: var(--panel2); border: 1px solid var(--line); box-shadow: none; transition: transform .15s; }
.reacts button.sent { transform: scale(1.35) translateY(-6px); border-color: var(--amber); }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 15; overflow: hidden; }
.fx { position: absolute; bottom: -12vh; display: grid; justify-items: center; gap: .1em; animation: floatUp 4.5s ease-out forwards; }
.fx .e { font-size: 7vh; line-height: 1; filter: drop-shadow(0 0 14px rgba(0, 0, 0, .6)); }
.fx .who { font-size: 2vh; color: var(--text); background: rgba(10, 8, 15, .7); border-radius: 999px; padding: .1em .7em; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 12% { opacity: 1; transform: translateY(-14vh) scale(1.1); } 80% { opacity: 1; } 100% { transform: translateY(-105vh) scale(1); opacity: 0; } }

/* ---------- closing ceremony ---------- */
.bigav { margin: .2em auto .3em; animation: slam .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.bigav .av { font-size: 5.5em; display: block; line-height: 1.1; }
.bigav img.av.ph, .tv .bigav img.av.ph { width: 22vh; height: 22vh; border: 4px solid var(--amber); box-shadow: 0 0 60px var(--glow); }
.tvmain .rows { text-align: left; }
.tvmain .card { width: min(92%, 44em); font-size: .8em; }

/* Final results board on the TV: compact, so 16 players and the honours fit one screen. */
.finalboard { width: 100%; display: grid; justify-items: center; }
.finalboard .hero { padding: 0; }
.finalboard .hero .big { display: none; }
.finalboard .hero h2 { font-size: 1.7em; margin: 0; }
.finalboard .hero h2::after { display: none; }
.tvmain .finalboard .hero .verdict { font-size: 1.5em; margin: 0; animation: none; }
.tvmain .finalboard .hero p { font-size: 1em; margin: 0 0 .4em; }
.tvmain .finalboard .card { width: min(96%, 62em); font-size: .68em; padding: .6em 1em; margin: 0 0 .6em; }
.finalboard .rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.6em; }
.finalboard .rows li { padding: .3em 0; border: 0; }
.finalboard h3 { margin: 0 0 .2em; }
.finalboard p { margin: .2em 0 0; }

/* ---------- home: how it works ---------- */
.facts { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0; margin: 4px 0 12px; text-align: center; }
.facts li { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 10px; padding: 10px 4px; font-size: .78rem; color: var(--muted); }
.facts b { display: block; color: var(--amber); font-size: .95rem; }
.facts span { display: block; }
.howto .steps { margin: 0 0 10px; }
.howto .textbtn { display: block; margin: 0 auto; color: var(--amber); }

/* =====================================================================
   Motion: scene changes, touch feedback, the vote and the dawn on the TV
   ===================================================================== */
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
main[data-k] { animation: enter .36s cubic-bezier(.2, .7, .2, 1) both; }
.tvmain { animation: enter .7s cubic-bezier(.2, .7, .2, 1) both; }

/* TV title card between the big moments */
#curtain { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; pointer-events: none; opacity: 0; background: radial-gradient(ellipse 80% 70% at 50% 42%, var(--tint) 0%, #07050b 72%); }
#curtain.go { animation: curtain 2.5s ease both; }
#curtain .ct { text-align: center; width: 90vw; }
#curtain h1 { font-size: 6vw; margin: 0; text-transform: uppercase; background: linear-gradient(180deg, #fff1cf, var(--amber) 50%, var(--amber2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#curtain.go h1 { animation: title 2.5s cubic-bezier(.2, .7, .2, 1) both; }
#curtain p { font-family: var(--serif); font-style: italic; font-size: 2.6vw; margin: 1vh 0 0; color: var(--text); }
#curtain.go p { animation: sub 2.5s ease both; }
#curtain .rule { display: block; height: 1px; width: 0; margin: 2.5vh auto; background: linear-gradient(90deg, transparent, var(--amber), transparent); }
#curtain.go .rule { animation: rule 2.5s ease both; }
@keyframes curtain { 0% { opacity: 0; } 9% { opacity: 1; } 72% { opacity: 1; } 100% { opacity: 0; } }
@keyframes title { 0% { letter-spacing: .55em; opacity: 0; filter: blur(10px); } 28% { letter-spacing: .14em; opacity: 1; filter: blur(0); } 78% { letter-spacing: .17em; opacity: 1; } 100% { letter-spacing: .2em; opacity: 0; } }
@keyframes sub { 0%, 22% { opacity: 0; transform: translateY(1vh); } 40%, 78% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes rule { 0% { width: 0; } 35% { width: 44vw; } 100% { width: 52vw; } }

/* Touch feedback on phones */
.grid button { transition: transform .16s cubic-bezier(.2, 1.4, .4, 1), border-color .2s, background .2s, box-shadow .2s; }
.grid button.sel { transform: scale(1.04); }
.opts button { transition: border-color .2s, background .2s; }
.opts button.chosen { animation: pick .34s cubic-bezier(.2, 1.5, .4, 1); }
.opts button.chosen::after, .opts button.right::after { content: '✓'; float: right; color: var(--amber); font-weight: 700; }
.opts button.right::after { color: var(--good); }
.opts button.wrong::after { content: '✕'; float: right; color: var(--blood); font-weight: 700; }
@keyframes pick { 0% { transform: scale(.96); } 60% { transform: scale(1.03); } 100% { transform: none; } }
button.busy { pointer-events: none; opacity: .75; }
button.busy::after { content: ''; display: inline-block; width: .9em; height: .9em; margin-left: .6em; vertical-align: -.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
nav.tabs button { transition: color .2s, box-shadow .2s; }
.sealed { display: grid; justify-items: center; gap: 6px; margin: 18px 0 4px; }
.sealed .pf { position: relative; width: 124px; height: 124px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #3a3050, #17121f); border: 3px solid var(--amber2); box-shadow: 0 0 26px var(--glow); }
.sealed .pf .av { font-size: 3.6rem; }
.sealed .pf img.av.ph { width: 100%; height: 100%; border: 0; }
.sealed b { font-family: var(--display); font-size: 1.2rem; letter-spacing: .05em; }
.sealed .stamp { position: absolute; right: -22px; bottom: 2px; padding: 3px 10px; border: 2px solid var(--blood); border-radius: 6px; color: var(--blood); background: rgba(20, 8, 8, .9); font-family: var(--display); font-weight: 700; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; animation: stamp .45s .2s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stamp { 0% { transform: scale(3) rotate(-30deg); opacity: 0; } 100% { transform: scale(1) rotate(-12deg); opacity: 1; } }
.bigav.dead .av { filter: grayscale(1) brightness(.8); }
.bigav.dead img.av.ph, .tv .bigav.dead img.av.ph { border-color: var(--blood); box-shadow: 0 0 60px rgba(214, 73, 58, .6); }

/* The table: portraits used by the vote reveal and the dawn */
.tvmain .callout.stagecall { font-size: 2.1em; min-height: 1.5em; margin: 0 0 2vh; }
.seats { --seat: 9.5vw; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 6vh 2.6vw; width: 94vw; margin: 3vh auto 0; }
.seats.s6 { --seat: 11.5vw; }
.seats.s16 { --seat: 7.2vw; max-width: 84vw; }
.seat { position: relative; z-index: var(--v, 0); display: grid; justify-items: center; gap: .8vh; width: calc(var(--seat) + 1vw); transform: scale(calc(1 + var(--v, 0) * .04)); transition: transform .55s cubic-bezier(.2, 1.4, .4, 1) .68s, opacity .6s, filter .6s; }
.seat .pf { position: relative; width: var(--seat); height: var(--seat); border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #3a3050, #17121f); border: .28vw solid var(--amber2); box-shadow: 0 0 1.4vw var(--glow), inset 0 0 1vw rgba(0, 0, 0, .6); transition: border-color .4s, box-shadow .4s, filter .6s; }
.seat .pf .av { font-size: calc(var(--seat) * .55); }
.seat .pf img.av.ph, .tv .seat .pf img.av.ph { width: 100%; height: 100%; border: 0; margin: 0; }
.seat .nm { font-size: 1.45vw; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .cnt { position: absolute; right: -8%; top: -8%; min-width: 2.8vw; height: 2.8vw; padding: 0 .4vw; border-radius: 1.4vw; display: grid; place-items: center; background: var(--blood); color: #fff; font: 700 1.6vw var(--display); box-shadow: 0 .3vw 1vw rgba(0, 0, 0, .6); animation: pop .45s .68s cubic-bezier(.2, 1.6, .4, 1) both; }
.seat .cnt.zero { display: none; }
.seat.voting .pf { border-color: #fff; box-shadow: 0 0 3vw rgba(255, 255, 255, .55); }
.seat.lead .pf { border-color: var(--blood); box-shadow: 0 0 3vw rgba(214, 73, 58, .6); }
.seat.hit .pf { animation: thud .5s .68s; }
.seat.tied .pf { border-color: var(--amber); box-shadow: 0 0 3.5vw rgba(230, 171, 69, .8); }
.seat.out { animation: shake .6s .1s; }
.seat.out .pf { border-color: var(--blood); box-shadow: 0 0 5vw rgba(214, 73, 58, .9); }
.seat.out .pf .av { filter: grayscale(.8) brightness(.8); }
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes thud { 0% { transform: scale(1); } 30% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { translate: 0; } 20% { translate: -1vw; } 40% { translate: 1vw; } 60% { translate: -.6vw; } 80% { translate: .6vw; } }
.ballot { position: fixed; left: 0; top: 0; z-index: 14; width: 3.6vw; height: 4.6vw; border-radius: .3vw; background: linear-gradient(160deg, #f8efd8, #d6c394); box-shadow: 0 .6vw 1.8vw rgba(0, 0, 0, .65); pointer-events: none; }
.ballot::after { content: ''; position: absolute; left: 50%; top: 56%; width: 1.3vw; height: 1.3vw; margin: -.65vw; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ee6a58, #8f241a); }

/* Dawn: a candle for everyone who went to bed alive */
.seat.candle { transition: transform .7s cubic-bezier(.2, 1.2, .4, 1), opacity .7s; }
.seat.candle .flame { width: 1.7vw; height: 2.6vw; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: radial-gradient(ellipse at 50% 72%, #fff 0%, #ffe9a8 24%, #ffb347 52%, rgba(255, 120, 30, 0) 76%); filter: drop-shadow(0 0 1vw #ffb347); transform-origin: 50% 100%; animation: wick .34s ease-in-out infinite alternate; transition: opacity .5s, scale .5s; }
.seat.candle.doubt .pf { box-shadow: 0 0 2.6vw rgba(255, 179, 71, .55); }
.seat.candle.safe { opacity: .5; transform: scale(.88); }
.seat.candle.safe .flame { animation-duration: 2.4s; }
.seat.candle.safe .pf { border-color: var(--good); box-shadow: 0 0 1.4vw rgba(124, 192, 140, .4); }
.seat.candle.dead { transform: scale(1.22); }
.seat.candle.dead .flame { opacity: 0; scale: .2; }
.seat.candle.dead .pf { border-color: var(--blood); box-shadow: 0 0 5vw rgba(214, 73, 58, .85); }
.seat.candle.dead .pf .av { filter: grayscale(1) brightness(.55); }
@keyframes wick { from { transform: scaleY(1) rotate(-4deg); } to { transform: scaleY(1.18) scaleX(.9) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .seat .cnt { opacity: 1; } }
.bigav img.av.ph, .tv .bigav img.av.ph { margin: 0 auto; }

/* =====================================================================
   Living backdrop, banishment flip, sealed letter
   ===================================================================== */
#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#bg .fog { position: absolute; width: 110vmax; height: 70vmax; border-radius: 50%; background: radial-gradient(closest-side, var(--tint), transparent); opacity: .5; will-change: transform; }
#bg .fog.a { left: -40vmax; top: 30%; animation: driftA 70s ease-in-out infinite alternate; }
#bg .fog.b { right: -50vmax; top: -10%; opacity: .38; animation: driftB 95s ease-in-out infinite alternate; }
#bg .fog.c { left: 10%; bottom: -45vmax; opacity: .42; animation: driftC 80s ease-in-out infinite alternate; }
@keyframes driftA { to { transform: translate(45vmax, -12vmax) scale(1.2); } }
@keyframes driftB { to { transform: translate(-40vmax, 18vmax) scale(.85); } }
@keyframes driftC { to { transform: translate(20vmax, -20vmax) scale(1.3); } }

/* Banishment: the portrait turns to show the truth */
.flip { --d: 150px; position: relative; width: var(--d); height: var(--d); margin: 4px auto 16px; perspective: 900px; color: var(--amber); }
.tv .flip { --d: 30vh; margin-bottom: 3vh; }
.flip.t { color: var(--blood); }
.flip.f { color: var(--good); }
.flipin { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 1s cubic-bezier(.35, 1.25, .4, 1); animation: sway 3.2s ease-in-out infinite; }
.flip.on .flipin { animation: none; transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; overflow: hidden; -webkit-backface-visibility: hidden; backface-visibility: hidden; border: 4px solid var(--amber2); background: radial-gradient(circle at 50% 30%, #3a3050, #17121f); box-shadow: 0 0 34px var(--glow), inset 0 0 20px rgba(0, 0, 0, .6); }
.face.front .av { font-size: calc(var(--d) * .55); }
.face.front img.av.ph, .tv .face.front img.av.ph { width: 100%; height: 100%; border: 0; margin: 0; }
.face.back { transform: rotateY(180deg); border-color: currentColor; }
.flip.t .back { background: radial-gradient(circle at 50% 35%, #8a2218, #2a0906 75%); box-shadow: 0 0 70px rgba(214, 73, 58, .75); }
.flip.f .back { background: radial-gradient(circle at 50% 35%, #2f6b40, #0b2414 75%); box-shadow: 0 0 70px rgba(124, 192, 140, .6); }
.flip .glyph { font-size: calc(var(--d) * .5); line-height: 1; }
.flip::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 3px solid currentColor; opacity: 0; pointer-events: none; }
.flip.on::after { animation: burst 1.1s .6s ease-out; }
.verdict.late { animation-delay: .9s; }
@keyframes sway { 0%, 100% { transform: rotateY(-10deg); } 50% { transform: rotateY(10deg); } }
@keyframes burst { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }

/* The sealed letter that holds your role */
.envwrap { --eh: 176px; position: relative; width: min(100%, 300px); height: 184px; margin: 6px auto 14px; transition: height .6s cubic-bezier(.3, 1, .4, 1) .45s; perspective: 1000px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.envwrap.open { cursor: default; height: 348px; }
.eback, .efront, .eflap { position: absolute; left: 0; right: 0; bottom: 0; height: var(--eh); border-radius: 8px; }
.eback { z-index: 1; background: linear-gradient(180deg, #a8946a, #8c7850); box-shadow: 0 16px 34px rgba(0, 0, 0, .55); }
.efront { z-index: 3; background: linear-gradient(180deg, #eadcb8, #cfbc8c); clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%); }
.eflap { z-index: 4; background: linear-gradient(180deg, #f3e8ca, #dccb9e); clip-path: polygon(0 0, 100% 0, 50% 60%); transform-origin: 50% 0; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3)); transition: transform .6s cubic-bezier(.4, 0, .2, 1) .25s, z-index 0s .5s; }
.envwrap.open .eflap { transform: rotateX(180deg); z-index: 1; }
.letter { position: absolute; z-index: 2; left: 8%; right: 8%; bottom: 8px; height: 162px; padding: 10px 12px; border-radius: 4px; display: grid; align-content: center; justify-items: center; gap: 2px; text-align: center; color: #2a2118; background: linear-gradient(180deg, #fbf4e1, #efe3c4); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); transition: transform .75s cubic-bezier(.3, 1.2, .4, 1) .7s; }
.envwrap.open .letter { transform: translateY(-170px); }
.letter > * { animation: ink .6s 1.2s both; }
.letter .ic { font-size: 1.4rem; line-height: 1; }
.letter .you { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.letter .role { font-family: var(--display); font-weight: 700; font-size: 1.6rem; letter-spacing: .1em; text-transform: uppercase; line-height: 1.1; }
.letter .role.t { color: #a8281b; }
.letter .role.f { color: #2c6e40; }
.letter .more { font-size: .8rem; line-height: 1.3; }
@keyframes ink { from { opacity: 0; } to { opacity: 1; } }
.seal { position: absolute; z-index: 5; left: 50%; bottom: calc(var(--eh) * .4 - 34px); width: 68px; height: 68px; margin-left: -34px; animation: sealpulse 2.2s ease-in-out infinite; }
.seal .h { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f07260, #a52d20 55%, #6d170f); box-shadow: inset 0 0 0 6px rgba(0, 0, 0, .12), inset 0 0 0 8px rgba(255, 255, 255, .12); transition: transform .45s cubic-bezier(.3, 0, .6, 1), opacity .45s; }
.seal .h::after { content: '✦'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(60, 10, 6, .55); font-size: 1.6rem; }
.seal .h.l { clip-path: polygon(0 0, 54% 0, 46% 35%, 56% 60%, 47% 100%, 0 100%); }
.seal .h.r { clip-path: polygon(54% 0, 100% 0, 100% 100%, 47% 100%, 56% 60%, 46% 35%); }
.envwrap.open .seal { animation: none; pointer-events: none; }
.envwrap.open .seal .h.l { transform: translate(-30px, 22px) rotate(-28deg); opacity: 0; }
.envwrap.open .seal .h.r { transform: translate(30px, 22px) rotate(28deg); opacity: 0; }
@keyframes sealpulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.seal::before { content: ''; position: absolute; inset: 2px; border-radius: 50%; box-shadow: 0 4px 10px rgba(0, 0, 0, .55), 0 0 22px rgba(240, 114, 96, .55); transition: opacity .3s; }
.envwrap.open .seal::before { opacity: 0; }
.envwrap { scroll-margin-top: 10px; }

/* Burning the letter: the paper is eaten away from the bottom, in time with the flame drawn over it */
#burnfx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 16; pointer-events: none; }
.envwrap.burning .letter {
  -webkit-mask-image: linear-gradient(to top, transparent 0, transparent 50%, #000 50%, #000 100%); mask-image: linear-gradient(to top, transparent 0, transparent 50%, #000 50%, #000 100%);
  -webkit-mask-size: 100% 200%; mask-size: 100% 200%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: burnup 1.7s linear both;
}
.envwrap.burning .letter > * { animation: none; }
@keyframes burnup { from { -webkit-mask-position: 0 0; mask-position: 0 0; filter: none; } 30% { filter: sepia(.5) brightness(.92); } to { -webkit-mask-position: 0 100%; mask-position: 0 100%; filter: sepia(.9) brightness(.7); } }
.envwrap.burning .eback, .envwrap.burning .efront, .envwrap.burning .eflap { animation: envgone .7s 1.35s ease-in both; }
@keyframes envgone { to { opacity: 0; transform: translateY(14px) scale(.96); } }
.envwrap.burning .eflap { animation-name: envgone-flap; }
@keyframes envgone-flap { from { transform: rotateX(180deg); } to { opacity: 0; transform: rotateX(180deg) translateY(-14px); } }
