:root {
  --primary: #6366F1;
  --secondary: #818CF8;
  --accent: #A5B4FC;
  --background: #0F0F1A;
  --surface: #1E1E2E;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --success: #22C55E;
  --error: #EF4444;
  --warning: #F59E0B;
  --radius: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.app-container {
  width: 100%;
  max-width: 600px;
  background-color: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.settings-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  color: var(--muted);
}

select {
  background-color: var(--background);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
}

select:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s;
}

.secondary-btn {
  background-color: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
}

.secondary-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.scoreboard {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background-color: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: var(--radius);
}

.score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.score-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

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

.player .score { color: var(--accent); }
.computer .score { color: var(--error); }
.draw .score { color: var(--muted); }

.streak-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--warning);
}

.streak-container .value {
  font-weight: 700;
  font-size: 1.25rem;
}

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  min-height: 250px;
  justify-content: center;
}

.hands {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  width: 100%;
}

.hand-container {
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hand-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}

.computer .hand-img {
  transform: scaleX(-1); /* Mirror the CPU hand */
}

.versus {
  font-size: 1.5rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.1);
}

.result-message {
  font-size: 1.5rem;
  font-weight: 600;
  text-align: center;
  min-height: 2rem;
  color: var(--accent);
}

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

.control-btn {
  background-color: var(--background);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 1rem;
  width: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.control-btn:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.control-btn .icon {
  font-size: 2rem;
}

.history-section {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.history-section h3 {
  font-size: 0.875rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  position: sticky;
  top: 0;
  background-color: rgba(15, 15, 26, 0.9);
  padding: 0.5rem 0;
  z-index: 1;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 0.875rem;
}

.history-item.win { border-left: 3px solid var(--success); }
.history-item.loss { border-left: 3px solid var(--error); }
.history-item.draw { border-left: 3px solid var(--muted); }

/* Animations */
@keyframes shake {
  0% { transform: translateX(0) scaleX(-1); }
  25% { transform: translateX(-10px) scaleX(-1); }
  50% { transform: translateX(10px) scaleX(-1); }
  75% { transform: translateX(-10px) scaleX(-1); }
  100% { transform: translateX(0) scaleX(-1); }
}

@keyframes shakePlayer {
  0% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  50% { transform: translateX(10px); }
  75% { transform: translateX(-10px); }
  100% { transform: translateX(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-30px); }
}

@keyframes bounceComputer {
    0%, 100% { transform: translateY(0) scaleX(-1); }
    50% { transform: translateY(-30px) scaleX(-1); }
}

.anim-shake-player { animation: shakePlayer 0.5s ease-in-out; }
.anim-shake-computer { animation: shake 0.5s ease-in-out; }
.anim-bounce-player { animation: bounce 0.5s ease-in-out infinite; }
.anim-bounce-computer { animation: bounceComputer 0.5s ease-in-out infinite; }

/* Confetti Container */
#confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

@media (max-width: 480px) {
  .app-container {
    padding: 1rem;
  }

  .game-area {
    gap: 1rem;
  }

  .hands {
    gap: 1rem;
  }

  .hand-container {
    width: 80px;
    height: 80px;
  }

  .controls {
    gap: 0.5rem;
  }

  .control-btn {
    width: 80px;
    padding: 0.5rem;
  }
}
