/* =============================================================
   ARCADE · minesweeper.css
   ============================================================= */

.game-page--mine {
  --accent: var(--cyan);
  --accent-soft: rgba(77, 225, 255, 0.15);
  --board-w: max-content;
}

/* -------------------------------------------------------------
   Board
   ------------------------------------------------------------- */
.ms-board {
  --gap: 3px;
  --cell: clamp(
    18px,
    calc((min(100vw, 780px) - 5.5rem) / var(--cols)),
    36px
  );
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  gap: var(--gap);
  padding: 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #15151c;
  max-width: 100%;
  overflow: auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cell {
  position: relative;
  width: var(--cell);
  height: var(--cell);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  padding: 0;
  background: linear-gradient(
    170deg,
    rgba(255, 255, 255, 0.11),
    rgba(255, 255, 255, 0.045)
  );
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 1px 2px rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
  font-size: calc(var(--cell) * 0.6);
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s var(--ease), transform 0.12s var(--ease),
    box-shadow 0.12s var(--ease);
}

.cell:hover:not(.is-open) {
  background: linear-gradient(
    170deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.08)
  );
}

.cell:active:not(.is-open) {
  transform: scale(0.94);
}

.cell.is-open {
  background: #0e0e14;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.035) inset;
  cursor: default;
}

/* numbers */
.cell.is-open[data-n="1"] {
  color: #4da3ff;
}
.cell.is-open[data-n="2"] {
  color: #3ddc97;
}
.cell.is-open[data-n="3"] {
  color: #ff6b6b;
}
.cell.is-open[data-n="4"] {
  color: #b388ff;
}
.cell.is-open[data-n="5"] {
  color: #ffb03d;
}
.cell.is-open[data-n="6"] {
  color: #4de1ff;
}
.cell.is-open[data-n="7"] {
  color: #f3f3f7;
}
.cell.is-open[data-n="8"] {
  color: #8d8d9e;
}

/* flag */
.cell.is-flag::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  translate: -50% -50%;
  width: 2px;
  height: 46%;
  background: var(--amber);
  border-radius: 2px;
}

.cell.is-flag::after {
  content: "";
  position: absolute;
  left: calc(50% + 1px);
  top: 26%;
  width: 0;
  height: 0;
  border-top: calc(var(--cell) * 0.13) solid transparent;
  border-bottom: calc(var(--cell) * 0.13) solid transparent;
  border-left: calc(var(--cell) * 0.26) solid var(--amber);
}

/* mine */
.cell.is-mine::after {
  content: "";
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4) inset,
    0 0 14px -3px var(--coral);
}

.cell.is-mine.is-open {
  background: rgba(255, 107, 74, 0.14);
}

.cell.is-wrong::after {
  content: "✕";
  position: absolute;
  font-size: calc(var(--cell) * 0.62);
  color: var(--rose);
}

.cell.is-wrong::before {
  display: none;
}

/* -------------------------------------------------------------
   HUD extras
   ------------------------------------------------------------- */
.ms-hud .hud__v.is-warn {
  color: var(--coral);
}

/* -------------------------------------------------------------
   Toolbar
   ------------------------------------------------------------- */
.ms-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 780px;
}

.ms-toolbar .hint {
  font-size: 0.78rem;
  color: var(--dim);
}

.ms-toolbar .hint b {
  color: var(--muted);
  font-weight: 600;
}

.ms-toolbar .btn {
  padding: 0.55rem 1.05rem;
  font-size: 0.82rem;
}

/* -------------------------------------------------------------
   Difficulty
   ------------------------------------------------------------- */
.diff--ms button {
  font-size: 0.74rem;
}

/* -------------------------------------------------------------
   Responsive
   ------------------------------------------------------------- */
@media (max-width: 560px) {
  .ms-board {
    padding: 0.5rem;
    --gap: 2px;
  }

  .ms-toolbar {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .ms-toolbar .btn {
    width: 100%;
  }

  .ms-toolbar .hint {
    text-align: center;
  }
}