:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #f093fb;
  --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-background: rgba(255, 255, 255, 0.95);
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --success-color: #48bb78;
  --danger-color: #f56565;
  --warning-color: #ed8936;
  --border-radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --card-background: rgba(26, 32, 44, 0.95);
  --text-primary: #f7fafc;
  --text-secondary: #e2e8f0;
  --background-gradient: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--background-gradient);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  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%);
  pointer-events: none;
  z-index: -1;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

#theme-btn {
  background: var(--card-background);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  color: var(--text-primary);
  font-size: 1.2rem;
}

#theme-btn:hover {
  transform: scale(1.1);
}

.game-container {
  background: var(--card-background);
  backdrop-filter: blur(20px);
  padding: 30px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 600px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  margin-bottom: 30px;
}

h1 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stats-summary {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.scoreboard {
  display: flex;
  justify-content: space-between;
  margin-bottom: 30px;
  gap: 15px;
  flex-wrap: wrap;
}

.score-card {
  flex: 1;
  min-width: 120px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border-radius: 12px;
  padding: 15px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition);
}

.score-card:hover {
  transform: translateY(-2px);
}

.score-header {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.score-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.player-card .score-value {
  color: var(--success-color);
}

.computer-card .score-value {
  color: var(--danger-color);
}

.streak-card .score-value {
  color: var(--warning-color);
}

.game-settings {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 15px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.1);
  padding: 15px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.setting-group label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

select {
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: var(--card-background);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

select:hover, select:focus {
  border-color: var(--primary-color);
  outline: none;
}

.reset-btn, .clear-btn, .sound-btn {
  background: linear-gradient(135deg, var(--danger-color), #e53e3e);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 0.9rem;
}

.reset-btn:hover, .clear-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(245, 101, 101, 0.4);
}

.battle-arena {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 30px 0;
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.player-choice-display, .computer-choice-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.choice-preview {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  font-weight: bold;
  transition: var(--transition);
  animation: pulse 2s infinite;
}

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

.vs-indicator {
  font-size: 2rem;
  color: var(--text-primary);
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.choices {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 30px 0;
  flex-wrap: wrap;
}

.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  cursor: pointer;
  transition: var(--transition);
  min-width: 120px;
  position: relative;
  overflow: hidden;
}

.choice-btn::before {
  content: '';
  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.5s;
}

.choice-btn:hover::before {
  left: 100%;
}

.choice-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.choice-btn:active {
  transform: translateY(-2px) scale(1.02);
}

.choice-emoji {
  font-size: 2.5rem;
}

.choice-name {
  font-size: 1rem;
  font-weight: 600;
}

.game-status {
  margin: 20px 0;
  min-height: 40px;
}

.timer, .round-counter {
  display: inline-block;
  background: linear-gradient(135deg, var(--warning-color), #dd6b20);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 1.1rem;
  animation: pulse 1s infinite;
}

.results {
  margin: 30px 0;
}

.result-message {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 15px;
  font-weight: 600;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  backdrop-filter: blur(10px);
}

.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 15px;
}

.achievement {
  background: linear-gradient(135deg, var(--success-color), #38a169);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.history-section {
  margin-top: 30px;
}

.history-section h3 {
  color: var(--text-primary);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.history-log {
  max-height: 150px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  backdrop-filter: blur(10px);
  margin-bottom: 15px;
}

.history-log:empty::before {
  content: "No games played yet. Start playing!";
  color: var(--text-secondary);
  font-style: italic;
}

.history-log > div {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.history-log > div:last-child {
  border-bottom: none;
}

.sound-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
}

.sound-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--card-background);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 1rem;
}

.sound-btn:hover {
  transform: scale(1.1);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--card-background);
  padding: 30px;
  border-radius: var(--border-radius);
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow);
  animation: modalSlide 0.3s ease-out;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal h2 {
  color: var(--text-primary);
  margin-bottom: 20px;
}

.play-again-btn {
  background: linear-gradient(135deg, var(--success-color), #38a169);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  font-size: 1rem;
  margin-top: 20px;
}

.play-again-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.hidden {
  display: none !important;
}

.winner-animation {
  animation: celebrate 0.6s ease-out;
}

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

.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .game-container {
    padding: 20px;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .stats-summary {
    flex-direction: column;
    gap: 10px;
  }
  
  .scoreboard {
    flex-direction: column;
    gap: 10px;
  }
  
  .game-settings {
    flex-direction: column;
    gap: 10px;
  }
  
  .choices {
    flex-direction: column;
    gap: 15px;
  }
  
  .choice-btn {
    min-width: 200px;
  }
  
  .battle-arena {
    flex-direction: column;
    gap: 20px;
  }
  
  .vs-indicator {
    order: 2;
    transform: rotate(90deg);
  }
}

@media (max-width: 480px) {
  .choice-btn {
    min-width: 150px;
    padding: 15px;
  }
  
  .choice-emoji {
    font-size: 2rem;
  }
  
  .choice-preview {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
}
