/* Overlay oscuro para el modo ojo */
#ojo-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: #000 !important;
    opacity: 1 !important;
    transition: opacity 0.4s;
    pointer-events: auto;
}

/* Efecto de estática/ruido en el overlay */
#ojo-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    animation: noiseShift 0.5s steps(3) infinite;
}

@keyframes noiseShift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-1px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, -1px); }
}

/* Viñeta oscura en el overlay */
#ojo-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.8) 100%);
    pointer-events: none;
}

/* Ojo centrado y agrandado, aún más arriba */
.ojo-decorativo.ojo-central {
    position: fixed !important;
    left: 50% !important;
    top: 30% !important;
    right: auto !important;
    bottom: auto !important;
    width: 260px !important;
    height: 130px !important;
    transform: translate(-50%, -50%) scale(2.1);
    z-index: 1100 !important;
    background: transparent !important;
    transition: all 0.6s cubic-bezier(.77,0,.18,1.01);
    box-shadow: 0 0 80px 20px #000b;
    pointer-events: none;
    animation: ojoBreathing 4s ease-in-out infinite, ojoGlitch 8s ease-in-out infinite;
}

/* Respiración sutil del ojo */
@keyframes ojoBreathing {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(2.1);
        filter: brightness(1);
    }
    50% { 
        transform: translate(-50%, -50%) scale(2.15);
        filter: brightness(1.05);
    }
}

/* Glitch ocasional */
@keyframes ojoGlitch {
    0%, 92%, 100% { 
        clip-path: inset(0 0 0 0);
        filter: brightness(1) hue-rotate(0deg);
    }
    93% { 
        clip-path: inset(10% 0 30% 0);
        filter: brightness(1.3) hue-rotate(-5deg);
        transform: translate(-50%, -50%) scale(2.1) translateX(3px);
    }
    94% { 
        clip-path: inset(40% 0 10% 0);
        filter: brightness(0.8) hue-rotate(5deg);
        transform: translate(-50%, -50%) scale(2.1) translateX(-3px);
    }
    95% { 
        clip-path: inset(0 0 0 0);
        filter: brightness(1.1);
        transform: translate(-50%, -50%) scale(2.1);
    }
}

/* Efecto de aura perturbadora alrededor del ojo */
.ojo-decorativo.ojo-central::before {
    content: "";
    position: absolute;
    inset: -40px;
    background: radial-gradient(ellipse at center, 
        rgba(122, 26, 26, 0.15) 0%, 
        rgba(122, 26, 26, 0.05) 40%, 
        transparent 70%);
    animation: auraFlicker 3s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes auraFlicker {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    30% { opacity: 0.8; transform: scale(1.02); }
    60% { opacity: 0.4; transform: scale(0.98); }
    80% { opacity: 0.9; transform: scale(1.01); }
}

/* Texto del ojo estilo Undertale, más arriba */
#ojo-texto-undertale {
    position: fixed;
    left: 50%;
    top: calc(30% + 80px);
    transform: translateX(-50%);
    z-index: 1201;
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.35em;
    text-align: center;
    background: none;
    padding: 0.5em 0 0 0;
    letter-spacing: 0.5px;
    min-width: 320px;
    max-width: 90vw;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 2px 8px #000, 0 0 2px #000, 0 0 20px rgba(122, 26, 26, 0.3);
    white-space: pre-line;
    line-height: 1.6;
    opacity: 1;
    transition: opacity 0.2s;
}

/* Efecto de glitch en el texto ocasionalmente */
#ojo-texto-undertale.glitch-text {
    animation: textGlitch 0.3s ease-in-out;
}

@keyframes textGlitch {
    0%, 100% { 
        transform: translateX(-50%); 
        text-shadow: 0 2px 8px #000, 0 0 2px #000;
    }
    20% { 
        transform: translateX(calc(-50% + 2px)); 
        text-shadow: -2px 0 #7a1a1a, 2px 0 #1a1a7a;
    }
    40% { 
        transform: translateX(calc(-50% - 2px)); 
        text-shadow: 2px 0 #7a1a1a, -2px 0 #1a1a7a;
    }
    60% { 
        transform: translateX(calc(-50% + 1px)); 
        text-shadow: -1px 0 #7a1a1a, 1px 0 #1a1a7a;
    }
}

/* Input y botón más abajo del texto */
#ojo-input-undertale {
    position: fixed;
    left: 50%;
    top: calc(30% + 260px);
    transform: translateX(-50%);
    z-index: 1202;
    display: flex;
    gap: 0.5em;
    justify-content: center;
    align-items: center;
    background: none;
    pointer-events: auto;
}
#ojo-input-undertale input {
    width: 260px;
    max-width: 60vw;
    padding: 0.5em 0.7em;
    font-size: 1em;
    border-radius: 6px;
    border: 1.5px solid #7a1a1a;
    background: #232326;
    color: #fff;
    outline: none;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}
#ojo-input-undertale input:focus {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(122, 26, 26, 0.4);
}
#ojo-input-undertale button {
    padding: 0.45em 1.2em;
    font-size: 1em;
    border-radius: 6px;
    border: 1.5px solid #fff;
    background: #7a1a1a;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}
#ojo-input-undertale button:hover {
    background: #fff;
    color: #7a1a1a;
    transform: scale(1.05);
}

/* Botón cerrar arriba a la derecha */
#ojo-close-undertale {
    position: fixed;
    top: 2.5em;
    right: 3em;
    z-index: 1300;
    color: #fff;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.3s, color 0.3s;
}
#ojo-close-undertale:hover {
    opacity: 1;
    transform: rotate(90deg);
    color: #7a1a1a;
}

/* Parpadeo del ojo cuando está inactivo */
.ojo-decorativo:not(.ojo-central) .ojo-decorativo-img {
    animation: eyeBlink 6s ease-in-out infinite;
}

@keyframes eyeBlink {
    0%, 94%, 100% { 
        clip-path: inset(0 0 0 0);
    }
    96%, 98% { 
        clip-path: inset(45% 0 45% 0);
    }
}
    z-index: 1300;
    color: #fff;
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}
#ojo-close-undertale:hover {
    opacity: 1;
}
