body {
    font-family: 'Roboto', Arial, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.no-scroll, html.no-scroll {
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

.heading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.heading-wrapper h1 {
    margin: 0;
    font-size: 2.5em;
    color: #333;
}

.mode-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    gap:10px;
}

.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: #007BFF;
    color: #FFFFFF;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    margin-left: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.size-selection {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.size-selection button {
    margin: 5px;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, transform 0.2s ease;
    user-select: none;
}

.size-selection button:hover,
.size-selection button:focus,
.size-selection button:active {
    background-color: #ccc; /* Slightly darker on interaction */
    transform: translateY(-1px); /* Slight lift effect */
}

.grid {
    display: grid;
    gap: 5px;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
}

.grid-item {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f1c40f;
    color: black;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 6px;
    user-select: none;
}

.hard-mode .grid-item {
    background-color: #CC0000;
    color: white;
}

.timer {
    font-size: 36px;
    font-weight: bold;
    color: black;
    margin-top: 20px;
    user-select: none;
}

.grid, .leaderboard, #text-content {
    user-select: none;
}

.leaderboard {
    width: 50%;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    margin-top: 20px;
    box-sizing: border-box;
}

.leaderboard h2 {
    margin-top: 0;
    font-size: 24px;
}

.leaderboard ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.leaderboard li {
    padding: 10px 0;
    border-bottom: 1px solid #ddd;
    font-size: 18px;
    color: #333;
    line-height: 1.5;
}

.leaderboard li:hover {
    background-color: #f9f9f9;
}

#text-content {
    width: 50%;
    padding: 20px;
    background-color: #fff;
    box-sizing: border-box;
    margin-top: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#text-content p {
    text-align: center;
    margin: 15px 0;
    line-height: 1.6;
    color: #333;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px; 
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    position: relative;
}

.modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    z-index: 1;
}

/* Modal content */
.modal-content {
    position: absolute;
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    width: 300px;
    text-align: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Input field and buttons */
.prompt-input {
    margin-top: 20px;
    width: 80%;
    padding: 5px;
}

.modal-buttons {
    margin-top: 20px;
}

.modal-buttons button {
    padding: 5px 10px;
    margin: 5px;
    font-weight: bold;
}

#alertMessage {
    margin-bottom: 20px;
}

#submitBtn {
    background-color: #f1c40f;
    color: black;
    padding: 5px 10px;
    margin: 5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#cancelBtn {
    background-color: #CC0000;
    color: white;
    padding: 5px 10px;
    margin: 5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

#submitBtn:hover {
    background-color: #D4A00A;
}

#cancelBtn:hover {
    background-color: #A30000;
}

#alertOkBtn {
    background-color: #f1c40f;
    color: black;
    padding: 5px 10px;
    margin: 5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}


#alertOkBtn:hover {
    background-color: #D4A00A;
}

/* Media Queries for Mobile Devices */
@media (max-width: 768px) {
    .container {
        width: 100%;
        float: none;
        align-items: center;
    }

    .heading-wrapper {
        flex-direction: column;
        align-items: center;
        width: 100%;
        text-align: center;
    }

    .size-selection {
        margin-bottom: 20px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .size-selection button {
        margin: 5px;
        padding: 10px;
        font-size: 14px;
        background-color: #e0e0e0;
        color: black;
        border: 1px solid #ddd;
        cursor: pointer;
        outline: none;
        box-shadow: none;
        transition: none;
        user-select: none;
        width: 40px;
        height: 40px;
    }

    .grid {
        width: 95%;
        box-sizing: border-box;
        grid-template-columns: repeat(auto-fill, minmax(calc(95% / var(--grid-size)), 1fr));
        grid-auto-rows: calc(100vw / var(--grid-size));
        justify-items: center;
    }

    .grid-item {
        width: 100%;
        height: 100%;
    }

    .leaderboard {
        width: 100%;
        float: none;
        clear: both;
        box-sizing: border-box;
    }

    #text-content {
        width: 100%;
        float: none;
    }

    .hard-mode .grid-item {
        background-color: #CC0000;
        color: white;
    }
}