/* ============================================================
   Minesweeper — Game Styles
   ============================================================ */

/* ── Layout ── */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* Header → see .game-header in global.css */

/* ── Difficulty Bar (below header) ── */
.diff-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* ── Difficulty Tabs ── */
.diff-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.diff-tab {
  padding: 0.28em 0.75em;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
}

.diff-tab:hover:not(.active) {
  color: var(--text);
}

.diff-tab.active[data-diff="easy"] {
  background: rgba(74, 222, 128, 0.18);
  color: var(--easy);
}

.diff-tab.active[data-diff="medium"] {
  background: rgba(251, 191, 36, 0.18);
  color: var(--medium);
}

.diff-tab.active[data-diff="hard"] {
  background: rgba(248, 113, 113, 0.18);
  color: var(--hard);
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 900px;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.stat-divider {
  width: 1px;
  height: 2.5rem;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Smiley Reset Button ── */
.smiley-btn {
  font-size: 1.75rem;
  line-height: 1;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.2em 0.45em;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.smiley-btn:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 10px var(--accent-glow);
}

.smiley-btn:active {
  transform: scale(0.93);
}

/* ── Game Container ── */
.game-container {
  width: 100%;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Board Wrapper ── */
.board-wrapper {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

/* ── Board ── */
.board {
  display: grid;
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  gap: 1px;
  box-shadow: var(--shadow-md);
  user-select: none;
  -webkit-user-select: none;
}

/* ── Cell ── */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.85em;
  line-height: 1;
  position: relative;
  background: var(--surface-2);
  transition: background 80ms ease;
  -webkit-tap-highlight-color: transparent;
  /* Raised/embossed look for unrevealed cells */
  box-shadow:
    inset 1px 1px 0 rgba(255,255,255,0.08),
    inset -1px -1px 0 rgba(0,0,0,0.35);
}

.cell:hover:not(.revealed):not(.exploded) {
  background: var(--surface-3);
}

.cell:active:not(.revealed) {
  background: var(--surface);
  box-shadow: none;
}

/* Revealed cell — flat */
.cell.revealed {
  background: var(--surface);
  box-shadow: none;
  cursor: default;
}

/* Empty revealed cell (count=0) */
.cell.revealed.empty {
  background: #ece9ff;
  cursor: default;
}

/* Flagged cell */
.cell.flagged::after {
  content: '🚩';
  font-size: 0.85em;
  pointer-events: none;
}

/* Mine revealed on game over */
.cell.mine {
  background: #fee2e2;
  box-shadow: none;
}

/* The mine that was clicked */
.cell.exploded {
  background: #fca5a5;
  box-shadow: inset 0 0 8px rgba(248, 113, 113, 0.6);
}

/* Wrongly flagged mine indicator */
.cell.wrong-flag::after {
  content: '❌';
  font-size: 0.85em;
  pointer-events: none;
}

/* ── Number colors ── */
.cell[data-n="1"] { color: #1d4ed8; }
.cell[data-n="2"] { color: #15803d; }
.cell[data-n="3"] { color: #dc2626; }
.cell[data-n="4"] { color: #7e22ce; }
.cell[data-n="5"] { color: #92400e; }
.cell[data-n="6"] { color: #0e7490; }
.cell[data-n="7"] { color: #9d174d; }
.cell[data-n="8"] { color: #374151; }

/* ── Cell size per difficulty ── */
.board.easy .cell {
  width: 40px;
  height: 40px;
  font-size: 1rem;
}

.board.medium .cell {
  width: 30px;
  height: 30px;
  font-size: 0.82rem;
}

.board.hard .cell {
  width: 24px;
  height: 24px;
  font-size: 0.72rem;
}

/* ── Modals ── */
.modal-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  display: block;
}

.modal-card h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.modal-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.modal-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.modal-stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}

.modal-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.modal-msg {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* ── Sparkle animation for win ── */
@keyframes sparkle-in {
  0%   { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.1) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.modal-overlay.active .modal-emoji {
  animation: sparkle-in 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Mine reveal animation ── */
@keyframes mine-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.cell.mine.revealed-on-loss {
  animation: mine-pop 250ms ease forwards;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .diff-tab {
    padding: 0.25em 0.55em;
    font-size: 0.72rem;
  }

  .board.easy .cell {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }

  .board.medium .cell {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  .board.hard .cell {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
  }

  .smiley-btn {
    font-size: 1.4rem;
  }
}

