/*
 * Bet picker for halo static. The sheet is the game's own lace panel (game/ui/panel.webp), the same
 * frame the reels use for banners, in the HUD palette (Gaegu, lace, gold, ink). scripts/sync-halo-static.mjs
 * copies this file next to the bundle and links it after the game's stylesheet.
 */

.bet-veil {
  position: fixed;
  inset: 0;
  z-index: 40; /* above the paytable / bonus-buy modals (20) and toasts (30) */
  display: grid;
  place-items: center;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: #0a0b12b3;
}

.bet-sheet {
  width: min(440px, 100%);
  max-height: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 4px 8px 10px;
  overflow: hidden;
  color: var(--lace, #f6f2ff);
  font-family: Gaegu, Patrick Hand, Comic Sans MS, system-ui, sans-serif;
  font-weight: 700;
  background: none;
  border-style: solid;
  border-color: transparent;
  border-width: 34px;
  border-image-source: url("./game/ui/panel.webp");
  border-image-slice: 72 fill;
  border-image-width: 34px;
  border-image-repeat: stretch;
  border-image-outset: 0;
}

.bet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}
.bet-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  color: #fff;
}
.bet-now {
  margin: 1px 0 0;
  min-height: 1.15em;
  font-size: 26px;
  line-height: 1;
  color: var(--gold, #f2c14e);
}
.bet-now small {
  display: block;
  margin-bottom: 1px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  color: var(--muted, #b9b3cc);
}
.bet-x {
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lace, #f6f2ff);
  font-size: 26px;
  line-height: 1;
}

.bet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 2px;
}
.bet-opt {
  min-height: 48px;
  margin: 0;
  padding: 6px 4px;
  border: 2px solid rgba(246, 242, 255, .4);
  border-radius: 999px;
  background: rgba(20, 22, 34, .55);
  color: var(--lace, #f6f2ff);
  font-size: 22px;
  line-height: 1;
  font-weight: 700;
}
.bet-opt.is-on {
  background: var(--lace, #f6f2ff);
  border-color: var(--gold, #f2c14e);
  color: var(--ink, #1d2030);
  box-shadow: 0 0 0 2px var(--gold, #f2c14e);
}
.bet-opt:disabled {
  opacity: .38;
  box-shadow: none;
}
.bet-note {
  margin: 0;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--muted, #b9b3cc);
}

/* the HUD stake is a button now, still sitting on the lace pill */
button.bet-readout {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
button.bet-readout:disabled { cursor: default; }
.bet-readout { min-width: 108px; }
@media (max-width: 1180px) and (orientation: landscape) { .bet-readout { min-width: 96px; } }
@media (max-height: 520px) and (max-width: 780px) and (orientation: landscape) { .bet-readout { min-width: 84px; } }
@media (orientation: portrait) { .bet-readout { min-width: 92px; } }
@media (orientation: portrait) and (max-width: 374px) {
  .bet-readout { min-width: 80px; padding-inline: 6px; }
  .bet-readout b { font-size: calc(var(--ctl) * .4); }
}

/* the same control inside the Bonus Buy panel, next to its own + / − */
.buy-bet .buy-bet-open {
  margin: 0;
  padding: 6px 12px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 20px;
  cursor: pointer;
}
.buy-bet .buy-bet-open b { color: var(--gold, #f2c14e); }
.buy-bet .buy-bet-open:disabled { cursor: default; }

@media (min-width: 520px) {
  .bet-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* a phone on its side: the iframe is short, so the lace shrinks and the rows stay tappable */
@media (max-height: 520px) {
  .bet-veil { padding: 4px; }
  .bet-sheet {
    border-width: 14px;
    border-image-width: 14px;
    padding: 0 4px 4px;
    gap: 2px;
  }
  .bet-head { min-height: 32px; align-items: center; }
  .bet-head h2 { font-size: 22px; }
  .bet-now { display: flex; align-items: baseline; gap: 6px; margin: 0; font-size: 20px; }
  .bet-now small { display: inline; margin: 0; font-size: 14px; }
  .bet-x { width: 36px; height: 36px; font-size: 20px; }
  .bet-grid { gap: 6px; }
  .bet-opt { min-height: 36px; font-size: 18px; padding: 2px; }
  .bet-note { font-size: 14px; }
}
@media (max-width: 359px) {
  .bet-sheet { border-width: 22px; border-image-width: 22px; }
  .bet-opt { font-size: 18px; min-height: 44px; }
}
