.crt-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 15;
    will-change: opacity;
    transform: translateZ(0);
}

html.compat-mode .crt-overlay {
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.2);
    background: radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.15) 100%);
}
html.compat-mode .scanlines,
html.compat-mode .crt-refresh-line {
    display: none !important;
}

html.high-perf-mode .crt-overlay {
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.3);
    background: radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
}

html.high-perf-mode .scanlines {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0),
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.2)
    );
    background-size: 100% 4px;
    pointer-events: none;
    transform: translateZ(0);
}

html.high-perf-mode .crt-refresh-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 12vh;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.01) 20%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(255, 255, 255, 0.01) 80%,
        rgba(255, 255, 255, 0) 100%
    );
    pointer-events: none;
    z-index: 2;

    will-change: transform;
    transform: translate3d(0, 0, 0);
    animation: refresh-roll 8s linear infinite;
}

html.lite-mode .crt-overlay,
html.lite-mode .scanlines,
html.lite-mode .crt-refresh-line,
body.mobile-mode .crt-overlay,
body.mobile-mode .scanlines,
body.mobile-mode .crt-refresh-line {
    display: none !important;
}

@keyframes refresh-roll {
    0% { transform: translate3d(0, -50vh, 0); }
    100% { transform: translate3d(0, 150vh, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .crt-refresh-line {
        animation: none !important;
        display: none !important;
    }
}