/* Reset & fullscreen shell */
* {
  box-sizing: border-box;
}

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

#unity-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #141218;
  outline: none;
}

/* Preloader overlay */
#app-preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.55s ease, visibility 0.55s ease;
  visibility: visible;
}

#app-preloader.preloader-exit {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(88, 28, 135, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 100% 60% at 80% 100%, rgba(30, 58, 138, 0.25) 0%, transparent 50%),
    linear-gradient(165deg, #0c0b0e 0%, #141218 45%, #0a090c 100%);
}

.preloader-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.preloader-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  max-width: 22rem;
  width: 100%;
}

.preloader-title {
  margin: 0 0 2rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(120deg, #f4f4f5 0%, #a8a29e 40%, #f4f4f5 80%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: preloader-shimmer 2.5s ease-in-out infinite;
}

@keyframes preloader-shimmer {
  0%,
  100% {
    background-position: 100% center;
  }
  50% {
    background-position: 0% center;
  }
}

.preloader-progress-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.preloader-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #a78bfa, #c4b5fd);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.45);
  transition: width 0.12s ease-out;
}

.preloader-status {
  margin: 1rem 0 0;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.8rem;
  color: rgba(228, 228, 231, 0.55);
  letter-spacing: 0.04em;
}

.preloader-orbit {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.5rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(167, 139, 250, 0.9);
  border-radius: 50%;
  animation: preloader-spin 0.9s linear infinite;
}

@keyframes preloader-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Unity warning banner (errors / warnings from engine) */
#unity-warning {
  position: fixed;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  z-index: 1100;
  max-width: min(90vw, 42rem);
  background: rgba(24, 24, 27, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  display: none;
  font-family: system-ui, sans-serif;
  font-size: 0.875rem;
  color: #fafafa;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}
