/* GamePulo embed fit (web build only).
   The site player gives the game a wide 16:9 frame (4:3 on phones). The original 2048 page is a tall
   document, so in that frame the board was cut off. When the page does not fit its window, embed-fit.js
   adds .gp-fit (and .gp-landscape for wide windows) and a scale; the board then always fits whole.
   When the page already fits (for example in fullscreen), nothing here applies. */
html.gp-fit, html.gp-fit body { height: 100%; overflow: hidden; }
html.gp-fit body { margin: 0; padding: 0; }
html.gp-fit .container {
  position: absolute; left: 50%; top: 50%; margin: 0;
  width: max-content;
  transform: translate(-50%, -50%) scale(var(--gp-scale, 1));
  transform-origin: 50% 50%;
}
html.gp-fit:not(.gp-landscape) .container { width: 500px; }
html.gp-fit.gp-landscape .container {
  display: grid;
  grid-template-columns: 210px auto;
  grid-template-rows: auto auto auto 1fr;
  grid-template-areas: "logo game" "heading game" "above game" "help game";
  column-gap: 26px;
}
html.gp-landscape .gamepulo-logo { grid-area: logo; justify-self: start; }
html.gp-landscape .heading { grid-area: heading; }
html.gp-landscape .above-game { grid-area: above; }
html.gp-landscape .game-container { grid-area: game; margin-top: 0; align-self: center; }
html.gp-landscape .game-explanation { grid-area: help; margin: 14px 0 0; font-size: 14px; line-height: 1.5; }
html.gp-landscape h1.title { float: none; font-size: 64px; line-height: 1.05; }
html.gp-landscape .scores-container { float: none; text-align: left; margin: 6px 0 4px; }
html.gp-landscape .score-container, html.gp-landscape .best-container { margin: 4px 4px 0 0; }
html.gp-landscape .game-intro { float: none; line-height: 1.4; margin: 8px 0 10px; font-size: 15px; }
html.gp-landscape .restart-button { float: none; display: inline-block; }

@media screen and (max-width: 520px) {
  html.gp-fit:not(.gp-landscape) .container { width: 280px; }
  html.gp-fit.gp-landscape .container { grid-template-columns: 124px auto; column-gap: 14px; }
  html.gp-landscape h1.title { font-size: 34px; margin-top: 0; }
  html.gp-landscape .score-container, html.gp-landscape .best-container { padding: 15px 8px; min-width: 40px; }
  html.gp-landscape .game-intro { width: auto; font-size: 13px; margin: 6px 0 8px; }
  html.gp-landscape .restart-button { width: auto; padding: 0 12px; }
  /* Phones: the short how-to text stays on the game page below the player; the board gets the room. */
  html.gp-landscape .game-explanation { display: none; }
}
