* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Фон */
body {
    background: #0b0c10;
    position: relative;
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
            radial-gradient(ellipse at 20% 30%, rgba(26, 26, 29, 0.6) 0%, transparent 40%),
            radial-gradient(ellipse at 80% 70%, rgba(47, 49, 54, 0.4) 0%, transparent 50%),
            radial-gradient(circle at 40% 50%, rgba(24, 28, 37, 0.7) 0%, transparent 60%);
    pointer-events: none;
}

/* Контейнер для текста */
.box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Основные стили для глитч-эффекта */
.glitch {
    position: relative;
    color: rgb(255, 255, 255);
    font-size: 120px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    line-height: 1.2;
    letter-spacing: 8px;
    text-shadow: 2px 2px 15px rgba(0, 0, 0, 0.4);
    padding: 30px;
}

/* Стили для каждой буквы внутри .glitch */
.glitch span {
    display: inline-block;
    transition: font-family 0.2s ease, transform 0.1s ease;
    position: relative;
    z-index: 2;
}

/* Класс для активного глитч-эффекта на букве */
.glitch span.glitching {
    animation: subtleShake 0.08s infinite;
    text-shadow:
            -2px 0 rgba(255, 0, 0, 0.8),
            2px 0 rgba(0, 0, 255, 0.8);
}

/* Анимация дрожания */
@keyframes subtleShake {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, -1px); }
    100% { transform: translate(0, 0); }
}

/* Общие стили для псевдоэлементов глитча - обновляем, чтобы они дублировали содержимое из span */
.glitch:before,
.glitch:after {
    content: attr(data-glitch-text);
    color: rgb(255, 255, 255);
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    padding: 30px;
    width: 100%;
    height: 100%;
    background: transparent;
    text-transform: none;
    pointer-events: none;
    white-space: nowrap;
}

/* Стили для первого псевдоэлемента (красное смещение) */
.glitch:before {
    left: 2px;
    text-shadow: -4px 0 rgba(255, 0, 0, 0.8);
    animation: glitch-before 1.5s infinite steps(1) alternate;
}

/* Стили для второго псевдоэлемента (синее смещение) */
.glitch:after {
    left: -2px;
    text-shadow: 4px 0 rgba(0, 0, 255, 0.8);
    animation: glitch-after 1.8s infinite steps(1) alternate;
}

/* Анимации глитча */
@keyframes glitch-before {
    0%, 100% { clip: rect(0px, 999px, 140px, 0px); }
    10% { clip: rect(15px, 999px, 45px, 0px); }
    20% { clip: rect(65px, 999px, 95px, 0px); }
    30% { clip: rect(5px, 999px, 35px, 0px); }
    40% { clip: rect(85px, 999px, 125px, 0px); }
    50% { clip: rect(25px, 999px, 55px, 0px); }
    60% { clip: rect(45px, 999px, 85px, 0px); }
    70% { clip: rect(105px, 999px, 135px, 0px); }
    80% { clip: rect(35px, 999px, 75px, 0px); }
    90% { clip: rect(75px, 999px, 115px, 0px); }
}

@keyframes glitch-after {
    0%, 100% { clip: rect(0px, 999px, 140px, 0px); }
    12% { clip: rect(55px, 999px, 105px, 0px); }
    24% { clip: rect(95px, 999px, 135px, 0px); }
    36% { clip: rect(25px, 999px, 65px, 0px); }
    48% { clip: rect(5px, 999px, 45px, 0px); }
    60% { clip: rect(75px, 999px, 115px, 0px); }
    72% { clip: rect(115px, 999px, 145px, 0px); }
    84% { clip: rect(35px, 999px, 85px, 0px); }
    96% { clip: rect(15px, 999px, 55px, 0px); }
}

/* Адаптивность */
@media (max-width: 768px) {
    .glitch {
        font-size: 80px;
        letter-spacing: 6px;
        padding: 20px;
    }
    .glitch:before,
    .glitch:after {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .glitch {
        font-size: 50px;
        letter-spacing: 4px;
        padding: 15px;
    }
    .glitch:before,
    .glitch:after {
        padding: 15px;
    }
}