/* CRT and Console Effects for Kosmik Dstroyer Main Page */

/* Global CRT effects that don't change layout */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.15) 50%
    );
    background-size: 100% 4px;
    z-index: 9998;
    pointer-events: none;
    animation: scanlines 0.2s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 9997;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

/* CRT Monitor curved edges effect */
body {
    position: relative;
    overflow-x: hidden;
}

body::before, body::after {
    pointer-events: none;
}

.ascii-container {
    position: relative;
}

.ascii-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: 0 0 30px 5px rgba(255, 179, 0, 0.1) inset;
    border-radius: 10px;
    pointer-events: none;
    z-index: 10;
    animation: crt-breathing 8s ease-in-out infinite;
}

/* CRT monitor breathing effect for subtle glow */
@keyframes crt-breathing {
    0%, 100% { box-shadow: 0 0 30px 5px rgba(255, 179, 0, 0.1) inset; }
    50% { box-shadow: 0 0 40px 8px rgba(255, 179, 0, 0.2) inset; }
}

/* Scan Lines Animation */
@keyframes scanlines {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 4px;
    }
}

/* Screen Flicker Animation */
@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    15% { opacity: 0.90626; }
    20% { opacity: 0.18128; }
    25% { opacity: 0.83891; }
    30% { opacity: 0.65583; }
    35% { opacity: 0.67807; }
    40% { opacity: 0.26559; }
    45% { opacity: 0.84693; }
    50% { opacity: 0.96019; }
    55% { opacity: 0.08594; }
    60% { opacity: 0.20313; }
    65% { opacity: 0.71988; }
    70% { opacity: 0.53455; }
    75% { opacity: 0.37288; }
    80% { opacity: 0.71428; }
    85% { opacity: 0.70419; }
    90% { opacity: 0.7003; }
    95% { opacity: 0.36108; }
    100% { opacity: 0.24387; }
}

/* Text Shadow for CRT glow effect */
.crt-text {
    text-shadow: 0 0 5px #ffb300, 0 0 10px #ffb300;
    animation: textShadow 1.6s infinite;
}

@keyframes textShadow {
    0% { text-shadow: 0.4389924193300864px 0 1px rgba(255, 179, 0, 0.5), -0.4389924193300864px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    5% { text-shadow: 2.7928974010788217px 0 1px rgba(255, 179, 0, 0.5), -2.7928974010788217px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    10% { text-shadow: 0.02956275843481219px 0 1px rgba(255, 179, 0, 0.5), -0.02956275843481219px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    15% { text-shadow: 0.40218538552878136px 0 1px rgba(255, 179, 0, 0.5), -0.40218538552878136px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    20% { text-shadow: 3.4794037899852017px 0 1px rgba(255, 179, 0, 0.5), -3.4794037899852017px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    25% { text-shadow: 1.6125630401149584px 0 1px rgba(255, 179, 0, 0.5), -1.6125630401149584px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    30% { text-shadow: 0.7015590085143956px 0 1px rgba(255, 179, 0, 0.5), -0.7015590085143956px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    35% { text-shadow: 3.896914047650351px 0 1px rgba(255, 179, 0, 0.5), -3.896914047650351px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    40% { text-shadow: 3.870905614848819px 0 1px rgba(255, 179, 0, 0.5), -3.870905614848819px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    45% { text-shadow: 2.231056963361899px 0 1px rgba(255, 179, 0, 0.5), -2.231056963361899px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    50% { text-shadow: 0.08084290417898504px 0 1px rgba(255, 179, 0, 0.5), -0.08084290417898504px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    55% { text-shadow: 2.3758461067427543px 0 1px rgba(255, 179, 0, 0.5), -2.3758461067427543px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    60% { text-shadow: 2.202193051050636px 0 1px rgba(255, 179, 0, 0.5), -2.202193051050636px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    65% { text-shadow: 2.8638780614874975px 0 1px rgba(255, 179, 0, 0.5), -2.8638780614874975px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    70% { text-shadow: 0.48874025155497314px 0 1px rgba(255, 179, 0, 0.5), -0.48874025155497314px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    75% { text-shadow: 1.8948491305757957px 0 1px rgba(255, 179, 0, 0.5), -1.8948491305757957px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    80% { text-shadow: 0.0833037308038857px 0 1px rgba(255, 179, 0, 0.5), -0.0833037308038857px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    85% { text-shadow: 0.09769827255241735px 0 1px rgba(255, 179, 0, 0.5), -0.09769827255241735px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    90% { text-shadow: 3.443339761481782px 0 1px rgba(255, 179, 0, 0.5), -3.443339761481782px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    95% { text-shadow: 2.1841838852799786px 0 1px rgba(255, 179, 0, 0.5), -2.1841838852799786px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
    100% { text-shadow: 2.6208764473832513px 0 1px rgba(255, 179, 0, 0.5), -2.6208764473832513px 0 1px rgba(255, 100, 0, 0.3), 0 0 3px #ffb300; }
}

/* VHS glitch effect */
.vhs-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9996;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.vhs-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(255, 179, 0, 0.03) 1px,
        rgba(255, 179, 0, 0.03) 2px
    );
}

.vhs-noise {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAMAAAAp4XiDAAAAUVBMVEWFhYWDg4N3d3dtbW17e3t1dXWBgYGHh4d5eXlzc3OLi4ubm5uVlZWPj4+NjY19fX2JiYl/f39ra2uRkZGZmZlpaWmXl5dvb29xcXGTk5NnZ2c8TV1mAAAAG3RSTlNAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEAvEOwtAAAFVklEQVR4XpWWB67c2BUFb3g557T/hRo9/WUMZHlgr4Bg8Z4qQgQJlHI4A8SzFVrapvmTF9O7dmYRFZ60YiBhJRCgh1FYhiLAmdvX0CzTOpNE77ME0Zty/nWWzchDtiqrmQDeuv3powQ5ta2eN0FY0InkqDD73lT9c9lEzwUNqgFHs9VQce3TVClFCQrSTfOiYkVJQBmpbq2L6iZavPnAPcoU0dSw0SUTqz/GtrGuXfbyyBniKykOWQWGqwwMA7QiYAxi+IlPdqo+hYHnUt5ZPfnsHJyNiDtnpJyayNBkF6cWoYGAMY92U2hXHF/C1M8uP/ZtYdiuj26UdAdQQSXQErwSOMzt/XWRWAz5GuSBIkwG1H3FabJ2OsUOUhGC6tK4EMtJO0ttC6IBD3kM0ve0tJwMdSfjZo+EEISaeTr9P3wYrGjXqyC1krcKdhMpxEnt5JetoulscpyzhXN5FRpuPHvbeQaKxFAEB6EN+cYN6xD7RYGpXpNndMmZgM5Dcs3YSNFDHUo2LGfZuukSWyUYirJAdYbF3MfqEKmjM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6um/Sfj7ei6UUVk4AIl3MyD4MSSTOFgSwsH/QJWaQ5as7ZcmgBZkzjjU1UrQ74ci1gWBCSGHtuV1H2mhSnO3Wp/3fEV5a+4wz//6qy8JxjZsmxxy5+4w9CDNJY09T072iKG0EnOS0arEYgXqYnXcYHwjTtUNAcMelOd4xpkoqiTYICWFq0JSiPfPDQdnt+4/wuqcXY47QILbgAAAABJRU5ErkJggg==');
    opacity: 0.05;
    animation: noise 0.2s infinite;
}

@keyframes noise {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-1%); }
    20% { transform: translateX(1%); }
    30% { transform: translateX(-2%); }
    40% { transform: translateX(3%); }
    50% { transform: translateX(-3%); }
    60% { transform: translateX(2%); }
    70% { transform: translateX(-1%); }
    80% { transform: translateX(2%); }
    90% { transform: translateX(-2%); }
}

/* Tape glitch effect */
.tape-glitch {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 9995;
    pointer-events: none;
    opacity: 0;
}

.tape-glitch-line {
    position: absolute;
    background: rgba(255, 179, 0, 0.2);
    height: 5px;
    width: 100%;
    left: 0;
    transform: translateY(-10px);
    animation: tape-glitch 6s infinite;
}

@keyframes tape-glitch {
    0% { opacity: 0; top: -100px; }
    1% { opacity: 1; top: 120px; }
    2% { top: 150px; }
    3% { top: 150px; opacity: 0; }
    4% { top: 300px; opacity: 0; }
    5% { top: 300px; opacity: 0; }
    6% { top: 300px; opacity: 0; }
    7% { top: 300px; opacity: 0.2; }
    8% { top: 350px; opacity: 0; }
    9% { top: 400px; opacity: 0; }
    10% { top: 450px; opacity: 0; }
    11% { top: 450px; opacity: 0; }
    12% { top: 450px; opacity: 0; }
    13% { top: 500px; opacity: 0.3; }
    14% { top: 500px; opacity: 0; }
    100% { top: -100px; opacity: 0; }
}

/* TV Turn on/off animation */
.tv-on-animation {
    animation: tv-on 0.4s ease-in-out;
}

@keyframes tv-on {
    0% { transform: scale(0.1); opacity: 0; filter: brightness(5); }
    50% { transform: scale(1.02); opacity: 0.8; filter: brightness(3); }
    80% { transform: scale(0.98); opacity: 1; filter: brightness(1.5); }
    100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

/* Text Glitch Effect */
.glitch-text {
    position: relative;
    animation: glitch-text 3s infinite;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.8;
}

.glitch-text::before {
    animation: glitch-left 0.5s infinite;
    left: 2px;
    text-shadow: -1px 0 #ff0000;
    clip: rect(24px, 550px, 90px, 0);
}

.glitch-text::after {
    animation: glitch-right 0.7s infinite;
    left: -2px;
    text-shadow: 2px 0 #00ff00;
    clip: rect(85px, 550px, 140px, 0);
}

@keyframes glitch-text {
    0% { text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.05em 0 rgba(0, 255, 0, 0.75), 0.05em 0.05em 0 rgba(0, 0, 255, 0.75); }
    14% { text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75), -0.05em -0.05em 0 rgba(0, 255, 0, 0.75), 0.05em 0.05em 0 rgba(0, 0, 255, 0.75); }
    15% { text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75), 0.025em 0.025em 0 rgba(0, 255, 0, 0.75), -0.05em -0.05em 0 rgba(0, 0, 255, 0.75); }
    49% { text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75), 0.025em 0.025em 0 rgba(0, 255, 0, 0.75), -0.05em -0.05em 0 rgba(0, 0, 255, 0.75); }
    50% { text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75), 0.05em 0 0 rgba(0, 255, 0, 0.75), 0 -0.05em 0 rgba(0, 0, 255, 0.75); }
    99% { text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75), 0.05em 0 0 rgba(0, 255, 0, 0.75), 0 -0.05em 0 rgba(0, 0, 255, 0.75); }
    100% { text-shadow: -0.025em 0 0 rgba(255, 0, 0, 0.75), -0.025em -0.025em 0 rgba(0, 255, 0, 0.75), -0.025em -0.05em 0 rgba(0, 0, 255, 0.75); }
}

@keyframes glitch-left {
    0% { transform: translateX(0); }
    80% { transform: translateX(0); }
    85% { transform: translateX(-2px); }
    90% { transform: translateX(2px); }
    95% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

@keyframes glitch-right {
    0% { transform: translateX(0); }
    80% { transform: translateX(0); }
    85% { transform: translateX(2px); }
    90% { transform: translateX(-2px); }
    95% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

/* Heavy Glitch Effect */
.heavy-glitch {
    animation: heavy-glitch 0.5s ease-in-out;
    position: relative;
}

@keyframes heavy-glitch {
    0% { transform: translate(0); }
    10% { transform: translate(-5px, 3px); }
    20% { transform: translate(-10px, 5px) skewX(10deg); }
    30% { transform: translate(4px, -2px) skewX(-8deg); filter: hue-rotate(90deg); }
    40% { transform: translate(-2px, 2px); }
    50% { transform: translate(0, 5px) skewX(12deg); filter: hue-rotate(180deg); }
    60% { transform: translate(4px, 2px); }
    70% { transform: translate(-7px, -5px) skewX(-4deg); filter: hue-rotate(270deg); }
    80% { transform: translate(1px, 2px); }
    90% { transform: translate(3px, -4px) skewX(6deg); filter: brightness(2); }
    100% { transform: translate(0); filter: none; }
}

/* Rainbow overlay for the track title easter egg */
.rainbow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: rainbow-bg 3s infinite;
    pointer-events: none;
}

@keyframes chat-slide {
    0% { transform: translateY(20px) scale(0.9); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Console Bug Effect */
.console-bug {
    animation: console-bug 5s ease-in-out;
}

@keyframes console-bug {
    0% { transform: translateX(0); }
    0.5% { transform: translateX(-5px); }
    1% { transform: translateX(5px); }
    1.5% { transform: translateX(-7px); }
    2% { transform: translateX(5px); }
    2.5% { transform: translateX(0); }
    100% { transform: translateX(0); }
}

/* Easter Egg Animations */
.secret-code-anim {
    animation: secret-code 0.5s ease-in-out;
}

@keyframes secret-code {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(1); }
}

/* Button Hover Effect */
button:hover:not(.nav-arrow) {
    animation: button-flicker 1s infinite;
    position: relative;
    z-index: 1;
}

button:hover:not(.nav-arrow)::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 179, 0, 0.2);
    z-index: -1;
    opacity: 0;
    animation: phosphor-trail 0.8s ease-out;
}

@keyframes phosphor-trail {
    0% { transform: scaleX(1.1) scaleY(1.3); opacity: 0.3; }
    100% { transform: scaleX(1.5) scaleY(1.8); opacity: 0; }
}

@keyframes button-flicker {
    0% { opacity: 1; }
    49% { opacity: 1; }
    50% { opacity: 0.8; }
    51% { opacity: 1; }
    59% { opacity: 1; }
    60% { opacity: 0.8; }
    61% { opacity: 1; }
    100% { opacity: 1; }
}

/* CRT Off Animation */
.crt-off {
    animation: crt-off 0.4s ease-in;
}

@keyframes crt-off {
    0% { transform: scale(1); opacity: 1; filter: brightness(1); }
    5% { transform: scale(1.1, 0.1); opacity: 0.8; filter: brightness(10); }
    30% { transform: scale(1, 0.0001); opacity: 0.6; filter: brightness(8); }
    100% { transform: scale(0.0001); opacity: 0; filter: brightness(0); }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after,
    .crt-text,
    .vhs-noise,
    .tape-glitch,
    .glitch-text::before,
    .glitch-text::after,
    button:hover {
        animation: none !important;
    }
    
    .chat-panel-animation,
    .tv-on-animation,
    .crt-off,
    .console-bug,
    .secret-code-anim {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Rainbow overlay for Easter Egg */
.rainbow-text {
    font-size: 3rem;
    text-transform: uppercase;
    animation: rainbow-text 0.5s infinite alternate;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    font-family: 'VT323', monospace;
}

@keyframes rainbow-bg {
    0% { background-color: rgba(50, 0, 0, 0.8); }
    20% { background-color: rgba(50, 40, 0, 0.8); }
    40% { background-color: rgba(0, 50, 0, 0.8); }
    60% { background-color: rgba(0, 30, 50, 0.8); }
    80% { background-color: rgba(50, 0, 50, 0.8); }
    100% { background-color: rgba(50, 0, 0, 0.8); }
}

@keyframes rainbow-text {
    0% { color: #ff0000; }
    16.666% { color: #ff8800; }
    33.333% { color: #ffff00; }
    50% { color: #00ff00; }
    66.666% { color: #0088ff; }
    83.333% { color: #8800ff; }
    100% { color: #ff0088; }
}

.rainbow-fade {
    animation: rainbow-fade-out 1s forwards;
}

@keyframes rainbow-fade-out {
    from { opacity: 1; }
    to { opacity: 0; transform: scale(1.5); }
}
