@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Courier Prime', 'Courier New', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: background-color 0.5s ease;
}

.crt {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Container for ASCII art */
.container {
    position: relative;
    z-index: 10;
    text-align: center;
}

.ascii-art {
    color: #ffffff;
    font-size: clamp(8px, 1.5vw, 16px);
    line-height: 1.2;
    letter-spacing: 0.05em;
    white-space: pre;
    font-weight: 700;
    /* REMOVED ALL GLOW EFFECTS - NO TEXT-SHADOW */
    animation: flicker 0.15s infinite alternate;
    user-select: none;
    /* Removed transition for text-shadow */
}

/* Vignette effect - REDUCED TO 30% */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 40%,
        rgba(0, 0, 0, 0.06) 60%,
        rgba(0, 0, 0, 0.18) 90%,
        rgba(0, 0, 0, 0.24) 100%
    );
    z-index: 2;
}

/* Scanlines effect - DOUBLED VISIBILITY */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.06) 2px,
            rgba(0, 0, 0, 0.06) 4px
        );
    animation: scanlines 8s linear infinite;
}

.scanlines::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.04) 2px,
            rgba(0, 0, 0, 0.04) 4px
        );
}

/* CRT curve effect - ALSO REDUCED */
.crt::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(
            ellipse at center,
            transparent 0%,
            transparent 70%,
            rgba(0, 0, 0, 0.03) 90%,
            rgba(0, 0, 0, 0.12) 100%
        );
    pointer-events: none;
    z-index: 4;
}

/* Subtle flicker animation */
@keyframes flicker {
    0% {
        opacity: 0.97;
    }
    100% {
        opacity: 1;
    }
}

/* Scanline movement */
@keyframes scanlines {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 10px;
    }
}

/* REMOVED OLD RGB SHIFT - Will be replaced with triple split effect */

/* Responsive adjustments */
@media (max-width: 768px) {
    .ascii-art {
        font-size: clamp(4px, 1.2vw, 10px);
        transform: rotate(90deg);
    }
}

@media (max-width: 480px) {
    .ascii-art {
        font-size: clamp(4px, 3vw, 10px);
        letter-spacing: 0.02em;
    }
}

/* Add subtle screen glow */
body::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.01) 0%,
        transparent 50%
    );
    pointer-events: none;
    z-index: 1;
}

/* REMOVED GLOW FADE ANIMATIONS - No longer needed */

/* TRIPLE RGB Split Effect Classes */
.rgb-split-effect {
    position: relative;
    animation: rgb-split-intensify 0.6s ease-in-out forwards;
    will-change: transform;
}

/* Create THREE pseudo-elements for triple split effect using ::before, ::after, and a third layer */
.rgb-split-effect::before,
.rgb-split-effect::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    white-space: pre;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    font-weight: inherit;
}

/* Third split layer using a span element that will be injected via JavaScript */
.rgb-split-third-layer {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    white-space: pre;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    font-weight: inherit;
    color: rgba(0, 255, 0, 0.35); /* Green channel with reduced opacity */
    mix-blend-mode: screen;
    z-index: 3;
}

/* First split - Red channel moving diagonally up-left with reduced opacity */
.rgb-split-effect::before {
    color: rgba(255, 0, 0, 0.35); /* Reduced from 0.7 to 0.35 */
    mix-blend-mode: screen;
    animation: rgb-triple-split-1 0.6s ease-in-out forwards;
    z-index: 1;
    /* NO GLOW */
}

/* Second split - Cyan channel moving diagonally down-right with reduced opacity */
.rgb-split-effect::after {
    color: rgba(0, 255, 255, 0.35); /* Reduced from 0.7 to 0.35 */
    mix-blend-mode: screen;
    animation: rgb-triple-split-2 0.6s ease-in-out forwards;
    z-index: 2;
    /* NO GLOW */
}

/* Triple split animations - three different directions */
@keyframes rgb-triple-split-1 {
    /* Red channel - moves diagonally up-left */
    0% { transform: translate(0, 0); opacity: 0; }
    10% { transform: translate(-2px, -2px); opacity: 0.2; }
    15% { transform: translate(0, 0); opacity: 0; }
    25% { transform: translate(-6px, -6px); opacity: 0.25; }
    35% { transform: translate(1px, 1px); opacity: 0.1; }
    45% { transform: translate(-1px, -1px); opacity: 0.15; }
    50% { transform: translate(0, 0); opacity: 0; }
    60% { transform: translate(-4px, -4px); opacity: 0.2; }
    65% { transform: translate(0, 0); opacity: 0; }
    85% { transform: translate(-5px, -5px); opacity: 0.3; }
    100% { transform: translate(-8px, -8px); opacity: 0.35; }
}

@keyframes rgb-triple-split-2 {
    /* Cyan channel - moves diagonally down-right */
    0% { transform: translate(0, 0); opacity: 0; }
    10% { transform: translate(2px, 2px); opacity: 0.2; }
    15% { transform: translate(0, 0); opacity: 0; }
    25% { transform: translate(6px, 6px); opacity: 0.25; }
    35% { transform: translate(-1px, -1px); opacity: 0.1; }
    45% { transform: translate(1px, 1px); opacity: 0.15; }
    50% { transform: translate(0, 0); opacity: 0; }
    60% { transform: translate(4px, 4px); opacity: 0.2; }
    65% { transform: translate(0, 0); opacity: 0; }
    85% { transform: translate(5px, 5px); opacity: 0.3; }
    100% { transform: translate(8px, 8px); opacity: 0.35; }
}

@keyframes rgb-triple-split-3 {
    /* Green channel - moves horizontally */
    0% { transform: translateX(0); opacity: 0; }
    10% { transform: translateX(-3px); opacity: 0.2; }
    15% { transform: translateX(0); opacity: 0; }
    25% { transform: translateX(9px); opacity: 0.25; }
    35% { transform: translateX(-1px); opacity: 0.1; }
    45% { transform: translateX(2px); opacity: 0.15; }
    50% { transform: translateX(0); opacity: 0; }
    60% { transform: translateX(-6px); opacity: 0.2; }
    65% { transform: translateX(0); opacity: 0; }
    85% { transform: translateX(7px); opacity: 0.3; }
    100% { transform: translateX(-10px); opacity: 0.35; }
}

/* Directional split variations for variety */
.rgb-split-vertical .rgb-split-third-layer {
    animation: rgb-triple-split-3-vertical 0.6s ease-in-out forwards;
}

@keyframes rgb-triple-split-3-vertical {
    /* Green channel - moves vertically for vertical variant */
    0% { transform: translateY(0); opacity: 0; }
    10% { transform: translateY(-3px); opacity: 0.2; }
    15% { transform: translateY(0); opacity: 0; }
    25% { transform: translateY(9px); opacity: 0.25; }
    35% { transform: translateY(-1px); opacity: 0.1; }
    45% { transform: translateY(2px); opacity: 0.15; }
    50% { transform: translateY(0); opacity: 0; }
    60% { transform: translateY(-6px); opacity: 0.2; }
    65% { transform: translateY(0); opacity: 0; }
    85% { transform: translateY(7px); opacity: 0.3; }
    100% { transform: translateY(-10px); opacity: 0.35; }
}

/* RGB Collapse animations - brings all three split channels back together */
.rgb-split-collapse::before,
.rgb-split-collapse::after,
.rgb-split-collapse .rgb-split-third-layer {
    animation-duration: 0.4s !important;
    animation-timing-function: ease-in !important;
    animation-fill-mode: forwards !important;
}

.rgb-split-collapse::before {
    animation-name: rgb-collapse-1 !important;
}

.rgb-split-collapse::after {
    animation-name: rgb-collapse-2 !important;
}

.rgb-split-collapse .rgb-split-third-layer {
    animation-name: rgb-collapse-3 !important;
}

/* Triple collapse animations */
@keyframes rgb-collapse-1 {
    0% { transform: translate(-8px, -8px); opacity: 0.35; }
    60% { transform: translate(-3px, -3px); opacity: 0.2; }
    100% { transform: translate(0, 0); opacity: 0; }
}

@keyframes rgb-collapse-2 {
    0% { transform: translate(8px, 8px); opacity: 0.35; }
    60% { transform: translate(3px, 3px); opacity: 0.2; }
    100% { transform: translate(0, 0); opacity: 0; }
}

@keyframes rgb-collapse-3 {
    0% { transform: translateX(-10px); opacity: 0.35; }
    60% { transform: translateX(-4px); opacity: 0.2; }
    100% { transform: translateX(0); opacity: 0; }
}

@keyframes rgb-split-intensify {
    /* Glitchy contrast and saturation changes */
    0% {
        filter: contrast(1) saturate(1);
    }
    10% {
        filter: contrast(1.1) saturate(0.95);
    }
    15% {
        filter: contrast(1) saturate(1);
    }
    25% {
        filter: contrast(1.3) saturate(0.85);
    }
    35% {
        filter: contrast(1.05) saturate(0.98);
    }
    45% {
        filter: contrast(1.1) saturate(0.96);
    }
    50% {
        filter: contrast(1) saturate(1);
    }
    60% {
        filter: contrast(1.2) saturate(0.9);
    }
    65% {
        filter: contrast(1) saturate(1);
    }
    85% {
        filter: contrast(1.4) saturate(0.85);
    }
    100% {
        filter: contrast(1.5) saturate(0.8);
    }
}

/* Background darkening overlay */
.darkening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    animation: darken-background 1s ease-in-out forwards;
}

@keyframes darken-background {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 0.65;
    }
}

/* Fade-out animation for darkening overlay */
.darkening-overlay-fade-out {
    animation: fade-out-overlay 0.6s ease-out forwards;
}

@keyframes fade-out-overlay {
    from {
        opacity: 0.65;
    }
    to {
        opacity: 0;
    }
}

/* Animation for the refresh effect */
.refreshing {
    animation: crt-refresh 0.75s ease-in-out;
}

@keyframes crt-refresh {
    0% {
        opacity: 1;
        transform: scale(1) skewX(0);
    }
    20% {
        opacity: 0.5;
        transform: scale(1.05, 0.9) skewX(-5deg);
    }
    49% {
        opacity: 0;
        transform: scale(1.1, 0.85) skewX(10deg);
    }
    50% {
        opacity: 0;
        transform: scale(1.1, 0.85) skewX(-10deg);
    }
    80% {
        opacity: 0.5;
        transform: scale(0.95, 1.05) skewX(5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) skewX(0);
    }
}
