/* The same console works in the world, dialogs and battle. */
.battle-screen {
  display: contents;
}
.mobile-game dialog.console-dialog:not(#battle-dialog) {
  bottom: calc(164px + env(safe-area-inset-bottom));
  max-height: calc(100dvh - 190px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.mobile-game dialog.console-dialog > .touch-controls {
  position: fixed;
  inset: auto env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  height: 158px;
  box-sizing: border-box;
  background: #d9dcd5;
}
.mobile-game #battle-dialog.console-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  padding: calc(6px + env(safe-area-inset-top)) calc(5px + env(safe-area-inset-right))
    calc(158px + env(safe-area-inset-bottom)) calc(5px + env(safe-area-inset-left));
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #d9dcd5;
  container-type: normal;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.mobile-game #battle-dialog .battle-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: auto;
  container-type: inline-size;
  border: 3px solid #41434c;
  border-radius: 5px;
  background: #303443;
  box-shadow: 0 3px 0 #20252c;
}
/* Battle typography must not resize the physical controls. */
.mobile-game #battle-dialog .touch-controls button {
  font:
    27px 'Comarca Pixel',
    monospace;
  text-shadow: none;
  touch-action: none;
}
.mobile-game #battle-dialog .touch-actions button {
  color: #fff4dd;
}
.mobile-game #battle-dialog .dpad button {
  color: #d9dedc;
}
@media (orientation: landscape) {
  .mobile-game #team-dialog .party-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .mobile-game dialog.console-dialog:not(#battle-dialog) {
    bottom: 0;
    width: calc(100% - 300px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .mobile-game dialog.console-dialog > .touch-controls {
    display: contents;
  }
  .mobile-game dialog.console-dialog > .touch-controls .dpad {
    position: fixed;
    left: calc(6px + env(safe-area-inset-left));
    top: calc(50% - 66px);
  }
  .mobile-game dialog.console-dialog > .touch-controls .touch-actions {
    position: fixed;
    right: calc(6px + env(safe-area-inset-right));
    top: calc(50% - 42px);
  }
  .mobile-game #battle-dialog.console-dialog {
    padding: calc(6px + env(safe-area-inset-top)) calc(142px + env(safe-area-inset-right))
      calc(6px + env(safe-area-inset-bottom)) calc(144px + env(safe-area-inset-left));
  }
  .mobile-game #battle-dialog .battle-screen {
    max-width: 680px;
  }
}
