/* 100% Автономный стиль для детской настольной онлайн-игры Russia Quest */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Comic Sans MS", Helvetica, Arial, sans-serif;
}

body {
  background: linear-gradient(135deg, #091a32 0%, #0d1e38 50%, #081426 100%);
  color: #f8fafc;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(6px, 1.5vw, 12px) clamp(6px, 1.5vw, 12px) clamp(24px, 4vw, 40px);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app-container {
  width: 100%;
  max-width: 1160px;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5vw, 12px);
  position: relative;
}

/* ================= НАВИГАЦИОННАЯ ПАНЕЛЬ ================= */
.main-navbar {
  background: rgba(23, 37, 62, 0.95);
  border: 2px solid #334e68;
  border-radius: 20px;
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.brand-icon {
  font-size: 32px;
  animation: floatBrand 3s infinite ease-in-out;
}
@keyframes floatBrand {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.brand-text h1 {
  font-size: 18px;
  font-weight: 900;
  color: #38bdf8;
  line-height: 1.2;
}
.brand-text p {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-btn {
  cursor: pointer;
  background: #1e293b;
  border: 1.5px solid #475569;
  color: #f8fafc;
  padding: 7px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.nav-btn:hover {
  background: #334155;
  border-color: #38bdf8;
  transform: translateY(-1px);
}
.user-badge {
  background: #0f172a;
  border: 1.5px solid #0284c7;
  border-radius: 14px;
  padding: 5px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
  color: #f8fafc;
}
.user-avatar-tag {
  font-size: 18px;
}

/* ================= ЭКРАНЫ (VIEWS) ================= */
.view-section {
  display: none;
  width: 100%;
  animation: fadeIn 0.25s ease;
}
.view-section.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= ЭКРАН ВХОДА И РЕГИСТРАЦИИ ================= */
.auth-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 0 40px;
}
.auth-card {
  background: #142137;
  border: 3px solid #38bdf8;
  border-radius: 28px;
  width: 100%;
  max-width: 440px;
  padding: 28px 24px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  text-align: center;
}
.auth-tabs {
  display: flex;
  background: #0f172a;
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab-btn {
  flex: 1;
  cursor: pointer;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 10px;
  font-size: 14px;
  font-weight: 900;
  border-radius: 10px;
  transition: all 0.15s ease;
}
.auth-tab-btn.active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2,132,199,0.5);
}
.form-group {
  text-align: left;
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #cbd5e1;
  margin-bottom: 5px;
}
.form-input {
  width: 100%;
  background: #0f172a;
  border: 1.8px solid #334155;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  outline: none;
  transition: border-color 0.15s ease;
}
.form-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}
.avatar-picker {
  display: flex;
  justify-content: space-around;
  margin-top: 6px;
}
.avatar-opt {
  cursor: pointer;
  font-size: 28px;
  padding: 6px 12px;
  border-radius: 12px;
  background: #1e293b;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}
.avatar-opt:hover {
  transform: scale(1.1);
}
.avatar-opt.selected {
  border-color: #facc15;
  background: #334155;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.5);
}
.btn-submit {
  width: 100%;
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border: none;
  color: #ffffff;
  padding: 12px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 4px 0 #0369a1;
  margin-top: 10px;
  transition: all 0.15s ease;
}
.btn-submit:hover { transform: scale(1.02); }
.btn-submit:active { transform: translateY(3px); box-shadow: none; }
.auth-msg {
  font-size: 13px;
  font-weight: 800;
  margin-top: 10px;
  min-height: 20px;
}
.auth-msg.error { color: #f87171; }
.auth-msg.success { color: #4ade80; }

/* ================= ЭКРАН ЛОББИ (СПИСОК КОМНАТ) ================= */
.lobby-header {
  background: #17253e;
  border: 2px solid #334e68;
  border-radius: 20px;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.lobby-title h2 {
  font-size: 20px;
  font-weight: 900;
  color: #38bdf8;
}
.lobby-title p {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 700;
}
.btn-create-room {
  cursor: pointer;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #ffffff;
  padding: 11px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 4px 0 #047857;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.btn-create-room:hover { transform: scale(1.02); }
.btn-create-room:active { transform: translateY(3px); box-shadow: none; }

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.room-card {
  background: #142137;
  border: 2px solid #284469;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: all 0.2s ease;
}
.room-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
}
.room-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.room-card-title {
  font-size: 16px;
  font-weight: 900;
  color: #f8fafc;
}
.room-status-badge {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
}
.room-status-badge.waiting {
  background: #065f46;
  color: #a7f3d0;
  border: 1px solid #10b981;
}
.room-status-badge.playing {
  background: #78350f;
  color: #fef08a;
  border: 1px solid #f59e0b;
}
.room-card-meta {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.room-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.btn-join-play {
  flex: 1;
  cursor: pointer;
  background: #0284c7;
  border: none;
  color: #ffffff;
  padding: 9px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  transition: all 0.15s ease;
}
.btn-join-play:hover { background: #0369a1; }
.btn-join-watch {
  flex: 1;
  cursor: pointer;
  background: #334155;
  border: 1.5px solid #64748b;
  color: #f8fafc;
  padding: 9px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  transition: all 0.15s ease;
}
.btn-join-watch:hover { background: #475569; }

.no-rooms-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: #142137;
  border: 2px dashed #334e68;
  border-radius: 20px;
  color: #94a3b8;
  font-size: 15px;
  font-weight: 700;
}

/* ================= ЭКРАН ИГРЫ (GAME VIEW) ================= */
.game-top-dock {
  background: #17253e;
  border: 2px solid #334e68;
  border-radius: 20px;
  padding: 10px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.game-room-title {
  font-size: 16px;
  font-weight: 900;
  color: #38bdf8;
}
.spectator-banner {
  background: #78350f;
  border: 1.5px solid #f59e0b;
  color: #fef08a;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 10px;
  animation: pulseSpec 2s infinite ease-in-out;
}
@keyframes pulseSpec {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Кнопки медиа и видеосвязи */
.game-media-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.media-btn {
  cursor: pointer;
  background: #1e293b;
  border: 1.5px solid #334155;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}
.media-btn:hover {
  background: #334155;
  color: #ffffff;
}
.media-btn.active {
  background: #065f46;
  border-color: #10b981;
  color: #a7f3d0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.media-btn.muted {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #fecaca;
}
.header-chat-btn {
  cursor: pointer;
  background: #0369a1;
  border: 1.5px solid #0284c7;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: all 0.2s ease;
}
.header-chat-btn:hover {
  background: #0284c7;
}
.chat-badge {
  background: #ef4444;
  color: white;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 900;
  animation: pulseSpec 1.5s infinite;
}

.btn-terminate-room {
  cursor: pointer;
  background: linear-gradient(135deg, #b91c1c, #991b1b);
  border: 1.5px solid #ef4444;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.4);
  transition: all 0.15s ease;
}
.btn-terminate-room:hover {
  background: #dc2626;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.6);
  transform: translateY(-1px);
}

.btn-admin-terminate {
  cursor: pointer;
  background: #7f1d1d;
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 900;
  transition: all 0.15s ease;
}
.btn-admin-terminate:hover {
  background: #b91c1c;
  color: #ffffff;
}

.btn-leave-room {
  cursor: pointer;
  background: #475569;
  border: 1px solid #64748b;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 900;
  transition: all 0.15s ease;
}
.btn-leave-room:hover { background: #334155; }

/* Панель игроков */
.players-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.player-card {
  background: #142137;
  border: 2.5px solid #284469;
  border-radius: 16px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.player-card.active-turn {
  border-color: #facc15;
  background: #1b2d4b;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.45);
  transform: translateY(-2px);
}
.player-card.active-turn::after {
  content: "ХОД!";
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 9px;
  font-weight: 900;
  background: #facc15;
  color: #713f12;
  padding: 2px 6px;
  border-radius: 8px;
}
.player-avatar-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b1322;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
.player-avatar {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}
.player-video-feed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
  z-index: 2;
}
.player-video-feed.local-mirror {
  transform: scaleX(-1);
}
.player-media-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  z-index: 4;
  display: flex;
  gap: 2px;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 6px;
  padding: 1px 3px;
  font-size: 10px;
  line-height: 1;
}
.player-info {
  flex: 1;
  min-width: 0;
}
.player-name-line {
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-sub-line {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 700;
}
.skip-flag {
  font-size: 9px;
  font-weight: 900;
  background: #ef4444;
  color: #fff;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
}

/* Док броска кубика */
.dice-bar {
  background: #101c31;
  border: 2px solid #284469;
  border-radius: 18px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.dice-action-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cube-btn {
  cursor: pointer;
  width: 58px;
  height: 58px;
  background: #ffffff;
  border: 3px solid #38bdf8;
  border-radius: 16px;
  font-size: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #0284c7;
  transition: all 0.15s ease;
  color: #0f172a;
}
.cube-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0284c7; }
.cube-btn.rolling {
  animation: cubeSpin 0.35s infinite linear;
  pointer-events: none;
}
@keyframes cubeSpin {
  0% { transform: rotate(0deg) scale(1.1); }
  50% { transform: rotate(180deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1.1); }
}
.roll-btn {
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border: none;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 4px 0 #0369a1;
  transition: all 0.15s ease;
}
.roll-btn:hover { transform: scale(1.02); }
.roll-btn:active { transform: translateY(3px); box-shadow: none; }
.roll-btn:disabled {
  background: #475569;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}
.turn-status-text {
  font-size: 14px;
  font-weight: 800;
  color: #facc15;
}

/* ================= ОБЩАЯ КАРТА РОССИИ ВВЕРХУ ================= */
.overview-map-card {
  background: #101c31;
  border: 2px solid #233854;
  border-radius: 20px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.overview-title {
  font-size: 13px;
  font-weight: 900;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.overview-stage-tag {
  background: #1e3a5f;
  border: 1px solid #38bdf8;
  color: #bae6fd;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
}
.overview-svg-wrap {
  width: 100%;
  aspect-ratio: 1000 / 150;
  max-height: 140px;
  height: auto;
  min-height: 55px;
  background: linear-gradient(180deg, #071529 0%, #0c1c36 100%);
  border-radius: clamp(10px, 2vw, 16px);
  border: 1.5px solid #1e3a5f;
  overflow: hidden;
  position: relative;
}
#overview-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ================= НАВИГАЦИЯ ПО РЕГИОНАМ ================= */
.region-nav {
  background: #13223b;
  border: 2px solid #284469;
  border-radius: 16px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.nav-arrow {
  cursor: pointer;
  background: #1e3352;
  border: 1.5px solid #3b5a82;
  color: #38bdf8;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  touch-action: manipulation;
}
.nav-arrow:hover { background: #2a476f; color: #fff; }
.region-info {
  text-align: center;
  flex: 1;
}
.region-name {
  font-size: 16px;
  font-weight: 900;
  color: #facc15;
}
.region-span {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

/* ================= ИГРОВОЙ ХОЛСТ С БИОМАМИ ================= */
.stage-canvas-wrap {
  width: 100%;
  aspect-ratio: 1000 / 560;
  max-height: 560px;
  height: auto;
  background: #071529;
  border: 3.5px solid #38bdf8;
  border-radius: clamp(14px, 2.5vw, 24px);
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.65);
}
#stage-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Виньетки животных:
   КРИТИЧЕСКИЙ BUGFIX: НЕ использовать transform: scale на <g class="nature-badge">!
   Координаты зафиксированы! Масштабируется ТОЛЬКО внутренний эмодзи!
*/
.nature-badge {
  cursor: pointer;
}
.nature-badge .nature-halo {
  transition: all 0.25s ease;
}
.nature-badge:hover .nature-halo {
  fill: rgba(56, 189, 248, 0.35);
  stroke: #facc15;
  stroke-width: 3.5px;
  filter: drop-shadow(0 0 14px rgba(250, 204, 21, 0.85));
}
.nature-badge:hover .nature-disc {
  stroke: #facc15;
  stroke-width: 3px;
}
.nature-badge .nature-emoji {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nature-badge:hover .nature-emoji {
  transform: scale(1.24);
}
.nature-badge .nature-tag rect {
  transition: all 0.2s ease;
}
.nature-badge:hover .nature-tag rect {
  fill: #1e293b;
  stroke: #facc15;
}

/* ================= МОДАЛКИ (MODALS) ================= */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(8, 17, 34, 0.88);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.modal-card {
  background: #142137;
  border: 3.5px solid #38bdf8;
  border-radius: 28px;
  width: 100%;
  max-width: 540px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  position: relative;
}
@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-close-cross {
  position: absolute;
  top: 14px;
  right: 18px;
  cursor: pointer;
  font-size: 20px;
  color: #94a3b8;
  font-weight: 900;
  background: transparent;
  border: none;
}
.modal-close-cross:hover { color: #f8fafc; }

/* Вопрос */
.quest-player-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}
.quest-tag {
  display: inline-block;
  background: #0284c7;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.quest-prompt {
  font-size: 22px;
  font-weight: 900;
  color: #f8fafc;
  margin-bottom: 16px;
  line-height: 1.35;
}
.choices-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
}
.choice-btn {
  cursor: pointer;
  background: #1e293b;
  border: 2px solid #475569;
  border-radius: 16px;
  padding: 12px 22px;
  font-size: 17px;
  font-weight: 900;
  color: #f8fafc;
  transition: all 0.15s ease;
  min-width: 90px;
}
.choice-btn:hover {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
  transform: translateY(-2px);
}
.btn-listen {
  cursor: pointer;
  background: #334155;
  border: 1.5px solid #64748b;
  color: #f8fafc;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  transition: all 0.15s ease;
}
.btn-listen:hover { background: #475569; }

.consult-box {
  border-top: 1px dashed #334e68;
  padding-top: 14px;
  margin-top: 10px;
}
.btn-consult {
  cursor: pointer;
  background: #451a03;
  border: 2px solid #f59e0b;
  color: #fbbf24;
  font-size: 13px;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.btn-consult:hover { background: #78350f; transform: scale(1.02); }
.consult-warn {
  font-size: 11px;
  color: #fb923c;
  margin-top: 6px;
  font-weight: 600;
}
.quest-feedback {
  font-size: 15px;
  font-weight: 800;
  margin-top: 12px;
  min-height: 24px;
}
.quest-feedback.ok { color: #4ade80; }
.quest-feedback.bad { color: #f87171; }

/* Таблица лидеров */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 13px;
}
.leaderboard-table th {
  background: #0f172a;
  color: #38bdf8;
  padding: 10px;
  text-align: center;
  font-weight: 900;
  border-bottom: 2px solid #334e68;
}
.leaderboard-table td {
  padding: 10px;
  text-align: center;
  border-bottom: 1px solid #1e293b;
  font-weight: 700;
}
.leaderboard-table tr:hover td {
  background: #1e3a5f;
}
.rank-1 { color: #facc15; font-weight: 900; font-size: 16px; }
.rank-2 { color: #e2e8f0; font-weight: 900; font-size: 15px; }
.rank-3 { color: #d97706; font-weight: 900; font-size: 15px; }

/* Ареал */
.habitat-emoji {
  font-size: 64px;
  margin-bottom: 8px;
}
.habitat-title-en {
  font-size: 24px;
  font-weight: 900;
  color: #38bdf8;
}
.habitat-title-ru {
  font-size: 17px;
  font-weight: 800;
  color: #facc15;
  margin-bottom: 14px;
}
.habitat-desc-box {
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#confetti-canvas {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Стили для слотов и ботов */
.bot-badge {
  font-size: 9px;
  font-weight: 900;
  background: #6366f1;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 5px;
  display: inline-block;
  vertical-align: middle;
  letter-spacing: 0.5px;
}
.slot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  border: 1.5px solid #334155;
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.slot-label {
  font-size: 13px;
  font-weight: 800;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.slot-select {
  background: #1e293b;
  border: 1.5px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  outline: none;
  cursor: pointer;
}
.slot-select:focus {
  border-color: #38bdf8;
}
.slot-summary-hint {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 700;
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 8px;
  border: 1px dashed rgba(56, 189, 248, 0.4);
}

/* ================= АДМИН-ПАНЕЛЬ И РОЛЕВАЯ МОДЕЛЬ ================= */
.admin-nav-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
  color: #ffffff !important;
  border: 1px solid #fbbf24 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  font-weight: 800;
}
.admin-nav-btn:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  transform: translateY(-1px);
}

.badge-role {
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 6px;
  display: inline-block;
}
.badge-role-admin {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: 1px solid #fde68a;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}
.badge-role-player {
  background: #1e3a5f;
  color: #38bdf8;
  border: 1px solid #0284c7;
}

.modal-admin-card {
  max-width: 960px !important;
  width: 95% !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  text-align: left !important;
}

.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-stat-card {
  background: #0f172a;
  border: 1.5px solid #1e293b;
  border-radius: 14px;
  padding: 12px 16px;
  text-align: center;
}
.admin-stat-card.stat-online {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.04);
}
.admin-stat-card.stat-admins {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.04);
}
.admin-stat-val {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.1;
  color: #38bdf8;
}
.stat-online .admin-stat-val {
  color: #4ade80;
}
.stat-admins .admin-stat-val {
  color: #facc15;
}
.admin-stat-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-top: 4px;
}

.admin-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.admin-filter-bar input {
  flex: 1;
  min-width: 200px;
}

.admin-table-container {
  flex: 1;
  overflow-y: auto;
  max-height: 420px;
  background: #0f172a;
  border: 1.5px solid #1e293b;
  border-radius: 14px;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-users-table th {
  background: #1e293b;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid #334155;
}
.admin-users-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #1e293b;
  vertical-align: middle;
  color: #f8fafc;
}
.admin-users-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Онлайн / Офлайн индикаторы */
.status-badge-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
  white-space: nowrap;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 rgba(34, 197, 94, 0.7);
  animation: onlinePulse 2s infinite;
}
@keyframes onlinePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.status-badge-offline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(148, 163, 184, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
}
.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
}

/* Кнопки действий администратора */
.admin-actions-cell {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.btn-admin-act {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-admin-act:hover {
  transform: translateY(-1px);
}
.btn-admin-act:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.btn-act-role {
  background: #1e3a5f;
  color: #38bdf8;
  border: 1px solid #0284c7;
}
.btn-act-role:hover {
  background: #0284c7;
  color: #ffffff;
}
.btn-act-pwd {
  background: #334155;
  color: #facc15;
  border: 1px solid #475569;
}
.btn-act-pwd:hover {
  background: #475569;
}
.btn-act-del {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-act-del:hover {
  background: #ef4444;
  color: #ffffff;
}

/* ================= АДАПТИВНЫЙ ДИЗАЙН: СМАРТФОНЫ И ПЛАНШЕТЫ ================= */

/* Подсказка ориентации для телефонов в портретном режиме */
.mobile-orient-tip {
  display: none;
  background: rgba(14, 116, 144, 0.25);
  border: 1.5px dashed #38bdf8;
  border-radius: 12px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 800;
  color: #bae6fd;
  text-align: center;
  align-items: center;
  justify-content: center;
  gap: 8px;
  animation: fadeInTip 0.5s ease;
}
@keyframes fadeInTip {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= ТЕКСТОВЫЙ ЧАТ (DRAWER & FAB) ================= */
.chat-fab-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: 2.5px solid #38bdf8;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 990;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}
.chat-fab-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.7);
}
.chat-fab-btn:active {
  transform: scale(0.95);
}
.chat-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #ffffff;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 900;
  border: 2px solid #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bounceBadge 0.4s ease;
}
@keyframes bounceBadge {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 20, 0.6);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.chat-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.chat-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  max-width: 92vw;
  height: 100vh;
  height: 100dvh;
  background: #0f1c31;
  border-left: 2px solid #284469;
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 36px rgba(0, 0, 0, 0.65);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-drawer.open {
  right: 0;
}

.chat-header {
  padding: 14px 16px;
  background: #142540;
  border-bottom: 1.5px solid #284469;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-title {
  font-size: 15px;
  font-weight: 900;
  color: #38bdf8;
}
.chat-subtitle {
  font-size: 11px;
  color: #94a3b8;
}
.chat-close-btn {
  cursor: pointer;
  background: #1e3352;
  border: none;
  color: #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.chat-close-btn:hover {
  background: #dc2626;
  color: #ffffff;
}

.chat-messages-box {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-welcome-note {
  background: #132742;
  border: 1px dashed #0284c7;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #93c5fd;
  text-align: center;
  margin-bottom: 6px;
}

.chat-msg-item {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  gap: 3px;
  animation: fadeIn 0.2s ease;
}
.chat-msg-item.self {
  align-self: flex-end;
}
.chat-msg-item.other {
  align-self: flex-start;
}
.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
  padding: 0 4px;
}
.chat-msg-item.self .chat-msg-meta {
  flex-direction: row-reverse;
}
.chat-role-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 1px 6px;
  border-radius: 6px;
}
.chat-role-badge.player {
  background: #0284c7;
  color: #ffffff;
}
.chat-role-badge.host {
  background: #d97706;
  color: #ffffff;
}
.chat-role-badge.spectator {
  background: #475569;
  color: #e2e8f0;
}
.chat-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}
.chat-msg-item.self .chat-bubble {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}
.chat-msg-item.other .chat-bubble {
  background: #1e3352;
  color: #f1f5f9;
  border-bottom-left-radius: 2px;
  border: 1px solid #2d4c77;
}
.chat-msg-item.quick-emoji .chat-bubble {
  font-size: 26px;
  background: transparent !important;
  padding: 2px 4px;
  border: none !important;
}

.chat-quick-reactions {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  background: #142540;
  border-top: 1px solid #203859;
  gap: 4px;
}
.quick-react-btn {
  cursor: pointer;
  background: #1a2e4c;
  border: 1px solid #2d4d77;
  border-radius: 8px;
  font-size: 18px;
  padding: 4px 6px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}
.quick-react-btn:hover {
  transform: scale(1.15);
  background: #254470;
}

.chat-input-form {
  padding: 10px 14px;
  background: #142540;
  display: flex;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: #0b1322;
  border: 1.5px solid #284469;
  color: #f8fafc;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}
.chat-input:focus {
  border-color: #38bdf8;
}
.chat-send-btn {
  cursor: pointer;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  border: none;
  color: #ffffff;
  width: 40px;
  height: 38px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.chat-send-btn:hover {
  background: #0284c7;
  transform: translateY(-1px);
}
.chat-privacy-hint {
  padding: 6px 14px 10px;
  background: #142540;
  font-size: 10px;
  color: #64748b;
  text-align: center;
  border-top: 1px dashed #1e3352;
}

/* 1. ПЛАНШЕТЫ (Ширина экрана до 1024px) */
@media (max-width: 1024px) {
  .app-container {
    max-width: 100%;
    gap: 10px;
  }
  .main-navbar {
    padding: 10px 14px;
    border-radius: 16px;
  }
  .brand-text h1 {
    font-size: 16px;
  }
  .brand-text p {
    font-size: 10px;
  }
  .players-bar {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    gap: 6px;
  }
  .player-card {
    padding: 7px 10px;
  }
  .player-avatar {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  .player-name-line {
    font-size: 12px;
  }
  .dice-bar {
    padding: 8px 14px;
    border-radius: 16px;
  }
  .cube-btn {
    width: 52px;
    height: 52px;
    font-size: 34px;
  }
  .modal-card {
    max-width: 90%;
    padding: 20px;
  }
}

/* 2. СМАРТФОНЫ (Ширина экрана до 640px) */
@media (max-width: 640px) {
  body {
    padding: 4px 4px 30px;
  }
  .mobile-orient-tip {
    display: flex;
  }

  /* Шапка на смартфонах */
  .main-navbar {
    padding: 8px 10px;
    border-radius: 14px;
    gap: 8px;
  }
  .brand-logo {
    gap: 6px;
  }
  .brand-icon {
    font-size: 24px;
  }
  .brand-text h1 {
    font-size: 13px;
    line-height: 1.15;
  }
  .brand-text p {
    display: none;
  }
  .nav-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
  }
  .nav-btn {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 9px;
    gap: 4px;
  }
  .user-badge {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 9px;
    gap: 5px;
  }
  #nav-user-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Экран авторизации на смартфонах */
  .auth-wrap {
    padding: 10px 4px;
  }
  .auth-card {
    padding: 16px 12px;
    border-radius: 18px;
  }
  .form-input {
    padding: 9px 12px;
    font-size: 14px;
  }
  .avatar-opt {
    font-size: 22px;
    padding: 4px 8px;
  }
  .btn-submit {
    padding: 10px;
    font-size: 14px;
    border-radius: 12px;
  }

  /* Экран лобби на смартфонах */
  .lobby-header {
    padding: 12px 14px;
    border-radius: 14px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 10px;
  }
  .lobby-title h2 {
    font-size: 16px;
  }
  .lobby-title p {
    font-size: 11px;
  }
  .btn-create-room {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 12px;
  }
  .rooms-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .room-card {
    padding: 12px 14px;
    border-radius: 16px;
  }
  .room-card-title {
    font-size: 14px;
  }
  .room-card-meta {
    font-size: 11px;
    gap: 4px;
  }
  .btn-join-play, .btn-join-watch {
    font-size: 12px;
    padding: 9px;
    border-radius: 10px;
  }

  /* Игровой док и ожидание */
  .game-top-dock {
    padding: 8px 10px;
    border-radius: 12px;
    gap: 6px;
  }
  .game-room-title {
    font-size: 13px;
  }
  .btn-leave-room {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 9px;
  }
  #lobby-waiting-banner {
    padding: 10px 12px;
    border-radius: 14px;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  #btn-start-game {
    width: 100%;
    padding: 10px;
    font-size: 14px;
  }

  /* Карточки игроков в комнате (2x2 сетка на телефоне) */
  .players-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .player-card {
    padding: 6px 8px;
    border-radius: 12px;
    gap: 6px;
  }
  .player-avatar {
    width: 32px;
    height: 32px;
    font-size: 18px;
    border-radius: 8px;
  }
  .player-name-line {
    font-size: 11px;
  }
  .player-sub-line {
    font-size: 10px;
  }
  .player-card.active-turn::after {
    top: 2px;
    right: 4px;
    font-size: 8px;
    padding: 1px 4px;
  }

  /* Панель броска кубика */
  .dice-bar {
    padding: 8px 10px;
    border-radius: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .dice-action-area {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: 8px;
  }
  .cube-btn {
    width: 48px;
    height: 48px;
    font-size: 28px;
    border-radius: 12px;
  }
  .roll-btn {
    flex: 1;
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 12px;
    text-align: center;
  }
  .turn-status-text {
    font-size: 12px;
    text-align: center;
    width: 100%;
  }
  .dice-bar .nav-btn {
    width: 100%;
    justify-content: center;
    padding: 7px;
    font-size: 11px;
  }

  /* Общая карта России */
  .overview-map-card {
    padding: 8px 10px;
    border-radius: 14px;
    gap: 6px;
  }
  .overview-title {
    font-size: 11px;
  }
  .overview-stage-tag {
    font-size: 10px;
    padding: 2px 7px;
  }
  .overview-svg-wrap {
    border-radius: 10px;
    min-height: 50px;
  }

  /* Навигация регионов */
  .region-nav {
    padding: 6px 10px;
    border-radius: 14px;
    gap: 6px;
  }
  .nav-arrow {
    width: 34px;
    height: 34px;
    font-size: 15px;
    border-radius: 10px;
  }
  .region-name {
    font-size: 13px;
  }
  .region-span {
    font-size: 10px;
  }

  /* Игровой холст (адаптивный масштаб 1000x560) */
  .stage-canvas-wrap {
    border-width: 2.5px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  }

  /* Журнал событий */
  #history-log-box {
    padding: 8px 12px;
    border-radius: 12px;
    max-height: 70px;
  }

  /* Модалки на смартфонах */
  .modal-backdrop {
    padding: 8px;
  }
  .modal-card {
    padding: 16px 12px;
    border-radius: 18px;
    border-width: 2.5px;
    max-height: 92vh;
    overflow-y: auto;
  }
  .modal-close-cross {
    top: 10px;
    right: 12px;
    font-size: 18px;
  }
  .quest-tag {
    font-size: 10px;
    padding: 3px 10px;
    margin-bottom: 8px;
  }
  .quest-prompt {
    font-size: 16px;
    margin-bottom: 12px;
  }
  .choices-row {
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin-bottom: 12px;
  }
  .choice-btn {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    min-height: 48px;
    border-radius: 12px;
  }
  .btn-consult {
    width: 100%;
    justify-content: center;
    padding: 9px;
    font-size: 12px;
  }
  .habitat-preview-box {
    height: 140px;
    border-radius: 14px;
    margin-bottom: 10px;
  }
  .habitat-desc-box {
    font-size: 11px;
    padding: 10px;
  }

  /* Панель администратора на смартфонах */
  .modal-admin-card {
    width: 98% !important;
    padding: 12px 10px !important;
    max-height: 94vh !important;
  }
  .admin-header-row h2 {
    font-size: 16px !important;
  }
  .admin-stats-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .admin-stat-card {
    padding: 8px 10px;
  }
  .admin-stat-val {
    font-size: 18px;
  }
  .admin-filter-bar {
    flex-direction: column;
    gap: 8px;
  }
  .admin-filter-bar select {
    max-width: 100% !important;
  }
  .admin-table-container {
    max-height: 45vh;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-users-table {
    min-width: 580px;
    font-size: 12px;
  }
  .admin-users-table th, .admin-users-table td {
    padding: 8px 10px;
  }

  /* Чат и медиа-кнопки на смартфонах */
  .chat-drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
  }
  .chat-fab-btn {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  .game-media-controls {
    gap: 4px;
  }
  .media-btn {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 9px;
  }
  .media-btn-label {
    display: none;
  }
  .header-chat-btn {
    padding: 5px 8px;
    font-size: 11px;
    border-radius: 9px;
  }
  .chat-btn-text {
    display: none;
  }
}

/* 3. ГОРИЗОНТАЛЬНЫЙ РЕЖИМ СМАРТФОНОВ (Landscape, высота экрана до 520px) */
@media (max-height: 520px) and (orientation: landscape) {
  body {
    padding: 4px 6px 14px;
  }
  .mobile-orient-tip {
    display: none !important;
  }
  .main-navbar {
    padding: 4px 10px;
    border-radius: 10px;
    gap: 6px;
  }
  .brand-icon {
    font-size: 20px;
  }
  .brand-text h1 {
    font-size: 12px;
  }
  .brand-text p {
    display: none;
  }
  .players-bar {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .player-card {
    padding: 4px 6px;
  }
  .player-avatar {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }
  .player-name-line {
    font-size: 10px;
  }
  .dice-bar {
    padding: 4px 10px;
    gap: 6px;
  }
  .cube-btn {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }
  .roll-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .overview-map-card {
    padding: 4px 8px;
  }
  .overview-svg-wrap {
    max-height: 70px;
    min-height: 40px;
  }
  .stage-canvas-wrap {
    max-height: 60vh;
    margin: 0 auto;
  }
  .modal-card {
    max-height: 94vh;
    padding: 12px;
  }
  .chat-drawer {
    width: 320px;
    max-width: 85vw;
  }
  .chat-fab-btn {
    bottom: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
}

