:root {
  --bg: #080d18;
  --panel: #12192b;
  --border: #25314e;
  --gold: #f4c55a;
  --text: #f5f7fb;
  --muted: #b8c0d6;

  --row-height: 78px;
  --reel-width-small: 92px;
  --reel-width-build: 76px;
  --reel-width-rune: 68px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  overflow: hidden;
  background: #050913;
}

#bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -3;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at center, rgba(18, 28, 50, 0.25), rgba(5, 9, 19, 0.78)),
    linear-gradient(180deg, rgba(6, 10, 20, 0.35), rgba(6, 10, 20, 0.72));
}

.app {
  position: relative;
  min-height: 100vh;
  padding: 18px 12px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* AUDIO BUTTON */

#audio-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 20;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  padding: 9px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  backdrop-filter: blur(8px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition:
    background 0.18s ease,
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

#audio-toggle:hover {
  background: rgba(30, 41, 59, 0.92);
  border-color: rgba(143, 250, 255, 0.28);
  transform: translateY(-1px);
}

#audio-toggle:active {
  transform: translateY(0);
}

#audio-toggle.audio-on {
  border-color: rgba(79, 246, 255, 0.34);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.25),
    0 0 18px rgba(0, 229, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* TITLE */

.machine-title {
  margin: -6px 0 18px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 0.4px;
  line-height: 1.18;
  overflow: visible;
}

.machine-title span {
  position: relative;
  display: inline-block;
  padding-bottom: 4px;
  overflow: visible;
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #dfffff 20%,
    #8ffaff 60%,
    #21e6ff 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.machine-title span::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.15) 35%,
    rgba(255,255,255,0.6) 50%,
    rgba(255,255,255,0.15) 65%,
    rgba(255,255,255,0) 100%
  );
  background-size: 200% 100%;
  background-position: -120% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  pointer-events: none;
  animation: textShimmer 4.5s ease-in-out infinite;
}

@keyframes textShimmer {
  0% {
    background-position: -120% 0;
  }
  40% {
    background-position: 120% 0;
  }
  100% {
    background-position: 120% 0;
  }
}

#machine-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

#machine-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

#machine {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-areas:
    "champion ability build"
    "spell1   spell2  runes";
  gap: 16px 16px;
  justify-content: center;
  align-items: start;
  width: max-content;
}

.champion-group { grid-area: champion; }
.ability-group { grid-area: ability; }
.build-group { grid-area: build; }
.spell1-group { grid-area: spell1; }
.spell2-group { grid-area: spell2; }
.rune-group { grid-area: runes; }

.group {
  background: linear-gradient(180deg, rgba(22, 31, 54, 0.92), rgba(12, 18, 32, 0.95));
  border: 1px solid rgba(53, 71, 107, 0.95);
  border-radius: 18px;
  padding: 12px 12px 14px;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(4px);
}

.group-title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.reel-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.small-group .mini-reel {
  width: var(--reel-width-small);
}

.build-group .mini-reel {
  width: var(--reel-width-build);
}

.rune-group .mini-reel {
  width: var(--reel-width-rune);
}

.mini-reel {
  position: relative;
  height: calc(var(--row-height) * 3);
  overflow: hidden;
  border-radius: 14px;
  background: linear-gradient(180deg, #18213a 0%, #0e1526 100%);
  border: 1px solid #314162;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.mini-reel::before,
.mini-reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 3;
}

.mini-reel::before {
  top: 0;
  height: var(--row-height);
  background: linear-gradient(180deg, rgba(5, 9, 19, 0.94), rgba(5, 9, 19, 0));
}

.mini-reel::after {
  bottom: 0;
  height: var(--row-height);
  background: linear-gradient(180deg, rgba(5, 9, 19, 0), rgba(5, 9, 19, 0.94));
}

.mini-reel .center-highlight {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--row-height);
  height: var(--row-height);
  border-top: 2px solid rgba(244, 197, 90, 0.95);
  border-bottom: 2px solid rgba(244, 197, 90, 0.95);
  background: linear-gradient(
    180deg,
    rgba(244, 197, 90, 0.08),
    rgba(244, 197, 90, 0.14),
    rgba(244, 197, 90, 0.08)
  );
  box-shadow:
    inset 0 0 18px rgba(244, 197, 90, 0.08),
    0 0 10px rgba(244, 197, 90, 0.08);
  z-index: 2;
  pointer-events: none;
}

.reel-strip {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  z-index: 1;
}

.symbol {
  height: var(--row-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
}

.symbol img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.build-group .symbol img {
  width: 50px;
  height: 50px;
}

.rune-group .symbol img {
  width: 44px;
  height: 44px;
}

.mini-reel.spinning .symbol img {
  filter:
    blur(0.3px)
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
}

/* LEVER */

#lever-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
}

#lever-track {
  position: relative;
  width: 92px;
  height: 370px;
  border-radius: 46px;
  background:
    linear-gradient(180deg, rgba(14, 22, 34, 0.78), rgba(10, 16, 28, 0.38));
  border: 1px solid rgba(95, 118, 150, 0.38);
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 28px;
  backdrop-filter: blur(3px);
}

#lever {
  position: relative;
  width: 58px;
  height: 270px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  transform-origin: top center;
  user-select: none;
}

#lever:disabled {
  cursor: not-allowed;
}

#lever-stick {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 12px;
  height: 192px;
  transform: translateX(-50%);
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      #586170 0%,
      #8d99aa 18%,
      #e0e7ef 48%,
      #9ea9ba 72%,
      #5a6474 100%
    );
  box-shadow:
    inset 1px 0 1px rgba(255,255,255,0.35),
    inset -1px 0 1px rgba(0,0,0,0.22),
    inset 0 -8px 14px rgba(0,0,0,0.18),
    0 0 8px rgba(255,255,255,0.08);
}

#lever-stick::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 14px;
  height: 26%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0));
  pointer-events: none;
}

#lever-stick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0.03));
  opacity: 0.7;
  pointer-events: none;
}

#lever-knob {
  position: absolute;
  left: 50%;
  top: 184px;
  width: 46px;
  height: 46px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.28) 16%, rgba(255,255,255,0) 28%),
    radial-gradient(circle at 40% 35%, #4ff6ff 0%, #00e5ff 30%, #00bcd4 62%, #0097a7 100%);
  box-shadow:
    inset 0 2px 5px rgba(255,255,255,0.34),
    inset 0 -8px 10px rgba(0,0,0,0.22),
    0 0 10px rgba(0,229,255,0.38),
    0 0 22px rgba(0,188,212,0.22),
    0 10px 18px rgba(0,0,0,0.34);
  transition:
    box-shadow 0.18s ease,
    filter 0.18s ease,
    transform 0.18s ease;
  overflow: hidden;
}

#lever-knob::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 10px;
  width: 18px;
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.58);
  filter: blur(0.4px);
  transform: rotate(-18deg);
  pointer-events: none;
}

#lever-knob::after {
  content: "";
  position: absolute;
  left: -65%;
  top: -15%;
  width: 44%;
  height: 130%;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.10) 35%,
    rgba(255,255,255,0.45) 50%,
    rgba(255,255,255,0.10) 65%,
    rgba(255,255,255,0) 100%
  );
  transform: rotate(18deg);
  opacity: 0.42;
  animation: knobShimmer 4.8s ease-in-out infinite;
  pointer-events: none;
}

#lever-glow-burst {
  position: absolute;
  left: 50%;
  top: 184px;
  width: 58px;
  height: 58px;
  transform: translateX(-50%) scale(0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(79,246,255,0.65) 0%, rgba(0,229,255,0.34) 35%, rgba(0,188,212,0.16) 58%, rgba(0,151,167,0) 78%);
  filter: blur(3px);
  opacity: 0;
  pointer-events: none;
}

#lever:hover #lever-knob {
  box-shadow:
    inset 0 2px 5px rgba(255,255,255,0.38),
    inset 0 -8px 10px rgba(0,0,0,0.22),
    0 0 14px rgba(0,229,255,0.48),
    0 0 30px rgba(0,188,212,0.28),
    0 10px 18px rgba(0,0,0,0.34);
  filter: brightness(1.06);
}

#lever:hover #lever-stick {
  filter: brightness(1.04);
}

#lever.pulling {
  animation: leverPullDown 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}

#lever.pulling #lever-knob {
  animation: knobPulse 0.58s ease;
}

#lever.pulling #lever-glow-burst {
  animation: glowBurstFade 1.15s ease-out forwards;
}

@keyframes leverPullDown {
  0% { transform: translateY(0); }
  28% { transform: translateY(68px); }
  42% { transform: translateY(82px); }
  62% { transform: translateY(50px); }
  78% { transform: translateY(62px); }
  100% { transform: translateY(0); }
}

@keyframes knobPulse {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.18); }
  100% { filter: brightness(1); }
}

@keyframes knobShimmer {
  0% {
    left: -65%;
    opacity: 0.18;
  }
  20% {
    opacity: 0.34;
  }
  50% {
    left: 120%;
    opacity: 0.32;
  }
  100% {
    left: 120%;
    opacity: 0;
  }
}

@keyframes glowBurstFade {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.72);
  }
  12% {
    opacity: 0.95;
    transform: translateX(-50%) scale(1.08);
  }
  45% {
    opacity: 0.42;
    transform: translateX(-50%) scale(1.34);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.8);
  }
}

@media (max-width: 1200px) {
  :root {
    --row-height: 72px;
    --reel-width-small: 84px;
    --reel-width-build: 70px;
    --reel-width-rune: 62px;
  }

  .machine-title {
    font-size: 30px;
    margin: -4px 0 16px;
  }

  .symbol img {
    width: 52px;
    height: 52px;
  }

  .build-group .symbol img {
    width: 46px;
    height: 46px;
  }

  .rune-group .symbol img {
    width: 40px;
    height: 40px;
  }

  #lever-track {
    height: 330px;
    width: 86px;
  }

  #lever {
    height: 240px;
  }

  #lever-stick {
    height: 174px;
  }

  #lever-knob {
    top: 168px;
    width: 42px;
    height: 42px;
  }

  #lever-glow-burst {
    top: 168px;
    width: 54px;
    height: 54px;
  }

  #audio-toggle {
    top: 14px;
    right: 14px;
    padding: 8px 12px;
    font-size: 12px;
  }
}