/* Fit the entire optical viewport within the actual battle area, including the toolbar. */
html.terra-fit-compact .legion-game.mode-formal .room-main > .battle .board-wrap {
 width:min(100%,calc((100dvh - var(--terra-toolbar-height,56px)) * 16 / 9))!important;
 max-width:100%!important; height:auto!important; aspect-ratio:16/9!important;
 left:50%!important;top:50%!important;transform:translate(-50%,-50%)!important;
}
html.terra-fit-compact .legion-game.mode-formal .formal-shop-rail {right:22px!important;bottom:23px!important;}
html.terra-fit-compact .legion-game.mode-formal .formal-ready-dock {right:22px!important;}

/* Fill the peripheral stage with the same world floor colour. Keep the optical
 * canvas and its hit testing isotropic; never stretch the board to screen width. */
html.terra-fit-compact .legion-game.mode-formal .room-main > .battle {background:#1c2b31!important;}
html.terra-fit-compact .legion-game.mode-formal .room-main > .battle .board-wrap {background:#1c2b31!important;}
/* Fade only decorative terrain at the outermost edges to avoid a hard seam.
 * The camera leaves safe margins around the board and reserve dock. */
html.terra-fit-compact .legion-game.mode-formal .board-wrap.view-3d #terrain3d-host {mask-image:linear-gradient(to right,transparent,#000 3%,#000 97%,transparent);}
