:root {
  --gold: #e8c77b;
  --gold-hi: #fff1c1;
  --gold-lo: #9b6a1f;
  --ink: #f5f1e8;
  --muted: #aeb0c8;
  --panel: rgba(13, 15, 38, .8);
  --line: rgba(232, 199, 123, .26);
  --blood: #ef4444;
  --moon: #9fb4ff;
  --display: "Cinzel", "Trajan Pro", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --ui: ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.2, 1.35, .4, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--ui);
  color: var(--ink);
  background: #070918;
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.sky .layer { position: absolute; inset: 0; opacity: 0; transition: opacity 2.4s ease; }
.sky .night { background: radial-gradient(130% 90% at 50% 110%, #1f2a63 0%, #0b1026 48%, #03040b 100%); }
.sky .dusk { background: radial-gradient(130% 90% at 50% 115%, #9b4668 0%, #3a2458 40%, #0d0f26 100%); }
.sky .day { background: radial-gradient(130% 90% at 50% 110%, #ffe6b3 0%, #a9cbe4 38%, #4a7cb3 100%); }
.sky .blood { background: radial-gradient(130% 90% at 50% 110%, #7a1118 0%, #2c0810 48%, #070206 100%); }
body[data-sky="night"] .sky .night, body[data-sky="dusk"] .sky .dusk,
body[data-sky="day"] .sky .day, body[data-sky="blood"] .sky .blood { opacity: 1; }

.stars {
  position: absolute; inset: -50%;
  background-image:
    radial-gradient(1.6px 1.6px at 20px 30px, #fff, transparent),
    radial-gradient(1px 1px at 90px 120px, #fffc, transparent),
    radial-gradient(1.3px 1.3px at 160px 60px, #fff, transparent),
    radial-gradient(1px 1px at 230px 180px, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 300px 90px, #fff, transparent),
    radial-gradient(1px 1px at 50px 220px, #fffa, transparent);
  background-size: 340px 260px;
  animation: drift 260s linear infinite, twinkle 5s ease-in-out infinite alternate;
  transition: opacity 2.4s;
}
.stars.far { background-size: 210px 170px; opacity: .45; animation-duration: 420s, 7s; }
body[data-sky="day"] .stars { opacity: 0; }
@keyframes drift { to { transform: translate3d(-340px, 130px, 0); } }
@keyframes twinkle { from { filter: brightness(.55); } to { filter: brightness(1.35); } }

.orb {
  position: absolute; width: 20vmin; height: 20vmin; right: 8vw; top: 8vh; border-radius: 50%;
  background: radial-gradient(circle at 40% 36%, #fffdf2, #f6e2a6 58%, #d9a246);
  box-shadow: 0 0 60px 18px #f6e2a640, 0 0 200px 70px #f6e2a61c;
  transition: all 2.6s cubic-bezier(.5, 0, .2, 1);
}
.orb i { position: absolute; border-radius: 50%; background: #c9953f; opacity: .2; transition: opacity 2s; }
.orb i:nth-child(1) { width: 22%; height: 22%; left: 24%; top: 26%; }
.orb i:nth-child(2) { width: 13%; height: 13%; left: 60%; top: 20%; }
.orb i:nth-child(3) { width: 26%; height: 26%; left: 56%; top: 56%; }
body[data-sky="day"] .orb {
  top: 4vh; right: 72vw;
  background: radial-gradient(circle, #fffef4, #ffdc6e 55%, #ffb627);
  box-shadow: 0 0 90px 40px #ffd96666, 0 0 260px 130px #ffd96630;
}
body[data-sky="day"] .orb i { opacity: 0; }
body[data-sky="blood"] .orb { background: radial-gradient(circle at 40% 36%, #ffc2b0, #d9412b 60%, #6e0d0d); box-shadow: 0 0 100px 30px #d9412b55; }

.fog {
  position: absolute; left: -30%; right: -30%; bottom: -4vh; height: 38vh; pointer-events: none;
  background:
    radial-gradient(40% 60% at 30% 70%, #c7d2fe22, transparent 70%),
    radial-gradient(35% 50% at 70% 80%, #c7d2fe1c, transparent 70%);
  filter: blur(18px);
  animation: fog 38s ease-in-out infinite alternate;
  opacity: .8; transition: opacity 2s;
}
.fog.two { animation-duration: 55s; animation-direction: alternate-reverse; bottom: 4vh; opacity: .5; }
body[data-sky="day"] .fog { opacity: .15; }
@keyframes fog { to { transform: translateX(12%); } }
.hills {
  position: absolute; left: -10%; right: -10%; bottom: -6vh; height: 24vh;
  background:
    radial-gradient(60% 100% at 25% 100%, #04050d 60%, transparent 61%),
    radial-gradient(55% 90% at 78% 100%, #070918 60%, transparent 61%);
  transition: filter 2.4s, opacity 2.4s;
}
body[data-sky="day"] .hills { filter: brightness(3.4) hue-rotate(70deg) saturate(.55); opacity: .5; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { border-radius: 10px; box-shadow: 0 4px 14px #000a, 0 0 0 1px #ffffff14; }
.word { font-family: var(--display); font-size: 21px; letter-spacing: .07em; font-weight: 700; text-shadow: 0 2px 12px #000c; white-space: nowrap; }
.ver {
  font-family: var(--ui); font-size: 10px; font-weight: 700; letter-spacing: .03em;
  color: var(--gold); margin-left: 4px; vertical-align: super; opacity: .9;
}
.top-right { display: flex; gap: 8px; align-items: center; }
.chip {
  font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(10px); letter-spacing: .14em; text-transform: uppercase; cursor: pointer;
}
.chip:hover { border-color: var(--gold); }

.btn {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--ink);
  padding: 11px 18px; border-radius: 14px; cursor: pointer; font-weight: 700; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s, background .2s, box-shadow .25s, border-color .2s;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); border-color: #e8c77b66; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #f6dc9c, #c99a45 60%, #b5832f); color: #211504; border-color: #fbe7b5;
  box-shadow: 0 8px 26px #e8c77b40, inset 0 1px 0 #fff9, inset 0 -2px 0 #0002;
  text-shadow: 0 1px 0 #fff6;
}
.btn.primary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(110deg, transparent 30%, #fff8 50%, transparent 70%);
}
.btn.primary:hover:not(:disabled)::after { transform: translateX(120%); transition: transform .8s ease; }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 36px #e8c77b66, inset 0 1px 0 #fff9; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn.sel { border-color: var(--accent, var(--gold)); box-shadow: 0 0 0 2px var(--accent, var(--gold)); }
.btn .ico { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; color: var(--gold); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px; }
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(20, 22, 52, .7); cursor: pointer; position: relative;
  display: grid; place-items: center; transition: background .2s, transform .15s, border-color .2s;
}
.icon-btn:hover { background: rgba(48, 52, 104, .9); border-color: #e8c77b77; }
.icon-btn:active { transform: scale(.92); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn .slash { position: absolute; inset: 12px; width: auto; height: auto; color: #ff6b6b; display: none; }
.icon-btn.off .slash { display: block; }
.icon-btn.off { background: rgba(127, 29, 29, .6); border-color: #ff6b6b66; }
.icon-btn.danger { color: #ff9b9b; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.cam-hint { max-width: 300px; margin-left: auto !important; margin-right: auto !important; }
.cam-hint .link-btn { padding: 0 2px; font-size: inherit; }

.join { display: grid; place-items: center; padding: 16px; overflow: auto; }
.join-card {
  position: relative; width: min(410px, 100%); text-align: center; padding: 26px 28px 20px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(24, 26, 62, .82), rgba(10, 11, 30, .88));
  border: 1px solid var(--line); backdrop-filter: blur(16px);
  box-shadow: 0 40px 100px #000b, inset 0 1px 0 #ffffff12;
  animation: rise .9s var(--ease-out) both;
}
.join-card::before {
  content: ""; position: absolute; inset: 7px; border-radius: 22px; border: 1px solid #e8c77b1c; pointer-events: none;
}
.join-card h1 { font-family: var(--display); font-size: 36px; margin: 10px 0 0; letter-spacing: .06em; line-height: 1.1; }
.tagline { color: var(--muted); margin: 4px 0 18px; font-style: italic; }
.preview { display: grid; justify-items: center; gap: 4px; }
.pcard { width: 118px; aspect-ratio: 1 / 1.36; perspective: 900px; animation: float 6s ease-in-out infinite; }
.pcard .flipper { font-size: 11.8px; }
.pcard .meter { position: absolute; left: 12%; right: 12%; bottom: 9%; height: 5px; border-radius: 9px; background: #0009; overflow: hidden; }
.pcard .meter i { display: block; height: 100%; width: calc(var(--lvl, 0) * 100%); background: linear-gradient(90deg, #34d399, #fde047); transition: width .08s; }
.field { display: grid; gap: 6px; text-align: left; margin-bottom: 12px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input {
  font: inherit; font-size: 16px; color: var(--ink); background: rgba(0, 0, 0, .35); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; outline: none; width: 100%; text-transform: none; letter-spacing: normal;
  transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px #e8c77b26; }
.or-row { display: flex; gap: 10px; align-items: center; margin: 16px 0 10px; color: var(--muted); font-size: 12px; }
.or-row .rule { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.code-row { display: flex; gap: 8px; }
.code-row input { text-transform: uppercase; letter-spacing: .4em; text-align: center; font-weight: 800; font-family: var(--display); }
.code-row input::placeholder { color: #ffffff30; }
.err { color: #ff9b9b; min-height: 1.4em; margin: 10px 0 0; font-size: 14px; }
.fine { color: var(--muted); font-size: 12px; margin: 4px 0 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(.97); } }
@keyframes float { 50% { transform: translateY(-6px) rotate(-2deg); } }

.game { display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.stage { position: relative; overflow-x: hidden; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.stage::-webkit-scrollbar { display: none; }
.stage-inner { position: relative; width: 100%; min-height: 100%; }
.dock {
  justify-self: center; display: flex; align-items: center; gap: 10px;
  margin: 6px 12px max(12px, env(safe-area-inset-bottom)); padding: 7px 10px; border-radius: 99px;
  background: rgba(10, 11, 30, .6); border: 1px solid var(--line); backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px #0009;
}
.dock-sep { width: 1px; height: 26px; background: var(--line); }

.table { position: absolute; pointer-events: none; transition: all .9s var(--ease-out); }
.table-top {
  position: absolute; inset: 0; border-radius: 50%;
  background:
    repeating-radial-gradient(ellipse at 50% 50%, #ffffff05 0 2px, transparent 2px 9px),
    radial-gradient(ellipse at 50% 38%, #7a5533 0%, #4a301b 55%, #24160b 100%);
  box-shadow: 0 0 0 3px #1a0f07, 0 0 0 5px #8a6a3a55, 0 40px 90px #000d, inset 0 0 90px #000c, inset 0 10px 30px #ffffff10;
  transition: filter 2.4s;
}
body[data-sky="night"] .table-top { filter: brightness(.42) saturate(.55) hue-rotate(190deg); }
body[data-sky="blood"] .table-top { filter: brightness(.55) saturate(1.2) hue-rotate(-20deg); }
.candle {
  position: absolute; left: 50%; top: 50%; width: 70%; height: 90%; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(closest-side, #ffb34740, #ff8a1a14 55%, transparent);
  animation: flicker 3.2s ease-in-out infinite; transition: opacity 2s, filter 2s;
}
body[data-sky="night"] .candle { filter: hue-rotate(200deg) saturate(.6); opacity: .7; }
@keyframes flicker { 0%, 100% { opacity: .9; transform: scale(1); } 40% { opacity: .75; transform: scale(.97); } 70% { opacity: 1; transform: scale(1.02); } }
.grave-label {
  position: absolute; font-family: var(--display); font-size: 11px; letter-spacing: .3em;
  text-transform: uppercase; color: var(--muted); transform: translateX(-50%); transition: all .9s var(--ease-out); white-space: nowrap;
}

.panel {
  position: absolute; left: 0; top: 0; z-index: 3;
  padding: 16px 20px 16px; border-radius: 24px; text-align: center;
  background: linear-gradient(180deg, rgba(26, 28, 66, .86), rgba(10, 11, 30, .92));
  border: 1px solid var(--line); backdrop-filter: blur(16px);
  box-shadow: 0 24px 70px #000b, inset 0 1px 0 #ffffff14;
  transition: transform .9s var(--ease-out), width .5s;
}
.panel::before { content: ""; position: absolute; inset: 6px; border-radius: 19px; border: 1px solid #e8c77b18; pointer-events: none; }
.panel .emblem {
  width: 60px; height: 60px; margin: -48px auto 2px; position: relative;
  filter: drop-shadow(0 6px 16px #000c);
  animation: pop .7s var(--spring) both;
}
.panel .emblem .ico { width: 100%; height: 100%; }
.panel .emblem.plain { border-radius: 50%; padding: 13px; background: radial-gradient(circle at 40% 35%, #2a2f6e, #0e1030); border: 3px solid; border-color: #f3d58f #a87a2a #7a5212 #d9ae5c; color: var(--gold); }
.panel .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); }
.panel h2 { font-family: var(--display); font-size: 23px; margin: 2px 0 6px; letter-spacing: .03em; line-height: 1.18; text-wrap: balance; }
.panel p { margin: 6px 0; text-wrap: pretty; }
.panel .muted { color: var(--muted); font-size: 13px; }
.panel .row { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.panel .row:empty { display: none; }
.panel .sleep { color: #b9c6ff; font-style: italic; }
.panel .spirit { color: #bfe3ff; font-size: 13px; margin-top: 8px; }
.divider { position: relative; height: 12px; margin: 4px auto 8px; width: 70%; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 35%, transparent 47%, transparent 53%, var(--gold) 65%, transparent); opacity: .6; }
.divider::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; background: var(--gold); transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 0 10px var(--gold); }
.code {
  font-family: var(--display); font-size: 38px; font-weight: 700; letter-spacing: .3em; line-height: 1.1;
  padding-left: .3em; color: var(--gold-hi); text-shadow: 0 0 26px #e8c77b77, 0 2px 0 #7a5212;
}
.deck { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 10px 0 2px; }
.pip { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 800; color: var(--muted); }
.pip .ico { width: 30px; height: 30px; filter: drop-shadow(0 3px 6px #000a); transition: transform .2s var(--spring); }
.pip:hover .ico { transform: scale(1.18) rotate(-6deg); }
.picks { display: grid; gap: 4px; margin: 8px 0 0; font-size: 13px; }
.picks span { color: var(--muted); }
.picks b { color: var(--ink); }

.timer { --p: 1; --accent: var(--gold); position: relative; width: 50px; height: 50px; margin: 6px auto 2px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3.5; }
.timer .track { stroke: #ffffff18; }
.timer .bar { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p) * 100); transition: stroke-dashoffset .25s linear, stroke .3s; filter: drop-shadow(0 0 4px var(--accent)); }
.timer span { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.timer.low { --accent: var(--blood); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.headline { display: grid; gap: 2px; justify-items: center; }
.headline .skull { width: 34px; height: 34px; color: #efe7d4; filter: drop-shadow(0 0 12px #ff4d4d88); animation: pop .6s var(--spring) both; }
.rolechip { display: inline-flex; gap: 6px; align-items: center; font-weight: 800; color: color-mix(in srgb, var(--c) 55%, white); vertical-align: middle; }
.rolechip .ico { width: 24px; height: 24px; }
.winner { font-family: var(--display); font-size: 28px; line-height: 1.15; margin: 2px 0 4px; }
.winner.village { color: #ffe08a; text-shadow: 0 0 30px #ffd96688; }
.winner.wolves { color: #ff8a8a; text-shadow: 0 0 30px #ff3b3b88; }
@keyframes pop { from { transform: scale(0) rotate(-30deg); opacity: 0; } }

.seat {
  position: absolute; left: 0; top: 0; z-index: 1;
  perspective: 1100px;
  transition: transform .9s var(--ease-out), width .6s ease, font-size .6s ease;
  will-change: transform;
}
.seat.leaving { transition: opacity .5s, transform .5s; opacity: 0; }
.seat .shadow {
  position: absolute; left: 10%; right: 10%; bottom: -1.2em; height: 1.6em; border-radius: 50%;
  background: radial-gradient(closest-side, #000c, transparent); filter: blur(3px); transition: transform .5s, opacity .5s;
}
.seat.entering .shadow { animation: shadowIn 1.15s var(--ease-out) both; animation-delay: var(--delay, 0ms); }
@keyframes shadowIn { from { transform: scale(.2); opacity: 0; } }
.tilt { position: relative; transform-style: preserve-3d; transition: transform .35s var(--ease-out); }
.card {
  --accent: var(--gold);
  position: relative; width: 100%; aspect-ratio: 1 / 1.36;
  transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
}
.seat.entering .card { animation: deal 1.15s cubic-bezier(.18, .9, .22, 1.04) both; animation-delay: var(--delay, 0ms); }
@keyframes deal {
  0% { transform: translate3d(0, -40px, 520px) rotateY(-560deg) rotateX(55deg) scale(.25); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.card.flipping { animation: lift .95s cubic-bezier(.3, .1, .3, 1) both; animation-delay: var(--flip-delay, 0ms); }
@keyframes lift {
  0% { transform: none; }
  45% { transform: translateZ(120px) rotateZ(-4deg) scale(1.05); }
  100% { transform: none; }
}
.flipper {
  position: absolute; inset: 0;
  transform-style: preserve-3d; -webkit-transform-style: preserve-3d;
  transition: transform .95s cubic-bezier(.45, .05, .2, 1);
  transition-delay: var(--flip-delay, 0ms);
}
.flipper.down { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: .9em; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 .9em 2.2em #000b;
  transition: box-shadow .3s, filter .8s;
}
.face.front { background: #111633; }
.face.front video { width: 100%; height: 100%; object-fit: cover; display: block; background: #111633; }
.seat.mirror .face.front video { transform: scaleX(-1); }
.face.front .avatar {
  position: absolute; inset: 0; display: none; place-items: center;
  font-family: var(--display); font-size: 2.8em; font-weight: 700; color: #fff; text-shadow: 0 .06em .3em #0008;
  background:
    radial-gradient(circle at 50% 42%, hsl(var(--h) 60% 60% / .35), transparent 45%),
    linear-gradient(160deg, hsl(var(--h) 45% 32%), hsl(calc(var(--h) + 50) 55% 12%));
}
.face.front.novideo video { visibility: hidden; }
.face.front .avatar canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#previewVideo.mirror { transform: scaleX(-1); }
.face.front.novideo .avatar { display: grid; }
.frame {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 2px #c9a55a, inset 0 0 0 4px #0009, inset 0 0 0 5px #e8c77b44;
  background: linear-gradient(180deg, transparent 58%, #000a 100%);
}
.frame::before {
  content: ""; position: absolute; inset: .42em; border-radius: .55em; border: 1px solid #e8c77b33;
  -webkit-mask: linear-gradient(#000 0 0) top left / 1.6em 1.6em no-repeat, linear-gradient(#000 0 0) top right / 1.6em 1.6em no-repeat,
    linear-gradient(#000 0 0) bottom left / 1.6em 1.6em no-repeat, linear-gradient(#000 0 0) bottom right / 1.6em 1.6em no-repeat;
  mask: linear-gradient(#000 0 0) top left / 1.6em 1.6em no-repeat, linear-gradient(#000 0 0) top right / 1.6em 1.6em no-repeat,
    linear-gradient(#000 0 0) bottom left / 1.6em 1.6em no-repeat, linear-gradient(#000 0 0) bottom right / 1.6em 1.6em no-repeat;
  border-color: var(--gold);
}
.frame::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0; transition: opacity .3s;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%), #ffffff38, transparent 55%);
}
.tilt.hover .frame::after { opacity: 1; }
.face.back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at 50% 42%, #2a3778, #0e1336 62%, #070a1e);
  color: var(--gold);
  box-shadow: inset 0 0 0 2px #c9a55a, inset 0 0 0 4px #0b0f2a, inset 0 0 0 5px #e8c77b55, 0 .9em 2.2em #000b;
}
.back-art { position: absolute; inset: 0; display: grid; place-items: center; }
.back-art::before {
  content: ""; position: absolute; inset: .5em; border-radius: .55em; border: 1px solid #e8c77b44;
  background:
    repeating-linear-gradient(45deg, #ffffff08 0 .35em, transparent .35em .7em),
    repeating-linear-gradient(-45deg, #ffffff08 0 .35em, transparent .35em .7em);
}
.back-art .emblem { width: 74%; position: relative; filter: drop-shadow(0 0 .7em #e8c77b55); }
.shine {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(115deg, transparent 38%, #ffe9b030 48%, #fff5 50%, #ffe9b030 52%, transparent 62%);
  background-size: 300% 100%; animation: sheen 7s ease-in-out infinite;
}
@keyframes sheen { 0%, 60% { background-position: 120% 0; } 100% { background-position: -120% 0; } }

.card > .badge, .card > .votes, .card > .mark, .card > .tag, .card > .ribbon, .card > .mic-off, .card > .ring { transform: translateZ(3px); }
.badge {
  position: absolute; width: 3.2em; height: 3.2em; min-width: 26px; min-height: 26px; padding: 0; border: 0; background: none;
  cursor: pointer; filter: drop-shadow(0 .3em .5em #000c); animation: pop .6s var(--spring) both; z-index: 2;
}
.badge .ico { width: 100%; height: 100%; pointer-events: none; display: block; }
.badge:hover { filter: drop-shadow(0 .3em .5em #000c) brightness(1.12); }
.badge.role { top: -.9em; left: -.9em; }
.badge.mayor { top: -.9em; right: -.9em; }
[data-role] { cursor: pointer; }
.mic-off {
  position: absolute; right: .55em; top: .55em; width: 1.9em; height: 1.9em; min-width: 18px; min-height: 18px;
  border-radius: 50%; padding: .35em; background: #b91c1ccc; color: #fff; box-shadow: 0 .2em .5em #000a; pointer-events: none;
  animation: pop .4s var(--spring) both;
}
.card:has(.badge.mayor:not([hidden])) .mic-off { top: 2.6em; }
.mic-off .ico { width: 100%; height: 100%; display: block; }
.tag {
  position: absolute; left: 50%; top: 42%; translate: -50% 0; font-size: max(10px, .8em); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  padding: .25em .8em; border-radius: 99px; background: #000b; border: 1px solid #ffffff22; white-space: nowrap; pointer-events: none;
}
.ribbon {
  position: absolute; left: -4%; right: -4%; bottom: -.75em; height: 2.3em; min-height: 22px;
  display: flex; align-items: center; justify-content: center; gap: .3em; padding: 0 9%;
  font-size: max(11px, 1em); font-weight: 800; color: #2a1a05; letter-spacing: .01em; white-space: nowrap;
  background: linear-gradient(180deg, #f7e2a8, #d4a751 55%, #b7863a);
  clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%);
  filter: drop-shadow(0 .2em .3em #000a);
  text-shadow: 0 1px 0 #fff5;
}
.ribbon .nm { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ribbon .you { font-size: .78em; opacity: .7; font-weight: 700; }
.ribbon .host { color: #7a3d00; font-size: .9em; }
.ribbon .kick { border: 0; background: #0000; color: #7f1d1d; cursor: pointer; padding: 0 .1em; font-size: 1.2em; line-height: 1; font-weight: 900; }
.seat.me .ribbon { background: linear-gradient(180deg, #fff4cf, #ecc56c 55%, #c9953f); }
.seat.out .ribbon { background: linear-gradient(180deg, #9aa0ae, #5e6472); color: #1c1f26; text-shadow: none; }
.seat.out .ribbon .nm { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.seat.spectator .ribbon { background: linear-gradient(180deg, #a9b6d8, #6d7aa0); color: #10131f; }
.votes {
  position: absolute; left: .3em; right: .3em; bottom: 2em; pointer-events: none;
  display: flex; flex-wrap: wrap-reverse; justify-content: center; gap: .2em;
}
.vchip {
  position: relative;
  min-width: 2.1em; height: 2.1em; padding: 0 .35em; border-radius: 99px; display: grid; place-items: center;
  font-size: max(10px, .9em); font-weight: 900; color: #fff; border: 2px solid #fff9;
  background: hsl(var(--h) 60% 42%); box-shadow: 0 .2em .5em #000a;
  animation: chipIn .5s var(--spring) both;
}
.vchip.x2::after {
  content: "×2"; position: absolute; top: -.7em; right: -.8em; padding: .05em .3em; border-radius: 99px;
  font-size: .62em; font-weight: 900; color: #2a1a05; background: linear-gradient(180deg, #fde68a, #eab308); box-shadow: 0 .1em .3em #000a;
}
@keyframes chipIn { from { transform: translateY(-2em) scale(.3); opacity: 0; } }
.mark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .3s; }
.mark .ico { width: 46%; height: auto; filter: drop-shadow(0 0 1em var(--accent)); }
.card.chosen .mark { opacity: 1; animation: stamp .55s var(--spring) both; }
@keyframes stamp { from { transform: scale(2.2) rotate(-18deg); opacity: 0; } }
.ring {
  position: absolute; inset: -4px; border-radius: 1.05em; pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 3px #6ee7b7, 0 0 1.4em #34d399aa; transition: opacity .18s;
}
.card.speaking .ring { opacity: 1; }

.card[data-kind="kill"] { --accent: #ff3b3b; }
.card[data-kind="see"] { --accent: #b197fc; }
.card[data-kind="protect"] { --accent: #2dd4bf; }
.card[data-kind="elect"] { --accent: #facc15; }
.card[data-kind="vote"] { --accent: #fb923c; }
.card.targetable { cursor: pointer; }
.card.targetable .face { box-shadow: 0 0 0 2px var(--accent), 0 0 1.6em color-mix(in srgb, var(--accent) 55%, transparent), 0 .9em 2.2em #000b; animation: beckon 1.8s ease-in-out infinite; }
.card.targetable:hover .face { box-shadow: 0 0 0 3px var(--accent), 0 0 2.6em var(--accent), 0 .9em 2.2em #000b; }
.card.chosen .face { box-shadow: 0 0 0 3px var(--accent), 0 0 3em var(--accent), 0 .9em 2.2em #000b; animation: none; }
@keyframes beckon { 50% { box-shadow: 0 0 0 2px var(--accent), 0 0 2.6em var(--accent), 0 .9em 2.2em #000b; } }
.seat.awake .face.front { box-shadow: 0 0 0 2px #9fb4ffaa, 0 0 2.4em #7c93ff77, 0 .9em 2.2em #000b; }

.seat.out .face.front { filter: grayscale(1) brightness(.55) contrast(1.1); }
.seat.spectator .face.front { filter: saturate(.35) brightness(.8); }
.seat.offline .face { filter: brightness(.4) grayscale(.5); }
.seat.dying .card { animation: shake .7s cubic-bezier(.36, .07, .19, .97) both; }
.seat.dying .face.front::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, #ff1a1a66, #5c0000cc); animation: bloodflash 1.4s ease both;
}
@keyframes shake { 10%, 90% { transform: translateX(-.15em); } 20%, 80% { transform: translateX(.3em); } 30%, 50%, 70% { transform: translateX(-.5em) rotate(-2deg); } 40%, 60% { transform: translateX(.5em) rotate(2deg); } }
@keyframes bloodflash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

.reveal {
  position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; align-content: center; gap: 20px;
  background: radial-gradient(circle at 50% 45%, #0b0f2acc, #000e); backdrop-filter: blur(6px);
  animation: fadein .4s both; perspective: 1400px;
}
.reveal-card { position: relative; width: min(290px, 68vw); aspect-ratio: 1 / 1.4; font-size: min(29px, 6.8vw); animation: deal 1.1s cubic-bezier(.18, .9, .22, 1.04) both; transform-style: preserve-3d; }
.reveal-card .flipper { transition-duration: 1.2s; }
.reveal-card .face { border-radius: .8em; }
.reveal-card .face.front {
  display: grid; align-content: center; justify-items: center; gap: .15em; padding: .8em; text-align: center;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c) 45%, #1a1d48), #0b0d24 70%);
  box-shadow: inset 0 0 0 2px #c9a55a, inset 0 0 0 5px #0009, inset 0 0 0 6px #e8c77b55, 0 0 80px color-mix(in srgb, var(--c) 45%, transparent), 0 30px 80px #000;
}
.reveal-card .medal-big { width: 58%; filter: drop-shadow(0 .3em .6em #000c); }
.reveal-card .medal-big .ico { width: 100%; height: auto; display: block; }
.reveal-card h3 { font-family: var(--display); font-size: 1.25em; margin: .2em 0 0; color: color-mix(in srgb, var(--c) 40%, white); letter-spacing: .04em; }
.reveal-card .team { font-size: .4em; font-weight: 800; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.reveal-card p { font-size: .46em; line-height: 1.4; margin: .5em 0 0; color: #e7e2f5; }
.reveal-card .pack { font-size: .42em; color: #ffb4b4; margin-top: .4em; }
.reveal-hint { color: var(--muted); font-size: 13px; }

.sheet-wrap {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: #000a; backdrop-filter: blur(5px); animation: fadein .25s both;
}
.sheet {
  --c: var(--gold);
  position: relative; width: min(360px, 100%); text-align: center; padding: 24px 22px 18px; border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, #10133a), #0a0c22 70%);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow: 0 0 70px color-mix(in srgb, var(--c) 28%, transparent), 0 30px 80px #000c;
  animation: sheet .55s var(--spring) both;
}
@keyframes sheet { from { opacity: 0; transform: perspective(800px) rotateX(35deg) translateY(40px) scale(.9); } }
.sheet-ico { width: 100px; height: 100px; margin: -66px auto 4px; filter: drop-shadow(0 8px 20px #000c); }
.sheet-ico .ico { width: 100%; height: 100%; }
.sheet h3 { font-family: var(--display); font-size: 28px; margin: 4px 0 0; color: color-mix(in srgb, var(--c) 45%, white); }
.sheet-team { font-size: 11px; font-weight: 800; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; text-align: left; margin: 14px 0 16px; font-size: 13px; padding: 12px 14px; border-radius: 14px; background: #0005; }
.sheet dt { color: var(--gold); font-weight: 800; }
.sheet dd { margin: 0; }

.curtain {
  position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 10px; pointer-events: none; z-index: 20;
  opacity: 0;
}
.curtain-ico { width: 84px; height: 84px; color: var(--glow, #8fa6ff); }
.curtain-ico .ico { width: 100%; height: 100%; filter: drop-shadow(0 0 24px var(--glow, #8fa6ff)); }
.curtain span {
  font-family: var(--display); font-size: clamp(38px, 8vw, 92px); letter-spacing: .08em; font-weight: 700;
  text-shadow: 0 0 40px #000, 0 0 90px var(--glow, #8fa6ff);
}
.curtain.show { animation: curtain 2.6s ease both; }
.curtain.show span, .curtain.show .curtain-ico { animation: title 2.6s var(--ease-out) both; }
@keyframes curtain { 0% { opacity: 0; background: #0000; } 18%, 70% { opacity: 1; background: #000000a0; } 100% { opacity: 0; background: #0000; } }
@keyframes title { 0% { transform: scale(.82) translateY(24px); letter-spacing: .5em; filter: blur(10px); } 30% { transform: none; letter-spacing: .08em; filter: none; } 100% { transform: scale(1.05); } }

.fx { position: fixed; inset: 0; pointer-events: none; z-index: 25; overflow: hidden; }
.fx i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: confetti var(--d, 4s) linear var(--delay, 0s) both; }
.fx i.ember { top: auto; bottom: -20px; width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 10px currentColor; background: currentColor; animation-name: ember; }
@keyframes confetti { to { transform: translate3d(var(--x, 0), 110vh, 0) rotate(var(--r, 720deg)); } }
@keyframes ember { 0% { opacity: 0; } 15% { opacity: 1; } to { transform: translate3d(var(--x, 0), -105vh, 0); opacity: 0; } }

body.asleep .stage::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 35%, #000b 100%);
  animation: fadein 1.5s both;
}
@keyframes fadein { from { opacity: 0; } }

.toasts {
  position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); translate: -50% 0; z-index: 30;
  display: grid; gap: 8px; justify-items: center; width: min(92vw, 420px); pointer-events: none;
}
.toast {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 16px 9px 10px; border-radius: 16px; background: rgba(12, 14, 36, .92); border: 1px solid var(--line);
  box-shadow: 0 14px 34px #000b; font-size: 14px; font-weight: 600;
  animation: toast 5.2s var(--ease-out) both;
}
.toast .ico { width: 28px; height: 28px; flex: none; }
.toast.plain { padding-left: 16px; }
.toast.vision { border-color: #b197fc; box-shadow: 0 0 34px #8b5cf655, 0 14px 34px #000b; }
.toast.pack { border-color: #ff6b6b; box-shadow: 0 0 34px #ef444455, 0 14px 34px #000b; }
.toast.mayor { border-color: #facc15; box-shadow: 0 0 34px #eab30855, 0 14px 34px #000b; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-18px) scale(.95); } 7%, 86% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px) scale(.98); } }
.banner {
  position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; translate: -50% 0; z-index: 40; padding: 9px 18px; border-radius: 99px;
  background: #7a1a22ee; border: 1px solid #ff9b9b66; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px #000a;
}

@media (max-width: 560px) {
  .word { font-size: 18px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .panel { padding: 14px 14px 12px; border-radius: 20px; }
  .panel h2 { font-size: 19px; }
  .panel .emblem { width: 50px; height: 50px; margin-top: -40px; }
  .code { font-size: 30px; }
  .icon-btn { width: 42px; height: 42px; }
  .dock { gap: 7px; }
}
@media (hover: none) { .tilt { transform: none !important; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
