:root {
  --slot-bg: #0e0609;
  --slot-panel: #1a0e14;
  --slot-frame: #2a1520;
  --slot-gold: #f0c14b;
  --slot-saffron: #e8872b;
  --slot-crimson: #c42d4a;
  --slot-teal: #1a9e8f;
  --slot-text: #f5ebe8;
  --slot-muted: #9a8490;
  --symbol-h: clamp(3.5rem, 12vw, 5.5rem);
  --reel-gap: 0.35rem;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--slot-bg);
  color: var(--slot-text);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.slot {
  width: 100%;
  max-width: 52rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  max-height: 100%;
}

/* HUD */
.slot__hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.slot__stat {
  background: var(--slot-panel);
  border: 1px solid rgba(232, 135, 43, 0.2);
  border-radius: 0.625rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
}

.slot__stat--accent {
  border-color: rgba(240, 193, 75, 0.4);
  background: linear-gradient(135deg, rgba(232, 135, 43, 0.12), rgba(196, 45, 74, 0.08));
}

.slot__stat-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slot-muted);
  margin-block-end: 0.15rem;
}

.slot__stat-value {
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 700;
  color: var(--slot-gold);
}

.slot__stat--accent .slot__stat-value {
  color: var(--slot-saffron);
}

/* Machine */
.slot__machine {
  position: relative;
  flex: 1;
  min-height: 14rem;
  background: linear-gradient(180deg, var(--slot-frame), var(--slot-panel));
  border: 2px solid rgba(232, 135, 43, 0.35);
  border-radius: 1rem;
  padding: 0.75rem;
  box-shadow:
    0 0 40px rgba(232, 135, 43, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.slot__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(240, 193, 75, 0.08), transparent);
  pointer-events: none;
}

.slot__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--reel-gap);
  height: 100%;
}

.reel {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.reel__strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
}

.reel.is-spinning .reel__strip {
  transition: none;
}

.reel.is-cruising .symbol svg {
  filter: blur(3px) brightness(1.1);
  opacity: 0.88;
  transition: filter 0.15s, opacity 0.15s;
}

.reel.is-stopping .symbol svg {
  filter: blur(1.5px) brightness(1.05);
  opacity: 0.95;
  transition: filter 0.35s ease-out, opacity 0.35s ease-out;
}

.reel.is-settling .symbol svg,
.reel:not(.is-spinning):not(.is-cruising):not(.is-stopping) .symbol svg {
  filter: none;
  opacity: 1;
  transition: filter 0.25s, opacity 0.25s;
}

.symbol {
  height: var(--symbol-h);
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0.25rem;
}

.symbol svg {
  width: 70%;
  height: 70%;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.symbol.is-win {
  animation: symbol-pulse 0.6s ease infinite alternate;
}

@keyframes symbol-pulse {
  from { filter: drop-shadow(0 0 4px rgba(240, 193, 75, 0.4)); }
  to { filter: drop-shadow(0 0 14px rgba(240, 193, 75, 0.9)); }
}

.symbol--wild svg { filter: drop-shadow(0 0 8px rgba(240, 193, 75, 0.7)); }
.symbol--scatter svg { filter: drop-shadow(0 0 8px rgba(196, 45, 74, 0.7)); }

.slot__paylines {
  position: absolute;
  inset: 0.75rem;
  z-index: 2;
  pointer-events: none;
  width: calc(100% - 1.5rem);
  height: calc(100% - 1.5rem);
}

.payline-path {
  fill: none;
  stroke: var(--slot-gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 6 4;
  opacity: 0;
  animation: line-flash 1.2s ease infinite;
}

@keyframes line-flash {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.9; }
}

/* Toast */
.slot__toast {
  text-align: center;
  font-size: 0.8rem;
  color: var(--slot-muted);
  min-height: 1.25rem;
  transition: color 0.3s;
}

.slot__toast.is-win { color: var(--slot-gold); font-weight: 600; }
.slot__toast.is-big { color: var(--slot-saffron); font-weight: 700; }

/* Controls */
.slot__controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}

.slot__bet-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
}

.slot__btn {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid rgba(232, 135, 43, 0.3);
  border-radius: 50%;
  background: var(--slot-panel);
  color: var(--slot-gold);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.slot__btn:hover:not(:disabled) {
  background: rgba(232, 135, 43, 0.15);
  transform: scale(1.05);
}

.slot__btn:disabled { opacity: 0.35; cursor: not-allowed; }

.slot__bet-display {
  text-align: center;
  min-width: 4.5rem;
}

.slot__bet-label {
  display: block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slot-muted);
}

.slot__bet-value {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--slot-text);
}

.slot__spin {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 5.5rem;
  height: 5.5rem;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(145deg, var(--slot-saffron), var(--slot-gold));
  color: var(--slot-bg);
  box-shadow: 0 4px 24px rgba(232, 135, 43, 0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}

.slot__spin:hover:not(:disabled) {
  transform: scale(1.06);
  box-shadow: 0 6px 32px rgba(232, 135, 43, 0.6);
}

.slot__spin:active:not(:disabled) { transform: scale(0.96); }

.slot__spin:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.slot__spin-text {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.slot__spin-cost {
  font-size: 0.6rem;
  font-weight: 600;
  opacity: 0.75;
  margin-block-start: 0.15rem;
}

.slot__meta {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slot-muted);
}

@media (max-width: 40rem) {
  :root {
    --symbol-h: clamp(2.35rem, 10.5vw, 3.5rem);
    --reel-gap: 0.25rem;
  }

  body {
    padding: 0.25rem;
    align-items: stretch;
  }

  .slot {
    gap: 0.4rem;
    max-width: none;
  }

  .slot__hud {
    gap: 0.35rem;
  }

  .slot__stat {
    padding: 0.35rem 0.45rem;
  }

  .slot__stat-label {
    font-size: 0.58rem;
  }

  .slot__machine {
    padding: 0.5rem;
    min-height: 9.5rem;
  }

  .slot__paylines {
    inset: 0.5rem;
    width: calc(100% - 1rem);
    height: calc(100% - 1rem);
  }

  .slot__toast {
    font-size: 0.72rem;
    min-height: 1rem;
  }

  .slot__controls {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.35rem;
  }

  .slot__bet-group {
    gap: 0.35rem;
  }

  .slot__btn {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }

  .slot__bet-display {
    min-width: 3.5rem;
  }

  .slot__bet-value {
    font-size: 0.9rem;
  }

  .slot__spin {
    width: 4.25rem;
    height: 4.25rem;
  }

  .slot__spin-text {
    font-size: 0.75rem;
  }

  .slot__spin-cost {
    font-size: 0.55rem;
  }

  .slot__meta {
    font-size: 0.58rem;
    gap: 0.1rem;
  }
}

@media (max-width: 30rem) {
  .slot__controls {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    justify-items: stretch;
  }

  .slot__bet-group {
    justify-self: start;
  }

  .slot__meta {
    flex-direction: column;
    align-items: flex-end;
    justify-self: end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reel.is-cruising .symbol svg,
  .reel.is-stopping .symbol svg {
    filter: none;
    opacity: 1;
  }
  .symbol.is-win { animation: none; }
  .payline-path { animation: none; opacity: 0.7; }
}
