/* ============================================================
   MONZO SLOTS — Mobile bonus wheel
   Figma: node 1:2 (mobile_bonus) — base frame 390 x 844
   ============================================================ */

:root {
  --scale: 1;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: "Poppins", system-ui, -apple-system, sans-serif;
  background: #04121d;
  overflow: hidden;
}

/* ---- Viewport: centers & scales the fixed mobile stage ---- */
.viewport {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #04121d;
  overflow: hidden;
}

/* The 390 x 844 design canvas — scaled to fit the screen */
.stage {
  position: relative;
  flex: none;
  width: 390px;
  height: 844px;
  overflow: hidden;
  background: #0a1d2e;
  transform: scale(var(--scale));
  transform-origin: center center;
}

/* ---------------- Background ---------------- */
.bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: scaleX(-1); /* figma: -scale-y-100 rotate-180 => horizontal flip */
}

.bg img {
  position: absolute;
  top: 0;
  left: -6.89%;
  width: 346.26%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* ---------------- Energy ring (electric glow) ---------------- */
.energy-ring {
  position: absolute;
  left: -68px;
  top: 68px;
  width: 534px;
  height: 531px;
  pointer-events: none;
}

.energy-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------------- Wheel ---------------- */
.wheel {
  position: absolute;
  left: 10px;
  top: 145px;
  width: 370px;
  height: 370px;
}

/* rotor holds the wheel face + numbers so they spin together */
.wheel__rotor {
  position: absolute;
  inset: 0;
  transform: rotate(0deg);
  transform-origin: center center;
  will-change: transform;
}

.wheel__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.wheel__face img {
  position: absolute;
  left: -4.62%;
  top: -4.36%;
  width: 109.42%;
  height: 109.23%;
  max-width: none;
}

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

.prize {
  position: absolute;
  font-size: 21px;
  letter-spacing: 0.42px;
  line-height: normal;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(var(--rot));
  transform-origin: center center;
}

/* pointer sits above the wheel and does not rotate */
.wheel__pointer {
  position: absolute;
  left: 167px;
  top: -10px; /* figma frame y=135, wheel starts at y=145 */
  width: 36px;
  height: 54px;
  overflow: hidden;
  z-index: 3;
}

.wheel__pointer img {
  position: absolute;
  left: -51.63%;
  top: -23.33%;
  width: 163.4%;
  height: 130%;
  max-width: none;
}

/* ---------------- Fisherman ---------------- */
.fisherman {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 267px;
  height: 390px;
  z-index: 4;
  /* sit him a touch smaller and grounded bottom-left so the coral
     stays visible on the right (matches the reference mockup) */
  transform: scale(0.9);
  transform-origin: left bottom;
}

/* cyan rim glow (figma mask group, 60% #01e4fd, mirrored) */
.fisherman__glow {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 267px;
  height: 390px;
  background: #01e4fd;
  opacity: 0.6;
  transform: scaleX(-1);
  -webkit-mask: url("../images/fisherman-mask.png") center / 267px 390px no-repeat;
  mask: url("../images/fisherman-mask.png") center / 267px 390px no-repeat;
  transform: rotate(360deg);
}

.fisherman__img {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 267px;
  height: 390px;
  overflow: hidden;
}

.fisherman__img img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}

/* ---------------- Logo ---------------- */
.logo {
  position: absolute;
  left: 77px;
  top: 20px;
  width: 236px;
  height: 90px;
  overflow: hidden;
  z-index: 5;
}

.logo img {
  position: absolute;
  left: -13.15%;
  top: -22.27%;
  width: 124.05%;
  height: 128.07%;
  max-width: none;
}

/* ---------------- Spin button ---------------- */
.spin {
  position: absolute;
  left: 40px;
  top: 678px;
  width: 311px;
  height: 83px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  z-index: 6;
  -webkit-tap-highlight-color: transparent;
}

.spin__bg {
  position: absolute;
  left: 1px;
  top: 0;
  width: 310px;
  height: 83px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
}

.spin__text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.spin__text.shine {
  filter: drop-shadow(0 2.818px 15.215px rgba(0, 0, 0, 0.6));
}

.spin:active {
  transform: translateY(1px);
}

.spin:disabled {
  cursor: default;
}

/* ---------------- Win popup ---------------- */
.modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 26px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 12, 20, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal__card {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 34px 26px 32px;
  border-radius: 24px;
  text-align: center;
  background: radial-gradient(
      120% 90% at 50% 0%,
      rgba(1, 228, 253, 0.22) 0%,
      rgba(10, 29, 46, 0) 60%
    ),
    linear-gradient(180deg, #0c2740 0%, #07182a 100%);
  border: 1.5px solid rgba(1, 228, 253, 0.55);
  box-shadow: 0 0 40px rgba(1, 228, 253, 0.35),
    inset 0 0 24px rgba(1, 228, 253, 0.12);
  transform: scale(0.9);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.is-open .modal__card {
  transform: scale(1);
}

.modal__title {
  font-size: 30px;
  letter-spacing: 0.6px;
}

.modal__prizes {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 20px 0 28px;
}

.modal__amount {
  font-family: "Poppins", sans-serif;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0.5px;
}

.modal__plus {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #01e4fd;
}

/* Claim button — reuses the spin button artwork sizing */
.claim {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  border-radius: 40px;
  text-decoration: none;
  background: linear-gradient(180deg, #01e4fd 0%, #0193c9 100%);
  box-shadow: 0 8px 22px rgba(1, 228, 253, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
  -webkit-tap-highlight-color: transparent;
  animation: claimPulse 1.6s ease-in-out infinite;
}

.claim:active {
  transform: translateY(1px);
}

.claim__text {
  font-size: 24px;
  letter-spacing: 0.8px;
}

@keyframes claimPulse {
  0%,
  100% {
    box-shadow: 0 8px 22px rgba(1, 228, 253, 0.4),
      inset 0 2px 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 8px 30px rgba(1, 228, 253, 0.75),
      inset 0 2px 0 rgba(255, 255, 255, 0.4);
  }
}

/* Gold shiny variant for the prize amounts */
.gold {
  font-family: "Poppins", sans-serif;
  text-transform: uppercase;
  text-align: center;
  background-image: linear-gradient(
    180deg,
    #fff3c2 18%,
    #ffd24d 48%,
    #f0a830 82%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(255, 184, 41, 0.55));
}

/* ---------------- Shared shiny gradient text ---------------- */
.shine {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  background-image: linear-gradient(
    180deg,
    #eeecf1 24.731%,
    #ffffff 53.763%,
    #dedfe1 82.796%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2.818px 15.215px rgba(0, 0, 0, 0.7));
}

/* ============================================================
   Ambient + celebration effects
   ============================================================ */
.fx-rays,
.fx-bubbles,
.fx-confetti,
.fx-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ---- Soft moving light rays (god-rays) ---- */
.fx-rays {
  z-index: 1;
  opacity: 0.55;
  mix-blend-mode: screen;
  background: linear-gradient(
      108deg,
      transparent 30%,
      rgba(120, 220, 255, 0.1) 43%,
      transparent 53%
    ),
    linear-gradient(
      82deg,
      transparent 56%,
      rgba(140, 230, 255, 0.08) 67%,
      transparent 77%
    );
  animation: rayShift 9s ease-in-out infinite alternate;
}
@keyframes rayShift {
  from {
    transform: translateX(-22px);
  }
  to {
    transform: translateX(22px);
  }
}

/* ---- Rising bubbles ---- */
.fx-bubbles {
  z-index: 1;
}
.bubble {
  position: absolute;
  bottom: -40px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 32% 28%,
    rgba(255, 255, 255, 0.9),
    rgba(150, 225, 255, 0.35) 45%,
    rgba(120, 200, 240, 0.05) 70%
  );
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.5);
  opacity: 0;
  animation-name: bubbleRise;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}
@keyframes bubbleRise {
  0% {
    transform: translateY(0) translateX(0) scale(0.8);
    opacity: 0;
  }
  12% {
    opacity: 0.7;
  }
  55% {
    transform: translateY(-480px) translateX(16px) scale(1);
  }
  88% {
    opacity: 0.5;
  }
  100% {
    transform: translateY(-920px) translateX(-12px) scale(1.05);
    opacity: 0;
  }
}

/* ---- Energy ring shimmer ---- */
.energy-ring {
  animation: ringPulse 3.4s ease-in-out infinite;
}
.energy-ring img {
  transform-origin: 50% 50%;
  animation: ringSpin 28s linear infinite;
}
@keyframes ringSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ringPulse {
  0%,
  100% {
    opacity: 0.82;
    filter: drop-shadow(0 0 10px rgba(1, 228, 253, 0.25));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 26px rgba(1, 228, 253, 0.6));
  }
}

/* ---- Spin button: breathing glow to invite a tap ---- */
.spin__bg {
  transform-origin: 50% 50%;
  animation: spinPulse 2.4s ease-in-out infinite;
}
@keyframes spinPulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35))
      drop-shadow(0 0 8px rgba(1, 228, 253, 0.35));
  }
  50% {
    transform: scale(1.03);
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35))
      drop-shadow(0 0 22px rgba(1, 228, 253, 0.8));
  }
}
.spin:disabled .spin__bg {
  animation: none;
}

/* ---- Logo glint sweep ---- */
.logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 42%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 58%
  );
  transform: translateX(-130%);
  animation: logoShine 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes logoShine {
  0%,
  68% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(130%);
  }
}

/* ---- Win flash ---- */
.fx-flash {
  z-index: 25;
  background: radial-gradient(
    circle at 50% 44%,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0) 60%
  );
  opacity: 0;
}
.fx-flash.is-on {
  animation: winFlash 0.7s ease-out forwards;
}
@keyframes winFlash {
  0% {
    opacity: 0;
  }
  16% {
    opacity: 0.85;
  }
  100% {
    opacity: 0;
  }
}

/* ---- Confetti coins + sparks ---- */
.fx-confetti {
  z-index: 30;
}
.confetti {
  position: absolute;
  opacity: 0;
  will-change: transform, opacity;
  animation: confettiFly var(--dur, 1.6s) cubic-bezier(0.2, 0.6, 0.3, 1) forwards;
}
@keyframes confettiFly {
  0% {
    transform: translate(-50%, -50%) translate(0, 0) rotate(0deg) scale(0.3);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%)
      translate(calc(var(--dx) * 0.6), calc(var(--dy) * 0.6))
      rotate(calc(var(--rot) * 0.5)) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%)
      translate(var(--dx), calc(var(--dy) + 320px)) rotate(var(--rot)) scale(0.85);
    opacity: 0;
  }
}
.confetti.coin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2b0, #ffce4d 45%, #e89a26 75%);
  box-shadow: inset 0 0 4px rgba(255, 255, 255, 0.7), 0 2px 6px rgba(0, 0, 0, 0.3);
}
.confetti.spark {
  width: 13px;
  height: 13px;
  background: #01e4fd;
  box-shadow: 0 0 8px rgba(1, 228, 253, 0.8);
  clip-path: polygon(
    50% 0,
    61% 39%,
    100% 50%,
    61% 61%,
    50% 100%,
    39% 61%,
    0 50%,
    39% 39%
  );
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .fx-rays,
  .bubble,
  .energy-ring,
  .energy-ring img,
  .spin__bg,
  .logo::after,
  .claim {
    animation: none !important;
  }
}
