/* ============================================================
   Общие анимации портала. Подключается после основного CSS страницы.
   Всё уважает prefers-reduced-motion: при отключённой анимации
   элементы просто показываются без движения.
   ============================================================ */

@keyframes bunker-pop {
  0% { transform: scale(0.96); opacity: 0; }
  60% { transform: scale(1.01); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bunker-rise {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes bunker-flip {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(88deg); }
  100% { transform: rotateX(0deg); }
}

@keyframes bunker-bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@keyframes bunker-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

@keyframes bunker-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(216, 255, 62, 0); }
  50% { box-shadow: 0 0 26px rgba(216, 255, 62, 0.35); }
}

@keyframes bunker-sweep {
  from { background-position: -140% 0; }
  to { background-position: 240% 0; }
}

/** Появление панелей и карточек. */
.anim-pop { animation: bunker-pop 0.32s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.anim-rise { animation: bunker-rise 0.28s ease both; }
.anim-rise-1 { animation: bunker-rise 0.28s ease 0.04s both; }
.anim-rise-2 { animation: bunker-rise 0.28s ease 0.08s both; }
.anim-rise-3 { animation: bunker-rise 0.28s ease 0.12s both; }

/** Всплеск счёта: вызывается из JS добавлением класса на 400 мс. */
.bump { animation: bunker-bump 0.38s ease; }

/** Переворот карточки при раскрытии характеристики. */
.flip { animation: bunker-flip 0.42s ease; }

/** Ошибка/неверный ход. */
.shake { animation: bunker-shake 0.3s ease; }

/** Победный баннер. */
.win-glow { animation: bunker-glow 1.6s ease-in-out 2; }

/** Скелетон-загрузка (если ещё не задан страницей). */
.is-loading {
  background: linear-gradient(100deg, #101612 30%, #1a241c 45%, #101612 60%);
  background-size: 300% 100%;
  animation: bunker-sweep 1.4s linear infinite;
}

/** Тост с лёгким подъёмом. */
.toast.show { animation: bunker-rise 0.2s ease; }

/** Оверлей победы/поражения в аркаде и комнатах. */
.overlay-host > * { animation: bunker-pop 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) both; }

/** Кнопка звука. */
[data-sound-toggle] {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line, #26302a);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text, #eef3e7);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
[data-sound-toggle]:hover { border-color: var(--accent, #d8ff3e); background: rgba(216, 255, 62, 0.08); }
[data-sound-toggle][aria-pressed="false"] { opacity: 0.6; }

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

@media (prefers-reduced-motion: reduce) {
  .anim-pop, .anim-rise, .anim-rise-1, .anim-rise-2, .anim-rise-3,
  .bump, .flip, .shake, .win-glow, .is-loading, .overlay-host > *,
  .toast.show {
    animation: none !important;
  }
}
