:root {
  --primary: #8B5CF6;
  --secondary: #A78BFA;
  --accent: #DDD6FE;
  --background: #4C1D95;
  --text-light: #F3F4F6;
  --text-dark: #1F2937;
  --surface: #5B21B6;
  --surface-glass: rgba(91, 33, 182, 0.7);
  --success: #10B981;
  --danger: #EF4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --font-family: 'Inter', sans-serif;
}

/* Light Theme Variables (optional, for toggle) */
body.light-mode {
  --primary: #6D28D9;
  --secondary: #8B5CF6;
  --accent: #C4B5FD;
  --background: #F3F4F6;
  --text-light: #1F2937;
  --text-dark: #F3F4F6;
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.9);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--background);
  color: var(--text-light);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
  padding: 20px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 20px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.score-board {
  display: flex;
  gap: 20px;
}

.player-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--surface);
  padding: 10px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 80px;
}

.label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--secondary);
}

.score {
  font-size: 1.5rem;
  font-weight: 700;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.game-area {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 4px solid var(--surface);
  background: var(--surface); /* Fallback */
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  cursor: pointer;
  touch-action: none; /* Prevent scrolling on touch devices */
}

/* Game Message Overlay */
#game-message {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--surface-glass);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#game-message.active {
  opacity: 1;
  pointer-events: all;
}

#game-message h2 {
  font-size: 2rem;
  color: var(--accent);
  text-align: center;
}

#restart-btn {
  padding: 12px 24px;
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

#restart-btn:hover {
  background-color: var(--secondary);
  transform: translateY(-2px);
}

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

.control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--surface);
  color: var(--text-light);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.control-btn:hover:not(:disabled) {
  background-color: var(--primary);
  transform: translateY(-2px);
}

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

.control-btn svg {
  width: 20px;
  height: 20px;
}

footer {
  margin-top: 40px;
  color: var(--secondary);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 650px) {
  h1 {
    font-size: 1.8rem;
  }

  .score-board {
    gap: 10px;
  }

  .player-score {
    padding: 8px 12px;
    min-width: 60px;
  }

  .score {
    font-size: 1.2rem;
  }

  .game-area {
    width: 100%;
    border-width: 2px;
  }

  .control-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}

.hidden {
  display: none !important;
}
