/* ============================================
   LETTRO.CSS — Jeu de lettres (grille 3x3, 1 minute)
   Dépend de common.css (chargé avant ce fichier)
   ============================================ */

.stat-badge .stat-badge-icon {
    font-size: 1.2em;
}

/* Conteneur positionné pour superposer le flash "GO !" au centre de la grille */
.lettro-grid-wrapper {
    position: relative;
    width: min(100%, 400px);
    margin: 10px auto;
}

/* Grille de lettres 4 colonnes x 3 lignes */
.lettro-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    aspect-ratio: 4 / 3;
}

.lettro-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef0f5 100%);
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    font-size: 2.2em;
    font-weight: 800;
    color: #4a4a4a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    user-select: none;
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.3s ease;
}

.lettro-cell.spinning {
    color: #9aa0ee;
    background: linear-gradient(135deg, #eef0ff 0%, #e4e8ff 100%);
}

.lettro-cell.locked {
    color: #667eea;
    background: linear-gradient(135deg, #ffffff 0%, #f4f5ff 100%);
    border-color: #667eea;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.25);
    animation: lettroLockIn 0.35s ease;
}

@keyframes lettroLockIn {
    0% { transform: scale(1.15); }
    60% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.lettro-cell.used {
    color: #ffa726;
    border-color: #ffa726;
    background: linear-gradient(135deg, #fff8ef 0%, #ffefd9 100%);
}

.lettro-go-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.4) rotate(-6deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 46px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(3px);
    color: #43a047;
    font-weight: 900;
    font-size: 2.6em;
    letter-spacing: 0.06em;
    white-space: nowrap;
    border-radius: 20px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.lettro-go-flash::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 20px;
    box-shadow: 0 0 0 0 rgba(67, 160, 71, 0.55);
    opacity: 0;
}

.lettro-go-flash.show {
    animation: lettroGoFlash 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.lettro-go-flash.show::before {
    animation: lettroGoRing 1s ease-out forwards;
}

@keyframes lettroGoFlash {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(3deg); }
    50% { transform: translate(-50%, -50%) scale(0.96) rotate(-2deg); }
    65% { opacity: 1; transform: translate(-50%, -50%) scale(1.04) rotate(0deg); }
    88% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.15) rotate(0deg); }
}

@keyframes lettroGoRing {
    0%, 25% { opacity: 0; box-shadow: 0 0 0 0 rgba(67, 160, 71, 0.55); }
    40% { opacity: 1; }
    75% { opacity: 0; box-shadow: 0 0 0 28px rgba(67, 160, 71, 0); }
    100% { opacity: 0; box-shadow: 0 0 0 28px rgba(67, 160, 71, 0); }
}

/* Zone de saisie du mot */
.lettro-input-row {
    display: flex;
    gap: 8px;
    margin: 10px 0;
}

.lettro-input-row input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 1.15em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 2px solid #667eea;
    border-radius: 10px;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.lettro-input-row input:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.lettro-input-row input.invalid {
    border-color: #ef5350;
    animation: lettroShake 0.35s ease;
}

.lettro-input-row input:disabled {
    background: #f0f0f0;
    border-color: #ccc;
    color: #999;
}

@keyframes lettroShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.lettro-input-row button {
    flex: 0 0 auto;
    width: auto;
    padding: 10px 20px;
}

/* Mots trouvés */
.lettro-found-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 40px;
    max-height: 90px;
    overflow-y: auto;
    padding: 8px;
    margin-bottom: 6px;
    background: #f8f9fa;
    border-radius: 10px;
}

.lettro-found-words:empty::before {
    content: "Les mots trouvés apparaîtront ici…";
    color: #aaa;
    font-size: 0.85em;
    font-style: italic;
}

.lettro-word-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    animation: lettroChipIn 0.25s ease;
}

.lettro-word-chip .chip-points {
    font-size: 0.8em;
    opacity: 0.85;
}

@keyframes lettroChipIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Modale de résultat */
.lettro-result-content {
    max-width: 480px;
    text-align: center;
}

.lettro-result-content h2 {
    color: #ffa726;
}

.lettro-result-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    margin: 10px 0 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

#submit-lettro-score-btn {
    width: 100%;
    margin-bottom: 10px;
}

#skip-lettro-score-btn {
    width: 100%;
}

@keyframes confetti {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

@media screen and (max-width: 480px) {
    .lettro-cell {
        font-size: 1.7em;
        border-radius: 11px;
    }

    .lettro-go-flash {
        font-size: 1.9em;
        padding: 12px 30px;
    }
}

@media screen and (max-height: 720px) {
    .lettro-grid-wrapper {
        width: min(100%, 300px) !important;
        margin: 6px auto !important;
    }
    .lettro-grid {
        gap: 6px !important;
    }
    .lettro-cell {
        font-size: 1.5em !important;
    }
    .lettro-go-flash {
        font-size: 1.8em !important;
        padding: 10px 28px !important;
    }
}

/* ---------- Mot de 12 lettres (points doublés) ---------- */
.lettro-full-word-hint {
    margin-top: 8px;
    text-align: center;
    font-size: 0.8em;
    font-weight: 600;
    color: #8e6bd8;
}

.lettro-cell.full-word {
    color: #fff;
    border-color: #ffb300;
    background: linear-gradient(135deg, #ffca28 0%, #ff8f00 100%);
    animation: lettroFullWordCell 0.6s ease;
    box-shadow: 0 0 18px rgba(255, 179, 0, 0.75);
}

@keyframes lettroFullWordCell {
    0% { transform: scale(1) rotate(0); }
    40% { transform: scale(1.18) rotate(-6deg); }
    70% { transform: scale(0.95) rotate(4deg); }
    100% { transform: scale(1) rotate(0); }
}

.lettro-word-chip.full-word {
    background: linear-gradient(135deg, #ffca28 0%, #ff8f00 100%);
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.6);
}

.lettro-full-word-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 30px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffca28 0%, #ff8f00 100%);
    color: #fff;
    text-align: center;
    box-shadow: 0 12px 40px rgba(255, 143, 0, 0.55);
    pointer-events: none;
    animation: lettroFullWordPop 2.6s ease forwards;
    width: max-content;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    box-sizing: border-box;
}

.lettro-full-word-title {
    font-size: 1.1em;
    font-weight: 800;
    letter-spacing: 1px;
}

.lettro-full-word-word {
    font-size: clamp(1.2em, 7vw, 1.9em);
    font-weight: 900;
    letter-spacing: 1px;
}

.lettro-full-word-bonus {
    font-size: 1em;
    font-weight: 700;
    opacity: 0.95;
}

@keyframes lettroFullWordPop {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    15% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    25% { transform: translate(-50%, -50%) scale(1); }
    85% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
}

.lettro-result-full-word {
    margin: 8px 0;
    font-size: 0.9em;
    color: #ff8f00;
    font-weight: 600;
}

@media screen and (max-height: 720px) {
    .lettro-full-word-hint {
        margin-top: 4px;
        font-size: 0.72em;
    }
}
