/* Setup globale stile Terminale CRT */
* {
    box-sizing: border-box; /* FIX CRITICO: impedisce a padding e bordi di rompere le larghezze */
}

body {
    background-color: #0a0f0d;
    color: #33ff33;
    font-family: 'Courier New', Courier, monospace;
    padding: 20px;
    line-height: 1.6;
    overflow-x: hidden; /* Evita fastidiosi scroll orizzontali */
}

/* Selezione testo stile terminale */
::selection {
    background: #33ff33;
    color: #0a0f0d;
}

header,
section,
footer {
    max-width: 800px;
    width: 100%;
    margin: 0 auto 40px auto;
    border: 1px solid #33ff33;
    padding: 20px;
    box-shadow: 0 0 10px rgba(51, 255, 51, 0.2);
    overflow: hidden; /* Protezione extra per i bordi del terminale */
}

/* Gestione globale dei titoli corretta */
h1,
h2,
h3 {
    color: #33ff33;
    border-bottom: 1px dashed #33ff33;
    padding-bottom: 5px;
    white-space: normal; /* FIX: permette ai titoli lunghi di andare a capo invece di tagliare lo schermo */
    word-break: break-all; /* Spezza i path tipo ~/root_directory/sys_attack se necessario */
}

/* Titolo Principale nell'Header */
header h1 {
    font-size: 2.2rem;
    line-height: 1.3;
    margin-top: 10px;
}

/* Sottotitoli delle Sezioni */
section h2 {
    font-size: 1.8rem;
}

section h3 {
    font-size: 1.4rem;
}

h1::before {
    content: "> ";
}

h2::before {
    content: "# ";
}

/* Struttura dei Log nell'Header */
.header-logs {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 15px;
}

a {
    color: #00ffff;
    text-decoration: none;
}

a:hover {
    background-color: #33ff33;
    color: #0a0f0d;
}

/* Griglia dei progetti responsiva */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    width: 100%;
}

@media (min-width: 600px) {
    .project-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.project-card,
.info-card {
    border: 1px dashed #33ff33;
    padding: 15px;
    background: rgba(51, 255, 51, 0.02);
    margin-bottom: 15px;
    width: 100%;
    overflow-wrap: break-word; /* Forza la descrizione ad andare a capo prima di toccare i bordi */
    word-wrap: break-word;
}

.status {
    font-weight: bold;
    color: #ffb300;
}

.cursor {
    animation: blink 1s infinite;
}

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

/* Stile Terminale Interattivo per il Basket / Giochi */
.terminal-box {
    background-color: #000;
    border: 1px solid #33ff33;
    padding: 15px;
    font-family: monospace;
    margin-top: 15px;
    max-width: 100%;
    overflow-x: auto; /* Permette lo scroll interno nei giochi se lo schermo è minuscolo */
}

.terminal-input-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.terminal-btn {
    background: #33ff33;
    color: #0a0f0d;
    border: none;
    padding: 5px 15px;
    font-family: monospace;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.terminal-btn:hover:not(:disabled) {
    background: #fff;
}

.terminal-btn:disabled {
    background: #225522;
    color: #0a0f0d;
    cursor: not-allowed;
}

/* Punteggio */
.score-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffb300;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.score-display::before {
    content: "[★] ";
}

/* --- SCREEN FIX COMPLETO PER MOBILE --- */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    header, section, footer {
        padding: 12px; /* Riduce il padding interno per dare più spazio ai contenuti */
    }

    header h1 {
        font-size: 5.3vw;
    }

    section h2 {
        font-size: 4.2vw;
    }

    section h3 {
        font-size: 4.5vw;
    }
}

html {
    scroll-behavior: smooth;
}

.project-links a {
    margin-right: 15px;
    text-transform: uppercase;
}