.achievements-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent background */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align content to the top */
    z-index: 3;
    overflow-y: auto; /* Enable vertical scrolling if needed */
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

.achievements-overlay-content {
    background-color: #1e1e1e;
    padding: 20px;
    border: 1px solid #333;
    border-radius: 10px;
    text-align: center;
    color: #e0e0e0;
    max-width: 1000px;
    width: 100%;
    margin-top: 5%; /* Add some space from the top */
    box-sizing: border-box;
}

#achievements-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr); /* 10 columns */
    gap: 5px;
    width: 100%; /* Set width to 100% to prevent overflow */
    margin: 0 auto;
    margin-top: 20px;
    box-sizing: border-box;
}

.achievement {
    width: 80px;
    height: 80px;
    position: relative;
}

.achievement img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.1); /* Dim the image */
    transition: filter 0.3s ease;
}

.achievement.unlocked img {
    filter: brightness(1); /* Full brightness when unlocked */
}

.achievement:hover img {
    filter: brightness(1); /* Brighten on hover */
}

.achievement .hover-text {
    visibility: hidden;
    width: 150px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    padding: 5px;
    border-radius: 5px;
    position: absolute;
    z-index: 1;
    bottom: 105%; /* Position above the achievement */
    left: 50%; /* Default centered */
    transform: translateX(-50%); /* Default centered */
    opacity: 0;
    transition: opacity 0.3s, left 0.3s, right 0.3s, transform 0.3s; /* Allow transitions */
}


.achievement:hover .hover-text {
    visibility: visible;
    opacity: 1;
}

/* Achievements info at the top */
#achievements-info {
    font-size: 18px;
    font-weight: bold;
    color: white;
}

/* Achievements Button Styling */

#achievementsButton {
    background-color: #1B4D3E;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: 5px;
    white-space: nowrap; /* Prevent text wrapping */
    width: 100%; /* Take up the full width of the container */
}

#achievementsButton:hover {
    background-color: #2980b9; /* Darker blue on hover */
    transform: translateY(-2px); /* Slight lift on hover */
}

#achievementsButton:active {
    background-color: #1f6391; /* Even darker blue when clicked */
    transform: translateY(1px); /* Slight press down on click */
}

/* Styling for achievement tabs */
.achievement-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.tab-button {
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
    transition: background-color 0.3s;
}

.tab-button.active {
    background-color: #1B4D3E;
}

.tab-button:hover {
    background-color: #444;
}

/* Styling for the achievement count display */
.achievement-count {
    margin-top: 10px;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
    color: #e0e0e0;
    text-align: center;
}


/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    #achievements-grid {
        grid-template-columns: repeat(4, 1fr); /* 5 columns for mobile screens */
    }

    .achievement {
        width: 70px; /* Slightly smaller images on mobile */
        height: 70px;
    }

    .tab-button {
        padding: 8px 12px; /* Reduce padding for smaller screens */
        font-size: 14px; /* Reduce font size for smaller screens */
        margin-right: 3px; /* Reduce margin between buttons */
        flex-grow: 1; /* Allow buttons to grow equally to fill the space */
        text-align: center; /* Ensure text is centered */
    }

    .achievement-tabs {
        justify-content: space-between; /* Distribute space evenly on mobile */
    }
}
