html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fff;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  touch-action: none;
}

#unity-container {
  position: absolute;
  background: #fff;
}

#unity-container.unity-desktop {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#unity-container.unity-mobile {
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  height: calc(var(--unity-vh, 1vh) * 100);
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#unity-canvas {
  display: block;
  background: #000000;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.unity-mobile #unity-canvas {
  max-width: 100vw;
  max-height: calc(var(--unity-vh, 1vh) * 100);
}

#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 20;
}

#unity-logo {
  width: 300px;
  height: 118px;
  background: url('unity-logo-dark.png') no-repeat center;
  background-size: contain;
}

#unity-progress-bar-empty {
  width: 141px;
  height: 18px;
  margin-top: 10px;
  margin-left: auto;
  margin-right: auto;
  background: url('progress-bar-empty-dark.png') no-repeat center;
}

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

#unity-footer {
  position: relative;
}

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

#unity-webgl-logo {
  float: left;
  width: 123px;
  height: 38px;
  background: url('webgl-logo.png') no-repeat center;
}

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

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

#unity-mobile-warning {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  color: #263238;
  border: 1px solid rgba(0, 0, 0, .08);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  z-index: 30;
  display: none;
  pointer-events: none;
}

#unity-orientation-warning {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, .96);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body.i9-wrong-orientation #unity-orientation-warning {
  display: flex;
}

#unity-orientation-card {
  width: min(420px, calc(100vw - 48px));
  border-radius: 26px;
  padding: 30px 26px 26px;
  text-align: center;
  background: #fff;
  box-shadow: 0 22px 70px rgba(4, 60, 96, .18);
  border: 1px solid rgba(4, 114, 185, .10);
}

#unity-rotate-phone {
  width: 78px;
  height: 118px;
  margin: 0 auto 18px;
  border: 7px solid #0472B9;
  border-radius: 20px;
  position: relative;
  animation: i9RotatePhone 1.7s ease-in-out infinite;
  box-shadow: 0 10px 24px rgba(4, 114, 185, .22);
}

#unity-rotate-phone::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 18px;
  height: 4px;
  border-radius: 5px;
  background: #0472B9;
  transform: translateX(-50%);
}

#unity-rotate-phone-screen {
  position: absolute;
  inset: 13px 9px 20px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(4, 114, 185, .12), rgba(4, 114, 185, .28));
}

#unity-orientation-title {
  color: #063b5f;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
  margin-bottom: 10px;
}

#unity-orientation-description {
  color: #34495e;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 700;
}

@keyframes i9RotatePhone {
  0%, 100% { transform: rotate(0deg) scale(1); }
  45%, 55% { transform: rotate(90deg) scale(1.03); }
}

body.i9-wrong-orientation #unity-canvas {
  opacity: .2;
}

#unity-mobile-start-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(245, 249, 252, .98));
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body.i9-mobile-waiting-start #unity-mobile-start-modal {
  display: flex;
}

#unity-mobile-start-card {
  width: min(420px, calc(100vw - 48px));
  border-radius: 22px;
  padding: 24px 22px 20px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 22px 70px rgba(4, 60, 96, .18);
  text-align: center;
}

#unity-mobile-start-title {
  color: #063b5f;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 800;
  margin-bottom: 10px;
}

#unity-mobile-start-description {
  color: #34495e;
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 18px;
}

#unity-mobile-start-fullscreen,
#unity-mobile-start-windowed {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
}

#unity-mobile-start-fullscreen {
  background: #0472B9;
  color: #fff;
  box-shadow: 0 8px 18px rgba(4, 114, 185, .28);
}

#unity-mobile-start-windowed {
  margin-top: 10px;
  background: transparent;
  color: #0472B9;
}

#i9-virtual-keyboard {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(245, 247, 250, .96);
  box-shadow: 0 -14px 45px rgba(0, 0, 0, .16);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  transform: translateY(115%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform .24s ease, opacity .18s ease, visibility 0s linear .24s;
  will-change: transform, opacity;
}

#i9-virtual-keyboard[aria-hidden='false'] {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform .24s ease, opacity .18s ease;
}

.i9-vkey-panel {
  width: min(1120px, 100%);
}

.i9-vkey-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.i9-vkey-title {
  color: #34495e;
  font-size: 13px;
  font-weight: 800;
}

.i9-vkey-close {
  border: 0;
  border-radius: 10px;
  padding: 8px 14px;
  background: #0472B9;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.i9-vkey-preview {
  min-height: 38px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.16);
  background: #fff;
  color: #263238;
  font-size: 18px;
  line-height: 22px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.i9-vkey-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.i9-vkey-key {
  min-width: 54px;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: #222;
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(0,0,0,.10), 0 5px 14px rgba(0,0,0,.08);
  transition: transform .08s ease, filter .08s ease;
}

.i9-vkey-key:active {
  transform: translateY(2px) scale(.96);
  filter: brightness(.96);
}

.i9-vkey-action {
  min-width: 72px;
  background: #d6dbe1;
  font-size: 18px;
  font-weight: 800;
}

.i9-vkey-active {
  background: #0472B9;
  color: #fff;
}

.i9-vkey-space {
  flex: 1 1 300px;
  max-width: 420px;
  font-size: 16px;
}

.i9-vkey-wide {
  min-width: 86px;
  font-size: 18px;
}

body.i9-virtual-keyboard-open #unity-canvas {
  transform: translateY(-8px);
}

canvas, #gameContainer {
  height: 300px;
  width: 533px;
}

@media only screen and (min-width: 1024px) {
  canvas, #gameContainer {
    height: 480px;
    width: 853px;
  }
}

@media only screen and (min-width: 1440px) {
  canvas, #gameContainer {
    height: 720px;
    width: 1280px;
  }
}

@media only screen and (max-width: 1023px), (pointer: coarse) {
  canvas, #gameContainer {
    width: 100%;
    height: 100%;
  }

  #unity-logo {
    width: min(300px, 70vw);
  }

  .i9-vkey-key {
    min-width: 38px;
    height: 42px;
    font-size: 18px;
    border-radius: 9px;
  }

  .i9-vkey-action {
    min-width: 54px;
    font-size: 16px;
  }

  .i9-vkey-row {
    gap: 5px;
    margin-bottom: 6px;
  }
}


#unity-mobile-fullscreen-toggle {
  display: none;
}

.unity-mobile #unity-mobile-fullscreen-toggle {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  z-index: 75;
  display: block;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background-color: rgba(255, 255, 255, .88);
  background-repeat: no-repeat;
  background-image:
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor),
    linear-gradient(currentColor, currentColor);
  background-size:
    7px 2px,
    2px 7px,
    7px 2px,
    2px 7px,
    7px 2px,
    2px 7px,
    7px 2px,
    2px 7px;
  background-position:
    left 10px top 10px,
    left 10px top 10px,
    right 10px top 10px,
    right 10px top 10px,
    left 10px bottom 10px,
    left 10px bottom 10px,
    right 10px bottom 10px,
    right 10px bottom 10px;
  color: #063b5f;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
  -webkit-tap-highlight-color: transparent;
}

.unity-mobile #unity-mobile-fullscreen-toggle::before,
.unity-mobile #unity-mobile-fullscreen-toggle::after {
  content: none;
}

.unity-mobile #unity-mobile-fullscreen-toggle.i9-is-fullscreen {
  background-position:
    left 11px top 17px,
    left 17px top 11px,
    right 11px top 17px,
    right 17px top 11px,
    left 11px bottom 17px,
    left 17px bottom 11px,
    right 11px bottom 17px,
    right 17px bottom 11px;
}

body.i9-mobile-waiting-start #unity-mobile-fullscreen-toggle,
body.i9-wrong-orientation #unity-mobile-fullscreen-toggle,
body.i9-fullscreen-return-visible #unity-mobile-fullscreen-toggle {
  display: none;
}

#i9-mobile-debug-log[aria-hidden='true'] {
  display: none;
}

#i9-mobile-debug-log[aria-hidden='false'] {
  position: fixed;
  left: 8px;
  top: 8px;
  width: min(420px, calc(100vw - 16px));
  max-height: 34vh;
  z-index: 120;
  display: block;
  border-radius: 12px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(4,114,185,.22);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#i9-mobile-debug-title {
  padding: 6px 8px;
  background: #0472B9;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

#i9-mobile-debug-content {
  margin: 0;
  padding: 7px 8px;
  max-height: calc(34vh - 28px);
  overflow: auto;
  color: #263238;
  font-size: 10px;
  line-height: 1.35;
  white-space: pre-wrap;
}

/* I9 mobile fullscreen return prompt */
#unity-fullscreen-return-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

body.i9-fullscreen-return-visible #unity-fullscreen-return-overlay {
  display: flex;
}

#unity-fullscreen-return-card {
  width: min(380px, calc(100vw - 44px));
  border-radius: 24px;
  padding: 22px 20px 18px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(4, 60, 96, .20);
  text-align: center;
  border: 1px solid rgba(4, 114, 185, .12);
}

#unity-fullscreen-return-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 114, 185, .10);
  color: #0472B9;
  font-size: 31px;
  font-weight: 900;
}

#unity-fullscreen-return-title {
  color: #063b5f;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 900;
  margin-bottom: 8px;
}

#unity-fullscreen-return-description {
  color: #34495e;
  font-size: 15px;
  line-height: 1.35;
  margin-bottom: 14px;
}

#unity-fullscreen-return-button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: #0472B9;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(4, 114, 185, .28);
}

/* I9 virtual keyboard improvements */
.i9-vkey-top {
  gap: 10px;
}

.i9-vkey-title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  color: #063b5f;
}

.i9-vkey-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.i9-vkey-top-button {
  border: 0;
  border-radius: 12px;
  padding: 8px 12px;
  background: #e8edf2;
  color: #263238;
  font-size: 13px;
  font-weight: 900;
}

.i9-vkey-top-button-active {
  background: #0472B9;
  color: #fff;
}

.i9-vkey-close {
  background: #0472B9;
  color: #fff;
}

.i9-vkey-preview {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 0;
  font-weight: 600;
}

.i9-vkey-preview-text {
  white-space: pre;
}

.i9-vkey-preview-selected {
  white-space: pre;
  background: rgba(4, 114, 185, .18);
  color: #063b5f;
  border-radius: 4px;
}

.i9-vkey-caret {
  width: 2px;
  height: 24px;
  margin: 0 1px;
  border-radius: 2px;
  background: #0472B9;
  animation: i9CaretBlink 1s steps(1) infinite;
  flex: 0 0 auto;
}

@keyframes i9CaretBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.i9-vkey-key-pop {
  animation: i9KeyPop .12s ease-out;
}

@keyframes i9KeyPop {
  0% { transform: translateY(0) scale(1); }
  55% { transform: translateY(2px) scale(.94); }
  100% { transform: translateY(0) scale(1); }
}

.i9-vkey-space {
  font-size: 15px;
  font-weight: 900;
}

#i9-virtual-keyboard.i9-vkey-transparent[aria-hidden='false'] {
  background: rgba(245, 247, 250, .24);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, .08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#i9-virtual-keyboard.i9-vkey-transparent .i9-vkey-panel {
  opacity: .34;
  transition: opacity .12s ease;
}

#i9-virtual-keyboard.i9-vkey-transparent .i9-vkey-panel:active,
#i9-virtual-keyboard.i9-vkey-transparent .i9-vkey-panel:hover {
  opacity: .58;
}

@media only screen and (orientation: landscape) and (max-height: 520px) {
  #i9-virtual-keyboard[aria-hidden='false'] {
    padding-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .i9-vkey-preview {
    min-height: 32px;
    margin-bottom: 5px;
    font-size: 15px;
    line-height: 18px;
    padding: 5px 10px;
  }

  .i9-vkey-caret {
    height: 19px;
  }

  .i9-vkey-key {
    min-width: 40px;
    height: 36px;
    font-size: 17px;
  }

  .i9-vkey-action {
    min-width: 50px;
    font-size: 14px;
  }

  .i9-vkey-row {
    gap: 5px;
    margin-bottom: 5px;
  }

  .i9-vkey-top {
    margin-bottom: 4px;
  }

  .i9-vkey-title,
  .i9-vkey-top-button {
    font-size: 12px;
  }

  .i9-vkey-top-button {
    padding: 7px 10px;
  }
}


/* I9 virtual keyboard selection/caret touch support */
.i9-vkey-preview {
  cursor: text;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.i9-vkey-preview-char {
  display: inline-block;
  min-width: .34em;
  white-space: pre;
}

.i9-vkey-preview-placeholder {
  color: rgba(38, 50, 56, .45);
  font-weight: 600;
  margin-left: 2px;
}

.i9-vkey-preview-selected {
  display: inline-block;
  min-width: .34em;
  padding: 0 1px;
  margin: 0 -1px;
  background: rgba(4, 114, 185, .24);
  color: #063b5f;
  border-radius: 4px;
}
