.minesweeper-shell-page {
  background:
    radial-gradient(circle at 12% 8%, rgba(123, 182, 255, 0.26), transparent 24%),
    radial-gradient(circle at 86% 12%, rgba(255, 191, 118, 0.18), transparent 24%),
    linear-gradient(180deg, #f4eadf 0%, #dce9f6 100%);
}

.minesweeper-page-content {
  position: relative;
}

.minesweeper-head .page-copy {
  max-width: 34rem;
}

.minesweeper-stage-card {
  position: relative;
  padding: 18px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 252, 248, 0.92), rgba(246, 251, 255, 0.88)),
    rgba(255, 250, 244, 0.82);
}

.ms-topbar,
.ms-mode-banner,
.ms-board-meta,
.ms-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ms-topbar {
  margin-bottom: 14px;
}

.ms-topbar h2,
.ms-info-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.ms-difficulty-group,
.ms-mode-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ms-difficulty-group {
  margin-bottom: 14px;
}

.ms-difficulty-button,
.ms-mode-button {
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid rgba(58, 42, 27, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--moyu-ink);
  font: inherit;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ms-difficulty-button span {
  display: block;
  margin-top: 4px;
  color: var(--moyu-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.ms-difficulty-button.active,
.ms-mode-button.active {
  border-color: rgba(196, 84, 29, 0.28);
  background: linear-gradient(135deg, rgba(244, 124, 56, 0.18), rgba(121, 183, 255, 0.18));
  box-shadow: 0 14px 26px rgba(196, 84, 29, 0.14);
}

.ms-hud-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ms-hud-card {
  padding: 14px 15px;
  border-radius: 22px;
  border: 1px solid rgba(58, 42, 27, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.ms-hud-label {
  display: block;
  margin-bottom: 6px;
  color: var(--moyu-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.ms-hud-card strong {
  font-size: 1.24rem;
}

.ms-mode-banner {
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(49, 64, 92, 0.08);
  border: 1px solid rgba(58, 42, 27, 0.08);
}

.ms-mode-copy {
  min-width: 92px;
}

.ms-mode-label {
  display: block;
  margin-bottom: 4px;
  color: var(--moyu-muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ms-hint-text {
  margin: 0;
  color: var(--moyu-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.ms-board-shell {
  position: relative;
  margin-bottom: 16px;
}

.ms-board-frame {
  padding: 12px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(26, 38, 61, 0.08), rgba(255, 255, 255, 0.68)),
    rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(58, 42, 27, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.ms-board {
  --ms-cols: 9;
  --ms-cell: 30px;
  --ms-gap: 6px;
  --ms-font: 0.98rem;
  display: grid;
  grid-template-columns: repeat(var(--ms-cols), var(--ms-cell));
  gap: var(--ms-gap);
  justify-content: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.ms-cell {
  display: grid;
  place-items: center;
  width: var(--ms-cell);
  height: var(--ms-cell);
  border: 0;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #dfe8f3 0%, #b7c7d8 100%);
  color: #304053;
  font: inherit;
  font-size: var(--ms-font);
  font-weight: 900;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.52),
    inset 0 -2px 0 rgba(38, 53, 71, 0.12);
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.ms-cell.is-pressing {
  transform: scale(0.96);
}

.ms-cell.is-revealed {
  background: rgba(248, 250, 252, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.ms-cell.is-hidden {
  cursor: pointer;
}

.ms-cell.is-flagged {
  background: linear-gradient(180deg, #ffe8cc 0%, #ffc98a 100%);
  color: #b95511;
}

.ms-cell.is-mine {
  background: linear-gradient(180deg, #ffd8d8 0%, #ff8b8b 100%);
  color: #7a1521;
}

.ms-cell.is-exploded {
  background: linear-gradient(180deg, #ff9b8b 0%, #ea5a4f 100%);
  color: #ffffff;
}

.ms-cell.is-wrong {
  background: linear-gradient(180deg, #eef2f6 0%, #d4dce5 100%);
  color: #73839b;
}

.ms-cell[data-number="1"] { color: #2f70d4; }
.ms-cell[data-number="2"] { color: #288a5a; }
.ms-cell[data-number="3"] { color: #d14c46; }
.ms-cell[data-number="4"] { color: #6b59cf; }
.ms-cell[data-number="5"] { color: #9f4e21; }
.ms-cell[data-number="6"] { color: #1e8a94; }
.ms-cell[data-number="7"] { color: #2a3446; }
.ms-cell[data-number="8"] { color: #5d6776; }

.ms-board-meta {
  align-items: flex-start;
  margin-top: 10px;
  color: var(--moyu-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.ms-board-meta span:first-child {
  font-weight: 800;
  color: var(--moyu-accent-deep);
}

.stage-toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translate(-50%, 12px);
  min-width: 180px;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(28, 38, 55, 0.92);
  color: #f7fbff;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.stage-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stage-toast.hidden {
  visibility: hidden;
}

.ms-mode-dock {
  position: sticky;
  bottom: calc(82px + env(safe-area-inset-bottom));
  z-index: 3;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 250, 244, 0.92);
  border: 1px solid rgba(58, 42, 27, 0.08);
  box-shadow: 0 16px 32px rgba(76, 51, 31, 0.12);
  backdrop-filter: blur(12px);
}

.ms-mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ms-mode-icon {
  font-size: 1rem;
}

.ms-insight-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.ms-info-card {
  border: 1px solid var(--moyu-border);
  box-shadow: var(--moyu-shadow);
  background: rgba(255, 250, 244, 0.78);
}

.ms-record-list {
  display: grid;
  gap: 10px;
}

.ms-record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(58, 42, 27, 0.08);
}

.ms-record-item strong {
  font-size: 1rem;
}

.ms-record-meta {
  color: var(--moyu-muted);
  font-size: 0.82rem;
}

.ms-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(13, 19, 30, 0.44);
  backdrop-filter: blur(10px);
}

.ms-result-overlay.hidden {
  display: none;
}

.ms-result-card {
  width: min(100%, 360px);
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(180deg, #fffaf4 0%, #eef6ff 100%);
  box-shadow: 0 28px 56px rgba(18, 27, 42, 0.28);
}

.ms-result-tag {
  margin: 0 0 8px;
  color: var(--moyu-accent-deep);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ms-result-card h2 {
  margin: 0 0 10px;
  font-size: 1.5rem;
}

.ms-result-text {
  margin: 0 0 14px;
  color: var(--moyu-muted);
  line-height: 1.6;
}

.ms-result-meta {
  margin-bottom: 16px;
  flex-wrap: wrap;
  color: var(--moyu-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.ms-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ms-result-actions button {
  min-height: 48px;
  border-radius: 18px;
  border: 0;
  font: inherit;
  font-weight: 800;
}

.ms-result-actions button:first-child {
  color: #fff9f4;
  background: linear-gradient(135deg, var(--moyu-accent), var(--moyu-accent-deep));
}

.ms-result-actions .button-outline {
  border: 1px solid rgba(58, 42, 27, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--moyu-ink);
}

@media (min-width: 768px) {
  .ms-insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .minesweeper-stage-card {
    padding: 16px;
  }

  .ms-topbar,
  .ms-mode-banner,
  .ms-board-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .ms-mode-dock {
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) {
  .minesweeper-stage-card {
    padding: 12px;
    border-radius: 24px;
  }

  .ms-topbar,
  .ms-mode-banner,
  .ms-board-meta,
  .ms-result-meta {
    gap: 10px;
  }

  .ms-difficulty-group,
  .ms-mode-dock,
  .ms-hud-grid {
    gap: 8px;
  }

  .ms-difficulty-button,
  .ms-mode-button {
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 16px;
  }

  .ms-hud-card,
  .ms-mode-banner {
    padding: 12px;
    border-radius: 18px;
  }

  .ms-board {
    --ms-cell: 28px;
    --ms-gap: 5px;
    --ms-font: 0.92rem;
  }
}
