:root {
  --bg: #070708;
  --bg-2: #0e0b0c;
  --panel: rgba(20, 14, 15, 0.88);
  --panel-2: rgba(32, 20, 22, 0.9);
  --line: #2c1719;
  --line-strong: #4a1c20;
  --red: #a3141c;
  --red-bright: #d3242d;
  --red-deep: #5a0a0e;
  --red-glow: rgba(211, 36, 45, 0.45);
  --text: #f1e7e4;
  --muted: #a3908b;
  --gold: #d9a441;
  --ok: #4cc28a;
  --town: #9db8d6;
  --neutral: #c39be8;
  --radius: 16px;
  --font-display: 'Oswald', 'Cairo', sans-serif;
  --font-body: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

/* Lalezar has a single weight; faux bold would smear it. */
:lang(ar) {
  --font-display: 'Lalezar', 'Oswald', sans-serif;
  --font-body: 'Lalezar', 'Cairo', system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.22em; }
[dir='rtl'] .ico.flip-rtl { transform: scaleX(-1); }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(163, 20, 28, 0.38), transparent 70%),
    radial-gradient(ellipse 70% 45% at 50% 115%, rgba(90, 10, 14, 0.5), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 6px);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.75) 100%);
  z-index: 0;
}

#app { position: relative; z-index: 1; }

button, input, select { font: inherit; color: inherit; }

a { color: var(--red-bright); }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(32px + env(safe-area-inset-bottom));
}

.room.phase-lobby { max-width: 1040px; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
}

.top-actions { display: flex; align-items: center; gap: 8px; }

.room-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.room-chip b {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.2em;
}

.lang-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 14px;
}
.lang-select .ico { color: var(--muted); }
.lang-select select {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 8px 8px 2px;
  cursor: pointer;
}
.lang-select option { background: #140e0f; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { border-color: var(--red); background: var(--red-deep); }
.icon-btn .ico { width: 20px; height: 20px; }
.icon-btn.danger { width: 32px; height: 32px; color: var(--muted); }
.icon-btn.danger .ico { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--text); }
[dir='rtl'] .icon-btn svg { transform: scaleX(-1); }

.phase-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 16px;
  font-family: var(--font-display);
  font-size: clamp(26px, 7vw, 36px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 0 24px var(--red-glow), 0 2px 0 #000;
}
.phase-title::before,
.phase-title::after {
  content: '';
  flex: 1;
  max-width: 90px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red));
}
.phase-title::after { transform: scaleX(-1); }
.phase-ico { display: inline-flex; font-size: 0.8em; color: var(--red-bright); filter: drop-shadow(0 0 10px var(--red-glow)); }
.phase-ico .ico { width: 1em; height: 1em; }

/* ---------- home ---------- */

.hero { text-align: center; margin: 24px 0 22px; }
.logo { width: 150px; height: auto; filter: drop-shadow(0 8px 24px rgba(211, 36, 45, 0.45)); }
.title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(56px, 18vw, 92px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.14em;
  color: var(--text);
  text-shadow: 0 0 30px var(--red-glow), 0 0 2px var(--red-bright), 0 4px 0 #000;
}
[dir='rtl'] .title { letter-spacing: 0; }
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.guide-link {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 15px;
  text-decoration: none;
}
.guide-link:hover { color: var(--text); }

.home-panel { padding: 18px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line);
}
.tab {
  padding: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.tab.active { background: linear-gradient(180deg, var(--red), var(--red-deep)); color: #fff; box-shadow: 0 4px 14px var(--red-glow); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
[dir='rtl'] .field > span { letter-spacing: 0; }
.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 17px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus { border-color: var(--red-bright); box-shadow: 0 0 0 3px rgba(211, 36, 45, 0.25); }
.field select option { background: #140e0f; }
.field.compact { margin: 12px 0 0; }
.field.compact select { padding: 10px 12px; font-size: 15px; }
.code-input {
  text-align: center;
  font-family: var(--font-display);
  font-size: 30px !important;
  letter-spacing: 0.5em;
  text-transform: uppercase;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s, box-shadow 0.15s, opacity 0.15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn small { font-weight: 600; opacity: 0.8; }

.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, var(--red-bright), var(--red) 55%, var(--red-deep));
  border-color: #e0434b55;
  box-shadow: 0 6px 18px rgba(163, 20, 28, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
[dir='rtl'] .btn.primary { letter-spacing: 0; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.1); }

.btn.ghost {
  background: rgba(0, 0, 0, 0.45);
  border-color: var(--line-strong);
}
.btn.ghost:hover:not(:disabled) { border-color: var(--red); }
.btn.ghost.selected { border-color: var(--red-bright); background: var(--red-deep); }

.btn.big { width: 100%; padding: 16px 20px; font-size: 19px; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.wide { width: 100%; margin-top: 10px; }

.btn.glow { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 6px 18px rgba(163, 20, 28, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
  50% { box-shadow: 0 6px 34px rgba(211, 36, 45, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
}

.link-btn {
  background: none;
  border: 0;
  padding: 6px;
  color: var(--muted);
  text-decoration: underline;
  font-size: 13px;
  cursor: pointer;
}
.link-btn:hover { color: var(--red-bright); }

/* ---------- panels ---------- */

.panel {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(6px);
}
.panel::before {
  content: '';
  position: absolute;
  inset-inline: 16px;
  top: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0.8;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e9d9d5;
}
[dir='rtl'] .panel-title { letter-spacing: 0; }
.panel-title.sub { margin-top: 16px; font-size: 14px; color: var(--muted); }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--red-deep);
  border: 1px solid var(--red);
  font-family: var(--font-body);
  font-size: 13px;
  letter-spacing: 0;
}

.stack { display: grid; gap: 14px; }

.grid.lobby { display: grid; gap: 14px; }
@media (min-width: 860px) {
  .grid.lobby {
    grid-template-columns: 340px 1fr;
    grid-template-areas: 'share players' 'share settings' 'start start';
    align-items: start;
  }
  .share-card { grid-area: share; position: sticky; top: 16px; }
  .players-card { grid-area: players; }
  .settings-card { grid-area: settings; }
  .start-bar, .waiting.wide { grid-area: start; }
}

.hint { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.hint.warn { color: #ff8a8f; }
.hint.center, .center { text-align: center; }
.lead { margin: 0; text-align: center; color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }
.ok { margin: 12px 0 0; color: var(--ok); font-weight: 600; font-size: 14px; }

/* ---------- share card ---------- */

.share-card { text-align: center; }
.qr-frame {
  display: inline-block;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 4px var(--red-deep), 0 0 0 5px var(--red), 0 12px 40px rgba(211, 36, 45, 0.35);
}
.qr-frame img { display: block; width: min(230px, 62vw); height: auto; aspect-ratio: 1; }
.code-big {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 18px 0 8px;
}
.code-big span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 58px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #1c1112, #0a0707);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 14px var(--red-glow);
}
.join-url { font-size: 14px; color: var(--muted); margin-bottom: 10px; word-break: break-all; }

/* ---------- players ---------- */

.player-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  flex-wrap: wrap;
}
.player .pname { flex: 1; min-width: 80px; font-weight: 700; overflow-wrap: anywhere; }
.player.is-offline { opacity: 0.55; }
.player.is-dead { opacity: 0.5; }
.player.is-dead .pname { text-decoration: line-through; text-decoration-color: var(--red); }
.player.is-winner { border-color: var(--gold); box-shadow: inset 0 0 0 1px rgba(217, 164, 65, 0.3); }
.player .status { font-size: 14px; }
.roster .player { flex-wrap: wrap; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.35);
}

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.5);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.badge.host { color: var(--gold); border-color: rgba(217, 164, 65, 0.4); }
.badge.you { color: #fff; background: var(--red-deep); border-color: var(--red); }
.badge.off { color: #ff9ca0; }
.badge.win { color: var(--gold); border-color: var(--gold); }

/* ---------- roles ---------- */

.role-grid { display: grid; gap: 6px; }
@media (min-width: 520px) { .role-grid { grid-template-columns: 1fr 1fr; } }
.role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--team, var(--line));
}
.role-row.auto { opacity: 0.85; }
.role-ico { display: inline-flex; font-size: 20px; color: var(--team); }
.role-ico .ico { width: 1em; height: 1em; }
.role-name { flex: 1; font-weight: 700; font-size: 15px; }
.team-mafia { --team: var(--red-bright); }
.team-town { --team: var(--town); }
.team-neutral { --team: var(--neutral); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.5);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.stepper button:hover:not(:disabled) { border-color: var(--red); background: var(--red-deep); }
.stepper button:disabled { opacity: 0.3; cursor: not-allowed; }
.stepper output { min-width: 26px; text-align: center; font-family: var(--font-display); font-size: 19px; }

.settings-card > .btn.small { margin-top: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.role-chip, .role-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid var(--team, var(--line-strong));
  background: color-mix(in srgb, var(--team, #000) 14%, rgba(0, 0, 0, 0.6));
  white-space: nowrap;
}
.role-chip { padding: 5px 12px; font-size: 14px; font-weight: 600; }
.role-tag { padding: 2px 9px; font-size: 13px; font-weight: 700; color: var(--team, var(--text)); }

.role-guide { margin-top: 14px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
.role-guide summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.role-guide ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.role-guide li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border-inline-start: 3px solid var(--team);
}
.role-guide li span { font-size: 14px; color: var(--muted); }

/* ---------- toggles ---------- */

.toggles { display: grid; gap: 10px; margin-top: 16px; }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #2a1d1f;
  border: 1px solid var(--line-strong);
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8a7672;
  transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .switch { background: var(--red); border-color: var(--red-bright); }
.toggle input:checked + .switch::after { background: #fff; transform: translateX(18px); }
[dir='rtl'] .toggle input:checked + .switch::after { transform: translateX(-18px); }
.toggle input:focus-visible + .switch { box-shadow: 0 0 0 3px rgba(211, 36, 45, 0.35); }

/* ---------- start / waiting ---------- */

.start-bar { display: grid; gap: 4px; text-align: center; }
.waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}
.pulse-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red-bright);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(211, 36, 45, 0.7); }
  50% { box-shadow: 0 0 0 8px rgba(211, 36, 45, 0); }
}

.host-bar {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(217, 164, 65, 0.35);
  background: linear-gradient(180deg, rgba(217, 164, 65, 0.07), rgba(0, 0, 0, 0.5));
  text-align: center;
}
.host-label { font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.host-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.host-actions .btn { flex: 1 1 160px; }

/* ---------- role card ---------- */

.reveal .only-open { display: none; }
.reveal.card-open .only-open { display: block; }
.reveal.card-open .only-closed { display: none; }
.reveal .lead .only-open { display: none; }
.reveal.card-open .lead .only-open { display: inline; }

.role-card {
  display: block;
  width: min(300px, 78vw);
  aspect-ratio: 5 / 7;
  margin: 4px auto;
  padding: 0;
  border: 0;
  background: none;
  perspective: 1400px;
  cursor: pointer;
}
.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.role-card.open .card-inner { transform: rotateY(180deg); }
.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px;
  border-radius: 20px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}
.card-back {
  border: 2px solid var(--red);
  background:
    repeating-linear-gradient(45deg, rgba(211, 36, 45, 0.12) 0 10px, transparent 10px 20px),
    radial-gradient(circle at 50% 40%, #2a0b0e, #070506 75%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), inset 0 0 0 8px #0b0708, inset 0 0 0 9px var(--red-deep);
  animation: breathe 3s ease-in-out infinite;
}
.card-back .logo { width: 55%; }
.card-q {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 700;
  color: var(--red-bright);
  text-shadow: 0 0 24px var(--red-glow);
  line-height: 1;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), inset 0 0 0 8px #0b0708, inset 0 0 0 9px var(--red-deep); }
  50% { box-shadow: 0 18px 60px rgba(211, 36, 45, 0.35), inset 0 0 0 8px #0b0708, inset 0 0 0 9px var(--red); }
}
.card-front {
  transform: rotateY(180deg);
  border: 2px solid var(--team);
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--team) 22%, transparent), transparent 65%),
    linear-gradient(180deg, #1a1012, #070506);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), 0 0 40px color-mix(in srgb, var(--team) 35%, transparent);
  text-align: center;
}
.card-icon { display: inline-flex; font-size: 76px; line-height: 1; color: var(--team); filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6)); }
.card-icon .ico { width: 1em; height: 1em; stroke-width: 1.5; }
.card-role {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--team);
  text-shadow: 0 2px 0 #000;
}
[dir='rtl'] .card-role { letter-spacing: 0; }
.card-team {
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--team);
  font-size: 13px;
  font-weight: 700;
}
.card-desc { font-size: 15px; color: #d9c8c4; line-height: 1.55; }

.mafia-team { border-color: var(--red); }

/* ---------- night actions ---------- */

.phase-night { --night: 1; }
body:has(.phase-night) {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(60, 8, 12, 0.6), transparent 70%),
    radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 70% 15%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 85% 40%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 40% 10%, rgba(255, 255, 255, 0.4), transparent);
  background-color: #040405;
}
body:has(.phase-day) {
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(217, 120, 50, 0.22), transparent 70%),
    radial-gradient(ellipse 70% 45% at 50% 115%, rgba(90, 10, 14, 0.5), transparent 70%);
}
.night-lead { font-style: italic; }

.target-list { display: grid; gap: 8px; }
@media (min-width: 480px) { .target-list { grid-template-columns: 1fr 1fr; } }
.target {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.45);
  text-align: start;
  cursor: pointer;
  flex-wrap: wrap;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.target:hover:not(:disabled) { border-color: var(--red); }
.target:active:not(:disabled) { transform: scale(0.98); }
.target:disabled { opacity: 0.4; cursor: not-allowed; }
.target .pname { flex: 1; font-weight: 700; overflow-wrap: anywhere; }
.target small { color: var(--muted); font-weight: 400; }
.target.selected {
  border-color: var(--red-bright);
  background: linear-gradient(180deg, rgba(211, 36, 45, 0.35), rgba(90, 10, 14, 0.55));
  box-shadow: 0 0 0 1px var(--red-bright), 0 6px 20px rgba(211, 36, 45, 0.35);
}
.tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}
.tag.mafia { color: #ffb3b6; border-color: var(--red); }

.action-buttons { display: grid; gap: 8px; margin-top: 14px; }

ul.plain { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; }

/* ---------- announcements ---------- */

.announce {
  padding: 18px;
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
}
.announce p { margin: 4px 0; font-size: 18px; }
.announce .sub { font-size: 15px; color: var(--muted); }
.announce.death {
  border-color: var(--red);
  background: radial-gradient(circle at 50% 0%, rgba(211, 36, 45, 0.28), transparent 70%), var(--panel-2);
}
.announce.calm { border-color: #3c3030; }
.announce.investigation { border-color: var(--team); }
.deaths { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; font-size: 20px; }
.deaths li { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.big-ico { display: flex; justify-content: center; margin-bottom: 6px; font-size: 46px; color: var(--muted); }
.big-ico .ico { width: 1em; height: 1em; stroke-width: 1.5; }
.announce.death .big-ico, .dead-card .big-ico { color: var(--red-bright); }
.announce.investigation .big-ico { color: var(--team); }
.announce.calm .big-ico { color: var(--gold); }

.timer-card {
  display: grid;
  justify-items: center;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: radial-gradient(circle, rgba(163, 20, 28, 0.18), transparent 70%), var(--panel);
}
.timer-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.timer {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px var(--red-glow);
}
.timer.urgent { color: var(--red-bright); animation: tick 1s steps(2) infinite; }
@keyframes tick { 50% { opacity: 0.55; } }

.peek {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  font-size: 14px;
}
.peek.open { border-color: var(--red); }

.board { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.board-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 600;
}
[dir='rtl'] .board-chip { padding: 4px 4px 4px 10px; }
.board-chip .avatar { width: 26px; height: 26px; font-size: 13px; }
.board-chip.is-dead { opacity: 0.55; }
.board-chip.is-dead > span:not(.avatar):not(.role-tag) { text-decoration: line-through; text-decoration-color: var(--red); }
.board-chip.voted { border-color: var(--ok); }

.progress {
  position: relative;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.progress .bar { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--red-deep), var(--red)); transition: width 0.3s; }
.progress span { position: relative; display: grid; place-items: center; height: 100%; font-weight: 700; font-size: 14px; }

.tally { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tally-row { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; align-items: center; gap: 10px; }
.tally-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally-bar { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.tally-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red-deep), var(--red-bright)); border-radius: inherit; }
.tally-count { font-family: var(--font-display); font-size: 18px; }

.dead-card, .spectator { text-align: center; }
.dead-card h3, .spectator h3 { margin: 6px 0; font-family: var(--font-display); font-size: 26px; letter-spacing: 0.05em; text-transform: uppercase; }
.dead-card p, .spectator p { color: var(--muted); margin: 0 0 10px; }
.dead-card { border-color: var(--red-deep); filter: grayscale(0.4); }

.winner-banner {
  padding: 26px 18px;
  border-radius: 20px;
  text-align: center;
  border: 2px solid var(--team);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--team) 35%, transparent), transparent 70%),
    linear-gradient(180deg, #1a1012, #070506);
  box-shadow: 0 0 60px color-mix(in srgb, var(--team) 30%, transparent);
}
.winner-banner .trophy { display: inline-flex; font-size: 64px; line-height: 1; color: var(--team); animation: pop 0.8s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.winner-banner .trophy .ico { width: 1em; height: 1em; stroke-width: 1.5; }
.winner-banner h2 {
  margin: 10px 0 4px;
  font-family: var(--font-display);
  font-size: clamp(32px, 9vw, 46px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--team);
  text-shadow: 0 2px 0 #000;
}
.winner-banner p { margin: 0; color: #d9c8c4; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.log summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.log ol { margin: 10px 0 0; padding-inline-start: 4px; list-style: none; display: grid; gap: 6px; font-size: 14px; }

/* ---------- overlays ---------- */

.conn-banner {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  padding: 8px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--red);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(92vw, 440px);
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--red);
  background: #160d0e;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  font-weight: 600;
  text-align: center;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
  animation: fade 0.15s ease;
}
.modal {
  width: min(380px, 100%);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--red);
  background: #130c0d;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(211, 36, 45, 0.2);
  text-align: center;
}
.modal p { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions .ico { width: 22px; height: 22px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- entrance ---------- */

.enter { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- home guide (server-rendered for search engines) ---------- */

.screen.guide { max-width: 720px; padding-top: 24px; position: relative; z-index: 1; }
.guide[hidden] { display: none; }
.guide h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 0 24px var(--red-glow), 0 2px 0 #000;
}
.guide h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: #e9d9d5;
}
.guide p, .guide li { color: #d8cbc7; }
.guide strong { color: var(--text); }
.guide-intro { margin: 0 0 12px; font-size: 16px; }
.guide-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.guide-section ol, .guide-section ul { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; }
.guide-section li::marker { color: var(--red-bright); }

.guide-section .guide-roles { padding: 0; list-style: none; gap: 10px; }
@media (min-width: 560px) { .guide-section .guide-roles { grid-template-columns: 1fr 1fr; } }
.guide-role {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}
.guide-role-ico { display: inline-flex; font-size: 26px; line-height: 1.2; color: var(--team); }
.guide-role-ico .ico { width: 1em; height: 1em; }
.guide-role small { font-size: 12px; color: var(--muted); }
.guide-role.team-mafia small { color: var(--red-bright); }
.guide-role.team-town small { color: var(--town); }
.guide-role.team-neutral small { color: var(--neutral); }
.guide-role p { margin: 4px 0 0; font-size: 14px; }

.guide-faq { border-top: 1px solid var(--line); padding: 10px 0; }
.guide-faq:first-of-type { border-top: 0; padding-top: 0; }
.guide-faq summary { cursor: pointer; font-weight: 700; color: var(--text); }
.guide-faq p { margin: 8px 0 0; }
.guide-cta { margin: 24px 0 0; text-align: center; }
.guide-cta .btn { max-width: 360px; text-decoration: none; }
