/* =====================================================================
   MINES — Stake-style single-player
   Pink accent · glossy tiles · explosion fx
   ===================================================================== */

.screen--mines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- Stage (multiplier + board + status) ---------- */
.minesStage {
  position: relative;
  background:
    radial-gradient(circle 280px at 50% 0%, rgba(255,95,162,.12), transparent 70%),
    radial-gradient(circle 260px at 50% 100%, rgba(255,95,162,.08), transparent 70%),
    linear-gradient(180deg, #1a0a2e 0%, #0a0418 100%);
  border: 1px solid rgba(255,95,162,.28);
  border-radius: var(--r-card);
  padding: 10px 12px 12px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 0 0 1px rgba(255,95,162,.08),
    0 8px 28px -10px rgba(255,95,162,.25);
}
.minesStage.busted {
  background:
    radial-gradient(circle 320px at 50% 50%, rgba(255,95,162,.22), transparent 65%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border-color: rgba(255,95,162,.45);
  animation: minesShake .35s ease;
}
.minesStage.won {
  background:
    radial-gradient(circle 320px at 50% 50%, rgba(255,205,60,.18), transparent 65%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border-color: rgba(255,205,60,.4);
}
@keyframes minesShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* ---------- Stage meta header (multiplier · mines · next) ---------- */
.minesMeta {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.minesMeta__cell {
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 6px 8px;
  text-align: center;
}
.minesMeta__cell--center {
  background: rgba(255,95,162,.08);
  border-color: rgba(255,95,162,.25);
}
.minesMeta__label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 3px;
}
.minesMeta__label small { font-size: 10px; color: var(--pink); margin-left: 2px; }
.minesMeta__val {
  font-family: var(--display);
  font-weight: 900;
  font-size: 19px;
  line-height: 1;
  color: var(--text);
  font-feature-settings: 'tnum';
  letter-spacing: -.02em;
}
.minesMeta__val small {
  font-size: .55em;
  margin-left: 1px;
  font-weight: 700;
  color: var(--text-2);
}
/* Central multiplier when active glows green-ish to signal "growing" */
.minesStage.playing .minesMeta__cell:first-child .minesMeta__val {
  background: linear-gradient(180deg, #fff, var(--mint) 60%, var(--mint-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 12px var(--mint-glow));
}
.minesStage.busted .minesMeta__cell:first-child .minesMeta__val {
  background: linear-gradient(180deg, #fff, var(--pink) 60%, var(--pink-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px var(--pink-glow));
}
.minesStage.won .minesMeta__cell:first-child .minesMeta__val {
  background: linear-gradient(180deg, #fff, var(--gold-hi) 60%, var(--gold-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 14px var(--gold-glow));
}

/* ---------- Board grid ----------
   The board is square (aspect-ratio 1/1). We cap BOTH width and height so it
   never pushes the bet/action controls off-screen on shorter phones.
   --mines-board-cap: ≈ viewport height minus all the chrome around the board
   (top safe area + header + meta + status + controls + tabbar). */
.minesBoard {
  --mines-board-cap: calc(100dvh - 470px - var(--tg-safe-top) - var(--tg-safe-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 7px;
  margin: 2px auto 8px;
  width: min(340px, 100%, var(--mines-board-cap));
  aspect-ratio: 1 / 1;
}
/* Force every cell to be square + override any pseudo-element size from
   resizing the row. Without these, an opened cell's 30×30 ::after gem
   would push neighbours and skew row heights. */
.minesCell {
  min-width: 0;
  min-height: 0;
}
.minesCell {
  position: relative;
  background:
    radial-gradient(circle at 50% 35%, rgba(255,255,255,.04), transparent 60%),
    linear-gradient(180deg, var(--surface-hi), var(--surface));
  border: 1px solid var(--border-2);
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--display);
  font-weight: 900;
  color: transparent;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.10),
    inset 0 -3px 6px rgba(0,0,0,.4),
    inset 0 0 12px rgba(255,95,162,.05),
    0 2px 4px rgba(0,0,0,.25);
  transition: transform .12s, box-shadow .12s, filter .12s;
  user-select: none;
}
/* Subtle center hint sparkle on unrevealed cells — makes them feel
   "pressable" rather than flat empty boxes. */
.minesCell:not(.minesCell--revealed)::after {
  content: '';
  position: absolute;
  width: 2px; height: 2px;
  background: rgba(255,255,255,.18);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255,95,162,.25);
}
.minesCell:hover:not(.minesCell--revealed):not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.12);
  border-color: var(--border-3);
}
.minesCell:active:not(.minesCell--revealed):not(:disabled) {
  transform: scale(.96);
}
.minesCell:disabled { cursor: default; }

/* Revealed safe cell — mint glow gem */
.minesCell--safe {
  background: linear-gradient(180deg, rgba(95,255,182,.22), rgba(30,220,140,.10));
  border-color: rgba(95,255,182,.5);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.12),
    inset 0 -2px 6px rgba(0,40,20,.3),
    0 0 14px -2px rgba(95,255,182,.5);
  color: var(--mint);
  animation: minesPop .28s var(--ease-back);
}
.minesCell--safe::before {
  content: '';
  position: absolute;
  inset: 10px;
  background: radial-gradient(circle, var(--mint) 0%, var(--mint-deep) 60%, transparent 100%);
  border-radius: 50%;
  opacity: .35;
  filter: blur(3px);
}
/* Faceted gem rendered as inline SVG. Body = mint, darker facets on the lower
   half give depth, white sparkle catches the top-left light. */
.minesCell--safe::after {
  content: '';
  position: relative;
  width: 30px;
  height: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2 L21 9 L12 22 L3 9 Z' fill='%235fffb6' stroke='%23ffffff' stroke-width='0.6' stroke-opacity='0.85'/><path d='M3 9 L21 9' stroke='%23ffffff' stroke-width='0.5' stroke-opacity='0.55'/><path d='M12 2 L7 9 L12 22' fill='%23ffffff' fill-opacity='0.18'/><path d='M21 9 L17 9 L12 22 Z' fill='%231edc8c' fill-opacity='0.55'/><path d='M3 9 L7 9 L12 22 Z' fill='%231edc8c' fill-opacity='0.3'/><path d='M12 2 L17 9 L12 22 Z' fill='%23000000' fill-opacity='0.1'/><circle cx='8.5' cy='5.5' r='0.9' fill='%23ffffff' fill-opacity='0.9'/><circle cx='6.5' cy='6.8' r='0.4' fill='%23ffffff' fill-opacity='0.6'/></svg>") center/contain no-repeat;
  filter: drop-shadow(0 0 6px var(--mint))
          drop-shadow(0 1px 2px rgba(0,0,0,.4));
}

/* Revealed mine cell */
.minesCell--mine {
  background: linear-gradient(180deg, rgba(255,95,162,.30), rgba(255,25,121,.18));
  border-color: rgba(255,95,162,.6);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.18),
    inset 0 -2px 6px rgba(80,0,30,.4),
    0 0 22px -2px rgba(255,95,162,.6);
  color: #fff;
  animation: minesBoom .45s var(--ease-back);
}
.minesCell--mine::after {
  content: '💣';
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 0 10px var(--pink));
}

/* Mine that was the trigger — extra emphasis */
.minesCell--mine.minesCell--hit {
  background: linear-gradient(180deg, var(--pink) 0%, var(--pink-deep) 100%);
  border-color: #fff;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.45),
    0 0 32px rgba(255,95,162,.85);
  animation: minesBoomHit .5s var(--ease-back);
}
.minesCell--mine.minesCell--hit::after {
  content: '💥';
  font-size: 30px;
  filter: drop-shadow(0 0 14px var(--gold))
          drop-shadow(0 0 8px var(--pink));
  animation: minesHitWiggle .6s var(--ease-back);
}
@keyframes minesHitWiggle {
  0%   { transform: scale(.3) rotate(-20deg); }
  40%  { transform: scale(1.4) rotate(15deg); }
  70%  { transform: scale(1.1) rotate(-5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* Mines that were never picked — dimmer reveal */
.minesCell--mine:not(.minesCell--hit) { opacity: .85; }

@keyframes minesPop {
  0%   { transform: scale(.5); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes minesBoom {
  0%   { transform: scale(.6); opacity: 0; }
  50%  { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes minesBoomHit {
  0%   { transform: scale(.4); }
  35%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ---------- Status line ---------- */
.minesStatus {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  min-height: 16px;
}
.minesStatus.win  { color: var(--gold);  font-weight: 800; }
.minesStatus.lose { color: var(--pink);  font-weight: 800; }
.minesStatus.idle { color: var(--text-2); }

/* ---------- Controls ---------- */
.minesControls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.minesBet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 8px 10px;
}
.minesBet__label,
.minesMineSelect__label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  margin-bottom: 6px;
}
.minesBet__row {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  gap: 6px;
  align-items: stretch;
  margin-bottom: 6px;
}
.minesBet__step {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  color: var(--text-2);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  transition: background .12s;
}
.minesBet__step:hover { background: rgba(255,255,255,.08); }
.minesBet__input {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  color: var(--gold);
  text-align: center;
  font-feature-settings: 'tnum';
  min-width: 0;
}
.minesBet__chips {
  display: flex; gap: 4px;
}
.minesBet__chips button {
  flex: 1;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  transition: color .12s, background .12s;
}
.minesBet__chips button:hover { color: var(--text); background: rgba(255,255,255,.04); }

/* Mine count chips */
.minesMineSelect {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
  padding: 8px 10px;
}
.minesMineSelect__row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.minesMineChip {
  flex: 1 0 auto;
  min-width: 38px;
  padding: 6px 10px;
  background: rgba(0,0,0,.22);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text-2);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  font-feature-settings: 'tnum';
  transition: background .12s, color .12s, border-color .12s;
}
.minesMineChip:hover { background: rgba(255,255,255,.06); color: var(--text); }
.minesMineChip--active {
  background: linear-gradient(180deg, var(--pink), var(--pink-deep));
  color: #fff;
  border-color: rgba(255,255,255,.25);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    0 4px 12px -4px var(--pink-glow);
}
.minesMineChip:disabled { opacity: .4; cursor: not-allowed; }

/* Main action button */
.minesAction {
  background: linear-gradient(180deg, var(--pink), var(--pink-deep));
  color: #fff;
  border: 0;
  border-radius: var(--r-btn);
  font-family: var(--display);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: .04em;
  padding: 12px 16px;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.4),
    inset 0 -2px 5px rgba(80,0,30,.3),
    0 8px 24px -6px var(--pink-glow);
  transition: filter .15s, transform .12s;
}
.minesAction:hover { filter: brightness(1.06); }
.minesAction:active { transform: scale(.98); }
.minesAction:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; }
.minesAction--cashout {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-deep));
  color: #2a1500;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.45),
    inset 0 -2px 5px rgba(120,60,0,.2),
    0 8px 24px -6px var(--gold-glow);
  animation: minesPulse 1.2s ease-in-out infinite;
}
@keyframes minesPulse {
  50% { box-shadow:
    inset 0 2px 0 rgba(255,255,255,.5),
    inset 0 -2px 5px rgba(120,60,0,.25),
    0 12px 32px -4px var(--gold-glow); }
}

/* ---------- Profile · history rows ---------- */
.minesUserHist { display: flex; flex-direction: column; gap: 6px; }
.minesUserRow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-inner);
}
.minesUserRow__m {
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  font-feature-settings: 'tnum';
  letter-spacing: -.02em;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}
.minesUserRow__m.win { color: var(--gold); background: rgba(255,205,60,.1); }
.minesUserRow__m.lose { color: var(--pink); background: rgba(255,95,162,.1); }
.minesUserRow__info { font-size: 13px; font-weight: 600; }
.minesUserRow__info small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 500;
}
.minesUserRow__prize {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 14px;
  font-feature-settings: 'tnum';
}
.minesUserRow__prize.win { color: var(--gold); }
.minesUserRow__prize.lose { color: var(--pink); }
