@import url("../numbrix/styles.css");

.minesweeper-page .game-panel {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}

.minesweeper-page .difficulty-row {
  grid-template-columns: repeat(3, 1fr);
}

.minesweeper-page .play-sidebar {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
}

.minesweeper-page .sidebar-records {
  min-height: auto;
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tool-button {
  min-height: 38px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.tool-button.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dim) 100%);
  color: #fff;
  box-shadow: 0 2px 12px var(--blue-glow);
}

.mine-board {
  --size: 12;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  grid-template-rows: repeat(var(--size), minmax(0, 1fr));
  width: min(100%, 76dvh);
  aspect-ratio: 1;
  margin: auto;
  overflow: hidden;
  box-sizing: border-box;
  border: 3px solid rgba(230,235,255,0.58);
  border-radius: 12px;
  background: rgba(12,15,28,0.72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 18px 42px rgba(0,0,0,0.22);
}

.mine-cell {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.08);
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(145deg, rgba(91,107,172,0.26), rgba(36,43,70,0.68));
  color: var(--ink);
  font-size: clamp(14px, calc(50vw / var(--size)), 28px);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.mine-cell:hover {
  background: rgba(107,127,232,0.38);
}

.mine-cell.is-open {
  background: rgba(255,255,255,0.055);
  cursor: default;
}

.mine-cell.is-flagged {
  color: var(--rose);
}

.mine-cell.is-mine {
  background: rgba(255,112,154,0.18);
}

.mine-cell.is-blown {
  background: rgba(255,112,154,0.42);
}

.mine-cell[data-count="1"] { color: #8ea2ff; }
.mine-cell[data-count="2"] { color: #71d99e; }
.mine-cell[data-count="3"] { color: #ff8faf; }
.mine-cell[data-count="4"] { color: #c4a7ff; }
.mine-cell[data-count="5"] { color: #ffd166; }
.mine-cell[data-count="6"] { color: #69d2e7; }
.mine-cell[data-count="7"] { color: #f8f8f2; }
.mine-cell[data-count="8"] { color: #b8c0d9; }

@media (max-width: 760px) {
  .minesweeper-page .game-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto;
    grid-template-areas:
      "top"
      "difficulty"
      "status"
      "board"
      "info"
      "tools"
      "controls";
  }

  .minesweeper-page .play-sidebar {
    gap: 7px;
  }

  .minesweeper-page .difficulty-row {
    grid-area: difficulty;
    grid-template-columns: repeat(3, 1fr);
  }

  .minesweeper-page .status-strip {
    grid-area: status;
    grid-template-columns: repeat(3, 1fr);
  }

  .minesweeper-page .info-row {
    grid-area: info;
    margin: 5px 2px 6px;
  }

  .minesweeper-page .tool-row {
    grid-area: tools;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 7px;
  }

  .minesweeper-page .tool-button {
    min-height: 42px;
    border-radius: 9px;
    font-size: 15px;
  }

  .minesweeper-page .controls {
    grid-area: controls;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .minesweeper-page .controls .button {
    min-height: 40px;
    border-radius: 9px;
    font-size: 14px;
  }

  .mine-board {
    width: min(100%, 92vw);
    border-width: 2px;
    border-radius: 10px;
  }

  .mine-cell {
    font-size: clamp(11px, calc(78vw / var(--size)), 24px);
  }
}
