@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600;700&display=swap');

body {
    font-family: 'Fira Code', monospace;
    background-color: #050805;
}

/* Palette Fosfori CRT */
body.theme-green { color: #22c55e; }
body.theme-green .theme-border { border-color: #22c55e; }
body.theme-amber { color: #f59e0b; }
body.theme-amber .theme-border { border-color: #f59e0b; }
body.theme-cyan { color: #06b6d4; }
body.theme-cyan .theme-border { border-color: #06b6d4; }
body.theme-vt100 { color: #e2e8f0; }
body.theme-vt100 .theme-border { border-color: #94a3b8; }

/* Effetto CRT Scanlines & Flicker */
.crt-overlay {
    background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.35) 50%),
                linear-gradient(90deg, rgba(255,0,0,0.03), rgba(0,255,0,0.01), rgba(0,0,255,0.03));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

.crt-on .crt-overlay { display: block; }
.crt-off .crt-overlay { display: none; }
body.crt-scanlines .crt-overlay { background-size: 100% 3px, 6px 100%; }
body.crt-flicker .crt-overlay { animation: crtFlicker 0.15s infinite; }

@keyframes crtFlicker {
    0% { opacity: 0.85; }
    50% { opacity: 1; }
    100% { opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
    body.crt-flicker .crt-overlay { animation: none; }
}

/* Scrollbar Custom PTWG-DOS 6.22 Style */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #020402; }
::-webkit-scrollbar-thumb { background: currentColor; opacity: 0.4; border-radius: 4px; }

/* Spegnimento TV CRT (AUTOEXEC Error) */
.crt-shutdown { animation: crtPowerOff 0.8s forwards ease-in-out; pointer-events: none; }

@keyframes crtPowerOff {
    0% { transform: scale(1,1); filter: brightness(1); }
    50% { transform: scale(1,0.005); filter: brightness(2); }
    100% { transform: scale(0,0); filter: brightness(0); opacity: 0; }
}

.interlaced-load { animation: loadLines 1.8s steps(20, end) forwards; }
@keyframes loadLines { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* PTWG-DOS 6.22 BSOD / Crash Screen */
.bsod-dos {
    background-color: #0000AA;
    color: #FFFFFF;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.5;
    padding: 40px;
    width: 100%;
    height: 100%;
    overflow: auto;
}

.bsod-dos .bsod-header {
    background-color: #AAAAAA;
    color: #0000AA;
    padding: 0 6px;
    display: inline-block;
    margin-bottom: 16px;
    font-weight: bold;
}

.bsod-dos .bsod-halt {
    background-color: #AAAAAA;
    color: #0000AA;
    padding: 0 6px;
    font-weight: bold;
    animation: bsodBlink 1s infinite;
}

@keyframes bsodBlink {
    0%,49%{opacity:1;}
    50%,100%{opacity:0;}
}

.guess-input {
    background: transparent;
    border: 1px solid currentColor;
    color: currentColor;
    font-family: inherit;
    padding: 2px 6px;
    width: 80px;
    outline: none;
}

body.mode-editor #promptLabel { color: #f59e0b; }
body.mode-editor #cliInput { caret-color: #f59e0b; }

.vk-btn {
    border: 1px solid currentColor;
    background: rgba(0,0,0,0.5);
    padding: 6px 0;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px;
    user-select: none;
    cursor: pointer;
}
.vk-btn:active { background: rgba(255,255,255,0.15); }

#lifeCanvas { image-rendering: pixelated; }

/* Spazio minimo di sicurezza sul fondo del terminale su mobile */
@media (max-width: 767px) {
    #terminalWindow {
        scroll-padding-bottom: 110px;
    }

    #terminalForm {
        scroll-margin-bottom: 110px;
    }
}