/* Minesweeper Game Styles */

.minesweeper-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.minesweeper-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.btn-flag {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.5rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-flag:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-flag.active {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
}

.btn-flag:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.flag-icon {
  margin-right: 0.25rem;
}

.minesweeper-board {
  display: grid;
  gap: 2px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 8px;
  max-width: 100%;
  overflow: auto;
}

.minesweeper-cell {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #4a5568, #2d3748);
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  user-select: none;
  transition: all 0.1s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.minesweeper-cell:hover:not(.revealed):not(.game-over) {
  background: linear-gradient(145deg, #5a6578, #3d4858);
  transform: scale(1.05);
}

.minesweeper-cell.revealed {
  background: rgba(255, 255, 255, 0.1);
  cursor: default;
  border-color: transparent;
}

.minesweeper-cell.revealed:hover {
  background: rgba(255, 255, 255, 0.15);
}

.minesweeper-cell.mine {
  background: rgba(231, 76, 60, 0.4);
  animation: explode 0.3s ease-out;
}

.minesweeper-cell.flagged {
  background: linear-gradient(145deg, #e67e22, #d35400);
}

.minesweeper-cell.game-over {
  cursor: not-allowed;
}

.minesweeper-board.game-won .minesweeper-cell.flagged {
  background: linear-gradient(145deg, #27ae60, #1e8449);
}

.minesweeper-board.game-lost .minesweeper-cell.mine {
  background: rgba(231, 76, 60, 0.6);
}

.minesweeper-help {
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.minesweeper-help p {
  margin: 0.25rem 0;
}

/* Animation for mine explosion */
@keyframes explode {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .minesweeper-cell {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
}

@media (max-width: 400px) {
  .minesweeper-cell {
    width: 24px;
    height: 24px;
    font-size: 0.8rem;
  }

  .minesweeper-board {
    padding: 4px;
    gap: 1px;
  }
}

/* Number colors for adjacent mines */
.minesweeper-cell.revealed[data-adjacent="1"] { color: #3498db; }
.minesweeper-cell.revealed[data-adjacent="2"] { color: #27ae60; }
.minesweeper-cell.revealed[data-adjacent="3"] { color: #e74c3c; }
.minesweeper-cell.revealed[data-adjacent="4"] { color: #9b59b6; }
.minesweeper-cell.revealed[data-adjacent="5"] { color: #e67e22; }
.minesweeper-cell.revealed[data-adjacent="6"] { color: #1abc9c; }
.minesweeper-cell.revealed[data-adjacent="7"] { color: #2c3e50; }
.minesweeper-cell.revealed[data-adjacent="8"] { color: #7f8c8d; }
