html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #001326;
}

body {
  width: 100dvw;
  height: 100dvh;
}

.referee-viewport {
  width: 100dvw !important;
  height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding-top: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  overflow: hidden !important;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  background: #001326;
}

.referee-stage {
  flex: none;
}

.rotate-device {
  display: none;
}

@media (orientation: portrait) {
  /* Referee mode is always landscape: in portrait the whole 1850 x 850
     stage is turned 90 degrees and fitted to the screen (fitCanvas swaps
     the axes), so a phone or tablet held upright still shows the
     landscape referee surface. Touch hit-testing follows the transform. */
  .referee-stage {
    display: block !important;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
  }

  .rotate-device {
    display: none !important;
  }
}

@media (orientation: landscape) {
  .referee-stage {
    display: block;
  }

  .rotate-device {
    display: none !important;
  }
}
