:root {
  --face-h: 90px;
  --gold: #f6c945;
  --red: #a3121f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #3a1010, #14060a 70%);
  font-family: Georgia, 'Times New Roman', serif;
  overflow: hidden;
}

#fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.machine {
  position: relative;
  z-index: 1;
}

/* ---------- Marquee ---------- */

.marquee {
  background: linear-gradient(#7d0e18, #4a060d);
  border: 6px solid var(--gold);
  border-radius: 18px 18px 6px 6px;
  padding: 14px 28px 18px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.marquee h1 {
  color: var(--gold);
  font-size: 2.2rem;
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px rgba(246, 201, 69, 0.8), 0 2px 0 #7a5a0a;
}

.bulbs {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.bulbs span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffe9a8;
  box-shadow: 0 0 8px 2px rgba(255, 233, 168, 0.9);
  animation: chase 1.2s infinite;
}

.bulbs span:nth-child(3n)   { animation-delay: 0s; }
.bulbs span:nth-child(3n+1) { animation-delay: 0.4s; }
.bulbs span:nth-child(3n+2) { animation-delay: 0.8s; }

@keyframes chase {
  0%, 25%   { opacity: 1; }
  50%, 75%  { opacity: 0.2; box-shadow: none; }
  100%      { opacity: 1; }
}

.machine.celebrate .bulbs span {
  animation-duration: 0.25s;
}

/* ---------- Cabinet & reels ---------- */

.cabinet {
  position: relative;
  background: linear-gradient(var(--red), #6e0a13);
  border: 6px solid var(--gold);
  border-top: none;
  border-radius: 0 0 22px 22px;
  padding: 30px 34px 34px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45), 0 18px 30px rgba(0, 0, 0, 0.6);
}

.reels {
  display: flex;
  gap: 14px;
  background: #1b1209;
  border: 4px solid #d8d8de;
  border-radius: 12px;
  padding: 12px;
  box-shadow: inset 0 6px 18px rgba(0, 0, 0, 0.8);
}

.reel-window {
  width: 124px;
  height: calc(var(--face-h) * 1.5);
  overflow: hidden;
  border-radius: 8px;
  background: #efe9da;
  position: relative;
  perspective: 800px;
}

/* Curved-glass shading over the drum. */
.reel-window::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    rgba(0, 0, 0, 0.55),
    transparent 30%,
    transparent 70%,
    rgba(0, 0, 0, 0.55)
  );
  pointer-events: none;
}

.drum {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.face {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: var(--face-h);
  margin-top: calc(var(--face-h) / -2);
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  background: linear-gradient(#fdf8ea, #d9cfb4);
  border-top: 1px solid #b9ad8d;
  color: #4a0a10;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 0.06em;
}

.face.cuck {
  background: linear-gradient(#2b2b2b, #000);
  color: #fff;
  letter-spacing: 0.14em;
}

.drum.blur .face {
  filter: blur(1.5px);
}

/* ---------- Mute button ---------- */

.mute {
  position: absolute;
  bottom: 8px;
  right: 12px;
  background: none;
  border: 2px solid var(--gold);
  border-radius: 8px;
  color: var(--gold);
  font-size: 1rem;
  padding: 3px 8px;
  cursor: pointer;
}

/* ---------- Lever ---------- */

.lever {
  position: absolute;
  right: -66px;
  top: 110px;
  width: 64px;
  height: 200px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  perspective: 500px;
}

.lever:disabled {
  cursor: default;
}

/* Chrome mounting bracket at the base. */
.lever::after {
  content: '';
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2f5f9, #9aa0a8 60%, #5c6168);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6);
}

.lever-arm {
  position: absolute;
  bottom: 26px;
  left: 50%;
  width: 12px;
  height: 140px;
  margin-left: -6px;
  border-radius: 6px;
  background: linear-gradient(90deg, #9aa0a8, #e8ecf2, #7f858d);
  transform-origin: 50% calc(100% - 6px);
  transition: transform 0.3s cubic-bezier(0.4, 2, 0.6, 1);
}

.lever.pulled .lever-arm {
  transform: rotateX(140deg);
}

.knob {
  position: absolute;
  top: -28px;
  left: 50%;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff7b6e, #c2151f 60%, #7c0a12);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* ---------- Banners ---------- */

.banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.banner span {
  display: none;
  padding: 24px 48px;
  border-radius: 16px;
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: bold;
  letter-spacing: 0.08em;
  text-align: center;
}

.banner.win span {
  display: block;
  color: var(--gold);
  background: rgba(20, 6, 10, 0.85);
  border: 4px solid var(--gold);
  text-shadow: 0 0 18px rgba(246, 201, 69, 0.95), 0 0 40px rgba(246, 201, 69, 0.6);
  animation: slam 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes slam {
  from { transform: scale(3); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.banner.lose span {
  display: block;
  color: #cfd3da;
  background: rgba(10, 10, 14, 0.85);
  border: 4px solid #555;
  animation: droop 2.2s ease-out forwards;
}

@keyframes droop {
  0%   { transform: translateY(-40vh) rotate(0deg); opacity: 0; }
  35%  { transform: translateY(0)     rotate(0deg); opacity: 1; }
  55%  { transform: translateY(6px)   rotate(-2deg); }
  75%  { transform: translateY(14px)  rotate(2.5deg); }
  100% { transform: translateY(26px)  rotate(-1.5deg); opacity: 1; }
}

/* ---------- Small screens ---------- */

/* The machine (incl. lever overhang) is ~580px wide; scale it down on
   phones so nothing is clipped by the body's overflow: hidden. */
@media (max-width: 640px) {
  .machine {
    transform: scale(0.6);
  }
}
