/* Fonts self-hosted (SIL Open Font License) so the game works without Google Fonts */
@font-face { font-family: 'Pixelify Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/pixelify-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Pixelify Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/pixelify-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Silkscreen'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/silkscreen-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Silkscreen'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/silkscreen-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/nunito-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/nunito-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/nunito-latin-800-normal.woff2') format('woff2'); }
/* Civil Servants vs Law Offenders. Style follows the BestTop "Which Adviser Are You" booth:
   Sweetie 16 pixel palette, GE burgundy + gold card frames, hard pixel shadows,
   Pixelify Sans headings, Silkscreen labels, Nunito body. */
:root {
  --ground: #1a1c2c;
  --ground-lo: #131522;
  --panel: #333c57;
  --panel-hi: #566c86;
  --panel-lo: #29366f;
  --ink: #f4f4f4;
  --ink-2: #94b0c2;
  --gold: #ffcd75;
  --hot: #ef7d57;
  --hot-lo: #b13e53;
  --burg: #6f1b16;
  --burg-lo: #4d120e;
  --gegold: #c9a84c;
  --cream: #fcf3eb;
  --good: #41a6f6;
  --good-lo: #29366f;
  --evil: #ef5a6f;
  --evil-lo: #5d1a2a;
  --green: #38b764;
  --sky-1: #3b5dc9;
  --sky-2: #41a6f6;
  --shadow: 5px 5px 0 rgba(0, 0, 0, .45);
  --shadow-sm: 3px 3px 0 rgba(0, 0, 0, .45);
  --pix: "Pixelify Sans", "Silkscreen", monospace;
  --lbl: "Silkscreen", monospace;
  --body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { font-variant-ligatures: none; margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
body { min-height: 100dvh; }
img.spr { image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.boot { padding: 40px 16px; text-align: center; font-family: var(--lbl); color: var(--ink-2); }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.15; }
p { margin: 0; }

/* ---------- shared pieces ---------- */
.lbl { font-family: var(--lbl); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gegold); }
.pix { font-family: var(--pix); }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.good { color: var(--good); } .evil { color: var(--evil); } .gold { color: var(--gold); }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 22px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }

.panel { background: var(--panel); border: 3px solid var(--ground-lo); box-shadow: var(--shadow); padding: 16px; }
.panel.dark { background: #20243a; }
.frame { border: 4px solid var(--gegold); background: var(--burg); padding: 8px; box-shadow: var(--shadow); }
.frame > .inner { background: var(--ground); border: 3px solid var(--ground-lo); padding: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; border: 3px solid var(--ground-lo);
  background: var(--panel); color: var(--ink); font-family: var(--pix); font-size: 18px; font-weight: 700;
  box-shadow: var(--shadow); cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
}
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 rgba(0, 0, 0, .45); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn.primary { background: var(--gold); color: var(--ground); border-bottom: 6px solid var(--hot); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; font-size: 15px; padding: 0 14px; box-shadow: var(--shadow-sm); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--panel-hi); }
.btn.approve { background: #1f4e8c; border-color: var(--ground-lo); border-bottom: 6px solid var(--good-lo); }
.btn.reject { background: #8c2638; border-color: var(--ground-lo); border-bottom: 6px solid var(--evil-lo); }
.btn.sel { outline: 4px solid var(--gold); outline-offset: 2px; }
.iconbtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; color: var(--ink-2); cursor: pointer; }
.iconbtn:active { transform: translate(1px, 1px); }
.iconbtn:focus-visible { outline: 3px solid var(--gold); }
.iconbtn[disabled] { opacity: .25; cursor: default; }
svg.i { width: 20px; height: 20px; fill: currentColor; shape-rendering: crispEdges; flex: none; }

label.f { display: block; font-family: var(--lbl); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
input.field {
  width: 100%; height: 54px; padding: 0 14px; border: 3px solid var(--ground-lo); background: var(--ground-lo);
  color: var(--ink); font-family: var(--body); font-size: 18px; font-weight: 700; outline: none; border-radius: 0;
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, .35);
}
input.field:focus-visible { border-color: var(--gold); }
input.code { font-family: var(--pix); text-transform: uppercase; letter-spacing: .35em; font-size: 24px; }
.err { background: var(--evil-lo); border: 3px solid var(--evil); padding: 10px 12px; font-weight: 700; font-size: 14px; }
.note { background: #20243a; border: 3px solid var(--panel-hi); padding: 10px 12px; font-size: 14px; color: var(--ink-2); }

.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; font-family: var(--lbl); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: var(--ground-lo); color: var(--ink-2); border: 2px solid var(--ground-lo); white-space: nowrap; }
.chip.gold { background: var(--gold); color: var(--ground); }
.chip.good { background: var(--good-lo); color: #bfe3ff; }
.chip.evil { background: var(--evil-lo); color: #ffc2cb; }
.chip.ok { background: #1f5b3a; color: #c9f5d8; }

.sign { display: inline-block; font-family: var(--lbl); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 6px 10px; background: var(--burg); color: var(--cream); border: 3px solid var(--gegold); box-shadow: var(--shadow-sm); white-space: nowrap; }
.sign.gold { background: var(--gegold); color: var(--ground); border-color: var(--ground-lo); }

details.acc { border-top: 3px solid var(--panel); }
details.acc summary { list-style: none; cursor: pointer; padding: 14px 0; display: flex; justify-content: space-between; align-items: center; font-family: var(--pix); font-size: 18px; min-height: 44px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc[open] summary svg { transform: rotate(180deg); }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--panel); border: 3px solid var(--gold); color: var(--ink); padding: 12px 16px; font-weight: 700; z-index: 90; max-width: calc(100% - 32px); box-shadow: var(--shadow); animation: pop 160ms steps(3); }
.toast.bad { border-color: var(--evil); }
.overlay { position: fixed; inset: 0; background: rgba(10, 11, 20, .78); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade 160ms steps(3); }
.sheet { width: 100%; max-width: 440px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateX(-50%) translateY(8px); opacity: 0; } }

/* ---------- phone ---------- */
.phone { max-width: 520px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.roomtag { font-family: var(--pix); font-size: 16px; letter-spacing: .2em; color: var(--ink-2); }
.roomtag b { color: var(--gold); }
.dot { width: 10px; height: 10px; background: var(--ink-2); display: inline-block; }
.dot.live { background: var(--green); } .dot.down { background: var(--evil); }

.hero { position: relative; margin: 0 -16px 18px; height: 230px; overflow: hidden; border-bottom: 6px solid var(--burg); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.hero .cast { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; gap: 4px; align-items: flex-end; }
.title { text-align: center; margin: 0 0 18px; }
.title h1 { font-family: var(--pix); font-size: 34px; line-height: 1.02; color: var(--good); text-shadow: 3px 3px 0 var(--ground-lo); }
.title h1 .vs { display: block; font-family: var(--lbl); font-size: 13px; letter-spacing: .3em; color: var(--gegold); margin: 8px 0; text-shadow: none; }
.title h1 .bad { color: var(--evil); }
.title p { margin-top: 10px; color: var(--ink-2); }

.ops { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.op { background: var(--panel); border: 3px solid var(--ground-lo); box-shadow: var(--shadow-sm); text-align: center; padding: 6px 2px 4px; }
.op .n { font-family: var(--lbl); font-size: 9px; color: var(--ink-2); letter-spacing: .08em; }
.op .sz { font-family: var(--pix); font-size: 24px; line-height: 1.1; }
.op .ft { font-family: var(--lbl); font-size: 8px; color: var(--ink-2); min-height: 12px; }
.op.now { border-color: var(--gold); }
.op.success { background: var(--good-lo); }
.op.success .sz { color: var(--good); }
.op.fail { background: var(--evil-lo); }
.op.fail .sz { color: var(--evil); }
.meter { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-family: var(--lbl); font-size: 10px; color: var(--ink-2); letter-spacing: .08em; }
.pips { display: flex; gap: 4px; }
.pip { width: 16px; height: 10px; background: var(--panel); border: 2px solid var(--ground-lo); }
.pip.on { background: var(--evil); }

.phase { margin-top: 14px; }
.phase h2 { font-family: var(--pix); font-size: 26px; }
.phase .kick { font-family: var(--lbl); font-size: 11px; letter-spacing: .14em; color: var(--gold); margin-bottom: 6px; text-transform: uppercase; }
.bigres { font-family: var(--pix); font-size: 32px; line-height: 1.05; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.playcard { min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border: 4px solid var(--ground-lo); box-shadow: var(--shadow); cursor: pointer; font-family: var(--pix); font-size: 20px; color: var(--ink); }
.playcard:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 rgba(0, 0, 0, .45); }
.playcard.clean { background: #1f4e8c; border-bottom: 8px solid var(--good-lo); }
.playcard.leak { background: #8c2638; border-bottom: 8px solid var(--evil-lo); }
.playcard svg { width: 44px; height: 44px; }

/* role card, built like the BestTop trading card */
.rcard { border: 5px solid var(--gegold); background: var(--burg); padding: 8px; box-shadow: var(--shadow); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.rcard .in { background: var(--ground); border: 3px solid var(--ground-lo); padding: 14px; }
.rcard .head { border: 3px solid var(--good); background: #1d2a48; padding: 10px 12px; }
.rcard.tm-evil .head { border-color: var(--evil); background: #3a1824; }
.rcard .head .t { font-family: var(--pix); font-size: 26px; line-height: 1.05; color: var(--good); margin-top: 4px; }
.rcard.tm-evil .head .t { color: var(--evil); }
.rcard .art { margin-top: 12px; border: 3px solid var(--gegold); height: 190px; position: relative; overflow: hidden; background: linear-gradient(#2c4a76, #1a1c2c 72%); }
.rcard.tm-evil .art { background: linear-gradient(#5a2333, #1a1c2c 72%); }
.rcard .art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16px; background: var(--burg); border-top: 3px solid var(--gegold); }
.rcard .art img { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1; }
.rcard .art .side { position: absolute; top: 8px; right: 8px; z-index: 2; }
.rcard .foot { background: var(--burg); text-align: center; padding: 8px 0 2px; font-family: var(--lbl); font-size: 10px; letter-spacing: .2em; color: var(--gegold); }
.rcard.hidden .in { text-align: center; padding: 24px 14px; }
.rcard.hidden .art { margin: 0 auto 14px; width: 100%; background: repeating-linear-gradient(45deg, #222842 0 10px, #1d2238 10px 20px); }
.rcard.compact.hidden .art { height: 120px; }
.sees { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.sees .who { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel); border: 3px solid var(--ground-lo); padding: 6px 10px; font-weight: 800; }

.plist { display: flex; flex-direction: column; gap: 6px; }
.pl { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 3px solid var(--ground-lo); padding: 4px 6px 4px 4px; min-height: 58px; box-shadow: var(--shadow-sm); }
.pl .av { width: 40px; height: 50px; background: #20243a; border: 2px solid var(--ground-lo); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; flex: none; }
.pl .av.tap { cursor: pointer; border-color: var(--gold); }
.pl .nm { font-weight: 800; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .sub { font-family: var(--lbl); font-size: 10px; letter-spacing: .06em; color: var(--ink-2); }
.pl .seat { font-family: var(--pix); font-size: 14px; color: var(--ink-2); width: 18px; text-align: center; flex: none; }
.pl.off { opacity: .55; }
.pl.pick { cursor: pointer; }
.pl.picked { background: #5b4a24; border-color: var(--gold); }
.tick { width: 28px; height: 28px; border: 3px solid var(--ground-lo); background: var(--ground-lo); display: flex; align-items: center; justify-content: center; flex: none; }
.pl.picked .tick { background: var(--gold); color: var(--ground); }

.tg { display: flex; gap: 12px; align-items: center; padding: 10px 0; }
.tg + .tg { border-top: 3px solid var(--ground-lo); }
.tg .av { width: 36px; height: 45px; flex: none; display: flex; align-items: flex-end; justify-content: center; }
.tg .t { font-family: var(--pix); font-size: 17px; }
.tg .d { font-size: 13px; color: var(--ink-2); line-height: 1.35; }
.sw { position: relative; width: 58px; height: 32px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.sw .tr { position: absolute; inset: 0; background: var(--ground-lo); border: 3px solid var(--ground-lo); }
.sw .th { position: absolute; top: 5px; left: 5px; width: 22px; height: 22px; background: var(--panel-hi); transition: transform 120ms steps(3); }
.sw input:checked ~ .tr { background: var(--green); }
.sw input:checked ~ .th { transform: translateX(26px); background: var(--cream); }
.sw input:focus-visible ~ .tr { outline: 3px solid var(--gold); outline-offset: 2px; }
.sw input:disabled { cursor: default; }

.bigcode { font-family: var(--pix); font-size: 56px; letter-spacing: .18em; line-height: 1; color: var(--gold); text-shadow: 4px 4px 0 var(--ground-lo); }
.hist { padding: 10px 0; border-top: 3px solid var(--panel); font-size: 14px; }
.hist:first-child { border-top: 0; }
.board { width: 100%; border-collapse: collapse; font-size: 15px; }
.board th { font-family: var(--lbl); font-size: 10px; letter-spacing: .1em; color: var(--ink-2); text-align: right; padding: 6px 4px; font-weight: 400; }
.board th:first-child, .board td:first-child { text-align: left; }
.board td { padding: 8px 4px; border-top: 3px solid var(--ground-lo); text-align: right; font-family: var(--pix); }
.board td.n { font-family: var(--body); font-weight: 800; }

/* ---------- table screen (iPad) ---------- */
.tv { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; background: var(--ground); }
.tv-top { display: flex; align-items: center; gap: 20px; padding: calc(14px + env(safe-area-inset-top)) 24px 14px; background: var(--ground); border-bottom: 4px solid var(--ground-lo); }
.tv-top .brand { font-family: var(--pix); font-size: 22px; line-height: 1; }
.tv-top .brand small { display: block; font-family: var(--lbl); font-size: 10px; letter-spacing: .2em; color: var(--gegold); margin-top: 4px; }
.tv-ops { display: flex; gap: 10px; margin-left: auto; }
.tv-op { width: 78px; background: var(--panel); border: 4px solid var(--ground-lo); box-shadow: var(--shadow-sm); text-align: center; padding: 4px 0; }
.tv-op .n { font-family: var(--lbl); font-size: 10px; color: var(--ink-2); }
.tv-op .sz { font-family: var(--pix); font-size: 30px; line-height: 1.05; }
.tv-op .ft { font-family: var(--lbl); font-size: 9px; color: var(--ink-2); }
.tv-op.now { border-color: var(--gold); }
.tv-op.success { background: var(--good-lo); } .tv-op.success .sz { color: var(--good); }
.tv-op.fail { background: var(--evil-lo); } .tv-op.fail .sz { color: var(--evil); }
.tv-rej { text-align: center; font-family: var(--lbl); font-size: 10px; color: var(--ink-2); letter-spacing: .1em; }
.tv-rej .pips { justify-content: center; margin-top: 6px; }
.tv-rej .pip { width: 22px; height: 14px; }
.tv-stage { position: relative; overflow: hidden; }
.tv-stage canvas.bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.tv-cast { position: absolute; left: 0; right: 0; bottom: 0; height: 64%; display: flex; justify-content: center; align-items: flex-end; gap: 1.2vw; padding: 0 2vw; }
.actor { position: relative; display: flex; flex-direction: column; align-items: center; transition: transform 300ms steps(4); }
.actor img { filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, .35)); }
.actor .plate { margin-top: 6px; background: var(--ground); border: 3px solid var(--ground-lo); padding: 3px 8px; font-weight: 800; font-size: clamp(12px, 1.5vw, 18px); max-width: 11vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-shadow: var(--shadow-sm); }
.actor.raid { transform: translateY(-14px); }
.actor.raid .plate { background: var(--gold); color: var(--ground); }
.actor.off { opacity: .45; }
.actor .above { position: absolute; bottom: 100%; margin-bottom: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bubble { background: var(--cream); color: var(--ground); font-family: var(--pix); font-size: 18px; padding: 2px 10px; border: 3px solid var(--ground-lo); box-shadow: var(--shadow-sm); }
.bubble.ok { background: var(--green); color: var(--ground); }
.bubble.yes { background: var(--good); color: var(--ground); }
.bubble.no { background: var(--evil); color: var(--ground); }
.actor.jump img { animation: hop 600ms steps(4) infinite; }
@keyframes hop { 50% { transform: translateY(-10px); } }
.actor.walkin { animation: walkin 700ms steps(6); }
@keyframes walkin { from { transform: translateX(-60px); opacity: 0; } }
.tv-bottom { padding: 16px 24px calc(18px + env(safe-area-inset-bottom)); background: var(--burg); border-top: 6px solid var(--gegold); display: flex; align-items: center; gap: 24px; min-height: 120px; }
.tv-bottom .msg { flex: 1; }
.tv-bottom .msg .k { font-family: var(--lbl); font-size: 12px; letter-spacing: .2em; color: var(--gold); text-transform: uppercase; }
.tv-bottom .msg .h { font-family: var(--pix); font-size: clamp(26px, 3.4vw, 44px); line-height: 1.05; color: var(--cream); margin-top: 4px; }
.tv-bottom .msg .s { color: #f1d9c9; font-size: clamp(14px, 1.6vw, 20px); margin-top: 6px; }
.tv-banner { position: absolute; left: 50%; top: 10%; transform: translateX(-50%); z-index: 5; text-align: center; animation: drop 420ms steps(5); }
.tv-banner .b { font-family: var(--pix); font-size: clamp(34px, 5vw, 72px); line-height: 1; padding: 16px 30px; border: 5px solid var(--ground-lo); box-shadow: var(--shadow); white-space: nowrap; }
.tv-banner .b.good { background: var(--good); color: var(--ground); }
.tv-banner .b.evil { background: var(--evil); color: var(--ground); }
.tv-banner .b.gold { background: var(--gold); color: var(--ground); }
.tv-banner .s { display: inline-block; margin-top: 10px; background: var(--ground); border: 3px solid var(--ground-lo); padding: 6px 14px; font-weight: 800; font-size: clamp(14px, 1.8vw, 22px); }
@keyframes drop { from { transform: translateX(-50%) translateY(-40px); opacity: 0; } }
.tv-opfx { position: absolute; left: 50%; top: 5%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 18px; z-index: 5; }
.tv-cards { display: flex; gap: 16px; }
.tv-banner.static { position: static; transform: none; animation-name: dropin; }
@keyframes dropin { from { transform: translateY(-30px); opacity: 0; } }
.flip { width: clamp(70px, 7.5vw, 104px); aspect-ratio: 3 / 4; perspective: 600px; }
.flip .fi { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 500ms steps(6); }
.flip.on .fi { transform: rotateY(180deg); }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; border: 4px solid var(--ground-lo); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-family: var(--pix); font-size: clamp(13px, 1.4vw, 18px); text-align: center; }
.flip .back { background: repeating-linear-gradient(45deg, var(--burg) 0 8px, var(--burg-lo) 8px 16px); border-color: var(--gegold); }
.flip .front { transform: rotateY(180deg); }
.flip .front.clean { background: #1f4e8c; } .flip .front.leak { background: #8c2638; }
.flip .face svg { width: 40%; height: auto; }
.tv-side { position: absolute; top: 16px; right: 20px; z-index: 3; width: min(320px, 30vw); }
.tv-side.left { right: auto; left: 20px; }
.qrbox { background: var(--cream); padding: 12px; border: 5px solid var(--gegold); box-shadow: var(--shadow); text-align: center; color: var(--ground); }
.qrbox svg, .qrbox img { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.qrbox .u { font-weight: 800; font-size: 14px; margin-top: 6px; word-break: break-all; }
.tv-code { font-family: var(--pix); font-size: clamp(60px, 9vw, 120px); letter-spacing: .14em; color: var(--gold); text-shadow: 6px 6px 0 var(--ground-lo); line-height: 1; }
.tv-join { position: absolute; left: 24px; top: 20px; z-index: 3; }
.tv-board { background: rgba(26, 28, 44, .92); border: 4px solid var(--ground-lo); box-shadow: var(--shadow); padding: 12px 14px; }
.tv-board h3 { font-family: var(--lbl); font-size: 11px; letter-spacing: .16em; color: var(--gegold); margin-bottom: 4px; }
.tv-hint { position: absolute; right: 12px; top: 6px; font-family: var(--lbl); font-size: 9px; color: rgba(255, 255, 255, .5); z-index: 6; }

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

.tv-fame { width: min(300px, 28vw); background: var(--ground); border: 4px solid var(--gegold); padding: 8px 12px; box-shadow: var(--shadow); }
.tv-fame h3 { font-family: var(--lbl); font-size: 10px; letter-spacing: .16em; color: var(--gegold); margin-bottom: 2px; }
.tv-fame .fr { display: flex; gap: 8px; align-items: center; font-size: 15px; padding: 2px 0; }
.tv-fame .fr b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-fame .fr span:first-child { width: 14px; color: var(--gold); font-family: var(--pix); }
.tv-fame .fr span:last-child { font-family: var(--pix); color: var(--ink-2); }

/* ---------- v3: tips, dress up, presets, marks, recap, tutorial ---------- */
button.op { font: inherit; color: inherit; cursor: pointer; width: 100%; }
button.op[disabled] { cursor: default; }
button.op:not([disabled]):active { transform: translate(2px, 2px); }
.iconbtn.on { color: var(--gold); }
.tip { background: #2b2a1c; border: 3px solid var(--gold); box-shadow: var(--shadow-sm); }
.tip-h { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: none; border: 0; padding: 10px 12px; cursor: pointer; text-align: left; font-family: var(--pix); font-size: 17px; color: var(--gold); min-height: 44px; }
.tip.shut .tip-h svg:last-child { transform: rotate(-90deg); }
.tip ul { margin: 0; padding: 0 14px 4px 30px; font-size: 15px; line-height: 1.45; }
.tip li { margin: 4px 0; }
.tip-f { padding: 4px 12px 10px; font-family: var(--lbl); font-size: 9px; letter-spacing: .08em; color: #b9a46a; }
.tipline { background: #2b2a1c; border-left: 4px solid var(--gold); padding: 8px 10px; font-size: 14px; color: #f1e2b8; }
.rtips { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.rtips li { margin: 4px 0; }
.av-big { width: 84px; height: 100px; background: #20243a; border: 3px solid var(--gold); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; cursor: pointer; flex: none; box-shadow: var(--shadow-sm); }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset { position: relative; background: var(--panel); border: 3px solid var(--ground-lo); box-shadow: var(--shadow-sm); color: var(--ink); padding: 10px 6px 8px; cursor: pointer; text-align: center; display: flex; flex-direction: column; gap: 2px; min-height: 76px; }
.preset b { font-family: var(--pix); font-size: 17px; }
.preset span { font-size: 11px; color: var(--ink-2); line-height: 1.25; }
.preset em { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); font-style: normal; font-family: var(--lbl); font-size: 8px; letter-spacing: .08em; background: var(--gold); color: var(--ground); padding: 2px 6px; white-space: nowrap; }
.preset.rec { border-color: var(--gold); }
.preset:active { transform: translate(2px, 2px); }
.mark { min-width: 44px; height: 36px; border: 3px solid var(--ground-lo); background: var(--ground-lo); color: var(--ink-2); font-family: var(--lbl); font-size: 11px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mark.trust { background: #1f5b3a; color: #c9f5d8; }
.mark.sus { background: var(--evil-lo); color: #ffc2cb; }
.pl.mk-trust { border-left: 6px solid var(--green); }
.pl.mk-sus { border-left: 6px solid var(--evil); }
.raidrow, .rc-team { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-p { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; background: #20243a; border: 2px solid var(--ground-lo); padding: 4px 6px 2px; font-size: 12px; font-weight: 800; max-width: 84px; }
.rc-p span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.minicards { display: flex; justify-content: center; gap: 6px; }
.mc { width: 38px; height: 50px; display: inline-flex; align-items: center; justify-content: center; border: 3px solid var(--ground-lo); box-shadow: var(--shadow-sm); }
.mc.clean { background: #1f4e8c; } .mc.leak { background: #8c2638; }
.ld { display: flex; align-items: center; gap: 16px; justify-content: center; padding: 14px; border: 4px solid var(--good); background: var(--good-lo); }
.ld.evil { border-color: var(--evil); background: var(--evil-lo); }
.ld .bigres.good { color: var(--good); } .ld .bigres.evil { color: var(--evil); }
.recap { background: var(--panel); border: 3px solid var(--ground-lo); padding: 10px; box-shadow: var(--shadow-sm); }
.recap + .recap { margin-top: 8px; }
.recap .rc-team { margin: 8px 0 4px; }
.tut { text-align: left; }
.tut-art { display: flex; justify-content: center; align-items: flex-end; gap: 8px; min-height: 96px; background: linear-gradient(#2c4a76, #1a1c2c 80%); border: 3px solid var(--gegold); border-bottom: 10px solid var(--burg); padding: 10px 6px 0; margin-bottom: 12px; }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots span { width: 10px; height: 10px; background: var(--panel); border: 2px solid var(--ground-lo); }
.dots span.on { background: var(--gold); }
.sheet.dress { max-height: calc(100dvh - 32px); overflow-y: auto; }
.dz-prev { display: flex; justify-content: center; background: linear-gradient(#2c4a76, #1a1c2c 80%); border: 3px solid var(--gegold); border-bottom: 10px solid var(--burg); padding-top: 10px; }
.dz-uni { display: flex; justify-content: center; gap: 2px; flex-wrap: wrap; }
.dz .lbl { margin-bottom: 6px; }
.dz-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.dz-o { flex: none; min-width: 44px; min-height: 52px; background: #20243a; border: 3px solid var(--ground-lo); display: flex; align-items: flex-end; justify-content: center; cursor: pointer; padding: 2px; }
.dz-o.on { border-color: var(--gold); background: #3a3420; }
.swatch { width: 30px; height: 30px; display: block; margin: auto; border: 2px solid var(--ground-lo); }
.tv-tut { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 3; width: min(400px, 34vw); background: rgba(26, 28, 44, .93); border: 4px solid var(--gegold); box-shadow: var(--shadow); padding: 12px 14px; }
.tv-tut .tut-art { min-height: 70px; }
.tv-tut h2 { font-size: 22px; }
.tv-tut p { font-size: 15px; }
.tv-timer { text-align: center; background: var(--ground); border: 4px solid var(--ground-lo); padding: 6px 14px; box-shadow: var(--shadow-sm); }
.tv-timer .pix { font-size: 30px; color: var(--cream); line-height: 1.1; }
.tv-start { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(10, 11, 20, .8); padding: 20px; }
.tv-start .frame { width: min(420px, 100%); }
.actor .plate small { font-family: var(--lbl); font-size: 9px; color: var(--evil); }
