.glitch-text-container {
    display: inline-block;
    position: relative;
    overflow: visible;
}

.glitch {
    display: inline-block;
    position: relative;
    overflow: visible;
    /* font-size: xx-large; */
    color: white;
    text-shadow: 2px 0 rgba(255, 255, 255, 0.4), -2px 0 rgba(255, 255, 255, 0.4);
    height: 1.2em;
    white-space: nowrap;
}

.glitch span {
    position: absolute;
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
    text-align: center;
    transition: transform 0.1s ease, font-family 0.1s ease;
    animation: glitch 1.5s infinite;
    animation-delay: var(--animation-delay, 0s);
    left: var(--char-position);
    width: var(--char-width);
}

.glitch span.preserve-color {
    color: inherit !important;
    text-shadow: none !important;
    filter: none !important;
    font-family: inherit !important;
    text-transform: none !important;
    font-size: inherit !important;
}

.glitch-active .glitch span {
    animation: glitch 2s infinite, randomCase 1.5s infinite alternate, randomFont 1s infinite alternate;
    animation-delay: var(--animation-delay, 0s);
}

.glitch-active .glitch span.preserve-color {
    animation: glitchHover 2s infinite;
    animation-delay: var(--animation-delay, 0s);
}

.glitch-hover .glitch span {
    animation: glitchHover 0.75s infinite;
    animation-delay: var(--hover-delay, 0s);
}

.glitch-hover .glitch span.preserve-color {
    animation: glitchHover 0.75s infinite;
    animation-delay: var(--hover-delay, 0s);
}

@keyframes glitchHover {
    0% { transform: translate(0, 0); opacity: 1; }
    10% { transform: translate(-2px, -3px) skewX(-5deg); opacity: 0.8; }
    20% { transform: translate(3px, 2px) skewX(5deg); opacity: 0.9; }
    30% { transform: translate(-1px, 3px) skewX(-3deg); opacity: 0.7; }
    40% { transform: translate(2px, -2px) skewX(2deg); opacity: 1; }
    50% { transform: translate(0, 0); opacity: 1; }
    100% { transform: translate(0, 0); opacity: 1; }
}

@keyframes randomCase {
    0%, 100% {
        transform: scale(1);
        text-transform: uppercase;
    }
    50% {
        transform: scale(1.3);
        text-transform: lowercase;
    }
}

@keyframes randomFont {
    0% { font-family: 'Courier New', Courier, monospace; }
    50% { font-family: 'Arial', sans-serif; }
    100% { font-family: 'Courier New', Courier, monospace; }
}

@keyframes glitch {
    0% {
        text-shadow: 2px 0 rgba(255, 255, 255, 0.4), -2px 0 rgba(255, 255, 255, 0.4);
        transform: translate(0);
    }
    20% {
        text-shadow: -2px 0 rgba(255, 0, 0, 0.8), 2px 0 rgba(0, 255, 0, 0.8);
        transform: translate(-1px, 1px);
    }
    40% {
        text-shadow: 2px 0 rgba(0, 0, 255, 0.6), -2px 0 rgba(0, 255, 255, 0.6);
        transform: translate(1px, -1px);
    }
    60% {
        text-shadow: -2px 0 rgba(255, 0, 255, 0.6), 2px 0 rgba(255, 255, 0, 0.6);
        transform: translate(-1px, 1px);
    }
    100% {
        text-shadow: 2px 0 rgba(255, 255, 255, 0.4), -2px 0 rgba(255, 255, 255, 0.4);
        transform: translate(0);
    }
}

@keyframes glitchColors {
    0% {
        text-shadow: 2px 0 rgba(255, 255, 255, 0.4), -2px 0 rgba(255, 255, 255, 0.4);
    }
    20% {
        text-shadow: -2px 0 rgba(255, 0, 0, 0.8), 2px 0 rgba(0, 255, 0, 0.8);
    }
    40% {
        text-shadow: 2px 0 rgba(0, 0, 255, 0.6), -2px 0 rgba(0, 255, 255, 0.6);
    }
    60% {
        text-shadow: -2px 0 rgba(255, 0, 255, 0.6), 2px 0 rgba(255, 255, 0, 0.6);
    }
    100% {
        text-shadow: 2px 0 rgba(255, 255, 255, 0.4), -2px 0 rgba(255, 255, 255, 0.4);
    }
}

.glitch-colors {
    animation: glitchColors 1.5s infinite;
}
/*
@media (max-width: 1200px) {
    .glitch {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .glitch {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .glitch {
        font-size: 1rem;
    }
}
*/
.glitch-container {
    color: #fff;
    text-shadow: 0 0 5px #fff, 0 0 15px #f0f, 0 0 30px #f0f;
    overflow: visible;
    white-space: nowrap;
    margin: auto;
    position: relative;
    display: flex;
    flex: 0;
}

/* Letter spacing is now handled via absolute positioning in JavaScript */