/* style.css - Все стили приложения */

/* Базовые стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  padding: 20px;
}

main {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: #2c3e50;
}

/* Статус игры */
#status-text {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: #34495e;
  min-height: 2rem;
}

/* Кнопка «Новая игра» */
#new-game-btn {
  display: inline-block;
  margin-bottom: 20px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #2980b9;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;

  /* Контрастность WCAG AA: #ffffff на #2980b9 = 4.6:1 (проходит) */
}

#new-game-btn:hover {
  background-color: #2471a3; /* #ffffff на #2471a3 = 5.1:1 — WCAG AA (проходит) */
}

#new-game-btn:focus-visible {
  outline: 3px solid #3498db;
  outline-offset: 2px;
}

#new-game-btn:active {
  background-color: #1a6a9a;
  transform: scale(0.98);
}

/* Адаптивность кнопки для мобильных устройств */
@media (max-width: 480px) {
  #new-game-btn {
    font-size: 0.9rem;
    padding: 8px 18px;
  }
}

/* Игровое поле - CSS Grid */
#game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  background-color: #34495e;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: gap 0.2s ease;
}

/* Клетки поля */
.cell {
  aspect-ratio: 1;
  border: none;
  background-color: #ffffff;
  font-size: 3rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  color: #2c3e50;

  /* Обеспечиваем контрастность WCAG AA (минимум 4.5:1) */
  /* Текущее значение: #2c3e50 на #ffffff = 12.6:1 (отлично) */
  /* При изменении цветов проверяйте контраст: https://webaim.org/resources/contrastchecker/ */
}

.cell:hover {
  background-color: #ecf0f1;
  transform: scale(1.05);
}

.cell:focus-visible {
  outline: 3px solid #3498db;
  outline-offset: 2px;
}

.cell:active {
  transform: scale(0.98);
}

.cell:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.cell:disabled:hover {
  background-color: #ffffff;
  transform: none;
}

/* Поддержка тач-событий */
.cell {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  #status-text {
    font-size: 1.25rem;
  }

  #game-board {
    max-width: 90vw;
    padding: 10px;
    gap: 7px;
  }

  .cell {
    font-size: 2rem;
  }
}

/* Адаптивность для очень маленьких экранов (320px) */
@media (max-width: 360px) {
  h1 {
    font-size: 1.75rem;
  }

  #status-text {
    font-size: 1.1rem;
  }

  #game-board {
    padding: 8px;
    gap: 6px;
  }

  .cell {
    font-size: 1.75rem;
  }
}

/* Адаптивность для планшетов */
@media (min-width: 768px) {
  #game-board {
    max-width: 450px;
  }

  .cell {
    font-size: 3.5rem;
  }
}

/* Адаптивность для десктопов */
@media (min-width: 1200px) {
  h1 {
    font-size: 3rem;
  }

  #game-board {
    max-width: 500px;
  }
}
