:root {
  --green: #2dff3a;
  --green-dim: #1db82a;
  --gold: #f0c54a;
  --gold-2: #ffe58a;
  --red: #d01224;
  --red-mid: #b40f1e;
  --red-dark: #7a0a14;
  --navy: #070b1a;
  --slot: #07143d;
  --slot-deep: #040c28;
  --cell: 74px;
  --phone-w: 430px;
  --radius-frame: 22px;
  --font-display: "Unbounded", system-ui, sans-serif;
  --font-ui: "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: #f4f1ea;
  background: #03050d;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

.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;
}

.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, #1a2a55 0%, transparent 55%),
    #03050d;
}

.phone {
  position: relative;
  width: min(100%, var(--phone-w));
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background-color: #041525;
}

.world {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.world__palace {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 40, 62, 0.08) 0%, rgba(4, 28, 48, 0.2) 42%, rgba(3, 12, 28, 0.78) 100%),
    url("../assets/poseidon-bg.png");
  background-size: cover;
  background-position: center 18%;
  transform: scale(1.04);
  animation: palaceDrift 18s ease-in-out infinite alternate;
}

.world__rays {
  position: absolute;
  inset: -30% -20% 28%;
  background: repeating-conic-gradient(
    from -18deg at 50% -8%,
    transparent 0deg 7deg,
    rgba(170, 245, 255, 0.09) 8deg 11deg,
    transparent 12deg 18deg,
    rgba(255, 220, 140, 0.05) 19deg 21deg
  );
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 10%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 80% at 50% 0%, #000 10%, transparent 72%);
  animation: raysSweep 14s linear infinite;
  mix-blend-mode: screen;
}

.world__caustics {
  position: absolute;
  inset: 0 auto auto 0;
  width: 140%;
  height: 55%;
  left: -20%;
  top: -8%;
  background:
    radial-gradient(ellipse 40% 30% at 30% 40%, rgba(90, 230, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 35% 28% at 70% 30%, rgba(255, 210, 110, 0.12), transparent 62%),
    radial-gradient(ellipse 50% 35% at 50% 20%, rgba(120, 255, 230, 0.1), transparent 70%);
  filter: blur(8px);
  animation: causticShift 7s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

.world__bubbles span {
  position: absolute;
  bottom: 18%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, rgba(160, 230, 255, 0.15) 55%, transparent 70%);
  animation: bubbleRise 9s linear infinite;
  opacity: 0.55;
}

.world__bubbles span:nth-child(1) { left: 12%; width: 6px; height: 6px; animation-duration: 8s; animation-delay: 0s; }
.world__bubbles span:nth-child(2) { left: 22%; width: 10px; height: 10px; animation-duration: 11s; animation-delay: 1.4s; }
.world__bubbles span:nth-child(3) { left: 38%; width: 5px; height: 5px; animation-duration: 7s; animation-delay: 2.2s; }
.world__bubbles span:nth-child(4) { left: 52%; width: 9px; height: 9px; animation-duration: 10s; animation-delay: 0.6s; }
.world__bubbles span:nth-child(5) { left: 67%; width: 7px; height: 7px; animation-duration: 9s; animation-delay: 3.1s; }
.world__bubbles span:nth-child(6) { left: 78%; width: 11px; height: 11px; animation-duration: 12s; animation-delay: 1.8s; }
.world__bubbles span:nth-child(7) { left: 88%; width: 6px; height: 6px; animation-duration: 8.5s; animation-delay: 4s; }
.world__bubbles span:nth-child(8) { left: 8%; width: 8px; height: 8px; animation-duration: 13s; animation-delay: 5.2s; bottom: 30%; }

.sky,
.vignette,
.fx,
.flash,
.loader {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sky {
  z-index: 1;
  background:
    radial-gradient(circle at 50% 16%, rgba(90, 230, 255, 0.2), transparent 38%),
    radial-gradient(circle at 18% 28%, rgba(255, 200, 90, 0.1), transparent 26%);
  animation: skyPulse 4.5s ease-in-out infinite;
  mix-blend-mode: screen;
}

.vignette {
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 22%, transparent 36%, rgba(0, 10, 22, 0.28) 100%),
    linear-gradient(180deg, transparent 0%, transparent 46%, rgba(2, 8, 18, 0.55) 78%, rgba(2, 8, 18, 0.82) 100%);
}

.fx {
  z-index: 8;
}

.flash {
  z-index: 40;
  background: #fff;
  opacity: 0;
}

.flash.is-on {
  animation: boltFlash 0.45s ease-out;
}

.loader {
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 16px;
  background: rgba(4, 8, 20, 0.88);
  pointer-events: auto;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader p {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-2);
  text-align: center;
}

.loader-bolt {
  width: 42px;
  height: 64px;
  margin: 0 auto;
  background: linear-gradient(180deg, #fff 0%, #7ad7ff 40%, #3af 100%);
  clip-path: polygon(55% 0, 18% 52%, 46% 52%, 30% 100%, 82% 42%, 52% 42%);
  filter: drop-shadow(0 0 12px #5cf);
  animation: boltFlicker 0.7s ease-in-out infinite;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(14px + env(safe-area-inset-bottom));
}

.screen.is-active {
  display: flex;
}

.screen[hidden] {
  display: none !important;
}

.headline {
  text-align: center;
  width: 100%;
  flex: 0 0 auto;
}

.headline__lead {
  font-size: clamp(16px, 4.6vw, 21px);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.headline__prize {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: clamp(26px, 7.2vw, 34px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--green);
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    0 0 18px rgba(45, 255, 58, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.8);
  animation: prizeGlow 2.2s ease-in-out infinite;
}

.hero {
  position: relative;
  width: 100%;
  height: min(32vh, 250px);
  margin-top: -4px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  z-index: 3;
}

.hero__aura {
  position: absolute;
  width: 78%;
  height: 90%;
  left: 11%;
  top: 4%;
  background:
    radial-gradient(circle at 50% 42%, rgba(80, 230, 255, 0.5) 0%, rgba(255, 196, 90, 0.16) 38%, transparent 70%);
  filter: blur(16px);
  animation: auraPulse 3.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

.hero__bust {
  position: relative;
  z-index: 1;
  width: min(78%, 300px);
  height: 100%;
  object-fit: cover;
  object-position: center 8%;
  -webkit-mask-image: radial-gradient(ellipse 64% 80% at 50% 38%, #000 46%, transparent 78%);
  mask-image: radial-gradient(ellipse 64% 80% at 50% 38%, #000 46%, transparent 78%);
  filter:
    drop-shadow(0 0 16px rgba(70, 220, 255, 0.45))
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
  animation: bustGlow 2.8s ease-in-out infinite;
}

.hero__spark {
  position: absolute;
  right: 2%;
  top: 18%;
  width: 42px;
  height: 64px;
  fill: #bfefff;
  filter: drop-shadow(0 0 8px #6cf);
  animation: boltFlicker 0.85s ease-in-out infinite;
}

.machine {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-height: calc(var(--cell) * 3 + 28px);
}

.machine__frame {
  position: relative;
  width: 100%;
  height: calc(var(--cell) * 3);
  border-radius: var(--radius-frame);
  padding: 8px;
  background:
    linear-gradient(180deg, #f6d36a 0%, #b8862a 48%, #7a5410 100%);
  box-shadow:
    0 0 0 2px #3a2308,
    0 12px 28px rgba(0, 0, 0, 0.45),
    0 0 32px rgba(240, 197, 74, 0.22);
}

.machine__frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--radius-frame) - 8px);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 3;
}

.reels {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  height: 100%;
  overflow: hidden;
  border-radius: calc(var(--radius-frame) - 8px);
  background:
    radial-gradient(ellipse at center, #15408a 0%, var(--slot) 58%, var(--slot-deep) 100%);
}

.reel {
  overflow: hidden;
  height: 100%;
}

.reel-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.cell {
  height: var(--cell);
  display: grid;
  place-items: center;
  flex: 0 0 var(--cell);
  padding: 4px;
}

.cell img {
  width: 88%;
  height: 88%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.reels-grid {
  position: absolute;
  inset: 8px;
  border-radius: calc(var(--radius-frame) - 8px);
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(to right, transparent calc(33.333% - 1px), rgba(230, 190, 90, 0.45) calc(33.333% - 1px), rgba(230, 190, 90, 0.45) calc(33.333% + 1px), transparent calc(33.333% + 1px)),
    linear-gradient(to right, transparent calc(66.666% - 1px), rgba(230, 190, 90, 0.45) calc(66.666% - 1px), rgba(230, 190, 90, 0.45) calc(66.666% + 1px), transparent calc(66.666% + 1px)),
    linear-gradient(to bottom, transparent calc(33.333% - 1px), rgba(230, 190, 90, 0.32) calc(33.333% - 1px), rgba(230, 190, 90, 0.32) calc(33.333% + 1px), transparent calc(33.333% + 1px)),
    linear-gradient(to bottom, transparent calc(66.666% - 1px), rgba(230, 190, 90, 0.32) calc(66.666% - 1px), rgba(230, 190, 90, 0.32) calc(66.666% + 1px), transparent calc(66.666% + 1px));
}

.machine.is-spinning {
  animation: machineShake 0.18s linear infinite;
}

.machine.is-win .cell img {
  animation: symbolPop 0.55s ease;
}

.spin-btn {
  position: relative;
  width: min(100%, 380px);
  height: 54px;
  margin-top: 12px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  isolation: isolate;
  touch-action: manipulation;
  filter: drop-shadow(0 8px 14px rgba(120, 0, 10, 0.45));
}

.spin-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, #ff4d5c 0%, var(--red) 38%, var(--red-dark) 100%);
  clip-path: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.spin-btn::after {
  content: "";
  position: absolute;
  inset: 2px 18px;
  z-index: 1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.28) 50%, transparent 65%);
  transform: translateX(-130%);
  animation: btnShine 2.8s ease-in-out infinite;
  pointer-events: none;
}

.spin-btn__label {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: #ffcc33;
  text-shadow: 0 2px 0 #7a3b00, 0 0 12px rgba(255, 180, 0, 0.35);
}

.spin-btn__gem {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 18px;
  height: 18px;
  transform: translateY(-50%) rotate(45deg);
  background: linear-gradient(135deg, #fff 0%, #9ad7ff 42%, #3a6adf 100%);
  border: 1px solid #e8f6ff;
  box-shadow: 0 0 10px rgba(140, 210, 255, 0.8);
}

.spin-btn__gem--l { left: 10px; }
.spin-btn__gem--r { right: 10px; }

.spin-btn:hover::before {
  filter: brightness(1.08);
}

.spin-btn:active {
  transform: translateY(1px) scale(0.985);
}

.spin-btn:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

.spin-btn:disabled {
  cursor: default;
  opacity: 0.72;
}

.spin-btn:not(:disabled) {
  animation: btnPulse 1.8s ease-in-out infinite;
}

a.spin-btn {
  text-decoration: none;
  color: inherit;
}

.screen--win {
  justify-content: flex-start;
}

.win-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 8vw, 34px);
  font-weight: 800;
  text-transform: uppercase;
  color: var(--green);
  text-align: center;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 18px rgba(45, 255, 58, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.8);
  animation: prizeGlow 2s ease-in-out infinite;
}

.win-hero {
  position: relative;
  width: min(100%, 420px);
  flex: 1 1 auto;
  min-height: 240px;
  margin-top: -8px;
  background: transparent;
  overflow: visible;
}

.win-hero__img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center 8%;
  background: transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  filter:
    drop-shadow(0 0 18px rgba(70, 220, 255, 0.4))
    drop-shadow(0 12px 22px rgba(0, 0, 0, 0.35));
  animation: bustGlow 2.8s ease-in-out infinite;
}

.win-hero__glow {
  position: absolute;
  z-index: 0;
  inset: 8% 6% 16%;
  background:
    radial-gradient(circle at 50% 42%, rgba(70, 230, 255, 0.32), transparent 58%),
    radial-gradient(circle at 62% 38%, rgba(255, 200, 90, 0.12), transparent 48%);
  pointer-events: none;
  animation: auraPulse 2.4s ease-in-out infinite;
}

.win-card {
  width: 100%;
  margin-top: -12px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  text-align: center;
  background: linear-gradient(180deg, #141b2e 0%, #0b1020 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.win-card__kicker,
.win-card__note {
  font-size: 18px;
  font-weight: 700;
}

.win-card__value {
  margin: 4px 0 2px;
  font-family: var(--font-display);
  font-size: clamp(34px, 10vw, 44px);
  font-weight: 800;
  color: var(--green);
  text-shadow: 0 0 18px rgba(45, 255, 58, 0.4);
}

.screen--win .spin-btn {
  margin-top: 14px;
  opacity: 0;
  animation: claimIn 0.5s ease 0.4s forwards, btnPulse 1.8s ease-in-out 0.9s infinite;
}

@keyframes claimIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes prizeGlow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@keyframes bustGlow {
  0%, 100% {
    filter:
      drop-shadow(0 0 12px rgba(70, 220, 255, 0.35))
      drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
  }
  50% {
    filter:
      drop-shadow(0 0 26px rgba(90, 250, 255, 0.75))
      drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
  }
}

@keyframes auraPulse {
  0%, 100% { opacity: 0.7; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.06); }
}

@keyframes raysSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(18deg); }
}

@keyframes causticShift {
  from { transform: translate3d(-2%, 0, 0) scale(1); opacity: 0.7; }
  to { transform: translate3d(4%, 3%, 0) scale(1.08); opacity: 1; }
}

@keyframes palaceDrift {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(0, -1.4%, 0); }
}

@keyframes bubbleRise {
  0% { transform: translate3d(0, 40px, 0) scale(0.6); opacity: 0; }
  12% { opacity: 0.55; }
  100% { transform: translate3d(12px, -420px, 0) scale(1.1); opacity: 0; }
}

@keyframes boltFlicker {
  0%, 100% { opacity: 1; transform: scale(1); }
  40% { opacity: 0.55; transform: scale(0.92) translateY(2px); }
  70% { opacity: 1; transform: scale(1.08); }
}

@keyframes skyPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

@keyframes btnShine {
  0%, 58%, 100% { transform: translateX(-130%); }
  78% { transform: translateX(130%); }
}

@keyframes btnPulse {
  0%, 100% { filter: drop-shadow(0 8px 14px rgba(120, 0, 10, 0.45)); }
  50% { filter: drop-shadow(0 8px 18px rgba(255, 40, 50, 0.55)); }
}

@keyframes machineShake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, 0); }
}

@keyframes symbolPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes boltFlash {
  0% { opacity: 0.92; }
  100% { opacity: 0; }
}

@media (min-height: 780px) {
  :root { --cell: 82px; }
  .hero { height: 240px; }
}

@media (max-height: 700px) {
  :root { --cell: 64px; }
  .hero { height: 148px; }
  .headline__prize { font-size: 26px; }
  .spin-btn { height: 48px; margin-top: 10px; }
  .spin-btn__label { font-size: 18px; }
}

@media (min-width: 760px) {
  .phone {
    height: min(100dvh, 920px);
    border-radius: 28px;
    box-shadow:
      0 0 0 1px rgba(240, 197, 74, 0.2),
      0 24px 80px rgba(0, 0, 0, 0.55);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sky,
  .hero__bust,
  .hero__spark,
  .hero__aura,
  .world__rays,
  .world__caustics,
  .world__palace,
  .world__bubbles span,
  .headline__prize,
  .win-title,
  .win-hero__img,
  .spin-btn:not(:disabled),
  .screen--win .spin-btn,
  .spin-btn::after,
  .loader-bolt {
    animation: none;
  }
}
