* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0c2154 0%, #6479c4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.game-container {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 100%;
  max-width: 500px;
  height: 100%;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  color: white;
  position: relative;
  overflow: hidden;
}

h1 {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  text-align: center;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: white;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

@keyframes gradientShift {

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

  50% {
    background-position: 100% 50%;
  }
}

.game-settings {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.8rem;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.setting-group label {
  font-size: 0.8rem;
  font-weight: 500;
}

.setting-group input {
  width: 45px;
  padding: 0.3rem;
  text-align: center;
  font-size: 0.9rem;
  color: white;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  outline: none;
  transition: all 0.3s ease;
}

.setting-group input:focus {
  border-color: #4ecdc4;
  box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.win-condition-text {
  font-size: 0.8rem;
  color: #87ceeb;
  text-align: center;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.timer-display {
  font-size: 2rem;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff6b6b;
  border: 4px solid rgba(255, 107, 107, 0.3);
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
}

.timer-display.countdown {
  animation: pulse 1s infinite;
  color: #ffff00;
  border-color: rgba(255, 255, 0, 0.5);
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.game-status {
  font-size: 0.8rem;
  text-align: center;
  padding: 0.3rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.battle-arena {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 1rem;
  margin-bottom: 0.8rem;
}

.player-section,
.computer-section {
  flex: 1;
  text-align: center;
}

.player-section h3,
.computer-section h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.choice-display {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.choice-display.winner {
  background: rgba(76, 175, 80, 0.3);
  border-color: #4CAF50;
  animation: winner-glow 1s ease-in-out;
}

.choice-display.loser {
  background: rgba(244, 67, 54, 0.3);
  border-color: #f44336;
  animation: loser-shake 0.5s ease-in-out;
}

@keyframes winner-glow {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
  }

  50% {
    box-shadow: 0 0 40px rgba(76, 175, 80, 0.8);
  }
}

@keyframes loser-shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

.vs-divider {
  font-size: 1rem;
  margin: 0 0.5rem;
  color: #ff6b6b;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.buttons {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.choice-btn {
  font-size: 1.8rem;
  padding: 0.6rem;
  border-radius: 15px;
  border: none;
  color: white;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  border: 3px solid transparent;
  min-width: 60px;
  min-height: 60px;
}

.choice-btn:not(:disabled):hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.choice-btn.selected {
  border-color: #4ecdc4;
  background: rgba(78, 205, 196, 0.3);
  animation: selected-pulse 0.5s ease-in-out;
}

@keyframes selected-pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

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

#rock {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

#paper {
  background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

#scissors {
  background: linear-gradient(135deg, #45b7d1, #3498db);
}

.result {
  font-size: 0.9rem;
  padding: 0.6rem;
  text-align: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  min-height: 40px;
  width: 100%;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: 2px solid transparent;
}

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

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

.result.tie {
  background: rgba(255, 193, 7, 0.2);
  border-color: #FFC107;
  color: #FFC107;
}

.scoreboard {
  display: flex;
  justify-content: space-around;
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 0.6rem;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-item {
  text-align: center;
  font-size: 0.8rem;
}

.score-label {
  margin-bottom: 0.3rem;
  opacity: 0.8;
}

.score-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #4ecdc4;
  text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.game-controls {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}

.control-btn {
  font-size: 0.7rem;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.control-btn.start {
  background: linear-gradient(135deg, #4CAF50, #45a049);
}

.control-btn.pause {
  background: linear-gradient(135deg, #FF9800, #F57C00);
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.popup-overlay.show {
  display: flex;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.popup-modal {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  max-width: 90vw;
  width: 400px;
  font-size: 1rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.2);
  position: relative;
  animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.popup-title {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.popup-title.victory {
  color: #4CAF50;
  animation: victory-glow 2s infinite;
}

.popup-title.defeat {
  color: #f44336;
}

@keyframes victory-glow {

  0%,
  100% {
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
  }

  50% {
    text-shadow: 0 0 40px rgba(76, 175, 80, 0.8);
  }
}

.popup-score {
  font-size: 1.5rem;
  margin: 1rem 0;
  color: #87ceeb;
  font-weight: 600;
}

.popup-message {
  font-size: 1rem;
  margin: 1rem 0;
  line-height: 1.6;
  opacity: 0.9;
}

.popup-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.popup-btn {
  padding: 0.8rem 2rem;
  font-size: 1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.popup-btn.play-again {
  background: linear-gradient(135deg, #4CAF50, #45a049);
}

.popup-btn.close {
  background: linear-gradient(135deg, #87ceeb, #4682b4);
}

/* Confetti Animation */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f0f;
  animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-container {
    padding: 0.8rem;
    max-width: 90vw;
  }

  .battle-arena {
    padding: 0 0.5rem;
  }

  .choice-btn {
    font-size: 1.5rem;
    padding: 0.5rem;
    min-width: 50px;
    min-height: 50px;
  }

  .choice-display {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .timer-display {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .popup-modal {
    padding: 1.2rem;
    width: 300px;
  }
}

@media (max-width: 480px) {
  .game-container {
    padding: 0.5rem;
    max-width: 95vw;
  }

  .buttons {
    gap: 0.3rem;
  }

  .game-controls {
    gap: 0.3rem;
  }

  .control-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.6rem;
  }

  .popup-buttons {
    flex-direction: column;
    gap: 0.6rem;
  }

  .popup-btn {
    width: 100%;
    padding: 0.6rem 1.5rem;
  }

  h1 {
    font-size: 1rem;
  }

  .setting-group input {
    width: 35px;
    padding: 0.2rem;
  }
}

@media (max-height: 600px) {
  .game-container {
    padding: 0.3rem;
    max-height: 98vh;
  }

  h1 {
    margin-bottom: 0.2rem;
  }

  .game-settings {
    margin-bottom: 0.2rem;
  }

  .win-condition-text {
    margin-bottom: 0.2rem;
  }

  .timer-display {
    margin-bottom: 0.2rem;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .game-status {
    margin-bottom: 0.2rem;
  }

  .battle-arena {
    margin-bottom: 0.3rem;
  }

  .buttons {
    margin-bottom: 0.3rem;
  }

  .result {
    margin-bottom: 0.3rem;
    min-height: 30px;
    padding: 0.3rem;
  }

  .scoreboard {
    margin-bottom: 0.3rem;
    padding: 0.4rem;
  }
}