/* AMBA WORLD v104 | SAFE COMPACT CINEMATIC CARD CONTRACT
   v103 regression recovery: do not resize or reposition inner character art,
   stages, sprites, dialogue overlays, or whole-screen canvases here.
   Enforce consistent outer size / scroll only. Camera and gameplay untouched.
*/
:root{
  --amba-cinematic-width:min(86vw,760px);
  --amba-cinematic-reward-width:min(82vw,720px);
  --amba-cinematic-max-height:calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
@media (orientation:portrait){
 :root{
   --amba-cinematic-width:min(90vw,680px);
   --amba-cinematic-reward-width:min(88vw,650px);
   --amba-cinematic-max-height:calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
 }
}
@media (orientation:landscape){
 :root{
   --amba-cinematic-width:min(80vw,760px);
   --amba-cinematic-reward-width:min(78vw,720px);
   --amba-cinematic-max-height:calc(90dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
 }
}
/* Sakura: conversations and story transitions. Existing illustration positioning preserved. */
#dialog > .scene-card,
#npcDialog > .scene-card,
#sparkScene > .scene-card,
#duelIntro > .duel-intro-card{
 width:var(--amba-cinematic-width)!important;
 max-width:calc(100vw - 24px)!important;
 max-height:var(--amba-cinematic-max-height)!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 margin-inline:auto!important;
}
/* Higher specificity for the country-intro styling that previously forced 97vw. */
#npcDialog.amba-country-intro > .scene-card{
 width:var(--amba-cinematic-width)!important;
 max-height:var(--amba-cinematic-max-height)!important;
}
/* Sakura rewards can be somewhat smaller than conversations, including the stamped Japan page. */
#rewardScene > .animated-gift-card,
#passportScene > .passport-anim-card{
 width:var(--amba-cinematic-reward-width)!important;
 max-width:calc(100vw - 24px)!important;
 max-height:var(--amba-cinematic-max-height)!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 margin-inline:auto!important;
}
/* Guilin: keep its existing proven illustration/dialogue layout. */
#guilinRoot #guilinDialog > .guilin-panel{
 width:var(--amba-cinematic-width)!important;
 max-width:calc(100vw - 24px)!important;
 max-height:var(--amba-cinematic-max-height)!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 margin-inline:auto!important;
}
#guilinRoot #guilinReward > .gcin-card,
#guilinRoot #guilinChinaStamp > .gcin-card{
 width:var(--amba-cinematic-reward-width)!important;
 max-width:calc(100vw - 24px)!important;
 max-height:var(--amba-cinematic-max-height)!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 margin-inline:auto!important;
}
/* Singapore: preserve carefully positioned AMBA/Vibey sprites and baton/Star artwork. */
#singaporeRoot #sg-modal > .sg-modal-card,
#singaporeRoot #sg-modal > .sg-modal-card.country-start,
#singaporeRoot #sg-modal > .sg-modal-card.full-art,
#singaporeRoot #sg-modal > .sg-modal-card.victory-card{
 width:var(--amba-cinematic-width)!important;
 max-width:calc(100vw - 24px)!important;
 max-height:var(--amba-cinematic-max-height)!important;
 overflow-x:hidden!important;
 overflow-y:auto!important;
 margin-inline:auto!important;
}
/* Small landscape screens: avoid clipping action buttons, do not force any
   scene's aspect ratio or image height. User can scroll content if needed. */
@media (orientation:landscape) and (max-height:480px){
 #dialog > .scene-card,
 #npcDialog > .scene-card,
 #sparkScene > .scene-card,
 #duelIntro > .duel-intro-card,
 #rewardScene > .animated-gift-card,
 #passportScene > .passport-anim-card,
 #guilinRoot #guilinDialog > .guilin-panel,
 #guilinRoot #guilinReward > .gcin-card,
 #guilinRoot #guilinChinaStamp > .gcin-card,
 #singaporeRoot #sg-modal > .sg-modal-card{
   scrollbar-width:thin;
   overscroll-behavior:contain;
   -webkit-overflow-scrolling:touch;
 }
}

