/* ── MINE COUNTER + SMILEY + TIMER ROW ──────────────────────── */
.ms-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Clean badge display — replaces the old LCD look */
.lcd {
  background: var(--best-bg);
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: 10px;
  border: 2px solid var(--best-border);
  min-width: 62px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 3px;
  user-select: none;
  transition: background .25s, border-color .25s;
}

/* Smiley restart button — matches site button style */
.smiley-btn {
  font-size: 22px;
  width: 44px;
  height: 44px;
  border: 2px solid var(--btn-border);
  border-radius: 12px;
  background: var(--card-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: .15s;
  flex-shrink: 0;
}
.smiley-btn:hover  { border-color: var(--primary); transform: scale(1.06); }
.smiley-btn:active { transform: scale(.94); }

/* ── GRID SCROLL WRAPPER ────────────────────────────────────── */
.grid-scroll {
  overflow-x: auto;
  overflow-y: visible;
  margin: 0 -4px;
  padding: 0 4px 6px;
}

/* ── MINESWEEPER GRID ───────────────────────────────────────── */
.ms-grid {
  display: grid;
  gap: 2px;
  background: var(--border-light);
  border: 2px solid var(--btn-border);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
  transition: filter .25s;
  margin: 0 auto;
}

.ms-grid.blurred {
  filter: blur(8px);
  pointer-events: none;
}

/* ── CELLS ──────────────────────────────────────────────────── */
.ms-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  border-radius: 5px;
  transition: background .08s, box-shadow .08s;
}

.ms-cell.hidden {
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(42,111,189,.10);
}
.ms-cell.hidden:hover {
  background: var(--btn-hover-bg);
  box-shadow: 0 2px 6px rgba(42,111,189,.18);
}

.ms-cell.flagged {
  background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(42,111,189,.10);
  cursor: default;
}

.ms-cell.revealed  { background: var(--best-bg);  cursor: default; }
.ms-cell.mine-hit  { background: var(--err-color); }
.ms-cell.mine-shown{ background: #fef3c7; }
.ms-cell.wrong-flag{ background: #fef3c7; }

/* Dark mode */
[data-theme="dark"] .ms-grid             { background: var(--border-light); border-color: var(--btn-border); }
[data-theme="dark"] .ms-cell.hidden      { background: var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
[data-theme="dark"] .ms-cell.hidden:hover{ background: #1e3a5a; }
[data-theme="dark"] .ms-cell.flagged     { background: var(--card-bg); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
[data-theme="dark"] .ms-cell.revealed    { background: var(--best-bg); }
[data-theme="dark"] .ms-cell.mine-shown  { background: #2a1f0a; }
[data-theme="dark"] .ms-cell.wrong-flag  { background: #2a1f0a; }

/* Number colours */
.ms-cell.n1 { color: #6366f1; }
.ms-cell.n2 { color: #0d9488; }
.ms-cell.n3 { color: #e11d48; }
.ms-cell.n4 { color: #d97706; }
.ms-cell.n5 { color: #059669; }
.ms-cell.n6 { color: #9333ea; }
.ms-cell.n7 { color: #64748b; }
.ms-cell.n8 { color: #94a3b8; }

[data-theme="dark"] .ms-cell.n1 { color: #818cf8; }
[data-theme="dark"] .ms-cell.n2 { color: #2dd4bf; }
[data-theme="dark"] .ms-cell.n3 { color: #fb7185; }
[data-theme="dark"] .ms-cell.n4 { color: #fbbf24; }
[data-theme="dark"] .ms-cell.n5 { color: #34d399; }
[data-theme="dark"] .ms-cell.n6 { color: #c084fc; }
[data-theme="dark"] .ms-cell.n7 { color: #94a3b8; }
[data-theme="dark"] .ms-cell.n8 { color: #cbd5e1; }

/* ── GAME FOOTER (actions + best times) ─────────────────────── */
.game-footer {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.ms-actions { display: flex; flex-direction: column; gap: 7px; }

/* ── SECOND CHANCE MODAL ─────────────────────────────────────── */
#chanceModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5,15,45,.72);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#chanceModal.show { display: flex; }

.hint-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 24px 72px rgba(0,0,40,.32);
  animation: pop .38s cubic-bezier(.34,1.56,.64,1);
  width: 360px;
  max-width: 90vw;
  position: relative;
}

#chancePhase1, #chancePhase2, #chancePhase3 { display: none; }
#chancePhase1.active, #chancePhase2.active, #chancePhase3.active { display: block; }

.hint-icon  { font-size: 50px; line-height: 1.15; }
.hint-title { font-size: 1.25em; font-weight: 800; color: var(--primary); margin: 10px 0 6px; }
.hint-sub   { font-size: 14px; color: var(--muted); line-height: 1.55; }

.hint-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

.hint-btn-primary {
  padding: 11px 24px;
  border: none;
  border-radius: 26px;
  background: var(--primary);
  color: white;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: .16s;
}
.hint-btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); }

.hint-btn-ghost {
  padding: 9px 24px;
  border: 2px solid var(--btn-border);
  border-radius: 26px;
  background: transparent;
  color: var(--btn-text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: .16s;
}
.hint-btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

#chancePhase2 { position: relative; }
.hint-close-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--btn-border);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .14s;
}
.hint-close-btn:hover { border-color: var(--err-color); color: var(--err-color); }

#chanceAdSlot { margin: 0 auto; }

.hint-progress-label { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.hint-progress-wrap  { height: 8px; background: var(--border-light); border-radius: 4px; overflow: hidden; }
.hint-progress-bar   { height: 100%; width: 0%; background: var(--primary); border-radius: 4px; transition: width 1s linear; }

/* ── SIDE PANEL ADS (hidden by default) ─────────────────────── */
.side-panel-ad     { display: none; }
.side-panel-mid-ad { display: none; }
.game-mid-ad { display: none; margin: 0 auto 14px; }

@media (max-width: 775px) {
  .hdr-nav .ad-leaderboard { display: none; }
  .game-mid-ad { display: flex; }
}

@media (max-width: 1100px) {
  .content-row { grid-template-columns: 1fr; }
}

@media (min-width: 775px) and (max-width: 1100px) {
  .right-sidebar { display: none; }
  .side-panel-ad { display: flex; }
}

@media (max-width: 650px) {
  .side-panel-mid-ad { display: flex; margin: 0 auto; }
}

/* ── RESPONSIVE — MINESWEEPER SPECIFIC ──────────────────────── */
@media (max-width: 580px) {
  .ms-controls { order: 2; }
}
