.gff-landscape-gate { display: none; }
@media (orientation: landscape) and (max-width: 900px) and (max-height: 500px) {
  /* Keep the game world scaled, but render its DOM menus at native phone size. */
  #stage { overflow: visible !important; }
  #stage > .overlay {
    top: 0; left: 0; right: auto; bottom: auto;
    width: 100vw; height: 100dvh;
    max-width: none;
    transform-origin: 0 0;
    transform: scale(var(--gff-inverse-scale, 1)) translate(calc(-1 * var(--gff-stage-x, 0px)), calc(-1 * var(--gff-stage-y, 0px)));
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    justify-content: flex-start !important;
    padding: 8px;
  }
  #stage > .overlay button, #stage > .overlay select { min-height: 44px; }
  #stage > .overlay > * { min-width: 0; max-width: 100%; }
  #stage > .overlay .modal { min-width: 0; max-width: calc(100vw - 20px); max-height: calc(100dvh - 16px); overflow-y: auto; margin: auto; }
  #stage > #hud button,
  #stage > #hud-btns button,
  #stage > #topbtns button,
  #stage > #tut button,
  #stage > #touch button,
  #stage > #pad button,
  #stage > button[id*="pause"],
  #stage > button[id*="menu"] {
    min-width: var(--gff-touch-source, 88px);
    min-height: var(--gff-touch-source, 88px);
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  .gff-landscape-gate {
    position: fixed; inset: 0; z-index: 2147483646; display: flex; align-items: center; justify-content: center;
    padding: 24px; overflow: hidden; text-align: center; color: #fffaf0;
    background: #111526; font-family: 'Nunito', system-ui, sans-serif;
  }
  .gff-landscape-gate img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(12px) brightness(.38); transform: scale(1.15); }
  .gff-landscape-gate::after { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, #11152699, #080b1dec); }
  .gff-landscape-message { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 13px; max-width: 330px; }
  .gff-landscape-message .gff-rotate-icon { display: grid; place-items: center; width: 86px; height: 86px; border: 2px solid #ffffff80; border-radius: 24px; background: #ffffff20; font-size: 58px; line-height: 1; }
  .gff-landscape-message strong { font-size: 24px; line-height: 1.12; }
  .gff-landscape-message p { margin: 0; font-size: 14px; line-height: 1.35; color: #e4e9f4; }
}
