.mines-page .game-panel {
  display: grid;
  gap: 1rem;
}

.mines-ui {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 236, 255, 0.17), transparent 32%),
    radial-gradient(circle at 86% 8%, rgba(255, 79, 198, 0.15), transparent 30%),
    linear-gradient(165deg, rgba(11, 24, 71, 0.96), rgba(16, 14, 48, 0.9));
}

.mines-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.difficulty-group {
  display: inline-flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}


.mines-stats {
  margin-top: 0.9rem;
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  color: #dce5ff;
  font-size: 0.9rem;
}

.mines-hint {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.board-scroll {
  position: relative;
  margin-top: 0.9rem;
  overflow: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(121, 157, 244, 0.36);
  background: rgba(7, 13, 40, 0.36);
}

.board-scroll--won {
  box-shadow:
    0 0 0 1px rgba(95, 232, 180, 0.34) inset,
    0 0 34px rgba(95, 232, 180, 0.24);
  animation: board-win-glow 1.1s ease-in-out infinite alternate;
}

.board-scroll--lost {
  box-shadow:
    0 0 0 1px rgba(255, 124, 124, 0.36) inset,
    0 0 28px rgba(255, 98, 98, 0.22);
  animation: board-hit-shake 320ms ease-in-out 2;
}

.mines-board {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  --cell-size: 36px;
  padding: 0.7rem;
  display: grid;
  gap: 4px;
  width: max-content;
  min-width: 100%;
}

.mine-cell {
  width: var(--cell-size);
  height: var(--cell-size);
  border-radius: 0.5rem;
  border: 1px solid rgba(154, 191, 224, 0.38);
  background: linear-gradient(160deg, rgba(64, 95, 124, 0.98), rgba(28, 48, 67, 0.98));
  color: #eaf5ff;
  display: grid;
  place-content: center;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(0.8rem, 2vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.24) inset,
    0 -1px 0 rgba(0, 0, 0, 0.34) inset,
    0 4px 12px rgba(0, 0, 0, 0.26);
}

.mine-cell--open {
  border-color: rgba(214, 235, 252, 0.72);
  background: linear-gradient(165deg, rgba(228, 241, 252, 0.95), rgba(191, 220, 244, 0.93));
  color: #10293d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 0 0 1px rgba(13, 34, 52, 0.08) inset;
}

.mine-cell--closed:hover {
  filter: brightness(1.08);
}

.mine-cell--flagged {
  color: #ffd38d;
}

.mine-cell--mine {
  background: linear-gradient(145deg, rgba(116, 34, 34, 0.8), rgba(56, 10, 10, 0.88));
}

.mine-cell--exploded {
  border-color: rgba(255, 92, 92, 0.7);
  box-shadow: 0 0 0 2px rgba(255, 92, 92, 0.3) inset;
}

.mine-cell--n1 {
  color: #0f4da1;
}

.mine-cell--n2 {
  color: #0f6b3f;
}

.mine-cell--n3 {
  color: #a53a18;
}

.mine-cell--n4 {
  color: #3f2e8f;
}

.mine-cell--n5 {
  color: #8e1f39;
}

.mine-cell--n6 {
  color: #1b6f74;
}

.mine-cell--n7 {
  color: #1f2937;
}

.mine-cell--n8 {
  color: #6b3f0c;
}

.mines-outcome {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.45rem;
  text-align: center;
  background: rgba(7, 13, 22, 0.58);
  backdrop-filter: blur(1.5px);
  pointer-events: none;
}

.mines-outcome h3 {
  margin: 0;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
}

.mines-outcome p {
  margin: 0;
  color: #d6e7f3;
  font-size: 0.9rem;
}

.mines-message {
  margin: 0.9rem 0 0;
  color: #d9e8f3;
  font-size: 0.92rem;
  min-height: 1.4rem;
}

@keyframes board-win-glow {
  from {
    box-shadow:
      0 0 0 1px rgba(95, 232, 180, 0.26) inset,
      0 0 20px rgba(95, 232, 180, 0.16);
  }
  to {
    box-shadow:
      0 0 0 1px rgba(95, 232, 180, 0.44) inset,
      0 0 42px rgba(95, 232, 180, 0.31);
  }
}

@keyframes board-hit-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(3px);
  }
}

.mines-leaderboard {
  margin-top: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.9rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
}

.mines-leaderboard h2 {
  margin: 0;
  font-size: 1rem;
}

.leaderboard-grid {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.leaderboard-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.65rem;
  padding: 0.65rem;
  background: rgba(9, 21, 31, 0.55);
}

.leaderboard-card h3 {
  margin: 0 0 0.45rem;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 0.84rem;
}

.leaderboard-card ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.leaderboard-card li {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
  color: #cfe0ec;
  font-size: 0.84rem;
}

@media (max-width: 980px) {
  .mines-page .game-panel {
    padding: 0.8rem;
  }

  .leaderboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .mine-cell {
    border-radius: 0.4rem;
  }

  .mines-stats {
    font-size: 0.85rem;
  }

  .mines-hint {
    font-size: 0.82rem;
  }
}
