@font-face { font-family: 'Vazirmatn'; font-weight: 400; font-display: swap; src: url(fonts/vazirmatn-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Vazirmatn'; font-weight: 700; font-display: swap; src: url(fonts/vazirmatn-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Vazirmatn'; font-weight: 900; font-display: swap; src: url(fonts/vazirmatn-arabic-900-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: 'Vazirmatn'; font-weight: 400; font-display: swap; src: url(fonts/vazirmatn-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF; }
@font-face { font-family: 'Vazirmatn'; font-weight: 700; font-display: swap; src: url(fonts/vazirmatn-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF; }
@font-face { font-family: 'Vazirmatn'; font-weight: 900; font-display: swap; src: url(fonts/vazirmatn-latin-900-normal.woff2) format('woff2'); unicode-range: U+0000-00FF; }

:root {
  --bg: #0B0B14;
  --surface: #151521;
  --surface-2: #1E1E2E;
  --line: rgba(255, 255, 255, 0.09);
  --text: #F5F5FA;
  --muted: rgba(245, 245, 250, 0.6);
  --accent: #7C5CFC;
  --accent-soft: #A78BFA;
  --mafia: #FF6B70;
  --mafia-bg: rgba(229, 72, 77, 0.14);
  --town: #3DD68C;
  --town-bg: rgba(61, 214, 140, 0.12);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.7;
  min-height: 100dvh;
}
#app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
button, input { font: inherit; color: inherit; }
h1, h2 { margin: 0; }
h2 { font-size: 1.5rem; font-weight: 900; }
small { display: block; font-size: 0.8rem; }
.muted { color: var(--muted); }
.mafia { color: var(--mafia); }
.town { color: var(--town); }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(11, 11, 20, 0.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar h1 { font-size: 1.05rem; font-weight: 900; text-align: center; }
.logo { font-size: 1.4rem; text-align: center; }

.pad { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.dock {
  position: sticky; bottom: 0; display: flex; gap: 10px;
  padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.grow { flex: 1; min-width: 0; }

.btn {
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 0; cursor: pointer;
  font-weight: 700; transition: transform 0.1s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; border-radius: 10px; font-size: 0.88rem; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: var(--surface-2); border: 1px solid var(--line); }
.btn.danger { background: #C93A3F; color: #fff; }
.danger-text { color: var(--mafia); align-self: center; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2); cursor: pointer; font-size: 1.1rem; display: grid; place-items: center;
}
.icon-btn.small { width: 34px; height: 34px; font-size: 1rem; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; }

.row { display: flex; gap: 8px; }
input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
input::placeholder { color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.item .num { width: 26px; text-align: center; color: var(--muted); }
.item.dead { opacity: 0.5; }
.item.dead b { text-decoration: line-through; }
.plain { background: none; border: 0; text-align: start; padding: 0; cursor: pointer; }
.role-row .ricon { font-size: 1.6rem; }
.role-row small { color: var(--muted); }
.role-row.mafia { border-color: rgba(229, 72, 77, 0.3); }
.role-row.mafia b, .role-row.town b { color: var(--text); }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper b { min-width: 22px; text-align: center; font-size: 1.1rem; }
.votes.hot { color: var(--mafia); }
.menu { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 8px 8px; }

.summary { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { padding: 4px 12px; border-radius: 999px; background: var(--surface-2); font-size: 0.85rem; font-weight: 700; }
.chip.mafia { background: var(--mafia-bg); }
.chip.town { background: var(--town-bg); }
.error { color: var(--mafia); background: var(--mafia-bg); padding: 10px 14px; border-radius: 12px; margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.timer-row { display: flex; align-items: center; gap: 10px; }
.timer { flex: 1; font-size: 2.6rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.warn { color: #FFB224; }
.timer.done { color: var(--mafia); }
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip-btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; cursor: pointer; }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.announce { text-align: center; }
.announce .big { font-size: 1.15rem; margin: 6px 0 10px; }
.announce.mafia { background: var(--mafia-bg); }
.announce.town { background: var(--town-bg); }
.announce summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.big-icon { font-size: 4rem; line-height: 1.2; }

.grid-names { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.name-card {
  width: 100%; min-height: 84px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; font-size: 1.05rem; cursor: pointer; padding: 10px;
}
.name-card small { color: var(--accent-soft); font-weight: 400; }
.name-card.seen { opacity: 0.55; }
.name-card.seen small { color: var(--town); }

.reveal {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; padding: 32px 24px;
}
.reveal.mafia { background: radial-gradient(400px 300px at 50% 35%, rgba(229, 72, 77, 0.25), transparent 70%); }
.reveal.town { background: radial-gradient(400px 300px at 50% 35%, rgba(61, 214, 140, 0.18), transparent 70%); }
.reveal h2 { font-size: 2.2rem; }
.reveal .team-label { font-weight: 700; margin: 0; }
.reveal.mafia .team-label { color: var(--mafia); }
.reveal.town .team-label { color: var(--town); }
.reveal .desc { color: var(--muted); max-width: 340px; margin: 4px 0 18px; }
.reveal .btn { max-width: 340px; }

.night-bg { background: radial-gradient(500px 300px at 50% 0%, rgba(124, 92, 252, 0.18), transparent 70%); }
.targets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.target {
  min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; cursor: pointer; padding: 8px;
}
.target.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.target.none { grid-column: 1 / -1; font-weight: 400; color: var(--muted); }
.target.none.on { color: #fff; }
.answer { font-size: 1.3rem; font-weight: 900; text-align: center; padding: 12px; border-radius: 14px; margin: 0; }
.answer.pos { background: var(--mafia-bg); color: var(--mafia); }
.answer.neg { background: var(--town-bg); color: var(--town); }
.plain-list { margin: 10px 0 0; padding-inline-start: 18px; }

.log { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.log summary { cursor: pointer; font-weight: 700; }
.log ul { margin: 8px 0 0; padding-inline-start: 18px; color: var(--muted); font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }
