:root {
  --tg-bg: var(--tg-theme-bg-color, #17212b);
  --tg-text: var(--tg-theme-text-color, #f5f5f5);
  --tg-hint: var(--tg-theme-hint-color, #8e9599);
  --tg-button: var(--tg-theme-button-color, #5288c1);
  --tg-button-text: var(--tg-theme-button-text-color, #ffffff);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Плавающая шапка и низ — карта на весь экран под ними */
  --toolbar-h: 34px;
  /* Жёсткий потолок высоты шапки: иначе длинный текст + sync --toolbar-h раздувают тёмную полосу на пол-экрана */
  /* Первая строка — кнопки; вторая — все таймеры и статусы (не сжимают меню) */
  --toolbar-h-max: 140px;
  --hud-bg: rgba(5, 10, 18, 0.42);
  --hud-border: rgba(255, 255, 255, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--tg-bg);
  color: var(--tg-text);
}

/* Ускорение турнирного времени (бот: speed) — только тест; таймеры раунда сжаты, не игровой баланс. */
.dev-time-scale-banner {
  position: fixed;
  z-index: 9998;
  left: 50%;
  top: max(6px, var(--safe-top));
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a1205;
  background: linear-gradient(135deg, #ffcc33, #ff9933);
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  max-width: 92vw;
  text-align: center;
}

.dev-time-scale-banner[hidden] {
  display: none !important;
}

/* Полная пауза игры (сервер: pause по Telegram) */
.admin-game-pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.admin-game-pause-overlay[hidden] {
  display: none !important;
}

.admin-game-pause-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(3px);
}

.admin-game-pause-overlay__panel {
  position: relative;
  z-index: 1;
  max-width: min(420px, 92vw);
  padding: 28px 32px;
  border-radius: 16px;
  text-align: center;
  background: linear-gradient(160deg, rgba(28, 38, 52, 0.96), rgba(12, 18, 28, 0.98));
  border: 2px solid rgba(255, 80, 80, 0.55);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.admin-game-pause-overlay__kicker {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ff6b6b;
  text-transform: uppercase;
}

.admin-game-pause-overlay__title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--tg-text);
}

.admin-game-pause-overlay__hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--tg-hint);
}

.app {
  position: relative;
  display: block;
  height: 100%;
  min-height: 100dvh;
  min-width: 0;
  overflow: hidden;
}

.app__main {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Рейтинг: см. css/hud-premium.css (.lb-widget) */

/* Шапка всегда тёмная: не даём iOS/Telegram light-theme красить кнопки тёмным текстом */
.toolbar {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: var(--safe-top);
  flex-shrink: 0;
  color-scheme: dark;
  /* grid: правая колонка (кнопки) не сжимается ниже контента — иначе «Магазин» обрезался слева */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px;
  column-gap: 6px;
  min-height: 34px;
  max-height: var(--toolbar-h-max);
  padding: 4px calc(8px + env(safe-area-inset-right, 0px)) 4px calc(8px + env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--hud-border);
  /* Без backdrop-filter: в Telegram WebView размытие часто «тянется» на пол-экрана над картой */
  background: rgba(5, 10, 18, 0.82);
  pointer-events: auto;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.toolbar__lead {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.toolbar__round--lead {
  font-size: 0.52rem;
  line-height: 1.18;
  color: color-mix(in srgb, var(--tg-hint) 92%, transparent);
  max-width: 100% !important;
  width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-overflow: ellipsis;
}

.toolbar__round--lead[hidden] {
  display: none !important;
}

.toolbar__pixel-timer {
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  color: color-mix(in srgb, var(--tg-text) 95%, transparent);
}

.toolbar__pixel-timer--ready {
  color: color-mix(in srgb, #5cff8a 88%, var(--tg-text));
  font-weight: 600;
}

.toolbar__pixel-timer--wait {
  color: color-mix(in srgb, #5cc8ff 92%, var(--tg-text));
  font-weight: 700;
}

.toolbar__pixel-timer--muted {
  color: color-mix(in srgb, var(--tg-hint) 85%, transparent);
  font-weight: 500;
}

/* Второй ряд под кнопками: подсказки и таймеры на всю ширину — не сжимают «Магазин» */
.toolbar__hud-row {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-width: 0;
  width: 100%;
  padding-top: 1px;
}

/* Раунд + интервал пикселя — только здесь, не в ряду с кнопками */
.toolbar__hud-timers {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  width: 100%;
}

.toolbar__hud-timers .hud-lead-stack {
  min-width: 0;
  width: 100%;
}

.territory-isolation-hud {
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1.25;
  color: #ffb34a;
  text-align: start;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  white-space: normal;
  max-width: 100%;
  word-break: break-word;
}

.territory-isolation-hud[hidden] {
  display: none !important;
}

.toolbar__actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-width: min-content;
  max-width: 100%;
  overflow: visible;
  padding-top: 0;
  padding-bottom: 0;
}

.toolbar__actions .toolbar__btn,
.toolbar__actions .toolbar__discussion,
.toolbar__actions .toolbar__conn,
.toolbar__actions .toolbar__spectator {
  flex-shrink: 0;
}

.toolbar__hud-row .toolbar__cooldown {
  min-width: 0;
  line-height: 1.25;
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.toolbar__conn {
  font-size: 0.56rem;
  color: color-mix(in srgb, var(--tg-hint) 92%, transparent);
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar__conn[data-state="online"] {
  color: var(--tg-button);
}

.toolbar__conn[data-state="error"] {
  color: #e94560;
}

/* В правом блоке шапки — те же тёмные токены TG ломают контраст на нашем фоне */
.toolbar__actions .toolbar__conn {
  color: rgba(226, 232, 240, 0.88);
  -webkit-text-fill-color: rgba(226, 232, 240, 0.88);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.toolbar__actions .toolbar__conn[data-state="online"] {
  color: #7dd3fc;
  -webkit-text-fill-color: #7dd3fc;
}

.toolbar__actions .toolbar__conn[data-state="error"] {
  color: #ff6b8a;
  -webkit-text-fill-color: #ff6b8a;
}

.toolbar__btn {
  appearance: none;
  /* Не от var(--tg-text): в светлой теме TG на iPhone текст чёрный на нашем тёмном HUD */
  border: 1px solid rgba(255, 253, 245, 0.22);
  background: rgba(0, 0, 0, 0.25);
  color: #fffdf5;
  -webkit-text-fill-color: #fffdf5;
  caret-color: #fffdf5;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.15s ease;
}

.toolbar__btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.toolbar__btn:active {
  opacity: 0.85;
}

.toolbar__btn--audio {
  min-width: 2rem;
  font-size: 0.88rem;
  line-height: 1;
  padding: 3px 8px;
  letter-spacing: 0;
}

.toolbar__btn--audio.toolbar__btn--audio-muted {
  opacity: 0.9;
  border-color: rgba(255, 140, 140, 0.5);
}

.toolbar__cooldown {
  font-size: 0.56rem;
  color: var(--tg-hint);
}

.toolbar__cooldown--alert {
  color: #fff5e6;
  font-weight: 700;
  max-width: min(52vw, 240px);
  padding: 2px 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(146, 64, 14, 0.88), rgba(180, 83, 9, 0.82));
  border: 1px solid rgba(253, 224, 71, 0.45);
  animation: feedback-banner-pulse 1s ease-in-out infinite;
}

.toolbar__hud-row .toolbar__cooldown--alert {
  max-width: 100%;
}

/* Старый компактный вид раунда в правом ряду (если где-то останется без --lead) */
.toolbar__round:not(.toolbar__round--lead) {
  font-size: 0.62rem;
  color: color-mix(in srgb, var(--tg-hint) 92%, transparent);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar__spectator {
  font-size: 0.56rem;
  color: #e94560;
  font-weight: 600;
}

.toolbar__discussion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 1px 4px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1;
  text-decoration: none;
  color: #fffdf5;
  -webkit-text-fill-color: #fffdf5;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 253, 245, 0.2);
  flex-shrink: 0;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  transition: transform 0.15s ease, filter 0.2s ease;
}

.toolbar__discussion:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.toolbar__discussion:active {
  opacity: 0.88;
}

/* Быстрый повтор: лёгкие плавающие контролы; промежутки между кругами не перехватывают карту */
.quick-buy-rail {
  pointer-events: none;
  isolation: isolate;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.quick-buy-rail[hidden] {
  display: none !important;
}

.quick-buy-rail__caption--sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Правый нижний угол: компактный «воздушный» кластер, не как панель */
.quick-buy-rail--dock.quick-buy-rail--fab-cluster {
  position: absolute;
  z-index: 8;
  right: max(8px, env(safe-area-inset-right, 0px));
  bottom: calc(50px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0;
  width: auto;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
  padding: 0;
  pointer-events: none;
}

.quick-buy-rail--fab-cluster .quick-buy-rail__list {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 0;
  margin: 0;
  min-width: 0;
  max-height: none;
  overflow: visible;
  pointer-events: none;
}

.quick-buy-rail__list {
  display: flex;
  flex-direction: row;
  gap: 7px;
  list-style: none;
}

/* Круглый FAB: почти «воздух» — тонкое стекло, без тяжёлых панелей */
.quick-buy-rail__btn--fab {
  --quick-fab-size: 38px;
  appearance: none;
  position: relative;
  width: var(--quick-fab-size);
  height: var(--quick-fab-size);
  min-width: var(--quick-fab-size);
  min-height: var(--quick-fab-size);
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  pointer-events: auto;
  color: rgba(244, 248, 255, 0.96);
  background: rgba(8, 12, 22, 0.26);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.1),
    0 2px 6px rgba(0, 0, 0, 0.18);
  transition:
    transform 0.12s cubic-bezier(0.34, 1.35, 0.64, 1),
    box-shadow 0.16s ease,
    background 0.16s ease,
    filter 0.16s ease,
    opacity 0.16s ease;
  -webkit-tap-highlight-color: transparent;
}

@supports not (backdrop-filter: blur(1px)) {
  .quick-buy-rail__btn--fab {
    background: rgba(16, 22, 36, 0.52);
  }
}

.quick-buy-rail__btn--fab:hover:not(:disabled) {
  transform: scale(1.06);
  background: rgba(10, 16, 30, 0.4);
  box-shadow:
    0 0 0 0.5px rgba(186, 230, 253, 0.28),
    0 0 12px rgba(56, 189, 248, 0.12),
    0 3px 10px rgba(0, 0, 0, 0.22);
  filter: brightness(1.05);
}

.quick-buy-rail__btn--fab:active:not(:disabled) {
  transform: scale(0.96);
  transition-duration: 0.05s;
}

.quick-buy-rail__btn--fab:disabled {
  opacity: 0.32;
  cursor: not-allowed;
  filter: grayscale(0.5) brightness(0.9);
  box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.06), 0 1px 3px rgba(0, 0, 0, 0.15);
}

.quick-buy-rail__fab {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.quick-buy-rail__fab--recovery {
  justify-content: center;
}

.quick-buy-rail__orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  pointer-events: none;
}

.quick-buy-rail__svg {
  width: 32px;
  height: 32px;
  display: block;
}

.quick-buy-rail__ring-track {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 2px;
}

.quick-buy-rail__ring-arc {
  stroke-width: 2px;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s linear;
}

.quick-buy-rail__btn--kind-personal .quick-buy-rail__ring-arc {
  stroke: #fbbf24;
}

.quick-buy-rail__btn--kind-team .quick-buy-rail__ring-arc {
  stroke: #4ade80;
}

.quick-buy-rail__btn--buff-ticking.quick-buy-rail__btn--kind-personal .quick-buy-rail__orbit {
  filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.35));
}

.quick-buy-rail__btn--buff-ticking.quick-buy-rail__btn--kind-team .quick-buy-rail__orbit {
  filter: drop-shadow(0 0 3px rgba(74, 222, 128, 0.32));
}

.quick-buy-rail__glyph {
  position: relative;
  z-index: 1;
  font-size: 14px;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  user-select: none;
}

.quick-buy-rail__glyph--num {
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.quick-buy-rail__glyph--num12 {
  font-size: 9px;
  font-weight: 800;
}

.quick-buy-rail__cost {
  position: absolute;
  z-index: 2;
  right: 2px;
  bottom: 2px;
  left: auto;
  transform: none;
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  color: rgba(253, 224, 130, 0.82);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.quick-buy-rail__fab--recovery .quick-buy-rail__glyph {
  margin-top: -2px;
}

/* Активное ожидание тапа по карте — заметно, но без «тяжёлой» панели */
.quick-buy-rail__btn--fab.quick-buy-rail__btn--map-armed {
  transform: scale(1.04);
  background: rgba(12, 28, 48, 0.42);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.45),
    0 0 14px rgba(34, 211, 238, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.25);
}

.quick-buy-rail__btn--fab.quick-buy-rail__btn--map-armed:hover:not(:disabled) {
  transform: scale(1.07);
  filter: brightness(1.06);
}

.quick-buy-rail__btn--fab.quick-buy-rail__btn--map-armed:active:not(:disabled) {
  transform: scale(0.98);
}

@media (min-width: 600px) {
  .quick-buy-rail__btn--fab {
    --quick-fab-size: 40px;
  }
}

.stage-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  /* Совпадает с заливкой канвы: при глюке композитинга WebView не «вспыхивает» чёрным. */
  background-color: #050810;
  /* Десктопный TG иногда отдаёт нулевую высоту контейнера на кадр — min-height снижает шанс «полоски». */
  min-height: 120px;
}

@media (min-width: 600px) {
  .stage-wrap {
    min-height: min(42vh, 720px);
  }
}

.board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.palette-bar {
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hud-border);
  background: rgba(5, 10, 18, 0.82);
  pointer-events: auto;
}

.palette-bar__inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.palette-bar__lead {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

/* Смена команды: иконка двери слева от бейджа команды */
.btn-session-door {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  height: 32px;
  min-height: 32px;
  padding: 0 9px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--tg-hint) 42%, transparent);
  background: rgba(0, 0, 0, 0.32);
  color: color-mix(in srgb, var(--tg-text) 96%, transparent);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-session-door:hover {
  border-color: color-mix(in srgb, var(--tg-hint) 58%, transparent);
  background: rgba(0, 0, 0, 0.42);
}

.btn-session-door:active {
  transform: scale(0.96);
}

.btn-session-door:focus-visible {
  outline: 2px solid var(--tg-button);
  outline-offset: 2px;
}

.btn-session-door--icon-only {
  width: 36px;
  min-width: 36px;
  padding: 0;
}

.btn-session-door__svg {
  width: 22px;
  height: 22px;
  display: block;
}

.btn-session-door__label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
  max-width: min(38vw, 120px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-session-door--icon-only .btn-session-door__label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-session-door:not(.btn-session-door--icon-only) .btn-session-door__icon {
  display: none;
}

.btn-session-door {
  position: relative;
}

.palette-bar__lead .team-badge {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.palette-trigger {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 12px;
  border: 3px solid color-mix(in srgb, var(--tg-button-text) 85%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tg-button) 55%, transparent), 0 4px 14px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.palette-trigger--compact {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 6px;
  border-width: 2px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tg-button) 50%, transparent), 0 2px 6px rgba(0, 0, 0, 0.35);
}

.palette-trigger:active {
  transform: scale(0.96);
}

.palette-trigger:focus-visible {
  outline: 2px solid var(--tg-button);
  outline-offset: 2px;
}

/* Индикатор цвета команды (онлайн, без смены цвета) — визуал как у компактного palette-trigger */
.team-badge__color {
  display: block;
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 6px;
  border: 2px solid color-mix(in srgb, var(--tg-button-text) 85%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--tg-button) 50%, transparent), 0 2px 6px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  pointer-events: none;
}

.team-badge__color[hidden] {
  display: none !important;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.palette__swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.palette__swatch[aria-selected="true"] {
  border-color: var(--tg-button-text);
  box-shadow: 0 0 0 2px var(--tg-button);
}

/* Светлые кляксы в палитре создания команды — обводка, иначе сливаются с фоном карточки */
.palette__swatch.palette__swatch--needs-ring {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.palette__swatch.palette__swatch--needs-ring[aria-selected="true"] {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    0 0 0 2px var(--tg-button);
}

.palette--create-team {
  gap: 6px;
  justify-content: flex-start;
}

.palette--create-team .palette__swatch {
  width: 32px;
  height: 32px;
  border-radius: 7px;
}

.palette__swatch:focus-visible {
  outline: 2px solid var(--tg-button);
  outline-offset: 2px;
}

.team-badge[hidden] {
  display: none !important;
}

/* Палитра в модальном окне выбора цвета */
.overlay__card--palette-picker {
  max-width: 400px;
  max-height: min(88dvh, 560px);
  overflow-y: auto;
}

.palette--popup {
  gap: 8px;
  margin-top: 4px;
}

.palette--popup .palette__swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: calc(16px + var(--safe-top));
  padding-bottom: calc(16px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.78);
  /* Без backdrop-filter: в Telegram WebView размытие часто «тянется» на область карты под модалками */
}

.overlay[hidden] {
  display: none;
}

.overlay__card {
  width: 100%;
  max-width: 400px;
  max-height: min(90dvh, 560px);
  overflow: auto;
  padding: 18px 16px;
  border-radius: 14px;
  background: var(--tg-bg);
  border: 1px solid color-mix(in srgb, var(--tg-hint) 30%, transparent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.overlay__title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 600;
}

.overlay__hint {
  margin: 0 0 14px;
  font-size: 0.8rem;
  color: var(--tg-hint);
  line-height: 1.4;
}

.overlay__sub {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tg-text);
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-list__emoji {
  font-size: 1.2rem;
  margin-right: 6px;
}

.team-list__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--tg-hint) 35%, transparent);
  background: color-mix(in srgb, var(--tg-bg) 95%, #fff);
  color: var(--tg-text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}

.team-list__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.team-list__btn:not(:disabled):active {
  opacity: 0.88;
}

.team-list__meta {
  font-size: 0.75rem;
  color: var(--tg-hint);
  white-space: nowrap;
}

.team-badge {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-bottom: 0;
  font-size: 0.65rem;
  width: 100%;
  min-width: 0;
  border-radius: 8px;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.team-badge--danger {
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.85), 0 0 14px rgba(220, 38, 38, 0.45);
  animation: team-badge-danger-glow 1.05s ease-in-out infinite;
}

.team-badge--last-cell {
  box-shadow: 0 0 0 3px rgba(254, 202, 202, 0.95), 0 0 22px rgba(239, 68, 68, 0.65);
  animation: team-badge-danger-glow 0.55s ease-in-out infinite;
}

@keyframes team-badge-danger-glow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.team-badge--palette-only .team-badge__label,
.team-badge--palette-only .team-badge__emoji,
.team-badge--palette-only .team-badge__color,
.team-badge--palette-only .team-badge__name,
.team-badge--palette-only .team-badge__count,
.team-badge--palette-only .team-badge__invite {
  display: none !important;
}

.team-badge__label {
  color: var(--tg-hint);
}

.team-badge__name {
  font-weight: 600;
  color: var(--tg-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(42vw, 140px);
}

.team-badge__count {
  font-size: 0.6rem;
  color: var(--tg-hint);
}

.team-badge__emoji {
  font-size: 0.88rem;
  line-height: 1;
}

.team-badge__invite,
.team-badge__settings,
.team-badge__leave {
  appearance: none;
  border: 1px solid color-mix(in srgb, var(--tg-hint) 35%, transparent);
  background: rgba(0, 0, 0, 0.28);
  color: var(--tg-text);
  font-size: 0.62rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.team-badge__leave {
  border-color: color-mix(in srgb, #e94560 45%, transparent);
  background: color-mix(in srgb, #e94560 12%, var(--tg-bg));
}

.team-badge__invite {
  border-color: color-mix(in srgb, var(--tg-button) 55%, transparent);
  background: color-mix(in srgb, var(--tg-button) 18%, transparent);
}

.team-badge__invite:active,
.team-badge__settings:active,
.team-badge__leave:active {
  opacity: 0.88;
}

.overlay__card--settings {
  max-width: 420px;
}

/* —— Онбординг: премиум game UI (welcome / команда / новая команда) —— */
@keyframes game-onboarding-card-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.overlay--game-onboarding {
  background:
    radial-gradient(ellipse 85% 55% at 50% 18%, rgba(99, 102, 241, 0.22), transparent 58%),
    radial-gradient(ellipse 60% 45% at 85% 75%, rgba(34, 211, 238, 0.12), transparent 52%),
    radial-gradient(ellipse 50% 40% at 12% 70%, rgba(236, 72, 153, 0.08), transparent 50%),
    rgba(3, 7, 14, 0.9);
}

.overlay--game-onboarding > .overlay__card {
  border-radius: 16px;
  background: linear-gradient(168deg, rgba(26, 36, 54, 0.97) 0%, rgba(11, 16, 28, 0.99) 48%, rgba(8, 12, 22, 1) 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 28px 72px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  animation: game-onboarding-card-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.overlay__card--game-form {
  max-width: 440px;
  padding: 20px 18px 18px;
}

.overlay__card--game-roster {
  padding: 20px 18px 18px;
}

.game-form__header {
  margin: 0 0 12px;
  text-align: center;
}

.game-form__title,
.welcome-panel__title {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-shadow:
    0 0 20px color-mix(in srgb, var(--tg-button) 35%, transparent),
    0 2px 12px rgba(0, 0, 0, 0.45);
}

.overlay--game-onboarding .overlay__title {
  margin-bottom: 4px;
}

.game-form__subtitle {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  color: color-mix(in srgb, var(--tg-hint) 92%, transparent);
  letter-spacing: 0.02em;
}

.game-form__subtitle--tight {
  margin: 0 0 12px;
  text-align: center;
}

.welcome-panel__subtitle {
  margin: -4px 0 0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: color-mix(in srgb, var(--tg-hint) 88%, transparent);
}

.game-form__hint {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.game-form__section-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tg-text) 78%, var(--tg-hint));
}

.game-form__section-meta {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 0.62rem;
  color: var(--tg-hint);
}

.overlay--game-onboarding .game-form__field {
  margin-bottom: 4px;
}

.overlay--game-onboarding .field__input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.32) 100%);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  font-size: 1rem;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.overlay--game-onboarding .field__input::placeholder {
  color: color-mix(in srgb, var(--tg-hint) 75%, transparent);
}

.overlay--game-onboarding .field__input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 2px rgba(34, 211, 238, 0.22),
    0 0 28px rgba(34, 211, 238, 0.12);
}

/* Палитра «идентичность команды» */
.overlay--game-onboarding .palette--create-team {
  gap: 8px;
  row-gap: 10px;
  padding: 4px 2px 8px;
  justify-content: flex-start;
}

.overlay--game-onboarding .palette--create-team .palette__swatch {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--swatch, #888) 82%, #fff 18%) 0%,
    var(--swatch, #888) 42%,
    color-mix(in srgb, var(--swatch, #888) 55%, #000 45%) 100%
  );
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.22),
    inset 0 -3px 10px rgba(0, 0, 0, 0.42),
    0 3px 10px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.3s cubic-bezier(0.34, 1.45, 0.64, 1),
    box-shadow 0.25s ease,
    filter 0.2s ease,
    border-color 0.2s ease;
}

.overlay--game-onboarding .palette--create-team .palette__swatch:hover {
  transform: scale(1.08);
  filter: brightness(1.12) saturate(1.08);
  border-color: rgba(255, 255, 255, 0.35);
}

.overlay--game-onboarding .palette--create-team .palette__swatch:active {
  transform: scale(0.96);
  filter: brightness(0.95);
}

.overlay--game-onboarding .palette--create-team .palette__swatch[aria-selected="true"] {
  transform: scale(1.09);
  z-index: 2;
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.28),
    inset 0 -3px 10px rgba(0, 0, 0, 0.4),
    0 0 0 2px rgba(255, 255, 255, 0.92),
    0 0 22px color-mix(in srgb, var(--swatch, #38bdf8) 55%, transparent),
    0 0 44px color-mix(in srgb, var(--swatch, #38bdf8) 28%, transparent);
}

.overlay--game-onboarding .palette--create-team .palette__swatch.palette__swatch--needs-ring {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    inset 0 2px 5px rgba(255, 255, 255, 0.35),
    inset 0 -3px 8px rgba(0, 0, 0, 0.35),
    0 3px 10px rgba(0, 0, 0, 0.4);
}

.overlay--game-onboarding
  .palette--create-team
  .palette__swatch.palette__swatch--needs-ring[aria-selected="true"] {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    inset 0 2px 5px rgba(255, 255, 255, 0.35),
    0 0 0 2px rgba(255, 255, 255, 0.92),
    0 0 22px color-mix(in srgb, var(--swatch, #fbbf24) 50%, transparent),
    0 0 40px color-mix(in srgb, var(--swatch, #fbbf24) 22%, transparent);
}

.overlay--game-onboarding .overlay__actions {
  margin-top: 20px;
  padding-top: 4px;
}

.overlay--game-onboarding .overlay__actions .overlay__btn {
  padding: 11px 20px;
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition:
    transform 0.18s cubic-bezier(0.34, 1.45, 0.64, 1),
    box-shadow 0.2s ease,
    filter 0.18s ease,
    border-color 0.18s ease;
}

.overlay--game-onboarding .overlay__actions .overlay__btn:not(.overlay__btn--secondary) {
  border: 1px solid rgba(129, 140, 248, 0.55);
  background: linear-gradient(155deg, #7c3aed 0%, #5b21b6 45%, #4c1d95 100%);
  color: #fafafa;
  box-shadow:
    0 0 24px rgba(124, 58, 237, 0.35),
    0 4px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.overlay--game-onboarding .overlay__actions .overlay__btn:not(.overlay__btn--secondary):hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 0 32px rgba(124, 58, 237, 0.45),
    0 6px 0 rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.overlay--game-onboarding .overlay__actions .overlay__btn:not(.overlay__btn--secondary):active {
  transform: translateY(1px) scale(0.97);
  filter: brightness(0.96);
  box-shadow:
    0 0 18px rgba(124, 58, 237, 0.28),
    0 2px 0 rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.overlay--game-onboarding .overlay__actions .overlay__btn--secondary {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(180deg, rgba(40, 48, 64, 0.95), rgba(22, 28, 40, 0.98));
  color: color-mix(in srgb, var(--tg-text) 92%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.overlay--game-onboarding .overlay__actions .overlay__btn--secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(186, 198, 214, 0.4);
  filter: brightness(1.06);
}

.overlay--game-onboarding .overlay__actions .overlay__btn--secondary:active {
  transform: scale(0.98);
}

.overlay--game-onboarding .team-create-btn {
  border: 1px dashed rgba(129, 140, 248, 0.55);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.2), rgba(30, 27, 75, 0.35));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-weight: 700;
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.2s ease;
}

.overlay--game-onboarding .team-create-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.overlay--game-onboarding .team-create-btn:active {
  transform: scale(0.99);
}

.overlay--game-onboarding .team-list__btn {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(30, 38, 52, 0.92), rgba(15, 20, 32, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}

.overlay--game-onboarding .team-list__btn:hover:not(:disabled) {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.08);
}

.overlay--game-onboarding .team-list__btn:active:not(:disabled) {
  transform: scale(0.992);
}

@media (prefers-reduced-motion: reduce) {
  .overlay--game-onboarding > .overlay__card {
    animation: none !important;
  }

  .overlay--game-onboarding .palette--create-team .palette__swatch,
  .emoji-presets__btn,
  .overlay--game-onboarding .overlay__actions .overlay__btn,
  .welcome-team-btn {
    transition: none !important;
  }
}

/* —— Welcome: выбор команды + промо —— */
.welcome-card.welcome-card {
  padding: 16px 14px;
}

.welcome-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.welcome-panel__close {
  position: absolute;
  top: -4px;
  right: -4px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tg-bg) 70%, transparent);
  color: color-mix(in srgb, var(--tg-hint) 95%, transparent);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.welcome-panel__close:hover {
  background: color-mix(in srgb, var(--tg-hint) 22%, transparent);
  color: var(--tg-text);
}

.welcome-panel__close:active {
  opacity: 0.88;
}

.welcome-panel__title {
  margin: 0;
  padding-right: 28px;
  text-align: center;
  color: var(--tg-text);
}

.welcome-panel__lead {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--tg-hint);
  text-align: center;
}

.welcome-panel__community {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
}

.welcome-link {
  color: var(--tg-link, #6ab7ff);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.welcome-link:hover {
  filter: brightness(1.08);
}

.welcome-link:active {
  opacity: 0.9;
}

.welcome-open-browser {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
}

/* Иначе display:flex перебивает атрибут hidden — в браузере блок «Открыть в браузере» оставался видимым. */
.welcome-open-browser[hidden] {
  display: none !important;
}

.welcome-open-browser__copy {
  margin: 0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  color: color-mix(in srgb, var(--tg-text, #e2e8f0) 92%, #94a3b8);
}

.welcome-open-browser__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(145deg, #64748b 0%, #475569 50%, #334155 100%);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: filter 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.welcome-open-browser__btn:hover {
  filter: brightness(1.08);
}

.welcome-open-browser__btn:active {
  transform: translateY(1px);
}

.welcome-panel--mini-browser-first .welcome-open-browser {
  margin: 4px 0 14px;
  padding: 0;
  border: none;
  background: transparent;
  gap: 14px;
}

.welcome-panel--mini-browser-first .welcome-open-browser__copy {
  padding: 18px 16px;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: 0.01em;
  border-radius: 18px;
  color: #1c1008;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  background: linear-gradient(155deg, #fde68a 0%, #fbbf24 22%, #f59e0b 48%, #ea580c 78%, #c2410c 100%);
  border: 2px solid rgba(251, 191, 36, 0.65);
  box-shadow:
    0 0 0 1px rgba(120, 53, 15, 0.2),
    0 6px 20px rgba(234, 88, 12, 0.28),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
}

.welcome-panel--mini-browser-first .welcome-open-browser__btn {
  min-height: 3.25rem;
  padding: 14px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: 16px;
  color: #fffbeb;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, #f59e0b 0%, #ea580c 45%, #c2410c 100%);
  box-shadow:
    0 0 0 2px rgba(254, 243, 199, 0.35),
    0 6px 0 rgba(120, 53, 15, 0.55),
    0 10px 24px rgba(234, 88, 12, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.welcome-panel--mini-browser-first .welcome-open-browser__btn:hover {
  filter: brightness(1.07) saturate(1.05);
}

.welcome-panel--mini-browser-first .welcome-open-browser__btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 2px rgba(254, 243, 199, 0.28),
    0 2px 0 rgba(120, 53, 15, 0.5),
    0 4px 14px rgba(234, 88, 12, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.welcome-team-choice {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.welcome-team-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  color: #fff;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.45, 0.64, 1),
    box-shadow 0.22s ease,
    filter 0.2s ease;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.welcome-team-btn:not(:disabled):hover {
  transform: translateY(-2px);
  filter: brightness(1.07) saturate(1.05);
}

.welcome-team-btn:not(:disabled):active {
  transform: translateY(1px) scale(0.97);
  filter: brightness(0.94);
}

.welcome-team-btn:disabled {
  opacity: 0.4;
  filter: grayscale(0.4) brightness(0.88);
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
}

.welcome-team-btn--create {
  background: linear-gradient(145deg, #818cf8 0%, #6366f1 40%, #4f46e5 72%, #312e81 100%);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.5),
    0 0 28px rgba(99, 102, 241, 0.35),
    0 3px 0 rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.welcome-team-btn--join {
  background: linear-gradient(145deg, #2dd4bf 0%, #14b8a6 42%, #0f766e 100%);
  box-shadow:
    0 0 0 1px rgba(45, 212, 191, 0.45),
    0 0 24px rgba(20, 184, 166, 0.28),
    0 3px 0 rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.welcome-team-btn__icon {
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

.welcome-team-btn__text {
  flex: 1;
}

.tg-promo-bubble {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #182533;
  color: #ffffff;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.overlay--game-onboarding .tg-promo-bubble {
  background: linear-gradient(165deg, rgba(30, 44, 62, 0.95), rgba(18, 28, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 8px 28px rgba(0, 0, 0, 0.35);
}

.tg-miniapp-start {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 14px 44px 14px 20px;
  border: none;
  border-radius: 12px;
  background: #242f3d;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.tg-miniapp-start:hover {
  background: #2a3a4d;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.tg-miniapp-start:active {
  transform: scale(0.992);
  background: #1f2a38;
}

.tg-miniapp-start__corner-icon {
  position: absolute;
  top: 8px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: rgba(255, 255, 255, 0.92);
  pointer-events: none;
}

.tg-miniapp-start__label {
  display: block;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field__label {
  display: block;
  font-size: 0.78rem;
  color: var(--tg-hint);
  margin-bottom: 4px;
}

.field__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--tg-hint) 35%, transparent);
  background: color-mix(in srgb, var(--tg-bg) 96%, #fff);
  color: var(--tg-text);
  font-size: 1rem;
}

.field__input--textarea {
  resize: vertical;
  min-height: 88px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.35;
}

.team-create-btn {
  width: 100%;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px dashed color-mix(in srgb, var(--tg-button) 55%, transparent);
  background: color-mix(in srgb, var(--tg-button) 12%, transparent);
  color: var(--tg-text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.team-create-btn:active {
  opacity: 0.9;
}

.emoji-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.emoji-presets__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.38) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 14px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition:
    transform 0.26s cubic-bezier(0.34, 1.55, 0.64, 1),
    box-shadow 0.22s ease,
    filter 0.2s ease,
    border-color 0.2s ease;
}

.emoji-presets__glyph {
  display: block;
  font-size: 1.38rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.emoji-presets__btn:hover {
  transform: scale(1.1);
  filter: brightness(1.12);
  border-color: rgba(186, 198, 214, 0.35);
}

.emoji-presets__btn:active {
  transform: scale(0.93);
  filter: brightness(0.95);
}

.emoji-presets__btn[aria-pressed="true"] {
  border-color: rgba(56, 189, 248, 0.75);
  transform: scale(1.06);
  box-shadow:
    0 0 0 2px rgba(34, 211, 238, 0.35),
    0 0 26px rgba(34, 211, 238, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.emoji-presets--game {
  gap: 8px 10px;
  margin-bottom: 14px;
}

.overlay__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.overlay__actions--stack {
  flex-direction: column;
  align-items: stretch;
}

.team-back-btn {
  margin-bottom: 4px;
}

.overlay__btn {
  appearance: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--tg-button) 50%, transparent);
  background: color-mix(in srgb, var(--tg-button) 28%, transparent);
  color: var(--tg-text);
}

a.overlay__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.overlay__btn--secondary {
  border-color: color-mix(in srgb, var(--tg-hint) 40%, transparent);
  background: color-mix(in srgb, var(--tg-bg) 92%, #fff);
}

.toolbar__wallet {
  font-size: 0.56rem;
  font-weight: 600;
  color: #feca57;
  white-space: nowrap;
}

/** Слева под таймером — не уезжает в горизонтальный скролл кнопок справа */
.toolbar__wallet--lead {
  font-size: 0.62rem;
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  margin-top: 0;
}

/* Главная цель матча — квантовые фермы у центра (экономика + постоянные бои). */
.toolbar__quantum-objective {
  display: block;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: color-mix(in srgb, #7dd3fc 92%, var(--tg-text));
  text-shadow:
    0 0 12px rgba(56, 189, 248, 0.45),
    0 1px 3px rgba(0, 0, 0, 0.75);
  padding: 1px 0 0;
}

.toolbar__quantum-objective[hidden] {
  display: none !important;
}

.toolbar__quantum-objective--held {
  color: color-mix(in srgb, #5cffc4 88%, #e0f2fe);
  text-shadow:
    0 0 14px rgba(52, 211, 153, 0.55),
    0 0 22px rgba(34, 211, 238, 0.25),
    0 1px 3px rgba(0, 0, 0, 0.75);
}

.toolbar__quantum-objective--contested {
  animation: toolbar-quantum-contest 1.1s ease-in-out infinite;
}

@keyframes toolbar-quantum-contest {
  0%,
  100% {
    filter: brightness(1);
    opacity: 1;
  }
  50% {
    filter: brightness(1.2);
    opacity: 0.88;
  }
}

.deposit-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.deposit-presets .overlay__btn {
  flex: 1 1 calc(50% - 8px);
  min-width: 96px;
  font-size: 0.65rem;
  line-height: 1.25;
  padding: 10px 8px;
}

.field__error {
  color: #e94560;
  font-size: 0.85rem;
  margin: 8px 0 0;
}

/* —— VFX: карта, оверлей, покупки —— */
/* transform на предке <canvas> не используем — в WebView Telegram возможны артефакты отрисовки. */
.board-vfx {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.board {
  position: relative;
  z-index: 1;
}

.float-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 130;
  overflow: hidden;
}

.float-fx__pop {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -20%) scale(0.75);
  font-size: clamp(0.72rem, 2.8vw, 0.95rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fffbeb;
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.95), 0 2px 10px rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.4s cubic-bezier(0.34, 1.45, 0.64, 1);
  white-space: nowrap;
  z-index: 1;
}

.float-fx__pop--gold {
  color: #fef3c7;
  text-shadow: 0 0 20px rgba(251, 191, 36, 1), 0 0 40px rgba(245, 158, 11, 0.45);
}

.float-fx__pop--raid {
  color: #fecaca;
  text-shadow: 0 0 22px rgba(239, 68, 68, 0.95), 0 2px 12px rgba(0, 0, 0, 0.8);
}

.float-fx__pop--show {
  opacity: 1;
  transform: translate(-50%, -120%) scale(1);
}

.float-fx__pop--out {
  opacity: 0;
  transform: translate(-50%, -200%) scale(0.88);
}

/* Полноэкранные .fx-speed / .fx-flash убраны: в TG WebView давали «туман» на большой площади карты. */

.app.fx-military-deploy-moment {
  animation: military-deploy-app-vignette 1.35s ease-out 1;
}

@keyframes military-deploy-app-vignette {
  0%,
  100% {
    filter: none;
  }
  12% {
    filter: drop-shadow(0 0 22px rgba(251, 191, 36, 0.55)) drop-shadow(0 0 48px rgba(99, 102, 241, 0.2));
  }
  35% {
    filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.35));
  }
}

.app.fx-team-boost .toolbar__wallet {
  animation: wallet-pulse-glow 0.9s ease-in-out 2;
}

@keyframes wallet-pulse-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 transparent);
    transform: scale(1);
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.9));
    transform: scale(1.04);
  }
}

.toolbar__wallet--pulse {
  animation: wallet-bump 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wallet-bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

.event-banner-stack {
  position: fixed;
  z-index: 50;
  left: 0;
  right: 0;
  /* Под шапкой (Магазин, База…): плашки не перекрывают кнопки тулбара */
  top: calc(var(--safe-top) + var(--toolbar-h, 34px) + 2px);
  padding-top: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.event-banner {
  width: 100%;
  padding: 5px 10px 6px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fef3c7;
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.92), rgba(217, 119, 6, 0.88), rgba(180, 83, 9, 0.92));
  border-bottom: 1px solid rgba(251, 191, 36, 0.35);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  line-height: 1.35;
  pointer-events: none;
}

/* Смахиваемые плашки: жест вверх / влево / вправо (см. attachSwipeDismissSlot в main.js) */
.event-banner.event-banner--swipe-dismiss {
  pointer-events: auto;
  touch-action: pan-x pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.event-banner.event-banner--swipe-dismiss.is-alert-fly-out {
  pointer-events: none;
}

.event-banner__sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.92;
  margin-top: 2px;
  letter-spacing: 0.01em;
}

.event-banner__timer {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  margin-top: 3px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.event-banner--battle {
  color: #fffbeb;
  background: linear-gradient(90deg, rgba(146, 90, 10, 0.95), rgba(202, 138, 4, 0.92), rgba(146, 90, 10, 0.95));
  border-bottom-color: rgba(253, 224, 71, 0.45);
}

.event-banner--dramatic {
  color: #fff5f5;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, rgba(90, 20, 40, 0.97), rgba(160, 30, 50, 0.95), rgba(90, 20, 40, 0.97));
  border-bottom: 2px solid rgba(255, 160, 160, 0.55);
  animation: territory-danger-pulse 0.85s ease-in-out infinite;
}

.event-banner--mini-round {
  font-size: 0.64rem;
  padding: 4px 8px 5px;
  font-weight: 700;
  color: #e8ecff;
  background: linear-gradient(90deg, rgba(35, 42, 62, 0.94), rgba(55, 62, 92, 0.9), rgba(35, 42, 62, 0.94));
  border-bottom: 1px solid rgba(160, 180, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  animation: none;
}

/* В потоке стека под тулбаром (как остальные плашки) */
.event-banner--server-say {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  z-index: auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  color: #f8fafc;
  font-size: clamp(0.75rem, 2.8vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.4;
  padding: 10px 14px 11px;
  white-space: pre-wrap;
  word-break: break-word;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.96), rgba(67, 56, 202, 0.93), rgba(30, 58, 138, 0.96));
  border-bottom: 1px solid rgba(199, 210, 254, 0.45);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.35);
}

.event-banner--seismic-warn {
  color: #fff1f2;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: linear-gradient(90deg, rgba(120, 40, 30, 0.96), rgba(180, 60, 40, 0.94), rgba(120, 40, 30, 0.96));
  border-bottom: 1px solid rgba(252, 165, 165, 0.5);
  animation: territory-danger-pulse 1s ease-in-out infinite;
}

.event-banner--team {
  color: #ecfdf5;
  background: linear-gradient(90deg, rgba(6, 95, 70, 0.92), rgba(5, 150, 105, 0.88), rgba(6, 95, 70, 0.92));
  border-bottom-color: rgba(52, 211, 153, 0.35);
}

.event-banner--danger {
  color: #fff1f2;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, rgba(127, 29, 29, 0.95), rgba(185, 28, 28, 0.92), rgba(127, 29, 29, 0.95));
  border-bottom: 1px solid rgba(252, 165, 165, 0.45);
  animation: territory-danger-pulse 1.1s ease-in-out infinite;
}

.event-banner--flag {
  color: #fff7ed;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, rgba(120, 20, 60, 0.96), rgba(180, 40, 40, 0.94), rgba(120, 20, 60, 0.96));
  border-bottom: 1px solid rgba(255, 180, 120, 0.5);
  animation: territory-danger-pulse 0.9s ease-in-out infinite;
}

/* Отклонённые тапы / жёсткие ошибки — всегда заметно, не только в Telegram alert */
.event-banner--feedback {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding: 7px 12px 8px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  border-bottom-width: 2px;
}

.event-banner--feedback-warn {
  color: #fffbeb;
  background: linear-gradient(90deg, rgba(146, 64, 14, 0.96), rgba(217, 119, 6, 0.94), rgba(146, 64, 14, 0.96));
  border-bottom-color: rgba(253, 230, 138, 0.55);
  animation: feedback-banner-pulse 0.85s ease-in-out infinite;
}

.event-banner--feedback-error {
  color: #fef2f2;
  background: linear-gradient(90deg, rgba(99, 16, 16, 0.97), rgba(185, 28, 28, 0.95), rgba(99, 16, 16, 0.97));
  border-bottom-color: rgba(252, 165, 165, 0.65);
  animation: feedback-banner-pulse 0.65s ease-in-out infinite;
}

.event-banner--feedback-success {
  color: #ecfdf5;
  background: linear-gradient(90deg, rgba(6, 78, 59, 0.96), rgba(5, 122, 85, 0.94), rgba(6, 78, 59, 0.96));
  border-bottom-color: rgba(110, 231, 183, 0.55);
  animation: feedback-banner-pulse 0.75s ease-in-out infinite;
}

@keyframes feedback-banner-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.1);
  }
}

@keyframes territory-danger-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.event-banner--critical {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  animation: territory-critical-pulse 0.55s ease-in-out infinite;
}

@keyframes territory-critical-pulse {
  0%,
  100% {
    filter: brightness(1) saturate(1);
    transform: scale(1);
  }
  50% {
    filter: brightness(1.18) saturate(1.25);
    transform: scale(1.01);
  }
}

.event-banner[hidden] {
  display: none !important;
}

.defeat-flash {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 6;
  opacity: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, rgba(255, 240, 200, 0.35), transparent 65%),
    radial-gradient(ellipse 90% 70% at 50% 48%, rgba(255, 40, 30, 0.62), transparent 78%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2), transparent 55%);
}

.defeat-flash--on {
  animation: defeat-flash-anim 0.38s ease-out;
}

@keyframes defeat-flash-anim {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.map-shake {
  animation: map-shake-anim 0.68s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Тактическая бомба: чуть сильнее и резче, длительность задаётся из JS (timeout снятия класса). */
.map-shake--nuke {
  animation: map-shake-nuke-anim 0.55s cubic-bezier(0.32, 0.02, 0.24, 0.98) both;
}

@keyframes map-shake-nuke-anim {
  0%,
  100% {
    transform: translate(0, 0);
  }
  18% {
    transform: translate(-8px, 5px);
  }
  36% {
    transform: translate(9px, -6px);
  }
  54% {
    transform: translate(-6px, -7px);
  }
  72% {
    transform: translate(5px, 4px);
  }
  88% {
    transform: translate(-3px, 2px);
  }
}

/* Тряска только канвы: не конфликтует с body.pb-seismic-tremor #stage-wrap */
.board.map-shake-board {
  transform-origin: center center;
  animation: map-shake-anim 0.62s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
}

.board.map-shake-board--hit {
  transform-origin: center center;
  animation: map-shake-anim 0.52s cubic-bezier(0.36, 0.07, 0.19, 0.97) 9;
}

@keyframes map-shake-anim {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-5px, 3px);
  }
  40% {
    transform: translate(6px, -4px);
  }
  60% {
    transform: translate(-4px, -5px);
  }
  80% {
    transform: translate(2px, 1px);
  }
}

/* Под первой строкой шапки — полная ширина, не в ряду с кнопками */
.toolbar-buffs {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  flex-shrink: 0;
  align-self: stretch;
  margin-top: 0;
}

.toolbar-buffs[hidden] {
  display: none !important;
}

.toolbar-buff {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1px;
  flex-shrink: 0;
  width: 100%;
}

.toolbar-buff__label {
  font-size: 0.46rem;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0.01em;
  color: rgba(203, 213, 225, 0.9);
  -webkit-text-fill-color: rgba(203, 213, 225, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.toolbar-buff__track {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.toolbar-buff__fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.35);
  transition: width 0.3s linear;
}

.crisis-overlay__card {
  max-width: 360px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.2);
}

.crisis-overlay__title {
  color: #fecaca;
}

.crisis-overlay__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.crisis-overlay__dismiss {
  margin-top: 10px;
  width: 100%;
}

.defeat-overlay__card {
  max-width: 380px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 0 28px rgba(15, 23, 42, 0.45);
}

.defeat-overlay__title {
  color: #cbd5e1;
}

.defeat-overlay__text {
  white-space: pre-line;
}

.defeat-overlay__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.defeat-overlay__sub {
  margin: 0 0 4px;
  color: var(--tg-hint);
  font-size: 0.9rem;
}

.treasure-found-overlay__card {
  max-width: 400px;
  border: 1px solid rgba(255, 200, 120, 0.45);
  background: linear-gradient(165deg, rgba(28, 22, 12, 0.97), rgba(12, 14, 22, 0.98));
  box-shadow:
    0 0 0 1px rgba(255, 220, 140, 0.12),
    0 0 40px rgba(255, 170, 60, 0.22),
    0 20px 48px rgba(0, 0, 0, 0.55);
}

.treasure-found-overlay__kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 210, 140, 0.85);
}

.treasure-found-overlay__title {
  margin: 0 0 12px;
  color: #fff8e8;
  text-shadow: 0 0 20px rgba(255, 190, 80, 0.35);
}

.treasure-found-overlay__amount {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #ffe08a;
  text-shadow: 0 0 18px rgba(255, 200, 80, 0.45);
}

.treasure-found-overlay__hint {
  margin: 0;
  color: rgba(255, 252, 245, 0.72);
}

.treasure-found-overlay__btn {
  width: 100%;
  margin-top: 4px;
}

.fx-btn-press {
  animation: fx-btn-pop 0.22s ease-out;
}

@keyframes fx-btn-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(0.94);
    filter: brightness(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toolbar__wallet--pulse,
  .app.fx-team-boost .toolbar__wallet,
  .fx-btn-press {
    animation: none;
  }

  .quick-buy-rail__btn--fab,
  .quick-buy-rail__btn--fab:hover:not(:disabled),
  .quick-buy-rail__btn--fab:active:not(:disabled),
  .quick-buy-rail__btn--fab.quick-buy-rail__btn--map-armed,
  .quick-buy-rail__btn--fab.quick-buy-rail__btn--map-armed:hover:not(:disabled),
  .quick-buy-rail__btn--fab.quick-buy-rail__btn--map-armed:active:not(:disabled) {
    transform: none;
  }

  .toolbar__btn:hover {
    transform: none;
    filter: none;
  }

  .round-start-splash--in,
  .tournament-warmup-overlay,
  .round-ended-overlay {
    animation: none !important;
  }
}

/* —— Турнир: разминка, старт раунда, итог раунда —— */
.round-start-splash {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(6, 12, 28, 0.55), rgba(4, 8, 18, 0.92));
}

.round-start-splash[hidden] {
  display: none !important;
}

.round-start-splash__panel {
  text-align: center;
  padding: 24px 32px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(30, 64, 175, 0.95), rgba(88, 28, 135, 0.92));
  border: 2px solid rgba(250, 204, 21, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(250, 204, 21, 0.15);
  transform: scale(0.82);
  opacity: 0;
}

.round-start-splash--in .round-start-splash__panel {
  animation: round-splash-in 2.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes round-splash-in {
  0% {
    transform: scale(0.82);
    opacity: 0;
  }
  18% {
    transform: scale(1.06);
    opacity: 1;
  }
  35% {
    transform: scale(1);
  }
  78% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.02);
    opacity: 0;
  }
}

.round-start-splash__kicker {
  margin: 0 0 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: rgba(254, 243, 199, 0.9);
  text-transform: uppercase;
}

.round-start-splash__title {
  margin: 0;
  font-size: clamp(1.15rem, 4.2vw, 1.65rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.tournament-warmup-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 52px 12px 12px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 10, 24, 0.78) 0%, transparent 42%);
}

.tournament-warmup-overlay[hidden] {
  display: none !important;
}

.tournament-warmup-overlay__card {
  pointer-events: auto;
  max-width: 420px;
  width: 100%;
  padding: 14px 16px 16px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.96), rgba(30, 27, 75, 0.94));
  border: 1px solid rgba(129, 140, 248, 0.45);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.tournament-warmup-overlay__badge {
  display: inline-block;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #fef08a;
  background: rgba(234, 179, 8, 0.2);
  border: 1px solid rgba(250, 204, 21, 0.45);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.tournament-warmup-overlay__title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.tournament-warmup-overlay__timer {
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fde047;
  margin-bottom: 10px;
  text-shadow: 0 0 20px rgba(234, 179, 8, 0.35);
}

.tournament-warmup-overlay__body {
  font-size: 0.68rem;
  line-height: 1.45;
  color: color-mix(in srgb, var(--tg-hint) 95%, #e2e8f0);
}

.tournament-warmup-overlay__body ul {
  margin: 6px 0 0;
  padding-left: 1.1rem;
}

.tournament-warmup-overlay__body li {
  margin-bottom: 4px;
}

.tournament-warmup-overlay__hint {
  margin: 12px 0 0;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fca5a5;
  line-height: 1.35;
}

.round-ended-overlay {
  position: fixed;
  inset: 0;
  z-index: 230;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(8px);
}

.round-ended-overlay[hidden] {
  display: none !important;
}

.round-ended-overlay__card {
  max-width: 400px;
  width: 100%;
  max-height: min(86vh, 560px);
  overflow: auto;
  padding: 18px 18px 16px;
  border-radius: 18px;
  background: linear-gradient(165deg, rgba(30, 27, 75, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(167, 139, 250, 0.4);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.round-ended-overlay__kicker {
  margin: 0 0 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  color: #c4b5fd;
  text-transform: uppercase;
}

.round-ended-overlay__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.round-ended-overlay__score {
  margin: 0 0 12px;
  font-size: 0.72rem;
  color: #a5b4fc;
  font-weight: 600;
}

.round-ended-overlay__board {
  font-size: 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 8px 10px;
  margin-bottom: 12px;
}

.round-ended-overlay__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
}

.round-ended-overlay__row:last-child {
  border-bottom: none;
}

.round-ended-overlay__next {
  margin: 0 0 12px;
  font-size: 0.68rem;
  line-height: 1.4;
  color: #fcd34d;
  font-weight: 600;
}

.round-ended-overlay__btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: none;
  font-weight: 800;
  font-size: 0.75rem;
  cursor: pointer;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: #fff;
}

/* Полноэкранная вспышка при бомбе (ядро + ударная волна в красном спектре) */
@keyframes pb-nuke-flash-anim {
  0% {
    opacity: 0;
    filter: brightness(1) saturate(1);
  }
  6% {
    opacity: 1;
    filter: brightness(2.4) saturate(0.35);
  }
  18% {
    opacity: 0.88;
    filter: brightness(1.5) saturate(0.5);
  }
  100% {
    opacity: 0;
    filter: brightness(1) saturate(1);
  }
}

.pb-nuke-flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
  animation: pb-nuke-flash-anim 2.1s ease-out forwards;
  background: radial-gradient(
    ellipse 95% 78% at 50% 42%,
    rgba(255, 255, 245, 0.97) 0%,
    rgba(255, 200, 80, 0.55) 12%,
    rgba(255, 60, 20, 0.62) 32%,
    rgba(160, 0, 0, 0.72) 58%,
    rgba(20, 5, 8, 0.88) 100%
  );
  mix-blend-mode: screen;
}

/* Премиум: посадка передовой базы — золото/бирюза, без «ядерного» красного */
@keyframes pb-military-deploy-anim {
  0% {
    opacity: 0;
    filter: brightness(1) saturate(1);
  }
  8% {
    opacity: 1;
    filter: brightness(1.85) saturate(1.15);
  }
  22% {
    opacity: 0.92;
    filter: brightness(1.35) saturate(1.05);
  }
  100% {
    opacity: 0;
    filter: brightness(1) saturate(1);
  }
}

.pb-military-deploy-overlay {
  position: fixed;
  inset: 0;
  z-index: 10048;
  pointer-events: none;
  animation: pb-military-deploy-anim 1.65s ease-out forwards;
  background: radial-gradient(
    ellipse 88% 72% at 50% 38%,
    rgba(255, 252, 240, 0.55) 0%,
    rgba(251, 191, 36, 0.38) 18%,
    rgba(99, 102, 241, 0.22) 42%,
    rgba(15, 23, 42, 0.5) 100%
  );
  mix-blend-mode: screen;
}

.float-fx__pop--military {
  font-size: clamp(0.82rem, 3.4vw, 1.12rem);
  letter-spacing: 0.14em;
  color: #fffbeb;
  text-shadow:
    0 0 8px rgba(251, 191, 36, 1),
    0 0 28px rgba(245, 158, 11, 0.85),
    0 0 48px rgba(99, 102, 241, 0.35),
    0 3px 14px rgba(0, 0, 0, 0.9);
}

.float-fx__pop--military-sub {
  font-size: clamp(0.62rem, 2.4vw, 0.78rem);
  letter-spacing: 0.22em;
  color: #e0e7ff;
  text-shadow:
    0 0 12px rgba(129, 140, 248, 0.9),
    0 2px 10px rgba(0, 0, 0, 0.85);
  opacity: 0.95;
}

.toolbar__audio-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.game-audio-panel {
  /* Позицию задаёт JS (fixed от края экрана): иначе .toolbar { overflow: hidden } обрезает панель */
  position: fixed;
  z-index: 20050;
  min-width: min(280px, 92vw);
  max-width: calc(100vw - 16px);
  padding: 12px 14px 14px;
  border-radius: 12px;
  background: rgba(22, 28, 38, 0.96);
  border: 1px solid rgba(120, 160, 220, 0.28);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.game-audio-panel__title {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(200, 214, 235, 0.85);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: visible;
  text-align: left;
}

.game-audio-panel__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.92);
  margin-bottom: 8px;
}

.game-audio-panel__row--mute {
  grid-template-columns: auto 1fr;
  margin-bottom: 0;
  margin-top: 4px;
}

.game-audio-panel input[type="range"] {
  width: 120px;
  accent-color: #7c9cff;
}

.game-audio-panel input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #7c9cff;
}
