/* ========================================= */
/* AEGIS SYSTEM INITIALIZATION ANIMATION      */
/* ========================================= */
:root {
  --cyan: #00f0ff;
  --blue: #0080ff;
  --void: #050810;
  --alert: #ffa800;
  --neon: #00ff9f;
}

html.preload,
html:has(body.preload) {
  overflow: hidden !important;
  height: 100vh !important;
  width: 100vw !important;
}

html.preload::-webkit-scrollbar,
html:has(body.preload)::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

body.preload,
body.preload * {
  transition: none !important;
}
body.preload {
  overflow: hidden !important;
  height: 100vh !important;
  width: 100vw !important;
}
body.preload::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.loader-container {
  position: fixed;
  inset: 0;
  background: var(--void);
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Courier New', monospace;
  transition: opacity 0.8s ease;
}

.loader-container.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Background Grid & Scanline */
.aegis-bg-grid {
  position: absolute;
  inset: -50%;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  transform: perspective(500px) rotateX(60deg) translateY(-100px) translateZ(-200px);
  animation: gridMove 20s linear infinite;
  opacity: 0.3;
}

@keyframes gridMove {
  0% { transform: perspective(500px) rotateX(60deg) translateY(0) translateZ(-200px); }
  100% { transform: perspective(500px) rotateX(60deg) translateY(40px) translateZ(-200px); }
}

.aegis-scanline {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 10px;
  background: linear-gradient(to bottom, transparent, rgba(0, 240, 255, 0.4), transparent);
  animation: scan 4s linear infinite;
  z-index: 10;
  opacity: 0.5;
  pointer-events: none;
}

@keyframes scan {
  0% { transform: translateY(-100px); }
  100% { transform: translateY(100vh); }
}

/* HUD Corners */
.aegis-hud {
  position: absolute;
  inset: 2rem;
  pointer-events: none;
  z-index: 5;
}

.hud-block {
  position: absolute;
  color: var(--cyan);
  display: flex;
  flex-direction: column;
}

.hud-tl { top: 0; left: 0; border-left: 2px solid var(--cyan); padding-left: 10px; }
.hud-tr { top: 0; right: 0; border-right: 2px solid var(--cyan); padding-right: 10px; align-items: flex-end; }
.hud-bl { bottom: 0; left: 0; border-left: 2px solid var(--cyan); padding-left: 10px; flex-direction: column-reverse; }
.hud-br { bottom: 0; right: 0; border-right: 2px solid var(--cyan); padding-right: 10px; flex-direction: column-reverse; align-items: flex-end; }

.hud-label {
  font-size: 0.7rem;
  opacity: 0.6;
  letter-spacing: 2px;
}

.hud-value {
  font-size: 1rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  margin-top: 5px;
  margin-bottom: 5px;
}

/* Central Core Aperture */
.aegis-core {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  z-index: 10;
  transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.aegis-core.iris-open {
  transform: scale(4);
  opacity: 0;
}

.aegis-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.aegis-hex-outer {
  color: var(--blue);
  animation: spinOuter 20s linear infinite reverse;
}

.aegis-circle-main {
  animation: spinInner 8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  filter: drop-shadow(0 0 8px var(--cyan));
}

.aegis-reticle {
  color: var(--cyan);
  animation: spinOuter 12s linear infinite;
  opacity: 0.8;
}

@keyframes spinOuter {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinInner {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

.aegis-center-data {
  position: relative;
  z-index: 2;
  color: var(--cyan);
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.8);
  display: flex;
  align-items: flex-start;
  font-size: 2.5rem;
  font-weight: bold;
  margin: 0;
}

.aegis-percent-sym {
  font-size: 1.2rem;
  margin-left: 2px;
  margin-top: 6px;
  opacity: 0.8;
}

/* Status Tracking */
.aegis-status-container {
  width: 380px;
  text-align: center;
  position: relative;
  z-index: 10;
  transition: opacity 0.5s ease;
}

.aegis-status-container.hidden {
  opacity: 0;
}

.aegis-glitch-text {
  font-size: 0.9rem;
  color: var(--cyan);
  letter-spacing: 3px;
  margin-bottom: 1.5rem;
  position: relative;
  display: inline-block;
  line-height: normal;
}

.aegis-glitch-text::before,
.aegis-glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.8;
  clip: rect(0, 0, 0, 0);
}

.aegis-glitch-text.glitching::before {
  left: -2px;
  text-shadow: 1px 0 var(--alert);
  animation: glitch-anim 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
}

.aegis-glitch-text.glitching::after {
  left: 2px;
  text-shadow: -1px 0 var(--blue);
  animation: glitch-anim 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(10px, 9999px, 44px, 0); }
  20% { clip: rect(31px, 9999px, 83px, 0); }
  40% { clip: rect(65px, 9999px, 2px, 0); }
  60% { clip: rect(2px, 9999px, 55px, 0); }
  80% { clip: rect(87px, 9999px, 12px, 0); }
  100% { clip: rect(43px, 9999px, 33px, 0); }
}

.aegis-tracker {
  position: relative;
  width: 100%;
  height: 4px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
}

.aegis-tracker-brackets {
  color: var(--cyan);
  font-weight: bold;
  font-size: 1.2rem;
  position: absolute;
  top: -12px;
}
.aegis-tracker-brackets.left { left: -15px; }
.aegis-tracker-brackets.right { right: -15px; }

.aegis-bar-bg {
  width: 100%;
  height: 2px;
  background: rgba(0, 240, 255, 0.1);
  position: absolute;
}

.aegis-bar-fill {
  height: 2px;
  background: var(--cyan);
  width: 0%;
  position: absolute;
  left: 0;
  box-shadow: 0 0 10px var(--cyan);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.aegis-stage-dots {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 0 20px;
}

.aegis-dot {
  width: 8px;
  height: 8px;
  background: rgba(0, 240, 255, 0.2);
  transform: rotate(45deg);
  transition: all 0.3s ease;
}

.aegis-dot.active {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transform: rotate(45deg) scale(1.5);
}

.aegis-dot.completed {
  background: var(--cyan);
}

/* Success State Colors */
.aegis-success .aegis-bar-fill,
.aegis-success .aegis-dot.completed,
.aegis-success .aegis-dot.active {
  background: var(--neon);
  box-shadow: 0 0 15px var(--neon);
}
.aegis-success .aegis-glitch-text {
  color: var(--neon);
  text-shadow: 0 0 10px var(--neon);
}
