@font-face { font-family: "Dela Gothic One"; font-weight: 400; font-display: swap; src: url(/fonts/dela-gothic-one-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "Dela Gothic One"; font-weight: 400; font-display: swap; src: url(/fonts/dela-gothic-one-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(/fonts/golos-text-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; font-weight: 400; font-display: swap; src: url(/fonts/golos-text-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(/fonts/golos-text-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; font-weight: 600; font-display: swap; src: url(/fonts/golos-text-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Golos Text"; font-weight: 700; font-display: swap; src: url(/fonts/golos-text-cyrillic-700-normal.woff2) format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; font-weight: 700; font-display: swap; src: url(/fonts/golos-text-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Golos Text"; font-weight: 800; font-display: swap; src: url(/fonts/golos-text-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "Golos Text"; font-weight: 800; font-display: swap; src: url(/fonts/golos-text-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "PT Mono"; font-weight: 400; font-display: swap; src: url(/fonts/pt-mono-cyrillic-400-normal.woff2) format("woff2"); unicode-range: U+0400-04FF; }
@font-face { font-family: "PT Mono"; font-weight: 400; font-display: swap; src: url(/fonts/pt-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }

:root {
  --room: #1a1612;
  --room-2: #25201a;
  --line: #3d352c;
  --ink: #f3ede1;
  --paper: #efe6d3;
  --paper-2: #e4d9c2;
  --paper-ink: #1d1a16;
  --lamp: #ffc533;
  --lamp-deep: #9c740a;
  --stamp: #d8382a;
  --stamp-blue: #2c5cc5;
  --display: "Dela Gothic One", Impact, sans-serif;
  --ui: "Golos Text", system-ui, sans-serif;
  --mono: "PT Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--room) radial-gradient(ellipse 90% 55% at 50% -12%, rgba(255, 197, 51, .14), transparent 62%) no-repeat;
  color: var(--ink);
  font: 17px/1.45 var(--ui);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
b, strong { font-weight: 800; }

.wrap { max-width: 600px; margin: 0 auto; padding: 24px 16px calc(40px + env(safe-area-inset-bottom)); }
.gap { height: 24px; }

/* ---------- типографика ---------- */
.logo { font-family: var(--display); font-size: 52px; line-height: .95; margin: 24px 0 16px; text-transform: uppercase; }
.logo span { color: var(--lamp); display: block; }
.pitch { font-size: 19px; font-weight: 600; margin: 0 0 32px; max-width: 420px; }
h2 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 0 0 16px; line-height: 1.1; }
h2 em { font-style: normal; color: var(--lamp); }
.label { display: block; font-weight: 700; margin-bottom: 8px; }
.note { font-weight: 700; margin: 16px 0; }
.num { color: var(--lamp); font-family: var(--display); }

/* ---------- кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  border: 0; border-radius: 10px; padding: 16px 20px; font-size: 18px; font-weight: 800;
  background: var(--lamp); color: var(--paper-ink);
  box-shadow: 0 5px 0 var(--lamp-deep);
  transform: translateY(0); transition: transform .06s, box-shadow .06s;
  margin-bottom: 5px;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--lamp-deep); }
.btn.second { background: transparent; color: var(--ink); box-shadow: none; border: 2px solid var(--line); }
.btn.second:active { transform: translateY(2px); }
.btn:disabled { filter: grayscale(1); cursor: default; }
.btn + .btn { margin-top: 12px; }

/* ---------- поля ---------- */
.field {
  width: 100%; background: var(--room-2); border: 2px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 18px; font-weight: 600; outline: none;
}
.field:focus { border-color: var(--lamp); }
.code-field { font-family: var(--display); font-size: 30px; letter-spacing: 10px; text-align: center; padding: 10px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: stretch; }
.join-row .btn { width: auto; padding: 0 24px; margin: 0; }
.or { margin: 24px 0 16px; font-weight: 700; }

/* ---------- лобби ---------- */
.code-block { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.code-block .big { font-family: var(--display); font-size: 64px; line-height: .9; color: var(--lamp); letter-spacing: 4px; }
.section { padding: 24px 0; border-top: 2px solid var(--line); }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.people li { display: flex; justify-content: space-between; align-items: baseline; font-size: 19px; font-weight: 700; }
.people .st { font-size: 15px; font-weight: 700; color: var(--lamp); }
.people .st.off { color: var(--stamp); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; font-weight: 700; }
.opt + .opt { margin-top: 12px; }
.stepper { display: flex; align-items: center; gap: 16px; }
.stepper button { width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--line); background: var(--room-2); font-size: 24px; font-weight: 800; }
.stepper b { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--lamp); min-width: 28px; text-align: center; }
.switch { position: relative; width: 60px; height: 34px; border-radius: 17px; border: 2px solid var(--line); background: var(--room-2); flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: left .15s; }
.switch.on { background: var(--lamp); border-color: var(--lamp); }
.switch.on::after { left: 30px; background: var(--paper-ink); }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: r; }
.rules li { display: grid; grid-template-columns: 32px 1fr; gap: 8px; font-weight: 600; }
.rules li::before { counter-increment: r; content: counter(r); font-family: var(--display); color: var(--lamp); font-size: 22px; line-height: 1.2; }

/* ---------- игра: шапка ---------- */
.hud { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; min-height: 64px; }
.hud .r { font-weight: 700; font-size: 16px; }
.hud .r b { font-family: var(--display); font-weight: 400; color: var(--lamp); font-size: 20px; }
.hud .nick { margin-top: 6px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.secs { font-family: var(--display); font-size: 48px; line-height: 1; color: var(--lamp); min-width: 72px; text-align: right; letter-spacing: -3px; }
.secs.low { color: var(--stamp); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.08); } }
.bar { height: 6px; background: var(--room-2); margin: 12px 0 24px; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--lamp); transform-origin: left; }
.bar.low i { background: var(--stamp); }
.sq { width: 14px; height: 14px; border-radius: 3px; display: inline-block; flex: none; }

.ghost-line { border-left: 4px solid var(--lamp); padding: 4px 0 4px 12px; font-weight: 700; margin-bottom: 24px; }

.who-list { display: flex; flex-wrap: wrap; gap: 16px 24px; margin-bottom: 24px; }
.who-list .w { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; min-width: 84px; }
.who-list .w b { font-size: 16px; }
.who-list .w .s { grid-column: 2; font-size: 14px; font-weight: 700; min-height: 20px; color: var(--lamp); }
.who-list .w .s.bot { color: var(--stamp); }
.who-list .w.out b { text-decoration: line-through; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--lamp); animation: blink 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* ---------- вопрос и ответ ---------- */
.question { font-size: 27px; line-height: 1.2; font-weight: 800; margin: 0 0 24px; }
.question.small { font-size: 19px; margin-bottom: 16px; }
.paper-field {
  width: 100%; height: 110px; resize: none; border: 0; border-radius: 3px; outline: none;
  background: var(--paper); color: var(--paper-ink); font: 20px/1.4 var(--mono); padding: 16px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .45);
}
.paper-field::placeholder { color: #7d7466; }
.under { display: flex; justify-content: space-between; gap: 16px; margin: 12px 0 16px; font-weight: 700; font-size: 15px; min-height: 22px; }
.under .ok { color: var(--lamp); }

/* ---------- показания ---------- */
.slips { display: grid; gap: 16px; }
@media (min-width: 640px) { .slips:not(.one) { grid-template-columns: 1fr 1fr; } }
.slip {
  position: relative; background: var(--paper); color: var(--paper-ink); border-radius: 3px; padding: 14px 16px 16px;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .45); transform: rotate(var(--rot, 0deg));
}
.slip.enter { animation: drop .35s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: var(--delay, 0s); }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) rotate(calc(var(--rot, 0deg) * 3)); } }
.slip .who { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .5px; }
.slip .said { font: 21px/1.35 var(--mono); margin-top: 8px; word-break: break-word; }
.slip .said.silent { color: var(--stamp); }
.slip .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: center; }
.tagbtn { border: 2px solid var(--paper-ink); background: transparent; color: var(--paper-ink); border-radius: 6px; padding: 5px 10px; font-weight: 800; font-size: 15px; }
.tagbtn.on { background: var(--paper-ink); color: var(--paper); }
.votebtn { margin-left: auto; border: 0; border-radius: 6px; padding: 8px 14px; font-weight: 800; font-size: 15px; background: var(--paper-ink); color: var(--paper); }
.slip.chosen { outline: 4px solid var(--lamp); outline-offset: 3px; }
.slip.chosen .votebtn { background: var(--lamp); color: var(--paper-ink); }
.vote-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.dossier .who .votebtn { margin-left: auto; }
.round-qs { list-style: none; counter-reset: q; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.round-qs li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; font-weight: 700; font-size: 16px; line-height: 1.3; }
.round-qs li::before { counter-increment: q; content: counter(q); font-family: var(--display); color: var(--lamp); font-size: 18px; }
.qa { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: baseline; margin-top: 8px; }
.qa .n { font-family: var(--display); font-size: 15px; }
.qa .a { font: 19px/1.3 var(--mono); word-break: break-word; }
.qa .a.silent { color: var(--stamp); }
.hud .step { font-weight: 700; font-size: 15px; margin-top: 4px; color: var(--lamp); min-height: 20px; }

/* ---------- печать ---------- */
.stamp {
  position: absolute; right: 12px; top: 50%; translate: 0 -50%;
  font-family: var(--display); font-size: 30px; line-height: 1; letter-spacing: 2px;
  color: var(--stamp); border: 4px solid currentColor; border-radius: 6px; padding: 6px 10px 4px;
  transform: rotate(-9deg); mix-blend-mode: multiply; opacity: .92; pointer-events: none;
}
.stamp.human { color: var(--stamp-blue); font-size: 22px; }
.stamp.slam { animation: slam .45s cubic-bezier(.3, 1.6, .5, 1) both .25s; }
@keyframes slam { from { opacity: 0; transform: rotate(-20deg) scale(2.4); } }
.slip.hit { animation: hit .25s ease-out .55s; }
@keyframes hit { 30% { transform: rotate(var(--rot)) translate(2px, 3px); } 60% { transform: rotate(var(--rot)) translate(-2px, -1px); } }
.stamp.small { font-size: 16px; border-width: 3px; padding: 4px 6px 2px; right: 10px; }
.stamp.small.human { font-size: 13px; }

.verdict-slip { padding: 24px 20px 28px; min-height: 140px; }
.verdict-slip .who { font-size: 18px; }
.verdict-line { font-family: var(--display); font-size: 30px; line-height: 1.1; margin: 8px 0 24px; }
.tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tally li { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.tally li .n { margin-left: auto; font-family: var(--display); color: var(--lamp); font-size: 22px; }

.count { font-family: var(--display); font-size: 160px; line-height: 1; color: var(--lamp); text-align: center; margin: 64px 0 24px; }
.count.pop { animation: pop .4s ease-out; }
@keyframes pop { from { transform: scale(1.4); opacity: .3; } }

/* ---------- кто есть кто ---------- */
.guess-row { padding: 16px 0; border-top: 2px solid var(--line); }
.guess-row:first-of-type { border-top: 0; }
.guess-row .who { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; margin-bottom: 12px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { border: 2px solid var(--line); background: var(--room-2); border-radius: 8px; padding: 10px 14px; font-weight: 800; font-size: 16px; }
.choice.on { background: var(--lamp); border-color: var(--lamp); color: var(--paper-ink); }
.choice.bot.on { background: var(--stamp); border-color: var(--stamp); color: var(--paper); }

/* ---------- финал ---------- */
.final-title { font-family: var(--display); font-size: 44px; line-height: 1; margin: 16px 0 12px; text-transform: uppercase; }
.final-title.humans { color: var(--lamp); }
.final-title.bots { color: var(--stamp); }
.final-sub { font-size: 19px; font-weight: 700; margin: 0 0 32px; }
.final-slip { padding-right: 104px; }
.final-slip .name { font: 21px/1.3 var(--mono); margin-top: 6px; }
.final-slip .stats { font-size: 14px; font-weight: 700; margin-top: 8px; }
.points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.points li { display: grid; grid-template-columns: 40px 1fr; gap: 8px; font-weight: 600; }
.points b { font-family: var(--display); font-weight: 400; color: var(--lamp); font-size: 20px; line-height: 1.25; }

.rank { padding: 16px 16px 14px; }
.rank-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; }
.rank .place { font-family: var(--display); font-size: 30px; line-height: 1; }
.rank .name { font: 20px/1.3 var(--mono); margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.rank .pts { font-family: var(--display); font-size: 42px; line-height: 1; }
.rank .more { margin: 12px 0 0 52px; }
.stamp.inline { position: static; translate: none; display: inline-block; font-size: 13px; border-width: 3px; padding: 3px 6px 1px; transform: rotate(-6deg); }
.why { list-style: none; margin: 10px 0 0 52px; padding: 0; display: grid; gap: 4px; }
.why[hidden] { display: none; }
.why li { display: grid; grid-template-columns: 36px 1fr; gap: 6px; font-size: 15px; font-weight: 600; }
.why li.plain { display: block; color: var(--stamp); font-weight: 700; }

/* ---------- лобби: код и ссылка ---------- */
.room-big { font-family: var(--display); font-size: 72px; line-height: .9; color: var(--lamp); letter-spacing: 4px; margin: 4px 0 16px; }
.share { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; }
.share .link { flex: 1 1 240px; font: 20px/1.3 var(--mono); word-break: break-all; }
.share .btn { width: auto; margin: 0; padding: 12px 18px; font-size: 16px; }

/* ---------- раскладка игры: игроки сбоку ---------- */
.layout { max-width: 600px; margin: 0 auto; padding: 24px 16px calc(40px + env(safe-area-inset-bottom)); }
.side { margin-top: 32px; padding-top: 24px; border-top: 2px solid var(--line); }
.side h3 { font-family: var(--display); font-weight: 400; font-size: 20px; margin: 0 0 16px; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.plist li { display: flex; align-items: center; gap: 10px; font-size: 18px; min-height: 28px; }
.plist li.out b { text-decoration: line-through; }
.plist .who-name { margin-left: auto; font-weight: 700; color: var(--lamp); }
.plist .stamp.inline { margin-left: auto; }
@media (min-width: 1000px) {
  .layout { max-width: 1000px; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; align-items: start; }
  .side { margin-top: 72px; padding: 0 0 0 32px; border-top: 0; border-left: 2px solid var(--line); position: sticky; top: 24px; }
}

/* ---------- правила ---------- */
.help {
  position: fixed; top: 16px; right: 16px; z-index: 8; width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid var(--lamp); background: var(--room); color: var(--lamp); font: 22px/1 var(--display);
}
.hud { padding-right: 56px; }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(10, 8, 6, .72); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 560px; background: var(--room-2); border: 2px solid var(--line); border-radius: 12px; padding: 24px; }
.sheet h2 + .rules, .sheet h2 + .points { margin-bottom: 24px; }

/* ---------- служебное ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--stamp); color: #fff; font-weight: 800; padding: 12px 18px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); text-align: center; z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.info { background: var(--lamp); color: var(--paper-ink); }
.conn { position: fixed; top: 0; left: 0; right: 0; background: var(--stamp); color: #fff; text-align: center; font-weight: 800; padding: 6px; font-size: 15px; display: none; z-index: 9; }
.conn.show { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
