/* GOALCU maintenance 2026-11-18.  Presentation-only fixes; do not alter game-world ratios. */
@media (orientation: landscape) and (max-height: 470px) and (min-width: 560px) {
  /* Penalty: the older fullscreen rule had higher specificity and forced flex,
     hiding the 5:3 playfield under the control panel on shallow screens. */
  html body.gc-arcade-penalti .penalty-square,
  html body.gc-screen.gc-arcade-penalti .penalty-square {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(190px,33%)!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    height:var(--gc-pen-square-h,200px)!important;flex:none!important;min-height:0!important;
    align-content:stretch!important;align-items:stretch!important;
    gap:4px 7px!important;overflow:hidden!important;
  }
  html body.gc-arcade-penalti .penalty-square > .role-banner,
  html body.gc-screen.gc-arcade-penalti .penalty-square > .role-banner {
    grid-column:1!important;grid-row:1!important;min-width:0!important;
    align-self:stretch!important;padding:3px 5px!important;
  }
  html body.gc-arcade-penalti .penalty-square > .stadium,
  html body.gc-screen.gc-arcade-penalti .penalty-square > .stadium {
    grid-column:1!important;grid-row:2!important;align-self:center!important;
    justify-self:center!important;min-width:0!important;min-height:0!important;
    max-width:100%!important;max-height:100%!important;flex:none!important;
    width:var(--gc-pen-scene-w,min(100%,350px))!important;
    height:var(--gc-pen-scene-h,210px)!important;aspect-ratio:5 / 3!important;
  }
  html body.gc-arcade-penalti .penalty-square > .panel,
  html body.gc-screen.gc-arcade-penalti .penalty-square > .panel {
    grid-column:2!important;grid-row:1 / 3!important;min-width:0!important;
    min-height:0!important;align-self:stretch!important;
    display:flex!important;flex-direction:column!important;
    justify-content:center!important;gap:2px!important;
    padding:5px!important;overflow-y:auto!important;
  }
  body.gc-arcade-penalti .penalty-square .phase {font-size:13px!important}
  body.gc-arcade-penalti .penalty-square .tip {font-size:10px!important;line-height:1.2!important;margin:2px 0!important}
  body.gc-arcade-penalti .penalty-square .btn {font-size:11px!important;min-height:30px!important;padding:4px!important}
  body.gc-arcade-penalti .penalty-square .choices {gap:4px!important}
  body.gc-arcade-penalti .penalty-square .foot {margin-top:2px!important}
  /* Foot Tennis: make difficulty/start actions visible without scrolling a
     cropped court overlay. The court and ball physics are unchanged. */
  body.gc-arcade-foottennis #overlay:not(.hidden){
    position:fixed!important;inset:44px 0 0!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    padding:5px max(6px,env(safe-area-inset-right))!important;
    overflow-y:auto!important;overscroll-behavior:contain!important;
    z-index:60!important;
  }
  body.gc-arcade-foottennis #overlay .panel{
    width:min(540px,96vw)!important;max-width:96vw!important;
    max-height:calc(100dvh - 50px)!important;overflow-y:auto!important;
    padding:6px 12px!important;margin:auto!important;border-radius:12px!important;
  }
  body.gc-arcade-foottennis #overlay .panel h1 {font-size:19px!important;line-height:1!important;margin:0 0 3px!important}
  body.gc-arcade-foottennis #overlay .panel p {font-size:10px!important;line-height:1.17!important;margin:3px 0!important}
  body.gc-arcade-foottennis #overlay .choices {margin:4px 0!important;gap:5px!important}
  body.gc-arcade-foottennis #overlay .choices button {min-height:30px!important;padding:5px 3px!important;font-size:11px!important}
  body.gc-arcade-foottennis #overlay .primary{min-height:34px!important;padding:6px 8px!important;margin-top:2px!important;font-size:13px!important}
  body.gc-arcade-foottennis #overlay .metric{margin-top:3px!important}
  /* Zombie menus may be tall when resume/new-adventure buttons are present. */
  body.gc-responsive-zombie .arena .overlay:not([hidden]) {
    overflow-y:auto!important;overscroll-behavior:contain!important;
    align-items:center!important;padding:5px!important;
  }
  body.gc-responsive-zombie .arena .overlay .box {
    width:min(480px,96%)!important;max-width:96%!important;
    max-height:100%!important;overflow-y:auto!important;
    margin:auto!important;padding:8px 10px!important;
  }
  body.gc-responsive-zombie .arena .overlay .box h2 {font-size:17px!important;margin:2px 0!important}
  body.gc-responsive-zombie .arena .overlay .box p {font-size:11px!important;line-height:1.25!important;margin:5px 0!important}
  body.gc-responsive-zombie .arena .overlay .actions {gap:5px!important}
  body.gc-responsive-zombie .arena .overlay .actions button {min-height:32px!important;padding:5px 8px!important;font-size:11px!important}
  body.gc-responsive-zombie #finalBossNote{overflow-y:auto!important;align-items:safe center!important}
  /* Keep the game header buttons inside the touch-safe viewport. */
  body:is(.gc-responsive-zombie,.gc-responsive-shoot,.gc-responsive-longshot) .gc-screen-root > :is(header,.masthead){
    top:max(4px,env(safe-area-inset-top))!important;
  }
}

@media (orientation:landscape) and (max-height:470px) and (min-width:560px) {
  /* Avoid an auto-height feedback loop between the older fullscreen rule and
     the penalty stage-fit script. Fix the root to the visible area. */
  html body.gc-screen.gc-arcade-penalti main.wrap.gc-screen-root,
  html body.gc-arcade-penalti main.wrap.gc-fit-root {
    position:absolute!important;top:var(--gc-header-height,52px)!important;
    height:calc(100dvh - var(--gc-header-height,52px))!important;
    max-height:calc(100dvh - var(--gc-header-height,52px))!important;
    overflow:hidden!important;
  }
  /* Freekick mode selection is a menu, not a playable scene. Keep all four
     choices on screen before returning to the existing game layout. */
  body.gc-arcade-freekick:not(.gc-in-game) .layout > .panel {
    position:fixed!important;
    top:max(54px,env(safe-area-inset-top))!important;
    bottom:max(6px,env(safe-area-inset-bottom))!important;
    left:50%!important;right:auto!important;
    transform:translateX(-50%)!important;
    width:min(570px,92vw)!important;height:auto!important;max-height:calc(100dvh - 60px)!important;
    z-index:95!important;
    overflow-y:auto!important;padding:10px!important;
    background:#123529f7!important;border:1px solid #5d8066!important;
    box-shadow:0 6px 26px #0008!important;
  }
  body.gc-arcade-freekick:not(.gc-in-game) .menu {
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
  }
  body.gc-arcade-freekick:not(.gc-in-game) .menu > h2 {grid-column:1/-1!important;font-size:17px!important;text-align:center!important}
  body.gc-arcade-freekick:not(.gc-in-game) .menu .modeBtn {min-height:70px!important;padding:7px 9px!important}
  body.gc-arcade-freekick:not(.gc-in-game) .menu .modeBtn strong {font-size:13px!important;line-height:1.15!important}
  body.gc-arcade-freekick:not(.gc-in-game) .menu .modeBtn span {font-size:10px!important;line-height:1.2!important;margin-top:3px!important}
}
