:root {
  --gold: #FFD700;
  --neon-green: #39FF14;
  --neon-blue: #00D4FF;
  --bg-deep: #0A0A12;
  --bg-card: #12121E;
  --bg-panel: #1A1A2E;
  --text: #F0F0FF;
}

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

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Exo 2', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(0,212,255,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(255,0,110,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.star {
  position: absolute; border-radius: 50%; background: white;
  animation: twinkle var(--d) ease-in-out infinite; opacity: 0;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: var(--o); transform: scale(1); }
}

.wrapper {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ── HEADER ── */
header { text-align: center; margin-bottom: 32px; }
.logo {
  font-family: 'Bebas Neue', cursive;
  font-size: clamp(3rem, 10vw, 5.5rem);
  letter-spacing: 4px;
  background: linear-gradient(135deg, var(--gold) 0%, #fff 50%, var(--gold) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  filter: drop-shadow(0 0 20px rgba(255,215,0,0.6));
  animation: logoPulse 3s ease-in-out infinite; line-height: 1;
}
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(255,215,0,0.6)); }
  50% { filter: drop-shadow(0 0 40px rgba(255,215,0,1)); }
}
.tagline { font-size: 0.75rem; letter-spacing: 6px; text-transform: uppercase; color: var(--neon-blue); opacity: 0.8; margin-top: 4px; }
.notice-banner {
  display: inline-block; margin-top: 12px;
  background: rgba(255,0,0,0.15); border: 1px solid rgba(255,0,0,0.4);
  border-radius: 4px; padding: 6px 16px;
  font-size: 0.7rem; letter-spacing: 1px; color: #ff6b6b; text-transform: uppercase;
}

/* ── TICKER ── */
.ticker {
  background: rgba(255,215,0,0.05); border: 1px solid rgba(255,215,0,0.1);
  border-radius: 8px; padding: 10px 16px; margin-bottom: 24px;
  overflow: hidden; white-space: nowrap; font-size: 0.72rem;
  color: rgba(255,215,0,0.6); letter-spacing: 1px;
}
.ticker-inner { display: inline-block; animation: tickerScroll 20s linear infinite; }
@keyframes tickerScroll { from { transform: translateX(100%); } to { transform: translateX(-100%); } }

/* ── BALANCE ── */
.balance-bar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-panel); border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px; padding: 16px 24px; margin-bottom: 24px; gap: 12px;
}
.balance-item { text-align: center; flex: 1; }
.balance-label { font-size: 0.65rem; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,0.4); display: block; margin-bottom: 4px; }
.balance-value { font-family: 'Bebas Neue', cursive; font-size: 1.8rem; color: var(--gold); letter-spacing: 2px; }
.balance-value.win-highlight { color: var(--neon-green); }
.balance-divider { width: 1px; height: 40px; background: rgba(255,215,0,0.15); }

/* ── MACHINE ── */
.machine {
  background: var(--bg-card); border-radius: 20px;
  border: 2px solid rgba(255,215,0,0.25); padding: 28px;
  position: relative; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,215,0,0.05), 0 20px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  margin-bottom: 24px;
}
.machine::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: scanLine 2s linear infinite;
}
@keyframes scanLine { 0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.4; } }

/* ── REELS ── */
.reels-window {
  background: #06060F; border-radius: 12px; border: 2px solid rgba(255,215,0,0.3);
  padding: 12px; margin-bottom: 20px; position: relative; overflow: hidden;
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.8);
}
.reels-window::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.6) 100%);
  pointer-events: none; z-index: 10;
}
.win-line {
  position: absolute; top: 50%; left: 0; right: 0; height: 90px;
  transform: translateY(-50%);
  border-top: 2px solid rgba(255,215,0,0.2); border-bottom: 2px solid rgba(255,215,0,0.2);
  pointer-events: none; z-index: 11; transition: border-color 0.3s;
}
.win-line.active {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(255,215,0,0.4);
  background: rgba(255,215,0,0.03);
  animation: winLinePulse 0.5s ease-in-out infinite;
}
@keyframes winLinePulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255,215,0,0.4); }
  50% { box-shadow: 0 0 40px rgba(255,215,0,0.8); }
}
.reels { display: flex; gap: 8px; }
.reel { flex: 1; height: 90px; overflow: hidden; border-radius: 8px; background: #08080F; position: relative; }
.reel-strip { display: flex; flex-direction: column; will-change: transform; }
.symbol { height: 90px; display: flex; align-items: center; justify-content: center; font-size: 3rem; line-height: 1; flex-shrink: 0; user-select: none; }

/* ── PAYLINES ── */
.paylines { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-bottom: 20px; }
.payline-item {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; padding: 8px 6px; text-align: center;
  font-size: 0.65rem; letter-spacing: 1px; color: rgba(255,255,255,0.4);
}
.payline-item span { display: block; font-size: 1rem; margin-bottom: 2px; }

/* ── CONTROLS ── */
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-bottom: 16px; }
.bet-control {
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,215,0,0.15);
  border-radius: 10px; padding: 12px; text-align: center;
}
.bet-label { font-size: 0.6rem; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,0.35); display: block; margin-bottom: 6px; }
.bet-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.bet-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(255,215,0,0.3); background: rgba(255,215,0,0.08);
  color: var(--gold); font-size: 1rem; cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.bet-btn:hover { background: rgba(255,215,0,0.2); }
.bet-btn.action-btn { width: auto; padding: 4px 10px; border-radius: 6px; font-size: 0.65rem; letter-spacing: 1px; white-space: nowrap; }
.bet-amount { font-family: 'Bebas Neue', cursive; font-size: 1.5rem; color: var(--gold); min-width: 60px; text-align: center; }

/* ── SPIN BUTTON ── */
.spin-btn {
  width: 100px; height: 100px; border-radius: 50%; border: none; cursor: pointer; position: relative;
  background: conic-gradient(from 0deg, #FFD700, #FFA500, #FF6B00, #FFD700);
  box-shadow: 0 0 30px rgba(255,165,0,0.5), 0 0 60px rgba(255,165,0,0.2), inset 0 2px 4px rgba(255,255,255,0.3);
  transition: all 0.15s; animation: rotateBorder 3s linear infinite;
}
@keyframes rotateBorder { to { filter: hue-rotate(360deg); } }
.spin-btn::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #2a2a00, #1a1000); }
.spin-btn::after {
  content: 'SPIN'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', cursive; font-size: 1.3rem; letter-spacing: 3px;
  color: var(--gold); text-shadow: 0 0 10px rgba(255,215,0,0.8);
}
.spin-btn:hover:not(:disabled) { transform: scale(1.05); box-shadow: 0 0 50px rgba(255,165,0,0.8), 0 0 80px rgba(255,165,0,0.3); }
.spin-btn:active:not(:disabled) { transform: scale(0.97); }
.spin-btn:disabled { opacity: 0.6; cursor: not-allowed; animation: none; }
.spin-btn.spinning { animation: spinPulse 0.3s ease-in-out infinite; }
@keyframes spinPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(255,165,0,0.5); }
  50% { box-shadow: 0 0 60px rgba(255,165,0,1), 0 0 100px rgba(255,165,0,0.5); }
}

/* ── RESULT ── */
.result-msg {
  min-height: 50px; display: flex; align-items: center; justify-content: center;
  font-family: 'Bebas Neue', cursive; font-size: 1.6rem; letter-spacing: 4px;
  text-align: center; transition: all 0.3s; color: rgba(255,255,255,0.15);
}
.result-msg.win { color: var(--neon-green); text-shadow: 0 0 20px rgba(57,255,20,0.8); animation: resultBounce 0.5s ease-out; }
.result-msg.big-win { color: var(--gold); text-shadow: 0 0 30px rgba(255,215,0,1); font-size: 2.2rem; animation: resultBounce 0.4s ease-out infinite alternate; }
.result-msg.lose { color: rgba(255,255,255,0.3); font-size: 1rem; letter-spacing: 2px; }
@keyframes resultBounce { from { transform: scale(0.8); opacity: 0.5; } to { transform: scale(1); opacity: 1; } }

/* API status */
.api-status { min-height: 20px; text-align: center; font-size: 0.7rem; color: rgba(255,255,255,0.3); letter-spacing: 2px; }
.api-status.error { color: #ff6b6b; }

/* ── HISTORY ── */
.history-section { background: var(--bg-panel); border-radius: 12px; border: 1px solid rgba(255,255,255,0.06); padding: 16px; margin-bottom: 24px; }
.history-title { font-size: 0.65rem; letter-spacing: 4px; text-transform: uppercase; color: rgba(255,255,255,0.3); margin-bottom: 12px; }
.history-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: rgba(255,215,0,0.2); border-radius: 2px; }
.history-empty { text-align: center; color: rgba(255,255,255,0.2); font-size: 0.75rem; padding: 20px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.02); border-radius: 6px; padding: 8px 12px;
  font-size: 0.8rem; animation: historySlide 0.3s ease-out;
}
@keyframes historySlide { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }
.history-symbols { font-size: 1.1rem; letter-spacing: 4px; }
.history-amount { font-family: 'Bebas Neue', cursive; font-size: 1rem; letter-spacing: 1px; }
.history-amount.win-amt { color: var(--neon-green); }
.history-amount.lose-amt { color: rgba(255,255,255,0.25); }

/* ── WARNING ── */
.warning-box { background: rgba(255,0,0,0.06); border: 1px solid rgba(255,0,0,0.2); border-radius: 12px; padding: 16px 20px; text-align: center; }
.warning-icon { font-size: 1.5rem; margin-bottom: 8px; }
.warning-title { font-family: 'Bebas Neue', cursive; font-size: 1rem; letter-spacing: 3px; color: #ff6b6b; margin-bottom: 6px; }
.warning-text { font-size: 0.72rem; line-height: 1.6; color: rgba(255,255,255,0.4); }
.warning-text strong { color: #ff6b6b; }

/* ── CONFETTI ── */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.confetti-piece {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  animation: confettiFall var(--d) ease-in forwards; top: -10px;
}
@keyframes confettiFall { to { transform: translateY(100vh) rotate(720deg); opacity: 0; } }
