/* 性能优化样式 - 减少动画和效果对性能的影响 */

/* 1. 减少动画数量，优化性能 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        animation-delay: 0.01ms !important;
    }
    
    .scanline,
    .noise,
    .grid-bg,
    .matrix-container {
        display: none !important;
    }
}

/* 2. 优化硬件加速 */
.about-title,
#j-validator,
.music-main,
.aplayer {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* 3. 减少重绘和重排 */
* {
    will-change: auto;
}

/* 4. 优化滚动性能 */
body {
    overflow-y: scroll;
    scroll-behavior: smooth;
}

/* 5. 优化图像渲染 */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 6. 减少阴影和模糊效果 */
@media (max-width: 768px) {
    .about-title {
        text-shadow: 0 0 5px #0f0 !important;
    }
    
    #j-validator,
    .music-main {
        box-shadow: 0 0 10px rgba(0, 255, 0, 0.2) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    .scanline {
        height: 2px !important;
        opacity: 0.2 !important;
    }
    
    .noise {
        opacity: 0.03 !important;
    }
    
    .grid-bg {
        background-size: 30px 30px !important;
        opacity: 0.05 !important;
    }
}

/* 7. 优化字体渲染 */
body {
    text-rendering: optimizeSpeed;
    font-feature-settings: "kern" 1;
    font-kerning: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 8. 减少CSS动画对GPU的占用 */
.scanline {
    transform: translateZ(0);
}

.noise {
    transform: translateZ(0);
}

.grid-bg {
    transform: translateZ(0);
}

/* 9. 优化输入框性能 */
input, textarea, select {
    transform: translateZ(0);
}

/* 10. 禁用不必要的动画 */
@media (max-width: 480px) {
    .about-title {
        animation: none !important;
    }
    
    .scanline {
        animation: none !important;
        display: none !important;
    }
    
    .noise {
        animation: none !important;
        opacity: 0.02 !important;
    }
}

/* 11. 优化APlayer性能 */
.aplayer {
    contain: layout style paint;
}

/* 12. 减少JavaScript触发的样式变化 */
#j-input:focus,
#j-submit:hover,
#j-back:hover {
    transform: translateZ(0) scale(1.02);
    transition: transform 0.2s ease !important;
}

/* 13. 优化列表渲染 */
.music-type label {
    contain: content;
}

/* 14. 减少图层数量 */
.about > div {
    isolation: isolate;
}

/* 15. 优化滚动条渲染 */
::-webkit-scrollbar {
    width: 6px !important;
}

::-webkit-scrollbar-track {
    background: rgba(0, 10, 0, 0.5) !important;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 0, 0.3) !important;
}

/* 16. 优化按钮点击效果 */
.am-btn:active {
    transform: translateZ(0) scale(0.98);
    transition: transform 0.1s ease !important;
}

/* 17. 减少边框阴影 */
.am-form-field {
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.1) !important;
}

.am-form-field:focus {
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3) !important;
}

/* 18. 优化背景效果 */
.about::before,
.about::after {
    content: none !important;
}

/* 19. 简化黑客主题效果 */
.binary-code {
    text-shadow: 0 0 3px #0f0 !important;
}

.terminal-cursor {
    animation-duration: 1.5s !important;
}

/* 20. 最终性能优化 */
@media (max-width: 1024px) {
    /* 在平板设备上减少效果 */
    .scanline {
        animation-duration: 8s !important;
    }
    
    .noise {
        animation-duration: 1s !important;
    }
}

@media (max-width: 320px) {
    /* 在非常小的屏幕上禁用所有动画 */
    * {
        animation: none !important;
        transition: none !important;
    }
    
    .scanline,
    .noise,
    .grid-bg,
    .matrix-container {
        display: none !important;
    }
}