:root {
  --primary: #FFD700;
  --secondary: #FF8C00;
  --accent: #22c55e;
  --bg-overlay: rgba(0,0,0,0.85);
  --balance-label-color: rgba(255,255,255,0.7);
  --balance-value-color: var(--primary);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a1a;
  color: #fff;
}

.game-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.background-layer {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0;
}

.bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.content-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.logo-section { margin: 8px 0; }

.logo {
  max-width: 160px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(255,215,0,0.3));
}

.heading {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--primary, #FFD700) 0%, var(--secondary, #FFA500) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.stats-bar {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-bottom: 16px;
}

.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,215,0,0.2);
  border-radius: 12px;
  padding: 8px 4px;
  backdrop-filter: blur(8px);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--balance-label-color, rgba(255,255,255,0.5));
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--balance-value-color, var(--primary, #FFD700));
}

.slot-machine {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.slot-frame {
  position: relative;
  background: linear-gradient(180deg, #1a0a3a 0%, #0d0520 100%);
  border: 3px solid color-mix(in srgb, var(--primary, #FFD700) 50%, transparent);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 0 40px color-mix(in srgb, var(--primary, #FFD700) 20%, transparent), inset 0 0 30px rgba(0,0,0,0.5);
  overflow: hidden;
}

.reels-container {
  display: flex;
  gap: 6px;
  position: relative;
}

.reel {
  width: 80px;
  height: 240px;
  overflow: hidden;
  border-radius: 8px;
  position: relative;
  background: url('../images/reel_bg.png') repeat-y center;
  background-size: cover;
  background-color: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
}

.reel-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform, filter;
  transition: opacity 0.15s;
}

.symbol-cell {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.symbol-cell img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.payline {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #FFD700, transparent);
  transform: translateY(-50%);
  pointer-events: none;
  box-shadow: 0 0 10px rgba(255,215,0,0.5);
  z-index: 5;
}

.spin-btn {
  width: 80%;
  max-width: 320px;
  padding: 16px 32px;
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #1a0a00;
  background-color: transparent;
  background-image: var(--action-button-image, none), var(--btn-gradient, linear-gradient(180deg, var(--primary, #FFD700) 0%, var(--secondary, #FF8C00) 100%));
  background-size: cover, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 30px rgba(255,165,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.spin-btn::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
  animation: btnShine 3s infinite;
}

@keyframes btnShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.spin-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 40px rgba(255,165,0,0.7); }
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.spin-btn:disabled::after { display: none; }

.win-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.win-overlay.active { display: flex; }

.win-bg-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-overlay, rgba(0,0,0,0.85));
}

.win-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: var(--win-bg-image-opacity, 0.4);
}

.win-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  max-width: 400px;
  animation: winPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes winPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.win-title {
  font-size: 2.8rem;
  font-weight: 900;
  background: linear-gradient(180deg, var(--primary, #FFD700) 0%, var(--secondary, #FF6B00) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  text-transform: uppercase;
  animation: winGlow 1s infinite alternate;
}

@keyframes winGlow {
  0% { filter: drop-shadow(0 0 10px rgba(255,215,0,0.5)); }
  100% { filter: drop-shadow(0 0 30px rgba(255,215,0,0.8)); }
}

.win-prize {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary, #FFD700);
  text-shadow: 0 0 30px rgba(255,215,0,0.6);
  margin-bottom: 32px;
}

.cta-btn {
  display: inline-block;
  padding: 16px 48px;
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #fff;
  background: linear-gradient(180deg, var(--accent, #22c55e) 0%, color-mix(in srgb, var(--accent, #16a34a) 80%, #000) 100%);
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 6px 30px rgba(34,197,94,0.5);
  transition: all 0.2s;
  animation: ctaPulse 2s infinite;
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 6px 30px rgba(34,197,94,0.5); }
  50% { box-shadow: 0 6px 50px rgba(34,197,94,0.8); }
}

.cta-btn:hover { transform: translateY(-2px); }

.win-particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; }

.particle {
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  animation: particleFall linear forwards;
}

@keyframes particleFall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@media (min-width: 768px) {
  .heading { font-size: 2rem; }
  .reel { width: 100px; height: 300px; }
  .symbol-cell { width: 100px; height: 100px; }
  .symbol-cell img { width: 80px; height: 80px; }
  .logo { max-width: 220px; }
}
