/* ========================================
   MerryPlayValley — Game Page Styles
   ======================================== */

.game-page {
  padding: calc(var(--header-height) + var(--topbar-height) + 24px) 0 80px;
  min-height: 100vh;
}

.game-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* --- Game Container --- */
.game-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.game-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.game-mode-switch {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  padding: 4px;
  border: 1px solid var(--border-color);
}

.game-mode-switch button {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.game-mode-switch button.active {
  background: var(--gold-gradient);
  color: var(--text-inverse);
}

/* --- Slot Machine --- */
.slot-machine {
  background: linear-gradient(180deg, rgba(128, 0, 32, 0.2), rgba(10, 10, 10, 0.5));
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.slot-machine::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

.slot-reels-container {
  position: relative;
  margin-bottom: 16px;
}

/* --- Reels (shared) --- */
.reels {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.reel {
  flex: 1;
  max-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 4px;
  position: relative;
}

.reel::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.reel-symbol {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  transition: transform 0.05s linear;
  position: relative;
}

.reel-symbol.win-highlight {
  animation: winPulse 0.5s ease-in-out 3;
  background: rgba(76, 175, 80, 0.15);
  border: 2px solid var(--green);
  border-radius: var(--radius-sm);
}

@keyframes winPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 80, 0); }
  50% { transform: scale(1.08); box-shadow: 0 0 16px var(--green-glow); }
}

.reel-symbol .symbol-text {
  font-size: 18px;
  font-weight: 900;
  color: #E8C547;
  font-family: var(--font-heading);
}

/* --- Paylines (5-reel) --- */
.payline-indicator {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
  z-index: 5;
}

.payline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.payline-dot.active {
  opacity: 1;
  animation: dotPulse 0.6s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.5); }
}

/* --- Game Controls --- */
.game-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.balance-area {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
}

.balance-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.bet-control {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bet-control button {
  width: 40px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  transition: background var(--transition-fast);
  background: none;
  border: none;
  cursor: pointer;
  min-width: 44px;
}

.bet-control button:hover {
  background: rgba(212, 175, 55, 0.1);
}

.bet-control button:active {
  background: rgba(212, 175, 55, 0.2);
}

.bet-display {
  padding: 0 16px;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 16px;
  min-width: 50px;
  text-align: center;
  user-select: none;
}

.spin-btn {
  background: var(--gold-gradient);
  color: var(--text-inverse);
  font-weight: 800;
  font-size: 18px;
  padding: 14px 40px;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  border: none;
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(212, 175, 55, 0.4);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

/* --- Game Info --- */
.game-info {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 24px;
}

.game-info h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  margin-bottom: 16px;
  font-family: var(--font-body);
}

.paytable {
  width: 100%;
  border-collapse: collapse;
}

.paytable th,
.paytable td {
  padding: 8px 12px;
  text-align: center;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.paytable th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.paytable td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
}

.paytable .symbol-cell {
  font-size: 24px;
}

.paytable .payout-cell {
  color: var(--gold);
  font-weight: 700;
}

/* --- Win Display --- */
.win-display {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.win-display.win-animation {
  animation: winPopIn 0.4s ease;
}

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

/* --- Free Spins Indicator --- */
.free-spins-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green);
  color: var(--text-inverse);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  animation: pulse 1s ease-in-out infinite;
}

/* --- Sidebar --- */
.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.sidebar-panel h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  margin-bottom: 16px;
  font-family: var(--font-body);
}

/* --- Daily Bonus (in sidebar) --- */
.sidebar-bonus {
  text-align: center;
}

.sidebar-bonus .bonus-amount {
  font-size: 32px;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 12px;
}

.sidebar-bonus .bonus-info {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.sidebar-bonus .claim-btn {
  width: 100%;
}

/* --- History List --- */
.history-list {
  max-height: 320px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

.history-item:last-child {
  border-bottom: none;
}

.history-game {
  color: var(--text-primary);
  font-weight: 600;
}

.history-detail {
  color: var(--text-muted);
  font-size: 11px;
}

.history-bet {
  color: var(--text-secondary);
  white-space: nowrap;
}

.history-result {
  font-weight: 700;
  white-space: nowrap;
}

.history-result.win {
  color: var(--green);
}

.history-result.loss {
  color: var(--red);
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
  font-size: 14px;
}

/* --- Game Disclaimer --- */
.game-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0 0;
  line-height: 1.5;
}

/* ========================================
   Game Media Queries
   ======================================== */

@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .game-page {
    padding-top: calc(var(--header-height) + var(--topbar-height) + 16px);
  }

  .game-container {
    padding: 16px;
  }

  .game-sidebar {
    grid-template-columns: 1fr;
  }

  .reels {
    gap: 4px;
  }

  .reel {
    gap: 4px;
    padding: 2px;
  }

  .reel-symbol {
    font-size: 28px;
  }

  .reel-symbol .symbol-text {
    font-size: 12px;
  }

  .game-controls {
    gap: 8px;
  }

  .spin-btn {
    font-size: 15px;
    padding: 12px 28px;
    order: 3;
    width: 100%;
  }

  .win-display {
    font-size: 22px;
    min-height: 36px;
    order: 4;
    width: 100%;
  }

  .game-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .balance-area {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .bet-control {
    justify-content: center;
  }

  .game-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .paytable th,
  .paytable td {
    padding: 6px 8px;
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .slot-machine {
    padding: 12px;
  }

  .reel-symbol {
    font-size: 22px;
  }
}
