body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea, #764ba2, #f093fb, #f5576c);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: #333;
  min-height: 100vh;
}

header {
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  text-align: center;
}

h1 {
  margin: 0;
  font-size: 2.2rem;
  color: #333;
}

.back-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 15px;
  background: #667eea;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.3s ease;
}

.back-btn:hover {
  background: #5a6fd8;
}

main {
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.game-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

/* Mode Selection */
.mode-selection {
  text-align: center;
}

.mode-selection h2 {
  margin-bottom: 30px;
  font-size: 2rem;
  color: #333;
}

.mode-buttons {
  display: flex;
  gap: 30px;
  justify-content: center;
  flex-wrap: wrap;
}

.mode-btn {
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 3px solid transparent;
  border-radius: 20px;
  padding: 30px;
  width: 280px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border-color: #667eea;
}

.mode-icon {
  font-size: 3.5rem;
  margin-bottom: 15px;
}

.mode-btn h3 {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
  color: #333;
}

.mode-btn p {
  margin: 0 0 15px 0;
  color: #666;
  font-size: 1rem;
}

.mode-preview {
  font-size: 1.8rem;
  opacity: 0.8;
}

/* Difficulty Selection */
.difficulty-selection {
  text-align: center;
}

.difficulty-selection h2 {
  margin-bottom: 30px;
  font-size: 2rem;
  color: #333;
}

.difficulty-buttons {
  display: flex;
  gap: 25px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.difficulty-btn {
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 3px solid transparent;
  border-radius: 15px;
  padding: 25px 20px;
  width: 200px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.difficulty-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.difficulty-btn.easy:hover { border-color: #4caf50; }
.difficulty-btn.medium:hover { border-color: #ff9800; }
.difficulty-btn.hard:hover { border-color: #f44336; }

.difficulty-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.difficulty-btn h3 {
  margin: 0 0 10px 0;
  font-size: 1.3rem;
}

.difficulty-btn p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.back-btn-small {
  background: #666;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s ease;
  font-size: 1rem;
}

.back-btn-small:hover {
  background: #555;
}

/* Game Area */
.game-area {
  text-align: center;
}

.score-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: rgba(255, 255, 255, 0.5);
  padding: 20px;
  border-radius: 15px;
}

.score-card {
  text-align: center;
  min-width: 100px;
}

.score-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
}

.score-value {
  font-size: 3rem;
  font-weight: bold;
  color: #667eea;
}

.score-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

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

.round-info span {
  font-size: 1.1rem;
  font-weight: bold;
  color: #666;
}

/* Battle Area */
.battle-area {
  margin: 40px 0;
}

.choice-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.choice-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 4px solid #ddd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.4s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.choice-circle.winner {
  border-color: #4caf50;
  background: linear-gradient(145deg, #e8f5e8, #c8e6c9);
  transform: scale(1.1);
  animation: winnerPulse 1s ease-in-out;
}

.choice-circle.loser {
  border-color: #f44336;
  background: linear-gradient(145deg, #ffebee, #ffcdd2);
  opacity: 0.7;
}

.choice-symbol {
  font-size: 3rem;
  margin-bottom: 8px;
}

.choice-label {
  font-size: 0.9rem;
  font-weight: bold;
  color: #666;
}

.vs-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  min-width: 80px;
}

.vs-text {
  font-size: 2rem;
  font-weight: bold;
  color: #667eea;
}

.result-text {
  font-size: 1.2rem;
  font-weight: bold;
  min-height: 30px;
  padding: 8px 15px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.result-text.win {
  color: #4caf50;
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.result-text.lose {
  color: #f44336;
  border-color: #f44336;
  background: rgba(244, 67, 54, 0.1);
}

.result-text.draw {
  color: #ff9800;
  border-color: #ff9800;
  background: rgba(255, 152, 0, 0.1);
}

.game-message {
  margin: 30px 0;
}

#gameMessage {
  font-size: 1.3rem;
  color: #333;
  font-weight: 500;
}

/* Choice Buttons */
.choices-section h3 {
  margin-bottom: 20px;
  color: #333;
  font-size: 1.4rem;
}

.choice-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.choice-btn {
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border: 3px solid #ddd;
  border-radius: 15px;
  padding: 20px;
  width: 100px;
  height: 100px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.choice-btn:hover {
  transform: translateY(-5px);
  border-color: #667eea;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

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

.choice-btn .choice-emoji {
  font-size: 2.5rem;
  margin-bottom: 5px;
}

.choice-btn .choice-name {
  font-size: 0.8rem;
  font-weight: bold;
  color: #333;
}

.choice-btn.selected {
  border-color: #667eea;
  background: linear-gradient(145deg, #667eea, #5a6fd8);
  color: white;
  transform: translateY(-3px);
}

.choice-btn.selected .choice-name {
  color: white;
}

/* Game Controls */
.game-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.control-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.control-btn:hover {
  background: #5a6fd8;
  transform: translateY(-2px);
}

/* AI Thinking Animation */
.ai-thinking {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.thinking-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

.thinking-text {
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
}

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

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.4s ease-out;
  max-height: 80vh;
  overflow-y: auto;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.modal-content h2 {
  margin: 0 0 20px 0;
  font-size: 1.8rem;
  color: #333;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  padding: 12px 25px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn.primary {
  background: #667eea;
  color: white;
}

.btn.primary:hover {
  background: #5a6fd8;
  transform: translateY(-2px);
}

.btn:not(.primary) {
  background: #f0f0f0;
  color: #333;
}

.btn:not(.primary):hover {
  background: #e0e0e0;
}

/* Rules Content */
#rulesContent {
  text-align: left;
  margin: 20px 0;
}

.rule-section {
  margin-bottom: 20px;
}

.rule-section h3 {
  color: #667eea;
  margin-bottom: 10px;
}

.rule-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 8px;
}

.rule-emoji {
  font-size: 1.5rem;
  margin-right: 10px;
}

.rule-text {
  flex: 1;
}

/* Result Stats */
#resultStats {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 5px 0;
  border-bottom: 1px solid #eee;
}

.stat-row:last-child {
  border-bottom: none;
  font-weight: bold;
  font-size: 1.1rem;
}

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

/* Animations */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes modalSlideIn {
  0% {
    transform: translateY(-100px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .mode-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .mode-btn {
    width: 100%;
    max-width: 350px;
  }
  
  .difficulty-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .score-section {
    flex-direction: column;
    gap: 20px;
  }
  
  .choice-display {
    flex-direction: column;
    gap: 30px;
  }
  
  .vs-section {
    order: -1;
  }
  
  .choice-buttons {
    gap: 10px;
  }
  
  .choice-btn {
    width: 80px;
    height: 80px;
    padding: 15px;
  }
  
  .choice-btn .choice-emoji {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .game-container {
    padding: 20px;
  }
  
  .choice-circle {
    width: 100px;
    height: 100px;
  }
  
  .choice-symbol {
    font-size: 2.5rem;
  }
  
  .score-value {
    font-size: 2.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
}