/* EASY BACKGROUND COLOR CUSTOMIZATION - Change this variable */
:root {
  --loading-bg-color: #4b7923; /* Main background color */
  --loading-accent-color: #f6d234; /* Progress bar and accent color */
  --loading-secondary-color: #628e12; /* Secondary gradient color */
  --loading-tertiary-color: #7aa200; /* Tertiary gradient color */
  --game-width: 1280px; /*Full size of width*/
  --game-height: 720px; /*Full size of height*/
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  background: var(--loading-bg-color);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#unity-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--game-width);
  height: var(--game-height);
  max-width: 100vw;
  max-height: 100vh;
  background: #1a1a2e;
}

/* For devices smaller than game dimensions, scale proportionally */
@media (max-width: 1280px), (max-height: 720px) {
  #unity-container {
    width: 100vw;
    height: calc(100vw * 0.5625); /* 16:9 aspect ratio */
  }

  /* If height is still too much, scale by height instead */
  @media (max-height: 56.25vw) {
    #unity-container {
      width: calc(100vh * 1.7778); /* 16:9 aspect ratio */
      height: 100vh;
    }
  }
}

#unity-canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  background: var(--loading-bg-color) !important;
  background-image: none !important;
}

/* Enhanced Loading screen styles */
#loading-cover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--loading-bg-color) 0%,
    var(--loading-secondary-color) 50%,
    var(--loading-tertiary-color) 100%
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

#loading-cover.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Hide Unity's default loading elements */
#unity-loading-bar {
  display: none !important;
}

/* Logo container with proper positioning */
#custom-logo {
  margin-bottom: 50px;
  text-align: center;
  animation: logoFloat 3s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

#custom-logo img {
  max-width: 200px;
  height: auto;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  border-radius: 15px;
}
/* Floating animation for logo */
@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Enhanced Progress bar container */
#custom-progress-bar-empty {
  width: 350px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  overflow: hidden;
  margin: 30px auto;
  border: 3px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(76, 175, 80, 0.1);
  position: relative;
  backdrop-filter: blur(10px);
  display: none; /* Initially hidden */
}

#custom-progress-bar-full {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--loading-accent-color) 0%,
    #66bb6a 50%,
    var(--loading-accent-color) 100%
  );
  width: 0%;
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border-radius: 17px;
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

/* Animated shine effect on progress bar */
#custom-progress-bar-full::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  animation: shine 2s infinite;
}

@keyframes shine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

/* Enhanced Loading text */
.loading-text {
  color: white;
  font-size: 22px;
  margin-top: 25px;
  text-align: center;
  font-weight: 300;
  letter-spacing: 2px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

/* Improved Spinner animation */
.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid var(--loading-accent-color);
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  margin-top: 40px;
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Progress percentage display */
.progress-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  letter-spacing: 1px;
}

/* Fullscreen and Exit buttons styling */
.fullscreen-controls {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1001;
}

.fullscreen-btn {
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  color: white;
  font-size: 18px;
  user-select: none;
}

.fullscreen-btn:active {
  transform: scale(0.95);
}

/* Hide buttons on Android */
.android .fullscreen-controls {
  display: none !important;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  #custom-logo img {
    max-width: 150px;
  }

  #custom-progress-bar-empty {
    width: 280px;
    height: 25px;
    margin: 25px auto;
  }

  .loading-text {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .spinner {
    width: 50px;
    height: 50px;
    margin-top: 30px;
  }
}

@media (max-width: 480px) {
  #custom-logo img {
    max-width: 120px;
  }

  #custom-progress-bar-empty {
    width: 250px;
    height: 22px;
  }

  .loading-text {
    font-size: 16px;
  }
}

/* Force landscape orientation message for mobile fullscreen */
.orientation-message {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  color: white;
  text-align: center;
  padding: 20px;
}

.orientation-message.show {
  display: flex;
}

.rotate-icon {
  font-size: 60px;
  margin-bottom: 20px;
  animation: rotateIcon 2s ease-in-out infinite;
}

@keyframes rotateIcon {
  0%,
  100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(90deg);
  }
}

/*Comienza la separacion
--
--
*/
/* Mobile specific styles */
.unity-mobile #unity-canvas {
  width: 100vw !important;
  height: 100vh !important;
  height: 100svh !important;
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
  #unity-container {
    height: -webkit-fill-available;
  }

  .unity-mobile #unity-canvas {
    height: -webkit-fill-available !important;
  }
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  #custom-logo img {
    max-width: 150px;
  }

  #custom-progress-bar-empty {
    width: 280px;
    height: 25px;
    margin: 25px auto;
  }

  .loading-text {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .spinner {
    width: 50px;
    height: 50px;
    margin-top: 30px;
  }
}

@media (max-width: 480px) {
  #custom-logo img {
    max-width: 120px;
  }

  #custom-progress-bar-empty {
    width: 250px;
    height: 22px;
  }

  .loading-text {
    font-size: 16px;
  }
}

/* Fullscreen button styling */
#unity-fullscreen-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

#unity-fullscreen-button:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

#unity-fullscreen-button::before {
  content: "⛶";
  color: white;
  font-size: 20px;
}
