/* Root Variables */
:root {
  --text-dark: #222;
  --text-medium: #555;
  --accent-color: #6dc3c3;
  --accent-hover: #1c6cd6;
  --secondary-color: #e74c3c;
  --light-gray: #f5f5f5;
}

/* Chess Section Layout */
.chess-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1000px;
  margin: auto;
  padding: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-dark);
}

/* Section Heading */
.chess-section h2 {
  font-size: 2.25rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-align: left;
}

/* Paragraphs */
.chess-section p {
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.5;
  color: var(--text-medium);
  margin-bottom: 1.5rem;
  text-align: left;
  max-width: 600px;
}

/* Container Layout */
.chess-container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
}

/* Chessboard Styling */
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 60px);
  grid-template-rows: repeat(8, 60px);
  border: 2px solid var(--text-dark);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chess-square {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  position: relative;
  user-select: none;
  /* Force chess pieces to always be black */
  color: #000000 !important;
}

.chess-square.light {
  background-color: #f0d9b5;
}

.chess-square.dark {
  background-color: #b58863;
}

.chess-square.selected {
  box-shadow: inset 0 0 0 3px var(--accent-color);
}

.chess-square.possible-move::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: rgba(39, 174, 96, 0.3);
  border-radius: 50%;
}

.chess-square.last-move {
  background-color: rgba(255, 255, 0, 0.3);
}

/* Ensure chess pieces stay black even in dark mode */
.dark-mode .chess-square {
  color: #000000 !important;
}

/* Dark mode adjustments for other chess elements */
.dark-mode .chess-section {
  color: #ffffff;
}

.dark-mode .chess-section h2 {
  color: #ffffff;
}

.dark-mode .chess-section p {
  color: #cccccc;
}

.dark-mode .chess-info {
  background: #333333;
  color: #cccccc;
}

.dark-mode .chess-info h3 {
  color: #ffffff;
}

.dark-mode .game-status {
  background: #444444;
  color: #cccccc;
}

.dark-mode .move-history {
  background: #444444;
  color: #cccccc;
}

.dark-mode .move-history h4 {
  color: #ffffff;
}

.dark-mode .move-entry {
  background: #555555;
  color: #cccccc;
}

.dark-mode .move-entry:nth-child(odd) {
  background: #4a4a4a;
}

.dark-mode .player-input input {
  background: #444444;
  color: #ffffff;
  border-color: #666666;
}

.dark-mode .player-input input:focus {
  border-color: var(--accent-color);
}

/* Info Panel */
.chess-info {
  flex: 1;
  min-width: 280px;
  max-width: 320px;
  background: var(--light-gray);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-medium);
}

.chess-info h3 {
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 1rem;
}

.player-input input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.player-input input:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* Status Box */
.game-status {
  background: white;
  padding: 1rem;
  border-left: 4px solid var(--accent-color);
  border-radius: 5px;
  margin-bottom: 1rem;
  text-align: left;
}

/* Move History */
.move-history {
  background: white;
  padding: 1rem;
  border-radius: 5px;
  max-height: 200px;
  overflow-y: auto;
  text-align: left;
}

.move-history h4 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
}

.move-entry {
  font-size: 0.9rem;
  padding: 0.3rem;
  margin-bottom: 0.3rem;
  background: var(--light-gray);
  border-radius: 3px;
  line-height: 1.4;
}

.move-entry:nth-child(odd) {
  background: #f8f9fa;
}

/* Reset Button */
.reset-btn {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 1rem;
  width: 100%;
  transition: background 0.2s ease;
}

.reset-btn:hover {
  background: #c0392b;
}

/* Responsive */
@media (max-width: 768px) {
  .chess-board {
    grid-template-columns: repeat(8, 45px);
    grid-template-rows: repeat(8, 45px);
  }

  .chess-square {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
  }

  .chess-info {
    max-width: 100%;
  }

  .chess-section h2 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .chess-board {
    grid-template-columns: repeat(8, 40px);
    grid-template-rows: repeat(8, 40px);
  }

  .chess-square {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
  }

  .chess-section {
    padding: 2rem 1rem;
  }
}
