/* ========================================
   Wealth Rush - 财富夺宝
   PG Soft Style Luxury Slot Game
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  --bg-deep: #0a0a1a;
  --bg-mid: #12082a;
  --bg-surface: #1a0a2e;
  --gold: #FFD700;
  --gold-light: #FFF2A0;
  --gold-dark: #C0A040;
  --gold-glow: rgba(255, 215, 0, 0.5);
  --bronze: #C0A060;
  --scatter-red: #ff2040;
  --scatter-dark: #cc0020;
  --wild-green: #00e080;
  --wild-dark: #00b060;
  --cell-bg: rgba(255, 255, 255, 0.04);
  --cell-border: rgba(255, 215, 0, 0.12);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-dim: rgba(255, 255, 255, 0.35);
  --font-title: 'Playfair Display', Georgia, serif;
  --font-number: 'Orbitron', monospace;
  --font-body: 'Noto Sans SC', system-ui, sans-serif;
  --grid-cols: 5;
  --grid-rows: 6;
  --grid-gap: 4px;
  /* Cell size: dynamically fill available space.
     Width constraint: fit 5 cols within ~92% of viewport width.
     Height constraint: fit 6 rows within ~55% of viewport height.
     Take the smaller to maintain square-ish cells. */
  --cell-w: calc((92vw - 4 * var(--grid-gap)) / 5);
  --cell-h: calc((55dvh - 5 * var(--grid-gap)) / 6);
  --cell-size: min(var(--cell-w), var(--cell-h));
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--font-body);
  color: var(--text-primary);
  user-select: none;
  -webkit-user-select: none;
}

/* --- Game Container --- */
#game-container {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: linear-gradient(175deg, var(--bg-deep) 0%, var(--bg-mid) 40%, var(--bg-surface) 100%);
  overflow: hidden;
}

/* --- Background Glows --- */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  width: 300px;
  height: 300px;
  top: -80px;
  left: -60px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.08), transparent 70%);
}
.bg-glow-2 {
  width: 250px;
  height: 250px;
  bottom: 10%;
  right: -50px;
  background: radial-gradient(circle, rgba(160, 80, 255, 0.06), transparent 70%);
}

/* --- Header --- */
#game-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  flex-shrink: 0;
}

.title-section {
  text-align: left;
}

.game-title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: clamp(20px, 5.5vw, 28px);
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  line-height: 1.1;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.3));
}

.game-subtitle {
  font-size: 10px;
  color: var(--gold-dark);
  letter-spacing: 6px;
  margin-top: 2px;
  opacity: 0.7;
}

.stats-section {
  display: flex;
  gap: 8px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 8px;
  padding: 6px 12px;
}

.stat-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-family: var(--font-number);
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 700;
  color: var(--gold);
}

/* --- Win Display --- */
#win-display {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 6px 0;
  flex-shrink: 0;
  transition: opacity 0.3s;
}

#win-display.hidden {
  display: none;
}

.win-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-right: 8px;
}

.win-amount {
  font-family: var(--font-number);
  font-size: clamp(18px, 5vw, 26px);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
}

/* --- Free Spins Banner --- */
#fs-banner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 6px 16px;
  flex-shrink: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
  border-top: 1px solid rgba(255, 215, 0, 0.2);
  border-bottom: 1px solid rgba(255, 215, 0, 0.2);
  transition: opacity 0.3s;
}

#fs-banner.hidden {
  display: none;
}

.fs-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 700;
}

.fs-icon {
  font-size: 16px;
  animation: star-pulse 1s ease-in-out infinite;
}

.fs-count {
  font-family: var(--font-number);
  font-size: 18px;
  color: var(--gold-light);
  min-width: 24px;
  text-align: center;
}

.fs-total {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 8px;
}

.fs-total span {
  font-family: var(--font-number);
  color: var(--gold);
}

@keyframes star-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* --- Grid Wrapper --- */
#grid-wrapper {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  min-height: 0;
  /* Ensure this area takes up the bulk of remaining space */
  max-height: 65dvh;
}

.grid-border-glow {
  position: absolute;
  inset: 4px;
  border-radius: 14px;
  border: 1px solid rgba(255, 215, 0, 0.08);
  box-shadow:
    inset 0 0 30px rgba(255, 215, 0, 0.03),
    0 0 20px rgba(255, 215, 0, 0.05);
  pointer-events: none;
  z-index: 1;
}

/* --- Grid Container --- */
#grid-container {
  display: grid;
  grid-template-columns: repeat(5, var(--cell-size));
  grid-template-rows: repeat(6, var(--cell-size));
  gap: var(--grid-gap);
  position: relative;
  z-index: 2;
}

/* --- Reel & Cell --- */
/* Each reel is a sub-grid spanning 1 column x 6 rows of the parent grid */
.reel {
  display: grid;
  grid-template-rows: repeat(6, var(--cell-size));
  gap: var(--grid-gap);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cell-bg);
  border: 1px solid var(--cell-border);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.cell .symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 1;
  transition: transform 0.3s var(--bounce);
}

.cell .symbol img {
  width: 90%;
  height: 90%;
  object-fit: cover;
  border-radius: 10px;
  user-select: none;
  -webkit-user-drag: none;
}

.cell.spinning .symbol {
  animation: symbol-scroll 0.08s linear infinite;
}

.cell.bounce .symbol {
  animation: symbol-bounce 0.45s var(--bounce) forwards;
}

/* Win highlight */
.cell.win-cell {
  border-color: var(--gold);
  box-shadow:
    0 0 8px var(--gold-glow),
    0 0 16px rgba(255, 215, 0, 0.2),
    inset 0 0 8px rgba(255, 215, 0, 0.1);
  animation: win-pulse 0.7s ease-in-out infinite;
  background: rgba(255, 215, 0, 0.08);
}

.cell.scatter-win {
  border-color: var(--scatter-red);
  box-shadow:
    0 0 8px rgba(255, 32, 64, 0.5),
    0 0 16px rgba(255, 32, 64, 0.2),
    inset 0 0 8px rgba(255, 32, 64, 0.1);
  animation: scatter-pulse 0.7s ease-in-out infinite;
  background: rgba(255, 32, 64, 0.08);
}

/* Symbol type backgrounds */
.cell.symbol-wild {
  background: linear-gradient(135deg, rgba(0, 224, 128, 0.08), rgba(0, 176, 96, 0.04));
  border-color: rgba(0, 224, 128, 0.25);
}

.cell.symbol-scatter {
  background: linear-gradient(135deg, rgba(255, 32, 64, 0.08), rgba(204, 0, 32, 0.04));
  border-color: rgba(255, 32, 64, 0.25);
}

/* --- Animations --- */
@keyframes symbol-scroll {
  0% { transform: translateY(-40%); opacity: 0.5; }
  50% { opacity: 1; }
  100% { transform: translateY(40%); opacity: 0.5; }
}

@keyframes symbol-bounce {
  0% { transform: translateY(-20%) scale(0.92); }
  50% { transform: translateY(4%) scale(1.04); }
  75% { transform: translateY(-2%) scale(0.99); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes win-pulse {
  0%, 100% {
    box-shadow:
      0 0 8px var(--gold-glow),
      0 0 16px rgba(255, 215, 0, 0.2),
      inset 0 0 8px rgba(255, 215, 0, 0.1);
  }
  50% {
    box-shadow:
      0 0 14px var(--gold-glow),
      0 0 28px rgba(255, 215, 0, 0.35),
      inset 0 0 14px rgba(255, 215, 0, 0.2);
  }
}

@keyframes scatter-pulse {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(255, 32, 64, 0.5),
      0 0 16px rgba(255, 32, 64, 0.2);
  }
  50% {
    box-shadow:
      0 0 14px rgba(255, 32, 64, 0.7),
      0 0 28px rgba(255, 32, 64, 0.35);
  }
}

/* --- Controls --- */
#controls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 14px;
  flex-shrink: 0;
  gap: 10px;
}

.bet-section {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.06);
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.ctrl-btn:active {
  transform: scale(0.92);
  background: rgba(255, 215, 0, 0.15);
}

.bet-btn {
  font-weight: 700;
  font-size: 20px;
}

.bet-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 8px;
  padding: 4px 14px;
  min-width: 70px;
}

.bet-label {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.bet-amount {
  font-family: var(--font-number);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

/* Spin Button */
.spin-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  background: linear-gradient(145deg, #2a1a00, #1a0a00);
  color: var(--gold);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.2),
    0 0 40px rgba(255, 215, 0, 0.1),
    inset 0 1px 0 rgba(255, 215, 0, 0.2);
  transition: all 0.2s;
  flex-shrink: 0;
}

.spin-btn:active:not(:disabled) {
  transform: scale(0.93);
  box-shadow:
    0 0 10px rgba(255, 215, 0, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.spin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--bronze);
}

.spin-text {
  font-family: var(--font-number);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
}

.spin-sub {
  font-size: 9px;
  opacity: 0.7;
  margin-top: 1px;
}

/* Info Button */
.info-btn {
  font-size: 16px;
}

.info-label {
  font-size: 8px;
  margin-top: 1px;
}

/* --- Overlays (shared) --- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlay-in 0.3s ease-out;
}

.overlay.hidden {
  display: none;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Free Spins Trigger Overlay --- */
.fs-trigger-content {
  text-align: center;
  animation: fs-trigger-pop 0.6s var(--bounce) forwards;
}

@keyframes fs-trigger-pop {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.fs-flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.4), transparent 70%);
  animation: flash-out 0.8s ease-out forwards;
  pointer-events: none;
}

@keyframes flash-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.fs-trigger-title {
  font-family: var(--font-title);
  font-size: clamp(36px, 10vw, 52px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 20px rgba(255, 215, 0, 0.5));
  letter-spacing: 3px;
}

.fs-trigger-sub {
  font-size: 16px;
  color: var(--gold-dark);
  margin-top: 4px;
  letter-spacing: 4px;
}

.fs-trigger-count {
  font-family: var(--font-number);
  font-size: clamp(64px, 18vw, 96px);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(255, 215, 0, 0.3);
  margin: 16px 0;
  animation: count-glow 1.5s ease-in-out infinite;
}

@keyframes count-glow {
  0%, 100% { text-shadow: 0 0 40px var(--gold-glow), 0 0 80px rgba(255, 215, 0, 0.3); }
  50% { text-shadow: 0 0 60px var(--gold-glow), 0 0 120px rgba(255, 215, 0, 0.5); }
}

.fs-trigger-hint {
  font-size: 14px;
  color: var(--text-secondary);
}

/* --- Celebration Overlay --- */
#celebration-overlay {
  background: rgba(5, 2, 15, 0.92);
}

#celebration-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.celebration-content {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: celeb-pop 0.8s var(--bounce) forwards;
}

@keyframes celeb-pop {
  0% { transform: scale(0) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.celeb-title {
  font-family: var(--font-title);
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 4px 30px rgba(255, 215, 0, 0.6));
  letter-spacing: 4px;
  animation: celeb-title-glow 2s ease-in-out infinite;
}

@keyframes celeb-title-glow {
  0%, 100% { filter: drop-shadow(0 4px 30px rgba(255, 215, 0, 0.6)); }
  50% { filter: drop-shadow(0 4px 50px rgba(255, 215, 0, 0.9)); }
}

.celeb-amount-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 20px 0 8px;
}

.celeb-currency {
  font-family: var(--font-number);
  font-size: clamp(24px, 6vw, 36px);
  color: var(--gold);
}

.celeb-amount {
  font-family: var(--font-number);
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 900;
  color: var(--gold-light);
  text-shadow: 0 0 30px var(--gold-glow);
}

.celeb-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.celeb-btn {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none;
  border-radius: 8px;
  padding: 14px 40px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
  transition: all 0.2s;
}

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

/* --- Paytable Overlay --- */
.paytable-panel {
  width: 90%;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  background: linear-gradient(175deg, #1a1030, #0d0820);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  padding: 24px 20px;
  animation: panel-slide-up 0.4s ease-out;
}

@keyframes panel-slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.paytable-title {
  font-family: var(--font-title);
  font-size: 22px;
  color: var(--gold);
  text-align: center;
  margin-bottom: 20px;
  letter-spacing: 2px;
}

.paytable-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.pay-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
}

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

.pay-symbol img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
}

.pay-name {
  font-size: 13px;
  color: var(--text-secondary);
  width: 50px;
  flex-shrink: 0;
}

.pay-values {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.pay-tag {
  font-family: var(--font-number);
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 215, 0, 0.08);
  color: var(--gold);
  white-space: nowrap;
}

.paytable-rules {
  border-top: 1px solid rgba(255, 215, 0, 0.1);
  padding-top: 16px;
  margin-bottom: 16px;
}

.paytable-rules h3 {
  font-size: 14px;
  color: var(--gold);
  margin-bottom: 10px;
}

.paytable-rules ul {
  list-style: none;
  padding: 0;
}

.paytable-rules li {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
  padding-left: 14px;
  position: relative;
  line-height: 1.5;
}

.paytable-rules li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-dark);
}

.paytable-close {
  display: block;
  width: 100%;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.paytable-close:active {
  background: rgba(255, 215, 0, 0.15);
  transform: scale(0.98);
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Auth Overlay --- */
.auth-panel {
  position: relative;
  width: 88%;
  max-width: 360px;
  background: linear-gradient(175deg, #1a1030, #0d0820);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  padding: 28px 24px 24px;
  animation: panel-slide-up 0.4s ease-out;
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.auth-close:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.9);
}

.auth-icon {
  font-size: 48px;
  text-align: center;
  margin-bottom: 12px;
  animation: celeb-pop 0.6s var(--bounce) forwards;
}

.auth-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  margin-bottom: 6px;
}

.auth-desc {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-label {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.auth-input {
  width: 100%;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input::placeholder {
  color: var(--text-dim);
}

.auth-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.1);
}

.auth-submit {
  width: 100%;
  padding: 14px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.25);
  transition: all 0.2s;
  margin-top: 4px;
}

.auth-submit:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
  margin-left: 4px;
}

.auth-switch a:active {
  opacity: 0.7;
}

/* --- Deposit Overlay --- */
.deposit-panel {
  position: relative;
  width: 88%;
  max-width: 360px;
  background: linear-gradient(175deg, #1a1030, #0d0820);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  padding: 28px 24px 24px;
  animation: panel-slide-up 0.4s ease-out;
  text-align: center;
}

.deposit-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: celeb-pop 0.6s var(--bounce) forwards;
}

.deposit-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 10px;
}

.deposit-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.deposit-desc strong {
  color: var(--gold);
  font-size: 18px;
}

.deposit-amount-box {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 10px;
  padding: 14px 28px;
  margin-bottom: 20px;
}

.deposit-currency {
  font-family: var(--font-number);
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.deposit-value {
  font-family: var(--font-number);
  font-size: 32px;
  font-weight: 900;
  color: var(--gold);
}

.deposit-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
}

.deposit-benefits li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  line-height: 1.5;
}

.deposit-benefits li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--wild-green);
  font-weight: 700;
}

.deposit-submit {
  width: 100%;
  padding: 14px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 215, 0, 0.25);
  transition: all 0.2s;
}

.deposit-submit:active {
  transform: scale(0.97);
}

.deposit-note {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 12px;
}

/* --- Responsive --- */
@media (max-height: 680px) {
  :root {
    --cell-h: calc((50dvh - 5 * var(--grid-gap)) / 6);
  }
  #game-header { padding: 8px 12px 4px; }
  .game-title { font-size: 18px; }
  #controls { padding: 6px 12px 10px; }
  .spin-btn { width: 60px; height: 60px; }
}

@media (max-height: 580px) {
  :root {
    --cell-h: calc((45dvh - 5 * var(--grid-gap)) / 6);
    --grid-gap: 3px;
  }
  .game-subtitle { display: none; }
  #game-header { padding: 6px 10px 2px; }
  #controls { padding: 4px 10px 8px; }
  .spin-btn { width: 54px; height: 54px; }
}

@media (min-width: 431px) {
  #game-container {
    border-left: 1px solid rgba(255, 215, 0, 0.08);
    border-right: 1px solid rgba(255, 215, 0, 0.08);
  }
}

/* --- Scrollbar (paytable) --- */
.paytable-panel::-webkit-scrollbar {
  width: 4px;
}
.paytable-panel::-webkit-scrollbar-track {
  background: transparent;
}
.paytable-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.2);
  border-radius: 2px;
}

/* ============================================
   RED ENVELOPE POPUP
   ============================================ */
#redenvelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: reOverlayIn 0.4s ease;
}
#redenvelope-overlay.hidden {
  display: none;
}
#redenvelope-overlay.re-claiming {
  pointer-events: none;
}
#redenvelope-overlay.re-claiming .redenvelope-wrapper {
  animation: reClaimOut 0.8s ease forwards;
}

.redenvelope-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  animation: reFloatIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.redenvelope-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 50, 50, 0.4) 0%, transparent 70%);
  animation: reGlowPulse 2s ease-in-out infinite;
  pointer-events: none;
}

.redenvelope-body {
  position: relative;
  width: 220px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(255, 50, 50, 0.5),
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.3s ease;
}
.redenvelope-wrapper:hover .redenvelope-body {
  transform: scale(1.05);
}
.redenvelope-wrapper:active .redenvelope-body {
  transform: scale(0.97);
}

.redenvelope-top {
  position: relative;
  background: linear-gradient(180deg, #e63232 0%, #cc1a1a 60%, #b01010 100%);
  padding: 28px 20px 40px;
  text-align: center;
}

.redenvelope-gold-trim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #FFD700, transparent);
}

.redenvelope-label {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #FFD700;
  letter-spacing: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  margin-bottom: 12px;
}

.redenvelope-amount {
  font-family: 'Orbitron', monospace;
  font-size: 56px;
  font-weight: 900;
  color: #FFD700;
  line-height: 1;
  text-shadow:
    0 0 20px rgba(255, 215, 0, 0.6),
    0 2px 8px rgba(0, 0, 0, 0.5);
  margin-bottom: 8px;
}
.redenvelope-currency {
  font-size: 32px;
  vertical-align: super;
  margin-right: 2px;
}

.redenvelope-desc {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 13px;
  color: rgba(255, 215, 0, 0.8);
  letter-spacing: 1px;
}

.redenvelope-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFD700 0%, #F0A000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(255, 215, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  z-index: 2;
  animation: reSealPulse 1.5s ease-in-out infinite;
}
.redenvelope-seal span {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 22px;
  font-weight: 900;
  color: #8B0000;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.redenvelope-bottom {
  position: relative;
  background: linear-gradient(180deg, #b01010 0%, #8a0a0a 100%);
  padding: 40px 20px 24px;
  text-align: center;
}

.redenvelope-pattern {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 8px,
      rgba(255, 215, 0, 0.04) 8px,
      rgba(255, 215, 0, 0.04) 10px
    );
  pointer-events: none;
}

.redenvelope-hint {
  margin-top: 20px;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px;
  color: rgba(255, 215, 0, 0.7);
  letter-spacing: 2px;
  animation: reHintBlink 1.5s ease-in-out infinite;
}

/* Red Envelope Animations */
@keyframes reFloatIn {
  0% { opacity: 0; transform: scale(0.5) translateY(60px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes reOverlayIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes reGlowPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}
@keyframes reSealPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 20px rgba(255,215,0,0.4); }
  50% { transform: translate(-50%, -50%) scale(1.08); box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 30px rgba(255,215,0,0.6); }
}
@keyframes reHintBlink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
@keyframes reClaimOut {
  0% { opacity: 1; transform: scale(1); }
  30% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(0.3) translateY(-100px); }
}

/* Claimed success flash */
.redenvelope-claimed-flash {
  position: fixed;
  inset: 0;
  z-index: 9001;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
  animation: reFlash 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes reFlash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
