/* CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Rajdhani', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
  animation: backgroundFlow 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes backgroundFlow {
  0%, 100% { 
    transform: translateX(0%) rotate(0deg); 
    opacity: 0.5;
  }
  50% { 
    transform: translateX(5%) rotate(2deg); 
    opacity: 0.8;
  }
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

/* Header Styles */
.game-header {
  text-align: center;
  margin-bottom: 2rem;
}

#result {
  font-family: 'Orbitron', monospace;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 900;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease-in-out infinite;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
  margin-bottom: 1rem;
  letter-spacing: 2px;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.game-subtitle {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 300;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Game Board */
.game-board {
  display: flex;
  align-items: center;
  gap: 3rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0;
}

/* Player Styles */
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  min-width: 280px;
}

.player:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.player-info h2 {
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  margin-bottom: 1rem;
}

.score-display {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.score-label {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.score {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  font-weight: 700;
  color: #4ecdc4;
  text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
  min-width: 2rem;
  text-align: center;
}

/* Dice Container */
.dice-container {
  position: relative;
  perspective: 1000px;
}

.dice-img {
  width: 120px;
  height: 120px;
  border-radius: 15px;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.4),
    inset 0 2px 10px rgba(255, 255, 255, 0.2);
  transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.dice-img:hover {
  transform: rotateY(15deg) rotateX(15deg) scale(1.05);
}

.dice-glow {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  border-radius: 25px;
  opacity: 0;
  z-index: -1;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(1.1); }
}

/* VS Divider */
.vs-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.vs-text {
  font-family: 'Orbitron', monospace;
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 
    0 0 20px rgba(255, 255, 255, 0.5),
    0 0 40px rgba(255, 255, 255, 0.3);
  animation: vsGlow 2s ease-in-out infinite;
}

@keyframes vsGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
  50% { text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 40px rgba(255, 255, 255, 0.5); }
}

.lightning {
  font-size: 2rem;
  animation: lightning 1.5s ease-in-out infinite;
}

@keyframes lightning {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Controls */
.controls {
  display: flex;
  gap: 2rem;
  margin: 2rem 0;
  flex-wrap: wrap;
  justify-content: center;
}

.roll-btn, .reset-btn {
  position: relative;
  padding: 1rem 2.5rem;
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 180px;
}

.roll-btn {
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  color: white;
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.reset-btn {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.roll-btn:hover, .reset-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}

.roll-btn:active, .reset-btn:active {
  transform: translateY(0);
}

.btn-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
}

.roll-btn:hover .btn-glow {
  left: 100%;
}

/* Game Stats */
.game-stats {
  display: flex;
  gap: 3rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.stat-value {
  font-family: 'Orbitron', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #4ecdc4;
  text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

/* Dice Rolling Animation */
.rolling {
  animation: diceRoll 1s ease-in-out;
}

@keyframes diceRoll {
  0% { transform: rotateX(0) rotateY(0); }
  25% { transform: rotateX(90deg) rotateY(90deg) scale(1.1); }
  50% { transform: rotateX(180deg) rotateY(180deg) scale(1.2); }
  75% { transform: rotateX(270deg) rotateY(270deg) scale(1.1); }
  100% { transform: rotateX(360deg) rotateY(360deg) scale(1); }
}

/* Winner Highlight */
.winner {
  animation: winnerGlow 1s ease-in-out;
}

@keyframes winnerGlow {
  0%, 100% { 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
    transform: scale(1.02);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container { padding: 1rem; }
  
  .game-board {
    flex-direction: column;
    gap: 2rem;
  }
  
  .vs-divider {
    order: 2;
    transform: rotate(90deg);
  }
  
  .player {
    min-width: 250px;
    padding: 1.5rem;
  }
  
  .dice-img {
    width: 100px;
    height: 100px;
  }
  
  .controls {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  
  .game-stats {
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .player {
    min-width: 200px;
    padding: 1rem;
  }
  
  .dice-img {
    width: 80px;
    height: 80px;
  }
  
  .roll-btn, .reset-btn {
    min-width: 150px;
    padding: 0.8rem 2rem;
    font-size: 1rem;
  }
}
