/* Efectos Glitch */
.glitch-effect {
    position: relative;
    overflow: hidden;
}

.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 #ff00ff;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 #00ffff;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

/* Animaciones de glitch */
@keyframes glitch-anim-1 {
    0% { clip: rect(20px, 9999px, 25px, 0); }
    5% { clip: rect(50px, 9999px, 80px, 0); }
    10% { clip: rect(30px, 9999px, 60px, 0); }
    15% { clip: rect(70px, 9999px, 95px, 0); }
    20% { clip: rect(45px, 9999px, 75px, 0); }
    25% { clip: rect(15px, 9999px, 40px, 0); }
    30% { clip: rect(65px, 9999px, 90px, 0); }
    35% { clip: rect(35px, 9999px, 70px, 0); }
    40% { clip: rect(85px, 9999px, 100px, 0); }
    45% { clip: rect(25px, 9999px, 55px, 0); }
    50% { clip: rect(75px, 9999px, 95px, 0); }
    55% { clip: rect(40px, 9999px, 85px, 0); }
    60% { clip: rect(90px, 9999px, 120px, 0); }
    65% { clip: rect(50px, 9999px, 95px, 0); }
    70% { clip: rect(110px, 9999px, 140px, 0); }
    75% { clip: rect(60px, 9999px, 105px, 0); }
    80% { clip: rect(130px, 9999px, 160px, 0); }
    85% { clip: rect(70px, 9999px, 115px, 0); }
    90% { clip: rect(150px, 9999px, 180px, 0); }
    95% { clip: rect(80px, 9999px, 125px, 0); }
    100% { clip: rect(170px, 9999px, 200px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(100px, 9999px, 115px, 0); }
    5% { clip: rect(130px, 9999px, 160px, 0); }
    10% { clip: rect(110px, 9999px, 140px, 0); }
    15% { clip: rect(150px, 9999px, 180px, 0); }
    20% { clip: rect(125px, 9999px, 155px, 0); }
    25% { clip: rect(95px, 9999px, 120px, 0); }
    30% { clip: rect(145px, 9999px, 170px, 0); }
    35% { clip: rect(115px, 9999px, 150px, 0); }
    40% { clip: rect(165px, 9999px, 190px, 0); }
    45% { clip: rect(105px, 9999px, 135px, 0); }
    50% { clip: rect(155px, 9999px, 185px, 0); }
    55% { clip: rect(120px, 9999px, 165px, 0); }
    60% { clip: rect(170px, 9999px, 200px, 0); }
    65% { clip: rect(130px, 9999px, 175px, 0); }
    70% { clip: rect(190px, 9999px, 220px, 0); }
    75% { clip: rect(140px, 9999px, 185px, 0); }
    80% { clip: rect(210px, 9999px, 240px, 0); }
    85% { clip: rect(150px, 9999px, 195px, 0); }
    90% { clip: rect(230px, 9999px, 260px, 0); }
    95% { clip: rect(160px, 9999px, 205px, 0); }
    100% { clip: rect(250px, 9999px, 280px, 0); }
}

/* Efecto de distorsión de pantalla completa */
.screen-glitch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    mix-blend-mode: screen;
}

.glitch-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 0, 255, 0.7);
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
    animation: scanline 10s linear infinite;
}

@keyframes scanline {
    0% { top: 0%; }
    100% { top: 100%; }
}

/* Efecto de ruido estático */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.03;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: noise 0.2s infinite;
}

@keyframes noise {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-1%, -1%); }
    20% { transform: translate(1%, 1%); }
    30% { transform: translate(-1%, 1%); }
    40% { transform: translate(1%, -1%); }
    50% { transform: translate(-1%, 0); }
    60% { transform: translate(1%, 0); }
    70% { transform: translate(0, -1%); }
    80% { transform: translate(0, 1%); }
    90% { transform: translate(-1%, -1%); }
    100% { transform: translate(0, 0); }
}

/* Efecto de parpadeo */
@keyframes flicker {
    0% { opacity: 0.97; }
    5% { opacity: 0.95; }
    10% { opacity: 0.98; }
    15% { opacity: 0.92; }
    20% { opacity: 0.99; }
    25% { opacity: 0.93; }
    30% { opacity: 1; }
    35% { opacity: 0.94; }
    40% { opacity: 0.96; }
    45% { opacity: 0.91; }
    50% { opacity: 0.98; }
    55% { opacity: 0.93; }
    60% { opacity: 1; }
    65% { opacity: 0.92; }
    70% { opacity: 0.97; }
    75% { opacity: 0.94; }
    80% { opacity: 0.99; }
    85% { opacity: 0.92; }
    90% { opacity: 0.98; }
    95% { opacity: 0.93; }
    100% { opacity: 1; }
}

.flicker {
    animation: flicker 0.3s infinite;
}

/* Efecto de distorsión */
.distort {
    transform: skewX(calc(var(--skew) * 1deg));
    transition: transform 0.1s;
}

/* Mensajes de error del sistema - ESTILOS MEJORADOS */
.system-error {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: #000 !important;
    color: #0f0 !important;
    font-family: 'Courier New', monospace !important;
    padding: 20px 30px !important;
    border: 2px solid #f00 !important;
    z-index: 10000 !important;
    display: block !important; /* Cambiado de 'none' a 'block' */
    box-shadow: 
        0 0 30px rgba(255, 0, 0, 0.7),
        0 0 60px rgba(255, 0, 0, 0.3),
        inset 0 0 20px rgba(255, 0, 0, 0.2) !important;
    max-width: 600px !important;
    min-width: 400px !important;
    text-align: left !important;
    opacity: 1 !important;
    transition: opacity 0.5s !important;
    border-radius: 3px !important;
}

.system-error::before {
    content: '⚠ SYSTEM ALERT ⚠';
    display: block;
    color: #f00;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2em;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
    padding-bottom: 10px;
    border-bottom: 1px solid #f00;
}

.system-error::after {
    content: 'Press any key to continue...';
    display: block;
    color: #0ff;
    font-size: 0.9em;
    margin-top: 15px;
    text-align: center;
    font-style: italic;
    opacity: 0.8;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

.error-line {
    color: #0f0 !important;
    margin-bottom: 8px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5) !important;
    padding-left: 20px !important;
    position: relative !important;
}

.error-line::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: #f00;
    font-size: 12px;
}

.error-line span {
    color: #0ff !important;
    font-weight: bold !important;
}

.error-line.critical {
    color: #f00 !important;
    font-weight: bold !important;
    animation: pulse-red 1s infinite !important;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Overlay de fondo para error */
.error-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85) !important;
    z-index: 9999 !important;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    display: block !important;
    opacity: 1 !important;
}

/* Efecto de terminal parpadeante */
.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: #0f0;
    margin-left: 2px;
    animation: cursor-blink 1s infinite;
    vertical-align: middle;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}