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

body {
  overflow: hidden;
  background: #6aaa7a;
  font-family: system-ui, sans-serif;
  color: #2a3040;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* HUD */
#hud {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 0 8px;
  min-width: 320px;
}

#score-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 10px 16px 4px;
  font-size: 42px;
  font-weight: bold;
}

#score-left {
  color: #5b9bff;
}

#score-right {
  color: #ff5b6b;
}

#score-divider, #score-divider-right {
  color: rgba(255,255,255,0.3);
  font-size: 24px;
}

#event-emoji {
  font-size: 28px;
  line-height: 1;
}

#event-name {
  font-size: 13px;
  color: #ffcc55;
  text-transform: uppercase;
  letter-spacing: 2px;
  min-width: 120px;
  text-align: center;
}

#event-timer-bar {
  width: 90%;
  height: 3px;
  background: rgba(255,255,255,0.15);
  margin: 0 auto 8px;
  border-radius: 2px;
  overflow: hidden;
}

#event-timer-fill {
  width: 100%;
  height: 100%;
  background: #ffaa33;
  transition: width 0.3s linear;
}

#message-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  font-weight: bold;
  color: #2a3040;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.3s;
}

#message-overlay.visible {
  opacity: 1;
}

/* Menu */
#menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(60, 100, 70, 0.5);
  backdrop-filter: blur(12px);
  z-index: 100;
}

#menu-card {
  background: white;
  border-radius: 12px;
  padding: 40px 50px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  text-align: center;
  max-width: 420px;
}

#menu h1 {
  font-size: 64px;
  margin-bottom: 10px;
  color: #2a3040;
}

#menu .subtitle {
  font-size: 16px;
  color: #7a8090;
  margin-bottom: 20px;
  line-height: 1.4;
}

#name-input {
  margin-bottom: 20px;
}

#player-name {
  padding: 10px 16px;
  font-size: 16px;
  font-family: system-ui, sans-serif;
  border: 2px solid #ddd;
  border-radius: 6px;
  width: 100%;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}

#player-name:focus {
  border-color: #8855dd;
}

/* Settings Menu */
#settings-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  z-index: 200;
}

#settings-card {
  background: white;
  border-radius: 12px;
  padding: 30px 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  text-align: left;
  min-width: 280px;
}

#settings-card h2 {
  margin-bottom: 20px;
  text-align: center;
  color: #2a3040;
}

#settings-card label {
  display: block;
  margin-bottom: 14px;
  font-size: 15px;
  color: #3a4050;
  cursor: pointer;
}

#settings-card label input {
  margin-right: 8px;
}

#settings-close {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  font-family: system-ui, sans-serif;
  font-size: 15px;
  font-weight: bold;
  color: #fff;
  background: #3a4050;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#settings-close:hover {
  background: #555;
}

#mode-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

#mode-buttons .online-btn {
  border-color: #33aa55;
  color: #33aa55;
}

#mode-buttons .online-btn:hover {
  background: #33aa55;
  border-color: #33aa55;
  color: #fff;
}

.queue-count {
  font-size: 11px;
  font-weight: normal;
  opacity: 0.7;
}

.online-status {
  margin-top: 12px;
  font-size: 12px;
  color: #8a90a0;
  min-height: 16px;
}

#mode-buttons button {
  padding: 14px 28px;
  font-family: system-ui, sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #3a4050;
  background: transparent;
  border: 2px solid #8890a0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

#mode-buttons button:hover {
  background: #3a4050;
  border-color: #3a4050;
  color: #fff;
}

#mode-buttons .arena-btn {
  border-color: #8855dd;
  color: #8855dd;
  font-size: 18px;
}

#mode-buttons .arena-btn:hover {
  background: #8855dd;
  border-color: #8855dd;
  color: #fff;
}

/* Settings hint */
#settings-hint {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 15;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.15s;
}

#settings-hint:hover {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
}

/* Coin display */
#coin-display {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 15;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  padding: 8px 16px;
  pointer-events: none;
}

#coin-count {
  font-size: 28px;
  font-weight: bold;
  color: #ffcc33;
  letter-spacing: 2px;
}

#coin-count::before {
  content: '\2B50\00a0';
}

/* Death screen */
#death-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
}

#death-content {
  text-align: center;
}

#death-title {
  font-size: 72px;
  font-weight: 900;
  color: #dd2222;
  text-shadow: 0 4px 20px rgba(200, 0, 0, 0.5);
  margin-bottom: 16px;
}

#death-timer {
  font-size: 48px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 24px;
}

#death-upgrades {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.death-upgrade-btn {
  padding: 12px 20px;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.death-upgrade-btn:hover:not(:disabled) {
  background: rgba(136, 85, 221, 0.5);
  border-color: #8855dd;
}

.death-upgrade-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.death-upgrade-btn.maxed {
  border-color: #55aa55;
  color: #55aa55;
}

#death-respawn {
  font-size: 20px;
  color: #fff;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Shop overlay */
#shop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
}

#shop-card {
  background: white;
  border-radius: 12px;
  padding: 24px 32px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
  text-align: center;
  min-width: 340px;
}

#shop-header {
  font-size: 20px;
  font-weight: bold;
  color: #2a3040;
  margin-bottom: 16px;
}

#shop-coins {
  color: #dd8800;
}

#shop-coins::before {
  content: '\2B50\00a0';
}

#shop-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.shop-btn {
  padding: 16px 12px;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #3a4050;
  background: #f5f3f0;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  line-height: 1.4;
}

.shop-btn .shop-emoji {
  font-size: 28px;
  display: block;
  margin-bottom: 4px;
}

.shop-btn:hover:not(:disabled) {
  background: #ece8ff;
  border-color: #8855dd;
}

.shop-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.shop-btn.maxed {
  border-color: #55aa55;
  color: #55aa55;
}

#shop-close-hint {
  font-size: 13px;
  color: #999;
  margin-top: 4px;
}

/* Ball type indicator */
#ball-type-indicator {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: bold;
  border-radius: 4px;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.4s;
  text-shadow: 0 0 6px currentColor;
}

#ball-type-indicator.visible {
  opacity: 1;
}

/* Power-up spawn indicator */
#powerup-warning {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  font-family: system-ui, sans-serif;
  font-size: 16px;
  font-weight: bold;
  pointer-events: none;
  z-index: 15;
  opacity: 0;
  transition: opacity 0.3s;
}

#powerup-warning.visible {
  opacity: 1;
}

#controls-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  color: #8a90a0;
  pointer-events: none;
  z-index: 10;
}
