/* ToolyLab — Mayın Tarlası (Minesweeper) */
.ms-tool { max-width: 460px; margin: 0 auto; }
.ms-tool .calc-card { gap: var(--spacing-md); }

/* Mobilde kenar boşluklarını azalt → oyun alanı büyür */
@media (max-width: 640px) {
  .ms-tool .calc-card { padding: var(--spacing-md) var(--spacing-sm); }
}

.ms-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}
.ms-stats { display: inline-flex; align-items: center; gap: var(--spacing-md); }
.ms-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-secondary);
}
.ms-stat svg { width: 17px; height: 17px; }
.ms-stat span { color: var(--text-primary); min-width: 18px; text-align: right; }

/* Tahta */
.ms-board { position: relative; }
.ms-grid {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--n, 9), 1fr);
  gap: 3px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 3px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-sm);
  touch-action: manipulation;
}
.ms-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-weight: 800;
  line-height: 1;
  font-size: clamp(0.5rem, 5.2cqi, 1.3rem);
  cursor: pointer;
  transition: background 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.ms-cell:hover { background: rgba(255, 255, 255, 0.16); }
.ms-cell.open { background: rgba(255, 255, 255, 0.03); cursor: default; }
.ms-cell.flag { color: #f87171; background: rgba(255, 255, 255, 0.12); }
.ms-cell.flag svg { width: 62%; height: 62%; }
.ms-cell.mine { color: var(--text-secondary); }
.ms-cell.mine svg { width: 66%; height: 66%; }
.ms-cell.boom { background: rgba(248, 113, 113, 0.55); color: #fff; }

/* Sayı renkleri */
.ms-cell.n1 { color: #60a5fa; }
.ms-cell.n2 { color: #34d399; }
.ms-cell.n3 { color: #f87171; }
.ms-cell.n4 { color: #a78bfa; }
.ms-cell.n5 { color: #fb923c; }
.ms-cell.n6 { color: #22d3ee; }
.ms-cell.n7 { color: #e879f9; }
.ms-cell.n8 { color: #cbd5e1; }

/* Kaplama */
.ms-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  border: none;
  border-radius: var(--border-radius-sm);
  background: rgba(15, 15, 25, 0.76);
  backdrop-filter: blur(4px);
  cursor: pointer;
  padding: var(--spacing-md);
}
.ms-overlay[hidden] { display: none; }
.ms-ov-icon svg { width: 44px; height: 44px; }
.ms-overlay.is-win .ms-ov-icon svg { color: #34d399; }
.ms-overlay.is-lose .ms-ov-icon svg { color: #f87171; }
.ms-ov-title { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); }
.ms-ov-sub { font-size: 0.92rem; color: var(--text-secondary); font-weight: 600; }

/* Kontroller */
.ms-controls { display: grid; grid-template-columns: 1fr 1fr; gap: var(--spacing-sm); }
.ms-ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--spacing-sm);
  font-size: 0.9rem;
}
.ms-ctl svg { width: 18px; height: 18px; }
.ms-mode { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); color: var(--text-secondary); }
.ms-mode .ms-mode-flag { display: none; }
.ms-mode.flag-on { background: rgba(248, 113, 113, 0.18); border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; }
.ms-mode.flag-on .ms-mode-dig { display: none; }
.ms-mode.flag-on .ms-mode-flag { display: inline-flex; }
.ms-new { background: var(--gradient-primary); color: #fff; border: none; }
.ms-new:hover { opacity: 0.92; color: #fff; }

.ms-hint { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin: 0; }
