@font-face {
    font-family: 'Shadow Beamer';
    src: url('Shadow Beamer.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --primary: #2E85DE;
    --secondary: #2E85DE;
    --accent: #f59e0b;
    --light: #f8fafc;
    --dark: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --bg-light-blue: #dbeafe;
    --bg-light-green: #dcfce7;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Comic Relief', cursive;
    background: linear-gradient(to bottom right, var(--bg-light-blue), var(--bg-light-green));
    color: #334155;
    line-height: 1.7;
}
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

@keyframes slideInFromRight { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes animated-border { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes wobble { 0%, 100% { transform: translateX(0%) rotate(0deg); } 15% { transform: translateX(-5px) rotate(-3deg); } 30% { transform: translateX(4px) rotate(2deg); } 45% { transform: translateX(-3px) rotate(-1deg); } 60% { transform: translateX(2px) rotate(1deg); } 75% { transform: translateX(-1px) rotate(0deg); } }
@keyframes fadeIn { from {opacity: 0;} to {opacity: 1;} }

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--text-primary); }
}

/* Nuove animazioni per le icone saltellanti */
@keyframes jump {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

header { background-color: var(--primary); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; }

/* ✅ CSS per l'effetto 3D Tilt */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    perspective: 1000px;
}
.logo { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; }
.logo-img { width: 120px; height: auto; }
.nav-menu {
    display: flex;
    gap: 0.5rem;
    animation: slideInFromRight 0.6s ease-out forwards;
    transform-style: preserve-3d;
}
.nav-link {
    position: relative;
    z-index: 1;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s, transform 0.2s ease-out, border 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transform: rotateX(0) rotateY(0);
    border: 1px solid transparent;
}
.nav-link:hover {
    color: #fecaca;
    border: 1px solid black;
}
.nav-link::before {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    border-radius: 8px;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.3s ease;
}
.nav-link:hover::before {
    transform: scale(1);
    opacity: 1;
}
.nav-menu a:nth-child(1):hover::before { background-color: rgba(254, 202, 202, 0.2); } .nav-menu a:nth-child(2):hover::before { background-color: rgba(254, 215, 170, 0.2); } .nav-menu a:nth-child(3):hover::before { background-color: rgba(187, 247, 208, 0.2); } .nav-menu a:nth-child(4):hover::before { background-color: rgba(191, 219, 254, 0.2); } .nav-menu a:nth-child(5):hover::before { background-color: rgba(221, 214, 254, 0.2); } .nav-menu a:nth-child(6):hover::before { background-color: rgba(251, 207, 232, 0.2); }
.mobile-menu-btn { display: none; flex-direction: column; gap: 5px; padding: 0.5rem; background: transparent; border: none; cursor: pointer; }
.mobile-menu-btn span { display: block; width: 24px; height: 3px; background-color: white; border-radius: 3px; transition: transform 0.3s, opacity 0.3s; }
.mobile-menu-btn.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); } .mobile-menu-btn.active span:nth-child(2) { opacity: 0; } .mobile-menu-btn.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.update-message-wrapper {
    text-align: center;
    padding: 0.5rem 0;
    background-color: white;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    white-space: nowrap;
}

.typing-effect {
    font-family: 'Shadow Beamer', cursive;
    display: inline-block;
    border-right: 0.15em solid var(--text-primary);
    white-space: nowrap;
    margin: 0 auto;
    font-size: 1.2rem;

}

section { padding: 4rem 1rem; scroll-margin-top: 100px; }
.section-title { font-family: 'Shadow Beamer', cursive; font-size: 3rem; font-weight: normal; text-align: center; margin-bottom: 3rem; background: linear-gradient(to right, var(--secondary), var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-fill-color: transparent; }

.hero { padding: 4rem 1rem; text-align: center; }
.hero-logo-text-img { max-width: 90%; height: auto; max-height: 70px; margin-bottom: 1.5rem; }
.hero-title {
    font-family: 'Shadow Beamer', cursive;
    font-size: 3rem;
    font-weight: normal;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
}
.hero-subtitle { font-size: 1.25rem; margin-bottom: 2rem; color: var(--text-secondary); max-width: 600px; margin-left: auto; margin-right: auto; }
.image-grid { display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 3rem; }
.image-item { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.image-item img { width: 100%; height: 100%; object-fit: cover; }

.btn, .card-btn, .download-btn { position: relative; overflow: hidden; z-index: 1; border: none; cursor: pointer; transition: all 0.3s; }
.btn::before, .card-btn::before, .download-btn::before { content: ''; position: absolute; z-index: -1; background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent), var(--primary)); background-size: 200% 200%; animation: animated-border 4s linear infinite; opacity: 0; transition: opacity 0.4s ease-out; }
.btn:hover::before, .card-btn:hover::before, .download-btn:hover::before { opacity: 1; }
.btn:hover, .card-btn:hover, .download-btn:hover { box-shadow: var(--shadow-md); transform: scale(1.05); animation: wobble 0.8s ease-in-out 1; }
.btn { color: white; padding: 1rem 2rem; border-radius: 9999px; font-size: 1.125rem; font-weight: 600; text-decoration: none; display: inline-block; }
.btn::before { inset: -3px; border-radius: 9999px; }
.btn-primary { background: linear-gradient(to right, #3b82f6, var(--secondary)); background-size: 250% 100%; background-position: 0% 50%; box-shadow: var(--shadow-sm); transition: background-position 0.5s ease-out; }
.btn-primary:hover { background-position: 100% 50%; }

.ripple { position: absolute; border-radius: 50%; background-color: rgba(255, 255, 255, 0.6); transform: scale(0); animation: ripple-effect 0.6s linear; pointer-events: none; }
@keyframes ripple-effect { to { transform: scale(4); opacity: 0; } }

.card { background: white; border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow-sm); transition: box-shadow 0.3s, transform 0.3s; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-5px); }
.card-title { font-family: 'Shadow Beamer', cursive; font-size: 1.8rem; font-weight: normal; margin-bottom: 0.75rem; color: var(--primary); }
.card-text { margin-bottom: 1.5rem; }
.card-btn { background: white; color: var(--text-secondary); padding: 0.75rem 1.5rem; border-radius: 0.75rem; font-weight: 600; }
.card-btn::before { inset: -2px; border-radius: 0.75rem; }
.card-btn:hover { background: var(--primary); color: white; }

.grid { display: grid; gap: 2rem; }
.grid-fit-300 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

#chi-sono { background-color: white; }
.about-container { display: flex; flex-wrap: wrap; gap: 3rem; align-items: flex-start; }
.about-image-wrapper { flex: 1; min-width: 280px; text-align: center; }
.about-image { width: 100%; max-width: 400px; object-fit: contain; }
/* Font predefinito della pagina per la sezione Chi sono */
.about-text-wrapper { flex: 2; min-width: 300px; font-family: 'Comic Relief', cursive; }
.about-text-wrapper p { margin-bottom: 1.5rem; font-size: 1rem; line-height: 1.6; } /* Dimensione testo ridotta */
.about-text-wrapper h4 { font-family: 'Shadow Beamer', cursive; font-size: 1.8rem; font-weight: normal; color: var(--primary); margin-top: 2rem; margin-bottom: 1rem; }
.about-text-wrapper ul { list-style-type: none; padding-left: 0; }

/* Stili per i giochi */
.game-list-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    position: relative;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.3s;
    text-align: center;
}
.game-list-item:hover {
    transform: translateY(-5px);
}
.game-icon-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}
.game-icon {
    width: 120px;
    height: auto;
    transition: transform 0.3s ease-in-out;
}
.game-icon:hover {
    transform: scale(1.1);
}
.game-title {
    font-family: 'Shadow Beamer', cursive;
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
    color: var(--primary);
}
.game-description {
    margin-bottom: 1rem;
}

.matematicando-bg { background-color: #e0f2fe; } /* blue */
.trovalaparola-bg { background-color: #fef9c3; } /* yellow */
.fattoria-bg { background-color: #dcfce7; } /* green */
.isola-bg { background-color: #ffedc3; } /* orange */
.conta100-bg { background-color: #ccfbf1; } /* cyan/green chiaro */


.download-list { max-width: 800px; margin: 0 auto; display: grid; gap: 1.5rem; }
.download-item { display: flex; align-items: center; padding: 1rem; border: 1px solid #e2e8f0; border-radius: 0.75rem; transition: box-shadow 0.3s; background-color: white; }
.download-item:hover { box-shadow: var(--shadow-sm); }
.download-icon { font-size: 1.5rem; margin-right: 1rem; }
.download-info { flex: 1; }
.download-title { font-family: 'Shadow Beamer', cursive; font-size: 1.5rem; font-weight: normal; margin-bottom: 0.25rem; }
.download-meta { color: #64748b; font-size: 0.875rem; }
.download-btn { background: #3b82f6; color: white; padding: 0.5rem 1rem; border-radius: 0.5rem; font-weight: 500; }
.download-btn::before { inset: -2px; border-radius: 0.5rem; }
.download-btn:hover { background: #2563eb; }

#video { background: linear-gradient(to right, #f3e8ff, #fce7f3); }
#video .card { text-align: center; }
.video-card-content { position: relative; overflow: hidden; border-radius: 0.75rem; margin-bottom: 1rem; }
.video-thumbnail { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-duration { position: absolute; bottom: 0.5rem; right: 0.5rem; background: rgba(0, 0, 0, 0.7); color: white; padding: 0.25rem 0.5rem; border-radius: 0.25rem; font-size: 0.75rem; }
.video-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.3); opacity: 0; transition: opacity 0.3s; }
.play-button { width: 64px; height: 64px; background: rgba(255, 255, 255, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.play-icon { width: 0; height: 0; border-left: 20px solid var(--secondary); border-top: 12px solid transparent; border-bottom: 12px solid transparent; margin-left: 5px; }
.video-btn { width: 100%; background: linear-gradient(to right, var(--secondary), #ec4899); }

.video-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background-color: rgba(0,0,0,0.85);
    animation: fadeIn 0.3s;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background-color: #000;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.video-modal-content video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    max-height: 90vh;
}
.close-modal-btn {
    position: absolute;
    top: -40px;
    right: 0;
    color: #fff;
    font-size: 45px;
    font-weight: bold;
    transition: color 0.3s, transform 0.3s;
    cursor: pointer;
}
.close-modal-btn:hover {
    color: #ccc;
    transform: scale(1.1);
}

footer {
    background-color: var(--dark);
    color: white;
    padding: 3rem 1rem 2rem;
    text-align: center;
    font-family: 'Comic Relief', cursive;
}

.footer-logo {
    display: block;
    margin: 0 auto 1rem;
    width: 80px;
    height: auto;
}

/* Nuovo stile per l'immagine del footer */
.footer-image {
    width: 100px; /* Dimensione del cerchio */
    height: 100px;
    border-radius: 50%; /* Rende l'immagine circolare */
    object-fit: cover; /* Assicura che l'immagine riempia il cerchio senza distorsioni */
    margin: 0 auto 1rem; /* Centra l'immagine e aggiunge spazio inferiore */
    border: 3px solid white; /* Bordo bianco attorno all'immagine */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); /* Ombra per l'effetto di profondità */
}

.footer-title {
    font-family: 'Shadow Beamer', cursive;
    font-size: 2rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
    color: white;
}

.footer-subtitle {
    margin-bottom: 1.5rem;
    color: #cbd5e1;
    font-size: 1rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 2rem 0;
}

.footer-link {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.3s;
    font-size: 1rem;
}

.footer-link:hover {
    color: var(--accent);
}

.footer-copy {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        box-shadow: var(--shadow-sm);
        animation: none;
        z-index: 999;
        transform-style: flat;
    }
    .nav-link {
        transform: none !important;
    }
    .nav-menu.active { display: flex; }
    .mobile-menu-btn { display: flex; }
    .nav-menu .nav-link { color: var(--dark); }
    .nav-menu .nav-link:hover { color: var(--primary); }
    .logo-img { width: 100px; }
    .hero-title { font-size: 2.5rem; }
    .about-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
    }
    .about-text-wrapper { padding: 0 1rem; }
    .about-text-wrapper h4 { text-align: center; }
    .about-text-wrapper p, .about-text-wrapper ul { padding-right: 0; }
    .about-text-wrapper li { margin-left: auto; margin-right: auto; text-align: left; }
    .hero-logo-text-img { max-height: 50px; }
    .section-title { font-size: 2.5rem; }
    .card-title, .about-text-wrapper h4 { font-size: 1.5rem; }
    .update-message-wrapper { font-size: 0.9rem; }
}
.contact-card-icon img {
    width: 4rem;
    height: auto;
    margin-bottom: 0.5rem;
    transition: transform 0.2s ease-out;
    cursor: pointer;
}
.contact-card-icon img:hover {
    animation: jump 0.6s ease-in-out infinite;
}
.contact-card {
    display: block;
    text-decoration: none;
    color: inherit;
}
.contact-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
}

/* --- Banner Privacy Custom - FIXED for Chrome --- */
.privacy-banner {
    position: fixed;
    bottom: 30px; /* Alzato leggermente per sicurezza su mobile */
    left: 50%;
    /* Utilizziamo transform per il centraggio ma con backface-visibility per fix rendering chrome */
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
    backface-visibility: hidden;
    
    width: 90%;
    max-width: 600px;
    
    /* MODIFICA: Colore Sfondo Pastello (Theme Blue) e Bordo Primario Forte */
    background-color: var(--bg-light-blue);
    border: 3px solid var(--primary);
    
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    
    /* Ombra più profonda per effetto "Finestra Fluttuante" */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    animation: slideUpBanner 0.5s ease-out;
}

.privacy-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: 'Comic Relief', cursive;
    line-height: 1.4;
}

.close-privacy-btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--primary); /* Stesso colore del bordo per coerenza */
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
}

.close-privacy-btn:hover {
    color: var(--accent);
    transform: scale(1.2);
}

@keyframes slideUpBanner {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@media (max-width: 480px) {
    .privacy-banner { width: 95%; bottom: 15px; padding: 0.8rem; }
    .close-privacy-btn { font-size: 1.8rem; }
}