/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-0: #0A0A0A;
  --bg-1: #141414;
  --bg-2: #1A1A1A;
  --gold: #D4AF37;
  --gold-bright: #FFD700;
  --gold-dim: #8B7355;
  --gold-glow: rgba(212, 175, 55, 0.3);
  --ivory: #FFFFF0;
  --text-dim: #999;
  --transition: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { font-size: 16px; }

body {
  background: radial-gradient(ellipse at 50% 30%, var(--bg-2) 0%, var(--bg-0) 70%);
  color: var(--ivory);
  font-family: 'Inter', sans-serif;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ===== Background Particles ===== */
#bg-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== Header ===== */
.header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 3rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.logo-dot {
  color: var(--gold-bright);
  font-size: 1rem;
  text-shadow: 0 0 8px var(--gold-bright);
}

.nav-switch {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.3s ease;
  padding: 0.25rem 0;
  position: relative;
}

.nav-btn:hover { color: var(--gold-dim); }

.nav-btn.active {
  color: var(--gold);
}

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.nav-divider {
  width: 1px;
  height: 14px;
  background: rgba(212, 175, 55, 0.2);
}

/* ===== Main Stage ===== */
.main-stage {
  position: relative;
  z-index: 5;
  height: calc(100vh - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.module {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.module.active {
  display: flex;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Wheel Module ===== */
.wheel-container {
  position: relative;
  width: 360px;
  height: 360px;
}

.wheel-glow {
  position: absolute;
  inset: -40px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 60%);
  filter: blur(30px);
  animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.wheel-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 24px solid var(--gold);
  z-index: 20;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.wheel-rim {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #2A2A2A, #3A3A3A, #2A2A2A, #3A3A3A, #2A2A2A, #3A3A3A, #2A2A2A, #3A3A3A, #2A2A2A);
  padding: 8px;
  box-shadow:
    0 0 0 2px var(--gold-dim),
    0 0 30px rgba(212, 175, 55, 0.15),
    inset 0 2px 8px rgba(0,0,0,0.5);
}

.wheel-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-bright), var(--gold), var(--gold-dim));
  box-shadow: 0 2px 8px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.3);
  z-index: 15;
}

.wheel-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.result-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.result-amount {
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--gold-bright);
  text-shadow: 0 0 20px var(--gold-glow);
}

.spin-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 30% 30%, rgba(212,175,55,0.2), rgba(10,10,10,0.8));
  color: var(--gold);
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s var(--transition);
  position: relative;
  overflow: hidden;
}

.spin-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px var(--gold-glow);
  background: radial-gradient(circle at 30% 30%, rgba(212,175,55,0.35), rgba(10,10,10,0.8));
}

.spin-btn:active {
  transform: scale(0.95);
}

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

.spin-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, var(--gold), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.spin-btn:hover::before { opacity: 0.3; }

/* ===== Ball Module ===== */
.ball-machine {
  position: relative;
  width: 320px;
  height: 380px;
}

.machine-glow {
  position: absolute;
  inset: -30px;
  background: radial-gradient(ellipse, var(--gold-glow) 0%, transparent 60%);
  filter: blur(25px);
  animation: pulseGlow 4s ease-in-out infinite;
}

.ball-chamber {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 280px;
  border-radius: 50% 50% 45% 45%;
  background: linear-gradient(180deg, rgba(26,26,26,0.9), rgba(10,10,10,0.95));
  border: 2px solid var(--gold-dim);
  box-shadow:
    0 0 30px rgba(212, 175, 55, 0.1),
    inset 0 4px 12px rgba(0,0,0,0.6);
  overflow: hidden;
}

.ball-spout {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 100px;
  background: linear-gradient(180deg, rgba(26,26,26,0.9), rgba(10,10,10,0.95));
  border: 2px solid var(--gold-dim);
  border-top: none;
  border-radius: 0 0 40px 40px;
}

.ball-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.result-activity {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--gold-bright);
  text-shadow: 0 0 15px var(--gold-glow);
  max-width: 400px;
  text-align: center;
}

.lever-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.lever-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 40px;
  height: 80px;
  background: linear-gradient(180deg, rgba(26,26,26,0.6), rgba(10,10,10,0.8));
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}

.lever-ball {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-bright), var(--gold), var(--gold-dim));
  box-shadow: 0 0 10px var(--gold-glow);
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  transition: top 0.3s var(--transition);
}

.lever-btn:hover .lever-ball {
  top: 46px;
}

.lever-label {
  font-size: 0.75rem;
  color: var(--gold-dim);
  letter-spacing: 0.2em;
}

/* ===== Footer ===== */
.footer {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 10;
}

.footer-line {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.footer-text {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* ===== Explosion Canvas ===== */
.explosion-canvas {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

/* ===== Animations ===== */
@keyframes resultReveal {
  0% { opacity: 0; transform: scale(0.5); }
  50% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

.result-reveal {
  animation: resultReveal 0.6s var(--transition);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .wheel-container {
    width: 280px;
    height: 280px;
  }

  .ball-machine {
    width: 260px;
    height: 320px;
  }

  .ball-chamber {
    width: 220px;
    height: 220px;
  }

  .result-amount { font-size: 2rem; }
  .result-activity { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
