/* ---------- fonts (local, OFL) ---------- */
@font-face { font-family: 'Unbounded'; font-weight: 400 900; font-display: swap; src: url(fonts/unbounded-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-weight: 400 900; font-display: swap; src: url(fonts/unbounded-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Onest'; font-weight: 400 800; font-display: swap; src: url(fonts/onest-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Onest'; font-weight: 400 800; font-display: swap; src: url(fonts/onest-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Mono'; font-weight: 400 800; font-display: swap; src: url(fonts/mono-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Mono'; font-weight: 400 800; font-display: swap; src: url(fonts/mono-lat.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #0E0C12; --ink2: #17141D; --ink3: #221E2A; --ink4: #2E2938;
  --line: rgba(242, 234, 219, .1); --line2: rgba(242, 234, 219, .18);
  --paper: #F2EADB; --paper2: #E4D8C2; --text: #F2EADB; --muted: rgba(242, 234, 219, .56);
  --red: #FF3B2F; --red-deep: #C8231A; --acid: #D9FF3F;
  --ease: cubic-bezier(.23, 1, .32, 1);
  --spring: cubic-bezier(.34, 1.36, .5, 1);
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Onest', system-ui, -apple-system, sans-serif;
  --mono: 'Mono', ui-monospace, Menlo, monospace;
  --pad: 22px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--ink); color: var(--text); font: 16px/1.45 var(--body); }
body { min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
svg { display: block; }

/* Spotlight + film grain behind everything. */
body::before {
  content: ''; position: fixed; inset: -20%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40% 32% at 50% 18%, rgba(255, 59, 47, .16), transparent 70%),
    radial-gradient(50% 40% at 80% 90%, rgba(217, 255, 63, .05), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: .09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift { to { transform: translate(6%, 8%) scale(1.1); } }

#app { max-width: 480px; margin: 0 auto; }
.screen {
  position: relative; min-height: 100dvh; display: flex; flex-direction: column;
  padding: max(env(safe-area-inset-top), 14px) var(--pad) 0;
}
.body { flex: 1; padding-bottom: 8px; }
.center-stack { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 12px 0; }

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 700; text-align: center; }
h3 { font-size: 22px; margin-bottom: 14px; }
.kicker { margin: 0; font: 600 12px/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); display: inline-flex; align-items: center; gap: 10px; }
.kicker.red { color: var(--red); }
.muted { color: var(--muted); margin: 0; }
.center { text-align: center; }
.lead { font-size: 18px; margin: 0; max-width: 330px; }
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; text-align: center; }
.empty { color: var(--muted); text-align: center; padding: 18px 12px; margin: 0; }
.label { font-weight: 650; }
.desc { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.huge-name { font-size: 64px; line-height: 1.02; font-weight: 900; text-transform: uppercase; overflow-wrap: anywhere; }

/* ---------- buttons ---------- */
.btn {
  position: relative; min-height: 54px; padding: 0 20px; border-radius: 18px; flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; font-size: 15.5px; text-align: center; line-height: 1.15;
  transition: transform .16s var(--ease), background-color .2s, opacity .2s, box-shadow .16s var(--ease);
}
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn svg .f { fill: currentColor; stroke: none; }
.btn:active:not(:disabled) { transform: translateY(2px) scale(.985); }
.btn.primary { background: var(--paper); color: var(--ink); box-shadow: 0 4px 0 var(--paper2) inset, 0 -4px 0 rgba(0, 0, 0, .14) inset; }
.btn.red { background: var(--red); color: #fff; box-shadow: 0 -4px 0 rgba(0, 0, 0, .2) inset; }
.btn.big { min-height: 64px; font: 800 16px/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.btn.ghost { background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; color: var(--text); font-size: 14.5px; }
.btn.danger { background: transparent; box-shadow: 0 0 0 1px rgba(255, 59, 47, .45) inset; color: var(--red); }
.btn.danger.armed { background: var(--red); color: #fff; }
.btn.sq { flex: none; width: 54px; padding: 0; }
.btn:disabled { opacity: .32; }
.row { display: flex; gap: 10px; }
.row + .row, .dock .row { margin-top: 10px; }

.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; transition: transform .16s var(--ease); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg, .chip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip svg { width: 16px; height: 16px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; font: 600 13px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  transition: background-color .2s, color .2s, transform .16s var(--ease);
}
.chip:active { transform: scale(.95); }
.chip.strong { background: var(--ink3); color: var(--acid); min-width: 76px; justify-content: center; }
.chip.on { background: var(--paper); color: var(--ink); }
.chip em { font-style: normal; opacity: .5; }

/* Bottom dock: big targets in thumb reach. */
.dock {
  position: sticky; bottom: 0; z-index: 5; margin: 0 calc(-1 * var(--pad)); padding: 14px var(--pad) max(env(safe-area-inset-bottom), 18px);
  background: linear-gradient(to top, var(--ink) 70%, transparent);
}
.dock > .btn { width: 100%; }
.dock.row { display: flex; }

.bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 10px; }
.bar .count { justify-self: end; font: 600 13px var(--mono); color: var(--muted); }

/* ---------- avatars ---------- */
.ava {
  --c: var(--paper); flex: none; width: 42px; height: 42px; border-radius: 14px; display: inline-grid; place-items: center;
  background: var(--c); color: var(--ink); font: 800 18px/1 var(--display); transform: rotate(-4deg);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25);
}
.ava.sm { width: 24px; height: 24px; border-radius: 8px; font-size: 11px; transform: rotate(-3deg); box-shadow: none; vertical-align: -6px; margin-right: 6px; }
.ava.lg { width: 58px; height: 58px; border-radius: 18px; font-size: 26px; }
.ava.xl { width: 92px; height: 92px; border-radius: 28px; font-size: 44px; transform: rotate(-6deg); animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: rotate(4deg) translateY(-4px); } }

/* ---------- home ---------- */
.home { overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 2; }
.marquee { position: absolute; left: -10%; right: -10%; top: 54%; transform: rotate(-9deg); pointer-events: none; opacity: .07; }
.marquee div { white-space: nowrap; font: 900 64px/1 var(--display); animation: marquee 40s linear infinite; -webkit-text-stroke: 1.5px var(--paper); color: transparent; }
.marquee div + div { animation-direction: reverse; margin-top: 8px; color: var(--paper); -webkit-text-stroke: 0; }
@keyframes marquee { to { transform: translateX(-50%); } }

.hero { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; position: relative; z-index: 1; padding: 16px 0 8px; }
.eye { width: 132px; margin-bottom: 26px; overflow: visible; }
.hero::before { content: ''; position: absolute; left: 50%; top: 50%; width: 360px; height: 360px; transform: translate(-50%, -62%); background: radial-gradient(closest-side, rgba(255, 59, 47, .2), transparent); pointer-events: none; z-index: -1; }
.eye .lid { transform-origin: 100px 55px; animation: blink 6s infinite; }
.eye .eye-white { fill: var(--paper); }
.eye .eye-line { fill: none; stroke: var(--paper); stroke-width: 3; }
.eye .iris { fill: var(--red); }
.eye .pupil { fill: var(--ink); }
.eye .glint { fill: var(--paper); }
#pupil { transition: transform .5s var(--ease); }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.06); } }

.logo { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.logo-top { font: 700 15px var(--mono); letter-spacing: .42em; margin-right: -.42em; color: var(--muted); }
.logo-main { position: relative; display: inline-block; margin-top: 12px; font-size: clamp(40px, 12.2vw, 58px); font-weight: 900; letter-spacing: -.02em; }
.redact { position: relative; display: inline-block; }
.redact::after {
  content: ''; position: absolute; left: -.08em; right: -.08em; top: .04em; bottom: .02em; background: var(--red);
  transform: scaleX(0); transform-origin: left; animation: redact 7s var(--ease) infinite 1.2s;
}
@keyframes redact {
  0%, 62% { transform: scaleX(0); transform-origin: left; }
  68% { transform: scaleX(1); transform-origin: left; }
  80% { transform: scaleX(1); transform-origin: right; }
  86%, 100% { transform: scaleX(0); transform-origin: right; }
}
.logo-q { position: absolute; right: -.3em; top: -.5em; color: var(--red); font-size: 1.35em; transform: rotate(14deg); animation: wobble 3.6s ease-in-out infinite; }
@keyframes wobble { 50% { transform: rotate(-6deg) translateY(-3px); } }
.tagline { margin: 26px auto 0; max-width: 300px; color: var(--muted); font-size: 15.5px; }

/* Entrance: home pieces rise in sequence. */
.home .eye, .home .logo-top, .home .logo-main, .home .tagline, .home .dock > * { animation: rise .8s var(--ease) both; }
.home .logo-top { animation-delay: .08s; }
.home .logo-main { animation-delay: .14s; }
.home .tagline { animation-delay: .22s; }
.home .dock > *:nth-child(1) { animation-delay: .28s; }
.home .dock > *:nth-child(2) { animation-delay: .34s; }
.home .dock > *:nth-child(3) { animation-delay: .4s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* ---------- setup ---------- */
.players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.players li { animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 35ms); }
.player {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 10px; border-radius: 20px; text-align: left;
  background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; transition: transform .16s var(--ease), background-color .2s;
}
.player:active { transform: scale(.98); background: var(--ink3); }
.pname { flex: 1; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 92px; }
.pips i { width: 8px; height: 8px; border-radius: 3px; background: var(--ink4); transform: rotate(45deg); }
.pips i.on { background: var(--acid); }
.chev svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.add-player {
  width: 100%; margin-top: 10px; min-height: 58px; border-radius: 20px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 1.5px dashed var(--line2); color: var(--paper); font-weight: 700; transition: background-color .2s, transform .16s var(--ease);
}
.add-player:active { transform: scale(.98); background: var(--ink2); }
.add-player svg { width: 22px; height: 22px; fill: none; stroke: var(--acid); stroke-width: 2.4; stroke-linecap: round; }

.settings { margin-top: 26px; border-radius: 22px; background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; }
.setting { padding: 16px; }
.setting + .setting { border-top: 1px solid var(--line); }
.setting.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px; padding: 4px; border-radius: 14px; background: var(--ink); }
.seg::before { content: ''; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 11px; background: var(--paper); transition: transform .35s var(--spring); }
.seg[data-v="hint"]::before { transform: translateX(100%); }
.seg button { position: relative; height: 40px; font: 700 14px var(--display); transition: color .25s; }
.seg button[aria-pressed="true"] { color: var(--ink); }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--ink); padding: 4px; border-radius: 14px; }
.stepper button { width: 38px; height: 38px; border-radius: 10px; font-size: 22px; background: var(--ink3); transition: transform .12s var(--ease); }
.stepper button:active:not(:disabled) { transform: scale(.9); }
.stepper button:disabled { opacity: .3; }
.stepper b { width: 30px; text-align: center; font: 800 18px var(--display); }
.toggle { flex: none; width: 54px; height: 32px; border-radius: 99px; background: var(--ink4); position: relative; transition: background-color .25s; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); transition: transform .3s var(--spring); }
.toggle[aria-checked="true"] { background: var(--red); }
.toggle[aria-checked="true"] i { transform: translateX(22px); }

/* ---------- sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6, 5, 9, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .3s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 480px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px var(--pad) max(env(safe-area-inset-bottom), 20px); border-radius: 28px 28px 0 0;
  background: var(--ink2); box-shadow: 0 -1px 0 var(--line2), 0 -30px 60px rgba(0, 0, 0, .5);
  transform: translateY(105%); transition: transform .42s var(--ease);
}
.sheet.open { pointer-events: auto; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line2); margin: 0 auto 18px; }
.sheet-body > .btn, .sheet-body > .row { margin-top: 14px; }
.sheet-body > .btn { width: 100%; }

.field { display: block; margin-bottom: 18px; }
.field span { display: block; font: 600 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
input:not([type=checkbox]), select {
  width: 100%; height: 54px; padding: 0 16px; border-radius: 16px; border: 0; outline: 0; font-size: 17px;
  background: var(--ink); box-shadow: 0 0 0 1.5px var(--line) inset; transition: box-shadow .2s;
}
input:focus, select:focus { box-shadow: 0 0 0 2px var(--acid) inset; }
input::placeholder { color: rgba(242, 234, 219, .3); }
#pName { font: 700 20px var(--display); }
.words-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.words-head .label { font: 600 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.words-head em { font-style: normal; color: var(--paper); margin-left: 6px; }
.words-head em.ok { color: var(--acid); }
.words { display: grid; gap: 8px; }
.wrow { display: flex; gap: 8px; }
.words.masked input:not(:focus) { color: transparent; text-shadow: 0 0 9px rgba(242, 234, 219, .8); }
.dice { flex: none; width: 54px; height: 54px; border-radius: 16px; background: var(--ink3); display: grid; place-items: center; transition: transform .2s var(--spring); }
.dice:active { transform: rotate(-25deg) scale(.9); }
.dice svg { width: 24px; height: 24px; fill: none; stroke: var(--acid); stroke-width: 1.8; }
.dice svg .f { fill: var(--acid); stroke: none; }
.wrow.rolled input { animation: rolled .5s var(--ease); }
@keyframes rolled { from { box-shadow: 0 0 0 2px var(--acid) inset; transform: translateX(-4px); } }
.err { color: var(--red); margin: 8px 0 0; min-height: 0; font-weight: 600; }
.err:empty { display: none; }

table.stats { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.stats th { font: 600 10px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 0 4px 10px; text-align: center; vertical-align: bottom; }
.stats td { padding: 10px 4px; border-top: 1px solid var(--line); text-align: center; font: 700 16px var(--display); }
.stats td:first-child { text-align: left; font: 650 15px var(--body); }
.stats .who { display: flex; align-items: center; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.stats .who .ava { vertical-align: 0; }

.rules { list-style: none; counter-reset: r; padding: 0; margin: 0; display: grid; gap: 16px; }
.rules li { counter-increment: r; display: grid; grid-template-columns: 38px 1fr; gap: 2px 12px; }
.rules li::before { content: counter(r); grid-row: span 2; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--paper); color: var(--ink); font: 800 15px var(--display); transform: rotate(-5deg); }
.rules b { font-family: var(--display); font-size: 15px; }
.rules span { color: var(--muted); font-size: 14.5px; }
.pick-list { display: grid; gap: 8px; margin-top: 14px; }

/* ---------- deal: pass + card ---------- */
.progress { display: flex; justify-content: center; gap: 6px; margin-top: -4px; }
.progress i { width: 22px; height: 4px; border-radius: 2px; background: var(--ink4); transition: background-color .3s; }
.progress i.done { background: var(--paper); }
.progress i.now { background: var(--acid); }
.pass .huge-name { margin-top: 6px; }
.pass .muted { max-width: 280px; }

.flip { width: min(76vw, 320px); aspect-ratio: 5 / 7; perspective: 1400px; margin: 8px 0; }
.flip-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s var(--spring); }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip:not(.open):active .flip-inner { transform: scale(.97) rotateY(-8deg); transition-duration: .2s; }
.face { position: absolute; inset: 0; border-radius: 26px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; display: flex; }
.face.back {
  flex-direction: column; justify-content: space-between; align-items: stretch; padding: 22px; text-align: left;
  background: var(--paper); color: var(--ink); box-shadow: 0 30px 60px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .05) inset;
}
.face.back::before { content: ''; position: absolute; inset: 10px; border-radius: 18px; border: 1.5px dashed rgba(14, 12, 18, .25); pointer-events: none; }
.case { font: 700 12px var(--mono); letter-spacing: .16em; }
.redactions { display: grid; gap: 9px; }
.redactions i { height: 14px; background: var(--ink); border-radius: 2px; }
.redactions i:nth-child(1) { width: 82%; } .redactions i:nth-child(2) { width: 64%; } .redactions i:nth-child(3) { width: 90%; } .redactions i:nth-child(4) { width: 40%; }
.back-q { position: absolute; right: 18px; bottom: 34px; font: 900 150px/1 var(--display); color: var(--red); transform: rotate(10deg); opacity: .95; }
.stamp-small {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%) rotate(-14deg); padding: 6px 12px; border: 3px solid var(--red); border-radius: 8px;
  color: var(--red); font: 800 22px var(--display); letter-spacing: .06em; mix-blend-mode: multiply; opacity: .85;
}
.face.front { transform: rotateY(180deg); background: var(--ink3); box-shadow: 0 30px 60px rgba(0, 0, 0, .5); }
.face-in { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 28px 20px 24px; text-align: center; }
.face-in .tag { font: 700 12px var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.face-in .small { font-size: 14px; line-height: 1.35; max-width: 230px; }
.face-in.crew { background: var(--paper); color: var(--ink); }
.face-in.crew .tag, .face-in.crew .small { color: rgba(14, 12, 18, .55); }
.face-in .word { font-family: var(--display); font-weight: 800; line-height: 1.08; word-break: break-word; hyphens: auto; }
.face-in.imp { background: var(--red); color: #fff; background-image: repeating-linear-gradient(-45deg, rgba(0, 0, 0, .09) 0 14px, transparent 14px 28px); }
.imp-title { display: flex; flex-direction: column; gap: 6px; font-family: var(--display); }
.imp-title span { font-size: 22px; font-weight: 600; }
.imp-title em { font-style: normal; font-size: calc(min(76vw, 320px) / 9.6); font-weight: 900; letter-spacing: -.02em; text-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.face-in .small.hint { background: rgba(0, 0, 0, .22); padding: 10px 14px; border-radius: 12px; font-weight: 650; }
.flip.open .face-in > * { animation: rise .5s var(--ease) both .25s; }
.flip.open .face-in > :nth-child(2) { animation-delay: .32s; }
.flip.open .face-in > :nth-child(3) { animation-delay: .4s; }

/* ---------- discuss ---------- */
.slot { min-height: 100px; display: grid; place-items: center; width: 100%; }
.slot-name { display: block; font: 900 64px/1.02 var(--display); text-transform: uppercase; overflow-wrap: anywhere; color: var(--paper); }
.slot-name.tick { animation: tick .12s var(--ease); }
@keyframes tick { from { transform: translateY(-14px); opacity: .3; } }
.slot-name.landed { color: var(--ink); background: var(--acid); padding: 6px 16px 8px; border-radius: 14px; transform: rotate(-3deg); animation: land .6s var(--spring); }
@keyframes land { from { transform: scale(1.35) rotate(4deg); } }
.goes { margin: 0; font: 800 22px var(--display); transition: opacity .3s; }
.goes.dim { opacity: 0; }
.rule { margin: 6px 0 0; color: var(--muted); max-width: 320px; font-size: 15px; }
.timer { position: relative; width: 132px; height: 132px; margin-top: 10px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 7; }
.timer .track { stroke: var(--ink3); }
.timer .ring { stroke: var(--paper); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p) * 100); transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer .time { font: 800 30px var(--display); margin-top: -10px; }
.timer .tlabel { position: absolute; bottom: 32px; font: 600 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.timer.running .ring { stroke: var(--acid); }
.timer.urgent .ring { stroke: var(--red); }
.timer.urgent .time { color: var(--red); animation: pulse 1s infinite; }
.timer.done .time { color: var(--red); }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- vote ---------- */
.vote .sub { margin: -4px 0 16px; }
.suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.suspect { aspect-ratio: 4 / 4.8; perspective: 900px; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.s-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .7s var(--spring); }
.suspect:active:not(:disabled) .s-inner { transform: scale(.96); }
.suspect.sel .s-inner { transform: translateY(-6px) rotate(-2deg); }
.suspect.flipped .s-inner { transform: rotateY(180deg); }
.suspect.drum .s-inner { animation: drum .7s ease-in-out; }
@keyframes drum { 0%, 100% { transform: none; } 20% { transform: rotate(-3deg); } 40% { transform: rotate(3deg) scale(1.03); } 60% { transform: rotate(-4deg) scale(1.05); } 80% { transform: rotate(4deg) scale(1.05); } }
.s-face { position: absolute; inset: 0; border-radius: 22px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.s-front { background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; transition: box-shadow .2s, background-color .2s; }
.suspect.sel .s-front { background: var(--ink3); box-shadow: 0 0 0 3px var(--acid) inset, 0 14px 30px rgba(0, 0, 0, .4); }
.s-name { font-weight: 750; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-back { transform: rotateY(180deg); background: var(--ink3); }
.s-back.crew { background: var(--paper); color: var(--ink); }
.s-back.imp { background: var(--red); color: #fff; background-image: repeating-linear-gradient(-45deg, rgba(0, 0, 0, .1) 0 10px, transparent 10px 20px); }
.s-role { font: 900 13px var(--display); text-transform: uppercase; letter-spacing: .02em; padding: 5px 10px; border: 2.5px solid currentColor; border-radius: 8px; transform: rotate(-8deg); }
.suspect.flipped .s-role { animation: stampIn .5s var(--ease) both .35s; }
.suspect.out { opacity: .42; }
.suspect.out .s-name { text-decoration: line-through; }
.suspect.out .s-role { animation: none; }
@keyframes stampIn { from { transform: rotate(-8deg) scale(2.2); opacity: 0; } }
.miss-stamp.hit { color: var(--acid); }
.center-k { display: flex; justify-content: center; margin: -6px 0 14px; }
.face-in .team { font-size: 12.5px; line-height: 1.3; opacity: .9; max-width: 230px; margin-top: -10px; }
.miss-stamp { display: inline-block; font: 900 44px var(--display); color: var(--red); transform: rotate(-6deg); margin: 6px 0 12px; animation: stampIn .5s var(--ease) both .1s; }

/* ---------- last chance ---------- */
.last { background: radial-gradient(70% 50% at 50% 30%, rgba(255, 59, 47, .18), transparent 70%); }
.word-box { margin-top: 8px; padding: 18px 26px; border-radius: 20px; background: var(--paper); color: var(--ink); font-family: var(--display); font-weight: 800; line-height: 1.1; transform: rotate(-2deg) scale(.6); opacity: 0; transition: transform .6s var(--spring), opacity .3s; word-break: break-word; }
.word-box.show { transform: rotate(-2deg); opacity: 1; }
.sheet .word-box { margin: 6px auto 4px; text-align: center; width: fit-content; max-width: 100%; }
.sheet .kicker { display: flex; justify-content: center; margin-bottom: 10px; }

/* ---------- result ---------- */
.result .body { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6vh; }
.stamp-wrap { height: 120px; display: grid; place-items: center; }
.stamp {
  font: 900 46px/1 var(--display); letter-spacing: .02em; padding: 12px 20px 14px; border: 5px solid currentColor; border-radius: 14px;
  transform: rotate(-9deg); animation: slam .55s cubic-bezier(.5, 0, .2, 1.4) both .3s;
}
.crew-won .stamp { color: var(--acid); }
.imp-won .stamp { color: var(--red); }
.aborted .stamp { color: var(--muted); }
@keyframes slam { from { transform: rotate(-9deg) scale(3.4); opacity: 0; } 60% { opacity: 1; } }
.imp-won .stamp-wrap { animation: shake .4s ease-out .62s; }
@keyframes shake { 25% { transform: translate(-6px, 3px); } 50% { transform: translate(5px, -3px); } 75% { transform: translate(-3px, 2px); } }
.result-title { font-size: 28px; line-height: 1.1; margin-top: 18px; animation: rise .7s var(--ease) both .7s; }
.phrase { margin: 10px 0 0; color: var(--muted); font-style: italic; animation: rise .7s var(--ease) both .8s; }
.dossier {
  width: 100%; margin-top: 26px; border-radius: 24px; background: var(--paper); color: var(--ink); padding: 8px 20px; text-align: left; position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, .45); transform: rotate(-1.2deg); animation: dossier .8s var(--ease) both .9s;
}
@keyframes dossier { from { opacity: 0; transform: translateY(40px) rotate(3deg); } }
.d-row { display: flex; flex-direction: column; gap: 3px; padding: 13px 0; }
.d-row + .d-row { border-top: 1.5px dashed rgba(14, 12, 18, .2); }
.d-label { font: 700 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: rgba(14, 12, 18, .5); }
.d-val { font-weight: 700; font-size: 17px; }
.d-val .nm { display: inline-block; white-space: nowrap; margin-right: 12px; }
.d-val.big { font-family: var(--display); font-weight: 800; line-height: 1.1; }
.imp-won .d-row:first-child .d-val { color: var(--red-deep); }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ---------- library ---------- */
.lib-tools { display: grid; gap: 10px; margin-bottom: 14px; }
.lib-add { display: grid; grid-template-columns: 1fr auto 54px; gap: 8px; }
.lib-add select { width: auto; max-width: 128px; padding: 0 10px; font-size: 14px; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; }
.search { height: 46px !important; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 2px var(--pad); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.wordcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.wchip { display: inline-flex; align-items: center; gap: 2px; padding: 0 4px 0 12px; height: 36px; border-radius: 12px; background: var(--ink2); box-shadow: 0 0 0 1px var(--line) inset; font-size: 14.5px; transition: opacity .18s, transform .18s var(--ease); }
.wchip.mine { box-shadow: 0 0 0 1.5px var(--acid) inset; }
.wchip.gone { opacity: 0; transform: scale(.8); }
.wchip button { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--muted); }
.wchip button:active { background: var(--ink4); }
.wchip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 45; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 14px; background: var(--paper); color: var(--ink); font-weight: 650; font-size: 14px; white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
  transition: transform .35s var(--ease), opacity .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- screen transitions ---------- */
::view-transition-old(root) { animation: vt-out .2s ease-in both; }
::view-transition-new(root) { animation: vt-in .42s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-10px) scale(.985); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }

@media (min-width: 560px) {
  .screen { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- reorder & saved words ---------- */
.players li { position: relative; }
.player { padding-right: 56px; }
.grip { position: absolute; top: 0; right: 0; bottom: 0; width: 54px; display: grid; place-items: center; touch-action: none; cursor: grab; color: var(--muted); }
.grip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.players.sorting li { animation: none; transition: transform .18s var(--ease); }
.players.sorting li.dragging { transition: none; z-index: 2; }
.players li.dragging .player { background: var(--ink3); box-shadow: 0 0 0 1.5px var(--acid) inset, 0 14px 30px rgba(0, 0, 0, .5); }
.players li.dragging .grip { color: var(--acid); cursor: grabbing; }
.order-note { margin: 10px 4px 0; }
.saved { margin-top: 16px; }
.saved .label { display: block; margin-bottom: 8px; font: 600 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.saved .wchip .use { width: auto; height: 36px; padding: 0 2px 0 0; color: var(--text); font-size: 14.5px; border-radius: 0; }
.saved .wchip .use:active { background: none; opacity: .6; }
