body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* Prevent scrollbars */
  background-color: #111; /* Dark background */
  color: white;
  font-family: Arial, sans-serif;
  /* Disable text selection */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

canvas#gameCanvas {
  display: block; /* Remove extra space below canvas */
  width: 100%;
  height: 100%;
  /* Cursors can be set via JavaScript if needed
  cursor: crosshair; */
}

/* UI Overlay Container */
#ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Allow clicks to pass through to canvas */
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Pushes top/bottom bars */
  align-items: center; /* Centers middle content */
  padding: 15px;
  box-sizing: border-box; /* Include padding in width/height */
}

/* Top Bar (Timer, Player Count) */
#ui-top-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px; /* Padding inside the bar */
  box-sizing: border-box;
}

#ui-timer {
  font-size: 28px;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 5px 15px;
  border-radius: 8px;
}

#ui-player-count {
  font-size: 24px;
  font-weight: bold;
  background-color: rgba(0, 0, 0, 0.5);
  padding: 5px 15px;
  border-radius: 8px;
}

/* Bottom Bar (Health, Weapon) */
#ui-bottom-bar {
  width: 100%;
  display: flex;
  justify-content: flex-start; /* Align items to the left */
  align-items: center;
  padding: 0 10px; /* Padding inside the bar */
  box-sizing: border-box;
  gap: 20px; /* Space between health bar and weapon */
}

#ui-health-bar {
  width: 200px;
  height: 25px;
  background-color: rgba(50, 50, 50, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  position: relative; /* For positioning the text inside */
  overflow: hidden;
}

#ui-health-bar-fill {
  height: 100%;
  width: 100%; /* Default to full */
  background: linear-gradient(to right, rgb(0, 200, 0), rgb(100, 255, 100)); /* Default green */
  transition: width 0.2s ease-out, background 0.2s ease-out;
}

#ui-health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px black; /* Improve readability */
}

#ui-weapon-indicator {
  width: 50px;
  height: 50px;
  background-color: rgba(0, 0, 0, 0.6);
  border: 2px solid rgba(255, 215, 0, 0.7);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 30px;
}

/* Minimap */
#ui-minimap-container {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 150px; /* Match canvas size if using */
  height: 150px;
  background-color: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.7);
  overflow: hidden; /* Ensure canvas stays within */
  z-index: 20; /* Ensure it's above other overlay elements */
}

#ui-minimap-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Game State Messages (Centered) */
#ui-message-center {
  position: absolute;
  top: 30%; /* Adjust vertical position */
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  font-weight: bold;
  text-align: center;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  padding: 10px 20px;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
}

/* Game Over Screen */
#ui-game-over-screen {
  display: none; /* Initially hidden */
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  font-family: 'Bangers', cursive;
}

#ui-winner-display {
  text-align: center;
  font-size: 4em;
  margin-bottom: 20px;
  display: none; /* Hidden by default */
}

#ui-winner-display span#winner-name {
  display: block;
  font-size: 0.8em;
  margin-top: 10px;
  color: #ffd700; /* Gold color */
}

#ui-scoreboard-display {
  display: none; /* Hidden by default */
  width: 80%;
  max-width: 600px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
}

.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.scoreboard-table th,
.scoreboard-table td {
  padding: 10px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.scoreboard-table th {
  font-size: 1.2em;
  color: #aaa;
}

.scoreboard-table td {
  font-size: 1.1em;
}

/* Style for the winner's row */
.scoreboard-table tr.winner-row td {
  background-color: rgba(255, 215, 0, 0.2); /* Faint gold highlight */
  color: #fff;
  font-weight: bold;
}

/* Remove bottom border for the last row */
.scoreboard-table tbody tr:last-child td {
  border-bottom: none;
}

#ui-menu-button {
  display: none; /* Hidden by default */
  padding: 15px 30px;
  font-size: 1.5em;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'Bangers', cursive;
}

#ui-menu-button:hover {
  background-color: #45a049;
}

/* Loading Indicator */
#ui-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 30px;
  padding: 15px 25px;
  background-color: rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  z-index: 30; /* Highest */
}

/* Temporary Messages (e.g., eliminations) */
.temp-message {
  /* Styles are applied via JavaScript in showTemporaryMessage for now */
  /* Can define base styles here and override in JS if needed */
  transition: opacity 0.5s ease-out;
}

/* Example of a specific message style */
.elimination-message.success {
  color: lightgreen;
  border: 1px solid lightgreen;
}


/* Error Display */
#errorDisplay {
  position: absolute;
  top: 10px;
  left: 10px;
  color: red;
  background: rgba(0,0,0,0.7);
  padding: 5px;
  border-radius: 3px;
  font-size: 12px;
  z-index: 100;
}

/* Debug Info */
#debugInfo {
  position: absolute;
  bottom: 10px;
  left: 10px;
  color: limegreen;
  font-family: monospace;
  background: rgba(0,0,0,0.6);
  padding: 5px;
  font-size: 12px;
  z-index: 100;
  max-height: 100px;
  overflow-y: auto;
}
