/* Recovered CSS section 36: 36-singapore-expanded-victory.css */

/* Victory is the only cinematic whose canvas fills a portrait viewport.
   Sakura/Guilin, Singapore gameplay and the earlier baton transfer are untouched. */
@media (orientation:portrait) and (max-width:820px){
 #singaporeRoot.sg-v91-victory-cinematic #singaporeCanvas{
   object-fit:cover!important;object-position:center center!important;
   image-rendering:auto!important;
 }
}
/* The final congratulatory illustration fills the card, rather than floating
   as a small square within a shallow landscape banner. */
#singaporeRoot #sg-modal .sg-modal-card.victory-card{
 box-sizing:border-box!important;
 width:min(1180px,97vw)!important;
 max-width:1180px!important;
 max-height:95dvh!important;
 padding:clamp(9px,1.4vw,19px)!important;
}
#singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-cinematic{
 display:flex!important;flex-direction:column!important;
 height:auto!important;max-height:none!important;
}
#singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-stage{
 position:relative!important;
 width:100%!important;
 height:clamp(380px,62dvh,610px)!important;
 flex:0 0 auto!important;
 overflow:hidden!important;
 background:#7552ae!important;
}
#singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-scene-art{
 display:block!important;width:100%!important;height:100%!important;
 object-fit:cover!important;object-position:center 29%!important;
 background:transparent!important;opacity:1!important;
 image-rendering:auto!important;
}
/* Never layer the old high-five sprite over the final full-image card. */
#singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-v82-win-panel{
 display:none!important;
}
@media (orientation:portrait) and (max-width:820px){
 #singaporeRoot #sg-modal .sg-modal-card.victory-card{
   width:min(96vw,550px)!important;
   padding:10px!important;
 }
 #singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-stage{
   height:auto!important;
   min-height:0!important;
   aspect-ratio:4/3!important;
   max-height:min(47dvh,480px)!important;
 }
 #singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-scene-art{
   object-fit:cover!important;object-position:center center!important;
 }
}
@media (orientation:landscape) and (max-height:550px){
 #singaporeRoot #sg-modal .sg-modal-card.victory-card .sg-stage{
   height:clamp(135px,39dvh,235px)!important;
 }
 #singaporeRoot #sg-modal .sg-modal-card.victory-card{
   max-height:97dvh!important;overflow:auto!important;
 }
}


/* Recovered CSS section 37: 37-sakura-touch-polish.css */

#shell>.touch{touch-action:none!important;overscroll-behavior:contain;pointer-events:auto!important}
#shell>.touch button[data-key]{touch-action:none!important;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;user-select:none;pointer-events:auto!important;position:relative;z-index:6}
@media (pointer:coarse){
 #shell>.touch{gap:7px!important}
 #shell>.touch button[data-key]{min-width:54px!important;min-height:58px!important;padding:5px!important}
 #shell>.touch.action-pad [data-key="Space"]{height:60px!important;min-width:58px!important;margin-left:0!important}
}
@media (pointer:coarse) and (max-width:365px){
 #shell>.touch{gap:4px!important}
 #shell>.touch.move-pad{left:max(5px,env(safe-area-inset-left))!important}
 #shell>.touch.action-pad{right:max(5px,env(safe-area-inset-right))!important}
 #shell>.touch button[data-key]{min-width:46px!important;min-height:56px!important}
 #shell>.touch.action-pad [data-key="Space"]{min-width:51px!important;height:58px!important}
}


/* Recovered CSS section 38: 38-portrait-fullscreen-viewport.css */

/* The landscape canvases continue to render internally. In portrait the visible
   canvas is a full-height, correctly proportioned follow camera, not a scaled
   16:9 letterboxed rectangle. Guilin retains its established layout. */
#ambaSakuraPortraitView,#ambaSingaporePortraitView{display:none!important}
@media (pointer:coarse) and (orientation:portrait) and (max-width:820px){
  body.amba-sakura-portrait-play #shell #game{
    opacity:0!important;object-fit:fill!important;
  }
  body.amba-sakura-portrait-play #shell #ambaSakuraPortraitView{
    display:block!important;position:absolute!important;inset:0!important;
    width:100%!important;height:100%!important;object-fit:fill!important;
    pointer-events:none!important;z-index:1!important;image-rendering:auto!important;
  }
  #singaporeRoot.sg-portrait-continue #singaporeCanvas{
    opacity:0!important;object-fit:fill!important;
  }
  #singaporeRoot.sg-portrait-continue #ambaSingaporePortraitView{
    display:block!important;position:absolute!important;inset:0!important;
    width:100%!important;height:100%!important;object-fit:fill!important;
    pointer-events:none!important;z-index:1!important;image-rendering:auto!important;
  }
  body.amba-sakura-portrait-play #shell #top{z-index:4!important;}
  body.amba-sakura-portrait-play #shell .touch{z-index:8!important;}
  body.amba-sakura-portrait-play #shell .bottom,
  body.amba-sakura-portrait-play #shell #toast,
  body.amba-sakura-portrait-play #shell .prompt{z-index:4!important;}
  #singaporeRoot.sg-portrait-continue .sg-top,
  #singaporeRoot.sg-portrait-continue .sg-quest,
  #singaporeRoot.sg-portrait-continue #sg-toast{z-index:4!important;}
  #singaporeRoot.sg-portrait-continue .sg-mobile{z-index:8!important;}
  #singaporeRoot.sg-portrait-continue #sg-modal,
  #singaporeRoot.sg-portrait-continue #sg-pause{z-index:12!important;}
}




/* v96: Landscape mobile viewport parity with the Guilin chapter.
   Sakura must fit its full 1280 x 720 world in the phone's available space;
   Singapore should fill ultrawide phones without distorting character art.
   Scope to touch landscape only: portrait gameplay and desktop stay unchanged. */
@media (pointer:coarse) and (orientation:landscape) {
  /* Prevent a grid item's intrinsic 1280px width from expanding the Sakura
     layout beyond the phone. Give the canvas a definite constrained box. */
  #shell {
    width:100vw!important;
    width:100dvw!important;
    height:100dvh!important;
    min-width:0!important;
    grid-template-columns:minmax(0,1fr)!important;
    overflow:hidden!important;
  }
  #shell > #game {
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-width:100%!important;
    max-height:100%!important;
    object-fit:contain!important;
    object-position:center center!important;
    transform:none!important;
    opacity:1!important;
    image-rendering:auto!important;
  }
  /* Portrait-only follow canvas must never cover the Sakura landscape when
     the phone is rotated. The original 16:9 game view is used instead. */
  #shell > #ambaSakuraPortraitView { display:none!important; }

  /* The old Singapore override used object-fit:contain, leaving empty bars
     on 19.5:9 and 21:9 devices. Cover fills the viewport, cropping a little
     sky and foreground rather than stretching Vibey or the Guardian.
     Bottom alignment keeps Vibey above the touch buttons near ground level. */
  #singaporeRoot {
    width:100%!important;
    height:100%!important;
    overflow:hidden!important;
  }
  #singaporeRoot > #singaporeCanvas {
    position:absolute!important;
    inset:0!important;
    display:block!important;
    width:100%!important;
    height:100%!important;
    min-width:0!important;
    max-width:100%!important;
    object-fit:cover!important;
    object-position:center bottom!important;
    image-rendering:auto!important;
  }
  /* The film cutscenes use a separately composed centre frame. */
  #singaporeRoot.sg-cinematic-active > #singaporeCanvas {
    object-position:center center!important;
  }
  #singaporeRoot > #ambaSingaporePortraitView {display:none!important;}
}
