*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:       #003BFF;
  --blue-dark:  #0028b3;
  --blue-light: #4d79ff;
  --white:      #ffffff;
  --muted:      rgba(255,255,255,0.4);
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #000d40;
}

/* ── Loading screen ── */
#loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%,   rgba(0,59,255,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0,59,255,0.10) 0%, transparent 60%),
    linear-gradient(160deg, #000d40 0%, #001166 50%, #000a30 100%);
  z-index: 100;
  transition: opacity 0.7s ease;
}

/* subtle grid overlay */
#loading-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,59,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,59,255,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* left accent strip */
#loading-screen::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, transparent 0%, var(--blue) 40%, var(--blue-dark) 60%, transparent 100%);
}

/* ── Glass card ── */
#loader-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(0,59,255,0.25);
  border-radius: 24px;
  padding: 52px 64px 48px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow:
    0 0 0 1px rgba(0,59,255,0.1),
    0 32px 80px rgba(0,0,0,0.5),
    inset 0 0 60px rgba(0,59,255,0.04);
  min-width: 420px;
  max-width: 480px;
  width: 90vw;
}

/* corner accents */
#loader-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px;
  width: 60px; height: 60px;
  border-top: 2px solid var(--blue);
  border-left: 2px solid var(--blue);
  border-radius: 24px 0 0 0;
  opacity: 0.8;
}
#loader-card::after {
  content: '';
  position: absolute;
  bottom: -1px; right: -1px;
  width: 60px; height: 60px;
  border-bottom: 2px solid var(--blue);
  border-right: 2px solid var(--blue);
  border-radius: 0 0 24px 0;
  opacity: 0.4;
}

/* ── Logo ── */
#logo-wrap {
  position: relative;
  width: 96px; height: 96px;
}
#logo-wrap::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 30px;
  background: radial-gradient(circle, rgba(0,59,255,0.2) 0%, transparent 70%);
}
#app-logo {
  width: 96px; height: 96px;
  object-fit: contain;
  border-radius: 20px;
  position: relative;
  z-index: 1;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(0,59,255,0.25);
}

/* ── Title ── */
#title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#app-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -0.01em;
}
#app-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--blue-light);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ── Divider ── */
#divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,59,255,0.4), transparent);
}

/* ── Progress ── */
#loader-mid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#progress-status {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
#progress-pct {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue-light);
  font-variant-numeric: tabular-nums;
}
#progress-track {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  overflow: hidden;
}
#progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue), var(--blue-light));
  border-radius: 99px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
#progress-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: shine 1.8s ease-in-out infinite;
}
@keyframes shine {
  0%   { left: -60%; }
  100% { left: 160%; }
}

/* ── Bottom branding ── */
#loader-bottom {
  position: absolute;
  bottom: 28px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
}
#brand-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: opacity 0.2s;
}
#brand-link:hover { opacity: 0.7; }
#powered-text {
  font-size: 0.7rem;
  font-weight: 400;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.05em;
}
#brand-logo {
  height: 18px;
  object-fit: contain;
  filter: brightness(0) invert(1) opacity(0.45);
  transition: filter 0.2s;
}
#brand-link:hover #brand-logo {
  filter: brightness(0) invert(1) opacity(0.7);
}

/* ── Unity canvas ── */
#unity-container {
  position: fixed;
  inset: 0;
  display: none;
  background: #000d40;
  align-items: center;
  justify-content: center;
}
#unity-canvas {
  display: block;
  background: #000;
  /* maintain 16:9 within viewport */
  width: min(100vw, 177.78vh);
  height: min(100vh, 56.25vw);
}
