/**
 * Gates of Hades - Main Stylesheet
 * Dark theme with responsive design using viewport units
 */

/* CSS Variables */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --text-primary: #eee;
  --text-secondary: #aaa;
  --accent-gold: #ffd700;
  --accent-red: #e94560;
  --accent-purple: #9b59b6;
  --win-glow: #00ff88;
  --cell-bg: #252545;
  --cell-border: #3a3a5a;
  --button-primary: #e94560;
  --button-secondary: #0f3460;
  --multiplier-glow: #ff6b6b;
}

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

html, body {
  height: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  /* background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%); */
  background: #000;
  color: var(--text-primary);
  overflow-x: hidden;
}

/* Main Container */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 2vmin;
  gap: 2vmin;
}

/* Header */
.header {
  text-align: center;
  width: 100%;
  max-width: 90vmin;
}

.game-title {
  font-size: clamp(1.5rem, 5vmin, 2.5rem);
  color: var(--accent-gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  margin-bottom: 1vmin;
  letter-spacing: 2px;
}

.balance-display {
  font-size: clamp(1rem, 3vmin, 1.5rem);
  color: var(--text-secondary);
}

.balance-amount {
  color: var(--accent-gold);
  font-weight: bold;
}

/* Multiplier Buckets */
.multiplier-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1vmin;
  width: 100%;
  max-width: 70vmin;
}

.multiplier-bucket {
  background: var(--bg-tertiary);
  border: 2px solid var(--cell-border);
  border-radius: 8px;
  padding: 1.5vmin;
  text-align: center;
  font-size: clamp(0.8rem, 2.5vmin, 1.2rem);
  font-weight: bold;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.multiplier-bucket.active {
  color: var(--multiplier-glow);
  border-color: var(--multiplier-glow);
  box-shadow: 0 0 15px rgba(255, 107, 107, 0.5);
  text-shadow: 0 0 10px var(--multiplier-glow);
}

/* Game Grid */
.grid-container {
  background: var(--bg-secondary);
  border: 3px solid var(--accent-purple);
  border-radius: 12px;
  padding: 1vmin;
  box-shadow: 0 0 30px rgba(155, 89, 182, 0.3);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.8vmin;
  width: 70vmin;
  height: 70vmin;
  max-width: 500px;
  max-height: 500px;
}

.grid-cell {
  background: var(--cell-bg);
  border: 2px solid var(--cell-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.5rem, 5vmin, 3rem);
  transition: all 0.3s ease;
  position: relative;
  cursor: default;
}

.grid-cell:hover {
  border-color: var(--accent-gold);
  transform: scale(1.02);
}

/* Cell States */
.grid-cell.winning {
  animation: winPulse 0.5s ease-in-out infinite alternate;
  border-color: var(--win-glow);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
  z-index: 10;
}

.grid-cell.tumbling {
  animation: tumbleFade 0.3s ease-out forwards;
}

.grid-cell.wild {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.grid-cell.scatter {
  border-color: var(--accent-red);
  box-shadow: 0 0 15px rgba(233, 69, 96, 0.5);
}

/* Wild multiplier overlay */
.wild-multiplier {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: clamp(0.6rem, 1.5vmin, 0.9rem);
  color: var(--accent-gold);
  font-weight: bold;
  text-shadow: 1px 1px 2px #000;
}

/* Animations */
@keyframes winPulse {
  from {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.4);
  }
  to {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.8);
  }
}

@keyframes tumbleFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
}

@keyframes dropIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid-cell.dropping {
  animation: dropIn 0.3s ease-out;
}

/* Controls Section */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 2vmin;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 70vmin;
}

.bet-controls {
  display: flex;
  gap: 2vmin;
  flex-wrap: wrap;
  justify-content: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5vmin;
}

.control-group label {
  font-size: clamp(0.7rem, 2vmin, 0.9rem);
  color: var(--text-secondary);
}

.control-group select {
  padding: 1vmin 2vmin;
  font-size: clamp(0.9rem, 2.5vmin, 1.1rem);
  background: var(--bg-tertiary);
  border: 2px solid var(--cell-border);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 15vmin;
}

.control-group select:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.total-bet {
  font-size: clamp(1rem, 3vmin, 1.3rem);
  color: var(--accent-gold);
  font-weight: bold;
  padding: 1vmin 2vmin;
  background: var(--bg-tertiary);
  border-radius: 8px;
  min-width: 20vmin;
  text-align: center;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 2vmin;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 2vmin 4vmin;
  font-size: clamp(1rem, 3vmin, 1.3rem);
  font-weight: bold;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-spin {
  background: linear-gradient(135deg, var(--button-primary) 0%, #c73e54 100%);
  color: white;
  min-width: 25vmin;
  box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

.btn-spin:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}

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

/* Auto Spin */
.auto-spin-container {
  display: flex;
  align-items: center;
  gap: 0.5vmin;
}

.btn-auto {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, #0a2040 100%);
  color: var(--accent-gold);
  border: 2px solid var(--accent-gold);
  min-width: 15vmin;
}

.btn-auto:hover:not(:disabled) {
  background: linear-gradient(135deg, #153a6a 0%, #0f3460 100%);
  transform: translateY(-2px);
}

.btn-auto.active {
  background: linear-gradient(135deg, var(--accent-red) 0%, #c73e54 100%);
  border-color: var(--accent-red);
  color: white;
  animation: autoPulse 1s ease-in-out infinite;
}

@keyframes autoPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.8);
  }
}

.auto-spin-select {
  padding: 1.5vmin 1vmin;
  font-size: clamp(0.8rem, 2vmin, 1rem);
  background: var(--bg-tertiary);
  border: 2px solid var(--cell-border);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  min-width: 8vmin;
}

.auto-spin-select:focus {
  outline: none;
  border-color: var(--accent-gold);
}

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

.auto-spin-info {
  display: none;
  font-size: clamp(0.8rem, 2vmin, 1rem);
  color: var(--accent-gold);
  background: var(--bg-tertiary);
  padding: 1vmin 2vmin;
  border-radius: 8px;
  border: 1px solid var(--accent-gold);
}

.auto-spin-info.active {
  display: block;
}

.btn-buy {
  background: linear-gradient(135deg, var(--button-secondary) 0%, #0a2040 100%);
  color: var(--accent-gold);
  font-size: clamp(0.7rem, 2vmin, 0.9rem);
  padding: 1.5vmin 3vmin;
  border: 2px solid var(--accent-gold);
}

.btn-buy:hover:not(:disabled) {
  background: linear-gradient(135deg, #153a6a 0%, #0f3460 100%);
  transform: translateY(-2px);
}

.btn-buy.super {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

/* Free Spins Banner */
.free-spins-banner {
  display: none;
  background: linear-gradient(135deg, var(--accent-purple) 0%, #7d3c98 100%);
  padding: 2vmin 4vmin;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 0 30px rgba(155, 89, 182, 0.5);
  animation: bannerPulse 2s ease-in-out infinite;
}

.free-spins-banner.active {
  display: block;
}

.free-spins-banner.super {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b8860b 100%);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.free-spins-banner h3 {
  font-size: clamp(1rem, 3vmin, 1.5rem);
  margin-bottom: 0.5vmin;
}

.free-spins-count {
  font-size: clamp(1.5rem, 4vmin, 2rem);
  font-weight: bold;
}

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

/* Win Display */
.win-display {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  padding: 4vmin 8vmin;
  border-radius: 20px;
  text-align: center;
  z-index: 100;
  border: 3px solid var(--accent-gold);
  box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
}

.win-display.active {
  display: block;
  animation: winPopup 0.5s ease-out;
}

.win-display.big-win {
  border-color: var(--accent-red);
  box-shadow: 0 0 80px rgba(233, 69, 96, 0.7);
}

.win-display h2 {
  font-size: clamp(1.5rem, 5vmin, 2.5rem);
  color: var(--accent-gold);
  margin-bottom: 1vmin;
}

.win-display .win-amount {
  font-size: clamp(2rem, 8vmin, 4rem);
  color: var(--win-glow);
  font-weight: bold;
  text-shadow: 0 0 20px var(--win-glow);
}

.win-display.big-win .win-amount {
  color: var(--accent-red);
  text-shadow: 0 0 30px var(--accent-red);
}

@keyframes winPopup {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Info Panel */
.info-panel {
  display: flex;
  gap: 3vmin;
  font-size: clamp(0.7rem, 2vmin, 0.9rem);
  color: var(--text-secondary);
  flex-wrap: wrap;
  justify-content: center;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 1vmin;
}

/* History Link */
.history-link {
  color: var(--accent-gold);
  text-decoration: none;
  padding: 0.5vmin 1.5vmin;
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  transition: all 0.2s ease;
  font-weight: bold;
}

.history-link:hover {
  background: var(--accent-gold);
  color: var(--bg-primary);
  transform: translateY(-1px);
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  justify-content: center;
  align-items: center;
}

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

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid var(--cell-border);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Toast Messages */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-tertiary);
  padding: 1.5vmin 3vmin;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: clamp(0.9rem, 2.5vmin, 1.1rem);
  z-index: 150;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

/* Responsive Adjustments */
@media (max-width: 600px) {
  .game-grid {
    width: 90vmin;
    height: 90vmin;
  }
  
  .multiplier-row {
    max-width: 90vmin;
  }
  
  .controls {
    max-width: 95vw;
  }
  
  .btn-spin {
    width: 100%;
    max-width: 300px;
  }
}

@media (min-width: 1200px) {
  .game-container {
    padding: 20px;
    gap: 20px;
  }
  
  .game-grid {
    width: 550px;
    height: 550px;
    max-width: 550px;
    max-height: 550px;
  }
  
  .multiplier-row {
    max-width: 550px;
  }
}

/* Paytable Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 300;
  justify-content: center;
  align-items: center;
  padding: 2vmin;
}

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

.modal-content {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 3vmin;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  border: 2px solid var(--accent-purple);
}

.modal-content h2 {
  color: var(--accent-gold);
  margin-bottom: 2vmin;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
}

.modal-close:hover {
  color: var(--accent-red);
}

/* Debug Panel */
.debug-panel {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: var(--bg-tertiary);
  padding: 1vmin 2vmin;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 200px;
}

.debug-panel button {
  margin-top: 5px;
  padding: 5px 10px;
  font-size: 0.7rem;
  background: var(--button-secondary);
  border: 1px solid var(--cell-border);
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 4px;
}

.debug-panel button:hover {
  background: var(--accent-red);
}
