/* ---------- Общие эффекты ---------- */

/* число выросло / уменьшилось: короткая цветная вспышка */
.fx-up { animation: fxUp 1s ease-out; }
.fx-down { animation: fxDown 1s ease-out; }
@keyframes fxUp {
  0% { color: #4ade80; text-shadow: 0 0 14px rgba(74,222,128,.9); transform: scale(1.08); }
  100% { text-shadow: 0 0 0 transparent; transform: scale(1); }
}
@keyframes fxDown {
  0% { color: #f87171; text-shadow: 0 0 14px rgba(248,113,113,.9); transform: scale(.94); }
  100% { text-shadow: 0 0 0 transparent; transform: scale(1); }
}

/* волна появления: задержка = --i × --d */
.fx-in { animation: fxIn .5s cubic-bezier(.22,.8,.3,1) backwards; animation-delay: calc(var(--i, 0) * var(--d, 45ms)); }
@keyframes fxIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* «пружинка» — выбранный / новый элемент */
.fx-pop { animation: fxPop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes fxPop { 0% { transform: scale(.82); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }

/* тряска (не повезло) */
.fx-shake { animation: fxShake .6s cubic-bezier(.36,.07,.19,.97); }
@keyframes fxShake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); }
}

/* элемент уходит (продан / куплен) */
.fx-out { animation: fxOut .34s cubic-bezier(.5,0,.8,.4) forwards; pointer-events: none; }
@keyframes fxOut { to { opacity: 0; transform: translateY(18px) scale(.7); } }

/* новый подарок / строка: свечение, которое гаснет */
.fx-glow { animation: fxGlow 1.8s ease-out; }
@keyframes fxGlow {
  0% { box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 0 28px rgba(247,37,133,.9); transform: scale(.9); }
  25% { transform: scale(1.04); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 transparent; transform: scale(1); }
}
.wal__row.fx-newrow { animation: fxRow .9s cubic-bezier(.22,.8,.3,1); }
@keyframes fxRow {
  0% { opacity: 0; transform: translateX(-16px); background: rgba(247,37,133,.35); border-radius: 16px; }
  35% { opacity: 1; transform: none; }
  100% { background: transparent; }
}

/* конфетти */
.fx-layer { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.fx-layer i { position: absolute; display: block; will-change: transform, opacity; }

/* окно результата: квадраты с призами выскакивают по очереди */
.win.is-open .win__sq { animation: fxPop .55s cubic-bezier(.3,1.6,.5,1) both; }
.win.is-open .win__sq:nth-child(2) { animation-delay: .08s; }
.win.is-open .win__sq:nth-child(3) { animation-delay: .16s; }
.win.is-open .win__sq:nth-child(n+4) { animation-delay: .24s; }

/* кнопки: отклик на наведение (ПК) и нажатие */
.wal__btn, .prof__btn, .arena__bet, .sh__buy, .inv__wd, .inv__sell, .arena__gift, .modal__btn, .prof__claim, .wal__max, .wal__link {
  transition: transform .2s cubic-bezier(.3,1.4,.5,1), filter .2s, opacity .2s;
}
@media (hover: hover) {
  .wal__btn:not(:disabled):hover, .prof__btn:hover, .arena__bet:not(:disabled):hover, .sh__buy:hover, .inv__wd:hover,
  .inv__sell:hover, .arena__gift:hover, .modal__btn:hover, .prof__claim:not(:disabled):hover, .wal__max:hover, .wal__link:hover {
    transform: translateY(-2px); filter: brightness(1.1);
  }
}
.wal__btn:not(:disabled):active, .prof__btn:active, .arena__bet:not(:disabled):active, .sh__buy:active, .inv__wd:active,
.inv__sell:active, .arena__gift:active, .modal__btn:active, .prof__claim:not(:disabled):active { transform: scale(.95); }

/* выигравший сектор колеса после остановки */
#arRot [data-b] { transition: opacity .5s, filter .5s; }
#arRot.has-winner [data-b] { opacity: .3; }
#arRot.has-winner [data-b].is-win { opacity: 1; filter: drop-shadow(0 0 9px rgba(255,255,255,.9)); }

@media (prefers-reduced-motion: reduce) {
  .fx-up, .fx-down, .fx-in, .fx-pop, .fx-shake, .fx-out, .fx-glow, .wal__row.fx-newrow, .win.is-open .win__sq { animation: none; }
}
