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

body {
  margin: 0;
  overflow: hidden;
  background: radial-gradient(circle at top, #281447, #05010a 55%, #020007 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff;
}

#gameCanvas {
  display: block;
}

#ui {
  position: fixed;
  top: 10px;
  left: 0;
  right: 0;
  z-index: 10;
  pointer-events: none;
}

#scoreboard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 700px;
  margin: 0 auto 8px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.team {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
}

.team-icon {
  font-size: 16px;
}

.team-green {
  background: radial-gradient(circle at top, rgba(0, 255, 140, 0.4), rgba(0, 140, 80, 0.2));
  border: 1px solid rgba(0, 255, 120, 0.7);
  box-shadow: 0 0 15px rgba(0, 255, 120, 0.3);
}

.team-purple {
  background: radial-gradient(circle at top, rgba(210, 150, 255, 0.4), rgba(120, 80, 200, 0.2));
  border: 1px solid rgba(210, 150, 255, 0.7);
  box-shadow: 0 0 15px rgba(210, 150, 255, 0.3);
}

#timer {
  font-weight: 700;
  font-size: 16px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#game-info {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 6px;
}

#map-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  font-size: 12px;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

#power-up-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.small-btn {
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 12px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.small-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

#hint {
  text-align: center;
  font-size: 11px;
  opacity: 0.9;
  line-height: 1.4;
  max-width: 600px;
  margin: 0 auto;
}

/* Game over overlay enhancements */
#overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(20, 0, 40, 0.7), rgba(0, 0, 0, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  backdrop-filter: blur(5px);
}

#overlay.hidden {
  display: none;
}

#overlayContent {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  padding: 32px 40px;
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 400px;
}

#overlay-title {
  margin-bottom: 16px;
  font-size: 32px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#stats-summary {
  margin: 16px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  font-size: 14px;
}

#stats-summary div {
  margin: 4px 0;
}

#restartBtn, #characterBtn {
  margin: 8px 4px;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

#restartBtn {
  background: linear-gradient(135deg, #00ff99, #7b61ff);
  color: #05010a;
  box-shadow: 0 10px 25px rgba(0, 255, 153, 0.4);
}

#characterBtn {
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  color: #05010a;
  box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
}

#restartBtn:hover, #characterBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

/* Character Selection Panel */
#character-selection {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
  backdrop-filter: blur(8px);
}

#character-selection.hidden {
  display: none;
}

#character-panel {
  background: linear-gradient(145deg, #2c1810, #3d2817);
  padding: 24px;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8);
  border: 2px solid rgba(255, 165, 0, 0.3);
}

#character-panel h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 24px;
  background: linear-gradient(45deg, #ff8c00, #ffd700);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#character-preview {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  position: relative;
}

#preview-ghost {
  font-size: 48px;
  margin-bottom: 8px;
}

#preview-hat {
  font-size: 24px;
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.selection-section {
  margin-bottom: 20px;
}

.selection-section h3 {
  margin-bottom: 12px;
  font-size: 16px;
  color: #ffd700;
}

#ghost-types, #hat-collection {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost-type, .hat-option {
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.ghost-type:hover, .hat-option:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.ghost-type.selected, .hat-option.selected {
  background: linear-gradient(135deg, #ff8c00, #ffd700);
  color: #000;
  border-color: #ffd700;
}

#achievement-progress {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 8px;
  font-size: 12px;
}

#achievement-progress div {
  margin: 4px 0;
  display: flex;
  justify-content: space-between;
}

.panel-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

#apply-character, #cancel-character {
  flex: 1;
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

#apply-character {
  background: linear-gradient(135deg, #00ff99, #00cc7a);
  color: #000;
}

#cancel-character {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#apply-character:hover, #cancel-character:hover {
  transform: translateY(-1px);
}

/* Achievement Notifications */
.achievement-notification {
  position: fixed;
  top: 100px;
  right: 20px;
  background: linear-gradient(135deg, #ff8c00, #ffd700);
  color: #000;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(255, 140, 0, 0.4);
  z-index: 30;
  animation: slideIn 0.5s ease-out;
  transition: opacity 0.5s;
}

.achievement-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.achievement-hat {
  font-size: 24px;
}

.achievement-title {
  font-weight: bold;
  font-size: 14px;
}

.achievement-name {
  font-size: 12px;
  opacity: 0.8;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
