:root {
    --bg-color: #000000;
    --text-white: #ffffff;
    --text-green: #00ff00;
    --text-yellow: #ffff00;
    --text-cyan: #00ffff;
    --text-magenta: #ff00ff;
    --text-red: #ff0000;
    --text-blue: #0000ff;
    --black: #000000;
    --dark-gray: #1a1a1a;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    font-family: 'VT323', monospace;
    font-size: 26px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.green-text { color: var(--text-green); }
.white-text { color: var(--text-white); }
.yellow-text { color: var(--text-yellow); }
.cyan-text { color: var(--text-cyan); }
.magenta-text { color: var(--text-magenta); }
.black-text { color: var(--black); }

.red-bg { background-color: var(--text-red); }
.green-bg { background-color: var(--text-green); }
.yellow-bg { background-color: var(--text-yellow); }
.cyan-bg { background-color: var(--text-cyan); }

.crt-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 1px 1px, #a0a0a0 1px, transparent 1px);
    background-size: 3px 3px;
    opacity: 0.15;
    pointer-events: none;
    z-index: 100;
}

.crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    z-index: 101;
    pointer-events: none;
}

.startup-bars {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    z-index: 90; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    animation: startupSequence 3s forwards;
    animation-delay: 0.5s;
}

.bar-container { 
    width: 80%; 
    height: 60%; 
    display: flex; 
}
.bar { flex: 1; height: 100%; }
.bar.white { background-color: var(--text-white); }
.bar.yellow { background-color: var(--text-yellow); }
.bar.cyan { background-color: var(--text-cyan); }
.bar.green { background-color: var(--text-green); }
.bar.magenta { background-color: var(--text-magenta); }
.bar.red { background-color: var(--text-red); }
.bar.blue { background-color: var(--text-blue); }
.bar.black { background-color: var(--dark-gray); }

.startup-text { margin-top: 20px; color: var(--text-white); animation: blink 0.5s step-end infinite; background-color: var(--black); padding: 0 10px; }

@keyframes startupSequence {
    0% { opacity: 1; transform: scaleY(1); visibility: visible; }
    70% { opacity: 1; transform: scaleY(1); }
    80% { opacity: 1; transform: scaleY(0.01) scaleX(1); }
    90% { opacity: 0; transform: scaleY(0.01) scaleX(0); visibility: hidden; }
    100% { opacity: 0; transform: scaleY(0.01) scaleX(0); visibility: hidden; }
}

.main-content {
    width: 90%; max-width: 900px; height: 90%;
    display: none; opacity: 0; transition: opacity 0.3s ease-in;
    flex-direction: column;
}
.main-content.visible { display: flex; opacity: 1; }

.teletext-header {
    display: flex; 
    flex-direction: column;
    margin-bottom: 20px;
}

.header-top {
    display: flex; 
    justify-content: space-between;
    background-color: var(--bg-color);
    padding: 5px 15px;
}

.page-number { font-size: 1.2em; }

.name-banner {
    width: 100%;
    margin-top: 10px;
    padding: 12px 0; 
    text-align: center;
    background: linear-gradient(
        to bottom,
        var(--text-blue) 0%,
        var(--text-blue) 33.33%,
        var(--black) 33.33%,
        var(--black) 66.66%,
        var(--text-blue) 66.66%,
        var(--text-blue) 100%
    );
    border-top: 4px solid var(--black);
    border-bottom: 4px solid var(--black);
    margin-bottom: 20px;
}

.banner-text {
    color: var(--text-yellow);
    font-family: 'Press Start 2P', monospace;
    font-size: 1.4em; 
    line-height: 1;
    display: inline-block;
    transform: scaleX(1.3); 
    letter-spacing: 1px; 
    text-shadow: none;
}

.teletext-subheader {
    text-align: center; 
    margin-bottom: 30px; 
    letter-spacing: 1px;
}

.content-grid {
    display: grid; grid-template-columns: 1fr 2fr; gap: 20px; flex-grow: 1;
}

.teletext-menu ul { list-style: none; padding: 0; margin: 0; }
.teletext-menu li {
    margin-bottom: 15px; padding: 5px 10px; cursor: pointer; 
    border: 2px solid transparent; transition: background 0.1s;
}

.teletext-menu li:hover, .teletext-menu li.active {
    background-color: var(--text-white);
    color: var(--black);
}
.teletext-menu li:hover .nav-number, .teletext-menu li.active .nav-number,
.teletext-menu li:hover .nav-text, .teletext-menu li.active .nav-text {
    color: var(--black); 
}

.nav-number { color: var(--text-yellow); margin-right: 15px; }
.nav-text { color: var(--text-cyan); }

.info-section { border-left: 2px dashed var(--text-white); padding-left: 20px; }
.info-section h2 { margin-top: 0; }
.project-item { margin-bottom: 20px; }
.project-item h3 { margin: 0 0 5px 0; font-size: 1em; }
.project-item p { margin: 0; font-size: 0.9em; }

.fastext-footer {
    display: flex; justify-content: space-between;
    margin-top: auto; padding-top: 20px;
}
.fastext-btn {
    flex: 1; text-align: center; padding: 10px 0; margin: 0 5px;
    font-weight: bold; cursor: pointer;
}
.fastext-btn:hover {
    filter: brightness(1.5); 
}

@keyframes blink { 50% { opacity: 0; } }

.info-section { 
    border-left: 2px dashed var(--text-white); 
    padding-left: 20px; 
    overflow-y: auto; 
    max-height: 55vh; 
    scrollbar-width: none; 
}
.info-section::-webkit-scrollbar {
    display: none; 
}

.page-content {
    display: none; 
}
.page-content.active-page {
    display: block; 
}

.flicker-effect {
    animation: tvWipe 0.2s step-end;
}

@keyframes tvWipe {
    0% { opacity: 0; }
    50% { opacity: 0; background-color: var(--text-white); }
    100% { opacity: 1; }
}

.project-link-block {
    text-decoration: none; 
    color: inherit;
    display: block;
    margin-bottom: 20px;
}

.clickable-item {
    transition: background 0.1s;
    cursor: pointer;
}

.clickable-item:hover {
    background-color: var(--text-blue);
}
.clickable-item:hover h3, .clickable-item:hover p {
    color: var(--text-white);
}

.tele-link {
    text-decoration: none; 
    display: inline-block;
    margin-top: 5px;
    border-bottom: 2px dashed var(--text-yellow); 
    transition: background 0.1s, color 0.1s;
}

.tele-link:hover {
    background-color: var(--text-yellow);
    color: var(--black);
}

.contact-list .project-item {
    margin-bottom: 20px;
}

.contact-list .project-item h3 {
    margin-bottom: 5px;
}

.badge-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.tech-badge {
    padding: 4px 10px;
    font-family: 'VT323', monospace;
    font-size: 0.9em;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--text-white); 
}

.blue-bg { background-color: var(--text-blue); }
.black-bg { background-color: var(--black); }
.white-bg { background-color: var(--text-white); }
.magenta-bg { background-color: var(--text-magenta); }
.border-white { border: 2px solid var(--text-white); box-shadow: none; }

#page-2 h3 {
    margin-bottom: 10px;
    font-size: 1.1em;
}

.tv-off-effect {
    animation: tvOff 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
    transform-origin: center center;
}

@keyframes tvOff {
    0% { transform: scaleX(1) scaleY(1); opacity: 1; filter: brightness(1); }
    40% { transform: scaleX(1) scaleY(0.01); opacity: 1; filter: brightness(4); } 
    100% { transform: scaleX(0) scaleY(0.01); opacity: 0; filter: brightness(0); } 
}

/* --- NUOVO: SCHERMATA NEVE (ESCI) --- */
.static-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 200; /* Livello altissimo per coprire tutto il resto */
    display: none; /* Nascosta di default */
    justify-content: center;
    align-items: center;
    background-color: var(--black);
    cursor: pointer; 
}

.static-screen video {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; 
    opacity: 0.5; 
    z-index: 1;
}

.power-button {
    position: relative;
    z-index: 2; 
    color: var(--text-green);
    background-color: rgba(0, 0, 0, 0.85);
    padding: 20px 40px;
    border: 4px solid var(--text-green);
    font-family: 'Press Start 2P', monospace;
    font-size: 1.5em;
    text-align: center;
    animation: blink 1s step-end infinite;
}

/* --- TASTO CAMBIO LINGUA (Top Right) --- */
/* --- HEADER CONTROLS (Lingua + Orologio) --- */
.header-top {
    display: flex; 
    justify-content: space-between;
    align-items: center; /* Mantiene orologio e bottoni allineati verticalmente */
    background-color: var(--bg-color);
    padding: 5px 15px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px; /* Spazio tra i bottoni lingua e l'orologio */
}

/* --- TASTO CAMBIO LINGUA (Stile Teletext in alto a destra) --- */
.lang-switcher {
    display: flex;
    gap: 5px; /* Spazio tra il bottone IT e il bottone EN */
}

.lang-btn {
    cursor: pointer;
    font-family: 'VT323', monospace;
    font-size: 0.9em; /* Dimensione ridotta */
    padding: 2px 6px; /* Bordi più vicini al testo */
    
    /* Stile inattivo */
    color: var(--text-green);
    background-color: var(--black);
    border: 2px solid var(--text-green); /* Bordo assottigliato a 2px */
    line-height: 1;
}

/* Stile attivo: Sfondo verde, testo nero (esattamente come in foto) */
.lang-btn.active {
    background-color: var(--text-green);
    color: var(--black);
}

/* --- SCHERMATA AVATAR FLASH (REBOOT) --- */
.flash-avatar {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--black);
    z-index: 300; /* Sopra le bande di avvio */
    display: none; /* Nascosto di default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.flash-avatar img {
    height: 70%; /* Altezza dell'immagine */
    image-rendering: pixelated; /* Mantiene i pixel definiti */
    border: 4px solid var(--text-cyan);
    box-shadow: 0 0 15px var(--text-cyan);
}

.avatar-tag {
    margin-top: 20px;
    font-family: 'Press Start 2P', monospace;
    color: var(--text-cyan);
    font-size: 1.2em;
    animation: blink 0.5s step-end infinite;
}

/* --- TESTO COPIABILE (Email) --- */
.copy-text {
    display: inline-block;
    margin-top: 5px;
    font-family: inherit;
    /* Permette di selezionare l'intera stringa con un solo click/tap */
    -webkit-user-select: all;
    user-select: all; 
    cursor: text;
}

/* ========================================================================= */
/* --- RESPONSIVITÀ PER SMARTPHONE E TABLET --- */
/* ========================================================================= */
/* ========================================================================= */
/* --- RESPONSIVITÀ PER SMARTPHONE E TABLET --- */
/* ========================================================================= */
@media (max-width: 768px) {
    body {
        font-size: 17px; 
        overflow-y: auto; /* Sblocca lo scorrimento su mobile! */
        height: auto;
        min-height: 100vh;
        padding: 20px 0;
        align-items: flex-start; /* Fa partire il sito dall'alto anziché centrarlo forzatamente */
    }
    
    .main-content {
        width: 95%; 
        height: auto; /* Rimuove il limite del 90% di altezza */
    }

    /* Riorganizza l'intestazione */
    .header-top {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .header-controls {
        width: 100%;
        justify-content: space-between;
    }

    .name-banner {
        padding: 8px 0;
        margin-bottom: 10px;
    }

    .banner-text {
        font-size: 1.1em;
        transform: scaleX(1.1); /* Riduce la dilatazione orizzontale */
    }

    .teletext-subheader {
        font-size: 0.8em;
        margin-bottom: 15px;
    }

    /* Layout a singola colonna */
    .content-grid {
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    /* Menu orizzontale a blocchi */
    .teletext-menu {
        border-bottom: 2px dashed var(--text-white);
        padding-bottom: 10px;
    }
    .teletext-menu ul {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    .teletext-menu li {
        flex: 1 1 45%; /* Dispone gli elementi 2x2 */
        margin-bottom: 0;
        padding: 8px 5px;
        text-align: center;
        border: 1px solid var(--text-white); 
    }
    .nav-number { margin-right: 5px; }

    /* Rimuove i blocchi di scorrimento interno: ora scorre l'intera pagina */
    .info-section {
        border-left: none; 
        padding-left: 0;
        max-height: none; /* Rimuove il blocco in altezza */
        overflow-y: visible; /* Elimina il doppio scorrimento interno fastidioso */
    }

    /* Tasti footer 2x2 */
    .fastext-footer {
        flex-wrap: wrap;
        gap: 5px;
        padding-top: 20px;
        padding-bottom: 10px;
    }
    .fastext-btn {
        flex: 1 1 45%;
        padding: 10px 0;
        margin: 0;
        font-size: 0.9em;
    }

    .power-button {
        font-size: 1em;
        padding: 15px 20px;
    }
    .flash-avatar img {
        height: 45%;
    }
}

/* --- CLASSE SEO (Nasconde elementi alla vista ma non a Google) --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}