/* Game-specific styles: board, color picker, scores, overlays, sidebar, log */

.game-board {
  display: grid;
  gap: 2px;
  margin: 20px auto;
  background: #333;
  padding: 2px;
  border-radius: 5px;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  text-shadow: 0 0 4px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.8);
  transition: opacity 0.2s;
  user-select: none;
}

.game-info { text-align: center; margin-bottom: 20px; }
#turn-indicator { font-size: 1.2em; font-weight: bold; margin-top: 10px; }
.move-counter { font-size: 1em; color: #667eea; font-weight: bold; margin-top: 4px; }

.color-picker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
}

.color-picker-label { font-size: 1.1em; font-weight: bold; text-align: center; }
.color-picker-label.your-turn { color: #4CAF50; }
.color-picker-label.waiting-turn { color: #666; }

.timer-display { font-size: 1.3em; font-weight: bold; color: #667eea; margin-top: 4px; }
.timer-display.warning { color: #ff6b6b; animation: pulse 0.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.color-picker-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
}

.your-turn, .waiting-turn { font-size: 1.1em; font-weight: bold; width: 100%; text-align: center; }
.your-turn { color: #4CAF50; }
.waiting-turn { color: #666; }

.color-btn {
  flex: 1;
  max-width: 55px;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 3px solid #333;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}
.color-btn:hover:not(.disabled) { transform: scale(1.1); }
.color-btn.disabled { opacity: 0.3; cursor: not-allowed; }

.score-board { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 20px 0; font-size: 1.1em; }
.player-score { flex: 1; min-width: 0; padding: 10px 16px; border-radius: 8px; font-weight: bold; text-align: center; display: flex; align-items: center; justify-content: center; gap: 8px; }
.player-symbol { font-size: 1.3em; }
.player-1-score { background: #FFE5E5; border: 2px solid #FF6B6B; }
.player-2-score { background: #E5F5FF; border: 2px solid #4ECDC4; }
.player-3-score { background: #FFF5E5; border: 2px solid #FFA07A; }
.player-4-score { background: #F0FFE5; border: 2px solid #98D8C8; }

.back-btn { background: #667eea; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 1em; margin-bottom: 20px; }
.back-btn:hover { background: #5568d3; }
.back-btn-inline { background: none; border: none; color: #667eea; font-size: 0.95em; cursor: pointer; padding: 0 0 16px 0; display: block; text-align: left; }
.back-btn-inline:hover { text-decoration: underline; }

.game-over { text-align: center; padding: 20px; background: #f0f0f0; border-radius: 10px; margin-top: 20px; }
.game-over h2 { color: #667eea; margin-bottom: 10px; }
.restart-btn { background: #667eea; color: white; border: none; padding: 12px 30px; border-radius: 5px; cursor: pointer; font-size: 1.1em; margin-top: 15px; }
.restart-btn:hover { background: #5568d3; }

.reconnect-message { background: #fff3cd; border: 2px solid #ffc107; border-radius: 8px; padding: 20px; margin: 20px 0; text-align: center; }
.reconnect-message p { margin: 10px 0; color: #856404; font-weight: bold; }

.game-layout { display: flex; gap: 20px; align-items: flex-start; }
.game-main { flex: 1; min-width: 0; }
.board-wrapper { position: relative; width: 100%; display: flex; justify-content: center; align-items: flex-start; }

.game-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; border-radius: 5px; z-index: 10; }
.game-over-modal { background: white; border-radius: 12px; padding: 30px 40px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.3); max-width: 360px; width: 90%; }
.game-over-modal h2 { color: #667eea; font-size: 1.6em; margin-bottom: 16px; }
.game-over-scores { margin: 12px 0 20px; font-size: 1em; color: #444; line-height: 1.8; }
.waiting-restart { color: #888; font-style: italic; margin: 10px 0; }
.back-btn-small { background: none; border: 1px solid #ccc; color: #888; padding: 8px 16px; border-radius: 5px; cursor: pointer; font-size: 0.9em; margin-top: 8px; }
.back-btn-small:hover { background: #f5f5f5; }

.game-sidebar { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.sidebar-section { background: #f9f9f9; border-radius: 8px; padding: 14px; border: 1px solid #e0e0e0; }
.sidebar-section h3 { color: #667eea; font-size: 0.95em; margin-bottom: 10px; }
.win-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 0.9em; border-bottom: 1px solid #eee; }
.win-row:last-child { border-bottom: none; }
.win-count { font-weight: bold; color: #667eea; }

#game-log-entries { max-height: 300px; overflow-y: auto; font-size: 0.82em; }
.log-entry { padding: 4px 0; border-bottom: 1px solid #eee; line-height: 1.4; color: #444; }
.log-entry:last-child { border-bottom: none; }
.log-time { color: #aaa; font-size: 0.85em; margin-right: 4px; }
.log-win { color: #2e7d32; font-weight: bold; }
.log-warn { color: #b45309; }
.log-info { color: #444; }
