body {
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-color: #f0f0f0;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
    --border-color: #000000; /* Black border for day mode */
}

body.night-mode {
    background-color: #000000;
    color: #f0f0f0;
    --border-color: #ffffff; /* White border for night mode */
}

.game-container {
    text-align: center;
    max-width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

h1 {
    margin-bottom: 5px;
    font-size: 20px;
}

.dev-info {
    margin-bottom: 5px;
    font-size: 12px;
}

.dev-info a {
    color: #ff0000;
    text-decoration: none;
}

#score {
    font-size: 16px;
    margin-bottom: 5px;
}

canvas {
    border: 3px solid var(--border-color); /* Use the variable here */
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}

#game-board {
    border: 2px solid var(--border-color); /* Use the variable here as well */
}

#gameControls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#gameControls button,
#ton-connect-button button {
    font-size: 14px;
    padding: 8px 16px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: auto; /* Ensure buttons are sized by content */
}

#mobileControls {
    display: none;
    width: 180px; /* Adjust this value to change the overall size of the control pad */
    margin: 20px auto;
}

@media (max-width: 600px) {
    .game-container {
        padding: 5px;
    }

    canvas {
        max-width: 90%;
    }

    #mobileControls {
        display: block;
    }

    .control-row {
        display: flex;
        justify-content: center;
    }

    .control-btn {
        font-size: 24px;
        width: 60px;
        height: 60px;
        margin: 5px;
        border-radius: 50%;
        background-color: #ff0000;
        color: white;
        border: none;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Center the middle row buttons */
    .control-row:nth-child(2) {
        justify-content: space-between;
    }

    /* Adjust the size of left and right buttons to match the layout */
    #leftBtn, #rightBtn {
        width: 60px;
    }

    /* Adjust vertical spacing */
    #upBtn, #downBtn {
        margin: 5px 0;
    }
}

/* Style for the TON Connect button */
#ton-connect-button {
    margin: 10px 0;
    display: flex;
    justify-content: center;
}

#ton-connect-button button {
    font-size: 12px;
    padding: 8px 16px;
    background-color: #ff0000;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%; /* Make it full width of its container */
    max-width: 350px; /* Limit the maximum width */
}

#ton-connect-button button:hover {
    background-color: #cc0000;
}