:root {
  --app-max-width: min(calc(100vw - 40px), calc(100dvh * 16 / 9));
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--ui-text);
  background-color: var(--bg);
  font-family: "Roboto", system-ui, sans-serif;
  font-size: var(--fontSize);
}

body {
  touch-action: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  width: min(100vw, var(--app-max-width));
  height: min(100dvh, calc((100vw - 40px) * 9 / 16));
  max-height: 100dvh;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--bg);
  position: relative;
}

#pixi-container {
  width: 100%;
  height: 100%;
}

#pixi-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-root {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

@media (max-width: 768px), (pointer: coarse) {
  :root {
    --app-max-width: 100vw;
  }

  #app {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    aspect-ratio: 16 / 9;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  html,
  body {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
  }

  #app {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
  }
}
