/* slot-game-fit CACHE 20261205d
 * Problem: .sg2-stage used viewport-tall height clamps, so the iframe was
 * taller than the game canvas. Providers (esp. Pragmatic) then letterbox
 * inside the iframe → black top/bottom bars ("frames").
 * Fix: size the stage to the desktop slot aspect (16:9) and contain-fit
 * within available space. Do NOT stretch/distort the game.
 */
:root,
.sg2-page,
.sg2-stage {
  --sg2-game-ar-w: 16;
  --sg2-game-ar-h: 9;
}

.sg2-page {
  --sg2-stage-chrome: 15.5rem;
  --sg2-stage-max-h: min(56rem, calc(100dvh - var(--sg2-stage-chrome)));
}

/* Contain-fit stage: width capped so height never exceeds max; AR preserved */
.sg2-stage {
  --sg2-stage-w: min(
    100%,
    calc(var(--sg2-stage-max-h, 56rem) * var(--sg2-game-ar-w) / var(--sg2-game-ar-h))
  );
  width: var(--sg2-stage-w) !important;
  max-width: 100%;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: var(--sg2-game-ar-w) / var(--sg2-game-ar-h);
  margin-inline: auto;
  min-height: 0;
  background: #020711;
}

.sg2-frame {
  width: 100%;
  height: 100%;
  background: #020711;
}

/* Drop the inset vignette "picture frame" around the stage */
.sg2-stage:after {
  content: none !important;
  display: none !important;
  box-shadow: none !important;
}

/* Viewport-expand ("Full Screen" in-page): still contain-fit, no stretch */
.sg2-page.is-viewport-expand {
  --sg2-stage-chrome: 3.4rem;
  --sg2-stage-max-h: calc(100dvh - var(--sg2-stage-chrome));
}

.sg2-page.is-viewport-expand .sg2-shell {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  place-items: center stretch;
}

.sg2-page.is-viewport-expand .sg2-stage {
  --sg2-stage-w: min(
    100%,
    calc(var(--sg2-stage-max-h) * var(--sg2-game-ar-w) / var(--sg2-game-ar-h))
  );
  width: var(--sg2-stage-w) !important;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: var(--sg2-game-ar-w) / var(--sg2-game-ar-h);
  margin-inline: auto;
}

/* Native fullscreen on the stage element: letterbox OUTSIDE the iframe */
.sg2-stage:fullscreen,
.sg2-stage:-webkit-full-screen {
  width: 100dvw !important;
  height: 100dvh !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  background: #000;
  display: grid;
  place-items: center;
}

.sg2-stage:fullscreen .sg2-frame,
.sg2-stage:-webkit-full-screen .sg2-frame {
  width: min(100dvw, calc(100dvh * var(--sg2-game-ar-w) / var(--sg2-game-ar-h))) !important;
  height: min(100dvh, calc(100dvw * var(--sg2-game-ar-h) / var(--sg2-game-ar-w))) !important;
  max-width: 100%;
  max-height: 100%;
}

@media (width <= 1180px) {
  .sg2-page {
    --sg2-stage-chrome: 18rem;
    --sg2-stage-max-h: min(52rem, calc(100dvh - var(--sg2-stage-chrome)));
  }
}

@media (width <= 899.98px) {
  .sg2-page {
    --sg2-stage-chrome: 15.8rem;
    --sg2-stage-max-h: min(44rem, calc(100dvh - var(--sg2-stage-chrome)));
  }
}

@media (width <= 620px) {
  .sg2-page {
    --sg2-stage-chrome: 15.2rem;
    --sg2-stage-max-h: min(40rem, calc(100dvh - var(--sg2-stage-chrome)));
  }
}

/* Landscape phones: use almost full remaining shell height, still contain */
@media (width <= 899.98px) and (orientation: landscape) and (height <= 620px) {
  .sg2-page {
    --sg2-stage-chrome: 3.2rem;
    --sg2-stage-max-h: calc(100dvh - var(--sg2-stage-chrome));
  }

  .sg2-shell {
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    place-items: center stretch;
  }

  .sg2-stage {
    --sg2-stage-w: min(
      100%,
      calc(var(--sg2-stage-max-h) * var(--sg2-game-ar-w) / var(--sg2-game-ar-h))
    );
    width: var(--sg2-stage-w) !important;
    height: auto !important;
  }
}
