* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

html,
body {
  width: 100%;
  height: 100vh;
  height: 100dvh !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #050508;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#unity-container {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #050508;
  touch-action: none;
}

#unity-canvas {
  width: 100%;
  height: 100vh;
  height: 100dvh !important;
  display: block;
  background-color: #050508;
  outline: none;
  touch-action: none;
}

/* Botón nativo discreto de Pantalla Completa (esquina superior izquierda) */
#fullscreen-btn {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: rgba(10, 12, 22, 0.68);
  color: #f4f6fa;
  border: 1.5px solid rgba(28, 232, 255, 0.72);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 10px rgba(28, 232, 255, 0.18);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
}

#fullscreen-btn:hover {
  background: rgba(18, 24, 42, 0.88);
  border-color: #1ce8ff;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(28, 232, 255, 0.35);
}

#fullscreen-btn.is-fullscreen {
  border-color: rgba(255, 118, 96, 0.80);
  box-shadow: 0 0 10px rgba(255, 118, 96, 0.22);
}

#fullscreen-btn.is-fullscreen:hover {
  border-color: #ff7660;
}

/* Pantalla de carga personalizada retro / neón */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #140924 0%, #050508 72%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  z-index: 9000;
  opacity: 1;
  transition: opacity 0.42s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-logo {
  display: block;
  max-width: min(70vw, 460px);
  max-height: 32vh;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-bottom: 4px;
  pointer-events: none;
  filter:
    drop-shadow(0 0 14px rgba(28, 232, 255, 0.34))
    drop-shadow(0 0 28px rgba(255, 46, 136, 0.24))
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.65));
}

.loader-bar-track {
  width: min(68%, 380px);
  height: 12px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(28, 232, 255, 0.70);
  border-radius: 999px;
  overflow: hidden;
  box-shadow:
    0 0 14px rgba(28, 232, 255, 0.26),
    inset 0 0 6px rgba(0, 0, 0, 0.85);
}

#loading-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ff2e88 0%, #ffb732 52%, #1ce8ff 100%);
  box-shadow: 0 0 14px rgba(28, 232, 255, 0.72);
  transition: width 0.14s ease-out;
}

#loading-percent {
  color: #1ce8ff;
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 0 0 8px rgba(28, 232, 255, 0.45);
}

.loader-hint {
  color: rgba(245, 237, 228, 0.78);
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
  max-width: 520px;
}

/* Aviso automático de orientación horizontal (solo móviles en portrait) */
#rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background-color: #050508;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px;
  text-align: center;
}

.rotate-phone-icon {
  width: 76px;
  height: 76px;
  color: #1ce8ff;
  filter: drop-shadow(0 0 12px rgba(28, 232, 255, 0.55));
  animation: rotatePhoneAnim 2.2s ease-in-out infinite;
}

.rotate-message {
  color: #ffe066;
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 46, 136, 0.55);
}

@keyframes rotatePhoneAnim {
  0%, 18% {
    transform: rotate(0deg);
  }
  45%, 72% {
    transform: rotate(-90deg);
  }
  92%, 100% {
    transform: rotate(0deg);
  }
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-overlay {
    display: flex;
  }
}
