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

:root {
  --bg: #0f1115;
  --bg2: #161a21;
  --bg3: #1f2530;
  --panel: #1a1f28;
  --panel2: #232a36;
  --text: #e8eaed;
  --muted: #8b94a3;
  --accent: #e8553d;
  --accent-hover: #f06b54;
  --accent-dark: #2a0c06;  /* тёмный текст на акцентной плашке */
  --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; }

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;
  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); }

/* ---------- оверлеи: стартовые экраны ---------- */
.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;
}
.tagline { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 14px; }
.btn-col { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

/* ---------- лобби ---------- */
.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;
}
.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); }
.crown { color: var(--accent); }
.bot-tag {
  font-size: 11px; padding: 2px 6px; background: var(--bg3); border-radius: 4px;
  color: var(--muted); margin-left: 6px;
}

/* ---------- каркас игры: 2 вкладки снизу + полноэкранные шаги сверху ---------- */
.game-shell {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}
.game-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  padding-top: calc(10px + var(--safe-top));
  background: var(--bg2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.game-header .brand { font-weight: 700; font-size: 16px; }
.game-header .spacer { flex: 1; }
.chip {
  font-size: 12px; padding: 4px 8px; border-radius: 999px;
  background: var(--bg3); border: 1px solid var(--line);
}

/* таб-бар снизу — 2 вкладки по требованию */
.tab-bar {
  display: flex;
  background: var(--bg2); border-top: 1px solid var(--line);
  position: sticky; bottom: 0;
  padding-bottom: var(--safe-bottom);
  z-index: 5;
}
.tab-bar button {
  flex: 1; border: none; border-radius: 0; background: transparent;
  padding: 12px 8px; font-size: 13px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tab-bar button.active { color: var(--accent); }
.tab-bar button.active .tab-icon { filter: drop-shadow(0 0 6px var(--accent)); }
.tab-icon { font-size: 18px; line-height: 1; }

.tab-content { flex: 1; overflow-y: auto; padding: 14px; padding-bottom: 80px; }

/* ---- вкладка: доверие фракций ---- */
.faction-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.faction-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
}
.faction-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.faction-name { flex: 1; font-size: 14px; }
.trust-bar {
  flex: 2; height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; position: relative;
}
.trust-fill { height: 100%; border-radius: 4px; transition: width .25s; }
.trust-value { width: 28px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.trust-delta { width: 28px; text-align: right; font-size: 12px; font-weight: 600; }
.trust-delta.up { color: var(--good); }
.trust-delta.down { color: var(--bad); }
.treasury-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--panel2); border-radius: 10px; margin-bottom: 10px;
}
.treasury-row b { color: var(--accent); font-size: 18px; }
.law-mini {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 12px;
}
.law-mini .lt { font-size: 14px; }

/* ---- вкладка: игроки по должностям ---- */
.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); }
.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-info { flex: 1; min-width: 0; }
.player-name { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--bg3); }
.pres-tag { font-size: 11px; padding: 2px 6px; border-radius: 4px; background: var(--accent); color: var(--accent-dark); font-weight: 700; }
.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-ability { font-size: 12px; color: var(--muted); margin-top: 4px; }
.player-coins { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---- полноэкранные шаги (модалы) ---- */
.step-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));
  animation: fadeIn .18s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.step-card {
  width: 100%; max-width: 500px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 24px 20px;
  max-height: 90vh; overflow-y: auto;
}
.step-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; text-align: center; }
.step-sub { text-align: center; color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.step-timer {
  position: fixed; top: calc(12px + var(--safe-top)); left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 999px; font-variant-numeric: tabular-nums;
  font-weight: 700; z-index: 51;
}
.step-timer.urgent { color: var(--bad); border-color: var(--bad); }

/* голосование: большая карта закона + ЗА/ПРОТИВ */
.vote-law {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 16px; font-size: 15px;
}
.vote-law-num { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.vote-buttons { display: flex; gap: 12px; }
.vote-buttons button { flex: 1; padding: 18px; font-size: 18px; font-weight: 700; border-radius: 14px; }
.vote-tally {
  display: flex; gap: 16px; justify-content: center; margin: 12px 0;
  font-variant-numeric: tabular-nums;
}
.vote-tally .for { color: var(--good); }
.vote-tally .against { color: var(--bad); }
.premier-row { display: flex; gap: 8px; justify-content: center; margin-top: 12px; align-items: center; }

/* выбор кандидата: список */
.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); }

/* применение силы: выбор цели */
.target-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.target-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer;
}

/* финал */
.final-screen { text-align: center; }
.winner-card { margin-bottom: 20px; }
.standings { display: flex; flex-direction: column; gap: 8px; }
.standing-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: var(--bg2); border-radius: 10px;
}

/* тосты */
.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); } }

/* планшет/десктоп: шире контент */
@media (min-width: 768px) {
  .tab-content { max-width: 720px; margin: 0 auto; width: 100%; }
  .screen-card { max-width: 480px; }
  body { font-size: 16px; }
}

/* очень узкие экраны: меньше отступов */
@media (max-width: 360px) {
  .tab-content { padding: 10px; }
  .faction-name { font-size: 13px; }
}
