/* Fortune Tiger — преленд под слотовый подход.
   Вертикаль первична: гео мобильное, на компьютере просто меняется фон. */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #7a0f10;
  font-family: "Trebuchet MS", "Segoe UI", Roboto, system-ui, sans-serif;
  color: #fff5d6;
  overflow-x: hidden;
}

.stage {
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 14px 34px;
  background-image: url(./assets/bg-mobile.webp);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  overflow: hidden;
}

@media (min-width: 900px) {
  .stage {
    background-image: url(./assets/bg-desktop.webp);
    background-position: center;
    padding-top: 26px;
  }
}

/* фон реагирует на скаттер: становится теплее и чуть ближе */
.stage {
  transition: filter 900ms ease, transform 1400ms ease;
}
.stage--win {
  filter: saturate(1.25) brightness(1.12);
  transform: scale(1.02);
}

/* ── парящие колокольчики и конверты ─────────────────────────────────────── */

.float { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

.float__item {
  position: absolute;
  width: 74px;
  opacity: .22;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35));
  animation: drift 15s ease-in-out infinite;
}

.float__item--a { top: 8%;  left: 6%;  width: 84px; animation-duration: 17s; }
.float__item--b { top: 17%; right: 5%; width: 66px; animation-duration: 21s; animation-delay: -4s; }
.float__item--c { top: 47%; left: 3%;  width: 58px; animation-duration: 19s; animation-delay: -8s; }
.float__item--d { top: 58%; right: 6%; width: 78px; animation-duration: 23s; animation-delay: -2s; }
.float__item--e { bottom: 9%; left: 12%; width: 62px; animation-duration: 18s; animation-delay: -11s; }
.float__item--f { bottom: 15%; right: 11%; width: 70px; animation-duration: 25s; animation-delay: -6s; }

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) rotate(-4deg); }
  50%  { transform: translate3d(6px, -18px, 0) rotate(5deg); }
  100% { transform: translate3d(0, 0, 0) rotate(-4deg); }
}

/* на выигрыше парящие элементы оживают */
.stage--win .float__item { opacity: .4; animation-duration: 6s; }

/* ── заголовок ───────────────────────────────────────────────────────────── */

.head { position: relative; z-index: 2; text-align: center; margin-bottom: 10px; }

.head__kicker {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #ffd977;
}

.head__title {
  margin: 0;
  font-size: 25px;
  line-height: 1.15;
  font-weight: 800;
  text-shadow: 0 3px 0 #7d1206, 0 6px 18px rgba(0, 0, 0, .45);
}

@media (min-width: 900px) {
  .head__title { font-size: 34px; }
}

/* ── барабаны ────────────────────────────────────────────────────────────── */

.slot {
  position: relative;
  z-index: 2;
  width: min(94vw, 430px);
  margin-top: 10px;
  /* 28.08 Егор: «окно слота меньше, чисто под 3 элемента». Рамку обрезал по
     высоте до одного ряда, отсюда и новое соотношение сторон. */
  aspect-ratio: 1000 / 513;
}

.slot__frame { width: 100%; height: 100%; display: block; }

/* сетка символов ложится точно в окна рамки: отступы подобраны под картинку */
.slot__reels {
  position: absolute;
  top: 33.1%;
  left: 12.4%;
  width: 75.2%;
  height: 58.5%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.6%;
}

.reel {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.reel__strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
}

.reel__cell {
  /* один видимый ряд: ячейка занимает всё окно барабана */
  height: 100%;
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel__cell img {
  width: 74%;
  max-height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(90, 20, 0, .35));
}

.reel--spinning .reel__strip { filter: blur(1.4px); }

/* подсветка выигрыша по всей рамке */
.slot__glow {
  position: absolute;
  inset: -6%;
  border-radius: 22px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255, 214, 102, .55), rgba(255, 214, 102, 0) 68%);
  transition: opacity 500ms ease;
}
.slot--win .slot__glow { opacity: 1; animation: pulse 1.1s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: .55; } }

.slot--win .reel__cell img { animation: pop 700ms ease-in-out 3; }

@keyframes pop {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}

/* ── подсказка и кнопка ──────────────────────────────────────────────────── */

.hint {
  position: relative;
  z-index: 2;
  margin: 14px 0 0;
  font-size: 15px;
  color: #ffe6a8;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.hint b { color: #fff; font-size: 17px; }

.spin {
  position: relative;
  z-index: 2;
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  width: 148px;
  animation: breathe 1.8s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.spin__img { width: 100%; display: block; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45)); }

.spin:active { transform: scale(.95); }
.spin[disabled] { animation: none; opacity: .75; cursor: default; }

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@media (min-width: 900px) {
  .spin { width: 168px; }
}

/* ── эффекты ─────────────────────────────────────────────────────────────── */

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }

.fx__salute, .fx__firework, .fx__confetti {
  position: absolute;
  opacity: 0;
  will-change: transform, opacity;
}

.fx__salute {
  top: 4%;
  left: 50%;
  width: min(92vw, 460px);
  transform: translateX(-50%) scale(.6);
}
.fx__salute--on { animation: salute 1600ms ease-out forwards; }

@keyframes salute {
  0%   { opacity: 0; transform: translateX(-50%) scale(.6); }
  25%  { opacity: 1; transform: translateX(-50%) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.12); }
}

.fx__firework { width: min(46vw, 220px); top: 12%; }
.fx__firework--l { left: -2%; }
.fx__firework--r { right: -2%; }
.fx__firework--on { animation: firework 1300ms ease-out forwards; }

@keyframes firework {
  0%   { opacity: 0; transform: scale(.4) rotate(-6deg); }
  35%  { opacity: 1; transform: scale(1) rotate(0deg); }
  100% { opacity: 0; transform: scale(1.25) rotate(4deg); }
}

.fx__confetti {
  top: -12%;
  left: 50%;
  width: min(120vw, 620px);
  transform: translateX(-50%);
}
.fx__confetti--on { animation: confetti 2600ms linear forwards; }

@keyframes confetti {
  0%   { opacity: 0; transform: translate(-50%, -10%) scale(1.05); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 42%) scale(1.05); }
}

.fx__coins { position: absolute; inset: 0; }

.coin {
  position: absolute;
  bottom: -12%;
  width: 54px;
  opacity: 0;
  will-change: transform, opacity;
}
.coin--on { animation: coin 1900ms cubic-bezier(.18, .7, .32, 1) forwards; }

@keyframes coin {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg) scale(.8); }
  12%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-115vh) rotate(320deg) scale(1.05); }
}

/* ── итоговое окно ───────────────────────────────────────────────────────── */

.popup {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(40, 4, 4, .72);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms ease, visibility 320ms ease;
}
.popup--show { opacity: 1; visibility: visible; }

.popup__box { width: min(92vw, 400px); text-align: center; }

.popup__win { width: 100%; display: block; }

.popup__text {
  margin: 6px 0 16px;
  font-size: 17px;
  font-weight: 700;
  color: #ffe6a8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}

.popup__claim { display: block; }
.popup__claim img {
  width: 100%;
  display: block;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .5));
  animation: breathe 1.6s ease-in-out infinite;
}
.popup__claim:active img { transform: scale(.97); }

/* ── плашка про ярлык ────────────────────────────────────────────────────── */

.install {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(30, 3, 3, .78);
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}
.install--show { opacity: 1; visibility: visible; }

.install__box {
  width: min(88vw, 340px);
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #8d1414, #5f0c0c);
  border: 2px solid #f0c04a;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
}

.install__title { margin: 0 0 8px; font-size: 19px; font-weight: 800; color: #ffd977; }
.install__text { margin: 0 0 16px; font-size: 14px; line-height: 1.45; color: #ffeec7; }

.install__yes {
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffd15c, #f0a92a);
  color: #5a1200;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.install__no {
  margin-top: 10px;
  width: 100%;
  padding: 6px 0;
  border: 0;
  background: none;
  color: #ffd9a8;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
