:root {
  --gold: #f4c542;
  --gold-deep: #b8860b;
  --red: #c0102a;
  --red-deep: #6b0011;
  --cabinet: #2a0610;
  --neon: #ff2d6f;
  --reel-bg: #fffdf5;
  --symbol-h: 84px; /* height of one symbol cell; overridden on small screens */
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: #fff;
  background:
    radial-gradient(circle at 50% 0%, #3a0a18 0%, #1a0008 55%, #0a0004 100%);
  overflow: hidden;
  touch-action: manipulation;
}

/* ---- Cabinet ---------------------------------------------------------- */

.machine {
  width: min(94vw, 420px);
  border-radius: 28px;
  padding: 14px;
  background: linear-gradient(160deg, #4a0c1c, var(--cabinet) 60%, #1c0309);
  border: 3px solid var(--gold-deep);
  box-shadow:
    0 0 0 6px #1a0008,
    0 24px 60px rgba(0, 0, 0, 0.7),
    inset 0 0 40px rgba(0, 0, 0, 0.5);
}

/* ---- Marquee + lights ------------------------------------------------- */

.marquee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.title {
  margin: 0;
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--gold);
  text-shadow:
    0 0 6px var(--neon),
    0 0 14px var(--neon),
    0 2px 0 #7a0012;
  animation: neon-flicker 3.5s infinite;
}

@keyframes neon-flicker {
  0%, 18%, 22%, 100% { opacity: 1; }
  20% { opacity: 0.55; }
  60% { opacity: 1; }
  62% { opacity: 0.7; }
}

.bulbs {
  flex: 1;
  height: 10px;
  border-radius: 6px;
  background-image: radial-gradient(circle, var(--gold) 0 3px, transparent 4px);
  background-size: 16px 10px;
  background-position: center;
  background-repeat: repeat-x;
  animation: chase 0.8s steps(2) infinite;
}

@keyframes chase {
  to { background-position-x: 16px; }
}

/* ---- Reels ------------------------------------------------------------ */

.cabinet {
  position: relative;
  display: flex;
  justify-content: center;
}

.reels {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(#111, #000);
  border: 3px solid var(--gold);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.9);
}

.reel {
  width: var(--symbol-h);
  height: var(--symbol-h);
  overflow: hidden;
  border-radius: 8px;
  background: var(--reel-bg);
  box-shadow:
    inset 0 14px 18px -10px rgba(0, 0, 0, 0.6),
    inset 0 -14px 18px -10px rgba(0, 0, 0, 0.6);
}

.strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.cell {
  height: var(--symbol-h);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--symbol-h) * 0.62);
  line-height: 1;
  user-select: none;
}

/* Center win line across the reels */
.payline {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, var(--neon), transparent);
  opacity: 0.6;
  pointer-events: none;
}

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

.lever {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: var(--symbol-h);
  touch-action: none;
  cursor: grab;
}

.lever:active {
  cursor: grabbing;
}

.lever-track {
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 10px;
  transform: translateX(-50%);
  border-radius: 6px;
  background: linear-gradient(90deg, #555, #999, #555);
  box-shadow: inset 0 0 4px #000;
}

.lever-rod {
  position: absolute;
  left: 50%;
  top: 0;
  width: 8px;
  height: 0;
  transform: translateX(-50%);
  border-radius: 4px;
  background: linear-gradient(90deg, #888, #ddd, #888);
}

.lever-knob {
  position: absolute;
  left: 50%;
  top: 0;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6b6b, var(--red) 55%, var(--red-deep));
  border: 2px solid var(--gold);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}

/* ---- Panel ------------------------------------------------------------ */

.panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #14060b;
  border: 2px solid var(--gold-deep);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.stat-label {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--gold);
  opacity: 0.85;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.message {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  min-height: 18px;
}

.machine.win {
  animation: win-shake 0.5s ease 2;
}

.machine.win .title {
  animation: neon-flicker 0.3s infinite;
}

@keyframes win-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (max-height: 640px) {
  :root { --symbol-h: 70px; }
}
