/* --- ROOT --- */
:root {
    --neon-blue: #00f0ff;
    --neon-gold: #ffcc00;
    --bg-dark: #000;
    --chat-bg: rgba(0, 10, 20, 0.95);
}

/* --- BODY --- */
body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Rajdhani', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}




/* --- HEADER --- */
header {
    text-align: center;
    padding: 40px 20px;
    background: transparent;
    position: relative;
    z-index: 10;
}



@keyframes pulse-neon {
    from { text-shadow: 0 0 5px var(--neon-blue); opacity: 0.9; }
    to { text-shadow: 0 0 15px var(--neon-blue); opacity: 1; }
}

/* --- 🖼️ HEADER & QUADRANTE WEB APP --- */
header {
    text-align: center;
    padding: 40px 20px;
    background: transparent; /* <-- Via il nero al 70%, ora è trasparente cristallo! */
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-main {
    max-width: 180px;
    border: none;
    box-shadow: 0 0 20px var(--neon-blue);
    border-radius: 50%;
    margin-bottom: 20px;
}

h1 { 
    font-family: 'Orbitron', sans-serif; 
    color: var(--neon-blue); 
    letter-spacing: 5px; 
    margin: 0; 
}

.header-title-main {
    font-size: 1.1em;
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    text-shadow: 0 0 10px var(--neon-blue);
    letter-spacing: 3px;
    margin-top: -5px;
    margin-bottom: 10px;
    text-align: center;
}

.header-subtitle-sub {
    font-size: 0.85em;
    color: #b3faff;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
}

/* --- ⚡ PULSANTE INSTALLA WEB APP CON FLASH --- */
.install-app-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 240, 255, 0.08);
    padding: 10px 18px;
    border-radius: 14px;
    border: 1.5px solid var(--neon-blue);
    text-decoration: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.25);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.install-app-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.5);
    border-color: #ffffff;
}

.install-app-icon {
    font-size: 22px;
    filter: drop-shadow(0 0 6px var(--neon-blue));
}

.install-app-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.install-app-title {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.install-app-action {
    color: var(--neon-blue);
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: -2px;
}

.header-badges-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.badge-box {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 240, 255, 0.05);
    padding: 12px 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
    position: relative;
    overflow: hidden;
    width: fit-content;
}

.badge-text-wrap {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.badge-title-top {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    letter-spacing: 2px;
    font-weight: 700;
}

.badge-title-sub {
    color: #00f0ff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 2px;
    margin-top: -3px;
    text-transform: uppercase;
}

.privacy-link-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 240, 255, 0.1);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1.5px solid var(--neon-blue);
    text-decoration: none;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    transition: all 0.3s ease;
}

.privacy-link-btn:hover {
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.5);
    border-color: #ffffff;
}

.privacy-title-top {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 600;
}

.privacy-title-sub {
    color: #00f0ff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.intro-text {
    max-width: 800px;
    margin: 20px auto;
    font-size: 1.2em;
    color: #b3faff;
    line-height: 1.5;
    padding: 0 20px;
    text-align: center;
}

/* --- 📦 APPS LAYOUT --- */
.apps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

.app-card {
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    transition: 0.3s;
    backdrop-filter: blur(5px);
}

.app-card:hover {
    transform: translateY(-10px);
    border-color: var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.app-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    margin-bottom: 15px;
    border: 2px solid var(--neon-blue);
}

.app-card h2 { 
    font-family: 'Orbitron', sans-serif; 
    font-size: 1.2em; 
    color: var(--neon-blue); 
    margin: 10px 0; 
}

.app-card p { 
    font-size: 0.9em; 
    color: #ccc; 
    min-height: 45px; 
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8em;
    transition: 0.3s;
    cursor: pointer;
    text-align: center;
}

.btn-download { background: var(--neon-blue); color: black; }
.btn-guide { border: 1px solid var(--neon-blue); color: var(--neon-blue); }
.btn-download:hover { box-shadow: 0 0 15px var(--neon-blue); opacity: 0.8; }
.btn-guide:hover { background: rgba(0, 240, 255, 0.1); }

.guide-content {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: rgba(0,0,0,0.9);
    border-radius: 10px;
    text-align: left;
    font-size: 0.85em;
    border: 1px dashed var(--neon-blue);
    line-height: 1.4;
}

.show-guide { display: block !important; animation: fadeIn 0.5s; }

/* --- CHAT DROID AI WIDGET STYLE (ALTEZZA CENTRO - LATO DESTRA IN VISTA) --- */
#chat-widget { 
    position: fixed; 
    top: 50%;
    right: 15px; 
    transform: translateY(-50%);
    z-index: 1000; 
}

#chat-trigger {
    position: fixed;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 75px; 
    height: 75px;
    background: radial-gradient(circle at 30% 30%, #1a1a1a, #000); 
    border: 2px solid var(--neon-blue);
    border-radius: 50%;
    cursor: move; 
    z-index: 1005;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    animation: pulse-glow 3s infinite ease-in-out;
    box-shadow: 0 0 25px var(--neon-blue), inset 0 0 15px rgba(0, 240, 255, 0.2);
    touch-action: none; 
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 15px var(--neon-blue); }
    50% { box-shadow: 0 0 35px var(--neon-blue); border-color: #fff; }
    100% { box-shadow: 0 0 15px var(--neon-blue); }
}

#chat-trigger::before {
    content: "AI";
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    color: var(--neon-blue);
    font-weight: bold;
    z-index: 3;
    pointer-events: none; 
}

#chat-trigger img {
    width: 55%;
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
}

#chat-window {
    display: none; 
    width: 85vw;
    max-width: 320px; 
    height: 400px; 
    background: var(--chat-bg);
    border: 2px solid var(--neon-blue); 
    border-radius: 16px; 
    flex-direction: column;
    position: fixed;
    bottom: 95px;
    right: 25px; /* Spostata verso l'interno di ben 25px, niente più angoli tagliati! */
    overflow: hidden; 
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.5);
    backdrop-filter: blur(15px);
    z-index: 1004;
    animation: fadeIn 0.3s ease-in-out;
}
/* --- FIX MOBILE QUADRANTE (video non deve sembrare ingrandito) --- */
@media (max-width: 600px) {
    #bg-video {
        object-position: center center;
        height: 100vh;
        width: 100vw;
    }

    .cyber-quadrant {
        max-width: 90%;
    }

    header {
        padding: 20px;
    }
}


#chat-header { 
    background: var(--neon-blue); 
    color: black; 
    padding: 12px; 
    font-family: 'Orbitron', sans-serif; 
    font-weight: bold; 
    font-size: 0.8em; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    cursor: move !important;
    user-select: none;
    touch-action: none; /* Fondamentale per trascinare fluidamente con le dita su Android e iOS */
}

#chat-messages { 
    flex: 1; 
    padding: 15px; 
    overflow-y: auto; 
    font-size: 0.9em; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    scrollbar-width: thin;
    scrollbar-color: var(--neon-blue) transparent;
}

.msg { padding: 8px 12px; border-radius: 10px; max-width: 85%; line-height: 1.3; }
.msg.ai { 
    background: rgba(0, 240, 255, 0.1); 
    color: var(--neon-blue); 
    align-self: flex-start; 
    border: 1px solid rgba(0, 240, 255, 0.3); 
}
.msg.user { background: var(--neon-blue); color: black; align-self: flex-end; font-weight: 500; }

#chat-input-area { padding: 10px; border-top: 1px solid rgba(0, 240, 255, 0.2); display: flex; gap: 5px; }
#chat-input { 
    background: transparent; 
    border: 1px solid var(--neon-blue); 
    color: white; 
    padding: 8px; 
    border-radius: 5px; 
    flex: 1; 
    outline: none; 
    font-family: 'Rajdhani', sans-serif; 
}
#chat-send { 
    background: var(--neon-blue); 
    border: none; 
    padding: 8px 15px; 
    border-radius: 5px; 
    cursor: pointer; 
    font-weight: bold; 
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 🛡️ SHIELD FLARE (FLASH NEON PER I BOTTONI) --- */
.shield-flare {
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1) 40%, 
        rgba(255, 255, 255, 0.6) 50%, 
        rgba(255, 255, 255, 0.1) 60%, 
        transparent
    );
    animation: play-shield-flare 4s infinite ease-in-out;
    pointer-events: none;
    transform: skewX(-25deg);
    z-index: 10;
}



/* --- VIDEO SFONDO (VERSIONE COMPATIBILE iOS) --- */
#bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 100vh;
    transform: translate(-50%, -50%);
    object-fit: cover;
    object-position: center center;
    z-index: -1;
    opacity: 1;

    /* iOS FIX */
    -webkit-transform: translate(-50%, -50%) translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* --- FRECCIA VERDE NEON (PAGINA TURNER IN BASSO A DESTRA) --- */
.neon-page-turner {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00ff66;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 255, 102, 0.6), inset 0 0 10px rgba(0, 255, 102, 0.4);
    z-index: 9999;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.neon-page-turner .arrow-icon {
    font-size: 1.8em;
    color: #00ff66;
    text-shadow: 0 0 10px #00ff66;
    animation: pulse-arrow 1.5s infinite;
}

.neon-page-turner:hover {
    transform: scale(1.15) rotate(90deg);
    background: #00ff66;
    box-shadow: 0 0 35px #00ff66, inset 0 0 15px rgba(0, 0, 0, 0.8);
}

.neon-page-turner:hover .arrow-icon {
    color: #000;
    text-shadow: none;
    animation: none;
}

@keyframes pulse-arrow {
    0% { transform: translateX(0); }
    50% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* --- STILE QUADRANTE DI NAVIGAZIONE RAPIDA --- */
.cyber-quadrant {
    background: rgba(0, 0, 0, 0.75);
    border: 1.5px solid rgba(0, 240, 255, 0.6);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.25), inset 0 0 15px rgba(0, 240, 255, 0.15);
    padding: 20px;
    margin: 20px auto;
    text-align: center;
}

.quadrant-title {
    font-family: 'Orbitron', sans-serif;
    color: var(--neon-blue);
    font-size: 0.9em;
    letter-spacing: 2px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.quadrant-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.q-link {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8em;
    color: #ccc;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.q-link:hover, .q-link.active {
    color: #000;
    background: var(--neon-blue);
    border-color: var(--neon-blue);
    box-shadow: 0 0 15px var(--neon-blue);
    font-weight: bold;
}

/* --- 🌀 EFFETTO TELETRASPORTO IPERSPAZIALE (TUNNEL ZOOM 3D) --- */
html {
    height: 100%;
    background-color: #000;
    overflow-x: hidden;
}

body.cyber-book-page {
    opacity: 1;
    transform: scale(1) translateZ(0);
    transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.6s ease;
    will-change: transform, opacity;
}

/* Quando clicchi sulla freccia, la pagina viene risucchiata nel tunnel in avanti ed esplode in dissolvenza laser */
body.page-turning {
    transform: scale(2.5) translateZ(300px);
    opacity: 0;
    filter: brightness(2) contrast(1.3);
    box-shadow: 0 0 50px var(--neon-blue);
}

/* --- OTTIMIZZAZIONE SUPREMA VIDEO MOBILI (IOS & ANDROID) --- */
#bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: 100vw;
    height: 100vh;
    z-index: -999;
    transform: translate(-50%, -50%);
    object-fit: cover;
    object-position: center center;
    background-color: #000000; /* Sfondo nero di sicurezza anti-schermo bianco/nero */
    opacity: 1;
    /* Forza l'accelerazione GPU per nitidezza laser su Retina e AMOLED */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translate(-50%, -50%) translateZ(0);
    transform: translate(-50%, -50%) translateZ(0);
    filter: brightness(1.05) contrast(1.1) saturate(1.2);
}