html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #231F20;
}

/* itch.io の iframe / fullscreen 全体を Unity の表示領域として使う */
#unity-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;

  /* Unityロード中の背景 */
  background:
    #231F20
    url('Loading.png')
    center center / cover
    no-repeat;
}

/* Desktop: 16:9 を維持しながら利用可能領域いっぱいまで拡大 */
#unity-container.unity-desktop {
  left: 0;
  top: 0;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile 側でも画面内へ収める */
#unity-container.unity-mobile {
  left: 0;
  top: 0;
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/*
  16:9 を維持。
  1280x720 の通常埋め込みでは全面表示。
  16:10 / ultrawide などでは上下または左右にレターボックスを出す。
*/
#unity-canvas {
  display: block;
  width: min(100vw, calc(100vh * 16 / 9)) !important;
  height: min(100vh, calc(100vw * 9 / 16)) !important;
  background: #231F20;
}

.unity-mobile #unity-canvas {
  width: min(100vw, calc(100vh * 16 / 9)) !important;
  height: min(100vh, calc(100vw * 9 / 16)) !important;
}

/* Unity のロード表示 */
#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 10;
  width: min(42vw, 320px);
  text-align: center;
}

/* Unity標準ロゴの代わりにYuruPuzロゴを表示 */
#unity-logo {
  width: min(24vw, 220px);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto 18px auto;
  background:
    url('YuruPuzStudio_Logo_white.png')
    center center / contain
    no-repeat;
}

/* プログレスバーはUnity標準画像をそのまま使用 */
#unity-progress-bar-empty {
  width: 141px;
  height: 18px;
  margin: 0 auto;
  background: url('progress-bar-empty-dark.png') no-repeat center;
}

#unity-progress-bar-full {
  width: 0%;
  height: 18px;
  margin: 0;
  background: url('progress-bar-full-dark.png') no-repeat left center;
}

/* itch.io 側の fullscreen ボタンを使うので Unity 標準 footer は非表示 */
#unity-footer {
  display: none !important;
}

.unity-mobile #unity-footer {
  display: none !important;
}

/* Unity Default Template の要素。footer 非表示時は通常見えないが定義は残す */
#unity-logo-title-footer {
  float: left;
  width: 102px;
  height: 38px;
  background: url('unity-logo-title-footer.png') no-repeat center;
}

#unity-build-title {
  float: right;
  margin-right: 10px;
  line-height: 38px;
  font-family: arial;
  font-size: 18px;
}

#unity-fullscreen-button {
  cursor: pointer;
  float: right;
  width: 38px;
  height: 38px;
  background: url('fullscreen-button.png') no-repeat center;
}

/* Unity の warning / error バナー */
#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translateX(-50%);
  max-width: min(90vw, 900px);
  box-sizing: border-box;
  background: white;
  padding: 10px;
  display: none;
  z-index: 20;
}
