:root {
    --bg-dark: #020617;
    --accent-cyan: #22d3ee; /* Neon Blue */
    --accent-gold: #fbbf24; /* Gold for coins/rewards */
    --card-bg: rgba(30, 41, 59, 0.6); /* Translucent dark blue */
    --border-light: rgba(255, 255, 255, 0.08); /* Subtle white border */
    --input-bg: rgba(15, 23, 42, 0.7); /* Darker, slightly translucent input */
    --correct-green: #10b981; /* Green for correct answers */
    --font-primary: 'Outfit', -apple-system, sans-serif;
}

/* Base Styles & Typography */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-dark);
    font-family: var(--font-primary);
    color: white;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important for particle background */
    position: relative; /* For particle positioning */
}

/* Particle Background */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    background-image: url(''); /* Puoi aggiungere un'immagine di background qui se vuoi */
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 50% 50%;
    z-index: 0; /* Dietro tutti gli altri elementi */
}

/* Header & HUD */
header {
    padding: 5px 25px; 
    min-height: 110px; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(2, 6, 23, 0.7);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-light);
    z-index: 10;
    position: relative;
    box-shadow: 0 4px 30px rgba(0,0,0,0.3);
    min-height: 80px; /* Assicura che l'header non si "schiacci" */
}

/* Quando il gioco parte, diventa visibile */
body.game-running header {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Il contenitore del logo */
.logo-container {
    display: flex;
    align-items: center;
    /* Rimuove eventuali margini che potrebbero spostare il logo */
    margin: 0;
}

.logo-container img {
    /* Il drop-shadow crea l'effetto neon seguendo i bordi del fulmine e del cervello */
    filter: drop-shadow(0 0 10px var(--accent-cyan)) drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
    transition: transform 0.3s ease;
    cursor: pointer;
}

.logo-container img:hover {
    transform: scale(1.05); /* Effetto pulsazione al passaggio del mouse */
}

.hud-group { 
    display: flex; 
    align-items: center;
    gap: 15px; /* Spazio tra i badge e l'ingranaggio */
}

.hud-item {
    background: var(--card-bg); /* Glassmorphism background */
    padding: 8px 14px; /* Slightly smaller padding */
    border-radius: 10px; /* Softer corners */
    border: 1px solid rgba(255,255,255,0.15); /* Finer border */
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(8px); /* Blur for card effect */
    box-shadow: 0 2px 10px rgba(0,0,0,0.2); /* Soft inner shadow */
    transition: all 0.2s ease;
}
.hud-item.gold { color: var(--accent-gold); }
.hud-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.settings-btn {
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%; /* Circular button */
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}
.settings-btn:hover {
    background: rgba(46, 60, 80, 0.7);
    transform: rotate(90deg); /* Rotate animation on hover */
}

/* Main Game Area */
.main-game {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center; /* Perfect vertical centering */
    padding: 20px;
    position: relative;
    z-index: 5; /* Above particles */
}

.content-wrapper {
    width: 100%;
    max-width: 450px; /* Slightly adjusted max-width */
    display: flex;
    flex-direction: column;
    gap: 20px; /* Reduced gap for tighter layout */
    animation: fadeIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; /* Smoother fade-in */
}

/* Word Nodes (Start/End) - Glassmorphism Neon */
.word-node {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.8)); /* Deeper gradient */
    padding: 18px 25px; /* Adjust padding */
    border-radius: 18px; /* Softer roundness */
    text-align: center;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--accent-cyan);
    border: 1px solid rgba(34, 211, 238, 0.4); /* Stronger neon border */
    box-shadow: 0 0 25px rgba(34, 211, 238, 0.3), 0 8px 30px rgba(0,0,0,0.5); /* Dual shadow: neon glow + depth */
    transition: all 0.3s ease-out;
}
.word-node:hover {
    transform: translateY(-3px) scale(1.01); /* Lift and slight enlarge on hover */
    box-shadow: 0 0 35px rgba(34, 211, 238, 0.4), 0 12px 40px rgba(0,0,0,0.6);
}

/* Arrow Separator with Glow */
.separator {
    text-align: center;
    color: rgba(71, 85, 105, 0.7); /* Softer grey */
    font-size: 1.8rem; /* Larger arrow */
    text-shadow: 0 0 10px rgba(71, 85, 105, 0.3); /* Subtle glow */
    animation: bounce 2s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smoother bounce */
    margin: 5px 0; /* Add some vertical space */
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* Input Slots - Advanced Glassmorphism */
.slot-row { /* New class for the row wrapping slots */
    display: flex;
    gap: 6px; /* Tighter spacing */
    justify-content: center;
    padding: 10px; /* Padding inside the row card */
    background: var(--card-bg); /* Glassmorphism background for the row */
    border-radius: 16px; /* Rounded corners for the row */
    border: 1px solid rgba(255,255,255,0.1); /* Light border */
    backdrop-filter: blur(10px); /* Blur for glass effect */
    box-shadow: 0 4px 20px rgba(0,0,0,0.3); /* Depth shadow */
    transition: all 0.3s ease-out;
}
.slot-row.correct { /* Animation for correct row */
    border-color: var(--correct-green);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}
.slot-row.shake { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; } /* More controlled shake */
@keyframes shake {
    10%, 90% { transform: translateX(-3px); }
    20%, 80% { transform: translateX(6px); }
    30%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
    50% { transform: translateX(-6px); }
}


.letter-input {
    width: 48px; /* Slightly larger input for touch */
    height: 58px; /* Slightly larger input for touch */
    background: var(--input-bg);
    border: 2px solid rgba(71, 85, 105, 0.6); /* Softer border for inputs */
    border-radius: 12px;
    color: white;
    font-size: 1.8rem; /* Larger font in slots */
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none; /* Remove default outline */
}

.letter-input:focus {
    border-color: var(--accent-cyan);
    transform: translateY(-2px) scale(1.05); /* Slight lift and enlarge */
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.4); /* Neon glow on focus */
    background: rgba(34, 211, 238, 0.1); /* Subtle background change */
}

.slot-row.correct .letter-input {
    border-color: var(--correct-green);
    color: var(--correct-green);
    background: rgba(16, 185, 129, 0.15); /* Greenish background for correct */
}

/* Buttons - Animated & Styled */
.btn-group {
    display: flex;
    gap: 15px;
    margin-top: 25px; /* More space above buttons */
}

.btn {
    padding: 16px 25px; /* Adjust padding */
    border-radius: 14px; /* Slightly softer corners */
    border: none;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smoother transitions */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    flex: 2;
    background: linear-gradient(90deg, #00f2ff, #00c6ff); /* Gradient primary button */
    color: var(--bg-dark);
    box-shadow: 0 6px 25px rgba(34, 211, 238, 0.4); /* Stronger glow shadow */
}

.btn-secondary {
    flex: 1;
    background: var(--card-bg); /* Glassmorphism secondary button */
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-3px); /* Lift effect on hover */
    box-shadow: 0 8px 30px rgba(34, 211, 238, 0.5); /* Enhanced shadow on hover */
}
.btn-secondary:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.4); /* Secondary button shadow */
}
.btn:active { transform: translateY(0); box-shadow: none; } /* Press effect */

/* Modal Styles - Animated & Premium */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.95); /* Nearly opaque dark background */
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(15px);
    animation: modalShow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; /* Pop-out animation */
}
@keyframes modalShow {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content {
    background: linear-gradient(160deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9)); /* Deep gradient for modal */
    border: 1px solid var(--accent-cyan);
    border-radius: 25px;
    padding: 50px 40px; /* Generous padding */
    text-align: center;
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.5), 0 15px 50px rgba(0,0,0,0.7); /* Strong neon glow + depth */
    position: relative;
    max-width: 400px;
    width: 90%;
}

.trophy-icon {
    font-size: 4rem; /* Huge trophy */
    margin-bottom: 20px;
    text-shadow: 0 0 20px var(--accent-gold); /* Gold glow */
}

.modal-title {
    color: var(--accent-cyan);
    font-size: 2.8rem;
    font-weight: 900;
    margin-bottom: 10px;
    text-shadow: 0 0 15px var(--accent-cyan);
}

.modal-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.modal-reward {
    color: var(--accent-gold);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 30px;
    text-shadow: 0 0 10px var(--accent-gold);
}

.next-btn { /* Re-style next button within modal */
    padding: 18px 50px;
    font-size: 1.1rem;
    border-radius: 16px;
}


/* Media Queries for Responsiveness */
@media (max-width: 600px) {
    header { padding: 10px 15px; min-height: 70px; }

    /* Fix Logo Header */
    .logo-container img { 
        height: 50px !important; 
        width: auto; 
    }

/* Fix Logo Start Card */
.start-logo-img {
    height: 100px !important;
}

.start-card { padding: 15px; gap: 5px; }

    .hud-item { padding: 6px 10px; font-size: 0.8rem; }
    .settings-btn { width: 32px; height: 32px; font-size: 1rem; }
    .main-game { padding: 15px; }
    .content-wrapper { gap: 15px; }
    .word-node { padding: 15px 20px; font-size: 0.9rem; }
    .separator { font-size: 1.5rem; }
    .slot-row { padding: 8px; gap: 4px; border-radius: 12px; }
    .letter-input { width: 40px; height: 50px; font-size: 1.5rem; border-radius: 10px; }
    .btn-group { flex-direction: column; gap: 10px; margin-top: 20px; }
    .btn { width: 100%; padding: 14px; font-size: 0.9rem; border-radius: 12px; }
    .modal-content { padding: 30px 20px; border-radius: 20px; }
    .trophy-icon { font-size: 3rem; }
    .modal-title { font-size: 2.2rem; }
    .modal-message { font-size: 1rem; }
    .modal-reward { font-size: 1.5rem; }
    .next-btn { padding: 14px 30px; font-size: 1rem; border-radius: 14px; }
}

/* Feedback di errore */
.slot-row.error-row {
    border-color: #ff4757 !important;
    box-shadow: 0 0 25px rgba(255, 71, 87, 0.4);
    background: rgba(255, 71, 87, 0.1) !important;
    /* Rimuoviamo eventuali transizioni pesanti che rallentano l'esecuzione */
    transition: none !important; 
}

.slot-row.error-row .letter-input {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.letter-input.hint-letter {
    color: var(--accent-cyan);
    background-color: rgba(34, 211, 238, 0.1); /* Sfondo leggermente colorato */
    border-color: rgba(34, 211, 238, 0.3);
    pointer-events: none; /* Evita che l'utente ci clicchi sopra per sbaglio */
}

.level-badge {
    display: flex;
    align-items: center;
    gap: 8px; /* Spazio tra scritta e numero */
    border-left: 3px solid var(--accent-cyan); /* Bordo laterale colorato */
    padding-left: 12px; /* Spazio interno */
    background: rgba(255, 255, 255, 0.05); /* Sfondo leggerissimo */
}

.label-text {
    font-size: 0.7rem;
    letter-spacing: 1px;
    font-weight: 700;
    color: #94a3b8; /* Grigio tecnico */
}

.level-digit {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 10px var(--accent-cyan); /* Effetto neon solo sul numero */
}

/* --- BADGE MONETE (ORO) --- */
.coin-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    
    /* Bordo laterale ORO */
    border-left: 4px solid #FFD700; 
    
    padding: 5px 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border-radius: 8px; /* Arrotondamento uguale a quello della foto */
}

/* 1. SCRITTA "CREDITI": Ora molto più luminosa */
.coin-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    
    /* TRUCCO: Usiamo un oro pallido/chiaro (#ffe082) invece di quello scuro */
    color: #ffe082; 
    
    /* Un leggerissimo bagliore per staccarla dal fondo scuro */
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
}

/* 2. NUMERO: Oro puro e forte bagliore */
.coin-digit {
    font-size: 1.2rem;
    font-weight: 900;
    
    /* Colore Oro Puro */
    color: #FFD700; 
    
    /* Bagliore intenso per effetto Neon */
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
    
    font-variant-numeric: tabular-nums;
}

/* --- BOTTONE AIUTO (Stile "Magic Pill") --- */
.hint-btn {
    /* 1. FORMA E LAYOUT */
    display: flex;
    align-items: center;
    justify-content: space-between; /* Spinge icona/testo a sx e prezzo a dx */
    gap: 15px;
    padding: 10px 20px;
    
    /* Larghezza controllata ma flessibile */
    min-width: 160px; 
    margin: 0 auto;

    /* 2. COLORE DISTINTIVO (Viola/Indaco Magic) */
    /* Questo gradiente lo separa visivamente dal resto del gioco che è Ciano/Blu */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* 3. FORMA ARROTONDATA (Differenza chiave dalle card quadrate) */
    border-radius: 50px; 
    border: 2px solid rgba(255, 255, 255, 0.2);
    
    /* Effetti 3D e Ombra */
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4), /* Ombra viola */
                inset 0 1px 0 rgba(255, 255, 255, 0.3); /* Riflesso vetro in alto */
    
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
}

/* Icona e Testo a sinistra */
.hint-btn .btn-text {
    color: white;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.hint-btn .btn-icon {
    font-size: 1.1rem;
    filter: drop-shadow(0 0 2px rgba(255, 255, 0, 0.8)); /* Lampadina accesa */
}

/* Il costo (-20) a destra dentro un bollino scuro */
.hint-btn .btn-cost {
    background: rgba(0, 0, 0, 0.3); /* Sfondo scuro per contrasto col viola */
    color: #ffcc00; /* Oro per richiamare le monete */
    font-weight: 900;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 20px; /* Anche questo arrotondato */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* --- EFFETTO HOVER --- */
.hint-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.6); /* L'ombra viola aumenta */
    filter: brightness(1.1);
}

/* --- EFFETTO CLICK --- */
.hint-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* --- ANIMAZIONE NO SOLDI (Shake Rosso) --- */
.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important; /* Diventa rosso errore */
    border-color: #fca5a5 !important;
}

/* --- TRACCIA DELLA BARRA (Base dell'Header) --- */
.progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px; 
    background: rgba(255, 255, 255, 0.05);
    z-index: 20;
    overflow: visible; /* FONDAMENTALE: Lascia uscire la scritta "fuori" dall'header */
}

/* --- BARRA COLORATA --- */
#progress-fill {
    width: 0%;
    height: 100%;
    background-color: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan); 
    transition: width 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
}

/* --- PERCENTUALE CENTRATA E SOSPESA --- */
#progress-text {
    position: absolute;
    
    /* POSIZIONAMENTO VERTICALE */
    /* 0px è la barra. Mettiamo 12px per staccarlo e farlo scendere verso la card */
    top: 12px; 
    
    /* CENTRATURA ORIZZONTALE PERFETTA */
    left: 50%;
    transform: translateX(-50%); 
    
    /* STILE */
    font-family: var(--font-primary);
    font-size: 0.85rem; /* Leggermente più grande */
    font-weight: 800;
    letter-spacing: 2px;
    
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
    
    /* SFONDO "PILLOLA" */
    background: rgba(2, 6, 23, 0.9); /* Molto scuro per coprire le particelle dietro */
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(34, 211, 238, 0.3);
    
    /*Z-INDEX ALTO per stare sopra le particelle ma sotto eventuali modali */
    z-index: 10; 
    pointer-events: none;
}

/* --- START SCREEN PRO DESIGN --- */

/* Sfondo che copre tutto */
.start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%); /* Gradiente sfumato */
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease;
}

/* La Card Centrale */
.start-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    padding: 20px 25px; /* Ridotto verticalmente a 20px */
    border-radius: 30px;
    border: 1px solid rgba(34, 211, 238, 0.2);
    text-align: center;
    box-shadow: 0 0 60px rgba(34, 211, 238, 0.15), 
                inset 0 0 20px rgba(34, 211, 238, 0.05);
    max-width: 90%;
    width: 420px;
    display: flex;
    flex-direction: column;
    gap: 5px; /* Spazio ridottissimo tra gli elementi per far stare il logo */
    animation: floatCard 5s ease-in-out infinite;
}

/* --- IL LOGO (FIX RIGA UNICA) --- */
.start-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

.start-logo-img {
    height: 220px; /* Logo grande ma bilanciato */
    width: auto;
    filter: drop-shadow(0 0 20px var(--accent-cyan));
    transition: transform 0.3s ease;
}

.start-logo-img:hover {
    transform: scale(1.05);
}

.bolt-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 15px #fbbf24); /* Glow Oro */
    animation: pulseIcon 2s infinite;
}

.text-group {
    display: flex;
    align-items: baseline; /* Allinea il testo alla base */
    gap: 10px;
}

.text-the {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
}

.text-bridge {
    font-size: 3rem; /* Molto più grande */
    font-weight: 900;
    color: var(--accent-cyan);
    letter-spacing: -1px;
    text-shadow: 0 0 25px var(--accent-cyan); /* Super Glow */
    font-style: italic; /* Leggermente inclinato per dinamismo */
}

/* Linea divisoria elegante */
.divider-line {
    width: 60px;
    height: 4px;
    background: var(--accent-cyan);
    margin: 0 auto 25px auto;
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.start-subtitle {
    color: #94a3b8;
    font-size: 1.2rem;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

/* Badges (100 Livelli / Pro) */
.start-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 35px;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge.highlight {
    background: rgba(34, 211, 238, 0.1);
    color: var(--accent-cyan);
    border-color: rgba(34, 211, 238, 0.3);
}

/* Bottone Start Gigante */
.start-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.3rem;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #22d3ee, #3b82f6);
    border: none;
    transition: transform 0.2s;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(34, 211, 238, 0.6);
}

/* Animazioni */
@keyframes floatCard {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Responsive per cellulari piccoli */
@media (max-width: 400px) {
    .text-bridge { font-size: 2.2rem; }
    .bolt-icon { font-size: 2.5rem; }
    .start-card { padding: 30px 20px; }
}

/* --- ANIMAZIONE FEEDBACK AIUTO --- */
@keyframes revealPop {
    0% { 
        transform: scale(1); 
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.4); /* Diventa grande */
        filter: brightness(2); /* Diventa luminosissima (quasi bianca) */
        box-shadow: 0 0 40px var(--accent-cyan); /* Super bagliore */
        border-color: #ffffff; /* Bordo bianco flash */
    }
    100% { 
        transform: scale(1); 
        filter: brightness(1);
    }
}

/* Classe che applicheremo via Javascript */
.animate-reveal {
    animation: revealPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ==========================================
   TASTO INGRANAGGIO & IMPOSTAZIONI
   ========================================== */

/* --- TASTO INGRANAGGIO (Versione Definitiva) --- */
.settings-btn {
    /* Dimensioni e Forma */
    width: 42px;
    height: 42px;
    border-radius: 12px;
    
    /* Colori e Bordi per farlo risaltare */
    background: rgba(255, 255, 255, 0.1); 
    border: 1px solid rgba(255, 255, 255, 0.3); 
    
    /* Testo/Icona */
    color: white;
    font-size: 1.4rem; 
    
    /* Posizionamento */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    
    /* Animazione */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    /* Sicurezza click */
    z-index: 200; 
}

.settings-btn:hover {
    background: var(--accent-cyan); /* Diventa Ciano */
    border-color: var(--accent-cyan);
    color: #020617; /* Icona scura per contrasto */
    transform: rotate(180deg) scale(1.1); /* Ruota e ingrandisce */
    box-shadow: 0 0 15px var(--accent-cyan); /* Bagliore */
}

/* =========================================
   SETTINGS & MODALS PREMIUM DESIGN
   ========================================= */

/* --- 1. CARD IMPOSTAZIONI (Effetto Vetro Scuro) --- */
.settings-card {
    background: rgba(15, 23, 42, 0.95); /* Blu scuro quasi solido */
    backdrop-filter: blur(20px); /* Sfocatura sfondo */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 0; /* Il padding lo gestiamo dentro i blocchi */
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* Header della Modale (Titolo e X) */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
}

.modal-header h2 {
    font-size: 1.2rem;
    letter-spacing: 1px;
    color: #fff;
    margin: 0;
    font-weight: 800;
}

.icon-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0;
}
.icon-close:hover { color: #fff; transform: scale(1.1); }

/* --- GRUPPI OPZIONI --- */
.settings-group {
    padding: 25px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.setting-icon { font-size: 1.5rem; }

.setting-text h3 {
    font-size: 1rem;
    color: #fff;
    margin: 0 0 4px 0;
}

.setting-text p {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 0;
}

/* --- NUOVO SWITCH (Toggle Button) --- */
.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute; inset: 0;
    background-color: #334155;
    border-radius: 34px;
    transition: .3s;
    cursor: pointer;
}
.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .3s; border-radius: 50%;
}

/* Stato Attivo (ON) */
input:checked + .slider { 
    background-color: var(--accent-cyan); 
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.4); 
}
input:checked + .slider:before { transform: translateX(20px); }

/* Linea divisoria */
.divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 0 25px;
}

/* --- ZONA PERICOLO (Box Tratteggiato) --- */
.danger-zone {
    margin: 25px;
    border: 1px dashed rgba(239, 68, 68, 0.3); /* Tratteggio Rosso */
    background: rgba(239, 68, 68, 0.05);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.danger-header {
    color: #ef4444;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.danger-body p {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-danger-outline:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* =========================================
   2. CARD RESET (ALERT ROSSO)
   ========================================= */
.alert-card {
    background: #0f172a;
    border-top: 4px solid #ef4444; /* Linea rossa in alto */
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Icona animata con cerchio che pulsa */
.alert-icon-wrapper {
    position: relative;
    width: 80px; height: 80px;
    margin: 0 auto 20px;
    display: flex; align-items: center; justify-content: center;
}

.alert-icon { font-size: 3rem; z-index: 2; position: relative; }

.alert-ring {
    position: absolute;
    width: 100%; height: 100%;
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    animation: pulseRing 1.5s infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.alert-title {
    color: #ef4444;
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.alert-message {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* Bottoni Alert (Affiancati) */
.alert-actions {
    display: flex;
    gap: 10px;
}

/* Bottone Annulla (Fantasma) */
.btn-ghost {
    flex: 1;
    background: rgba(255,255,255,0.05);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* Bottone Conferma (Rosso Pieno) */
.btn-destructive {
    flex: 1;
    background: linear-gradient(135deg, #ef4444, #991b1b);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: transform 0.2s;
}
.btn-destructive:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}


  /* supporto banner */
/* Questo assicura che il banner stia su una riga tutta sua al centro */
.support-banner {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 15px 0;
    margin-top: 5px;  /* Poco sotto la progress bar */
    margin-bottom: 10px; /* Spazio prima della card delle parole */
    z-index: 10;
}

.btn-bmc-mini {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid #fbbf24;
    color: #fbbf24;
    padding: 10px 20px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
    transition: all 0.3s ease;
}

.btn-bmc-mini:hover {
    background: #fbbf24;
    color: #000;
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.5);
    transform: scale(1.05);
}

/* IMPORTANTE: Se il tuo .main-game ha display: flex, aggiungi questo: */
.main-game {
    display: flex;
    flex-direction: column; /* Forza gli elementi uno sotto l'altro */
    align-items: center;
}

/* --- SELETTORE LINGUA --- */
.lang-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #94a3b8;
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    font-family: var(--font-primary);
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.lang-btn.active {
    background: rgba(34, 211, 238, 0.2); /* Ciano trasparente */
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.2);
}
