/* Классы для разных уровней производительности */

/* Стили для когда вкладка неактивна */
body.cosmic-paused * {
    animation-play-state: paused !important;
}

/* ULTRA PERFORMANCE - все эффекты включены */
body.ultra-performance .modal-title {
    animation: galaxyText 4s ease-in-out infinite;
}

/* HIGH PERFORMANCE - большинство эффектов включены */
body.high-performance .modal-title {
    animation: galaxyText 6s ease-in-out infinite;
}

body.high-performance .modal-content::after {
    animation-duration: 25s;
}

/* MEDIUM PERFORMANCE - упрощенные эффекты */
body.medium-performance .modal-title {
    /* Статичный градиент без анимации */
    animation: none;
}

body.medium-performance .modal-content::after {
    animation-duration: 40s;
}

body.medium-performance main .twinkling-stars {
    animation-duration: 12s;
    opacity: 0.6;
}

body.medium-performance footer::before {
    animation-duration: 15s;
}

body.medium-performance .bottom-navbar::after {
    animation: none;
    opacity: 0.8;
}

body.medium-performance .shooting-star {
    box-shadow: none !important;
}

/* LOW PERFORMANCE - минимум эффектов */
body.low-performance .modal-title {
    background: #fff;
    -webkit-text-fill-color: #fff;
}

body.low-performance .modal-content::after {
    display: none;
}

body.low-performance main .twinkling-stars {
    display: none; /* Полностью убираем */
}

body.low-performance footer::before {
    display: none; /* Полностью убираем */
}

body.low-performance .bottom-navbar::after {
    display: none;
}

body.low-performance .bottom-navbar-item.active::before {
    animation: none;
    opacity: 0.7; /* Статичный */
}

body.low-performance .shooting-star,
body.low-performance .cosmic-particle {
    display: none;
}

body.low-performance .menu-item::before {
    display: none;
}

/* АГРЕССИВНО: Убираем ВСЕ переходы */
body.low-performance *,
body.low-performance *::before,
body.low-performance *::after {
    transition-duration: 0.1s !important;
    animation: none !important;
}

/* ULTRA-LOW PERFORMANCE - эффекты полностью отключены */
body.ultra-low-performance main .twinkling-stars,
body.ultra-low-performance .shooting-stars-container,
body.ultra-low-performance footer::before,
body.ultra-low-performance .modal-content::after,
body.ultra-low-performance .cosmic-particle,
body.ultra-low-performance .bottom-navbar::after,
body.ultra-low-performance .bottom-navbar-item.active::before,
body.ultra-low-performance .menu-item::before,
body.ultra-low-performance .menu-item::after {
    display: none !important;
}

body.ultra-low-performance * {
    animation: none !important;
    transition-duration: 0.1s !important;
}

body.ultra-low-performance .modal-title {
    background: none;
    color: #fff;
    -webkit-text-fill-color: #fff;
}

body.ultra-low-performance .income-display {
    backdrop-filter: none;
    background: rgba(0, 20, 40, 0.95);
}

/* Дополнительные оптимизации для backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    .income-display {
        backdrop-filter: none;
        background: rgba(0, 20, 40, 0.95);
    }
}

/* Адаптивная оптимизация для разных разрешений */
@media (max-width: 480px) {
    /* АГРЕССИВНО: На маленьких экранах убираем ВСЁ */
    body main .twinkling-stars,
    body .shooting-star,
    body footer::before,
    body .modal-content::after,
    body .bottom-navbar::after,
    body .cosmic-particle {
        display: none !important;
    }
    
    /* Убираем ВСЕ анимации */
    body *,
    body *::before,
    body *::after {
        animation: none !important;
        transition-duration: 0.05s !important;
    }
}

@media (max-width: 768px) {
    /* На средних экранах тоже агрессивно оптимизируем */
    body:not(.ultra-performance) main .twinkling-stars {
        display: none;
    }
    
    body:not(.ultra-performance) .shooting-star {
        display: none;
    }
    
    body:not(.ultra-performance) footer::before {
        display: none;
    }
    
    body:not(.ultra-performance) .modal-content::after {
        display: none;
    }
}

@media (min-width: 1920px) and (min-height: 1080px) {
    /* На больших экранах можем позволить больше эффектов */
    body.ultra-performance .shooting-star:nth-child(n+10) {
        display: block;
    }
}

/* Оптимизация для режима энергосбережения */
@media (prefers-color-scheme: dark) {
    /* В темном режиме можем немного снизить яркость */
    body.medium-performance main .twinkling-stars,
    body.low-performance main .twinkling-stars {
        opacity: 0.3;
    }
}

/* Плавные переходы между режимами */
body {
    transition: none;
}

body * {
    transition-property: opacity, transform, background-color, color, border-color;
}

/* Отключение анимаций для accessibility */
@media (prefers-reduced-motion: reduce) {
    body * {
        animation: none !important;
        transition-duration: 0.01s !important;
    }
    
    .shooting-stars-container,
    main .twinkling-stars,
    footer::before,
    .modal-content::after {
        display: none !important;
    }
}

/* Оптимизация для старых браузеров */
@supports not (transform: translate3d(0, 0, 0)) {
    .shooting-star,
    .shooting-star-tail {
        display: none;
    }
}

/* Добавляем индикатор производительности (для разработки) */
body::after {
    content: '';
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 99999;
    display: none; /* Скрыто по умолчанию */
}

/* Показываем индикатор только в режиме разработки */
body[data-debug="true"]::after {
    display: block;
}

body.ultra-performance[data-debug="true"]::after {
    background: #00ff00; /* Зеленый */
    box-shadow: 0 0 10px #00ff00;
}

body.high-performance[data-debug="true"]::after {
    background: #90EE90; /* Светло-зеленый */
    box-shadow: 0 0 10px #90EE90;
}

body.medium-performance[data-debug="true"]::after {
    background: #ffff00; /* Желтый */
    box-shadow: 0 0 10px #ffff00;
}

body.low-performance[data-debug="true"]::after {
    background: #ffa500; /* Оранжевый */
    box-shadow: 0 0 10px #ffa500;
}

body.ultra-low-performance[data-debug="true"]::after {
    background: #ff0000; /* Красный */
    box-shadow: 0 0 10px #ff0000;
}
