.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    inset: 0; /* добавлено для надёжного центрирования */
    box-sizing: border-box; /* добавлено для корректного расчёта размеров */
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease-out;
}

.preloader-content {
    text-align: center;
    max-width: 350px;
    margin: 0 auto;
    width: 100%;
    /* Убираем возможные внешние отступы */
    padding: 0;
    box-sizing: border-box;
}

.brand {
    margin-bottom: 40px;
}

.logo-animation {
    font-size: 4em;
    font-weight: 700;
    color: #fff;
    white-space: nowrap; /* предотвращает перенос букв */
}

.logo-animation span {
    display: inline-block;
    animation: letterAnimation 2s ease-in-out infinite;
    background: linear-gradient(45deg, #fff, #7f7fd5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

/* Индивидуальные задержки и вариации анимации для каждой буквы */
.logo-animation span:nth-child(1) { animation-delay: 0.1s; }
.logo-animation span:nth-child(2) { 
    animation: letterRotate 2s ease-in-out infinite;
    animation-delay: 0.2s; 
}
.logo-animation span:nth-child(3) { 
    animation: letterScale 2s ease-in-out infinite;
    animation-delay: 0.3s; 
}
.logo-animation span:nth-child(4) { 
    animation: letterBounce 2s ease-in-out infinite;
    animation-delay: 0.4s; 
}
.logo-animation span:nth-child(5) { 
    animation: letterFade 2s ease-in-out infinite;
    animation-delay: 0.5s; 
}
.logo-animation span:nth-child(6) { 
    animation: letterRotateScale 2s ease-in-out infinite;
    animation-delay: 0.6s; 
}
.logo-animation span:nth-child(7) { 
    animation: letterJump 2s ease-in-out infinite;
    animation-delay: 0.7s; 
}

@keyframes letterAnimation {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes letterRotate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(360deg); }
}

@keyframes letterScale {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.5); }
}

@keyframes letterBounce {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-30px); }
    60% { transform: translateY(-15px); }
}

@keyframes letterFade {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

@keyframes letterRotateScale {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
}

@keyframes letterJump {
    0%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-40px) scale(1.2); }
    60% { transform: translateY(-20px) scale(1.1); }
}

.loading-animation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.circle {
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    animation: bounce 0.5s alternate infinite;
}

.circle:nth-child(2) { animation-delay: 0.2s; }
.circle:nth-child(3) { animation-delay: 0.4s; }

.loading-text {
    color: #fff;
    font-size: 1.2em;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulse 1.5s infinite;
}

.loading-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #7f7fd5, #86a8e7, #91eae4);
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(127, 127, 213, 0.7);
}

@keyframes bounce {
    to { transform: translateY(-15px); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .logo-animation {
        font-size: 3em;
    }

    .loading-progress {
        width: 250px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .logo-animation span,
    .circle {
        animation: none;
    }
}
