:root {
  color-scheme: dark;
  --symbol-h: 132px;
  --lever-room: 64px;
  --gold: #e4c57a;
  --gold-deep: #8d6a2f;
  --ink: #f4e7c8;
  --face: Didot, "Bodoni MT", "Didot LT STD", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(228, 197, 122, 0.09), transparent 55%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(228, 197, 122, 0.05), transparent 60%),
    #050504;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

button {
  font: inherit;
  color: inherit;
  padding: 0;
}

.stage {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px 16px 32px;
}

.intro {
  max-width: 100%;
  min-width: 0;
  text-align: center;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #b08948;
}

h1 {
  margin: 0;
  font-family: var(--face);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.machine {
  position: relative;
  width: min(420px, calc(100vw - 86px));
  min-width: 0;
  user-select: none;
  -webkit-user-select: none;
}

.machine::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 0;
  bottom: -18px;
  height: 24px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.7), transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.cabinet {
  position: relative;
  padding: 8px 14px 12px;
  border-radius: 168px 168px 18px 18px;
  background:
    linear-gradient(180deg, rgba(228, 197, 122, 0.16), transparent 22%),
    linear-gradient(90deg, #050505 0%, #16140f 42%, #0c0b09 72%, #050505 100%);
  border: 1px solid rgba(228, 197, 122, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 232, 180, 0.28),
    inset 0 -18px 28px rgba(0, 0, 0, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.55);
}

.arch {
  position: relative;
  height: 42px;
  margin: 2px 18px 0;
}

.bulb {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #fff6d4, #e4c57a 46%, #8d6a2f 80%);
  box-shadow:
    0 0 8px 2px rgba(228, 197, 122, 0.45),
    inset 0 -1px 1px rgba(60, 40, 0, 0.45);
  animation: bulbPulse 2.4s ease-in-out infinite;
}

.arch .bulb {
  position: absolute;
  transform: translate(-50%, -50%);
}

.light-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 16px 6px;
}

.vlights {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 0;
}

@keyframes bulbPulse {
  0%, 100% {
    filter: brightness(0.55);
    box-shadow: 0 0 2px rgba(255, 180, 40, 0.25);
  }
  45% {
    filter: brightness(1.2);
    box-shadow: 0 0 8px 3px rgba(255, 214, 90, 0.95);
  }
}

.machine.is-jackpot .bulb {
  animation-duration: 0.22s;
}

.marquee {
  container-type: inline-size;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  gap: 10px;
  margin: 0 10px;
  padding: 16px 10px 14px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(228, 197, 122, 0.16), transparent 58%),
    linear-gradient(180deg, #1a1712, #070706);
  border: 1px solid var(--gold);
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 1px rgba(228, 197, 122, 0.25),
    0 0 22px rgba(228, 197, 122, 0.12);
}

.star {
  color: var(--gold);
  font-size: 13px;
  text-shadow: 0 0 8px rgba(228, 197, 122, 0.7);
}

.marquee-title {
  font-family: var(--face);
  font-size: clamp(26px, 7.4vw, 38px);
  line-height: 1;
  letter-spacing: 0.14em;
  white-space: nowrap;
  min-width: 0;
  color: #f6e7bc;
  text-shadow: 0 0 16px rgba(228, 197, 122, 0.45);
}

.marquee-title.is-jackpot {
  animation: jackflash 0.28s steps(2, end) infinite;
}

@keyframes jackflash {
  50% { color: #fff8e8; }
}

.window-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.window {
  flex: 1;
  min-width: 0;
  padding: 8px;
  border-radius: 12px;
  background: #070706;
  box-shadow:
    inset 0 0 0 1px var(--gold),
    inset 0 0 28px rgba(0, 0, 0, 0.65);
}

.reels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.reel {
  position: relative;
  height: var(--symbol-h);
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #1c1914, #0a0908 46%, #14120e);
  box-shadow:
    inset 0 0 0 1px rgba(228, 197, 122, 0.7),
    inset 0 14px 16px rgba(0, 0, 0, 0.45);
}

.reel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 226, 170, 0.1), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.4));
}

.reel.is-spinning .symbol-art {
  filter: blur(0.4px);
}

.reel.just-stopped {
  animation: reelpop 0.22s ease-out;
}

@keyframes reelpop {
  0% { transform: scaleY(0.97); }
  55% { transform: scaleY(1.025); }
  100% { transform: none; }
}

.reel.is-hot {
  background: linear-gradient(180deg, #3a3018, #1a150c 55%, #2a230f);
  box-shadow:
    inset 0 0 0 1px #f3e0a6,
    0 0 18px rgba(228, 197, 122, 0.55);
}

.reel-strip { will-change: transform; }

.symbol {
  height: var(--symbol-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 2px 6px;
}

.symbol-art {
  width: 72px;
  height: 72px;
  color: var(--gold);
}

.symbol-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.symbol-name {
  font-family: var(--face);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #f0ddb0;
  line-height: 1;
}

.readout {
  margin: 4px 8px 0;
  padding: 8px 10px 10px;
  min-height: 96px;
  text-align: center;
  border-radius: 12px;
  border: 1px solid rgba(228, 197, 122, 0.7);
  background: linear-gradient(180deg, #14110c, #070605);
  box-shadow: inset 0 0 0 1px rgba(228, 197, 122, 0.15);
}

.readout-kicker {
  margin: 0;
  color: #f0c14a;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.readout-name {
  margin: 2px 0 0;
  color: #f8edd2;
  font-family: var(--face);
  font-weight: 400;
  font-size: clamp(26px, 7vw, 34px);
  line-height: 1.05;
  letter-spacing: 0.04em;
}

.readout-name.pop {
  animation: pop 0.34s cubic-bezier(0.2, 1.35, 0.4, 1);
}

@keyframes pop {
  from { transform: scale(0.86); opacity: 0.35; }
  to { transform: none; opacity: 1; }
}

.readout-line {
  margin: 3px 0 0;
  min-height: 2.5em;
  color: #e7c98a;
  font-size: 14px;
  line-height: 1.25;
}

.readout.is-jackpot .readout-name { color: #ffe08a; }

.base {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% + 28px);
  margin: 8px 0 0 -14px;
  padding: 12px 14px 14px;
  border-radius: 10px 10px 26px 26px;
  background: linear-gradient(180deg, #1a1712, #050504);
  border: 1px solid rgba(228, 197, 122, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 230, 180, 0.16),
    0 8px 0 #000,
    0 16px 24px rgba(0, 0, 0, 0.55);
}

.gold-btn {
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #f6e7bc;
  background: radial-gradient(circle at 35% 30%, #fff4cc, #e4c57a 42%, #8a6428 78%);
  box-shadow:
    0 3px 0 #3a2c10,
    inset 0 -3px 5px rgba(60, 40, 0, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.7);
  color: #4a3410;
}

.gold-btn-sm { width: 36px; height: 36px; }

.gold-btn-lg {
  width: 64px;
  height: 64px;
  margin-left: auto;
  border-width: 4px;
}

.gold-btn:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 #3a2c10,
    inset 0 -2px 4px rgba(60, 40, 0, 0.35);
}

button.gold-btn { cursor: pointer; }

button.gold-btn:disabled,
.lever:disabled { cursor: default; }

.gold-btn:focus-visible,
.lever:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.lever {
  position: absolute;
  z-index: 3;
  right: -52px;
  top: 118px;
  width: 72px;
  height: 158px;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: manipulation;
}

.lever:active { cursor: grabbing; }

.lever-arm {
  position: absolute;
  left: 6px;
  bottom: 16px;
  width: 36px;
  height: 136px;
  transform-origin: 16px 124px;
  transform: rotate(18deg);
  transition: transform 0.22s cubic-bezier(0.2, 0.85, 0.2, 1.15);
}

.lever.is-pulled .lever-arm {
  transform: rotate(64deg);
  transition-duration: 0.1s;
  transition-timing-function: ease-in;
}

.lever-rod {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: 13px;
  height: 108px;
  border-radius: 8px;
  background: linear-gradient(90deg, #6d5424, #f6e7bc 48%, #8d6a2f);
  box-shadow: inset -2px 0 2px rgba(0, 0, 0, 0.35);
}

.lever-knob {
  position: absolute;
  left: -2px;
  top: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #3c3830, #0c0b09 62%, #000);
  box-shadow:
    inset 0 0 0 2px #e4c57a,
    inset -4px -5px 6px rgba(0, 0, 0, 0.55),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

.lever-hinge {
  position: absolute;
  left: 2px;
  bottom: 12px;
  width: 36px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(180deg, #f6e7bc, #a8843c 55%, #5c4318);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 0 #2a1e0c;
}

.burst {
  position: absolute;
  inset: -20px 0 auto;
  height: 70%;
  pointer-events: none;
  overflow: visible;
  z-index: 4;
}

.bit {
  position: absolute;
  top: 42%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: fly 0.95s ease-out forwards;
}

@keyframes fly {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(220deg);
    opacity: 0;
  }
}

@media (max-width: 420px) {
  :root { --symbol-h: 112px; }

  h1 { font-size: 26px; }

  .symbol-art { width: 56px; height: 56px; }
  .symbol-name { font-size: 10px; letter-spacing: 0.1em; }
  .gold-btn-sm { width: 32px; height: 32px; }
  .gold-btn-lg { width: 54px; height: 54px; }
  .readout { min-height: 88px; }
  .readout-line { font-size: 13px; }
}

@media (max-width: 540px) {
  .stage {
    padding-left: 18px;
    padding-right: calc(8px + var(--lever-room));
  }

  .machine { width: min(420px, 100%); }

  .marquee {
    gap: 6px;
    margin-left: 8px;
    margin-right: 8px;
    padding: 12px 8px 10px;
  }

  .marquee-title {
    font-size: clamp(15px, 11cqw, 30px);
    letter-spacing: 0.04em;
  }

  .lever {
    top: 104px;
    right: calc(var(--lever-room) * -1 + 30px);
    height: 142px;
  }
}

@media (max-height: 760px) {
  :root { --symbol-h: 108px; }
  .stage { padding-top: 10px; gap: 6px; }
  .arch { height: 28px; }
  .marquee { padding: 10px 8px; }
  .readout { min-height: 82px; }
}

@media (prefers-reduced-motion: reduce) {
  .bulb,
  .marquee-title.is-jackpot,
  .reel.just-stopped,
  .readout-name.pop,
  .bit {
    animation: none;
  }

  .lever-arm { transition: none; }
}
