* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #0a140f;
  font-family: system-ui, 'Segoe UI', sans-serif;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
  overscroll-behavior: none;
  color: #e8f2ea;
}

#gameCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
  background: #1c2b22;
}

.hidden { display: none !important; }

/* ===================== ЭКРАНЫ ===================== */
.screen {
  position: fixed; inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: radial-gradient(circle at 50% 30%, rgba(30,60,45,0.55), transparent 70%),
              linear-gradient(180deg, #0d1f16, #08120d);
}

.menu-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(76,175,80,0.18), transparent 55%);
  pointer-events: none;
}

.menu-inner {
  position: relative;
  width: min(430px, 92vw);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 26px 28px 22px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(22,40,30,0.92), rgba(12,24,18,0.94));
  box-shadow: 0 24px 60px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(6px);
}

.menu-title {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: 5px;
  text-align: center;
  background: linear-gradient(180deg, #7ef29b, #2ecc71 55%, #1a9e4f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 6px 24px rgba(46,204,113,0.35);
  margin: 4px 0 2px;
}

.menu-title .dot { color: #e91e63; -webkit-text-fill-color: #e91e63; }

.menu-sub {
  text-align: center;
  color: #7fae91;
  font-size: 13px;
  margin-bottom: 18px;
  letter-spacing: 1px;
}

.menu-foot {
  text-align: center;
  color: #43604f;
  font-size: 11px;
  margin-top: 14px;
}

/* Логотип в главном меню (сверху, по центру) */
.menu-logo { text-align: center; margin-bottom: 6px; }
.menu-logo img { max-width: 100%; object-fit: contain; }
.menu-logo a { display: inline-block; }

/* Верхняя панель меню: справка слева, переключатель языка справа */
.menu-topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 5;
}
.lang-switch { display: flex; flex-wrap: wrap; gap: 4px; max-width: 300px; justify-content: flex-end; }
.lang-btn {
  border: 1px solid rgba(126,242,155,0.35);
  background: rgba(0,0,0,0.45);
  color: #bfe6cd;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.lang-btn:hover { border-color: #7ef29b; color: #fff; }
.lang-btn.active { background: rgba(46,204,113,0.3); border-color: #7ef29b; color: #fff; }
.help-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(126,242,155,0.4);
  background: rgba(0,0,0,0.45);
  color: #7ef29b;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}
.help-btn:hover { background: rgba(46,204,113,0.3); color: #fff; }

/* Кнопка «Открыть на весь экран» в главном меню */
.menu-topbar-left { display: flex; align-items: center; gap: 8px; }
.fs-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(126,242,155,0.4);
  background: rgba(0,0,0,0.45);
  color: #7ef29b;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.fs-btn:hover { background: rgba(46,204,113,0.3); color: #fff; }

/* Описание режима под превью карты */
.mode-desc {
  margin: 8px 0 2px;
  font-size: 12px;
  color: #9cc7ac;
  line-height: 1.45;
}

/* Справка «Как играть» */
.help-text {
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.65;
  color: #d6ecd9;
}

.muted { color: #7fae91; font-size: 12px; margin: 10px 0 6px; }

/* --- Табы --- */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: rgba(0,0,0,0.35);
  border-radius: 12px;
  padding: 4px;
}

.tab {
  flex: 1;
  padding: 9px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #9cc7ac;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.tab.active {
  background: linear-gradient(180deg, #33d074, #22a356);
  color: #04210f;
  box-shadow: 0 4px 14px rgba(46,204,113,0.4);
}

.tab:hover:not(.active) { color: #fff; }

.tab-page { display: none; }
.tab-page.active { display: block; }

/* --- Элементы форм --- */
.m-label {
  display: block;
  font-size: 12px;
  color: #9cc7ac;
  margin: 12px 0 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  border-radius: 12px;
  border: 1px solid rgba(126,242,155,0.35);
  background: rgba(0,0,0,0.45);
  color: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
  border-color: #7ef29b;
  box-shadow: 0 0 0 3px rgba(46,204,113,0.18);
}

input[type="text"]::placeholder { color: #5b7a68; }

.btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  color: #ecfdf2;
  background: linear-gradient(180deg, #2f5a3f, #1c3a28);
  border: 1px solid rgba(126,242,155,0.22);
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(180deg, #35d474, #1f9e51);
  color: #04210f;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(46,204,113,0.35);
}

.btn-danger {
  background: linear-gradient(180deg, #d43b4e, #8e1e2e);
  color: #fff;
  border-color: transparent;
}

/* --- Список комнат --- */
.rooms-list {
  max-height: 180px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}

.room-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(126,242,155,0.18);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.room-row:hover { background: rgba(46,204,113,0.14); border-color: rgba(126,242,155,0.55); }

.room-row .rr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.room-row .rr-name { font-weight: 600; font-size: 14px; }
.room-row .rr-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.room-row .rr-count { color: #7fae91; font-size: 13px; }
.room-row .rr-count.full { color: #e74c3c; }
.room-row .rr-fog {
  color: #9cc7ac;
  font-size: 11px;
  background: rgba(126,242,155,0.12);
  border: 1px solid rgba(126,242,155,0.25);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.room-row .rr-arrow { color: #7ef29b; font-size: 16px; }
.room-row .rr-mode.m-team { color: #ffd54f; border-color: rgba(255,213,79,0.4); background: rgba(255,213,79,0.1); }
.room-row .rr-mode.m-base { color: #ff8a65; border-color: rgba(255,138,101,0.4); background: rgba(255,138,101,0.1); }
.room-row .rr-mode.m-ffa { color: #9cc7ac; border-color: rgba(126,242,155,0.25); background: rgba(126,242,155,0.08); }

.create-room {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.create-room .create-room-title { grid-column: 1 / -1; margin: 0 0 2px; }
.create-room input { flex: 1; width: 100%; }
.create-room .btn { width: auto; margin-top: 0; white-space: nowrap; padding: 11px 14px; }

/* --- Выбор тумана при создании комнаты --- */
.create-fog {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(126,242,155,0.18);
}

.create-fog .toggle { grid-column: 2; grid-row: 1; }
.create-fog .set-label { grid-column: 1; grid-row: 1; font-size: 13px; color: #cbe8d2; }
.create-fog input[type="range"] { grid-column: 1 / span 2; width: 100%; }
.create-fog .set-val { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
.create-fog.disabled { opacity: 0.45; }

.create-fog .num-input {
  grid-column: 2; grid-row: 1;
  width: 76px;
  background: rgba(255,255,255,0.06);
  color: var(--text, #f2ffe4);
  border: 1px solid rgba(126,242,155,0.3);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 15px;
  text-align: center;
  justify-self: end;
}

.create-fog select.mode-select {
  grid-column: 2; grid-row: 1;
  justify-self: end;
  background: rgba(0,0,0,0.45);
  color: #e8f2ea;
  border: 1px solid rgba(126,242,155,0.35);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  max-width: 240px;
}
.create-fog select.mode-select:focus { border-color: #7ef29b; }
.create-fog select.mode-select option { background: #0d1f16; }

/* --- Мини-превью выбранной карты --- */
#mapPreviewRow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
#mapPreview {
  width: 200px;
  height: 200px;
  border-radius: 10px;
  border: 1px solid rgba(126,242,155,0.35);
  box-shadow: 0 4px 18px rgba(0,0,0,0.45);
  background: #223127;
}
#mapPreviewInfo {
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

.settings-note { font-size: 12.5px; line-height: 1.5; margin-top: 12px; }

/* --- Живое превью надписи над танком (настройки в меню) --- */
.settings-preview {
  border: 1px solid rgba(126,242,155,0.28);
  border-radius: 14px;
  padding: 12px 12px 8px;
  text-align: center;
  margin-bottom: 16px;
  background:
    radial-gradient(circle at 50% 40%, rgba(126,242,155,0.06), rgba(0,0,0,0) 70%),
    rgba(0,0,0,0.25);
  box-shadow: inset 0 0 30px rgba(0,0,0,0.55);
}
.settings-preview canvas {
  display: block;
  margin: 0 auto;
  width: 240px;
  height: 150px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.07);
}

.rooms-empty { padding: 6px 2px; }

/* --- Рейтинг --- */
.rating-me {
  background: linear-gradient(90deg, rgba(46,204,113,0.2), rgba(46,204,113,0.05));
  border: 1px solid rgba(126,242,155,0.4);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}

.rating-table { display: flex; flex-direction: column; gap: 4px; }

.rt-head, .rt-row {
  display: grid;
  grid-template-columns: 36px 1fr 40px 44px 40px 56px;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  font-size: 13px;
}

.rt-head {
  color: #7fae91;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.rt-row { border-radius: 8px; background: rgba(255,255,255,0.04); }
.rt-row.me { background: rgba(46,204,113,0.16); border: 1px solid rgba(126,242,155,0.4); }

.rt-row .pos { font-weight: 700; color: #9cc7ac; }
.rt-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-row .num { text-align: right; color: #cfe8d6; }
.rt-row .pos:hover, .rt-row:hover { background: rgba(46,204,113,0.1); }

.rt-me-stats { color: #cfe8d6; font-size: 12px; }

/* --- Пагинация списка комнат --- */
.rooms-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
  min-height: 28px;
}
.rooms-pagination .pg-btn,
.rating-pagination .pg-btn {
  background: rgba(46,204,113,0.15);
  color: #9fe7b2;
  border: 1px solid rgba(126,242,155,0.4);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}
.rooms-pagination .pg-btn:hover:not(:disabled),
.rating-pagination .pg-btn:hover:not(:disabled) { background: rgba(46,204,113,0.3); }
.rooms-pagination .pg-btn:disabled,
.rating-pagination .pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rooms-pagination .pg-info,
.rating-pagination .pg-info { color: #8fb7a0; font-size: 12px; }

/* --- Пагинация рейтинга --- */
.rating-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.rating-pagination.hidden { display: none; }

/* --- Настройки (форма собирается в JS) --- */
.set-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.set-row .set-label { font-size: 14px; color: #d6ecd9; min-width: 0; }
.set-row .set-hint { display: block; font-size: 11px; color: #61806d; }
.set-row input[type="range"] { width: 150px; height: 4px; }

.set-val { color: #7ef29b; font-size: 12px; min-width: 42px; text-align: right; }

/* в форме настроек: поле ввода/переключатель прижаты к правому краю в одну колонку */
#settingsForm .set-row > :last-child,
#settingsModalForm .set-row > :last-child {
  justify-self: end;
}

/* --- Переключатели --- */
.toggle {
  position: relative;
  width: 48px; height: 26px;
  flex: 0 0 auto;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.18);
  border-radius: 26px;
  transition: 0.2s;
  cursor: pointer;
}
.toggle .slider::before {
  content: '';
  position: absolute;
  height: 20px; width: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .slider { background: #2ecc71; }
.toggle input:checked + .slider::before { transform: translateX(22px); }

/* --- Модалка настроек --- */
.modal {
  position: fixed; inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4,10,7,0.55);
  backdrop-filter: blur(3px);
}

.modal-box {
  width: min(380px, 92vw);
  max-height: 88vh;
  overflow: auto;
  padding: 22px 24px;
  border-radius: 18px;
  border: 1px solid rgba(126,242,155,0.3);
  background: linear-gradient(180deg, #152a20, #0d1d15);
  box-shadow: 0 24px 60px rgba(0,0,0,0.7);
}

.modal-title {
  color: #7ef29b;
  font-size: 20px;
  text-align: center;
  margin-bottom: 14px;
}

.modal-buttons { display: flex; gap: 10px; margin-top: 16px; }
.modal-buttons .btn { margin-top: 0; }

/* ===================== HUD ===================== */
#hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }

.gear-btn {
  position: absolute;
  top: 12px; left: 12px;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  pointer-events: auto;
  z-index: 6;
}
.gear-btn:hover { background: rgba(46,204,113,0.4); }

.hud-fs-btn {
  position: absolute;
  top: 12px; left: 60px;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.55);
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  z-index: 6;
  display: none;
}
.hud-fs-btn:hover { background: rgba(46,204,113,0.4); }
.hud-fs-btn svg { vertical-align: middle; }

@media (pointer: coarse), (hover: none), (max-width: 820px) {
  .hud-fs-btn { display: flex; align-items: center; justify-content: center; }
}

#movePad {
  position: absolute;
  bottom: 70px; left: 20px;
  width: 132px; height: 132px;
  pointer-events: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  opacity: 0.85;
}

.hud-btn {
  display: flex; align-items: center; justify-content: center;
  background: rgba(76,175,80,0.55);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 12px;
  color: #fff;
  font-size: 22px;
  font-weight: bold;
}

.hud-btn:active { background: rgba(76,175,80,0.9); }

#btnUp    { grid-column: 2; grid-row: 1; }
#btnLeft  { grid-column: 1; grid-row: 2; }
#btnRight { grid-column: 3; grid-row: 2; }
#btnDown  { grid-column: 2; grid-row: 3; }

#fireBtn {
  position: absolute;
  bottom: 60px; right: 40px;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: rgba(231,76,60,0.6);
  border: 2px solid rgba(255,255,255,0.6);
  font-size: 40px;
  pointer-events: auto;
}

#fireBtn:active { background: rgba(231,76,60,0.95); }

#scoreboard {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 13px;
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 150px;
  border: 1px solid rgba(255,255,255,0.15);
  pointer-events: auto;
  max-height: 60vh;
  overflow: auto;
}

/* Кнопка «Игроки» (только мобильные) */
.scores-btn {
  position: absolute;
  top: 12px; right: 12px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.55);
  color: #7ef29b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  z-index: 6;
}
.scores-btn:hover { background: rgba(46,204,113,0.4); }

#scoreboard .sb-title {
  font-weight: bold;
  margin-bottom: 6px;
  color: #81c784;
  text-align: center;
}

#scoreboard .sb-team {
  font-size: 12px;
  font-weight: 600;
  color: #9cc7ac;
  margin: 8px 0 3px;
  letter-spacing: 0.5px;
}

#scoreboard .sb-row { margin: 2px 0; }

#hud.dead #movePad, #hud.dead #fireBtn { display: none !important; }

/* Окно конца раунда (счёт, отсчёт, выбор команды) */
#roundOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 15, 10, 0.55);
  z-index: 40;
}
#roundOverlay.hidden { display: none; }
#roundOverlayBox {
  background: linear-gradient(180deg, #132b1d, #0d1f16);
  border: 1px solid rgba(126,242,155,0.35);
  border-radius: 16px;
  padding: 22px 34px 24px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  min-width: 300px;
}
#roundTitle { font-size: 22px; font-weight: 700; color: #f2ffe4; margin-bottom: 6px; }
#roundScore { font-size: 30px; font-weight: 800; color: #ffd54f; margin-bottom: 8px; letter-spacing: 2px; }
#roundCount { font-size: 15px; color: #9cc7ac; margin-bottom: 14px; }
#roundCount b { color: #ffd54f; font-size: 19px; }

/* --- Меню возрождения (отсчёт после уничтожения) --- */
#respawnOverlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 15, 10, 0.6);
  z-index: 41;
}
#respawnOverlay.hidden { display: none; }
#respawnOverlayBox {
  background: linear-gradient(180deg, #132b1d, #0d1f16);
  border: 1px solid rgba(126,242,155,0.35);
  border-radius: 16px;
  padding: 24px 34px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  min-width: 300px;
  max-width: 92vw;
}
#respawnTitle { font-size: 22px; font-weight: 700; color: #ff8a80; margin-bottom: 8px; }
#respawnCount { font-size: 16px; color: #9cc7ac; margin-bottom: 6px; }
#respawnCount b { color: #ffd54f; font-size: 26px; }

/* --- Рекламные блоки --- */
.ad-box { margin-top: 12px; text-align: center; }
#menuFooterAd {
  max-width: 480px;
  margin: 12px auto 0;
}
.ad-inner {
  display: block;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(126,242,155,0.25);
  border-radius: 12px;
  padding: 8px 10px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
}
#menuFooterAd .ad-inner { display: inline-block; max-width: 100%; }
.ad-inner img { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.ad-inner video { max-width: 100%; border-radius: 8px; display: block; margin: 0 auto; }
.ad-frame {
  width: 100%;
  height: 170px;
  border: 0;
  border-radius: 8px;
  display: block;
  background: #000;
}
#roundOverlayBox .ad-inner { margin-bottom: 12px; }
.ad-title { font-size: 13px; font-weight: 700; color: #f2ffe4; margin-top: 6px; }
.ad-text { font-size: 12px; color: #8fb7a0; margin-top: 2px; }
.ad-inner .ad-title:first-child, .ad-inner .ad-text:first-child { margin-top: 0; }
.team-btn {
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.25);
  cursor: pointer;
  color: #fff;
  transition: transform 0.1s, box-shadow 0.1s, opacity 0.15s;
}
.team-btn:hover { transform: translateY(-2px); }
.team-btn:active { transform: translateY(0); }
.team-btn.t-red { background: rgba(231,76,60,0.85); box-shadow: 0 4px 14px rgba(231,76,60,0.4); }
.team-btn.t-blue { background: rgba(52,152,219,0.85); box-shadow: 0 4px 14px rgba(52,152,219,0.4); }
.team-btn.current { outline: 3px solid #ffd54f; outline-offset: 1px; }
.team-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* Команда в настройках: одинаковые по размеру кнопки, ровные отступы,
   без наложения друг на друга (никогда не уезжают и не перекрываются) */
.team-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}
.team-pick .team-btn {
  flex: 1 1 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin: 0;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.2;
}
.team-pick .team-btn:hover { transform: none; box-shadow: 0 0 0 2px rgba(255,255,255,0.35) inset; }

#selfHud {
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  text-align: center;
}

#selfHud .hp-bar {
  width: 140px; height: 10px;
  background: rgba(255,255,255,0.2);
  border-radius: 5px;
  margin: 6px auto 0;
  overflow: hidden;
}

#selfHud .hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #e74c3c, #f1c40f, #2ecc71);
  width: 100%;
  border-radius: 5px;
  transition: width 0.2s;
}

/* панель выбора снарядов */
#ammoBar {
  position: absolute;
  bottom: 58px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 7;
  pointer-events: none;
}

#ammoBar .ammo-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}

#ammoBar .ammo-item:hover { border-color: rgba(255,255,255,0.5); }
#ammoBar .ammo-item.sel {
  border-color: #7ef29b;
  background: rgba(76,175,80,0.35);
  box-shadow: 0 0 8px rgba(126,242,155,0.4);
}
#ammoBar .ammo-item.disabled { opacity: 0.45; cursor: not-allowed; }

#ammoBar .ammo-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

#ammoBar .ammo-count {
  font-weight: bold;
  min-width: 16px;
  text-align: center;
}

#ammoBar { display: flex; }
#ammoBar.hidden { display: none; }

#killfeed {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  color: #ffeb3b;
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
  font-size: 14px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  transition: opacity 0.5s;
  z-index: 6;
}

#movePad, #fireBtn { display: none; }
#btnScores { display: none; }

@media (pointer: coarse), (hover: none), (max-width: 820px) {
  #movePad { display: grid; }
  #fireBtn { display: flex; }
  #btnScores { display: inline-flex; align-items: center; justify-content: center; }

  /* таблица игроков на мобильных открывается кнопкой «Игроки» */
  #scoreboard { display: none; top: 62px; right: 12px; max-height: calc(100vh - 90px); }
  #hud.show-scores #scoreboard { display: block; }

  /* панель снарядов не должна вылезать за экран: перенос + компактнее */
  #ammoBar {
    bottom: 212px;
    max-width: 96vw;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 5px;
  }
  #ammoBar .ammo-item { padding: 4px 8px; font-size: 12px; gap: 4px; }
}

/* скроллбары */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(126,242,155,0.3); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }