/* Desktop: fit the same 1840px-wide game surface to the available browser viewport. */
html.desktop-fit{overflow-x:hidden;overflow-y:auto}
html.desktop-fit body{min-height:100dvh;height:auto;display:flex;flex-direction:column;align-items:stretch}
html.desktop-fit body>header{zoom:var(--game-scale,1);width:auto;max-width:none;margin:0;flex:none;align-self:stretch}
html.desktop-fit main.integrated-main{zoom:var(--game-scale,1);width:1840px;max-width:none;min-width:1840px;flex:0 0 auto;margin:0 auto;padding:8px 12px;box-sizing:border-box}
html.desktop-fit .integrated-main .integrated-arena{width:100%;max-width:none}
html.desktop-fit .integrated-arena .stage-row{display:grid;grid-template-columns:minmax(195px,16%) minmax(0,1fr);gap:8px}
html.desktop-fit .integrated-arena .stage-rail{max-height:700px;min-height:0;overflow:hidden}
html.desktop-fit .integrated-arena .stage-row .board{width:100%;max-width:none}
html.desktop-fit .integrated-arena .battle-toolbar{flex-wrap:nowrap}
#settingsDialog #audioTest{margin-top:8px;min-height:35px;width:100%;font-size:12px;background:#26394a;border:1px solid #52677f;box-shadow:none}
#settingsDialog #settingsMessage{font-size:12px;line-height:1.5;color:#c5d2e2;overflow-wrap:anywhere}
#settingsDialog #settingsMessage:empty{display:none}

/* Stable combat geometry. Dynamic HUD content occupies one reserved row on desktop. */
.stage-status-row{display:contents}
html.desktop-fit{scrollbar-gutter:stable;overflow-anchor:none}
html.desktop-fit .stage-status-row{display:flex;align-items:center;gap:6px;height:52px;min-height:52px;max-height:52px;overflow:hidden;flex:none;box-sizing:border-box}
html.desktop-fit .stage-status-row>#bossTimer{flex:0 0 auto;min-width:100px;margin:0;white-space:nowrap}
html.desktop-fit .stage-status-row>#challengePanel{flex:0 1 470px;min-width:0;max-height:50px;margin:0;overflow:auto;box-sizing:border-box}
html.desktop-fit .stage-status-row>#stageEventBar,html.desktop-fit .stage-status-row>#rookieGuide{flex:1 1 0;min-width:0;max-height:50px;overflow:auto;box-sizing:border-box;margin:0}
html.desktop-fit .stage-status-row>#practicePanel{flex:1 1 auto;min-width:0;max-height:50px;overflow:auto;margin:0}
html.desktop-fit .integrated-arena .stage-forecast{height:20px;min-height:20px;box-sizing:border-box;white-space:nowrap}
html.desktop-fit .integrated-arena .ultimate-strip{height:36px;min-height:36px;max-height:36px;box-sizing:border-box;overflow-x:auto;overflow-y:hidden;flex-wrap:nowrap}
html.desktop-fit .integrated-arena .ultimate-strip:has(#ultimateBar:empty){display:flex;visibility:hidden}
html.desktop-fit .integrated-arena #ultimateBar{display:flex;flex-wrap:nowrap;min-width:0;overflow-x:auto;overflow-y:hidden}
html.desktop-fit .integrated-arena #ultimateBar>*{flex-shrink:0}

/* Preserve the original child order when the wrapper is flattened on touch/narrow layouts. */
.stage-status-row>*{order:0!important;min-width:0;flex-shrink:0}
