.juego--wordle {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.juego--wordle .presentacion-juego {
    margin-bottom: 0.75rem;
}

.juego--wordle .modo-juego {
    padding-top: 20px;
}

.juego--wordle #titulo-wordle {
    margin: 0;
}

.juego--wordle .presentacion-juego > p:last-child:not(.modo-juego) {
    margin: 0.55rem 0 0;
}

.tarjeta-wordle {
    width: min(430px, 100%);
    margin: 12px auto 6px;
    padding-bottom: 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.tarjeta-wordle .estado-diario {
    min-height: 0;
    padding: 8px 18px 10px;
    border-top: none;
}

.tarjeta-wordle .cuenta-regresiva {
    flex-wrap: wrap;
    justify-content: center;
}

.tarjeta-wordle .cuenta-regresiva span {
    white-space: nowrap;
}

.tablero-wordle {
    display: flex;
    padding: 20px 16px 8px;
    gap: 6px;
    align-items: center;
    flex-direction: column;
}

.fila-wordle {
    display: grid;
    width: min(100%, calc(var(--largo-palabra, 5) * 52px));
    gap: 6px;
    grid-template-columns: repeat(var(--largo-palabra, 5), 1fr);
}

.fila-wordle--agitando {
    animation: agitar-fila 380ms ease;
}

.celda-wordle {
    display: grid;
    aspect-ratio: 1 / 1;
    border: 2px solid var(--color-borde);
    border-radius: 6px;
    color: var(--color-texto);
    background: #0c0c10;
    font-family: var(--fuente-titulos);
    font-size: clamp(1rem, 3.6vw, 1.4rem);
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
    place-items: center;
}

.celda-wordle--llena {
    border-color: #8d8e99;
    animation: aparecer-letra 110ms ease-out;
}

.celda-wordle--girando {
    animation: girar-celda 480ms ease;
}

.celda-wordle--correcta,
.celda-wordle--presente,
.celda-wordle--ausente {
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / 18%);
}

.celda-wordle--correcta {
    border-color: var(--color-correcto);
    background: var(--color-correcto);
    color: #fff;
}

.celda-wordle--presente {
    border-color: var(--color-cerca);
    background: var(--color-cerca);
    color: #1c1400;
}

.celda-wordle--ausente {
    border-color: var(--color-borde);
    background: var(--color-superficie-clara);
    color: var(--color-texto-suave);
    box-shadow: none;
}

.celda-wordle--salto {
    animation: saltar-celda 550ms ease;
}

.mensaje-wordle {
    width: min(560px, 100%);
    min-height: 18px;
    margin: 4px auto 2px;
    text-align: center;
}

.teclado-virtual {
    display: grid;
    width: min(560px, calc(100% - 1rem));
    margin: 4px auto 0;
    gap: 6px;
}

.teclado-virtual__fila {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.tecla {
    height: 44px;
    min-width: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    color: var(--color-texto);
    background: #3a3b44;
    font-family: var(--fuente-titulos);
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: inset 0 -3px 0 rgb(0 0 0 / 22%);
    transition: background-color 120ms ease, transform 80ms ease, box-shadow 80ms ease;
    flex: 1;
}

.tecla:hover:not(:disabled) {
    background: #46474f;
}

.tecla:active:not(:disabled) {
    box-shadow: inset 0 -1px 0 rgb(0 0 0 / 22%);
    transform: translateY(2px) scale(0.97);
}

.tecla:focus-visible {
    outline: 2px solid var(--color-rojo);
    outline-offset: 2px;
}

.tecla:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.tecla--ancha {
    flex: 1.6;
    font-size: 0.7rem;
}

.tecla--correcta {
    background: var(--color-correcto);
    color: #fff;
}

.tecla--presente {
    background: var(--color-cerca);
    color: #1c1400;
}

.tecla--ausente {
    background: #232329;
    color: var(--color-texto-suave);
    box-shadow: none;
}

.resumen-wordle-modal {
    display: grid;
    margin: 18px auto 0;
    gap: 4px;
    justify-content: center;
}

.resumen-wordle-modal__fila {
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(var(--largo-palabra, 5), 15px);
}

.resumen-wordle-modal__celda {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    background: var(--color-superficie-clara);
}

.resumen-wordle-modal__celda--correcta {
    background: var(--color-correcto);
}

.resumen-wordle-modal__celda--presente {
    background: var(--color-cerca);
}

@keyframes aparecer-letra {
    0% {
        transform: scale(0.88);
    }

    60% {
        transform: scale(1.06);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes girar-celda {
    0% {
        transform: rotateX(0deg);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0deg);
    }
}

@keyframes saltar-celda {
    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-16px);
    }

    50% {
        transform: translateY(0);
    }

    70% {
        transform: translateY(-6px);
    }
}

@keyframes agitar-fila {

    10%,
    90% {
        transform: translateX(-2px);
    }

    20%,
    80% {
        transform: translateX(4px);
    }

    30%,
    50%,
    70% {
        transform: translateX(-8px);
    }

    40%,
    60% {
        transform: translateX(8px);
    }
}

@media (max-width: 620px) {
    .tarjeta-wordle {
        width: min(400px, 100%);
    }

    .tablero-wordle {
        padding: 8px 4px 6px;
        gap: 5px;
    }

    .fila-wordle {
        width: min(100%, calc(var(--largo-palabra, 5) * 42px));
        gap: 5px;
    }

    .celda-wordle {
        font-size: clamp(0.95rem, 5.5vw, 1.2rem);
    }

    .teclado-virtual {
        gap: 5px;
    }

    .tecla {
        height: 40px;
        min-width: 24px;
        font-size: 0.76rem;
    }

    .tecla--ancha {
        font-size: 0.6rem;
    }
}

@media (max-width: 360px) {
    .fila-wordle {
        width: min(100%, calc(var(--largo-palabra, 5) * 40px));
        gap: 4px;
    }

    .tecla {
        min-width: 20px;
        padding: 0 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .celda-wordle--llena,
    .celda-wordle--salto {
        animation: none;
    }
}
