* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  background: #000;
  color: #eee;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.screen { display: none; flex-direction: column; align-items: center; gap: 16px;
  padding: 24px 16px 90px; max-width: 480px; margin: 0 auto; }
.screen.active { display: flex; }

/* нижнее меню — видно всегда */
.navbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: #000; border-top: 2px solid #333; z-index: 10;
  padding-bottom: env(safe-area-inset-bottom); }
.nav-btn { flex: 1; background: none; border: none; color: #888; font-size: 1.4rem;
  padding: 8px 0 6px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 2px; }
.nav-btn small { font-size: 0.65rem; }
.nav-btn.active { color: #fff; }
.nav-btn.active small { color: #2c2; }

.title { text-align: center; font-size: 2.4rem; letter-spacing: 4px; margin-top: 8vh;
  color: #fff; text-shadow: 0 0 12px #e33, 0 0 24px #33e; }
h2 { text-align: center; }

.btn {
  display: block; width: 100%; padding: 14px 18px;
  background: #000; color: #eee; font-size: 1.05rem;
  border-radius: 12px; cursor: pointer; border: 2px solid #555;
}
.btn:active { transform: scale(0.97); }
.btn.red   { border-color: #e33; box-shadow: 0 0 8px #e3333355; }
.btn.blue  { border-color: #36f; box-shadow: 0 0 8px #3366ff55; }
.btn.green { border-color: #2c2; box-shadow: 0 0 8px #22cc2255; }
.btn.yellow{ border-color: #dd0; box-shadow: 0 0 8px #dddd0055; }
.btn.big { padding: 22px; font-size: 1.2rem; }
.btn:disabled { opacity: 0.4; }

.stack { display: flex; flex-direction: column; gap: 12px; width: 100%; margin-top: 8px; }

.coins { font-size: 1.1rem; border: 2px solid #2c2; border-radius: 999px;
  padding: 6px 16px; background: #000; }

.note { color: #aaa; text-align: center; line-height: 1.5; }
.rules { text-align: left; color: #ccc; line-height: 1.7; padding-left: 20px; }
/* полоса установки на телефон — над нижним меню, поверх любого экрана */
.install-bar { position: fixed; left: 0; right: 0; bottom: 62px; z-index: 9;
  background: #000; border-top: 1px solid #222; padding: 8px 16px 10px;
  display: flex; flex-direction: column; gap: 6px; }
.install-bar .btn { padding: 12px; }
.install-hint { font-size: 0.85rem; border: 1px solid #333;
  border-radius: 8px; padding: 8px 10px; }

/* настройка */
.stepper { display: flex; align-items: center; gap: 16px; }
.btn.step { width: 64px; font-size: 1.6rem; padding: 8px; }
.step-val { text-align: center; font-size: 1.8rem; min-width: 90px; }
.step-val small { color: #aaa; font-size: 0.85rem; }

#roles-box { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.suit-group { border: 1px solid #333; border-radius: 12px; padding: 10px; }
.suit-title { margin-bottom: 8px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid #555; border-radius: 999px; padding: 8px 14px;
  background: #000; color: #eee; cursor: pointer; font-size: 0.95rem; }
.chip.red   { border-color: #e33; }
.chip.blue  { border-color: #36f; }
.chip.green { border-color: #2c2; }
.chip.yellow{ border-color: #dd0; }
.chip.off { opacity: 0.35; }
.chip.locked { border-style: dashed; }  /* ядро 6♦/6♣/6♥ — снять нельзя, но копии добавлять можно */
.chip.disabled { opacity: 0.2; pointer-events: none; }
.counter { color: #aaa; }
.counter.bad { color: #e33; }

/* карта роли */
.card { width: 100%; border: 3px solid #555; border-radius: 20px; padding: 24px;
  text-align: center; background: #050505; }
.card.red   { border-color: #e33; box-shadow: 0 0 18px #e3333366; }
.card.blue  { border-color: #36f; box-shadow: 0 0 18px #3366ff66; }
.card.green { border-color: #2c2; box-shadow: 0 0 18px #22cc2266; }
.card.yellow{ border-color: #dd0; box-shadow: 0 0 18px #dddd0066; }
.card-rank { font-size: 2rem; font-weight: 700; }
.card-suit { font-size: 4rem; line-height: 1.1; }
.card-name { font-size: 1.4rem; font-weight: 600; margin-top: 6px; }
.card-faction { color: #aaa; margin-bottom: 12px; }
.card-abilities { text-align: left; line-height: 1.6; padding-left: 20px; color: #ddd; }

.ending { width: 100%; border: 2px solid #555; border-radius: 12px; padding: 12px;
  line-height: 1.5; }
.ending.red-b { border-color: #e33; }
.ending.blue-b { border-color: #36f; }
.ending.green-b { border-color: #2c2; }
.ending.yellow-b { border-color: #dd0; }

.commentary { width: 100%; border: 2px solid #36f; border-radius: 12px; padding: 14px;
  line-height: 1.6; color: #ddd; font-style: italic; }

.shop-item { width: 100%; border: 2px solid #e33; border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; text-align: center; }
.shop-name { font-size: 1.15rem; font-weight: 600; }
.shop-desc { color: #aaa; }

.version { color: #666; font-size: 0.85rem; margin-top: 12px; }

.status-banner { width: 100%; text-align: center; font-size: 1.1rem; min-height: 1.3em;
  color: #e33; }
.card.compact { padding: 12px; }
.card.compact .card-suit { font-size: 2.2rem; }
.card.compact .card-rank { font-size: 1.2rem; }
.card.compact .card-abilities { display: none; }
h3 { align-self: flex-start; color: #aaa; font-size: 1rem; font-weight: 600; }
.ability-btn small { display: block; color: #888; font-size: 0.8rem; }

.room-code { font-size: 2.6rem; letter-spacing: 8px; font-weight: 700;
  border: 2px solid #2c2; border-radius: 16px; padding: 10px 22px; }
.player-row { border: 1px solid #444; border-radius: 10px; padding: 10px;
  color: #eee; display: flex; justify-content: space-between; align-items: center; }
.with-avatar { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 1px solid #555; }
.avatar-mini { width: 20px; height: 20px; }
.avatar-big { width: 84px; height: 84px; border: 2px solid #36f; }
.msg .with-avatar { gap: 6px; }
.player-row .lose { color: #e33; }
.player-row .win { color: #2c2; }

/* чат */
.chat-status { color: #e33; text-align: center; min-height: 1.2em; }
.chat-log { width: 100%; min-height: 200px; max-height: 45vh; overflow-y: auto;
  border: 1px solid #333; border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; line-height: 1.4;
  border: 2px solid #36f; align-self: flex-start; word-wrap: break-word; }
.msg.me { border-color: #2c2; align-self: flex-end; }
.msg small { color: #888; display: block; font-size: 0.75rem; }
.field { width: 100%; background: #000; color: #eee; border: 2px solid #36f;
  border-radius: 12px; padding: 10px 12px; font-size: 1rem; font-family: inherit; }

/* история игр */
.history-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.history-item { border: 1px solid #444; border-radius: 10px; padding: 10px;
  color: #ccc; line-height: 1.5; font-size: 0.95rem; }
.history-item b { color: #eee; }

#net-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; text-align: center;
  background: #000; color: #e33; border-bottom: 2px solid #e33; padding: 6px;
  font-size: 0.9rem; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #000; border: 2px solid #2c2; border-radius: 12px; padding: 10px 18px;
  opacity: 0; transition: opacity 0.3s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }

.names-details { width: 100%; border: 1px solid #333; border-radius: 12px; padding: 10px; }
.names-details summary { color: #aaa; cursor: pointer; }
.names-details .field { margin-top: 8px; }

/* объяснение исхода игрока на экране итогов (разворачивается по нажатию) */
.note.why { text-align: left; margin: -4px 0 10px; padding: 8px 10px;
  border-left: 3px solid #444; background: #111; font-size: 0.85rem; }
