:root {
  color-scheme: dark;
  --page-background: #080614;
  --panel-background: #130d25;
  --neon-pink: #ff41d5;
  --neon-blue: #65cfff;
  --neon-white: #fff8ff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at 50% 35%, #34234f 0%, var(--page-background) 72%);
  overflow: hidden;
  font-family: "Helvetica Neue", Arial, sans-serif;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

#unity-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#unity-container {
  position: relative;
  width: min(100vw, calc(100vh * 0.5625));
  width: min(100vw, calc(100dvh * 0.5625));
  height: min(100vh, calc(100vw * 1.7777778));
  height: min(100dvh, calc(100vw * 1.7777778));
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  background: var(--panel-background);
  box-shadow: 0 0 70px rgba(84, 48, 133, 0.3);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--panel-background);
  outline: none;
}

#unity-loading-bar {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px;
  color: var(--neon-white);
  background:
    radial-gradient(circle at 18% 24%, rgba(86, 225, 255, 0.30), transparent 48%),
    radial-gradient(circle at 82% 28%, rgba(255, 74, 206, 0.32), transparent 50%),
    radial-gradient(circle at 50% 88%, rgba(255, 218, 100, 0.18), transparent 58%),
    linear-gradient(160deg, #736f9e 0%, #b879a4 48%, #8aaea5 100%);
  opacity: 1;
  transition: opacity 0.4s ease;
}

#unity-loading-bar.is-hidden {
  pointer-events: none;
  opacity: 0;
}

#thunderspread-logo {
  width: min(82%, 720px);
  height: auto;
  filter:
    drop-shadow(0 0 8px rgba(255, 65, 213, 0.95))
    drop-shadow(0 0 22px rgba(101, 207, 255, 0.72))
    drop-shadow(0 0 48px rgba(255, 65, 213, 0.42));
}

#loading-subtitle {
  margin-top: 8px;
  color: rgba(255, 248, 255, 0.76);
  font-size: clamp(9px, 2.2vw, 12px);
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

#unity-progress-bar-empty {
  width: min(280px, 72%);
  height: 3px;
  margin-top: 42px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

#unity-progress-bar-full {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--neon-pink), var(--neon-blue));
  box-shadow: 0 0 14px rgba(255, 65, 213, 0.72), 0 0 24px rgba(101, 207, 255, 0.45);
  transition: width 0.12s linear;
}

#loading-percent {
  margin-top: 12px;
  color: rgba(255, 248, 255, 0.72);
  font-size: 11px;
  letter-spacing: 0.12em;
}

#mooom-back {
  position: fixed;
  z-index: 30;
  top: calc(12px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  color: rgba(255, 248, 255, 0.82);
  border: 1px solid rgba(205, 172, 255, 0.42);
  border-radius: 999px;
  background: rgba(8, 5, 15, 0.62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.16em;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

#mooom-back:hover,
#mooom-back:focus-visible {
  color: var(--neon-white);
  border-color: rgba(255, 248, 255, 0.72);
  background: rgba(19, 11, 32, 0.84);
  outline: none;
}

#unity-warning {
  position: absolute;
  z-index: 40;
  top: 12%;
  left: 50%;
  display: none;
  width: min(88%, 460px);
  transform: translateX(-50%);
}

#unity-warning > div {
  margin-bottom: 8px;
  padding: 10px 12px;
  color: #fff;
  border-radius: 8px;
  background: rgba(122, 86, 16, 0.94);
  font-size: 13px;
}

#unity-warning > .error { background: rgba(128, 24, 39, 0.96); }

@media (max-width: 600px) {
  #unity-container {
    box-shadow: none;
  }

  #mooom-back {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 10px;
  }
}
