/* ==========================================================================
   RESET Y CONFIGURACIÓN BASE RESPONSIVA
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --gaming-green: #00e6a8;
  --gaming-blue: #6be0ff;
  --neon-glow-green: rgba(0, 230, 168, 0.35);
  --neon-glow-blue: rgba(107, 224, 255, 0.25);
  --dark-bg: #070708;
}

body {
  margin: 0;
  padding: 10px;
  background-color: var(--dark-bg);
  background-image: 
    linear-gradient(rgba(18, 18, 18, 0.1) 50%, transparent 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
  background-size: 100% 4px, 3px 100%;
  color: #e6f7f0;
  font-family: 'Fira Code', monospace;
  min-height: 100vh;
  overflow: hidden; /* Se deshabilita por JS al terminar el preloader */
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (min-width: 768px) {
  body {
    padding: 20px;
  }
}

/* ==========================================================================
   PANTALLA DE PRECARGA INTERACTIVA (PRELOADER BLACK MIRROR)
   ========================================================================== */
#preloader {
  position: fixed;
  inset: 0;
  background: #030304;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Interfaz del botón disparador de audio */
#audioTriggerContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

#startSystemBtn {
  background: transparent;
  border: 1px dashed var(--gaming-blue);
  color: var(--gaming-blue);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(12px, 3vw, 15px);
  padding: 14px 28px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(107, 224, 255, 0.1);
}

#startSystemBtn:hover {
  background: rgba(107, 224, 255, 0.05);
  border-style: solid;
  color: #fff;
  border-color: #fff;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.2);
  transform: scale(1.02);
}

.trigger-hint {
  font-size: 9px;
  color: #555;
  letter-spacing: 1px;
}

/* Animación de salida desordenada (Glitch analógico final) */
#preloader.shattering-glitch {
  animation: staticShatter 0.4s steps(2) infinite;
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-out, visibility 0.5s;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 35px;
  width: 85%;
  max-width: 320px;
  position: relative;
}

/* CONTENEDOR DE LOGO ESTILO GLITCH */
.black-mirror-logo-wrap {
  position: relative;
  width: clamp(140px, 45vw, 190px);
  height: clamp(140px, 45vw, 190px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
}

.loader-logo {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(107, 224, 255, 0.1));
  animation: mainLogoGlitch 4s ease-in-out infinite;
  z-index: 2;
}

/* Capas espejo para el efecto aberración cromática */
.glitch-ghost {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.65;
  z-index: 1;
}

.ghost-1 {
  animation: ghostCyan 3.5s steps(3) infinite;
  filter: drop-shadow(0 0 5px var(--gaming-blue)) hue-rotate(90deg);
}

.ghost-2 {
  animation: ghostRed 3.5s steps(2) infinite;
  filter: drop-shadow(0 0 5px #ff4b4b) hue-rotate(270deg);
}

/* Indicador de carga */
.loader-status {
  width: 100%;
  text-align: center;
}

.status-text {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  letter-spacing: 3px;
  color: #fff;
  opacity: 0.4;
  display: block;
  margin-bottom: 10px;
  animation: heartbeat 2s infinite;
}

.progress-bar-wrap {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  box-shadow: 0 0 8px #fff;
}

.status-percentage {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  color: #666;
}

/* ==========================================================================
   INTERFAZ PRINCIPAL CON CONTENEDOR RESPONSIVO
   ========================================================================== */
.main-container {
  width: 100%;
  max-width: 800px;
  min-height: calc(100vh - 40px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow: 0 25px 55px rgba(0,0,0,0.7);
  padding: 24px 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
}

@media (min-width: 768px) {
  .main-container {
    min-height: 80vh;
    border-radius: 24px;
    padding: 40px;
  }
}

/* Esquinas Estéticas HUD */
.hud-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--gaming-blue);
  opacity: 0.6;
}
@media (min-width: 768px) {
  .hud-corner { width: 16px; height: 16px; opacity: 1; }
}
.top-left { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.top-right { top: 12px; right: 12px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 12px; left: 12px; border-right: none; border-top: none; }
.bottom-right { bottom: 12px; right: 12px; border-left: none; border-top: none; }

/* BARRA SUPERIOR MINIMALISTA */
.minimal-nav {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(9px, 2.5vw, 11px);
  gap: 10px;
  width: 100%;
}

.sys-status {
  color: var(--gaming-green);
  text-shadow: 0 0 8px var(--neon-glow-green);
  font-weight: bold;
  white-space: nowrap;
}

.discord-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 10px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.discord-badge span {
  display: none;
}
@media (min-width: 360px) {
  .discord-badge span { display: inline; }
}

.discord-badge svg {
  width: 12px;
  height: 12px;
  fill: #8ea1ff;
  flex-shrink: 0;
}

.discord-badge:hover {
  background: rgba(88, 101, 242, 0.2);
  border-color: #8ea1ff;
  box-shadow: 0 0 12px rgba(88, 101, 242, 0.3);
}

/* CONTENIDO PRINCIPAL ADAPTATIVO */
.coming-soon-content {
  text-align: center;
  width: 100%;
}

.main-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(28px, 7.5vw, 56px);
  font-weight: 900;
  letter-spacing: clamp(3px, 1.2vw, 6px);
  margin: 0;
  background: linear-gradient(180deg, #fff 0%, #a4b3be 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.sub-line {
  color: var(--gaming-green);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(9px, 2.2vw, 12px);
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 12px;
  padding: 0 10px;
  text-shadow: 0 0 10px var(--neon-glow-green);
}

.description-text {
  font-size: clamp(11px, 2.8vw, 13px);
  color: #a4b3be;
  max-width: 520px;
  margin: 20px auto;
  line-height: 1.6;
  padding: 0 10px;
}

/* ==========================================================================
   SECCIÓN: CARRUSEL ESTILO BLACK MIRROR
   ========================================================================== */
.preview-carousel-section {
  width: 100%;
  max-width: 540px;
  margin: 35px auto;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.carousel-hud-top {
  display: flex;
  justify-content: space-between;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  color: #555;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.carousel-hud-top .view-mode {
  color: var(--gaming-blue);
  opacity: 0.7;
}

/* Monitor/Pantalla analógica */
.mirror-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.9);
}

/* Capa estática CRT */
.screen-scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 18, 18, 0) 50%, rgba(0, 0, 0, 0.4) 50%);
  background-size: 100% 4px;
  z-index: 5;
  pointer-events: none;
  opacity: 0.6;
}

.mirror-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.mirror-item {
  min-width: 100%;
  height: 100%;
  position: relative;
  background: #020203;
}

.carousel-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.75;
  filter: grayscale(30%) contrast(110%);
  transition: all 0.3s ease;
}

/* Al pasar el cursor, la captura genera micro-glitches */
.mirror-item:hover .carousel-preview-img {
  opacity: 0.9;
  filter: grayscale(0%) contrast(100%);
  animation: mainLogoGlitch 0.3s steps(2) infinite;
}

.item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  padding: 12px;
  text-align: left;
  z-index: 4;
}

.item-overlay span {
  font-size: 10px;
  color: var(--gaming-green);
  letter-spacing: 1px;
  font-weight: bold;
}

/* Controles de Navegación */
.mirror-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
}

.ctrl-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #666;
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 1px;
}

.ctrl-btn:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
  text-shadow: 0 0 5px rgba(255,255,255,0.5);
}

.mirror-dots {
  display: flex;
  gap: 8px;
}

.m-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
}

.m-dot.active {
  background: var(--gaming-green);
  box-shadow: 0 0 8px var(--gaming-green);
  transform: scale(1.2);
}

/* ==========================================================================
   CAJA DE TERMINAL MÓVIL/ESCRITORIO
   ========================================================================== */
.terminal-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  text-align: left;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  width: 100%;
}

.term-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 14px;
  font-size: clamp(9px, 2.2vw, 10px);
  color: var(--gaming-blue);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.term-body {
  padding: 14px;
  font-size: clamp(10px, 2.4vw, 11px);
  color: #8898a5;
}

.term-body p {
  margin: 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot-blink {
  width: 6px;
  height: 6px;
  background: var(--gaming-green);
  border-radius: 50%;
  animation: blink 1s steps(2, start) infinite;
}

/* FOOTER */
footer {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(8px, 2.2vw, 10px);
  color: #555;
  letter-spacing: 1px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (min-width: 480px) {
  footer {
    flex-direction: row;
    justify-content: center;
    gap: 8px;
  }
}

footer .rights {
  color: var(--gaming-blue);
}

/* ==========================================================================
   ANIMACIONES CLAVE DE INTERFERENCIAS (GLITCH)
   ========================================================================== */

/* Glitch del Logo e Imágenes */
@keyframes mainLogoGlitch {
  0%, 85%, 95%, 100% { transform: skewX(0deg) scale(1); filter: drop-shadow(0 0 10px rgba(107, 224, 255, 0.1)); }
  88% { transform: skewX(-5deg) scaleY(1.02); filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3)); }
  90% { transform: skewX(8deg) scaleY(0.97); }
  92% { transform: skewX(-12deg) scale(0.99); }
}

/* Desplazamiento Fantasma Cyan */
@keyframes ghostCyan {
  0%, 90%, 100% { transform: translate(0, 0); opacity: 0; }
  92% { transform: translate(-8px, 2px); opacity: 0.65; }
  94% { transform: translate(6px, -4px); opacity: 0.45; }
  96% { transform: translate(-3px, 5px); opacity: 0.75; }
}

/* Desplazamiento Fantasma Rojo */
@keyframes ghostRed {
  0%, 90%, 100% { transform: translate(0, 0); opacity: 0; }
  91% { transform: translate(8px, -2px); opacity: 0.7; }
  93% { transform: translate(-5px, 4px); opacity: 0.5; }
  95% { transform: translate(4px, -3px); opacity: 0.65; }
}

/* Latido de opacidad */
@keyframes heartbeat {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.85; }
}

/* Interferencia CRT final antes de apagarse */
@keyframes staticShatter {
  0% { transform: translate(2px, -1px); filter: contrast(150%) brightness(1.2) grayscale(0.5); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(1px, -3px) scale(1.02); filter: invert(1); }
  75% { transform: translate(-1px, 1px) scaleY(0.9); }
  100% { transform: translate(4px, 2px); }
}

@keyframes blink {
  to { visibility: hidden; }
}

.section-fade-in {
  animation: viewEnter 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
