body {
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 20px;
}

.welcome-container {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
  background: #fff;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.welcome-container h1 {
  font-size: 3em;
  margin-bottom: 20px;
  color: #333;
}

.welcome-container p {
  font-size: 1.5em;
  color: #555;
}

.welcome-container ul {
  list-style: none;
  padding: 0;
  font-size: 1.3em;
}

.welcome-container li {
  margin: 10px 0;
}

.welcome-container a {
  text-decoration: none;
  color: #0066cc;
  font-weight: bold;
}

.welcome-container a:hover {
  color: #004999;
}

/* Board container wrapping board, overlay, and leaderboard */
#board-container {
  position: relative;
  width: calc(16 * 80px + 15 * 1px);
  height: calc(16 * 80px + 15 * 1px);
  margin: 20px auto;
}

/* Game board styling */
#game-board {
  display: grid;
  grid-template-columns: repeat(16, 80px);
  grid-template-rows: repeat(16, 80px);
  gap: 1px;
  width: 100%;
  height: 100%;
  background-color: #333;
  position: relative;
  z-index: 1;
}

/* Individual cell styling */
.cell {
  border: 1px solid red;
  width: 80px;
  height: 80px;
  background-color: #eee;
  text-align: center;
  line-height: 80px;
  font-size: 18px;
  cursor: pointer;
  user-select: none;
}

/* Style for white cells (non-spawn cells with no owner) */
.cell:not(.spawn):not(.red):not(.blue):not(.green):not(.yellow) {
  cursor: not-allowed;
  filter: brightness(0.95);
  border: 1px dashed #ccc;
}

.cell.red {
  background-color: #ffaaaa;
}

.cell.blue {
  background-color: #aaaaff;
}

.cell.green {
  background-color: #aaffaa;
}

.cell.yellow {
  background-color: #ffc935;
}

.cell.neutral {
  background-color: #eee;
}

/* Spawn styling */
.spawn {
  border: 2px solid black;
  filter: brightness(0.85);
}

.inactive-spawn {
  background-color: #555;
  filter: none;
}

/* Overlay canvas positioned relative to board-container */
#overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
}

/* Game controls */
.game-controls {
  max-width: calc(16 * 80px + 15 * 1px);
  margin: 20px auto;
  text-align: center;
  display: flex;
  gap: 10px;
  justify-content: center;
}

#pause-button, #finish-button {
  font-size: 1.2em;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s;
}

#pause-button {
  background-color: #4CAF50;
}

#finish-button {
  background-color: #f44336;
}

#pause-button:hover {
  background-color: #45a049;
}

#finish-button:hover {
  background-color: #da190b;
}

#pause-button.paused {
  background-color: #f44336;
}

#pause-button.paused:hover {
  background-color: #da190b;
}

/* Update leaderboard styles */
#leaderboard {
  max-width: 800px;
  margin: 20px auto;
  font-size: 1.2em;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  overflow: hidden;
}

#leaderboard table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#leaderboard td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* First row (header) styling */
#leaderboard tr:first-child td {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #333;
}

/* Column widths and alignments */
.team-name { 
  width: 15%; 
  text-align: left;
}

.player-names { 
  width: 35%; 
  text-align: left;
  padding-left: 20px;
}

.stat-value { 
  width: 15%; 
  text-align: center;
}

/* Team row colors in leaderboard */
.red-row {
  background-color: rgba(255, 0, 0, 0.1);
}

.blue-row {
  background-color: rgba(0, 0, 255, 0.1);
}

.green-row {
  background-color: rgba(0, 255, 0, 0.1);
}

.yellow-row {
  background-color: rgba(255, 201, 53, 0.1);
}

/* Current player's team highlighting */
tr.current-player-team {
  position: relative;
  font-weight: bold;
}

/* Specific colors for current player's team */
tr.red-row.current-player-team {
  background-color: rgba(255, 0, 0, 0.2);
}

tr.blue-row.current-player-team {
  background-color: rgba(0, 0, 255, 0.2);
}

tr.green-row.current-player-team {
  background-color: rgba(0, 255, 0, 0.2);
}

tr.yellow-row.current-player-team {
  background-color: rgba(255, 201, 53, 0.2);
}

/* Cell hover effect */
.cell:hover {
  filter: brightness(0.9);
}

/* Selected cell animation with DRAMATICALLY increased visibility */
.cell.selected {
  outline: 8px solid #ffc935;
  box-shadow: 0 0 20px 5px #ffc935, inset 0 0 10px #ffc935;
  position: relative;
  z-index: 5;
  border: 2px solid #000;
  transform: scale(1.05);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { 
    outline-color: rgba(255, 201, 53, 1);
    box-shadow: 0 0 20px 5px rgba(255, 201, 53, 1), inset 0 0 10px rgba(255, 201, 53, 1);
  }
  50% { 
    outline-color: rgba(255, 201, 53, 0.5);
    box-shadow: 0 0 10px rgba(255, 201, 53, 0.5), inset 0 0 5px rgba(255, 201, 53, 0.5);
  }
  100% { 
    outline-color: rgba(255, 201, 53, 1);
    box-shadow: 0 0 20px 5px rgba(255, 201, 53, 1), inset 0 0 10px rgba(255, 201, 53, 1);
  }
}
