:root {
  --bg: #12041f;
  --panel: #2a0a45;
  --gold: #ffd23f;
  --gold-dark: #b8860b;
  --red: #e61e4d;
  --red-dark: #8f0f30;
  --cyan: #38e8ff;
  --ink: #fff7e0;
  --reel-h: 120px;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #3d0f66 0%, var(--bg) 65%) fixed;
  display: flex; justify-content: center; padding: 16px;
}
.cabinet {
  width: min(760px, 100%); padding: 16px; align-self: flex-start;
  background: linear-gradient(180deg, #4a1275, var(--panel));
  border: 4px solid var(--gold); border-radius: 24px;
  box-shadow: 0 0 0 4px var(--gold-dark), 0 0 40px rgba(255, 210, 63, .35), inset 0 0 30px rgba(0,0,0,.5);
}

.marquee { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
.marquee h1 {
  margin: 0 8px; font-size: clamp(1.5rem, 6vw, 2.6rem); letter-spacing: .12em; font-style: italic;
  color: var(--gold); text-shadow: 0 0 12px rgba(255,210,63,.8), 0 3px 0 var(--gold-dark); white-space: nowrap;
}
.marquee em { color: var(--red); text-shadow: 0 0 12px rgba(230,30,77,.9), 0 3px 0 var(--red-dark); }
.bulb { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: chase 1s infinite steps(1); }
.bulb:nth-child(odd) { animation-delay: .5s; }
.fast .bulb { animation-duration: .2s; }
.win .bulb { animation-duration: .12s; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
@keyframes chase { 0% { opacity: 1; } 50% { opacity: .2; } }

.displays { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 8px; margin-bottom: 12px; }
.display { background: #000; border: 2px solid var(--gold-dark); border-radius: 10px; padding: 6px 8px; text-align: center; }
.dlabel { font-size: .65rem; letter-spacing: .15em; color: var(--gold); opacity: .8; }
.dvalue { font: 700 1.8rem "Courier New", monospace; color: var(--red); text-shadow: 0 0 8px var(--red); min-height: 2.2rem; display: flex; align-items: center; justify-content: center; }
.dvalue.small { font-size: 1rem; line-height: 1.1; }
.jackpot .dvalue { color: var(--cyan); text-shadow: 0 0 8px var(--cyan); }

.window { background: #000; border: 4px solid var(--gold); border-radius: 16px; padding: 10px; box-shadow: inset 0 0 20px rgba(255,210,63,.4); }
.reels { position: relative; display: grid; grid-template-columns: 1.4fr 1.4fr 1fr; gap: 8px; }
.reel-title { text-align: center; font-size: .7rem; letter-spacing: .2em; color: var(--gold); margin-bottom: 4px; }
.reel {
  height: var(--reel-h); overflow: hidden; border-radius: 10px; position: relative;
  background: #fff;
}
.reel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.45), transparent 30%, transparent 70%, rgba(0,0,0,.45));
}
.strip { will-change: transform; }
.cell {
  height: var(--reel-h); display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 6px; font-weight: 800; font-size: clamp(1rem, 3.6vw, 1.6rem); line-height: 1.1; color: #2a0a45; overflow-wrap: anywhere;
}
.cell.value { color: var(--red-dark); font-size: clamp(1.2rem, 4.4vw, 2rem); }
.cell.prize { color: #0a5a6b; }
.reel.landed { animation: pop .4s ease-out; }
@keyframes pop { 50% { transform: scale(1.05); } }

.banner { margin-top: 10px; text-align: center; min-height: 2.4rem; font-size: 1.15rem; font-weight: 800; color: var(--gold); text-shadow: 0 0 8px rgba(255,210,63,.7); display: flex; align-items: center; justify-content: center; }
.banner.win { color: var(--cyan); text-shadow: 0 0 12px var(--cyan); animation: flash .35s infinite alternate; }
@keyframes flash { to { opacity: .55; } }

.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 16px 0; }
.btn {
  font: 800 .9rem "Trebuchet MS", sans-serif; letter-spacing: .12em; cursor: pointer; color: #fff;
  border: 3px solid var(--gold); border-radius: 12px; padding: 10px 16px;
  background: linear-gradient(180deg, #6a1fa3, #3b0f63); box-shadow: 0 4px 0 #1d0633; transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #1d0633; }
.btn:disabled { filter: grayscale(.9) brightness(.55); cursor: not-allowed; }
.btn.spin {
  font-size: 1.8rem; padding: 18px 44px; border-radius: 50px;
  background: radial-gradient(circle at 50% 30%, #ff6b8e, var(--red) 55%, var(--red-dark)); box-shadow: 0 6px 0 #4a0618, 0 0 24px rgba(230,30,77,.6);
}
.btn.spin:not(:disabled) { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 6px 0 #4a0618, 0 0 40px rgba(255,80,120,.95); } }
.btn:focus-visible, summary:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

.paytable { background: #000a; border: 2px solid var(--gold-dark); border-radius: 12px; padding: 10px; }
.pt-head { display: flex; justify-content: space-between; align-items: center; }
.pt-head h2 { margin: 0; font-size: 1rem; letter-spacing: .2em; color: var(--gold); }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: .9rem; }
th, td { text-align: left; padding: 5px 8px; border-bottom: 1px solid #ffffff22; }
th { color: var(--gold); font-size: .75rem; letter-spacing: .1em; }
td:last-child, th:last-child { text-align: right; font-family: "Courier New", monospace; }
tbody tr:last-child { background: #ffd23f22; }
.empty { text-align: center; opacity: .6; margin: 10px 0 2px; }
.empty[hidden] { display: none; }

.service { margin-top: 12px; }
.service summary { cursor: pointer; opacity: .75; font-size: .85rem; letter-spacing: .1em; }
.service-body { padding: 10px 0; display: grid; gap: 10px; justify-items: start; }
.hint { margin: 0; font-size: .8rem; opacity: .75; }
code { background: #0006; padding: 1px 5px; border-radius: 4px; color: var(--cyan); }
.file { display: grid; gap: 4px; font-size: .85rem; }

.modal { position: fixed; inset: 0; background: #000b; display: flex; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--panel); border: 4px solid var(--gold); border-radius: 18px; padding: 22px; max-width: 420px; text-align: center; box-shadow: 0 0 40px rgba(255,210,63,.5); }
.modal-card h3 { margin: 0 0 8px; color: var(--cyan); letter-spacing: .2em; text-shadow: 0 0 10px var(--cyan); }
.modal-card p { white-space: pre-line; line-height: 1.5; }
.modal-actions { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.modal-actions .btn.spin { font-size: 1.1rem; padding: 12px 24px; }

.coins { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.coin { position: absolute; top: -40px; font-size: 28px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

.cabinet.shake { animation: shake .5s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

@media (max-width: 520px) {
  :root { --reel-h: 96px; }
  .btn.spin { padding: 14px 30px; font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  .bulb, .btn.spin, .banner.win, .cabinet.shake, .reel.landed { animation: none !important; }
}
