/* ==================== CHESS GAME STYLES ==================== */

.chess-game {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.chess-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.player-name {
  font-weight: 600;
  color: var(--text-primary);
}

.player-timer {
  font-family: 'Courier New', monospace;
  color: var(--accent-yellow);
  font-size: 1.2rem;
}

/* ==================== CHESS BOARD ==================== */

.chess-board-wrapper {
  width: 100%;
  max-width: 500px;
  aspect-ratio: 1;
  padding: 0.5rem;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px var(--shadow);
}

.chess-board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 8px;
  overflow: hidden;
}

/* Classic theme (default) */
.chess-board[data-theme="classic"] .square.light {
  background: #f0d9b5;
}

.chess-board[data-theme="classic"] .square.dark {
  background: #b58863;
}

/* Future themes can be added here */
.chess-board[data-theme="neon"] .square.light {
  background: #1a1a2e;
}

.chess-board[data-theme="neon"] .square.dark {
  background: #16213e;
}

/* Square styles */
.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.square:hover {
  filter: brightness(1.1);
}

.square.selected {
  background: var(--accent-yellow) !important;
  box-shadow: inset 0 0 0 3px var(--accent-purple);
}

.square.legal-move::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  background: var(--accent-magenta);
  border-radius: 50%;
  opacity: 0.5;
  pointer-events: none;
}

.square.last-move {
  background: rgba(168, 85, 247, 0.3) !important;
}

/* Chess pieces */
.piece {
  font-size: clamp(2rem, 8vw, 3.5rem);
  cursor: pointer;
  pointer-events: none;
  transition: transform 0.15s;
}

.piece.white {
  color: #ffffff;
  text-shadow: 
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000;
}

.piece.black {
  color: #000000;
  text-shadow: 
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff;
}

.square:active .piece {
  transform: scale(0.95);
}

/* ==================== CHESS CONTROLS ==================== */

.chess-controls {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 500px;
}

.chess-controls button {
  flex: 1;
}

/* ==================== MOVE HISTORY ==================== */

.move-history {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
}

.move-history h4 {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.moves-list {
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
}

.move-pair {
  display: grid;
  grid-template-columns: 40px 1fr 1fr;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.move-pair:hover {
  background: var(--bg-secondary);
}

.move-num {
  color: var(--text-muted);
  text-align: right;
}

.move-white, .move-black {
  color: var(--text-primary);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 640px) {
  .chess-game {
    padding: 0.5rem;
  }
  
  .chess-board-wrapper {
    padding: 0.25rem;
  }
  
  .piece {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
}
