/* =========================================================
ECDS Wordle v1.0
Clean grid, flip animations, on-screen keyboard
EC Digital Services
========================================================= */

.ecds-wl-empty {
    color: var(--ecds-text-muted);
    text-align: center;
    padding: 40px 20px;
    font-size: 16px;
}

/* ---- GRID ---- */
.ecds-wl-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 0 auto 18px;
    width: fit-content;
}

.ecds-wl-row {
    display: flex;
    gap: 6px;
}

.ecds-wl-tile {
    width: 58px;
    height: 58px;
    border: 2px solid var(--ecds-border-dark);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    font-family: var(--ecds-font-mono, monospace);
    color: var(--ecds-text);
    text-transform: uppercase;
    user-select: none;
    transition: border-color .1s;
    background: #fff;
}

@media (max-width: 480px) {
    .ecds-wl-tile { width: 46px; height: 46px; font-size: 22px; }
}

.ecds-wl-tile-filled {
    border-color: #565758;
    color: #1a1a1b;
}

/* Pop animation on letter entry */
.ecds-wl-tile-pop {
    animation: ecdsWlPop .1s ease-in-out;
}
@keyframes ecdsWlPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* Flip animation */
.ecds-wl-flip {
    animation: ecdsWlFlip .5s ease forwards;
}
@keyframes ecdsWlFlip {
    0%   { transform: rotateX(0deg); }
    49%  { transform: rotateX(-90deg); }
    50%  { transform: rotateX(-90deg); }
    100% { transform: rotateX(0deg); }
}

/* ---- TILE STATES (applied mid-flip) ---- */
.ecds-wl-state-correct {
    background: #538d4e;
    border-color: #538d4e;
    color: #fff;
}

.ecds-wl-state-present {
    background: #b59f3b;
    border-color: #b59f3b;
    color: #fff;
}

.ecds-wl-state-absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
    color: #fff;
}

/* Shake on invalid word */
.ecds-wl-shake {
    animation: ecdsWlShake .5s ease;
}
@keyframes ecdsWlShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80%      { transform: translateX(4px); }
}

/* ---- MESSAGE ---- */
.ecds-wl-msg {
    text-align: center;
    font-size: 16px;
    font-weight: 800;
    color: #1a1a1b;
    background: rgba(0,0,0,.85);
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    min-height: 40px;
    display: inline-block;
    margin: 0 auto 16px;
    transition: opacity .4s;
    opacity: 0;
    width: fit-content;
    display: block;
}

/* ---- ON-SCREEN KEYBOARD ---- */
.ecds-wl-keyboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    max-width: 500px;
}

.ecds-wl-kb-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.ecds-wl-key {
    height: 56px;
    min-width: 40px;
    padding: 0 8px;
    border-radius: 6px;
    border: none;
    background: #d3d6da;
    color: #1a1a1b;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s, color .15s, transform .1s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ecds-wl-key:hover {
    filter: brightness(.92);
    transform: translateY(-1px);
}
.ecds-wl-key:active { transform: scale(.95); }

.ecds-wl-key-wide {
    min-width: 64px;
    font-size: 13px;
}

@media (max-width: 480px) {
    .ecds-wl-key       { height: 46px; min-width: 32px; font-size: 12px; padding: 0 5px; }
    .ecds-wl-key-wide  { min-width: 50px; }
    .ecds-wl-kb-row    { gap: 4px; }
}

/* Keyboard key states */
.ecds-wl-key-state-correct {
    background: #538d4e !important;
    color: #fff !important;
}
.ecds-wl-key-state-present {
    background: #b59f3b !important;
    color: #fff !important;
}
.ecds-wl-key-state-absent {
    background: #3a3a3c !important;
    color: #fff !important;
}

/* ---- LEGEND ---- */
.ecds-wl-legend {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.ecds-wl-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ecds-text-muted);
}

.ecds-wl-legend-dot {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}
