/* NM Mafia — неон-бар тема.
   Фирменные цвета бара подставляются в переменные ниже — вся тема перекрасится. */
:root {
  --bg: #0a0a14;
  --bg-glow-1: rgba(255, 45, 120, 0.08);
  --bg-glow-2: rgba(0, 229, 255, 0.06);
  --panel: #14141f;
  --panel-2: #1b1b2c;
  --border: rgba(255, 255, 255, 0.09);
  --text: #f2f2f7;
  --muted: #9a9ab0;
  --neon-pink: #ff2d78;
  --neon-cyan: #00e5ff;
  --neon-violet: #a78bfa;
  --gold: #ffd166;
  --danger: #ff4d5e;
  --ok: #3ddc97;
  --town: var(--neon-cyan);
  --mafia: var(--neon-pink);
  --gray: var(--neon-violet);
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, sans-serif;
  margin: 0;
  padding: 20px 16px 32px;
  background:
    radial-gradient(ellipse 80% 40% at 20% -5%, var(--bg-glow-1), transparent),
    radial-gradient(ellipse 70% 35% at 90% 0%, var(--bg-glow-2), transparent),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

main { max-width: 480px; margin: 0 auto; }

h1, h2 {
  font-family: "Unbounded", "Inter", sans-serif;
  letter-spacing: 0.02em;
}
section h1 {
  margin: 0 0 16px;
  font-size: 24px;
  text-shadow: 0 0 24px rgba(255, 45, 120, 0.45);
}
h2 { font-size: 15px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.12em; margin: 20px 0 10px; }

p { color: var(--muted); line-height: 1.45; }

input {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  font-size: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px var(--neon-cyan), 0 0 18px rgba(0, 229, 255, 0.25);
}
input::placeholder { color: var(--muted); }

button {
  padding: 12px 16px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.2s, border-color 0.2s;
}
button:active { transform: scale(0.97); }
button.primary {
  background: linear-gradient(135deg, var(--neon-pink), #b3227f);
  border: none;
  color: #fff;
  font-weight: 700;
  width: 100%;
  margin-top: 14px;
  padding: 15px 16px;
  box-shadow: 0 0 22px rgba(255, 45, 120, 0.45);
}
button.link { background: none; border: none; color: var(--neon-cyan); margin-top: 16px; }
button:disabled { opacity: 0.35; box-shadow: none; }

/* --- Статистика игрока --- */
.stats-row { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.stats-row span { white-space: nowrap; }

.player-title {
  display: inline-block;
  color: var(--gold);
  font-weight: 700;
  margin: -6px 0 10px;
  cursor: pointer;
  text-shadow: 0 0 14px rgba(255, 209, 102, 0.5);
}
.title-desc {
  background: rgba(255, 209, 102, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--gold);
}
.extra-stats {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 8px 0 4px;
  font-size: 14px;
  color: var(--muted);
}
.extra-stats div { padding: 3px 0; }

/* --- Лидерборд --- */
ol { padding-left: 0; counter-reset: lb; list-style: none; margin: 0; }
ol li {
  counter-increment: lb;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
#admin-leaderboard li::before {
  content: counter(lb);
  min-width: 24px;
  text-align: center;
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  color: var(--muted);
}
#admin-leaderboard li:nth-child(1)::before { content: "🥇"; }
#admin-leaderboard li:nth-child(2)::before { content: "🥈"; }
#admin-leaderboard li:nth-child(3)::before { content: "🥉"; }
.lb li:nth-child(1), #admin-leaderboard li:nth-child(1) { border-color: rgba(255, 209, 102, 0.5); box-shadow: 0 0 16px rgba(255, 209, 102, 0.12); }

/* --- Чипы (номера, роли, победители) --- */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.chip.selected {
  outline: none;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 1px var(--neon-cyan), 0 0 16px rgba(0, 229, 255, 0.35);
}
.chip-town { border-left: 3px solid var(--town); }
.chip-mafia { border-left: 3px solid var(--mafia); }
.chip-gray { border-left: 3px solid var(--gray); }
.chip.suggested {
  outline: none;
  border-color: var(--ok);
  box-shadow: 0 0 0 1px var(--ok), 0 0 18px rgba(61, 220, 151, 0.35);
}

/* --- Карточка роли --- */
.role-card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 16px 16px;
  text-align: center;
  overflow: hidden;
}
.role-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-violet), var(--neon-cyan));
}
.role-card h2 {
  font-size: 22px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0.02em;
  margin: 10px 0 4px;
  text-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}
.role-card img {
  width: 100%;
  max-width: 360px;
  border-radius: 16px;
  box-shadow: 0 0 28px rgba(167, 139, 250, 0.35);
  cursor: zoom-in;
}
.role-emblem { font-size: 56px; filter: drop-shadow(0 0 14px rgba(167, 139, 250, 0.6)); }

/* --- Поле ролей --- */
#roles-board { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.board-role {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 14px;
}
.board-role.eliminated { text-decoration: line-through; opacity: 0.35; filter: grayscale(1); }

/* --- Экран игры --- */
#game-status {
  font-family: "Unbounded", sans-serif;
  font-size: 18px;
  margin-bottom: 12px;
  color: var(--neon-cyan);
  text-shadow: 0 0 18px rgba(0, 229, 255, 0.5);
}
.eliminated-banner {
  background: rgba(255, 77, 94, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(255, 77, 94, 0.2);
}
#game-result {
  font-family: "Unbounded", sans-serif;
  font-size: 20px;
  margin-top: 18px;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(255, 209, 102, 0.5);
}

/* --- Стол ведущего --- */
#table-header h1 { margin-bottom: 4px; }
#seats-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
#seats-table td {
  padding: 10px 8px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
#seats-table td:first-child { border-left: 1px solid var(--border); border-radius: 12px 0 0 12px; font-family: "Unbounded", sans-serif; font-size: 13px; }
#seats-table td:last-child { border-right: 1px solid var(--border); border-radius: 0 12px 12px 0; text-align: right; white-space: nowrap; }
#seats-table button { padding: 7px 10px; font-size: 13px; margin-left: 4px; }
tr.eliminated td { text-decoration: line-through; opacity: 0.35; }
#table-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.suggestion {
  background: rgba(61, 220, 151, 0.08);
  border: 1px solid var(--ok);
  color: var(--ok);
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(61, 220, 151, 0.15);
}

.error { color: var(--danger); }

/* --- Блоки аналитики на главной --- */
.hero-card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 16px 14px;
  overflow: hidden;
  margin-bottom: 12px;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-violet), var(--neon-cyan));
}
.hero-card h1 { margin-bottom: 6px; }
.hero-rank { display: flex; align-items: center; gap: 10px; }
.rank-badge {
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  color: var(--neon-cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 999px;
  padding: 4px 12px;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.18);
}
.rank-points { color: var(--muted); font-size: 14px; }

.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 8px; }
.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 8px 10px;
  text-align: center;
}
.stat-tile .num {
  font-family: "Unbounded", sans-serif;
  font-size: 22px;
  text-shadow: 0 0 16px rgba(255, 45, 120, 0.35);
}
.stat-tile .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 4px;
}

.stat-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.block-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 8px;
}
.fav-role { display: flex; align-items: center; gap: 12px; }
.fav-emoji { font-size: 36px; filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.6)); }
.fav-name { font-weight: 700; font-size: 16px; }
.fav-sub { color: var(--muted); font-size: 13px; }

.team-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.team-label { min-width: 56px; font-size: 13px; color: var(--muted); }
.team-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.team-bar i { display: block; height: 100%; border-radius: 999px; }
.team-bar .bar-town { background: linear-gradient(90deg, var(--town), rgba(0, 229, 255, 0.5)); box-shadow: 0 0 10px rgba(0, 229, 255, 0.5); }
.team-bar .bar-mafia { background: linear-gradient(90deg, var(--mafia), rgba(255, 45, 120, 0.5)); box-shadow: 0 0 10px rgba(255, 45, 120, 0.5); }
.team-bar .bar-gray { background: linear-gradient(90deg, var(--gray), rgba(167, 139, 250, 0.5)); box-shadow: 0 0 10px rgba(167, 139, 250, 0.5); }
.team-score { min-width: 34px; text-align: right; font-size: 13px; color: var(--muted); }

.survival-row { font-size: 14px; color: var(--muted); line-height: 1.6; }
.survival-row b { color: var(--text); }

/* --- Поле номеров игроков --- */
.board-seat { font-family: "Unbounded", sans-serif; font-size: 14px; min-width: 52px; text-align: center; }
.board-seat.me { border-color: var(--neon-cyan); box-shadow: 0 0 12px rgba(0, 229, 255, 0.25); }

/* --- Ачивки --- */
.ach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 6px;
  opacity: 0.55;
  filter: grayscale(0.6);
}
.ach-row.earned {
  opacity: 1;
  filter: none;
  border-color: rgba(255, 209, 102, 0.5);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.12);
}
.ach-emoji { font-size: 26px; }
.ach-name { font-weight: 700; font-size: 14px; }
.ach-row.earned .ach-name { color: var(--gold); }
.ach-desc { font-size: 12px; color: var(--muted); }
.ach-check { margin-left: auto; color: var(--gold); font-weight: 700; font-size: 18px; }

/* --- Умный рейтинг --- */
.lb .lb-rank { min-width: 28px; text-align: center; font-family: "Unbounded", sans-serif; font-size: 13px; color: var(--muted); }
.lb .lb-nick { flex: 1; }
.lb .lb-points { font-family: "Unbounded", sans-serif; font-size: 13px; color: var(--muted); }
.lb li.me { border-color: var(--neon-cyan); box-shadow: 0 0 14px rgba(0, 229, 255, 0.2); }
.lb li.me .lb-nick { color: var(--neon-cyan); font-weight: 700; }
.lb-ellipsis { justify-content: center; color: var(--muted); background: none !important; border: none !important; box-shadow: none !important; padding: 2px !important; }
#full-lb-btn { margin-top: 4px; }

/* --- Бейдж ачивок на hero --- */
.ach-badge {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.08);
  border: 1px solid rgba(255, 209, 102, 0.45);
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 0 12px rgba(255, 209, 102, 0.15);
}


/* --- Полноэкранный просмотр арта --- */
#img-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(5, 5, 12, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#img-overlay img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
