/* Общие настройки */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --cell-size: 50px;
}

/*
body {
  background-color: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}
*/

/* Контейнер игры */
.container {
  width: 100%;
  max-width: 800px;
  text-align: center;
}

h1 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

/* Блок управления (задание и таймер) */
.controls {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  padding: 10px;
  background-color: #e0e0e0;
  border-radius: 8px;
}

.controls div {
  font-size: 1rem;
  color: #444;
}

.highlight-target {
  font-weight: bold;
  color: #d35400;
  font-size: 1.1rem;
}

#timer {
  font-weight: bold;
  color: #c0392b;
}

/* Макет доски */
.board-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

/* Цифры слева */
.numbers-y {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: calc(8 * var(--cell-size));
  width: calc(var(--cell-size) * 0.8);
  margin-right: 5px;
  overflow: hidden;
}

.numbers-y div {
  height: var(--cell-size);
  font-size: calc(var(--cell-size) * 0.4);
  color: #555;
  text-align: right;
  padding-right: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Область доски и букв снизу */
.board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Сама шахматная доска */
#chessboard {
  display: grid;
  grid-template-columns: repeat(8, var(--cell-size));
  grid-template-rows: repeat(8, var(--cell-size));
  gap: 0;
  border: 2px solid #333;
  border-radius: 4px;
  overflow: hidden;
  background-color: #b58863;
}

/* Клетки доски */
.square {
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: calc(var(--cell-size) * 0.6);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.square.white {
  background-color: #f0d9b5;
}

.square.black {
  background-color: #b58863;
}

/* Стили фигур */
.square.white-piece {
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.square.black-piece {
  color: #000;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

/* Подсветка правильных/неправильных кликов */
.square.correct {
  background-color: #90EE90 !important;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
}

.square.wrong {
  background-color: #FF6347 !important;
  box-shadow: 0 0 8px rgba(255, 99, 71, 0.6);
}

/* Буквы снизу */
.letters-x {
  display: flex;
  justify-content: space-around;
  width: calc(8 * var(--cell-size));
  margin-top: 5px;
  height: calc(var(--cell-size) * 0.6);
  overflow: hidden;
}

.letters-x span {
  width: var(--cell-size);
  font-size: calc(var(--cell-size) * 0.4);
  color: #555;
  text-align: center;
  display: inline-block;
}

/* Статистика */
.stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  padding: 15px;
  background-color: #e0e0e0;
  border-radius: 8px;
}

.stats div {
  font-size: 1rem;
  color: #444;
}

#score, #errors, #accuracy {
  font-weight: bold;
  color: #2c3e50;
}

/* Кнопки управления */
.buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

button {
  padding: 12px 24px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

#restart {
  background-color: #3498db;
  color: white;
}

#restart:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
}

#flipBoard {
  background-color: #e74c3c;
  color: white;
}

#flipBoard:hover {
  background-color: #c0392b;
  transform: translateY(-2px);
}

/* Адаптивность */
@media (max-width: 768px) {
  :root {
    --cell-size: 40px;
  }

  .container {
    padding: 10px;
  }

  .controls, .stats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  :root {
    --cell-size: 30px;
  }

  .controls, .stats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }
}
