/* Подключение стилей и шрифтов */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body {
  background-color: #1e1e1f;
  color: #fff;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Блокировка вертикального режима */
#rotate-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: #111;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.rotate-icon {
  font-size: 50px;
  margin-bottom: 20px;
  animation: spin 2s infinite linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media screen and (orientation: portrait) {
  #rotate-warning {
    display: flex;
  }
  #app {
    display: none;
  }
}

/* Главный контейнер */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 6px 12px;
}

/* Шапка */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
}

.score {
  font-size: 14px;
  font-weight: bold;
}
.score span {
  color: #55ff55;
}

/* Кнопка в стиле Minecraft */
.mc-button {
  background: #727272;
  border: 2px solid #000;
  border-top-color: #dbdbdb;
  border-left-color: #dbdbdb;
  border-bottom-color: #383838;
  border-right-color: #383838;
  color: #fff;
  padding: 4px 16px;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  text-shadow: 1px 1px #000;
}

.mc-button:active {
  border-top-color: #383838;
  border-left-color: #383838;
  border-bottom-color: #dbdbdb;
  border-right-color: #dbdbdb;
}

/* Игровые поля */
.boards-container {
  display: flex;
  flex: 1;
  gap: 16px;
  justify-content: center;
  align-items: center;
  height: calc(100vh - 50px);
}

.player-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.player-title {
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.p1-title { color: #55ffff; }
.p2-title { color: #ffaa00; }

/* Сетка 5х5 */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 3px;
  background: #111;
  padding: 4px;
  border: 2px solid #3c3f41;
  /* Адаптивный квадрат под высоту ландшафтного экрана */
  height: calc(100% - 24px);
  aspect-ratio: 1 / 1;
}

/* Ячейка с предметом */
.cell {
  background: #313233;
  border: 1px solid #48494a;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s ease;
}

/* Отрисовка пиксель-арта без размытия */
.cell img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  pointer-events: none;

  /* Nearest Neighbor для пиксельной графики */
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Состояние выполненного задания */
.cell.completed {
  background-color: #2e6629;
  border-color: #55ff55;
}

.cell.completed::after {
  content: '✔';
  position: absolute;
  font-size: 20px;
  color: #55ff55;
  text-shadow: 0 0 3px #000;
}

.cell.completed img {
  opacity: 0.35;
}