/* Menus stay out of the way: no dimming, small, in a corner, the office keeps working behind them. */
dialog:not(#raceDialog)[open]{position:fixed;inset:auto 12px 76px auto;margin:0;width:min(380px,calc(100vw - 24px));max-height:min(62vh,560px);overflow:auto;z-index:40;box-shadow:0 8px 28px rgba(20,16,50,.28)}
dialog:not(#raceDialog)::backdrop{background:transparent}
.panel.right{width:min(360px,calc(100vw - 24px))!important;max-height:calc(100% - 24px);top:12px;bottom:auto;right:12px;border-radius:12px;box-shadow:0 8px 28px rgba(20,16,50,.28)}
#objectMenu{position:fixed;z-index:60;display:flex;flex-direction:column;gap:2px;min-width:170px;max-width:240px;padding:6px;border-radius:12px;background:#fffdf6;border:1px solid #d9d2bd;box-shadow:0 6px 20px rgba(20,16,50,.25);font:14px/1.3 system-ui,sans-serif;color:#2c2a3f}
#objectMenu[hidden]{display:none}
#objectMenu .object-menu-title{padding:4px 8px 6px;font-size:12px;font-weight:700;color:#6b6780}
#objectMenu button{min-height:36px;padding:6px 10px;border:0;border-radius:8px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}
#objectMenu button:hover,#objectMenu button:focus-visible{background:#ece7d6;outline:0}

/* Resolve legacy absolute shell sizing without changing controls or scene coordinates. */
body.off-is-ui:not(.login-page)>header{position:relative;inset:auto;height:auto;align-content:flex-start;box-sizing:border-box}
body.off-is-ui:not(.login-page)>#viewport{position:relative;inset:auto;width:100%;height:100%;min-height:0}
body.off-is-ui:not(.login-page)>footer{position:relative;inset:auto;box-sizing:border-box}
@media(max-width:700px){
 body.off-is-ui:not(.login-page)>header{max-height:35dvh;align-content:flex-start}
 body.off-is-ui #gameHud{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;flex:0 0 100%;width:100%;min-width:0}
 body.off-is-ui #gameHud>*{min-width:0;max-width:100%;margin:0;box-sizing:border-box;overflow-wrap:anywhere}
 body.off-is-ui #gameHud button{font-size:11px;padding:8px;white-space:normal}
 body.off-is-ui #gameHud .hud-coins,body.off-is-ui #gameHud .hud-usage{padding:6px;grid-template-columns:1fr}
 body.off-is-ui #gameHud strong{text-align:left}
}

/* A readable bounded message; preserve the real error and hidden state. */
body.off-is-ui #loading{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:max-content;max-width:min(560px,calc(100% - 32px));height:auto;max-height:calc(100% - 32px);min-width:0;white-space:normal;overflow-wrap:anywhere;overflow:auto;line-height:1.45;box-sizing:border-box}
