body {
  margin: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
  font-family: Arial, sans-serif;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Rotate warning for landscape mode */
#rotate-warning {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  color: white;
  text-align: center;
}

.rotate-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: rotate 2s ease-in-out infinite alternate;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(90deg); }
}

#rotate-warning p {
  font-size: 1.2rem;
  margin: 0;
}

/* Show rotate warning only in landscape */
@media (orientation: landscape) and (max-height: 600px) {
  #rotate-warning {
    display: flex !important;
  }
  #unity-container {
    display: none !important;
  }
}

#unity-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
}

#unity-canvas {
  display: block;
  background: #231F20;
  outline: none;
  max-width: 100vw;
  max-height: 100vh;
}

/* Portrait mode optimization */
@media (orientation: portrait) {
  #unity-canvas {
    width: 100vw !important;
    height: 100vh !important;
    object-fit: contain; /* Maintain aspect ratio in portrait */
  }
  
  #unity-container.unity-mobile #unity-canvas.unity-mobile {
    width: 100vw !important;
    height: 100vh !important;
  }
}

/* Desktop portrait simulation */
@media (min-width: 769px) and (min-height: 1000px) {
  #unity-canvas {
    width: 60vh !important;
    height: 100vh !important;
    max-width: 500px;
  }
}

/* Very wide desktop screens - keep game reasonable size */
@media (min-width: 1200px) {
  #unity-canvas {
    width: 60vh !important;
    height: 100vh !important;
    max-width: 500px;
  }
}

/* Loading bar */
#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

#unity-logo {
  width: 154px;
  height: 130px;
  background: url('TemplateData/unity-logo-dark.png') no-repeat center / contain;
}

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

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

/* Warning banner */
#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%, 0);
  background: white;
  border-radius: 5px;
  display: none;
  z-index: 1001;
  max-width: 90vw;
  text-align: center;
}

/* Footer */
#unity-footer {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 5px;
  padding: 5px 10px;
}

#unity-build-title {
  color: white;
  font-size: 14px;
  margin: 0 10px;
}

#unity-fullscreen-button {
  width: 32px;
  height: 32px;
  background: url('TemplateData/fullscreen-button.png') no-repeat center / contain;
  border: none;
  cursor: pointer;
  margin: 0 5px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

#unity-fullscreen-button:hover {
  opacity: 1;
}

/* Hide footer on very small screens */
@media (max-height: 500px), (max-width: 400px) {
  #unity-footer {
    display: none;
  }
}

/* Landscape warning styles */
@media (orientation: landscape) and (max-width: 900px) {
  #rotate-warning {
    display: flex !important;
  }
  #unity-container {
    display: none !important;
  }
}