/* ── Minesweeper ── */

.minesweeper-container {
  background: #c0c0c0;
  border-radius: var(--radius-lg, 16px);
  padding: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  border: 3px solid #999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ── Controls Bar ── */
.ms-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 2px solid #999;
}

.ms-btn {
  padding: 6px 14px;
  border: 2px outset #ddd;
  border-radius: 0;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: #c0c0c0;
  color: #000;
  transition: background 0.1s;
}

.ms-btn:hover { background: #d4d4d4; }
.ms-btn:active { border-style: inset; }

/* Difficulty toggle */
.ms-difficulty {
  display: flex;
  gap: 0;
  border: 2px inset #ddd;
}

.ms-diff-opt {
  padding: 5px 12px;
  border: none;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  background: #c0c0c0;
  color: #555;
  transition: background 0.1s;
}

.ms-diff-opt.active {
  background: #a0a0a0;
  color: #000;
}

.ms-diff-opt:hover { background: #b0b0b0; }

/* Status bar (mines left, timer, face) */
.ms-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.ms-counter {
  background: #000;
  color: #f00;
  font-family: 'Courier New', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 2px 8px;
  border: 2px inset #666;
  min-width: 48px;
  text-align: center;
  letter-spacing: 2px;
}

.ms-face {
  width: 36px;
  height: 36px;
  border: 2px outset #ddd;
  background: #c0c0c0;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.ms-face:active { border-style: inset; }

/* ── Grid ── */
.ms-grid {
  display: inline-grid;
  gap: 0;
  border: 3px inset #999;
  background: #c0c0c0;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Cell ── */
.ms-cell {
  width: clamp(26px, 4vw, 34px);
  height: clamp(26px, 4vw, 34px);
  border: 2px outset #eee;
  background: #c0c0c0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(12px, 1.8vw, 16px);
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.ms-cell:hover:not(.revealed):not(.flagged) {
  background: #d0d0d0;
}

.ms-cell.revealed {
  border: 1px solid #999;
  background: #d4d4d4;
  cursor: default;
}

.ms-cell.flagged {
  cursor: pointer;
}

.ms-cell.flagged::after {
  content: '🚩';
  font-size: clamp(11px, 1.6vw, 15px);
}

.ms-cell.mine-hit {
  background: #f00;
}

.ms-cell.mine-shown::after {
  content: '💣';
  font-size: clamp(11px, 1.6vw, 15px);
}

/* Number colors */
.ms-cell.n1 { color: #0000ff; }
.ms-cell.n2 { color: #008000; }
.ms-cell.n3 { color: #ff0000; }
.ms-cell.n4 { color: #000080; }
.ms-cell.n5 { color: #800000; }
.ms-cell.n6 { color: #008080; }
.ms-cell.n7 { color: #000; }
.ms-cell.n8 { color: #808080; }

/* ── Game Over Overlay ── */
.ms-game-over {
  text-align: center;
  padding: 16px;
  display: none;
}

.ms-game-over.visible { display: block; }

.ms-game-over-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 4px;
}

.ms-game-over-stats {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 12px;
}

.ms-game-over-btn {
  padding: 8px 24px;
  border: 2px outset #ddd;
  background: #c0c0c0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.ms-game-over-btn:hover { background: #d4d4d4; }
.ms-game-over-btn:active { border-style: inset; }

/* ── Best Stats ── */
.ms-best {
  display: flex;
  gap: 16px;
  justify-content: center;
  color: #666;
  font-size: 0.72rem;
  padding-top: 6px;
  border-top: 2px solid #999;
  width: 100%;
}

.ms-best span {
  color: #333;
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .minesweeper-container { padding: 10px 6px; }
  .ms-controls { gap: 6px; }
  .ms-diff-opt { padding: 4px 8px; font-size: 0.72rem; }
  .ms-counter { font-size: 1.1rem; min-width: 40px; }
  .ms-face { width: 30px; height: 30px; font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .minesweeper-container { padding: 8px 4px; border-radius: 12px; }
  .ms-controls { justify-content: center; }
  .ms-status { margin-left: 0; }
  .ms-cell {
    width: clamp(22px, 7vw, 30px);
    height: clamp(22px, 7vw, 30px);
    font-size: clamp(10px, 2.5vw, 14px);
  }
  .ms-cell.flagged::after,
  .ms-cell.mine-shown::after {
    font-size: clamp(9px, 2.2vw, 13px);
  }
}
