/* AMBA WORLD v98: Landscape parity across Sakura, Guilin and Singapore.
   Guilin is the proven reference. Keep portrait completely untouched.

   Guilin renders its full-viewport 1280x720 gameplay canvas with object-fit:cover.
   Earlier Sakura rules used contain (letterbox). Singapore used cover with
   bottom alignment, producing different framing on wide handsets.

   Apply the same screen-filling, centered view to all three and keep their
   existing interactive HUD/touch pads outside the canvas unaffected.
*/
@media (orientation:landscape) and (max-height:650px),
       (orientation:landscape) and (pointer:coarse) {
  /* Same viewport contract as Guilin's #guilinRoot. */
  html,body{width:100%!important;height:100%!important;overflow:hidden!important}
  #shell{
    position:relative!important;inset:0!important;
    width:100vw!important;width:100dvw!important;
    height:100vh!important;height:100dvh!important;
    min-width:0!important;min-height:0!important;
    overflow:hidden!important;
  }
  #shell > #game{
    position:absolute!important;inset:0!important;
    display:block!important;
    width:100%!important;height:100%!important;
    max-width:none!important;max-height:none!important;
    object-fit:cover!important;
    object-position:center 50%!important;
    transform:none!important;opacity:1!important;
    image-rendering:auto!important;
  }
  #shell > #ambaSakuraPortraitView{display:none!important}
  #singaporeRoot{
    position:absolute!important;inset:0!important;
    width:100%!important;height:100%!important;
    min-width:0!important;min-height:0!important;
    overflow:hidden!important;
  }
  #singaporeRoot > #singaporeCanvas{
    position:absolute!important;inset:0!important;
    width:100%!important;height:100%!important;
    max-width:none!important;max-height:none!important;
    display:block!important;
    object-fit:cover!important;
    object-position:center 50%!important;
    transform:none!important;opacity:1!important;
    image-rendering:auto!important;
  }
  #singaporeRoot > #ambaSingaporePortraitView{display:none!important}

  /* Match Guilin's compact controls, retaining generous touch targets. */
  #shell > .touch button[data-key]{min-height:52px!important;min-width:51px!important}
  #shell > .touch.action-pad [data-key="Space"]{min-height:54px!important;min-width:58px!important}
  #singaporeRoot .sg-mobile button{min-height:52px!important;min-width:51px!important}
  #singaporeRoot .sg-mobile-right button:last-child{min-width:69px!important}
  #shell > .touch.move-pad,#singaporeRoot .sg-mobile-left{
    left:max(12px,env(safe-area-inset-left))!important;
  }
  #shell > .touch.action-pad,#singaporeRoot .sg-mobile-right{
    right:max(12px,env(safe-area-inset-right))!important;
  }
  #shell > .touch,#singaporeRoot .sg-mobile{
    bottom:max(12px,env(safe-area-inset-bottom))!important;
  }

  /* The country-entry cards use Guilin's 57dvh cinematic height, typography,
     compact nameplate and footer spacing. Only ENTRY cards are touched. */
  #npcDialog.amba-country-intro .scene-card,
  #singaporeRoot #sg-modal .sg-modal-card.country-start{
    width:min(940px,97vw)!important;
    max-height:96dvh!important;
    padding:clamp(9px,1.2vw,14px)!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
  }
  #npcDialog.amba-country-intro .guardian-scene,
  #singaporeRoot #sg-modal .sg-modal-card.country-start .sg-cinematic{
    height:clamp(190px,57dvh,355px)!important;
  }
  #npcDialog.amba-country-intro .guardian-dialogbox,
  #singaporeRoot #sg-modal .sg-modal-card.country-start .sg-caption{
    bottom:2%!important;
    padding:10px 14px 11px!important;
  }
  #npcDialog.amba-country-intro .guardian-dialogbox .nameplate,
  #singaporeRoot #sg-modal .sg-modal-card.country-start .sg-caption .sg-name{
    top:-15px!important;font-size:20px!important;padding:5px 15px!important;
  }
  #npcDialog.amba-country-intro .guardian-dialogbox .dialog-copy,
  #singaporeRoot #sg-modal .sg-modal-card.country-start .sg-caption p{
    font-size:17px!important;line-height:1.25!important;
    padding-top:21px!important;
  }
  #npcDialog.amba-country-intro .guardian-dialogbox .dialog-copy .sub{
    font-size:12px!important;line-height:1.25!important;margin-top:5px!important;
  }
  #npcDialog.amba-country-intro .guardian-scene-actions,
  #singaporeRoot #sg-modal .sg-modal-card.country-start .sg-actions{
    margin-top:6px!important;gap:10px!important;
  }
  #npcDialog.amba-country-intro .guardian-scene-actions button,
  #singaporeRoot #sg-modal .sg-modal-card.country-start .sg-actions button{
    min-height:40px!important;padding:7px 12px!important;font-size:12px!important;
  }
}
