* {
  box-sizing: border-box;
  margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --gold:       #f0a500;
  --gold-light: #ffd055;
  --gold-dark:  #b87800;
  --cream:      #fff8ee;
  --reel-sep:   #d4a017;
  --text:       #f0e8d8;
  --text-dim:   #8899cc;
  --bg-dark:    #030918;
  --row-height: 90px;
  --sym-size:   62px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Preloader ── */
#preloader {
  position: fixed; inset: 0; z-index: 999;
  background: radial-gradient(ellipse at 50% 0%, #1a2f7a 0%, #0a1645 50%, #030918 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.4s;
}
#preloader.fade-out { opacity: 0; pointer-events: none; }

.pre-emoji { font-size: 72px; animation: pre-pulse 1s ease-in-out infinite alternate; }
@keyframes pre-pulse { from { transform: scale(0.9); } to { transform: scale(1.1); } }

.pre-bar {
  width: 200px; height: 6px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px; overflow: hidden;
}
.pre-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light));
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}
.pre-label { color: rgba(255,255,255,0.6); font-size: 13px; letter-spacing: 1px; }

/* ── App ── */
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1a2f7a 0%, #0a1645 50%, #030918 100%);
  overflow: hidden;
}

/* ── Machine ── */
.machine {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, #ffba00 0%, #d47800 100%);
  padding: 6px 6px 0;
}

/* Spotlight glow above reels */
.machine-glow {
  position: absolute;
  top: -30px; left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 80px;
  background: radial-gradient(ellipse, rgba(100,160,255,0.35) 0%, transparent 70%);
  pointer-events: none;
}

.reels-container {
  display: flex;
  gap: 5px;
  background: #f0e0c0;
  border-radius: 6px 6px 0 0;
  padding: 8px 8px 0;
}

.reel-wrap { flex: 1; }

.reel {
  height: calc(var(--row-height) * 3);
  overflow: hidden;
  background: var(--cream);
  border-radius: 4px 4px 0 0;
  border: 1.5px solid #c8960a;
  border-bottom: none;
  position: relative;
}

/* Top/bottom fade */
.reel::before, .reel::after {
  content: '';
  position: absolute; left: 0; right: 0;
  height: calc(var(--row-height) * 0.55);
  z-index: 2; pointer-events: none;
}
.reel::before {
  top: 0;
  background: linear-gradient(to bottom, rgba(255,248,238,0.92) 0%, transparent 100%);
}
.reel::after {
  bottom: 0;
  background: linear-gradient(to top, rgba(255,248,238,0.92) 0%, transparent 100%);
}

.reel-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.sym {
  height: var(--row-height);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--sym-size);
  line-height: 1;
  user-select: none;
}

/* Win animation on centre symbols (emoji scale + glow) */
@keyframes sym-win-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); filter: drop-shadow(0 0 10px #ffd700); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 8px #ffd700); }
}
@keyframes sym-win-pulse {
  from { transform: scale(1.15); filter: drop-shadow(0 0 8px  #ffd700); }
  to   { transform: scale(1.25); filter: drop-shadow(0 0 22px #ffe066); }
}
.sym-win {
  animation: sym-win-pop 0.45s ease forwards,
             sym-win-pulse 0.8s ease 0.45s infinite alternate;
}

/* Gold bar at bottom of reel area */
.machine-bottom-bar {
  height: 8px;
  background: linear-gradient(90deg, #b87800, #ffd055, #b87800);
  margin: 0 8px;
}

/* Win line */
.win-line {
  position: absolute;
  left: 8px; right: 8px;
  top: calc(6px + 8px + var(--row-height));
  height: var(--row-height);
  border-top: 2px solid rgba(240,165,0,0.5);
  border-bottom: 2px solid rgba(240,165,0,0.5);
  pointer-events: none;
  z-index: 1;
}
.win-line.glow {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(240,165,0,0.9), inset 0 0 12px rgba(240,165,0,0.15);
}

/* ── Result ── */
.result-box {
  min-height: 34px;
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 0 12px;
}
.result-text {
  font-size: 18px; font-weight: 700; text-align: center;
  opacity: 0; transform: scale(0.8);
  transition: opacity 0.3s, transform 0.3s;
  color: #fff;
}
.result-text.show { opacity: 1; transform: scale(1); }
.result-text.win     { color: #5ddb8a; }
.result-text.lose    { color: rgba(255,255,255,0.45); }
.result-text.jackpot { color: var(--gold-light); text-shadow: 0 0 20px var(--gold); }

/* ── Bet buttons ── */
.bet-section { width: 100%; padding: 0 10px; }
.bet-buttons { display: flex; gap: 6px; width: 100%; }

.bet-btn {
  flex: 1; padding: 7px 4px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.bet-btn:active { transform: scale(0.95); }
.bet-btn.active {
  background: rgba(240,165,0,0.2);
  color: var(--gold-light);
  border-color: var(--gold);
}

/* ── Spin area ── */
.spin-area {
  display: flex; align-items: center; justify-content: center;
  width: 100%; flex: 1;
}

.spin-btn {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #3d3d3d, #111111);
  border: 3px solid rgba(255,255,255,0.12);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  box-shadow:
    0 6px 24px rgba(0,0,0,0.7),
    0 2px 6px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.12s, box-shadow 0.12s;
}
.spin-btn svg { fill: white; width: 100%; height: 100%; }
.spin-btn:active {
  transform: scale(0.92);
  box-shadow: 0 2px 10px rgba(0,0,0,0.7);
}
.spin-btn:disabled {
  opacity: 0.4; cursor: not-allowed; transform: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ── Info bar ── */
.info-bar {
  width: 100%;
  display: flex;
  padding: 6px 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.info-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.info-label {
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.8px;
}
.info-val {
  font-size: 16px; font-weight: 700; color: #fff;
}

/* ── Win pulse on reels ── */
@keyframes pulse-win {
  0%,100% { box-shadow: inset 0 0 0 rgba(93,219,138,0), 0 0 0 rgba(93,219,138,0); }
  50%      { box-shadow: inset 0 0 10px rgba(93,219,138,0.3), 0 0 24px rgba(93,219,138,0.7); }
}
@keyframes pulse-jackpot {
  0%,100% { box-shadow: inset 0 0 0 rgba(255,208,85,0), 0 0 0 rgba(255,208,85,0); }
  50%      { box-shadow: inset 0 0 16px rgba(255,208,85,0.4), 0 0 44px rgba(255,208,85,1); }
}
.reel.win-reel     { animation: pulse-win     0.6s ease 0.1s 3; }
.reel.jackpot-reel { animation: pulse-jackpot 0.5s ease 0.1s 6; }
