/* ====================== RESET & BASICS ====================== */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #e9ebee;
}
h1, h2, h3, h4 {
  margin: 0;
  padding: 0;
}
button {
  cursor: pointer;
}

/* ====================== START MENU ====================== */
.start-menu {
  max-width: 1200px;
  margin: 2rem auto;
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.start-menu h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}
.start-menu-layout {
  display: flex;
  gap: 2rem;
  justify-content: space-between;
}
.connection-panel, .player-setup {
  flex: 1;
  background: #f7f7f7;
  border-radius: 4px;
  padding: 1rem;
}
.connection-panel button {
  margin-bottom: 1rem;
}
#connection-log-container {
  margin-top: 1rem;
}
#connection-log {
  list-style: none;
  padding: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.player-setup .setup-field {
  margin-bottom: 1rem;
}
.player-setup label {
  font-weight: bold;
  margin-bottom: 0.3rem;
  display: block;
}
.player-setup input,
.player-setup select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* ====================== MAIN GAME AREA ====================== */
.game-area {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.game-header h1 {
  font-size: 2rem;
}
.blue-text {
  color: #007bff;
}
.timer {
  font-size: 1.4rem;
  font-weight: bold;
  color: #007bff;
}

/* Grid layout for main game area */
.main-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr;
  grid-template-rows: 2fr 1fr;
  gap: 10px;
  min-height: 600px; /* ensure a decent vertical space */
}

/* 1) Board Panel (green) */
.board-panel {
  grid-column: 1 / 2;
  grid-row: 1 / 2;
  background-color: #2c662d;
  border-radius: 8px;
  color: #fff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.board-panel .panel-title {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}
.board {
  flex: 1;
  background: #fff;
  border-radius: 4px;
  /* Insert your 15x15 board styling or background image */
}

/* 2) History Panel (yellow) */
.history-panel {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  background-color: #f9c738;
  border-radius: 8px;
  color: #333;
  padding: 1rem;
}
.history-panel .panel-title {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}
.move-history {
  max-height: 280px; 
  overflow-y: auto;
}
.move-history > div {
  margin-bottom: 0.5rem;
}

/* 3) Score Panel (red) */
.score-panel {
  grid-column: 3 / 4;
  grid-row: 1 / 2;
  background-color: #d33;
  border-radius: 8px;
  color: #fff;
  padding: 1rem;
}
.score-panel .panel-title {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}
.score-extra {
  margin-top: 1rem;
}

/* 4) Rack Panel (blue) */
.rack-panel {
  grid-column: 1 / 2;
  grid-row: 2 / 3;
  background-color: #004aad;
  border-radius: 8px;
  color: #fff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.rack-panel .panel-title {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}
.rack {
  background: #f8f9fa;
  border-radius: 4px;
  padding: 1rem;
  min-height: 60px;
  margin-bottom: 0.5rem;
}
.controls-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.recommendation-buttons {
  display: flex;
  gap: 0.5rem;
}

/* 5) Chat Panel (green) */
.chat-panel {
  grid-column: 3 / 4;
  grid-row: 2 / 3;
  background-color: #2c7f2c;
  border-radius: 8px;
  color: #fff;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}
.chat-panel .panel-title {
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}
.chat-log {
  flex: 1;
  background: #f8f9fa;
  color: #000;
  border-radius: 4px;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  overflow-y: auto;
}
.chat-input-container {
  display: flex;
  gap: 0.5rem;
}
.chat-input-container input {
  flex: 1;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}

/* 6) Stats row below the grid */
.stats-row {
  margin-top: 1rem;
  background: #fff;
  border-radius: 4px;
  padding: 1rem;
  display: flex;
  justify-content: space-around;
}
.stats-box {
  text-align: left;
}

/* Overlay for recommendation */
#recommendation-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 10;
  width: 100%;
  height: 100%;
}
#recommendation-overlay.hidden {
  display: none;
}
#recommendation-overlay .recommendation-tile {
  position: absolute;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 0, 0.6);
  border: 2px dashed #ffa500;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  color: #000;
  border-radius: 4px;
  pointer-events: none;
  z-index: 11;
}

/* Modal styling */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
}

/* Buttons */
.primary-button {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 0.75rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
}
.primary-button:hover {
  background-color: #0056b3;
}
.secondary-button {
  background-color: #6c757d;
  color: #fff;
  border: none;
  padding: 0.75rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
}
.secondary-button:hover {
  background-color: #545b62;
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
