/* mp-style.css — мобильный-first интерфейс мультиплеера «Политики».
   Тёмная тема в духе основного style.css. Mobile-first: базовые стили для
   телефонов, медиа-запросы расширяют на планшет/десктоп. */

:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --bg3: #1f2530;
  --panel: #1a1f28;
  --panel2: #232a36;
  --text: #e8eaed;
  --muted: #8b94a3;
  --accent: #d48a9a;        /* пыльно-розовый */
  --accent-hover: #e0a3b0;
  --accent-dark: #2a1014;   /* тёмный текст на акцентной плашке */
  --good: #2ecc71;
  --bad: #e74c3c;
  --info: #3498db;
  --line: #2a323f;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Roboto", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { min-height: 100vh; min-height: 100dvh; }
#app { min-height: 100vh; min-height: 100dvh; }

/* Анти-overflow на телефоне: весь контент в пределах ширины экрана.
   Раньше длинные слова/тексты могли растягивать layout по горизонтали,
   теперь всё обрезается или переносится. */
#app, .game-shell, .game-header, .top-strip, .bottom-feed, .step-overlay, .step-card {
  max-width: 100vw;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
.game-shell { overflow-x: hidden; }

button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s, transform .06s, border-color .12s;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary {
  background: var(--accent); color: var(--accent-dark); border-color: var(--accent);
  font-weight: 600;
}
button.primary:hover { background: var(--accent-hover); }
button.good { background: var(--good); color: #04210f; border-color: var(--good); font-weight: 600; }
button.bad { background: var(--bad); color: #2a0703; border-color: var(--bad); font-weight: 600; }
button.ghost { background: transparent; }
button.sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }

input, textarea {
  font: inherit; padding: 12px 14px;
  /* font-size: 16px — iOS Safari зумит страницу при фокусе на input с font-size
     < 16px, что само по себе дёргает клавиатуру и визуальную раскладку. 16px =
     порог, при котором зум не срабатывает. Переопределяет наследуемые 15px body. */
  font-size: 16px;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px;
  width: 100%;
}
input:focus { outline: none; border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }

.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }
.accent { color: var(--accent); }
/* утилит-классы (§7.5): сведённые повторяющиеся инлайн-стили —
   «text-align:center;margin-top:12px» и «margin-top:12px;width:100%» */
.ta-c { text-align: center; }
.mt12 { margin-top: 12px; }
.cta-full { width: 100%; }

/* ---------- оверлеи: стартовые экраны ---------- */
.screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 20px;
  padding-top: calc(24px + var(--safe-top));
}
.screen-card {
  width: 100%; max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 20px;
}
.logo {
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.5px;
  text-align: center;
  margin-bottom: 4px;
}
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- переключатель языка (фича 2026-07-31, по образцу WT) ---------- */
.lang-switcher {
  position: fixed;
  top: calc(8px + var(--safe-top));
  right: 10px;
  display: flex; gap: 4px;
  z-index: 30;
}
.lang-pill {
  min-width: 30px;
  padding: 5px 7px;
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}
.lang-pill:hover { border-color: var(--accent); color: var(--text); }
.lang-pill.active {
  background: var(--accent); color: var(--accent-dark);
  border-color: var(--accent);
}

/* ---------- карусель правил (нативный CSS scroll-snap) ---------- */
/* viewport — сам скролл-контейнер: браузер сам обрабатывает свайп (железобетонно
   на мобайле), без ручного JS. scroll-snap-x заставляет прилипать к карточкам. */
.howto {
  margin: 0 0 20px;
}
.howto-viewport {
  display: flex;            /* флекс-ряд слайдов */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;  /* плавный инерционный скролл на iOS */
  scrollbar-width: none;    /* Firefox: спрятать полосу */
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
}
.howto-viewport::-webkit-scrollbar { display: none; }  /* Chrome/Safari: спрятать */
.howto-slide {
  flex: 0 0 100%;           /* каждая карточка = полная ширина viewport */
  scroll-snap-align: start;
  scroll-snap-stop: always; /* НЕ пропускать точку привязки за один свайп —
                               максимум один шаг за жест (фикс «слишком чувствительно») */
  box-sizing: border-box;
  padding: 16px 18px;
  /* выравнивание контента по верху, иконка сверху */
  display: flex; flex-direction: column;
  gap: 6px;
}
.howto-icon { font-size: 26px; line-height: 1; }
.howto-title { font-size: 15px; font-weight: 700; color: var(--text); }
.howto-body { font-size: 13px; line-height: 1.5; color: var(--muted); }
/* точки-индикатор */
.howto-dots {
  display: flex; justify-content: center; gap: 6px;
  margin: 10px 0 0;
}
.howto-dot {
  width: 7px; height: 7px; padding: 0;
  border: none; border-radius: 50%;
  background: var(--bg3);
  cursor: pointer;
}
.howto-dot.active { background: var(--accent); }

/* ---------- лобби ---------- */
.lobby { padding: 16px; padding-top: calc(16px + var(--safe-top)); max-width: 680px; margin: 0 auto; }
.lobby h2 { font-size: 18px; margin: 0 0 4px; }
.code-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px dashed var(--accent);
  padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 16px;
  letter-spacing: 1px; color: var(--accent); cursor: pointer;
}
/* SVG-иконка «копировать» (две страницы) — наследует цвет от .code-pill. */
.code-pill-icon { display: inline-flex; align-items: center; }
.code-pill-icon svg { display: block; width: 16px; height: 16px; }
.member-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.member-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.member-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--good); flex-shrink: 0;
}
.member-dot.offline { background: var(--muted); }
.member-name { flex: 1; font-weight: 500; }
.member-name.is-me { color: var(--accent); }
.host-tag { color: var(--accent); }   /* тег «(хост)» в лобби (mp-ui.js:312) */
.bot-tag {
  font-size: 11px; padding: 2px 6px; background: var(--bg3); border-radius: 4px;
  color: var(--muted); margin-left: 6px;
}

/* ---------- каркас игры: header + полоса доверия/ролей + шаг + фид ---------- */
.game-shell {
  /* НЕ min-height: 100vh — иначе при коротком контенте всё растягивается
     и между блоками собирается пустота. Layout диктуется контентом. */
  display: flex; flex-direction: column;
}
.game-header {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 8px;
  padding-top: calc(6px + var(--safe-top));
  background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
}
.game-header .brand {
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  white-space: nowrap;
}
.game-header .spacer { flex: 1; min-width: 0; }
/* чипы — единый размер шрифта (13px, как в строках фракций).
   Было 11px — слишком мелко, пользователь не мог прочесть «Ход», «Казна». */
.chip {
  font-size: 13px; padding: 4px 9px; border-radius: 999px;
  background: var(--bg3); border: 1px solid var(--line);
  /* white-space: nowrap — КРИТИЧНО. Без него «Ход 2» переносилось: «Ход» на
     одной строке, «2» повисала на следующей. С nowrap чип — единый блок. */
  white-space: nowrap !important;
  display: inline-flex; align-items: center; gap: 4px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  line-height: 1.2;
}
/* chip «Ход N» — «Ход» и число в одну строку, неразрывно. */
.chip.chip-stack {
  flex-direction: row; align-items: center;
  padding: 4px 9px; gap: 4px; line-height: 1.2;
}
.chip.chip-stack .chip-label {
  font-size: 13px; color: var(--muted);
}
.chip.chip-stack .chip-value {
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text);
}
/* chip казны — «Казна N» в одну строку */
.chip.chip-treasury .chip-treasury-label { color: var(--muted); }
.chip.chip-treasury .chip-treasury-val {
  font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.game-header .btn-leave {
  padding: 5px 10px; font-size: 13px;
  flex-shrink: 0;
}

/* ---------- НОВЫЙ КАРКАС: верхняя полоса (доверие | роли) + нижний фид ---------- */
/* верхняя полоса — горизонтальный скролл между двумя страницами */
.top-strip {
  flex-shrink: 0;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.top-strip::-webkit-scrollbar { display: none; }
.strip-page {
  min-width: 100%;
  width: 100%;
  scroll-snap-align: start;
  padding: 8px 10px;
}
.strip-dots {
  display: flex; justify-content: center; gap: 6px;
  padding: 3px 0;
  background: var(--bg2);
  /* без border-bottom — убирает лишнюю горизонтальную полосу-разделитель,
     которая зрительно увеличивала пустоту между полосой доверия и шагом. */
}
.strip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line);
  transition: background .2s, width .2s;
  cursor: pointer;
}
.strip-dot.active { background: var(--accent); width: 18px; border-radius: 3px; }

/* нижний фид — вертикальный скролл: закон/результат/лог/тайна.
   flex: 1 РАНЬШЕ растягивал фид на всю свободную высоту → между полосой
   доверия и шагом закона появлялось много пустоты. Теперь фид — компактный
   блок, не больше 35vh; остальное место занимает шаг закона (он и есть
   основной фокус экрана). */
.bottom-feed {
  flex: 0 0 auto;
  max-height: 40vh;
  overflow-y: auto;
  padding: 8px 10px;
  padding-bottom: calc(12px + var(--safe-bottom));
}

/* ---- страница 1: доверие фракций (горизонтальные шкалы 0-10) ----
   Пороги: 3 (кризис) и 7 (доход) — показаны засечками + зонами. */
.trust-hgrid {
  display: flex; flex-direction: column; gap: 8px;
}
.trust-hrow {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  align-items: center;
}
.trust-hlabel {
  font-size: 11.5px; font-weight: 700; color: var(--text);
  /* перенос разрешён — «Интеллигенция»/«Intelligentsia» не обрезается (жалоба
     2026-07-31: ellipsis резал название). 2 строки влезают в высоту строки. */
  line-height: 1.1;
  word-break: break-word;
}
.trust-hbar {
  position: relative;
  height: 22px;
  background: var(--bg3);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
}
/* зоны кризиса (<3) и дохода (>7) — фоновая подсветка */
.trust-hzone {
  position: absolute; top: 0; bottom: 0;
  pointer-events: none;
}
.trust-hzone.crisis { left: 0; background: rgba(231, 76, 60, 0.10); }
.trust-hzone.high { background: rgba(46, 204, 113, 0.10); }
/* засечки 3 и 7 */
.trust-htick {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}
/* заполнение шкалы */
.trust-hfill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 6px 0 0 6px;
  transition: width .25s;
  min-width: 0;
  opacity: 0.92;
}
/* числовое значение поверх полосы */
.trust-hval {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  pointer-events: none;
}
/* дельта от прошлого закона */
.trust-hdelta {
  position: absolute; top: 50%; transform: translateY(-50%);
  right: 32px;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 1px 4px; border-radius: 4px;
  background: rgba(0,0,0,0.45);
  pointer-events: none;
}
.trust-hdelta.up { color: var(--good); }
.trust-hdelta.down { color: var(--bad); }

/* ---- блок «Президент / Выборы / Импичмент» под шкалами доверия ----
   Объединяет три ранее раздельных элемента: плашку выборов (была сверху),
   президента (был в шапке) и импичмент (был отдельной строкой).
   Теперь это компактная зона из 2 строк, без визуального шума. */
.politics-block {
  margin-top: 10px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
/* строка 1: президент + выборы. Имя президента занимает свою строку,
   выборы — отдельная мелкая подпись ниже. Так на телефоне не возникает
   переноса/сжатия и обе строки читаются полностью. */
.pres-line {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 13px; color: var(--text);
}
.pres-line .politics-text {
  white-space: normal; font-weight: 600; color: var(--accent);
  /* имя может быть длинным — переносится по словам */
  overflow-wrap: break-word; word-wrap: break-word;
}
.pres-line .politics-election { color: var(--muted); font-size: 12px; }
/* зеркальная строка «Вы: <роль>» (фича 2026-07-31, жалоба п.3): под президентом.
   Приглушённый серый — второстепенный контекст (кто я), в отличие от акцентного
   президента. НЕ дублирует способность — только название роли. */
.pres-line.you-line { gap: 0; }
.pres-line .you-text {
  font-weight: 500; color: var(--muted); font-size: 13px;
}

/* ---- плашка импичмента (фича 2026-07-30: вынесена из politics-block) ----
   Отдельная карточка с воздухом, прогресс-баром и пояснением последствий.
   Раньше было скучено в одну строку (кнопка + счётчик) внутри politics-block. */
.impeach-card {
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.impeach-card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.impeach-card-title { font-weight: 700; font-size: 14px; }
.impeach-card-stats {
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* прогресс-бар голосов за импичмент */
.impeach-bar {
  height: 6px; width: 100%;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.impeach-bar-fill {
  height: 100%;
  background: var(--bad);
  border-radius: 3px;
  transition: width .3s ease;
}
/* кнопка голосования за импичмент — компактная, по центру (не красная/full-width) */
.impeach-vote-btn {
  margin: 6px auto 0;
  display: block;            /* чтобы margin:auto центрировал */
  min-width: 180px;
}

/* swipe-подсказки на полосах доверия/ролей — мелкие, симметричные */
.swipe-hint { text-align: center; opacity: 0.7; }

/* ---- страница 2: карусель ролей (крупные карточки с силами) ----
   Здесь игрок читает, кто какую роль имеет и что умеет. Карточки содержат
   шапку (аватар + имя + монеты в одну строку) + роль + список сил.
   Компактнее по вертикали, чем раньше (аватар был сверху отдельной строкой). */
.roles-page .role-carousel {
  display: flex; gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.roles-page .role-carousel::-webkit-scrollbar { display: none; }
.player-card.role-card-mini {
  flex: 0 0 230px;
  margin-bottom: 0;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 10px;
}
/* шапка карточки: аватар + имя + монеты в одну строку */
.player-card.role-card-mini .player-card-head {
  display: flex; align-items: center; gap: 8px;
}
.player-card.role-card-mini .player-avatar {
  width: 32px; height: 32px; font-size: 13px;
  flex-shrink: 0;
}
.player-card.role-card-mini .player-name-block {
  flex: 1; min-width: 0;
}
.player-card.role-card-mini .player-name {
  font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.player-card.role-card-mini .player-coins {
  font-size: 13px; flex-shrink: 0;
}
.player-card.role-card-mini .player-role {
  font-size: 12px; margin-top: 2px;
}

/* ---- нижний фид: закон/результат/лог/тайна ---- */
.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.vote-summary {
  /* одна плашка голосования: «ЗА 2 (имена) · ПРОТИВ 0 (имена)» в одну строку */
  padding: 8px 12px;
}
.vote-line {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px;
  font-size: 13px;
}
/* ЗА/ПРОТИВ в сводке голосования — мягкие цвета, как у live-шкалы (фича
   2026-07-31, жалоба п.1: раньше были ядовитые --good/--bad, «давящие»). */
.vote-line .good { color: #7fa8c4; font-weight: 700; }
.vote-line .bad { color: #c97b63; font-weight: 700; }
.vote-line .sep { color: var(--muted); }
.log-row { color: var(--muted); border-left: 3px solid var(--accent); }

/* плашка закона на странице доверия */
.law-mini {
  position: relative;  /* для угловой иконки жалобы */
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 0;
}
.law-title-line {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.law-title { flex: 1; }
/* крупный ✓/✗ результата голосования — отдельная нижняя строка плашки закона
   (фича 2026-07-31, жалоба п.2: перенесён из шапки, где налезал на иконку). */
.law-result-mark {
  font-size: 20px; font-weight: 800; line-height: 1;
  text-align: center; margin-top: 8px;
}
.law-result-mark.passed { color: var(--good); }
.law-result-mark.rejected { color: var(--bad); }
.law-mini .lt { font-size: 14px; margin-top: 4px; }
/* иконка жалобы на закон: символ ℹ в кружке в углу (вместо флажка 🚩) —
   технический стиль, не конфликтует с ✓/✗ внизу. */
.law-report-icon {
  position: absolute; top: 6px; right: 6px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line);
  border-radius: 50%; cursor: pointer; padding: 0;
  width: 22px; height: 22px; line-height: 20px; text-align: center;
  font-size: 13px; opacity: 0.65; color: var(--muted);
}
.law-report-icon:active { opacity: 1; }
.law-report-form { margin-top: 10px; }
.law-report-form textarea {
  width: 100%; resize: vertical; min-height: 44px;
}

/* ---- блок тайной цели (на странице ролей, внизу) ----
   Это ГЛАВНАЯ цель игрока — раньше рендерилась мелким .tiny (12px) как сноска,
   теряясь среди списка сил роли. Теперь — акцентный блок: название крупно,
   цели — нормальным размером с явной маркировкой выполнения (✓ зелёным). */
.secret-block {
  margin-top: 14px;
  padding: 12px;
  background: linear-gradient(135deg, var(--panel) 0%, rgba(212, 138, 154, 0.06) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.secret-label {
  font-size: 12px; color: var(--muted); margin-bottom: 4px;
}
.secret-name {
  font-size: 20px; font-weight: 800; color: var(--accent);
  margin-bottom: 10px; line-height: 1.15;
}
.secret-goals {
  display: flex; flex-direction: column; gap: 6px;
}
.secret-goal {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 14px; line-height: 1.35;
  padding: 4px 0;
}
.secret-goal-mark {
  flex-shrink: 0; font-weight: 700; color: var(--muted);
  width: 14px; text-align: center;
}
.secret-goal-text { flex: 1; min-width: 0; }
.secret-goal-now {
  flex-shrink: 0; font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* выполненное условие — зелёным */
.secret-goal.done .secret-goal-mark { color: var(--good); }
.secret-goal.done .secret-goal-text { color: var(--good); }

/* ---- карточка игрока (используется в карусели и шагах) ---- */
.player-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px;
}
.player-card.me { border-color: var(--accent); }
/* Президент — выделение рамкой (роль id=1, faction=null). Не дублируем тегом. */
.player-card.is-pres {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--panel) 0%, rgba(212, 138, 154, 0.10) 100%);
}
.player-card.is-pres.me { border-color: var(--accent); border-width: 2px; }
.pres-role { font-weight: 700; color: var(--accent); }
.player-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0; font-size: 16px;
}
.player-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* bot-tag в карточке роли — золотистый (scoped, не перебивает лобби-версию) */
.player-card .bot-tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: #3a2a1a; color: #d4a14a; }
.player-role { font-size: 12px; color: var(--muted); margin-top: 2px; }
.player-coins { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* список сил роли в карточке игрока — аккуратный ul/li вместо одной строки */
.player-ability-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.player-ability-list li {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  padding-left: 12px;
  position: relative;
}
.player-ability-list li::before {
  content: "·";
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-weight: 700;
}
.player-ability-list.pres-powers li::before { content: "▸"; font-size: 10px; }
.player-ability-list.pres-powers li { color: var(--accent); }

/* ---- активный шаг (голосование / сила / выборы / финал) ----
   Это НЕ модал. Обычный inline-блок ВНУТРИ game-shell между верхней полосой
   и нижним фидом. На любом экране (мобильный/десктоп) всё видно одновременно:
   шкалы фракций сверху, шаг (закон + кнопки) под ними, фид с результатом ниже.

   ИСКЛЮЧЕНИЕ: .modal-overlay — полноэкранный модал, используется только для
   «событийных» экранов: жеребьёвки карт ролей и финала игры. Голосование,
   применение сил и выборы — всегда inline. */
.step-overlay {
  padding: 6px 8px 0;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  flex-shrink: 0;
}
.step-overlay.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bottom));
  max-width: none;
  animation: fadeIn .18s ease-out;
}
.step-overlay.modal-overlay .step-card {
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px;
  border-radius: 18px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.step-card {
  width: 100%;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 12px;
}
/* Шаг встроен внутрь страницы доверия (.strip-page), под law-mini. Лёгкий
   разделитель сверху — чтобы карточка действия визуально отделялась от текста
   закона над ней. (2026-07-28: шаги перенесены с отдельного step-overlay сюда.) */
.strip-page .step-card { margin-top: 8px; }
/* ВСЕ кнопки внутри страницы доверия (голосование, Премьер +/−, выборы и т.д.)
   защищены от случайного горизонтального свайпа на страницу ролей — .strip-page
   живёт в scroll-snap-контейнере, и без touch-action тап по кнопке (особенно
   мелкой Премьер +/−) мог перехватываться жестом скролла → «кнопка не нажимается».
   2026-07-30: ранее touch-action был только у .vote-buttons button (Task 1). */
.strip-page button { touch-action: manipulation; }
.step-title { font-size: 18px; font-weight: 700; margin: 0 0 6px; text-align: center; }
.step-sub { text-align: center; color: var(--muted); margin-bottom: 12px; font-size: 13px; }

/* шаг-ожидание (waiting): когда фаза активна, но действие не моё */
.waiting-card { text-align: center; }
.waiting-dots {
  display: flex; justify-content: center; gap: 8px; margin-top: 18px;
}
.waiting-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
  animation: waitingPulse 1.2s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: 0.2s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes waitingPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.vote-buttons { display: flex; gap: 10px; }
/* ЗА/ПРОТИВ — мягкие outline-кнопки (фича 2026-07-31 п.7: приглушены давящие
   ядовитые цвета). Используем мягкие пастельные тона вместо кислотных --good/--bad.
   ЗА — тёплый зелёный (как зона дохода >7, но спокойнее), ПРОТИВ — терракотовый. */
.vote-buttons button {
  flex: 1; padding: 12px 10px;
  font-size: 14px; font-weight: 500;
  border-radius: 12px;
  border-width: 2px;
}
.vote-buttons button.good {
  background: rgba(106, 156, 181, 0.12);
  color: #7fa8c4;
  border-color: rgba(106, 156, 181, 0.45);
}
.vote-buttons button.good:hover {
  background: rgba(106, 156, 181, 0.22);
  border-color: #7fa8c4;
}
.vote-buttons button.bad {
  background: rgba(201, 123, 99, 0.12);
  color: #c97b63;
  border-color: rgba(201, 123, 99, 0.45);
}
.vote-buttons button.bad:hover {
  background: rgba(201, 123, 99, 0.22);
  border-color: #c97b63;
}
/* Выбранная игроком кнопка ЗА/ПРОТИВ — выделена сплошной заливкой (фича
   2026-07-31 п.8: кнопки всегда кликабельны, смена голоса; выбранная подсвечена). */
.vote-buttons button.good.voted-chosen {
  background: rgba(106, 156, 181, 0.40);
  border-color: #7fa8c4;
  color: #b8d2e2;
}
.vote-buttons button.bad.voted-chosen {
  background: rgba(201, 123, 99, 0.40);
  border-color: #c97b63;
  color: #e0a896;
}

/* ---- live-шкала голосования (фича 2026-07-31 п.7) ----
   Реальное время: сколько игроков проголосовало ЗА/ПРОТИВ. Мягкие цвета. */
.vote-live-bar {
  display: flex; height: 8px; border-radius: 4px; overflow: hidden;
  margin-bottom: 6px; background: var(--line);
}
.vote-live-for { background: rgba(127, 168, 196, 0.6); }
.vote-live-against { background: rgba(201, 123, 99, 0.6); }
.vote-live-stats {
  font-size: 12px; text-align: center; margin-bottom: 10px;
}
.vote-live-for-txt { color: #7fa8c4; font-weight: 600; }
.vote-live-against-txt { color: #c97b63; font-weight: 600; }
.vote-live-sep { color: var(--muted); }

/* ---- Премьер: понятный калькулятор покупки голосов ----
   Показывает базовый голос + сколько докуплено = итоговый вес. Игрок видит,
   сколько потратит и какой вес голоса получит. Кнопки +1/сброс вместо
   загадочной «+1 голос за 1💰». */
/* Премьер: компактные +/− кнопки под ЗА/ПРОТИВ. Без отдельной плашки —
   текущее число купленных голосов видно между кнопками. */
.premier-ctrl {
  display: flex; justify-content: center; align-items: center; gap: 10px;
  margin-top: 10px;
}
.premier-ctrl-current {
  font-size: 15px; font-weight: 700; color: var(--accent);
  min-width: 70px; text-align: center;
  font-variant-numeric: tabular-nums;
}


/* выбор кандидата: список */
.cand-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.cand-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
}
.cand-row.selected { border-color: var(--good); background: rgba(46, 204, 113, 0.08); }
.cand-row.self { border-color: var(--accent); }
.cand-score { margin-left: auto; font-weight: 700; color: var(--accent); }

/* ---- применение силы: МИНИМАЛЬНЫЙ список целей ----
   Только имена кнопками-pills, без аватарок/монет/пояснений.
   Действие понятно из заголовка шага. Весь шаг умещается в высоту голосования. */
.ability-card { padding: 10px 12px; }
.ability-name-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 8px 0 4px;
  justify-content: center;
}
.name-pill {
  padding: 8px 14px;
  font-size: 14px; font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, background .12s, transform .06s;
}
.name-pill:hover { border-color: var(--accent); background: var(--bg3); }
.name-pill:active { transform: scale(0.96); }

/* Президент — обмен ролями: список кнопок-плиток (как у главы ЦБ).
   Раньше был grid 2 колонки с аватарками → плитки выходили громоздкими.
   Теперь короткие name-pills в один ряд, без аватарок — компактно. */
.president-swap-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  justify-content: center;
  margin: 8px 0 10px;
}
.president-swap-grid .target-btn {
  padding: 8px 14px;
  font-size: 14px; font-weight: 600;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s, background .12s, transform .06s;
  flex-direction: row;
  justify-content: center;
  text-align: center;
}
.president-swap-grid .target-btn:hover { border-color: var(--accent); background: var(--bg3); }
.president-swap-grid .target-btn:active { transform: scale(0.96); }
.president-swap-grid .target-btn.selected {
  border-color: var(--accent);
  background: rgba(212, 138, 154, 0.12);
  color: var(--accent);
}
.president-swap-actions { display: flex; justify-content: center; }
.president-swap-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

/* кнопка «Наложить вето» — компактная, в одну строку, классический
   розовый (var(--accent)) цвет. Раньше была красная, на всю ширину,
   с длинным текстом в 2 строки. */
.veto-btn {
  background: var(--accent); color: var(--accent-dark);
  border-color: var(--accent);
  font-weight: 700;
  padding: 8px 18px;
  font-size: 14px;
  border-radius: 999px;
  white-space: nowrap;
  margin: 0 auto 12px;
  display: block;
  width: auto;
  min-width: 0;
}
.veto-btn:hover { background: var(--accent-hover); }
.veto-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* финал */
.final-screen { text-align: center; }
.standings { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.standing-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--bg2); border-radius: 10px;
  border: 1px solid transparent;
}
/* Левая часть строки финала: имя + должность. standing-info — отдельный
   scoped-класс (НЕ глобальный .player-name, который display:flex и ломал
   выравнивание имени в таблице). final-name — обычный блок, аккуратный перенос. */
.standing-info { min-width: 0; }
.final-name {
  font-weight: 600; display: block;   /* блок, не flex — иначе конфликт с глобальным .player-name */
  overflow-wrap: break-word;
}
/* Выделение призовых мест: 1-е — акцентная рамка + фон, 2-е — мягче. */
.standing-row.place-1 {
  border-color: var(--accent);
  background: rgba(212, 138, 154, 0.12);
}
.standing-row.place-2 {
  border-color: var(--line);
  background: var(--bg3);
}
.final-coins { white-space: nowrap; flex-shrink: 0; }
.standing-row.place-1 .final-coins { color: var(--accent); }

/* тосты */
.toast {
  position: fixed; bottom: calc(80px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 999px;
  z-index: 100; max-width: 90vw; text-align: center;
  animation: toastIn .2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- этап выбора карт ролей ----
   6 карт 3×2 + блок «Ваша роль». На телефоне всё должно помещаться без
   скролла внутри модала — для этого карты квадратные (а не 3/4 как карточки
   настолки), мелкий шрифт, минимум отступов. */
.role-draft-card { max-width: 480px; }
.role-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* grid-auto-rows: фиксированная высота, чтобы карта НЕ зависела от
     содержимого. Раньше aspect-ratio: 1/1 — при изменении контента (имя
     игрока длиннее/короче) высота считалась от ширины, и сетка «прыгала». */
  grid-auto-rows: 110px;
  gap: 6px;
  margin: 8px 0;
}
.role-card {
  height: 110px;          /* жёсткая высота = grid-auto-rows, без aspect-ratio */
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4px; text-align: center;
  position: relative;
  overflow: hidden;       /* длинные имена обрезаются, не растягивают карту */
  transition: transform 0.12s, border-color 0.12s;
}
.role-card.pickable {
  cursor: pointer;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel2) 100%);
}
.role-card.pickable:hover { transform: translateY(-2px); border-color: var(--accent); }
.role-card.pickable:active { transform: translateY(0); }
.role-card.opened { background: var(--bg2); }
.role-card.disabled { opacity: 0.45; }
.role-card-back {
  font-size: 22px; font-weight: 800;
  color: var(--muted);
  font-family: Georgia, serif;
  min-height: 27px;          /* та же высота, что у role-card-name */
  display: flex; align-items: center; justify-content: center;
}
.role-card.pickable .role-card-back { color: var(--accent); }

/* ---- драфт тайн: 20 мелких плиток рубашкой (для случайного выбора) ----
   Жалоба 2026-07-31: плитки слишком мелкие/текстовые были; теперь плитки —
   просто «?»/🔒 крупно, без текста. Своя цель — КРУПНО В ВЕРХУ (.secret-mine). */
.secret-cards-grid {
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 56px;
  gap: 5px;
}
.secret-tile { height: 56px; border-radius: 8px; padding: 4px; }
.secret-tile .role-card-back {
  font-size: 20px; min-height: 48px;
}
/* своя выбранная цель — КРУПНЫЙ блок вверху драфта (не мелкий текст внизу) */
.secret-mine {
  height: auto; padding: 14px; margin-bottom: 12px;
  border: 2px solid var(--accent); border-radius: 10px;
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel2) 100%);
}
.secret-card-big { font-size: 20px; font-weight: 800; line-height: 1.2; }
/* замок 🔒 / 🎯 на плитке — акцентный */
.secret-card.opened:not(.disabled) .role-card-back { color: var(--accent); }

.role-card-name {
  font-weight: 700; font-size: 12px; line-height: 1.1;
  /* «Председатель Думы» — 2 строки, «Президент» — 1. Фиксируем высоту в 2 строки,
     чтобы все карты сетки были одной высоты и не «прыгали». */
  min-height: 27px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
}
/* все 3 строки карты фиксированной высоты — чтобы вскрытие не меняло layout */
.role-card-faction {
  min-height: 14px; line-height: 1.1;
  /* всегда занимает строку, даже если пустая (Президент без фракции) */
}
.role-card-picker {
  margin-top: 3px; font-size: 11px; color: var(--muted);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 14px;
}
.my-role-block {
  margin-top: 10px;
  padding: 8px 10px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg2);
  text-align: center;
  /* ЖЁСТКАЯ высота (а не min-height) — чтобы блок НЕ менял размер при разных
     ролях. Описания ролей разной длины: «Двойной голос...» (1 строка) vs
     «Если вы голосовали...» (2 строки). С фиксированной высотой + overflow
     длинные описания обрежутся, но блок не «прыгнет». */
  height: 130px;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
/* описание силы — всегда 2 строки по высоте (даже если короткое). Так
   my-role-block не меняет размер между ролями. */
.my-role-block .tiny:last-child {
  min-height: 32px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1.3;
  margin-top: 4px;
  padding: 0 4px;
}
.my-role-name { font-size: 18px; font-weight: 800; margin: 2px 0; }

/* планшет/десктоп (≥768px): узкая колонка по центру, как в мобильной версии.
   Свайп страниц (Доверие/Роли) остаётся и здесь — один и тот же дизайн для
   всех экранов. Никаких всплывающих окон, весь игровой экран на одной
   вертикали: header → полоса доверия → шаг → фид. */
@media (min-width: 768px) {
  /* ВАЖНО: НЕ расширяем колонку на десктопе. Дизайн остаётся узким —
     max-width 540px везде, как в мобиле. На широком экране просто больше
     пустого поля по бокам, но интерфейс идентичен мобильному. */
  .bottom-feed, .strip-page, .step-overlay, .lobby, .screen-card {
    max-width: 540px; margin-left: auto; margin-right: auto; width: 100%;
  }
  body { font-size: 16px; }
  .trust-hbar { height: 26px; }
  .trust-hrow { grid-template-columns: 110px 1fr; }
  .trust-hlabel { font-size: 13px; }
  .strip-page { padding: 14px 16px; }
  .bottom-feed { padding: 12px 16px 24px; }
}

/* очень узкие экраны: меньше отступов */
@media (max-width: 360px) {
  .strip-page { padding: 8px 10px; }
  .bottom-feed { padding: 10px; }
  .player-card.role-card-mini { flex: 0 0 180px; }
  .trust-hrow { grid-template-columns: 84px 1fr; gap: 6px; }
  .trust-hlabel { font-size: 10.5px; line-height: 1.05; }
}
