/* ─────────────────────────────────────────
   Loading Screen — Hacker Style
───────────────────────────────────────── */

#loader {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Matrix rain canvas */
#matrix-canvas {
  position: absolute;
  inset: 0;
  opacity: 0.18;
}

/* Center content */
.loader-content {
  position: relative;
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: min(520px, 90vw);
}

/* Glitch logo */
.loader-logo {
  font-size: clamp(2rem, 8vw, 3.5rem);
  font-weight: 700;
  color: #00ff41;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  position: relative;
  animation: glitch 3s infinite;
  text-shadow:
    0 0 10px #00ff41,
    0 0 30px #00ff41,
    0 0 60px rgba(0,255,65,0.4);
}

.loader-logo::before,
.loader-logo::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
}

.loader-logo::before {
  color: #ff003c;
  animation: glitch-r 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  text-shadow: 2px 0 #ff003c;
}

.loader-logo::after {
  color: #00cfff;
  animation: glitch-b 3s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  text-shadow: -2px 0 #00cfff;
}

/* Terminal box */
.terminal-box {
  background: rgba(0, 255, 65, 0.04);
  border: 1px solid rgba(0, 255, 65, 0.25);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  width: 100%;
  text-align: left;
}

.terminal-line {
  color: rgba(0,255,65,0.5);
  font-size: clamp(0.68rem, 2vw, 0.78rem);
  line-height: 1.8;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  overflow: hidden;
}

.terminal-line.show { opacity: 1; transform: translateX(0); }
.terminal-line .prompt { color: #00ff41; margin-right: 0.5rem; }
.terminal-line .ok     { color: #00ff41; }
.terminal-line .warn   { color: #ffd700; }
.terminal-line .err    { color: #ff003c; }

/* Progress bar */
.progress-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: rgba(0,255,65,0.5);
}

.progress-label span:last-child { color: #00ff41; }

.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: rgba(0,255,65,0.1);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 4px,
    rgba(0,255,65,0.05) 4px,
    rgba(0,255,65,0.05) 8px
  );
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00a829, #00ff41);
  border-radius: 2px;
  transition: width 0.15s ease;
  box-shadow: 0 0 8px #00ff41, 0 0 20px rgba(0,255,65,0.4);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: -2px;
  width: 2px; height: 8px;
  background: #fff;
  border-radius: 1px;
  box-shadow: 0 0 6px #00ff41;
}

/* Scan line effect */
#loader::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 20;
}

/* Corner decorations */
.corner {
  position: absolute;
  width: 20px; height: 20px;
  border-color: rgba(0,255,65,0.4);
  border-style: solid;
}

.corner-tl { top: 16px; left: 16px;  border-width: 2px 0 0 2px; }
.corner-tr { top: 16px; right: 16px; border-width: 2px 2px 0 0; }
.corner-bl { bottom: 16px; left: 16px;  border-width: 0 0 2px 2px; }
.corner-br { bottom: 16px; right: 16px; border-width: 0 2px 2px 0; }

/* Status row */
.status-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  font-size: 0.7rem;
  color: rgba(0,255,65,0.35);
  letter-spacing: 0.1em;
}

.status-row span { display: flex; align-items: center; gap: 0.4rem; }
.status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #00ff41;
  box-shadow: 0 0 6px #00ff41;
  animation: blink-dot 1.2s ease-in-out infinite;
}

/* ─────────────────────────────────────────
   Keyframes
───────────────────────────────────────── */
@keyframes glitch {
  0%,90%,100% { transform: none; }
  91%          { transform: skewX(-2deg) translateX(2px); }
  93%          { transform: skewX(2deg) translateX(-2px); }
  95%          { transform: none; }
  97%          { transform: skewX(-1deg); }
}

@keyframes glitch-r {
  0%,90%,100% { transform: none; opacity: 0.8; }
  91%          { transform: translateX(3px); }
  93%          { transform: translateX(-3px); }
  95%          { transform: none; }
}

@keyframes glitch-b {
  0%,90%,100% { transform: none; opacity: 0.8; }
  92%          { transform: translateX(-3px); }
  94%          { transform: translateX(3px); }
  95%          { transform: none; }
}

@keyframes blink-dot {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.2; }
}