* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; font-family: -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  color: #fff; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 50% 10%, #5a2a10, #2a1500 70%);
  overflow-x: hidden;
}
body { display: flex; align-items: center; justify-content: center; padding: 14px; min-height: 100%; }

:root { --cell: 70px; --reelgap: 6px; }

#machine {
  width: min(96vw, 460px);
  background: linear-gradient(180deg, #f6d365 0%, #c98f1c 30%, #8a5a10 100%);
  border-radius: 26px; padding: 16px 16px 20px;
  box-shadow: 0 14px 40px rgba(0,0,0,.6), inset 0 2px 6px rgba(255,255,255,.5), inset 0 -6px 14px rgba(0,0,0,.35);
  border: 3px solid #5e3c08;
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.brand { font-size: 34px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.led {
  background: #1a0a00; border: 2px solid #3a1d00; border-radius: 10px;
  padding: 6px 12px; min-width: 108px; text-align: center;
  box-shadow: inset 0 0 10px rgba(255,80,0,.4);
}
.led span { display: block; font-size: 11px; color: #ff9a5a; letter-spacing: .5px; }
.led b { font-size: 21px; color: #ff4d2e; font-family: "Courier New", monospace; text-shadow: 0 0 8px rgba(255,60,20,.8); }
.led.win b { color: #4dff7a; text-shadow: 0 0 8px rgba(40,255,90,.8); }

.case {
  position: relative;
  background: linear-gradient(180deg, #2a1700, #120a00);
  border-radius: 16px; padding: 14px; border: 3px solid #5e3c08;
  box-shadow: inset 0 0 18px rgba(0,0,0,.7);
}
.reels { display: flex; gap: var(--reelgap); justify-content: center; }
.reel {
  width: var(--cell); height: calc(var(--cell) * 3);
  overflow: hidden; border-radius: 8px;
  background: linear-gradient(180deg, #fff, #e9e9ef);
  box-shadow: inset 0 8px 10px rgba(0,0,0,.25), inset 0 -8px 10px rgba(0,0,0,.25);
  position: relative;
}
.strip { display: flex; flex-direction: column; will-change: transform; }
.cell {
  height: var(--cell); display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cell) * 0.52);
}
.cell .sym-bar {
  font-weight: 900; font-size: calc(var(--cell) * 0.3); color: #fff;
  background: linear-gradient(180deg,#e23b3b,#9d1f1f); padding: 4px 8px; border-radius: 6px;
  border: 2px solid #fff; letter-spacing: 1px;
}
.cell .sym-img { width: calc(var(--cell) * 0.82); height: calc(var(--cell) * 0.82); border-radius: 50%; object-fit: cover; border: 2px solid #d4af37; }
/* payline highlight across the middle row */
.payline {
  position: absolute; left: 10px; right: 10px; top: 50%; height: calc(var(--cell));
  transform: translateY(-50%); border: 3px solid rgba(255,215,0,.0);
  border-radius: 8px; pointer-events: none; transition: border-color .2s;
}
.case.win .payline { border-color: rgba(255,215,0,.9); box-shadow: 0 0 18px rgba(255,215,0,.6); }

.lever {
  position: absolute; right: -6px; top: 8px; bottom: 8px; width: 18px; border: none;
  background: transparent; cursor: pointer;
}
.lever .stick { position: absolute; left: 6px; top: 30%; bottom: 0; width: 7px; background: linear-gradient(90deg,#888,#ddd,#888); border-radius: 4px; }
.lever .ball { position: absolute; left: -3px; top: 18%; width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ff8a8a, #c30000); box-shadow: 0 2px 4px rgba(0,0,0,.5); transition: top .15s; }
.lever.pulled .ball { top: 40%; }

.bonuswrap { display: flex; align-items: center; gap: 8px; margin: 14px 2px 4px; }
.bonuswrap .bl { font-size: 13px; font-weight: 800; color: #3a1d00; white-space: nowrap; }
.bonuswrap .bt { font-size: 13px; font-weight: 800; color: #3a1d00; min-width: 42px; }
.bonusbar { flex: 1; height: 16px; background: rgba(0,0,0,.35); border-radius: 10px; overflow: hidden; border: 2px solid #5e3c08; }
#bonusFill { height: 100%; width: 0%; border-radius: 8px; background: linear-gradient(90deg,#ffd24d,#ff7a00); transition: width .35s; }

.controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.betbtn {
  width: 50px; height: 50px; border-radius: 50%; font-size: 28px; font-weight: 900;
  border: 3px solid #fff; color: #3a1d00; background: linear-gradient(180deg,#ffe9a8,#e0b54e);
  box-shadow: 0 4px 0 #8a5a10; cursor: pointer;
}
.betbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #8a5a10; }
.betbox { background: #1a0a00; border: 2px solid #3a1d00; border-radius: 10px; padding: 5px 10px; text-align: center; min-width: 96px; }
.betbox span { display: block; font-size: 11px; color: #ff9a5a; }
.betbox b { font-size: 19px; color: #ffd24d; font-family: "Courier New", monospace; }
.spinbtn {
  flex: 1; height: 54px; border-radius: 14px; font-size: 22px; font-weight: 900; letter-spacing: 1px;
  border: 3px solid #fff; color: #fff; background: linear-gradient(180deg,#ff5b5b,#c30000);
  box-shadow: 0 5px 0 #7d0000; cursor: pointer;
}
.spinbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 #7d0000; }
.spinbtn:disabled { filter: grayscale(.5) brightness(.8); }

#msg { text-align: center; min-height: 24px; margin-top: 10px; font-weight: 800; font-size: 17px; color: #fff5d6; text-shadow: 0 1px 2px #000; }
#msg.win { color: #b6ffce; }
#msg.jackpot { color: #ffe35c; font-size: 20px; animation: pulse .5s ease-in-out 3; }
@keyframes pulse { 50% { transform: scale(1.12); } }

.home { display: inline-block; margin-top: 12px; color: #3a1d00; font-weight: 800; font-size: 14px; text-decoration: none; opacity: .85; }

/* overlays */
.ov {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center;
  background: rgba(10,5,0,.92);
}
.ov.hidden { display: none; }
.hidden { display: none !important; }
.ov .spinbtn { flex: 0 0 auto; width: min(82%, 300px); }
.ov h2 { font-size: 32px; text-shadow: 0 0 18px rgba(255,200,60,.6); }
.ov p { font-size: 16px; opacity: .92; max-width: 340px; }
.boxes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; width: min(90%, 340px); }
.box {
  aspect-ratio: 1; border-radius: 16px; font-size: 44px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg,#7b4dff,#3a1d9e); border: 3px solid #fff;
  box-shadow: 0 6px 0 #25116b; transition: transform .1s;
}
.box:active { transform: scale(.95); }
.box.opened { background: linear-gradient(180deg,#ffd24d,#e0a000); color: #3a1d00; font-weight: 900; font-size: 22px; box-shadow: 0 6px 0 #8a5a10; cursor: default; }
.box.dim { opacity: .5; }
.bres { font-size: 22px; font-weight: 900; color: #ffe35c; min-height: 28px; }
