.mines-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.mines-hero,
.mines-layout,
.mines-board-panel,
.mines-panel {
  position: relative;
}

.mines-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 244, 189, 0.82) 0 28px, transparent 29px),
    linear-gradient(135deg, #fffefe, #eaf7ff 76%);
  box-shadow: 0 0 0 7px #9fc8ee, 8px 8px 0 rgba(111, 134, 200, 0.24);
}

.mines-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
}

.mines-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.34fr);
  gap: 18px;
  align-items: start;
}

.mines-board-panel,
.mines-panel {
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 5px #6f86c8, 7px 7px 0 rgba(111, 134, 200, 0.25);
}

.mines-board-panel {
  padding: 16px;
  overflow: hidden;
}

.mines-board-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.mines-board-header h2 {
  margin: 0;
}

.mines-status {
  min-width: 170px;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.mines-board {
  --mine-cols: 8;
  display: grid;
  grid-template-columns: repeat(var(--mine-cols), minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 10px;
  border: 3px solid rgba(111, 134, 200, 0.42);
  border-radius: var(--radius);
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 247, 251, 0.18)),
    var(--mines-picture, linear-gradient(135deg, #fffefe, #eaf7ff)),
    linear-gradient(45deg, rgba(159, 200, 238, 0.18) 25%, transparent 25% 75%, rgba(159, 200, 238, 0.18) 75%),
    linear-gradient(45deg, rgba(159, 200, 238, 0.18) 25%, transparent 25% 75%, rgba(159, 200, 238, 0.18) 75%),
    #fffefe;
  background-position: center, center, 0 0, 14px 14px, 0 0;
  background-size: cover, cover, 28px 28px, 28px 28px, auto;
}

.mine-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: #52649d;
  border: 2px solid #ffffff;
  border-radius: 6px;
  background: #dff3ff;
  box-shadow: inset 0 -3px 0 rgba(111, 134, 200, 0.18), 2px 2px 0 rgba(111, 134, 200, 0.18);
  cursor: pointer;
  font-size: clamp(0.78rem, 2.8vw, 1.1rem);
  font-weight: 900;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.mine-cell:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff4bd;
}

.mine-cell:disabled {
  cursor: default;
}

.mine-cell.revealed {
  color: var(--ink);
  border-color: rgba(111, 134, 200, 0.18);
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(1px);
  box-shadow: inset 0 0 0 1px rgba(111, 134, 200, 0.14);
}

.mine-cell.flagged {
  color: #ff6f9f;
  background: #fff0f6;
}

.mine-cell.mine {
  color: #fff8ff;
  background: #ff6f9f;
}

.mine-cell.wrong-flag {
  color: #1b1728;
  background: #ffe49a;
}


.mine-cell.revealed[data-number] {
  background: rgba(255, 255, 255, 0.68);
  font-size: clamp(0.95rem, 3.4vw, 1.35rem);
  text-shadow:
    -1px -1px 0 #fffefe,
    1px -1px 0 #fffefe,
    -1px 1px 0 #fffefe,
    1px 1px 0 #fffefe,
    0 2px 3px rgba(31, 28, 45, 0.34);
}

body[data-theme="dark"] .mine-cell.revealed[data-number] {
  background: rgba(255, 255, 255, 0.58);
  text-shadow:
    -1px -1px 0 #fffefe,
    1px -1px 0 #fffefe,
    -1px 1px 0 #fffefe,
    1px 1px 0 #fffefe,
    0 2px 4px rgba(0, 0, 0, 0.55);
}
.mine-cell[data-number="1"] { color: #52649d; }
.mine-cell[data-number="2"] { color: #4b9361; }
.mine-cell[data-number="3"] { color: #d45f8b; }
.mine-cell[data-number="4"] { color: #7c67d6; }

.mine-cell.tip-safe,
.mine-cell.tip-flag {
  outline: 3px solid #ffe49a;
  outline-offset: -2px;
  animation: tipPulse 900ms ease-in-out infinite alternate;
}

.mine-cell.tip-safe {
  background: #fff4bd;
}

.mine-cell.tip-flag {
  color: #ff6f9f;
  background: #fff0f6;
}

@keyframes tipPulse {
  from { box-shadow: inset 0 -3px 0 rgba(111, 134, 200, 0.18), 0 0 0 rgba(255, 228, 154, 0); }
  to { box-shadow: inset 0 -3px 0 rgba(111, 134, 200, 0.18), 0 0 18px rgba(255, 228, 154, 0.78); }
}
.mine-cell[data-number="5"],
.mine-cell[data-number="6"],
.mine-cell[data-number="7"],
.mine-cell[data-number="8"] { color: #3a2c35; }

.mines-panel {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.mines-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 900;
}

.mines-field select {
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  border: 2px solid #6f86c8;
  border-radius: var(--radius);
  background: #fffefe;
  font-weight: 900;
}

.mines-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: rgba(216, 220, 255, 0.28);
  color: var(--muted);
  font-weight: 900;
}

.mines-stat-row strong {
  color: var(--ink);
}

.mines-actions {
  display: grid;
  gap: 10px;
}

.mines-actions .button {
  width: 100%;
}

body[data-theme="dark"] .mines-hero,
body[data-theme="dark"] .mines-board-panel,
body[data-theme="dark"] .mines-panel {
  border-color: rgba(216, 220, 255, 0.36);
  background: rgba(31, 28, 45, 0.92);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08), 6px 6px 0 rgba(0, 0, 0, 0.34);
}

body[data-theme="dark"] .mines-board {
  border-color: rgba(216, 220, 255, 0.28);
  background:
    linear-gradient(rgba(12, 11, 20, 0.3), rgba(31, 28, 45, 0.38)),
    var(--mines-picture, linear-gradient(135deg, #151422, #2a2640)),
    linear-gradient(45deg, rgba(159, 200, 238, 0.08) 25%, transparent 25% 75%, rgba(159, 200, 238, 0.08) 75%),
    linear-gradient(45deg, rgba(159, 200, 238, 0.08) 25%, transparent 25% 75%, rgba(159, 200, 238, 0.08) 75%),
    rgba(12, 11, 20, 0.56);
  background-position: center, center, 0 0, 14px 14px, 0 0;
  background-size: cover, cover, 28px 28px, 28px 28px, auto;
}

body[data-theme="dark"] .mine-cell {
  color: #fff8ff;
  border-color: rgba(216, 220, 255, 0.18);
  background: rgba(216, 220, 255, 0.14);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 2px 2px 0 rgba(0, 0, 0, 0.2);
}

body[data-theme="dark"] .mine-cell:hover:not(:disabled) {
  color: #1b1728;
  background: #ffe49a;
}

body[data-theme="dark"] .mine-cell.revealed {
  background: rgba(18, 16, 28, 0.34);
  box-shadow: inset 0 0 0 1px rgba(216, 220, 255, 0.12);
}

body[data-theme="dark"] .mine-cell.flagged {
  color: #ffe49a;
  background: rgba(255, 143, 188, 0.18);
}

body[data-theme="dark"] .mines-field select {
  color: #fff8ff;
  border-color: rgba(216, 220, 255, 0.35);
  background: rgba(12, 11, 20, 0.78);
}

body[data-theme="dark"] .mines-stat-row {
  background: rgba(216, 220, 255, 0.13);
}

body[data-theme="dark"] .mines-stat-row strong,
body[data-theme="dark"] .mines-board-header h2 {
  color: #fff8ff;
}

@media (max-width: 840px) {
  .mines-layout,
  .mines-hero {
    grid-template-columns: 1fr;
  }

  .mines-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .mines-board-header {
    flex-direction: column;
  }

  .mines-status {
    min-width: 0;
    text-align: left;
  }

  .mines-board {
    gap: 3px;
    padding: 8px;
  }

  .mine-cell {
    border-radius: 5px;
    border-width: 1px;
  }
}

@media (max-width: 460px) {
  .mines-shell {
    width: min(100% - 20px, 1120px);
  }

  .mines-board-panel,
  .mines-panel,
  .mines-hero {
    padding: 12px;
  }

  .mines-board {
    gap: 2px;
    padding: 6px;
  }
}
.mines-actions .button.active {
  color: #1b1728;
  background: #ffe49a;
}

body[data-theme="dark"] .mines-actions .button.active {
  color: #1b1728;
  background: #ffe49a;
}