/* ------------------------------------------------------------------ */
/*  MINES - Tilt Rips retro arcade theme (Balatro-inspired)            */
/* ------------------------------------------------------------------ */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/press-start-2p.woff2') format('woff2');
}

:root {
  --ink: #141a24;
  --ink-deep: #0b0f16;
  --side: #333e4d;
  --side-edge: #222a35;
  --panel: #222b37;
  --panel-deep: #1a212b;
  --red: #fc4b3a;
  --red-dk: #a02015;
  --blue: #1e9bff;
  --blue-dk: #0e5faf;
  --orange: #f8a01e;
  --orange-dk: #b56a08;
  --purple: #7b52e0;
  --purple-dk: #4c2f96;
  --gold: #ffd24a;
  --green: #2fd06c;
  --green-dk: #157f3e;
  --text: #ffffff;
  --text-dim: #9fb0c3;
  --text-faint: #64748b;
  --pix-shadow: 2px 2px 0 rgba(8, 11, 18, 0.85);
}

* { box-sizing: border-box; }

html {
  background: #0d1018;
}

/* Body must stay transparent: its background would otherwise paint over
   the fixed negative z-index swirl canvas inside the content box. */
html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: 'Press Start 2P', 'Courier New', monospace;
  font-size: 10px;
  -webkit-font-smoothing: none;
}
body { background: transparent; min-height: 100vh; }

.mono { font-variant-numeric: tabular-nums; }

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  color: inherit;
  background: none;
}
button:disabled { cursor: not-allowed; }

/* Psychedelic swirl painted behind everything, chunky-pixel upscaled. */
#bgSwirl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  image-rendering: pixelated;
}

/* Faint CRT scanlines over the whole page. */
.crt {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.16) 0px,
    rgba(0, 0, 0, 0.16) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.35;
  mix-blend-mode: multiply;
}

#app {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 26px;
  /* Stretch both columns so the sidebar and stage bottoms align. */
  align-items: stretch;
}

/* ------------------------------------------------------------------ */
/*  Sidebar                                                            */
/* ------------------------------------------------------------------ */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--side);
  border: 3px solid var(--side-edge);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.45), 0 20px 50px rgba(0, 0, 0, 0.5);
}

.logo-plaque {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0 4px;
}
.logo-img {
  width: 88%;
  max-width: 250px;
  display: block;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 0 18px rgba(255, 190, 60, 0.25));
}

.panel {
  background: var(--panel);
  border: 2px solid var(--panel-deep);
  border-radius: 10px;
  padding: 10px 11px 11px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
}

.panel-label {
  font-size: 7px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8);
}

.coin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffd94f, #f5a623);
  color: #3d2503;
  font-size: 11px;
  flex: none;
  box-shadow: 0 3px 0 #96650a;
  text-shadow: none;
}

.bump { animation: bump 0.35s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Grid size segmented toggle */
.grid-toggle { display: flex; gap: 6px; }
.grid-btn {
  flex: 1;
  padding: 10px 0 9px;
  border-radius: 8px;
  background: #46556a;
  color: var(--text-dim);
  font-size: 10px;
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8);
  box-shadow: 0 3px 0 #232b36;
  transition: filter 0.1s;
}
.grid-btn:hover:not(:disabled) { filter: brightness(1.12); color: #fff; }
.grid-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #232b36; }
.grid-btn.is-active {
  background: linear-gradient(180deg, #3fabff, var(--blue));
  box-shadow: 0 3px 0 var(--blue-dk);
  color: #fff;
}
.grid-btn:disabled { opacity: 0.45; }

/* Mines slider: diamond count on the left, bomb count on the right */
.slider-row { display: flex; align-items: center; gap: 8px; }

.slider-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0 5px;
  border-radius: 8px;
  font-size: 12px;
  flex: none;
  width: 76px; /* pinned: 2-digit counts must never resize the row */
  justify-content: center;
  text-shadow: var(--pix-shadow);
}
.slider-badge img { width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(1px 1px 0 rgba(8, 11, 18, 0.6)); }
/* Fixed 2-character slot so the icon doesn't slide between 1 and 2 digits. */
.slider-badge .mono { width: 24px; text-align: center; flex: none; }
.badge-gem {
  background: linear-gradient(180deg, #1d3050, #14233c);
  border: 2px solid rgba(77, 134, 255, 0.35);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  color: #9fd4ff;
}
.badge-bomb {
  background: linear-gradient(180deg, #4a1712, #35100c);
  border: 2px solid rgba(252, 75, 58, 0.4);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  color: #ff9d8f;
}

#minesSlider {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 24px;
  background: transparent;
  outline: none;
  cursor: pointer;
  --fill: 10%; /* blue portion; set from JS to match the thumb position */
}
#minesSlider::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    #3fabff 0%, var(--blue) var(--fill), var(--red) var(--fill), #b93325 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55), 0 1px 0 rgba(255, 255, 255, 0.06);
}
#minesSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 22px;
  margin-top: -6px; /* centre the 22px thumb on the 10px track */
  border-radius: 7px;
  border: 2px solid #8493a9;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 4px, #97a6bc 4px 6px),
    linear-gradient(180deg, #ffffff, #c9d4e4);
  background-size: 14px 10px, 100% 100%;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  cursor: grab;
}
#minesSlider::-moz-range-track {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    #3fabff 0%, var(--blue) var(--fill), var(--red) var(--fill), #b93325 100%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.55);
}
#minesSlider::-moz-range-thumb {
  width: 22px;
  height: 18px;
  border: 2px solid #8493a9;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff, #c9d4e4);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4);
  cursor: grab;
}
#minesSlider:disabled { opacity: 0.5; cursor: not-allowed; }
#minesSlider:disabled::-webkit-slider-thumb { cursor: not-allowed; }

/* Current win: blue mult x red payout, Balatro-style */
.score-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 7px;
}
.score-chip {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 6px 9px;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
  text-shadow: var(--pix-shadow);
  min-width: 0;
}
.chip-val { position: relative; z-index: 1; white-space: nowrap; }

/* Fire canvas: shader-rendered flames covering the chip and rising above
   its top edge, screen-blended so the button itself looks ablaze. */
.chip-fire {
  position: absolute;
  /* Extends past the button on all sides: fire hugs the whole rim, with
     extra headroom up top for the rising tongues. */
  left: -14px;
  top: -42px;
  /*
   * Canvas is a replaced element: width:auto uses its intrinsic 300px
   * width instead of stretching between left/right. Explicit dimensions
   * keep its layout stable when JS resizes the drawing buffer.
   */
  width: calc(100% + 28px);
  height: calc(100% + 54px);
  display: block;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  filter: saturate(1.1);
}
.chip-fire.is-ready { opacity: 1; }
.chip-blue { background: linear-gradient(180deg, #3fabff, var(--blue)); box-shadow: 0 4px 0 var(--blue-dk); }
.chip-red { background: linear-gradient(180deg, #ff6a52, var(--red)); box-shadow: 0 4px 0 var(--red-dk); }
.score-x {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--gold);
  text-shadow: var(--pix-shadow);
}

/* Next-tile odds readout */
.next-pick {
  margin-top: 9px;
  font-size: 7.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8);
}
.next-pick .next-arrow { color: var(--gold); }
.next-pick #nextMult { font-size: 10px; color: #ffd24a; letter-spacing: 0.5px; }

/* Multiplier on fire at deep streaks (Balatro-style) */
@keyframes fire-flicker {
  0%, 100% {
    box-shadow: 0 4px 0 var(--blue-dk), 0 0 14px rgba(255, 140, 30, 0.75), 0 -4px 18px rgba(255, 90, 20, 0.55);
    filter: brightness(1.04) saturate(1.15);
  }
  30% {
    box-shadow: 0 4px 0 var(--blue-dk), 0 0 22px rgba(255, 170, 40, 0.95), 0 -8px 26px rgba(255, 110, 20, 0.75);
    filter: brightness(1.14) saturate(1.3);
  }
  60% {
    box-shadow: 0 4px 0 var(--blue-dk), 0 0 16px rgba(255, 120, 20, 0.8), 0 -5px 20px rgba(255, 150, 30, 0.6);
    filter: brightness(1.02) saturate(1.2);
  }
  80% {
    box-shadow: 0 4px 0 var(--blue-dk), 0 0 26px rgba(255, 190, 60, 1), 0 -9px 30px rgba(255, 100, 10, 0.8);
    filter: brightness(1.18) saturate(1.35);
  }
}
.on-fire { animation: fire-flicker 0.55s infinite; }
.on-fire.inferno { animation-duration: 0.3s; }

.action-btn.on-fire { animation: fire-flicker-btn 0.55s infinite; }
@keyframes fire-flicker-btn {
  0%, 100% { box-shadow: 0 5px 0 var(--red-dk), 0 0 18px rgba(255, 140, 30, 0.7); filter: brightness(1.05); }
  40% { box-shadow: 0 5px 0 var(--red-dk), 0 0 30px rgba(255, 180, 50, 0.95); filter: brightness(1.16); }
  75% { box-shadow: 0 5px 0 var(--red-dk), 0 0 22px rgba(255, 120, 20, 0.85); filter: brightness(1.08); }
}

/* Bet panel */
.bet-amount {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel-deep);
  border: 2px solid #12181f;
  border-radius: 8px;
  padding: 8px 9px;
  margin-bottom: 8px;
}
#betInput {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  padding: 2px 0;
  text-shadow: var(--pix-shadow);
}
#betInput:disabled { color: var(--text-faint); text-shadow: none; }

.bet-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.mini-btn {
  padding: 8px 4px 7px;
  border-radius: 7px;
  background: #46556a;
  color: #fff;
  font-size: 8px;
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8);
  box-shadow: 0 3px 0 #232b36;
  transition: filter 0.1s;
}
.mini-btn:hover:not(:disabled) { filter: brightness(1.12); }
.mini-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #232b36; }
.mini-btn:disabled { opacity: 0.45; }

/* Big action button */
.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 64px;
  border-radius: 10px;
  color: #fff;
  transition: filter 0.1s;
}
.action-label { font-size: 15px; letter-spacing: 2px; text-transform: uppercase; text-shadow: var(--pix-shadow); }
.action-sub { font-size: 9px; opacity: 0.95; text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8); }

.action-btn.is-bet {
  background: linear-gradient(180deg, #3fabff, var(--blue));
  box-shadow: 0 5px 0 var(--blue-dk);
}
.action-btn.is-cashout {
  background: linear-gradient(180deg, #ff6a52, var(--red));
  box-shadow: 0 5px 0 var(--red-dk);
}
.action-btn:hover:not(:disabled) { filter: brightness(1.1); }
.action-btn:active:not(:disabled) { transform: translateY(3px); }
.action-btn.is-bet:active:not(:disabled) { box-shadow: 0 2px 0 var(--blue-dk); }
.action-btn.is-cashout:active:not(:disabled) { box-shadow: 0 2px 0 var(--red-dk); }
.action-btn:disabled { filter: saturate(0.25) brightness(0.6); }

.action-btn.pulse { animation: btn-pulse 0.4s ease; }
@keyframes btn-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Autopick + hint */
.side-row { display: flex; align-items: center; gap: 12px; }
.autopick-btn {
  flex: 1;
  padding: 12px 10px 11px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffb648, var(--orange));
  color: #fff;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: var(--pix-shadow);
  box-shadow: 0 4px 0 var(--orange-dk);
  transition: filter 0.1s;
}
.autopick-btn:hover:not(:disabled) { filter: brightness(1.1); }
.autopick-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--orange-dk); }
.autopick-btn:disabled { filter: saturate(0.25) brightness(0.6); }

.pick-hint { font-size: 7px; color: var(--text-dim); letter-spacing: 1px; text-transform: uppercase; }
.pick-hint.glow { color: var(--gold); animation: hint-glow 2.2s ease-in-out infinite; }
.pick-hint.scan { color: #48e6ff; animation: hint-glow 1.1s ease-in-out infinite; }
@keyframes hint-glow {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Vault bonus: shard progress + stored Minesweep charges (feature-flagged
   from the backend; the whole panel stays hidden when disabled). */
.vault-panel { border-color: rgba(255, 210, 74, 0.4); }
.shard-row { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.shard-bar {
  flex: 1;
  display: flex;
  gap: 3px;
  height: 14px;
  padding: 3px;
  border-radius: 6px;
  background: rgba(8, 11, 18, 0.65);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}
.shard-cell {
  flex: 1;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
}
.shard-cell.full {
  /* Vault shards are PINK - matching the pink diamond reveal. */
  background: linear-gradient(180deg, #ffd7f3, #ff5fd2 55%, #c73aa4);
  box-shadow: 0 0 6px rgba(255, 95, 210, 0.8);
}
.shard-cell.just-earned { animation: shard-pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes shard-pop {
  0% { transform: scaleY(0.2); filter: brightness(2.2); }
  60% { transform: scaleY(1.35); }
  100% { transform: scaleY(1); }
}
.shard-text { font-size: 9px; color: #ff8ad9; text-shadow: var(--pix-shadow); flex: none; }

/* Pink diamond flying from the Vault Tile to the progress bar. */
.shard-fly {
  position: fixed;
  width: 22px;
  height: 22px;
  z-index: 95;
  pointer-events: none;
  background: linear-gradient(135deg, #ffd7f3, #ff5fd2 60%, #c73aa4);
  clip-path: polygon(50% 0%, 100% 38%, 50% 100%, 0% 38%);
  filter: drop-shadow(0 0 8px rgba(255, 95, 210, 0.9));
  transition: transform 0.68s cubic-bezier(0.25, 0.7, 0.3, 1), opacity 0.68s ease;
  opacity: 1;
}

.radar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 8px 9px;
  border-radius: 9px;
  background: linear-gradient(180deg, #2e8ca8, #1c5f78);
  color: #d8f6ff;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: var(--pix-shadow);
  box-shadow: 0 4px 0 #113b4c;
  transition: filter 0.1s;
}
.radar-btn svg { width: 15px; height: 15px; }
.radar-btn .radar-count { color: #9df0ff; }
.radar-btn:hover:not(:disabled) { filter: brightness(1.12); }
.radar-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #113b4c; }
.radar-btn:disabled { filter: saturate(0.25) brightness(0.6); }
.radar-btn.armed {
  background: linear-gradient(180deg, #45d7f7, #1f8fb4);
  animation: radar-armed 1s ease-in-out infinite;
}
@keyframes radar-armed {
  0%, 100% { box-shadow: 0 4px 0 #113b4c, 0 0 10px rgba(72, 230, 255, 0.5); }
  50% { box-shadow: 0 4px 0 #113b4c, 0 0 22px rgba(72, 230, 255, 0.95); }
}

/* Crosshair over the board while a scan is armed. */
.board-wrap.radar-armed canvas { cursor: crosshair !important; }

/* Icon row - pinned to the sidebar bottom so column bottoms align. */
.icon-row { display: flex; gap: 8px; justify-content: center; margin-top: auto; }
.icon-btn {
  position: relative;
  width: 36px;
  height: 34px;
  border-radius: 8px;
  background: #46556a;
  color: #cbd8e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #232b36;
  transition: filter 0.1s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { filter: brightness(1.15); }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #232b36; }

.fair-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 6px rgba(47, 208, 108, 0.9);
}
.fair-dot.bad { background: var(--red); box-shadow: 0 0 6px rgba(252, 75, 58, 0.9); }

/* ------------------------------------------------------------------ */
/*  Stage: board + multiplier strip                                    */
/* ------------------------------------------------------------------ */
.stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.board-wrap {
  position: relative;
  border-radius: 12px;
  border: 3px solid var(--side-edge);
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 380px;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.45), 0 20px 50px rgba(0, 0, 0, 0.5);
  background: #10141f;
}

/* Balance lives inside the game container, top right. */
.balance-chip {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 7px;
  border-radius: 9px;
  background: rgba(34, 43, 55, 0.92);
  border: 2px solid var(--panel-deep);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  font-size: 12px;
  text-shadow: var(--pix-shadow);
  pointer-events: none;
}

/* Compact in-board Autopick appears only in the phone layout. */
.board-autopick-btn { display: none; }

#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.board-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 80px rgba(3, 6, 14, 0.55);
  pointer-events: none;
}

.board-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(70% 70% at 50% 50%, rgba(252, 75, 58, 0.36), rgba(252, 75, 58, 0.08) 70%, transparent);
}
.board-flash.red { animation: flash-fade 0.7s ease-out; }
.board-flash.green {
  background: radial-gradient(70% 70% at 50% 50%, rgba(47, 208, 108, 0.28), rgba(47, 208, 108, 0.05) 70%, transparent);
  animation: flash-fade 0.9s ease-out;
}
@keyframes flash-fade { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }

/* Win popup - arcade plaque */
.win-popup[hidden] { display: none; }
.win-popup {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 26px 20px;
  border-radius: 12px;
  background: var(--side);
  border: 3px solid var(--gold);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.5), 0 22px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(255, 210, 74, 0.25);
  z-index: 5;
  animation: pop-in 0.45s cubic-bezier(0.24, 1.56, 0.44, 1);
}
.win-popup.closing { animation: pop-out 0.25s ease-in forwards; }
@keyframes pop-in { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes pop-out { 0% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(0.7); opacity: 0; } }

.win-title {
  font-size: 15px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: var(--pix-shadow);
  animation: hint-glow 1.2s ease-in-out infinite;
}
.win-row { display: flex; align-items: center; gap: 12px; }
.win-mult {
  padding: 12px 15px 11px;
  border-radius: 9px;
  background: linear-gradient(180deg, #3fabff, var(--blue));
  box-shadow: 0 5px 0 var(--blue-dk);
  font-size: 17px;
  text-shadow: var(--pix-shadow);
}
.win-amount {
  padding: 12px 15px 11px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ff6a52, var(--red));
  box-shadow: 0 5px 0 var(--red-dk);
  font-size: 17px;
  text-shadow: var(--pix-shadow);
}
.win-amount::before { content: "$"; margin-right: 2px; }

/* Multiplier strip */
.mult-strip { display: flex; align-items: center; gap: 8px; }

.strip-arrow {
  flex: none;
  width: 30px;
  height: 52px;
  border-radius: 8px;
  background: #46556a;
  color: #cbd8e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #232b36;
  transition: filter 0.1s;
}
.strip-arrow svg { width: 16px; height: 16px; }
.strip-arrow:hover { filter: brightness(1.15); }
.strip-arrow:active { transform: translateY(2px); box-shadow: 0 1px 0 #232b36; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 4px 2px 6px;
  flex: 1;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  min-width: 86px;
  padding: 9px 10px 8px;
  border-radius: 8px;
  background: var(--panel);
  border: 2px solid var(--panel-deep);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  text-align: center;
  transition: transform 0.15s, filter 0.15s;
}
.chip-mult { font-size: 10px; color: var(--text); text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8); }

/* Ladder chips escalate like the board stamps: gold -> hot -> rainbow. */
.chip-mult.hot {
  color: #ffb347;
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8), 0 0 8px rgba(255, 150, 40, 0.75);
}
.chip-mult.blazing {
  color: #ff7a3c;
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8), 0 0 9px rgba(255, 120, 30, 0.95), 0 0 20px rgba(255, 60, 10, 0.5);
}
.chip-mult.rainbow {
  background: linear-gradient(90deg,
    #ff4949, #ffa62e, #fff23b, #4dff70, #3ed4ff, #b06bff, #ff54b0, #ff4949);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(1px 1px 0 rgba(8, 11, 18, 0.9))
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.45));
  animation: rainbow-slide 0.9s linear infinite;
}
.chip-hits { font-size: 6.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); margin-top: 5px; }

.chip.is-active {
  background: linear-gradient(180deg, #3fabff, var(--blue));
  border-color: var(--blue-dk);
  box-shadow: 0 3px 0 var(--blue-dk);
  transform: translateY(-2px) scale(1.04);
}
.chip.is-active .chip-hits { color: rgba(255, 255, 255, 0.8); }
.chip.is-next { border-color: var(--gold); }

/* Floating stamps: score pops that punch onto the board (Balatro-style) */
.stamp {
  position: absolute;
  z-index: 6;
  pointer-events: none;
  font-size: 15px;
  color: #fff;
  text-shadow:
    2px 0 0 var(--ink-deep), -2px 0 0 var(--ink-deep),
    0 2px 0 var(--ink-deep), 0 -2px 0 var(--ink-deep),
    3px 3px 0 rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%);
  animation: stamp-pop 0.95s cubic-bezier(0.18, 1.4, 0.4, 1) forwards;
  white-space: nowrap;
}
.stamp.mult { color: #ffd24a; }
.stamp.boom { color: #ff5d4a; font-size: 18px; }
.stamp.win { color: #ffe08a; font-size: 24px; }
.stamp.vault {
  color: #ffd7f3;
  text-shadow:
    2px 0 0 var(--ink-deep), -2px 0 0 var(--ink-deep),
    0 2px 0 var(--ink-deep), 0 -2px 0 var(--ink-deep),
    0 0 14px rgba(255, 95, 210, 0.95), 0 0 30px rgba(255, 60, 180, 0.6);
}
@keyframes stamp-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(var(--rot, 0deg)); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(var(--rot, 0deg)); }
  30% { transform: translate(-50%, -50%) scale(1) rotate(var(--rot, 0deg)); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(0.92) rotate(var(--rot, 0deg)); }
}

/* Escalating multiplier stamps: hotter, glowier, then full rainbow. */
.stamp.hot {
  color: #ffb347;
  text-shadow:
    2px 0 0 var(--ink-deep), -2px 0 0 var(--ink-deep),
    0 2px 0 var(--ink-deep), 0 -2px 0 var(--ink-deep),
    0 0 12px rgba(255, 150, 40, 0.9), 0 0 26px rgba(255, 90, 20, 0.55);
}
.stamp.blazing {
  color: #ff7a3c;
  text-shadow:
    2px 0 0 var(--ink-deep), -2px 0 0 var(--ink-deep),
    0 2px 0 var(--ink-deep), 0 -2px 0 var(--ink-deep),
    0 0 16px rgba(255, 120, 30, 1), 0 0 36px rgba(255, 60, 10, 0.8);
}
.stamp.rainbow {
  background: linear-gradient(90deg,
    #ff4949, #ffa62e, #fff23b, #4dff70, #3ed4ff, #b06bff, #ff54b0, #ff4949);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter:
    drop-shadow(2px 2px 0 rgba(8, 11, 18, 0.9))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.6))
    drop-shadow(0 0 26px rgba(255, 200, 255, 0.5));
  animation:
    stamp-pop 1.4s cubic-bezier(0.18, 1.4, 0.4, 1) forwards,
    rainbow-slide 0.7s linear infinite;
}
@keyframes rainbow-slide {
  to { background-position: 300% 0; }
}

/* ------------------------------------------------------------------ */
/*  Fairness modal                                                     */
/* ------------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 18px;
}
.modal-backdrop[hidden] { display: none; }

.modal {
  width: min(580px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--side);
  border: 3px solid var(--side-edge);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.45), 0 30px 80px rgba(0, 0, 0, 0.7);
  padding: 16px 18px 18px;
  animation: pop-in 0.3s cubic-bezier(0.24, 1.4, 0.44, 1);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.modal-head h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: var(--pix-shadow);
}

.modal-blurb {
  color: var(--text-dim);
  font-size: 7.5px;
  line-height: 2;
  letter-spacing: 0.5px;
  margin: 6px 0 14px;
}
.modal-blurb code {
  background: rgba(10, 14, 22, 0.5);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--gold);
}

.fair-section {
  border: 2px solid var(--panel-deep);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--panel);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

.fair-sub {
  font-size: 7px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 2px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fair-status {
  font-size: 7px;
  letter-spacing: 1px;
  padding: 4px 9px 3px;
  border-radius: 6px;
  background: #46556a;
  color: var(--text-dim);
  text-transform: none;
  box-shadow: 0 2px 0 #232b36;
}
.fair-status.ok { background: var(--green-dk); color: #b7ffd2; box-shadow: 0 2px 0 #0b4423; }
.fair-status.bad { background: var(--red-dk); color: #ffc4bd; box-shadow: 0 2px 0 #5e0e07; }

.fair-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  min-height: 26px;
}
.fair-label { flex: none; width: 148px; font-size: 7px; letter-spacing: 1px; text-transform: uppercase; color: var(--text-dim); }
.fair-value {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fair-seed-edit { display: flex; gap: 8px; align-items: center; }
#fairSeedInput {
  flex: 1;
  min-width: 0;
  background: var(--panel-deep);
  border: 2px solid #12181f;
  border-radius: 7px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 6px 9px;
  outline: none;
}
#fairSeedInput:focus { border-color: var(--blue); }
#fairSeedInput:disabled { opacity: 0.5; }
.fair-seed-edit .mini-btn { padding: 7px 12px 6px; }

/* ------------------------------------------------------------------ */
/*  Toasts                                                             */
/* ------------------------------------------------------------------ */
#toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 95;
  pointer-events: none;
}
.toast {
  padding: 11px 16px 10px;
  border-radius: 9px;
  background: var(--side);
  border: 2px solid var(--side-edge);
  color: var(--text);
  font-size: 8px;
  letter-spacing: 0.5px;
  line-height: 1.6;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 12px 34px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.28s cubic-bezier(0.2, 1.4, 0.4, 1);
  text-shadow: 1px 1px 0 rgba(8, 11, 18, 0.8);
}
.toast.error { border-color: var(--red); }
.toast.success { border-color: var(--green); }
.toast.leaving { animation: toast-out 0.3s ease-in forwards; }
@keyframes toast-in { 0% { transform: translateY(14px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { 100% { transform: translateY(10px); opacity: 0; } }

/* ------------------------------------------------------------------ */
/*  Responsive                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  /* Phone: one column ordered for zero-scroll betting - title, board,
     bet button and the score right below; tuning panels below the fold. */
  #app {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 10px 24px;
  }
  /* Dissolve the two desktop columns so their children become direct flex
     items of #app and can be reordered freely. */
  .sidebar,
  .stage { display: contents; }

  .logo-plaque { order: 1; padding: 0; }
  .logo-img { max-width: 150px; }

  .board-wrap {
    order: 2;
    flex: none;
    height: min(94vw, 46vh);
    min-height: 250px;
  }
  .board-autopick-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 38px;
    padding: 0 12px;
    border-radius: 9px;
    background: linear-gradient(180deg, #ffb648, var(--orange));
    color: #fff;
    font-size: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: var(--pix-shadow);
    box-shadow: 0 4px 0 var(--orange-dk);
  }
  .board-autopick-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--orange-dk);
  }
  .board-autopick-btn:disabled { filter: saturate(0.25) brightness(0.6); }

  .action-btn { order: 3; }
  .score-panel { order: 4; }

  /* Below the fold: everything you tune between rounds. */
  .mult-strip { order: 5; }
  .bet-panel { order: 6; }
  .grid-panel { order: 7; }
  .mines-panel { order: 8; }
  .vault-panel { order: 9; }
  .side-row { order: 10; }
  .side-row .autopick-btn { display: none; }
  .icon-row { order: 11; margin-top: 2px; }
}
