body {
    font-family: Arial, sans-serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    touch-action: manipulation; /* Prevent double-tap zoom */
}
h1 {
    font-size: 1.5em;
    margin: 10px 0;
}
p, label, select, button {
    font-size: 1em;
}
select, button {
    padding: 8px;
    margin: 5px;
    font-size: 1em;
}
#game-board {
    display: grid;
    margin: 10px auto;
    justify-content: center;
    max-width: 100vw;
    max-height: 70vh;
    overflow: auto; /* Scroll if too large */
    gap: 0; /* Remove gaps between cells */
}
.cell {
    width: var(--cell-size, 40px); /* Default 40px for touch */
    height: var(--cell-size, 40px);
    border: 1px solid #000;
    text-align: center;
    cursor: pointer;
    box-sizing: border-box;
    user-select: none;
    font-size: 1.2em; /* Larger for visibility */
    touch-action: manipulation; /* Prevent zoom */
    display: flex;
    align-items: center;
    justify-content: center;
}
.cell:focus {
    outline: none;
}
.cell.closed {
    background-color: #ccc;
}
.cell.opened {
    background-color: #fff;
}
.cell.mine {
    background-color: red;
}
.cell.flag {
    background-color: yellow;
}
#message {
    font-size: 1.2em;
    margin: 10px;
    color: red;
}
#leaderboard {
    margin-top: 20px;
    width: 90%;
}
table {
    margin: 0 auto;
    border-collapse: collapse;
    width: 100%;
}
th, td {
    border: 1px solid #000;
    padding: 8px;
    font-size: 0.9em;
}
form {
    max-width: 300px;
    margin: 20px auto;
    text-align: left;
}
input {
    width: 100%;
    margin-bottom: 10px;
    padding: 5px;
    font-size: 1em;
}
button {
    width: 100%;
    padding: 10px;
    font-size: 1em;
}
/* Media queries for smaller screens */
@media (max-width: 600px) {
    :root {
        --cell-size: 35px; /* Smaller for very small screens */
    }
    h1 {
        font-size: 1.2em;
    }
    .cell {
        font-size: 1em;
    }
}