body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    text-align: center;
    padding: 20px;
}

#game {
    display: inline-block;
    margin: 20px auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

#wordNumber {
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: bold;
}

#guess {
    padding: 10px;
    font-size: 20px;
    width: 200px;
    text-align: center;
    margin-bottom: 10px;
}

#submitGuess,
#resetGame {
    padding: 10px 20px;
    font-size: 20px;
    cursor: pointer;
    margin: 10px 5px;
}

#feedback {
    margin-top: 20px;
    font-size: 30px; /* Increased font size for guessed words */
}

.word-display {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 30px; /* Larger font for guessed words */
}

.letter-box {
    display: inline-block;
    width: 50px; /* Adjust width for larger text */
    height: 50px; /* Adjust height for larger text */
    line-height: 50px; /* Center text vertically */
    text-align: center;
    font-size: 30px; /* Increased font size for letters */
    font-weight: bold;
    margin: 2px;
    color: white;
    border-radius: 5px;
}

.correct {
    background-color: #f89422; /* New color for correct letters */
}

.present {
    background-color: #16658c; /* New color for present letters */
}

.absent {
    background-color: gray;
}

#keyboard {
    margin-top: 20px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}

.key {
    display: inline-block;
    padding: 10px;
    margin: 2px;
    font-size: 20px;
    font-weight: bold;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background-color: #ddd;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
}

.key.correct {
    background-color: #f89422; /* New color for correct letters */
    color: white;
}

.key.present {
    background-color: #16658c; /* New color for present letters */
    color: white;
}

.key.absent {
    background-color: gray;
    color: white;
}

#legend {
    margin-top: 20px;
    text-align: center;
}

.legend-item {
    margin-bottom: 10px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-color {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border-radius: 3px;
}

.legend-color.correct {
    background-color: #f89422;
}

.legend-color.present {
    background-color: #16658c;
}

.legend-color.absent {
    background-color: gray;
}

.next-word-banner {
    background-color: #f89422;
    color: #fff;
    padding: 12px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 8px;
    text-align: center;
    margin: 15px 0;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    animation: bounceIn 0.4s ease-out;
}

.flash-border {
    border: 3px solid #f89422 !important;
    transition: border 0.3s ease;
}

.fail-border {
    border: 3px solid #c0392b !important; /* Red for failure */
    transition: border 0.3s ease;
}
.next-word-banner.fail {
    color: #c0392b;
}

@keyframes bounceIn {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); }
}

@media (max-width: 600px) {
    #guess {
        width: 70%;
        font-size: 16px;
        padding: 8px;
        margin-bottom: 6px;
    }

    #submitGuess, #resetGame {
        font-size: 14px;
        padding: 6px 10px;
        margin: 4px;
    }

    .word-display .letter-box {
        font-size: 20px;
        width: 30px;
        height: 30px;
        margin: 2px;
    }

    #timer {
        font-size: 14px;
        margin-top: 8px;
        margin-bottom: 8px;
        text-align: right;
    }

    .keyboard {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 10px;
    }

    .key {
        width: 13px;
        height: 13px;
        font-size: 12px;
        line-height: 12px;
        margin: 2px;
        padding: 4px;
        border-radius: 3px;
        text-align: center;
    }

    /* Alphabetical keys in 6-letter rows */
    .key:nth-child(6n+1) {
        clear: both;
    }

    #feedback {
        margin-top: 15px;
        padding-bottom: 80px; /* space for on-screen keyboard */
    }

    #timer, #resetGame {
        display: block;
        text-align: center;
        margin: 12px auto;
    }
}

