@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

* {
    box-sizing: border-box;
}

body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem 1rem;
    font-family: 'Poppins', sans-serif;
    color: #fafafa;
}

#go-back-button {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

#go-back-button img {
    width: 33px;
    height: 33px;
}

h1 {
    margin: 0;
    color: #2dd4bf;
    font-weight: 600;
    font-size: 2.5rem;
    letter-spacing: 2px;
    text-align: center;
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
    width: 100%;
    max-width: 900px;
    min-height: 500px;
    padding: 2rem;
    border-radius: 12px;
    background-color: #1e293b; /* slate-800 */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#word-display {
    display: flex;
    gap: 0.5rem; /* Gap between letter boxes */
    margin-bottom: 2rem;
    flex-wrap: nowrap;
    justify-content: center;
    width: 100%; /* Make the container full width */
    padding: 0 1rem; /* Add padding to prevent touching screen edges */
    box-sizing: border-box; /* Ensure padding is included in the width */
}

.letter-box {
    /* Use aspect-ratio to maintain a square shape */
    aspect-ratio: 1 / 1;
    /* Flex properties for responsive sizing */
    flex-basis: 8%; /* Start with a flexible base size */
    max-width: 50px; /* Cap the size on larger screens */
    border-bottom: 4px solid #0ea5e9;
    flex-shrink: 1; /* Allow boxes to shrink */
    display: flex;
    justify-content: center;
    align-items: center;    
    font-size: clamp(1rem, 4vw, 2rem);
    font-weight: 600;
    text-transform: uppercase;
}

/* Styles for medium-length words */
.medium-word .letter-box {
    flex-basis: 6%;
    max-width: 40px;
}

/* Styles for long words */
.long-word .letter-box {
    flex-basis: 5%;
    max-width: 35px;
}

.missing-letter {
    color: #ef4444; /* A red color for missed letters on game over */
}

#keyboard {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Reduced gap between rows */
    width: 100%;
    max-width: 800px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 0.375rem; /* Reduced gap between keys (6px) */
    width: 100%;
}

.key {
    height: 60px;
    width: 8%; /* Use a percentage for responsive width */
    max-width: 60px; /* Set a max width for larger screens */
    min-width: 30px; /* Set a min width for smaller screens */
    border: none;
    border-radius: 8px;
    background-color: #334155;
    color: #fafafa;
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, transform 0.2s;
}

.key:hover {
    background-color: #475569;
}

.key:disabled {
    background-color: #1e293b;
    color: #475569;
    cursor: not-allowed;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(26, 26, 26, 0.9);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    visibility: hidden;
    z-index: 100;
    border-radius: 15px;
}

#overlay.visible {
    visibility: visible;
}

#overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#overlay-text {
    font-size: 2.5rem;
    font-weight: 600;
}

#overlay button {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    background-color: #0ea5e9;
    color: #1a1a1a;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
}

#overlay button:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

#confirmation-buttons {
    display: none; /* Hidden by default */
    gap: 1rem;
}

#confirm-no {
    background-color: #475569; /* slate-600 */
}

#confirm-no:hover {
    background-color: #5f7089;
}


#difficulty-container,
#language-container {
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

#difficulty,
#language {
    padding: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    background-color: #0f172a; /* slate-900 */
    color: #fafafa;
    border: 1px solid #0ea5e9;
    border-radius: 5px;
    text-align: center;
    text-align-last: center;
}
#difficulty-container {
    background-color: #0f172a; /* slate-900 */
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    align-items: center;
    justify-content: center;
}


@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
    }
    .key {
        height: 50px;
    }
}
