/* ==============================================
   Mix Of Minesweeper — Fully Responsive + Neon style
   Production version 2.0
   ============================================== */

.mix-minesweeper-wrapper {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 20px auto;
  background: #f8f7f2;
  border: 1px solid #e6e4d9;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  padding: 16px;
  color: #222;
  box-sizing: border-box;
}

/* Toolbar */
.momn-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f0eee5;
  border: 1px solid #e0dccf;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 12px;
}

.momn-stats {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.momn-stat {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 4px 10px;
  text-align: center;
  min-width: 64px;
  font-size: 12px;
}

.momn-stat .label {
  display: block;
  font-size: 10px;
  color: #666;
  line-height: 1;
}

.momn-stat .value {
  font-weight: 800;
  font-size: 16px;
  color: #0f6b78;
  line-height: 1.1;
}

.momn-btn {
  background: linear-gradient(180deg, #47b3c5, #3794a3);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .08s ease, box-shadow .15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.momn-btn:active { transform: translateY(1px); }
.momn-btn:focus-visible {
  outline: 2px solid #0f6b78;
  outline-offset: 2px;
}

.momn-btn-flag[aria-pressed="true"] {
  background: #d86c5b;
  box-shadow: 0 0 0 3px rgba(216, 108, 91, 0.25);
}

.momn-btn-reset .emoji { font-size: 15px; }

/* Board wrapper + dynamic grid */
.momn-board-wrapper {
  display: flex;
  justify-content: center;
  margin: 8px 0;
  overflow: auto; /* allow horizontal scroll on very wide expert boards on phones */
  -webkit-overflow-scrolling: touch;
}

.momn-board {
  display: grid;
  gap: 3px;
  background: #e8e6db;
  padding: clamp(6px, 1.8vw, 12px);
  border-radius: 10px;
  border: 1px solid #d6d3c4;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
  /* Dynamic values set by JS */
  grid-template-columns: repeat(var(--cols, 16), var(--cell-size, 32px));
  --cell-size: 32px;
}

/* Cells — sized by CSS var for perfect responsiveness */
.momn-board .momn-cell {
  width: var(--cell-size, 32px);
  height: var(--cell-size, 32px);
  min-width: 22px;
  min-height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(11px, calc(var(--cell-size, 32px) * 0.48), 20px);
  color: #222;
  background: #fff;
  border: 1px solid #c9c6b8;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  cursor: pointer;
  user-select: none;
  transition: background .1s ease, transform .08s ease, border-color .1s ease;
  touch-action: manipulation;
}

.momn-board .momn-cell:hover:not(.open):not(.flag) {
  background: #f0f7f8;
  border-color: #47b3c5;
}

.momn-board .momn-cell:active {
  transform: scale(0.94);
}

.momn-board .momn-cell.open {
  background: #f4f2e9;
  border-color: #a8a48f;
  box-shadow: none;
  cursor: default;
}

.momn-board .momn-cell.flag {
  color: #c94c3c;
  font-size: calc(var(--cell-size, 32px) * 0.55);
  background: #fff;
}

.momn-board .momn-cell.mine {
  background: #f8d7d0;
  color: #9c2e2e;
  border-color: #d86c5b;
}

/* Number colors (classic + neon pop) */
.momn-board .momn-cell.open[data-number="1"] { color: #1e88e5; font-weight: 800; }
.momn-board .momn-cell.open[data-number="2"] { color: #2e7d32; }
.momn-board .momn-cell.open[data-number="3"] { color: #c62828; }
.momn-board .momn-cell.open[data-number="4"] { color: #6a1b9a; }
.momn-board .momn-cell.open[data-number="5"] { color: #d84315; }
.momn-board .momn-cell.open[data-number="6"] { color: #00838f; }
.momn-board .momn-cell.open[data-number="7"] { color: #37474f; }
.momn-board .momn-cell.open[data-number="8"] { color: #5d4037; }

/* Presets row */
.momn-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 4px;
}

.momn-preset {
  background: #fff;
  border: 1px solid #d6d3c4;
  color: #333;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}

.momn-preset:hover,
.momn-preset:focus-visible {
  border-color: #47b3c5;
  background: #f0f7f8;
}

.momn-preset.active {
  background: #47b3c5;
  color: #fff;
  border-color: #47b3c5;
}

/* Custom size panel */
.momn-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  justify-content: center;
  background: #f0eee5;
  border: 1px solid #e0dccf;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}

.momn-custom label {
  font-size: 12px;
  color: #555;
}

.momn-custom input {
  width: 62px;
  padding: 4px 6px;
  border: 1px solid #c9c6b8;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
}

.momn-custom input:focus {
  border-color: #47b3c5;
  outline: none;
  box-shadow: 0 0 0 2px rgba(71, 179, 197, 0.2);
}

/* Footer hint */
.momn-footer {
  margin-top: 10px;
  font-size: 11px;
  color: #777;
  line-height: 1.3;
}

/* Modal */
.momn-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.momn-modal-content {
  background: #fff;
  border: 1px solid #e0dccf;
  border-radius: 14px;
  padding: 22px 28px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  max-width: 280px;
  animation: momn-pop .2s ease;
}

.momn-modal-content h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.momn-modal-content .momn-btn {
  margin-top: 12px;
}

/* Neon / cyber touches */
.mix-minesweeper-wrapper .momn-stat .value {
  color: #0f6b78;
  text-shadow: 0 0 1px rgba(71,179,197,0.3);
}

.momn-board .momn-cell.open {
  box-shadow: inset 0 0 0 1px rgba(71,179,197,0.15);
}

/* Strong responsiveness */
@media (max-width: 420px) {
  .momn-toolbar { flex-direction: column; align-items: stretch; }
  .momn-stats { justify-content: center; }
  .momn-presets { gap: 4px; }
  .momn-preset { padding: 4px 9px; font-size: 11px; }
}

@media (max-width: 340px) {
  .momn-board { gap: 2px; padding: 6px; }
}

/* Accessibility */
.mix-minesweeper-wrapper:focus-within .momn-board {
  outline: 2px solid #47b3c5;
  outline-offset: 3px;
  border-radius: 8px;
}

@keyframes momn-pop {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
