/* RESET E BASE */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    touch-action: none; 
}

body { 
    background-color: #000; 
    overflow: hidden; 
    width: 100vw; 
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    transition: background-color 0.8s ease; 
}

canvas { 
    display: block; 
    width: 100%; 
    height: 100%; 
}

/* UI COMUNE */
#ui, .ui-extra {
    position: absolute;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 10;
    transition: color 0.5s;
}

#ui { 
    top: 20px; 
    left: 20px; 
    font-size: 12px; 
}

.menu { 
    margin-top: 15px; 
}

/* PULSANTI */
button {
    background: none; 
    border: none; 
    font-family: 'Courier New', monospace;
    cursor: pointer; 
    padding: 5px 0; 
    display: block; 
    text-align: left; 
    transition: 0.3s; 
    opacity: 0.6;
    font-size: 12px;
}

button:hover { 
    opacity: 1; 
    text-shadow: 0 0 10px currentColor; 
}

/* HUD EXTRA */
.ui-extra { 
    font-size: 10px; 
    opacity: 0.5; 
    pointer-events: none; 
}

#ui-top-right { top: 20px; right: 20px; text-align: right; }
#ui-bottom-left { bottom: 80px; left: 20px; }
#ui-bottom-right { bottom: 80px; right: 20px; text-align: right; }

/* SELETTORE MODALITÀ */
#mode-switcher {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 20;
}

.mode-btn {
    border: 1px solid currentColor;
    padding: 10px 20px;
    font-weight: bold;
    opacity: 0.8;
    transition: all 0.3s;
    display: inline-block;
}

.mode-btn:hover { 
    background: rgba(128,128,128,0.1); 
    opacity: 1; 
}

/* --- CONFIGURAZIONE MODALITÀ --- */
.mode-1 { 
    background-color: #000; 
    color: #0f0; 
}
.mode-1 button { color: #0f0; }
.mode-1 .glitch-active { 
    color: #F5F5F7 !important; 
    text-shadow: 2px 0 #f00, -2px 0 #0ff; 
}

.mode-2 { 
    background-color: #f5f5f7; 
    color: #00f; 
}
.mode-2 button { color: #00f; }
.mode-2 .glitch-active { 
    color: #1D1D1F !important; 
    text-shadow: 2px 2px 10px rgba(0,0,255,0.5); 
}

/* BOOT SCREEN */
#boot-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: 'Courier New', monospace;
}

#boot-terminal { width: 80%; max-width: 600px; }
#boot-log {
    height: 200px;
    overflow: hidden;
    color: #0f0;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column-reverse;
}
#boot-bar-container { width: 100%; height: 4px; background: #111; border: 1px solid #0f0; position: relative; }
#boot-bar { width: 0%; height: 100%; background: #0f0; box-shadow: 0 0 10px #0f0; transition: width 0.1s; }
#boot-percentage { color: #0f0; text-align: right; margin-top: 10px; font-size: 14px; }

/* FLASH FINALE */
.flash-out { animation: flash 0.5s forwards; }
@keyframes flash {
    0% { background: #F5F5F7; opacity: 1; }
    100% { background: #000; opacity: 0; visibility: hidden; }
}