/* V1.4.3: the toolbar is INSIDE .room-main. Before this fix, .room-main
 * subtracted the toolbar height from 100dvh and .battle then took 100% of
 * that shortened container. The toolbar consumed its height once more,
 * clipping ~56px off the bottom and exposing the page background.
 * Make the stage a column with exactly one toolbar-height deduction.
 * This stylesheet is last in the cascade and ONLY affects formal mode. */
.legion-game.mode-formal {
  --terra-toolbar-height: 56px;
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.legion-game.mode-formal .room-main {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: 100% !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}
.legion-game.mode-formal .room-main > .formal-toolbar {
  flex: 0 0 var(--terra-toolbar-height) !important;
  height: var(--terra-toolbar-height) !important;
  min-height: var(--terra-toolbar-height) !important;
  max-height: var(--terra-toolbar-height) !important;
  margin: 0 !important;
}
.legion-game.mode-formal .room-main > .battle {
  flex: 1 1 0% !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
}
/* Browser fullscreen is applied to body; match its own viewport exactly.
 * Do not introduce a second 100%-minus-toolbar calculation here. */
.legion-game.mode-formal:is(:fullscreen,.terra-root-fullscreen) {
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
}
.legion-game.mode-formal:is(:fullscreen,.terra-root-fullscreen) .room-main { height: 100% !important; }
/* The small top seam in fullscreen came from the toolbar's broad downward
 * shadow; use a one-pixel divider rather than a large dark blur. */
.legion-game.mode-formal .formal-toolbar {
  box-shadow: none !important;
  border-bottom: 1px solid #53696b5c !important;
}
@media (max-width:850px) {
  .legion-game.mode-formal { --terra-toolbar-height: 79px; }
}
