/* Global styles */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  /* Use the forest image as the page background */
  background-image: url('assets/bg.png');
  background-size: cover;
  background-position: center;
  /* Provide a subtle white overlay to improve text contrast */
  background-color: rgba(255, 255, 255, 0.85);
  background-blend-mode: lighten;
  color: #214f3d;
}

header {
  background: rgba(33, 79, 61, 0.8);
  color: #fff;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
  max-width: 1000px;
  margin: 0 auto;
}

/* Scoreboard */
#scoreboard {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.team-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 0.5rem 1rem;
  min-width: 100px;
  text-align: center;
  border-left: 6px solid currentColor;
}

.team-name {
  font-weight: bold;
  margin-bottom: 0.25rem;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.team-score {
  font-size: 1.5rem;
}

/* Board */
#board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 900px;
}

/* Board cells */
.cell {
  background: rgba(43, 101, 75, 0.9);
  color: #fff;
  text-align: center;
  padding: 1rem 0.5rem;
  font-size: 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

/* Slight scale on hover to hint interactivity */
.cell:not(.category):hover {
  transform: scale(1.03);
}

.cell.used {
  background: #677a6b;
  pointer-events: none;
  color: transparent;
}

.cell.category {
  /* Distinct colour for category headers */
  background: rgba(210, 233, 210, 0.95);
  color: #214f3d;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 0.5px;
  padding: 0.75rem 0.5rem;
  cursor: default;
}

/* Modal */
#modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#modal.hidden {
  display: none;
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem;
  border-radius: 8px;
  max-width: 650px;
  width: 95%;
}

.modal-actions {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

/* Control buttons row within modal actions */
.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
}

/* Layout for modal actions: first row (team buttons) and second row (controls) */
#team-select {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

/* Team selection buttons */
.team-button {
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-weight: bold;
  flex: 1 1 100px;
}

.team-button.selected {
  outline: 3px solid rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

button {
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95rem;
  min-width: 90px;
}

/* Burnout button: used to discard a question when no one answers */
#burnout-btn, .burnout {
  background: #ffc107;
  color: #214f3d;
}

#show-answer {
  background: #1b4332;
  color: #fff;
}

#correct-btn {
  background: #28a745;
  color: #fff;
}

#wrong-btn {
  background: #dc3545;
  color: #fff;
}

#close-btn {
  background: #6c757d;
  color: #fff;
}

.hidden {
  display: none !important;
}

/* Setup overlay for choosing number of teams and their names */
.setup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.setup-content {
  background: rgba(255, 255, 255, 0.95);
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#team-names {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#team-names label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

#team-count {
  margin-left: 0.5rem;
  padding: 0.25rem;
}

#start-game-btn {
  margin-top: 1rem;
  background: #2d6a4f;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

/* Buzzer info section in setup overlay */
.buzzer-info {
  margin-top: 1.5rem;
  text-align: left;
}
.buzzer-info h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: #2d6a4f;
}
.buzzer-info p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: #214f3d;
}
.buzzer-info a {
  color: #386fa4;
  text-decoration: underline;
}

/* Preview buzzers within the setup overlay. These small coloured cards give
   hosts a quick visual of what each team’s manual buzzer looks like. */
.buzzer-preview-container {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.buzzer-preview {
  width: 60px;
  height: 90px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* Specific colours for each preview card */
.buzzer-preview.green { background: #2d6a4f; }
.buzzer-preview.blue  { background: #386fa4; }
.buzzer-preview.yellow{ background: #e9c46a; color: #214f3d; }
.buzzer-preview.red   { background: #e76f51; }