* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: #000000;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  user-select: none;
  overscroll-behavior: none;
}

.stage {
  width: 100vw;
  height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, #000000 0%, #000000 70%);
}

@supports (height: 100svh) {
  .stage {
    height: 100svh;
  }

  .machine {
    width: min(100vw, calc(100svh * 16 / 9));
    max-height: 100svh;
  }
}

.machine {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  max-height: 100dvh;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.machine-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Reel overlay */
.reel-stage {
  position: absolute;
  left: 15.1%;
  top: 18.4%;
  width: 70.8%;
  height: 61.7%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.9%;
  overflow: hidden;
  pointer-events: none;
  padding: 1.0% 1.1% 1.1%;
}

.reel-col {
  position: relative;
  overflow: hidden;
  border-radius: 30% / 8%;
}

/* Motion blur */
.reel-col.motion-blur.spinning .reel-strip {
  filter: blur(var(--reel-blur, 1.15px));
  transition: filter 220ms ease-out;
}

.reel-col.motion-blur.stopping .reel-strip {
  filter: blur(0);
}

/* ✅ FIXED SYMBOL SYSTEM */
.symbol {
  position: absolute;
  left: 50%;
  width: 75%;
  height: 34.6%;

  /* 🔥 master scale control */
  --symbol-scale: 1.08;

  transform: translateX(-50%) scale(var(--symbol-scale));

  object-fit: contain;
  filter: drop-shadow(0 5px 5px rgba(0,0,0,.45));
  transition: transform .18s ease, filter .18s ease;
}

/* Win animation (preserves scale) */
.symbol.win {
  animation: pulseWin .65s ease-in-out 0s 5;
  z-index: 5;
}

@keyframes pulseWin {
  0%, 100% {
    transform: translateX(-50%) scale(var(--symbol-scale));
    filter: drop-shadow(0 5px 5px rgba(0,0,0,.45));
  }
  50% {
    transform: translateX(-50%) scale(calc(var(--symbol-scale) * 1.12));
    filter: drop-shadow(0 0 18px rgba(255,230,70,.95));
  }
}

/* Readouts */
.readout {
  position: absolute;
  height: 5.2%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0290E9;
  font-weight: 900;
  font-size: clamp(12px, 2.35vw, 30px);
  text-shadow: 0 2px 3px #000;
  pointer-events: none;
}

.balance-readout {
  left: 13.0%;
  top: 87.4%;
  width: 12.8%;
}

.win-readout {
  left: 45.1%;
  top: 87.4%;
  width: 8.8%;
}

.bet-readout {
  left: 62.9%;
  top: 87.4%;
  width: 7.8%;
}

/* Free spins */
.free-readout {
  position: absolute;
  left: 38%;
  top: 10.9%;
  width: 24%;
  height: 4%;
  display: none;
  align-items: center;
  justify-content: center;
  color: #fff36b;
  font-size: clamp(12px, 2vw, 24px);
  font-weight: 900;
  text-shadow: 0 2px 5px #000, 0 0 10px #ff7b00;
  pointer-events: none;
}

.free-readout.active {
  display: flex;
}

/* Buttons */
.hotspot {
  position: absolute;
  border: 0;
  background: rgba(255,255,255,0);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.hotspot:active {
  transform: scale(.98);
}

.btn-balance { left: 7.0%; top: 86.6%; width: 8.0%; height: 5.8%; }
.btn-max     { left: 28.0%; top: 86.4%; width: 12.0%; height: 5.8%; }
.btn-minus   { left: 59.0%; top: 86.4%; width: 4.0%;  height: 5.5%; }
.btn-plus    { left: 71.3%; top: 86.4%; width: 4.0%;  height: 5.5%; }
.btn-spin    { left: 77.1%; top: 86.4%; width: 17.0%; height: 5.8%; }

/* Popup */
.popup {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.55);
  z-index: 20;
}

.popup.hidden {
  display: none;
}

.popup-card {
  width: min(72%, 620px);
  padding: 28px 32px;
  border-radius: 24px;
  border: 3px solid #ffc43b;
  background: linear-gradient(#39140b, #120806);
  box-shadow: 0 0 35px rgba(255,190,40,.65), inset 0 0 22px rgba(255,255,255,.08);
  text-align: center;
  color: white;
}

.popup-card h2 {
  margin: 0 0 10px;
  color: #ffe76d;
  font-size: clamp(28px, 5vw, 64px);
  text-shadow: 0 3px 0 #6b2800, 0 0 18px #ff8c00;
}

.popup-card p {
  margin: 0 0 22px;
  font-size: clamp(16px, 2vw, 28px);
  font-weight: 700;
}

.popup-card button {
  border: 0;
  border-radius: 14px;
  padding: 12px 36px;
  color: white;
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 900;
  background: linear-gradient(#37e340, #0a8d18);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 5px 0 #064d0e;
  cursor: pointer;
}

/* Mobile rotation */
@media (orientation: portrait) {
  body {
    background: #ffffff;
  }

  .stage {
    transform: rotate(90deg);
    transform-origin: center;
    width: 100dvh;
    height: 100vw;
    position: fixed;
    left: calc((100vw - 100dvh) / 2);
    top: calc((100dvh - 100vw) / 2);
  }

  .machine {
    width: min(100dvh, calc(100vw * 16 / 9));
    max-height: 100vw;
  }
}

@media (orientation: landscape) {
  .stage {
    height: 100dvh !important;
  }

  .machine {
    width: min(100vw, calc(100dvh * 16 / 9)) !important;
    max-height: 100dvh !important;
  }
}