
:root {
  --bg: #05060b;
  --panel: rgba(13, 16, 30, 0.88);
  --panel2: rgba(22, 26, 44, 0.9);
  --text: #f5f7ff;
  --muted: #8e97ad;
  --cyan: #42e8ff;
  --purple: #9b5cff;
  --pink: #ff4fa7;
  --gold: #ffd86b;
  --danger: #ff6b7a;
  --success: #78ffb3;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(68, 84, 255, .20), transparent 28%),
    radial-gradient(circle at 80% 20%, rgba(255, 79, 167, .16), transparent 28%),
    linear-gradient(180deg, #080a12, #030409 70%);
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  opacity: .12;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.game-shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 38px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--cyan);
  letter-spacing: .22em;
  font-size: 11px;
  font-weight: 800;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(32px, 6vw, 64px);
  line-height: .9;
  letter-spacing: -.055em;
  text-shadow: 0 0 28px rgba(66,232,255,.22);
}

.stat-pill {
  min-width: 120px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  text-align: right;
  backdrop-filter: blur(12px);
}

.stat-pill span, .hud-card span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .11em;
}
.stat-pill strong { font-size: 25px; }

.machine {
  position: relative;
  border: 1px solid rgba(255,255,255,.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.01)),
    var(--panel);
  border-radius: 28px;
  padding: 18px;
  box-shadow:
    0 30px 80px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px);
}

.machine-glow {
  position: absolute;
  inset: -1px;
  z-index: -1;
  border-radius: inherit;
  filter: blur(22px);
  opacity: .25;
  background: linear-gradient(90deg, var(--purple), transparent, var(--cyan));
}

.hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.hud-card {
  min-height: 68px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 16px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
}
.hud-card.center { text-align: center; }
.hud-card strong { font-size: 24px; margin-top: 2px; }

.reels-frame {
  position: relative;
  padding: 10px;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
  background: #050711;
  box-shadow:
    inset 0 0 35px rgba(0,0,0,.8),
    0 0 0 1px rgba(66,232,255,.04);
}

.reels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.reel {
  display: grid;
  grid-template-rows: repeat(3, minmax(95px, 1fr));
  gap: 8px;
}

.symbol {
  position: relative;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.075);
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.07), transparent 38%),
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  font-size: clamp(34px, 6vw, 58px);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  user-select: none;
}

.symbol::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.03);
  pointer-events: none;
}

.symbol.spinning {
  animation: blurSpin .11s linear infinite;
}

.symbol.win {
  z-index: 3;
  transform: translateY(-2px) scale(1.05);
  border-color: rgba(120,255,179,.9);
  box-shadow:
    0 0 0 2px rgba(120,255,179,.15),
    0 0 28px rgba(120,255,179,.28),
    inset 0 0 18px rgba(120,255,179,.06);
  animation: winPulse .7s ease-in-out infinite alternate;
}

.symbol[data-type="wild"] {
  color: var(--pink);
  text-shadow: 0 0 24px rgba(255,79,167,.8);
}

.symbol[data-type="scatter"] {
  color: var(--gold);
  text-shadow: 0 0 24px rgba(255,216,107,.8);
}

@keyframes blurSpin {
  0% { transform: translateY(-3px); filter: blur(1px); opacity: .74; }
  50% { transform: translateY(4px); filter: blur(2px); opacity: .45; }
  100% { transform: translateY(-3px); filter: blur(1px); opacity: .74; }
}

@keyframes winPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.42); }
}

.payline-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.message {
  min-height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 13px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
}

.bet-control {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bet-control > div {
  min-width: 78px;
  text-align: center;
}
.bet-control span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .12em;
}
.bet-control strong { font-size: 20px; }

button {
  border: 0;
  color: white;
  cursor: pointer;
  font: inherit;
}

.bet-control button, .sound-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
}
.bet-control button:hover, .sound-btn:hover { background: rgba(255,255,255,.12); }

.spin-btn {
  width: 150px;
  height: 82px;
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,.36), transparent 34%),
    linear-gradient(135deg, var(--purple), var(--pink));
  box-shadow:
    0 15px 38px rgba(155,92,255,.28),
    inset 0 1px 0 rgba(255,255,255,.45);
  font-weight: 900;
  letter-spacing: .08em;
  transition: transform .14s ease, filter .14s ease;
}
.spin-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.spin-btn:active { transform: translateY(1px) scale(.98); }
.spin-btn:disabled { filter: grayscale(.8) brightness(.55); cursor: not-allowed; transform: none; }
.spin-btn span { display: block; font-size: 25px; }
.spin-btn small { opacity: .6; font-size: 9px; }

.sound-btn { justify-self: end; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  color: var(--muted);
  font-size: 12px;
}
.legend-symbol {
  display: inline-block;
  width: 22px;
  font-size: 18px;
  text-align: center;
  vertical-align: -2px;
}
.legend-symbol.wild { color: var(--pink); }
.legend-symbol.scatter { color: var(--gold); }

footer {
  text-align: center;
  margin-top: 16px;
  color: #686f83;
  font-size: 11px;
}

.win-pop {
  position: fixed;
  left: 50%;
  top: 36%;
  transform: translate(-50%, -50%) scale(.7);
  pointer-events: none;
  opacity: 0;
  z-index: 50;
  font-weight: 1000;
  letter-spacing: -.04em;
  font-size: clamp(42px, 10vw, 88px);
  text-shadow: 0 0 35px rgba(120,255,179,.55);
}

.win-pop.show {
  animation: popWin 1s cubic-bezier(.2,.8,.2,1);
}

@keyframes popWin {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.55); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  70% { opacity: 1; transform: translate(-50%, -52%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -64%) scale(.96); }
}

@media (max-width: 700px) {
  .game-shell { width: min(100% - 14px, 980px); padding-top: 14px; }
  .machine { padding: 10px; border-radius: 20px; }
  .topbar { align-items: center; }
  .stat-pill { min-width: 92px; padding: 9px 11px; }
  .hud-card { min-height: 58px; padding: 9px 10px; }
  .hud-card strong { font-size: 18px; }
  .reels { gap: 4px; }
  .reel { gap: 4px; grid-template-rows: repeat(3, minmax(66px, 1fr)); }
  .symbol { min-height: 72px; border-radius: 11px; font-size: 34px; }
  .controls { grid-template-columns: 1fr auto 1fr; gap: 6px; }
  .spin-btn { width: 112px; height: 70px; border-radius: 22px; }
  .spin-btn span { font-size: 20px; }
  .bet-control { gap: 4px; }
  .bet-control button, .sound-btn { width: 36px; height: 36px; }
  .bet-control > div { min-width: 52px; }
  .legend { font-size: 10px; }
}
