/* Conteneur principal de la grille */
.ws-grid-wrapper {
    overflow-x: auto; /* Permet le scroll horizontal sur petit mobile */
    text-align: center;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre la grille et les éléments enfants */
}

.ws-grid {
    display: inline-grid;
    gap: 4px; /* Augmenté légèrement pour la lisibilité */
    background: #dee2e6;
    border: 4px solid #dc3545;
    border-radius: 10px;
    padding: 6px;
    width: max-content;
    margin-bottom: 15px;
    touch-action: none; /* Crucial pour le drag sur mobile sans scroller la page */
}

.ws-cell {
    aspect-ratio: 1/1;
    min-width: 35px; /* Évite que les cellules ne deviennent minuscules sur mobile */
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s, transform 0.1s;
    font-size: 1.1rem;
}

/* État sélectionné (pendant le drag) */
.ws-cell.selected {
    background: #ffc107 !important;
    transform: scale(0.95);
}

/* État trouvé */
.ws-cell.found {
    background: #198754 !important;
    color: white !important;
}

/* Liste de mots */
.ws-word {
    padding: 8px;
    margin: 4px 0;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    background: white;
}

.ws-word.found {
    background: #e9ecef;
    text-decoration: line-through;
    opacity: 0.6;
    color: #198754;
}

/* Animation de l'indice corrigée */
.hint-flash {
    background-color: #0dcaf0 !important;
    color: white !important;
    z-index: 10;
    position: relative;
    animation: flash-animation 0.6s ease-in-out infinite;
}

/* L'effet de pétillement lors de la victoire */
.ws-cell.win-flash {
    background-color: #2ecc71 !important; 
    color: white !important;
    transform: scale(1.05) !important; 
    z-index: 5;
    transition: all 0.4s ease-in-out;
}
.exo-wordsearch-container {
    overscroll-behavior: contain;
}
@keyframes flash-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 15px #0dcaf0; }
    100% { transform: scale(1); }
}

/* Responsive : ajustement de la taille des lettres sur mobile */
@media (max-width: 576px) {
    .ws-cell {
        min-width: 28px;
        font-size: 0.9rem;
    }
}