* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

.score-container {
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-info {
    font-size: 1rem;
    color: #4CAF50;
}

#gameCanvas {
    background-color: #222;
    border-radius: 5px;
    margin-bottom: 15px;
}

.controls {
    margin-bottom: 15px;
}

/* D-pad styles */
.d-pad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    /* background-color: #ccc; /* Optional: background for the circular base */
    /* border-radius: 50%; */
    /* width: 180px; /* Adjust as needed */
    /* height: 180px; /* Adjust as needed */
    /* padding: 10px; */
}

.d-pad {
    display: grid;
    grid-template-columns: repeat(3, 50px); /* 3 columns, each 50px wide */
    grid-template-rows: repeat(3, 50px);    /* 3 rows, each 50px high */
    gap: 2px; /* Small gap between buttons */
    position: relative; /* For positioning the center piece if needed */
}

.d-pad-btn {
    background-color: #555; /* Dark grey for D-pad buttons */
    color: white;
    border: 1px solid #333;
    border-radius: 5px; /* Slightly rounded corners */
    font-size: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.d-pad-btn:hover {
    background-color: #777;
}

.d-pad-up {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.d-pad-left {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
}

.d-pad-right {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
}

.d-pad-down {
    grid-column: 2 / 3;
    grid-row: 3 / 4;
}

/* Optional: Style for a central circle piece, if desired */
/* .d-pad::before {
    content: '';
    position: absolute;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    width: 40px;
    height: 40px;
    background-color: #444;
    border-radius: 50%;
    align-self: center;
    justify-self: center;
    z-index: -1; /* Behind buttons if they overlap */
/* } */


button {
    background-color: #4CAF50;
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    margin: 0 5px;
    padding: 10px 20px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.instructions {
    background-color: #f9f9f9;
    border-radius: 5px;
    margin-top: 20px;
    padding: 15px;
    text-align: left;
}

.instructions h2 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.instructions p {
    color: #666;
    margin-bottom: 8px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

#playerNameInput {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

/* High Scores Table */
.high-scores-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

#highScoresTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

#highScoresTable th,
#highScoresTable td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #ddd;
}

#highScoresTable th {
    background-color: #f2f2f2;
    font-weight: bold;
}

#highScoresTable tr:nth-child(even) {
    background-color: #f9f9f9;
}

#highScoresTable tr:hover {
    background-color: #f0f0f0;
}

@media (max-width: 500px) {
    #gameCanvas {
        width: 100%;
        height: auto;
    }
    
    button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    #highScoresTable th,
    #highScoresTable td {
        padding: 8px 5px;
        font-size: 0.9rem;
    }
}
