body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f9f4f0; text-align: center; }
.hidden { display: none !important; }

/* Overlay Login */
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 100; }
.modal { background: white; padding: 2rem; border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

/* --- CONTENITORE RESPONSIVE --- */
#crossword-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: visible; 
    padding: 10px 0;
    display: flex;
    justify-content: center; 
    box-sizing: border-box;
}

/* Griglia Cruciverba Desktop - ELIMINATO IL GAP PER RISOLVERE IL BUG VISIVO */
#crossword-container { 
    display: grid; 
    gap: 0px !important; /* Rimosso il gap per eliminare le righe orizzontali continue */
    justify-content: center; 
    margin: 20px auto 0 auto;
    background: #1a1a1a; /* Sfondo scuro uniforme per le celle nere */
    padding: 1px;
    border-radius: 4px;
    box-sizing: border-box;
}

/* Cella Desktop standard */
.cell { 
    position: relative; 
    background: #fff; 
    width: 40px;
    height: 40px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Gestione bordi vecchio stile per evitare disallineamenti del grid-gap */
    border: 1px solid #222; 
    margin: -0.5px; /* Sovrappone leggermente i bordi adiacenti rendendoli nitidi */
}

/* Le celle nere non hanno bisogno di bordi visibili, si fondono con lo sfondo */
.cell.black { 
    background: #1a1a1a !important; 
    border-color: #1a1a1a !important;
} 

.cell input { 
    width: 100%; 
    height: 100%; 
    border: none; 
    text-align: center; 
    font-size: 1.1rem; 
    text-transform: uppercase; 
    font-weight: bold;
    background: transparent;
    padding: 0;
    margin: 0;
    z-index: 1; 
}

.cell input:focus { background: #eef; outline: none; }
.cell.correct { background: #d4edda !important; } 

/* Container dell'overlay Modulo Login */
.gameOverlay {
    background: #ffffff;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid #f0f0f0;
}

.gameOverlay h2 {
    font-family: 'Playfair Display', serif; 
    color: #333;
    margin-bottom: 10px;
}

.gameOverlay p {
    color: #777;
    margin-bottom: 25px;
    font-size: 14px;
}

/* Input stilizzati */
.gameOverlay input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box; 
}

.gameOverlay input:focus {
    border-color: #d4af37; 
    outline: none;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

/* Bottone "Inizia" stile Elementor */
.gameOverlay button {
    width: 100%;
    padding: 15px;
    background-color: #d4af37; 
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.gameOverlay button:hover {
    background-color: #bfa030;
    transform: translateY(-2px);
}

.gameOverlay button:active {
    transform: translateY(0);
}

/* Box Info Utente */
#user-stats {
    background: #fff;
    padding: 10px 20px;
    border-radius: 50px;
    display: inline-flex;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    font-weight: bold;
    color: #555;
}

/* Container Indizi */
#hints-container {
    display: flex;
    justify-content: space-around;
    text-align: left;
    margin-top: 30px;
    gap: 20px;
}

.hints-column {
    flex: 1;
    background: rgba(255, 255, 255, 0.6);
    padding: 15px;
    border-radius: 10px;
}

.hints-column h3 {
    border-bottom: 2px solid #ddd;
    padding-bottom: 5px;
    color: #444;
}

.hint-item {
    margin: 8px 0;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Numero nelle celle - Versione Desktop */
.cell-number {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 10px; 
    font-weight: bold;
    color: #666;
    pointer-events: none; 
    z-index: 3; 
}

#score-display {
    padding-left:15px
}

/* --- MEDIA QUERY SMARTPHONE PERFETTA SENZA RIGHE INTERROTTE --- */
@media screen and (max-width: 768px) {
    .cell { 
        width: 7.8vw !important;
        height: 7.8vw !important;
        max-width: 35px;
        max-height: 35px;
        border: 1px solid #222 !important; /* Garantisce la separazione netta tra i quadrati bianchi */
    }

    .cell.black {
        border-color: #1a1a1a !important; /* Nasconde il bordo nelle zone nere vuote dello schema */
    }

    #crossword-container {
        width: auto !important;
        gap: 0px !important; /* Forza l'assenza di gap anche su mobile */
        padding: 1px !important;
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    .cell input {
        font-size: 0.9rem; 
    }

    .cell-number {
        font-size: 9px !important; 
        top: 1px !important;
        left: 2px !important;
        color: #444; 
    }

    #hints-container {
        flex-direction: column; 
        gap: 15px;
    }
}