:root {
  color-scheme: dark;
  --game-width-per-height: .5625;
  --game-height-per-width: 1.7777778;
}
* { box-sizing: border-box; }

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

body {
  font-family: Arial, "Helvetica Neue", sans-serif;
  background: radial-gradient(circle at 50% 22%, rgba(86, 38, 157, .3), transparent 42%), #08001d;
}

/* Keep the browser build at a phone-like 9:16 portrait ratio. */
#game-shell {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(100vw, calc(100vh * var(--game-width-per-height)));
  height: min(100vh, calc(100vw * var(--game-height-per-width)));
  aspect-ratio: 9 / 16;
  overflow: hidden;
  transform: translate(-50%, -50%);
  background: #08001d;
  box-shadow: 0 0 48px rgba(0, 0, 0, .45);
}

#unity-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: #08001d;
  outline: 0;
}

#loading-screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #090022 0%, #241061 38%, #65138d 68%, #17043f 100%);
  opacity: 1;
  transition: opacity .5s ease;
}

.glow {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .42;
  animation: drift 7s ease-in-out infinite alternate;
  pointer-events: none;
}

.glow-one { left: -38vmax; top: -38vmax; background: #334dff; }
.glow-two { right: -42vmax; bottom: -46vmax; background: #ff168f; animation-delay: -3.5s; }

#game-logo {
  position: relative;
  width: clamp(170px, 28vmin, 300px);
  height: clamp(170px, 28vmin, 300px);
  object-fit: cover;
  border-radius: 22%;
  box-shadow: 0 24px 65px rgba(5, 0, 25, .48), 0 0 42px rgba(201, 74, 255, .32);
  animation: logo-float 2.6s ease-in-out infinite;
}

#progress-track {
  position: relative;
  width: min(68vw, 390px);
  height: 16px;
  margin-top: 34px;
  padding: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .54);
  border-radius: 999px;
  background: rgba(5, 0, 24, .42);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
}

#progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff5abd 0%, #a65cff 40%, #48d9ff 100%);
  box-shadow: 0 0 18px rgba(145, 93, 255, .85);
  transition: width .18s ease;
}

#loading-percent {
  position: relative;
  margin-top: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .9);
}

#loading-screen.loaded { opacity: 0; pointer-events: none; }

#unity-warning {
  position: absolute;
  top: 4%;
  left: 50%;
  z-index: 4;
  display: none;
  width: min(90%, 720px);
  transform: translateX(-50%);
  font-size: 14px;
  text-align: center;
}

.warning, .error {
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #ffe66d;
  color: #2c2340;
}

.error { background: #e44767; color: #fff; }

@keyframes logo-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.015); }
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(.9); }
  to { transform: translate3d(12vmax, 8vmax, 0) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
  .glow, #game-logo { animation: none; }
  #loading-screen { transition: none; }
}

@media (max-width: 767px), (pointer: coarse) {
  #game-logo {
    width: clamp(150px, 42vw, 230px);
    height: clamp(150px, 42vw, 230px);
  }

  #progress-track {
    width: min(72vw, 340px);
    margin-top: 28px;
  }
}
