/* ============================================
   ROOT & THEME VARIABLES
   ============================================ */
:root {
  --bg-primary: #0f0f1e;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #16213e;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --accent: #00d4ff;
  --accent-alt: #ff006e;
  --success: #00ff88;
  --warning: #ffa500;
  --error: #ff3860;
  --card-bg: #16213e;
  --border-color: #2a2a4e;
}

body.light-theme {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #efefef;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --accent: #0066cc;
  --accent-alt: #ff1744;
  --success: #00c853;
  --card-bg: #fafafa;
  --border-color: #e0e0e0;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

/* ============================================
   THEME TOGGLE
   ============================================ */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.theme-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.theme-btn:hover {
  transform: scale(1.1) rotate(20deg);
  box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.sun-icon {
  position: absolute;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.moon-icon {
  position: absolute;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: rotate(-180deg);
}

body.light-theme .sun-icon {
  opacity: 0;
  transform: rotate(180deg);
}

body.light-theme .moon-icon {
  opacity: 1;
  transform: rotate(0);
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */
.container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.game {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px 30px;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  visibility: visible;
  pointer-events: auto;
}

.game:hover {
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.4);
}

/* ============================================
   HEADER
   ============================================ */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-alt) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 10px;
  letter-spacing: -1px;
}

.subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
  opacity: 0.8;
}

/* ============================================
   ARENA (PLAYER VS BOT)
   ============================================ */
.arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  margin: 40px 0;
  position: relative;
}

.player-section {
  display: flex;
  justify-content: center;
}

.player-card {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--card-bg) 100%);
  border: 2px solid var(--border-color);
  border-radius: 15px;
  padding: 25px 20px;
  text-align: center;
  min-width: 150px;
  transition: all 0.3s ease;
}

.player-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
  transform: translateY(-5px);
}

.player-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 15px;
  font-weight: 600;
}

.choice-display {
  font-size: 4rem;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.vs-badge {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  box-shadow: 0 0 20px var(--accent);
  animation: pulse 2s infinite;
}

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

/* ============================================
   CHOICES GRID
   ============================================ */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin: 40px 0;
}

.choice-btn {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--card-bg) 100%);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 600;
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  visibility: visible;
}

.choice-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

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

.choice-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  transform: translateY(-3px);
}

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

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

.choice-btn .label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   RESULT SECTION
   ============================================ */
.result-section {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--card-bg) 100%);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  margin: 30px 0;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
}

.result-text {
  font-size: 1.5rem;
  font-weight: 600;
  min-height: 30px;
  color: var(--accent);
}

.score-board {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
}

.score-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

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

.score-divider {
  color: var(--border-color);
  font-size: 1.5rem;
}

/* ============================================
   RESET BUTTON
   ============================================ */
.reset-btn {
  width: 100%;
  padding: 12px 30px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-alt) 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.reset-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 212, 255, 0.4);
}

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

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
  .theme-btn {
    width: 45px;
    height: 45px;
    font-size: 20px;
    top: 15px;
    right: 15px;
  }

  .game {
    padding: 30px 20px;
  }

  .title {
    font-size: 2rem;
  }

  .arena {
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 30px 0;
  }

  .vs-badge {
    grid-column: 1;
    grid-row: 2;
    margin: 0 auto;
  }

  .player-card {
    min-width: 130px;
    padding: 20px 15px;
  }

  .choice-display {
    font-size: 3rem;
    min-height: 70px;
  }

  .choices-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 30px 0;
  }

  .choice-btn {
    padding: 15px;
    touch-action: manipulation;
  }

  .choice-btn .emoji {
    font-size: 2rem;
  }

  .score-board {
    gap: 20px;
  }

  .score-value {
    font-size: 1.5rem;
  }

  .result-section {
    padding: 20px;
    min-height: 120px;
    gap: 15px;
  }

  .result-text {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px;
    min-height: 100vh;
  }

  .game {
    padding: 20px 15px;
    border-radius: 15px;
    max-width: 100%;
  }

  .title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .subtitle {
    font-size: 0.9rem;
    margin: 0;
  }

  .header {
    margin-bottom: 20px;
  }

  .arena {
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 20px 0;
  }

  .player-section {
    width: 100%;
  }

  .player-card {
    min-width: 100%;
    width: 100%;
    padding: 15px 12px;
  }

  .player-label {
    font-size: 0.8rem;
    margin-bottom: 10px;
  }

  .choice-display {
    font-size: 2.5rem;
    min-height: 60px;
  }

  .vs-badge {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    margin: 5px 0;
  }

  .choices-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 20px 0;
  }

  .choice-btn {
    padding: 12px;
    gap: 6px;
    font-size: 0.75rem;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .choice-btn .emoji {
    font-size: 1.8rem;
    line-height: 1;
  }

  .choice-btn .label {
    font-size: 0.75rem;
  }

  .choice-btn:active {
    transform: scale(0.95);
  }

  .result-section {
    padding: 15px;
    min-height: 100px;
    gap: 12px;
    margin: 20px 0;
  }

  .result-text {
    font-size: 1rem;
    min-height: 25px;
  }

  .score-board {
    gap: 15px;
  }

  .score-label {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .score-value {
    font-size: 1.2rem;
  }

  .score-divider {
    font-size: 1.2rem;
  }

  .reset-btn {
    padding: 10px 15px;
    font-size: 0.85rem;
    margin-top: 10px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .reset-btn:active {
    transform: scale(0.98);
  }

  .theme-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    top: 12px;
    right: 12px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Extra Small Devices (< 360px) */
@media (max-width: 360px) {
  .game {
    padding: 15px 12px;
  }

  .title {
    font-size: 1.3rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .choice-display {
    font-size: 2rem;
  }

  .choice-btn .emoji {
    font-size: 1.5rem;
  }

  .choices-grid {
    gap: 8px;
  }

  .result-section {
    padding: 12px;
  }

  .result-text {
    font-size: 0.9rem;
  }

  .score-value {
    font-size: 1rem;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.game {
  animation: slideInUp 0.6s ease-out;
}
