:root {
  --bg-0: #08090c;
  --bg-1: #121318;
  --bg-2: #1d1712;
  --panel-face: rgba(21, 19, 16, 0.96);
  --panel-face-2: rgba(13, 13, 13, 0.95);
  --panel-line: rgba(255, 220, 170, 0.12);
  --panel-line-strong: rgba(255, 206, 117, 0.22);
  --ink: #f7f1e4;
  --muted: #c7bca8;
  --muted-2: #9f9584;
  --danger-soft: #ff9e8f;

  --accent-gold: #ffc857;
  --accent-red: #f45334;
  --accent-green: #62d88f;
  --accent-ice: #d6efff;
  --tier-small: #8bd7ff;
  --tier-standard: #7aeaa6;
  --tier-epic: #ffc857;
  --tier-jackpot: #ff8c6b;

  --machine-max: 1080px;
  --panel-radius: 28px;
  --panel-pad: clamp(14px, 2vw, 22px);
  --panel-gap: clamp(10px, 1.4vw, 16px);
  --card-radius: 18px;

  --reel-gap: clamp(4px, 0.52vw, 7px);
  --sep-gap: clamp(6px, 1vw, 14px);
  --reel-width: clamp(20px, 2.8vw, 32px);
  --reel-content-fit-width: 0px;
  --reel-symbol-pad-x: 1px;
  --reel-frame-pad-x: 4px;
  --reel-frame-pad-y: 3px;
  --reel-frame-border-w: 1px;
  --reel-symbol-h: clamp(2.34rem, 5.7vw, 3.36rem);
  --reel-symbol-font: clamp(1.24rem, 3vw, 1.95rem);
  --reel-window-h: calc(var(--reel-symbol-h) * 2.5);
  --reel-frame-radius: clamp(7px, 0.7vw, 10px);
  --reel-window-radius: calc(var(--reel-frame-radius) - 2px);

  --btn-h: 48px;
  --btn-radius: 14px;
  --focus-ring: 0 0 0 2px rgba(9, 8, 7, 0.92), 0 0 0 4px rgba(255, 200, 87, 0.5);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 18% 12%, rgba(244, 83, 52, 0.07), transparent 62%),
    radial-gradient(1000px 720px at 82% 18%, rgba(255, 200, 87, 0.1), transparent 60%),
    radial-gradient(680px 500px at 50% 88%, rgba(98, 216, 143, 0.05), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg-1) 44%, var(--bg-0));
  font-family: "Rajdhani", "Avenir Next", "Trebuchet MS", sans-serif;
  line-height: 1.35;
  overflow-x: hidden;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding:
    max(18px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}

.scene-glow,
.scene-grid {
  position: absolute;
  pointer-events: none;
}

.scene-glow {
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.42;
  mix-blend-mode: screen;
}

.scene-glow-a {
  width: min(44vw, 460px);
  height: min(44vw, 460px);
  left: max(-14vw, -140px);
  top: 4%;
  background: radial-gradient(circle, rgba(244, 83, 52, 0.25), rgba(244, 83, 52, 0));
}

.scene-glow-b {
  width: min(42vw, 420px);
  height: min(42vw, 420px);
  right: max(-12vw, -130px);
  top: 62%;
  background: radial-gradient(circle, rgba(255, 200, 87, 0.2), rgba(255, 200, 87, 0));
}

.scene-grid {
  inset: 0;
  opacity: 0.06;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.11) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.11) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at 50% 40%, black 30%, transparent 90%);
}

.machine {
  position: relative;
  width: min(var(--machine-max), 100%);
  border-radius: var(--panel-radius);
  padding: var(--panel-pad);
  margin-top: clamp(4px, 1.8vh, 16px);
  display: grid;
  gap: var(--panel-gap);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 14%),
    linear-gradient(165deg, rgba(255, 200, 87, 0.06), transparent 38%),
    linear-gradient(0deg, var(--panel-face), var(--panel-face-2));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 32px 70px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

.machine::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--panel-radius) - 1px);
  border: 1px solid rgba(255, 220, 170, 0.05);
  pointer-events: none;
}

.machine-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 12px;
}

.machine-header h1 {
  margin: 0;
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: clamp(1.3rem, 3vw, 2.05rem);
  line-height: 1.12;
  letter-spacing: 0.03em;
}

.score-hud {
  position: relative;
  justify-self: end;
  display: inline-grid;
  grid-auto-flow: column;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(9, 10, 12, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  isolation: isolate;
}

.score-hud::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 200, 87, 0.05);
  pointer-events: none;
}

.score-hud-star {
  font-size: 0.95rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 200, 87, 0.16));
}

.score-hud-label {
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(255, 241, 214, 0.72);
}

.score-hud-value {
  min-width: 2ch;
  margin-left: 2px;
  color: rgba(255, 247, 229, 0.96);
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  letter-spacing: 0.03em;
}

.score-hud-delta {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
  color: rgba(122, 234, 166, 0.96);
  font-weight: 700;
  font-size: 0.82rem;
  text-shadow: 0 0 10px rgba(98, 216, 143, 0.14);
}

.score-hud.is-burst {
  animation: scoreHudPulse 520ms ease-out;
}

.score-hud.is-burst[data-tier="small"] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(139, 215, 255, 0.12),
    0 0 18px rgba(139, 215, 255, 0.08);
}

.score-hud.is-burst[data-tier="standard"] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(122, 234, 166, 0.14),
    0 0 20px rgba(122, 234, 166, 0.1);
}

.score-hud.is-burst[data-tier="epic"] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 200, 87, 0.16),
    0 0 24px rgba(255, 200, 87, 0.13);
}

.score-hud.is-burst[data-tier="jackpot"] {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 18px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 140, 107, 0.2),
    0 0 28px rgba(255, 140, 107, 0.16);
}

.score-hud-delta.is-active {
  animation: scoreDeltaFloat 760ms ease-out forwards;
}

.display-panel,
.controls-panel {
  position: relative;
  border-radius: var(--card-radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 30%),
    rgba(9, 9, 10, 0.68);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -18px 26px rgba(0, 0, 0, 0.16);
}

.display-panel {
  padding: clamp(12px, 1.6vw, 16px);
  overflow: clip;
}

.display-panel-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(80% 100% at 50% 54%, rgba(98, 216, 143, 0.18), transparent 70%),
    radial-gradient(60% 90% at 50% 46%, rgba(255, 200, 87, 0.12), transparent 72%);
}

.display-panel.is-celebrating .display-panel-flash {
  animation: displayFlash 420ms ease-out;
}

.lucky-particles {
  position: absolute;
  inset: 10px;
  pointer-events: none;
  overflow: clip;
  z-index: 4;
}

.lucky-particle {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 2px;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.9) rotate(0deg);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
  will-change: transform, opacity;
}

.lucky-particle.is-live {
  animation: luckyParticleFloat 620ms ease-out forwards;
}

.lucky-particle.is-glint {
  border-radius: 999px;
  animation: luckyParticleGlint 420ms ease-out forwards;
}

.display-head {
  margin-bottom: 8px;
}

.display-heading {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: rgba(255, 241, 214, 0.95);
}

.guid-machine {
  position: relative;
  border-radius: 16px;
  padding: clamp(8px, 1vw, 10px);
  background:
    linear-gradient(180deg, rgba(255, 200, 87, 0.07), rgba(244, 83, 52, 0.04) 48%, rgba(255, 255, 255, 0.01)),
    rgba(14, 14, 16, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -10px 18px rgba(0, 0, 0, 0.28);
}

.guid-machine.has-lucky-glow::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  animation: luckyPanelAura 680ms ease-out;
}

.guid-machine.has-lucky-glow[data-lucky-tier="small"]::after {
  background: radial-gradient(70% 90% at 50% 50%, rgba(139, 215, 255, 0.08), transparent 75%);
}

.guid-machine.has-lucky-glow[data-lucky-tier="standard"]::after {
  background: radial-gradient(70% 90% at 50% 50%, rgba(122, 234, 166, 0.1), transparent 75%);
}

.guid-machine.has-lucky-glow[data-lucky-tier="epic"]::after {
  background: radial-gradient(76% 100% at 50% 50%, rgba(255, 200, 87, 0.14), transparent 76%);
}

.guid-machine.has-lucky-glow[data-lucky-tier="jackpot"]::after {
  background:
    radial-gradient(72% 95% at 50% 50%, rgba(255, 140, 107, 0.14), transparent 76%),
    radial-gradient(60% 88% at 50% 50%, rgba(255, 200, 87, 0.1), transparent 72%);
}

.guid-machine-window {
  position: relative;
  border-radius: 14px;
  padding: clamp(8px, 0.9vw, 10px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.18)),
    #101114;
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    inset 0 -8px 16px rgba(0, 0, 0, 0.22);
}

.guid-machine-bezel {
  position: relative;
  border-radius: 10px;
  padding: clamp(5px, 0.7vw, 7px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.14)),
    rgba(8, 8, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.guid-machine-bezel::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 200, 87, 0.05);
  pointer-events: none;
}

.guid-machine-bezel::after {
  content: "";
  position: absolute;
  inset: clamp(5px, 0.7vw, 7px);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  pointer-events: none;
}

.guid-reels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: max(var(--reel-gap), 4px);
  min-height: calc(var(--reel-window-h) + 10px);
  overflow-x: auto;
  overflow-y: hidden;
  padding: clamp(4px, 0.7vw, 6px) clamp(4px, 1vw, 10px);
  scrollbar-width: none;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.guid-reels::-webkit-scrollbar { height: 0; }

.reel-position {
  position: relative;
  flex: 0 0 auto;
}

.reel-position.is-settling {
  animation: reelLand 180ms cubic-bezier(0.2, 0.8, 0.25, 1.14);
}

.reel-position.is-settled .reel-frame {
  border-color: rgba(98, 216, 143, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -8px 10px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(98, 216, 143, 0.09),
    0 0 12px rgba(98, 216, 143, 0.08);
}

.reel-position.is-lucky-match {
  --lucky-hue-glow: rgba(122, 234, 166, 0.2);
}

.reel-position.is-lucky-match .reel-frame {
  border-color: rgba(122, 234, 166, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -8px 10px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(122, 234, 166, 0.07),
    0 0 10px rgba(122, 234, 166, 0.06);
}

.reel-position.is-lucky-match .reel-symbol {
  color: rgba(150, 255, 202, 1);
  text-shadow:
    0 0 7px rgba(122, 234, 166, 0.24),
    0 0 14px rgba(122, 234, 166, 0.1);
  filter: saturate(1.06);
}

.reel-position.is-lucky-pulse {
  animation: luckyReelPulse 640ms cubic-bezier(0.16, 0.86, 0.24, 1.06) both;
  animation-delay: var(--lucky-delay, 0ms);
}

.reel-position.is-lucky-pulse .reel-frame {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -8px 10px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(122, 234, 166, 0.12),
    0 0 20px rgba(122, 234, 166, 0.16);
}

.reel-position.is-lucky-epic .reel-frame {
  border-color: rgba(255, 200, 87, 0.2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -8px 10px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(255, 200, 87, 0.1),
    0 0 14px rgba(255, 200, 87, 0.1);
}

.reel-position.is-lucky-jackpot .reel-frame {
  border-color: rgba(255, 140, 107, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -8px 10px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(255, 140, 107, 0.11),
    0 0 16px rgba(255, 140, 107, 0.11);
}

.reel-position.is-lucky-epic .reel-symbol {
  color: rgba(255, 220, 112, 1);
  text-shadow:
    0 0 8px rgba(255, 200, 87, 0.24),
    0 0 16px rgba(255, 200, 87, 0.12);
}

.reel-position.is-lucky-jackpot .reel-symbol {
  color: rgba(255, 176, 154, 1);
  text-shadow:
    0 0 8px rgba(255, 140, 107, 0.26),
    0 0 16px rgba(255, 140, 107, 0.14);
}

.reel-position.is-hexword-match .reel-symbol {
  color: rgba(160, 234, 255, 1);
  text-shadow:
    0 0 8px rgba(139, 215, 255, 0.24),
    0 0 16px rgba(139, 215, 255, 0.12);
}

.reel-position.is-spinning .reel-frame {
  border-color: rgba(255, 200, 87, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -8px 10px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(255, 200, 87, 0.08),
    0 0 10px rgba(255, 200, 87, 0.05);
}

.reel-frame {
  position: relative;
  width: calc(
    max(var(--reel-width), var(--reel-content-fit-width)) +
    (var(--reel-frame-pad-x) * 2) +
    (var(--reel-frame-border-w) * 2)
  );
  border-radius: var(--reel-frame-radius);
  padding: var(--reel-frame-pad-y) var(--reel-frame-pad-x);
  border: var(--reel-frame-border-w) solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(255, 200, 87, 0.05), rgba(0, 0, 0, 0.02) 32%, rgba(244, 83, 52, 0.06));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 -10px 12px rgba(0, 0, 0, 0.22);
}

.reel-viewport {
  position: relative;
  width: max(var(--reel-width), var(--reel-content-fit-width));
  height: var(--reel-window-h);
  border-radius: var(--reel-window-radius);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.004)),
    linear-gradient(180deg, rgba(15, 16, 19, 0.98), rgba(8, 8, 10, 0.99));
}

.reel-viewport::before,
.reel-viewport::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 2;
}

.reel-viewport::before {
  top: 0;
  bottom: 0;
  background:
    linear-gradient(
      180deg,
      rgba(4, 4, 5, 0.995) 0%,
      rgba(4, 4, 5, 0.992) 14%,
      rgba(4, 4, 5, 0.965) 26%,
      rgba(4, 4, 5, 0.9) 33%,
      rgba(4, 4, 5, 0.76) 38%,
      rgba(4, 4, 5, 0.5) 42.5%,
      rgba(4, 4, 5, 0.2) 46.6%,
      rgba(4, 4, 5, 0.03) 48.7%,
      rgba(4, 4, 5, 0.012) 49.45%,
      rgba(4, 4, 5, 0.012) 50.55%,
      rgba(4, 4, 5, 0.03) 51.3%,
      rgba(4, 4, 5, 0.2) 53.4%,
      rgba(4, 4, 5, 0.5) 57.5%,
      rgba(4, 4, 5, 0.76) 62%,
      rgba(4, 4, 5, 0.9) 67%,
      rgba(4, 4, 5, 0.965) 74%,
      rgba(4, 4, 5, 0.992) 86%,
      rgba(4, 4, 5, 0.995) 100%
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 20%, transparent 80%, rgba(255, 255, 255, 0.012));
}

.reel-viewport::after {
  top: 50%;
  height: calc(var(--reel-symbol-h) + 4px);
  transform: translateY(-50%);
  background: transparent;
  border-top: 0;
  border-bottom: 0;
  box-shadow: none;
}

.reel-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.reel-symbol {
  display: grid;
  place-items: center;
  width: 100%;
  height: var(--reel-symbol-h);
  padding-inline: var(--reel-symbol-pad-x);
  font-family: "IBM Plex Mono", "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: var(--reel-symbol-font);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
  color: rgba(246, 242, 232, 0.88);
  text-transform: lowercase;
  text-shadow: 0 0 0 rgba(0, 0, 0, 0);
  user-select: none;
}

.reel-position.is-spinning .reel-strip {
  filter: blur(0.22px) saturate(1.01);
}

.reel-position.is-spinning .reel-symbol {
  color: rgba(255, 236, 200, 0.52);
  text-shadow: 0 0 3px rgba(255, 200, 87, 0.04);
}

.reel-position.is-near-stop .reel-strip {
  filter: blur(0.12px) saturate(1.01);
}

.reel-position.is-near-stop .reel-symbol {
  color: rgba(255, 236, 200, 0.62);
  text-shadow: 0 0 3px rgba(255, 200, 87, 0.05);
}

.reel-position.is-settled .reel-symbol {
  color: #f8f6f0;
}

.guid-separator {
  flex: 0 0 auto;
  width: max(0.8em, clamp(8px, 1.4vw, 14px));
  margin-inline: calc(var(--sep-gap) - var(--reel-gap));
  height: var(--reel-window-h);
  display: grid;
  place-items: center;
  position: relative;
  color: rgba(255, 228, 180, 0.88);
  font-family: "IBM Plex Mono", "Cascadia Mono", monospace;
  font-size: calc(var(--reel-symbol-font) * 0.92);
  line-height: 1;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 200, 87, 0.08);
}

.guid-separator::before {
  content: "";
  position: absolute;
  left: 50%;
  width: 1px;
  height: 64%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 200, 87, 0.22), rgba(255, 255, 255, 0.04));
  opacity: 0.5;
}

.lucky-banner {
  position: absolute;
  left: auto;
  right: clamp(14px, 2vw, 20px);
  top: clamp(40px, 5.2vw, 58px);
  bottom: auto;
  z-index: 5;
  display: grid;
  gap: 2px;
  width: min(100%, 360px);
  max-width: calc(100% - clamp(20px, 3vw, 32px));
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(8, 9, 11, 0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 26px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  pointer-events: none;
}

.lucky-banner.is-active {
  animation: luckyBannerInOut 3000ms cubic-bezier(0.18, 0.82, 0.24, 1) forwards;
}

.lucky-banner[data-tier="small"] {
  border-color: rgba(139, 215, 255, 0.12);
}

.lucky-banner[data-tier="standard"] {
  border-color: rgba(122, 234, 166, 0.13);
}

.lucky-banner[data-tier="epic"] {
  border-color: rgba(255, 200, 87, 0.16);
}

.lucky-banner[data-tier="jackpot"] {
  border-color: rgba(255, 140, 107, 0.18);
}

.lucky-banner-kicker,
.lucky-banner-title,
.lucky-banner-sub {
  margin: 0;
}

.lucky-banner-kicker {
  font-size: 0.68rem;
  line-height: 1.05;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255, 241, 214, 0.72);
}

.lucky-banner-title {
  font-family: "Orbitron", "Rajdhani", sans-serif;
  font-size: clamp(0.95rem, 2vw, 1.12rem);
  line-height: 1.08;
  letter-spacing: 0.03em;
  color: rgba(255, 250, 239, 0.98);
}

.lucky-banner-sub {
  font-size: 0.82rem;
  line-height: 1.2;
  color: rgba(229, 221, 205, 0.86);
}

.lucky-banner[data-tier="small"] .lucky-banner-title { color: var(--tier-small); }
.lucky-banner[data-tier="standard"] .lucky-banner-title { color: var(--tier-standard); }
.lucky-banner[data-tier="epic"] .lucky-banner-title { color: var(--tier-epic); }
.lucky-banner[data-tier="jackpot"] .lucky-banner-title { color: var(--tier-jackpot); }

.controls-panel {
  padding: clamp(10px, 1.2vw, 12px);
  display: grid;
  gap: 0;
}

.main-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: min(100%, 320px);
  margin-inline: auto;
}

.btn {
  position: relative;
  min-height: var(--btn-h);
  border-radius: var(--btn-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(11, 11, 13, 0.85);
  font: inherit;
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 14px;
  cursor: pointer;
  transition:
    transform 90ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 16px rgba(0, 0, 0, 0.16);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: calc(var(--btn-radius) - 1px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 38%);
  opacity: 0.8;
  pointer-events: none;
}

.btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.18);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  border-color: rgba(244, 83, 52, 0.26);
  background:
    linear-gradient(180deg, rgba(244, 83, 52, 0.23), rgba(255, 200, 87, 0.08)),
    rgba(11, 11, 13, 0.85);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 10px 20px rgba(0, 0, 0, 0.2),
    0 0 18px rgba(244, 83, 52, 0.06);
}

.btn-secondary {
  border-color: rgba(255, 200, 87, 0.2);
  background:
    linear-gradient(180deg, rgba(255, 200, 87, 0.13), rgba(255, 200, 87, 0.04)),
    rgba(11, 11, 13, 0.82);
}

.btn-accent {
  border-color: rgba(98, 216, 143, 0.22);
  background:
    linear-gradient(180deg, rgba(98, 216, 143, 0.14), rgba(98, 216, 143, 0.05)),
    rgba(11, 11, 13, 0.82);
}

.btn-accent.is-copied {
  border-color: rgba(98, 216, 143, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 10px 18px rgba(0, 0, 0, 0.18),
    0 0 18px rgba(98, 216, 143, 0.12);
  animation: buttonPulse 320ms ease-out;
}

.status-line {
  margin: 0;
  min-height: 1.35em;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-line.is-error {
  color: var(--danger-soft);
}

button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.reduce-motion .scene-glow,
body.reduce-motion .reel-position.is-settling,
body.reduce-motion .display-panel.is-celebrating .display-panel-flash,
body.reduce-motion .btn-accent.is-copied {
  animation: none !important;
}

body.reduce-motion .reel-position.is-lucky-pulse {
  animation: none !important;
}

body.reduce-motion .reel-position.is-lucky-match .reel-frame,
body.reduce-motion .reel-position.is-lucky-epic .reel-frame,
body.reduce-motion .reel-position.is-lucky-jackpot .reel-frame {
  transition: box-shadow 140ms ease, border-color 140ms ease;
}

body.reduce-motion .score-hud.is-burst {
  animation: scoreHudPulseReduced 220ms ease-out;
}

body.reduce-motion .lucky-banner.is-active {
  animation: luckyBannerFadeReduced 3000ms ease-out forwards;
}

body.reduce-motion .lucky-particle.is-live {
  animation: luckyParticleGlint 260ms ease-out forwards;
}

body.reduce-motion .reel-position.is-spinning .reel-strip {
  filter: blur(0.25px) saturate(1.02);
}

@media (prefers-reduced-motion: reduce) {
  body:not(.allow-full-motion) .scene-glow {
    opacity: 0.18;
  }
}

@media (max-width: 980px) {
  :root {
    --panel-radius: 22px;
  }
}

@media (max-width: 760px) {
  :root {
    --panel-pad: 14px;
    --panel-gap: 12px;
    --reel-width: clamp(17px, 3.1vw, 22px);
    --reel-gap: 3px;
    --sep-gap: 5px;
    --reel-symbol-h: clamp(2.02rem, 7.2vw, 2.5rem);
    --reel-symbol-font: clamp(1.02rem, 3.55vw, 1.38rem);
    --reel-window-h: calc(var(--reel-symbol-h) * 2.42);
    --btn-h: 46px;
  }

  .guid-machine-window {
    padding: 6px;
  }

  .guid-machine-bezel {
    padding: 4px;
  }

  .machine-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .score-hud {
    justify-self: start;
  }

  .lucky-banner {
    right: 12px;
    top: 36px;
    width: min(100%, 300px);
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  :root {
    --reel-width: clamp(14px, 3.3vw, 18px);
    --reel-gap: 2px;
    --sep-gap: 4px;
    --reel-symbol-h: clamp(1.68rem, 7vw, 2.08rem);
    --reel-symbol-font: clamp(0.9rem, 3.35vw, 1.12rem);
    --reel-window-h: calc(var(--reel-symbol-h) * 2.36);
    --btn-h: 44px;
  }

  .machine-header h1 {
    font-size: 1.18rem;
  }

  .guid-separator {
    width: max(0.75em, 8px);
  }

  .score-hud {
    min-height: 30px;
    gap: 5px;
    padding: 5px 9px;
  }

  .score-hud-label {
    font-size: 0.66rem;
    letter-spacing: 0.1em;
  }

  .score-hud-value {
    font-size: 0.86rem;
  }

  .lucky-banner-title {
    font-size: 0.9rem;
  }

  .lucky-banner-sub {
    font-size: 0.76rem;
  }
}

@media (orientation: landscape) and (max-height: 640px) {
  :root {
    --panel-pad: 12px;
    --panel-gap: 10px;
    --reel-width: clamp(14px, 2.5vw, 18px);
    --reel-gap: 3px;
    --sep-gap: 5px;
    --reel-symbol-h: clamp(1.62rem, 6.5vh, 2.1rem);
    --reel-symbol-font: clamp(0.92rem, 3.5vh, 1.18rem);
    --reel-window-h: calc(var(--reel-symbol-h) * 2.34);
    --btn-h: 40px;
  }

  .controls-panel {
    padding: 10px;
  }

  .app-shell {
    padding-top: max(12px, env(safe-area-inset-top));
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .display-head {
    margin-bottom: 6px;
  }
}

@keyframes reelLand {
  0% {
    transform: translateY(-2px) scaleY(1.015);
  }
  60% {
    transform: translateY(1px) scaleY(0.992);
  }
  100% {
    transform: translateY(0) scaleY(1);
  }
}

@keyframes displayFlash {
  0% {
    opacity: 0;
  }
  28% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@keyframes buttonPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes luckyReelPulse {
  0% {
    transform: translateY(0) scale(1);
  }
  32% {
    transform: translateY(-1px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes luckyPanelAura {
  0% {
    opacity: 0;
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes luckyBannerInOut {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  8% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  88% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-3px) scale(0.995);
  }
}

@keyframes luckyBannerFadeReduced {
  0% {
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes scoreHudPulse {
  0% {
    transform: scale(1);
  }
  28% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes scoreHudPulseReduced {
  0% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.13);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes scoreDeltaFloat {
  0% {
    opacity: 0;
    transform: translateY(-42%) translateX(0) scale(0.95);
  }
  18% {
    opacity: 1;
    transform: translateY(-84%) translateX(4px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-132%) translateX(10px) scale(0.98);
  }
}

@keyframes luckyParticleFloat {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.86) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate3d(var(--dx, 0px), var(--dy, -22px), 0)
      scale(var(--s, 1))
      rotate(var(--r, 0deg));
  }
}

@keyframes luckyParticleGlint {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  25% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.92);
  }
}
