/* Splash overlay — neo-tokyo Nexus City loading screen.
 *
 * Shown during boot in beta builds only (gated by window.NEXUS_BETA).
 * Layers: rain canvas → scanlines → vignette → corner brackets → chrome rows
 *       → centered core (title/phase/bar) → phase ladder → footer.
 */

#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000308;
  color: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
}

#splash-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.22;
  pointer-events: none;
  z-index: 1;
}

#splash-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    transparent 0 2px,
    rgba(0, 0, 0, 0.45) 2px 3px
  );
}

#splash-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(0, 0, 0, 0.75) 100%
  );
}

.splash-corner {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 1px solid #00ffef;
  opacity: 0.85;
  z-index: 4;
}
.splash-corner.tl { top: 16px;    left: 16px;   border-right:  none; border-bottom: none; }
.splash-corner.tr { top: 16px;    right: 16px;  border-left:   none; border-bottom: none; }
.splash-corner.bl { bottom: 16px; left: 16px;   border-right:  none; border-top:    none; }
.splash-corner.br { bottom: 16px; right: 16px;  border-left:   none; border-top:    none; }

.splash-header,
.splash-footer {
  position: absolute;
  left: 60px;
  right: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  text-transform: uppercase;
}
.splash-header {
  top: 22px;
  font-size: 9px;
  letter-spacing: 0.35em;
  color: rgba(0, 255, 239, 0.7);
}
.splash-footer {
  bottom: 22px;
  font-size: 8px;
  letter-spacing: 0.4em;
  color: rgba(0, 255, 239, 0.4);
}
.splash-header .sys::before {
  content: '● ';
  color: #00ff88;
  text-shadow: 0 0 4px #00ff88;
}

.splash-core {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-tagline {
  font-size: 9px;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: #00ffef;
  opacity: 0.6;
  margin-bottom: 14px;
}

.splash-title {
  font-weight: 700;
  font-size: 44px;
  letter-spacing: 0.25em;
  color: #fff;
  text-shadow:
    2px 0 #ff0080,
    -2px 0 #00ffef,
    0 0 24px rgba(0, 255, 239, 0.55);
  animation: splash-glitch 4s infinite;
  margin-bottom: 6px;
}
@keyframes splash-glitch {
  0%, 92%, 100% {
    text-shadow: 2px 0 #ff0080, -2px 0 #00ffef, 0 0 24px rgba(0, 255, 239, 0.55);
    transform: translateX(0);
  }
  94% {
    text-shadow: 6px 0 #ff0080, -6px 0 #00ffef, 0 0 24px rgba(0, 255, 239, 0.55);
    transform: translateX(1px);
  }
  96% {
    text-shadow: -3px 0 #ff0080, 3px 0 #00ffef, 0 0 24px rgba(0, 255, 239, 0.55);
    transform: translateX(-1px);
  }
}

.splash-subtitle-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 11px;
  letter-spacing: 0.6em;
  color: #00ffef;
  opacity: 0.75;
  margin-bottom: 32px;
}

#splash-phase {
  font-size: 11px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #00ffef;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#splash-phase::before { content: '>'; color: #00ff88; }
#splash-phase::after {
  content: '▊';
  color: #00ffef;
  animation: splash-blink 1s steps(1) infinite;
  margin-left: 4px;
}
@keyframes splash-blink { 50% { opacity: 0; } }

#splash-phase-jp {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 9px;
  letter-spacing: 0.4em;
  color: rgba(0, 255, 239, 0.55);
  margin-bottom: 16px;
}

.splash-bar-wrap {
  position: relative;
  width: 46vw;
  max-width: 600px;
  padding: 3px;
  border: 1px solid rgba(0, 255, 239, 0.3);
  margin-bottom: 10px;
}
.splash-bar-wrap::before,
.splash-bar-wrap::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1px solid #00ffef;
}
.splash-bar-wrap::before { top: -4px;    left: -4px;    border-right: none; border-bottom: none; }
.splash-bar-wrap::after  { bottom: -4px; right: -4px;   border-left:  none; border-top:    none; }

#splash-bar-track {
  height: 3px;
  background: rgba(0, 255, 239, 0.08);
  position: relative;
  overflow: hidden;
}
#splash-bar {
  position: relative;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00ffef, #4d9fff);
  box-shadow: 0 0 10px #00ffef, 0 0 24px rgba(0, 255, 239, 0.4);
  transition: width 120ms linear;
}
#splash-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
  animation: splash-sweep 1.6s linear infinite;
}
@keyframes splash-sweep { 100% { left: 140%; } }

.splash-meta-row {
  display: flex;
  justify-content: space-between;
  width: 46vw;
  max-width: 600px;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: rgba(0, 255, 239, 0.7);
  text-transform: uppercase;
}
#splash-pct {
  color: #fff;
  text-shadow: 0 0 6px #00ffef;
}

.splash-ladder {
  position: absolute;
  bottom: 56px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  /* Six steps including MANIFEST (8 chars, longest). 22px gap (down from 28)
   * keeps the ladder centered without wrapping at viewport widths down to
   * ~800px while preserving the existing rhythm. */
  gap: 22px;
  font-size: 8px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  z-index: 5;
}
.splash-ladder .step { color: rgba(0, 255, 239, 0.25); }
.splash-ladder .step.done {
  color: #00ff88;
  text-shadow: 0 0 4px #00ff88;
}
.splash-ladder .step.done::before   { content: '● '; }
.splash-ladder .step.active {
  color: #00ffef;
  text-shadow: 0 0 6px #00ffef;
}
.splash-ladder .step.active::before {
  content: '◆ ';
  animation: splash-blink 1s steps(1) infinite;
}
.splash-ladder .step.pending::before { content: '○ '; }

@media (prefers-reduced-motion: reduce) {
    #splash-rain              { display: none; }
    .splash-title             { animation: none; }
    #splash-phase::after      { animation: none; }
    #splash-bar::after        { animation: none; display: none; }
    .splash-ladder .step.active::before { animation: none; }
}
