/* Wordle Style */
#wordle-game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    /* For absolute positioning of back btn */
}

#wordle-back-to-menu {
    position: fixed;
    /* Fixed to viewport */
    top: 30px;
    left: 30px;
    width: auto;
    padding: 1rem 1.5rem;
    /* Larger touch target matches main back btn */
    z-index: 100;
    border-radius: 50px;
    /* Match style of main back btn */
}

#wordle-board {
    display: grid;
    /* grid-template-columns set by js */
    gap: 5px;
    width: 100%;
    /* Ensure it takes space inside flex container */
    margin-bottom: 2rem;
    padding: 10px;
    margin-left: auto;
    margin-right: auto;
}

.wordle-box.small-text {
    font-size: 18px;
    /* Smaller font for long words */
}

.wordle-box {
    width: 100%;
    /* Fill grid cell */
    aspect-ratio: 1;
    /* Maintain square shape */
    border: 2px solid #334155;
    background: rgba(30, 41, 59, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Responsive font size based on viewport width, clamped */
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: bold;
    color: white;
    text-transform: uppercase;
    transition: all 0.2s;
    border-radius: 4px;
    /* Slight rounded corners look better */
}

.wordle-box.filled {
    border-color: #64748b;
    animation: pop 0.1s;
}

.wordle-box.reveal {
    animation: flip 0.6s ease forwards;
}

/* Colors */
.wordle-box.correct,
.key-btn.correct {
    background-color: #22c55e !important;
    border-color: #22c55e !important;
    color: white;
}

.wordle-box.present,
.key-btn.present {
    background-color: #eab308 !important;
    /* Yellow-500 */
    border-color: #eab308 !important;
    color: white;
}

.wordle-box.absent,
.key-btn.absent {
    background-color: #475569 !important;
    /* Slate-600 */
    border-color: #475569 !important;
    color: #94a3b8;
}

/* Keyboard */
#wordle-keyboard {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key-btn {
    font-family: inherit;
    font-weight: bold;
    border: none;
    padding: 0;
    min-width: 30px;
    height: 50px;
    border-radius: 4px;
    background: #cbd5e1;
    color: #0f172a;
    cursor: pointer;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    user-select: none;
    text-transform: uppercase;
    touch-action: manipulation;
}

.key-btn.wide {
    flex: 1.5;
    font-size: 0.9rem;
}

/* Mobile adjustments */
@media (max-width: 500px) {
    #wordle-board {
        gap: 3px;
        /* Tighter gap on mobile */
        padding: 5px;
    }

    .key-btn {
        height: 45px;
        font-size: 0.8rem;
    }
}

/* Animations */
@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes flip {
    0% {
        transform: rotateX(0);
    }

    50% {
        transform: rotateX(90deg);
    }

    100% {
        transform: rotateX(0);
    }
}

#wordle-message {
    height: 30px;
    margin-bottom: 20px;
    color: #f8fafc;
    font-weight: bold;
    font-size: 1.2rem;
    text-align: center;
}