/* The desktop game and every in-game route share a centred 16:9 stage. */
html:root[data-game-scale]{background:#171814!important;overflow:hidden!important;scrollbar-gutter:auto}
@media (aspect-ratio > 16/9), (aspect-ratio < 16/9){
 html:root[data-game-scale]{
  background:linear-gradient(#10141163,#100e0c69),url('assets/han-cloud-brocade.webp') center / 448px repeat #171814!important;
 }
}
html[data-game-scale] body{
 position:fixed!important;inset:var(--game-frame-y) auto auto var(--game-frame-x)!important;
 width:var(--game-logical-width)!important;height:var(--game-logical-height)!important;
 min-height:0!important;margin:0!important;box-sizing:border-box;
 transform-origin:top left;transform:scale(var(--game-ui-scale));overflow:auto;
}
html[data-game-scale] body :is(.room-experience,.title-screen,.field-card-battle-overlay,.creation-card,.life-prologue){
 width:var(--game-logical-width)!important;height:var(--game-logical-height)!important;
 max-width:100%!important;max-height:100%!important;min-height:0!important;
 inset:0!important;margin:0!important;box-sizing:border-box;
}
html[data-game-scale] body:is(.palace-playing,.is-character-creation,.is-prologue,.is-year-review,.is-action-result,.is-life-finale) .site-wrap{
 height:var(--game-logical-height)!important;min-height:0!important;
}
/* Native modal dialogs live in the browser top layer, outside the body transform. */
@layer game-stage-dialogs {
html[data-game-scale] dialog:modal{
 zoom:var(--game-ui-scale)!important;max-width:calc(var(--game-logical-width) - 24px)!important;
 max-height:calc(var(--game-logical-height) - 24px)!important;
}
html[data-game-scale] dialog:modal:is(.action-scene,.family-action-scene,.cinematic-opening,.season-intro){
 width:var(--game-logical-width)!important;height:var(--game-logical-height)!important;
 max-width:var(--game-logical-width)!important;max-height:var(--game-logical-height)!important;
 inset:0!important;margin:auto!important;
}
/* Top-layer coordinates use the dialog's zoom, not the translated game body. */
html:root[data-game-scale] body dialog[open]:modal{
 position:fixed!important;inset:calc(var(--game-frame-y) / var(--game-ui-scale) + var(--game-logical-height) / 2) auto auto calc(var(--game-frame-x) / var(--game-ui-scale) + var(--game-logical-width) / 2)!important;
 translate:-50% -50%!important;
 margin:0!important;transform:none!important;
}
}
