* {
    box-sizing: border-box;
}

body {
    margin: 0;

    min-height: 100vh;

    background: #f1f3f4;

    font-family: Arial, Helvetica, sans-serif;

    display: flex;

    justify-content: center;

    align-items: center;
}

.game-container {
    text-align: center;

    padding: 20px;
}

h1 {
    margin-top: 0;

    margin-bottom: 15px;

    font-size: 42px;

    color: #4285f4;
}

.top-bar {
    width: 450px;

    max-width: 90vw;

    margin: auto;

    margin-bottom: 10px;

    padding: 10px;

    background: #dadce0;

    border-radius: 8px;

    display: flex;

    justify-content: space-between;

    align-items: center;
}

.counter {
    min-width: 90px;

    padding: 8px;

    background: #202124;

    color: #ea4335;

    border-radius: 5px;

    font-family: monospace;

    font-size: 20px;

    font-weight: bold;
}

#restart {
    width: 45px;

    height: 45px;

    border: none;

    border-radius: 6px;

    background: white;

    font-size: 25px;

    cursor: pointer;

    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.2);
}

#restart:hover {
    background: #f8f9fa;
}

#restart:active {
    transform: scale(0.92);
}

#board {
    display: grid;

    grid-template-columns: repeat(9, 45px);

    grid-template-rows: repeat(9, 45px);

    width: 405px;

    margin: auto;

    border: 4px solid #7b7b7b;

    background: #7b7b7b;
}

.cell {
    width: 45px;

    height: 45px;

    border: 3px outset #ffffff;

    background: #c0c0c0;

    display: flex;

    justify-content: center;

    align-items: center;

    font-size: 22px;

    font-weight: bold;

    cursor: pointer;

    user-select: none;
}

.cell:hover {
    background: #d0d0d0;
}

.cell.revealed {
    border: 1px solid #999;

    background: #d0d0d0;

    cursor: default;
}

.cell.mine {
    background: #ea4335;

    border: 1px solid #999;

    font-size: 22px;
}

.cell.flagged {
    font-size: 21px;
}

.cell.hinted {
    box-shadow: inset 0 0 0 2px rgba(234, 67, 53, 0.28);
}

/* Number colors */

.cell.number-1 {
    color: #0000ff;
}

.cell.number-2 {
    color: #008000;
}

.cell.number-3 {
    color: #ff0000;
}

.cell.number-4 {
    color: #000080;
}

.cell.number-5 {
    color: #800000;
}

.cell.number-6 {
    color: #008080;
}

.cell.number-7 {
    color: #000000;
}

.cell.number-8 {
    color: #808080;
}

#message {
    min-height: 30px;

    margin-top: 15px;

    font-size: 20px;

    font-weight: bold;
}

.cheat-button {
    display: block;

    width: 24px;

    height: 24px;

    margin: 2px 0 0 auto;

    padding: 0;

    border: 0;

    background: transparent;

    color: #7b7b7b;

    font-size: 14px;

    cursor: pointer;

    opacity: 0.18;
}

.cheat-button:hover,
.cheat-button:focus-visible {
    opacity: 1;
}

@media (max-width: 500px) {

    #board {
        grid-template-columns: repeat(9, 35px);

        grid-template-rows: repeat(9, 35px);

        width: 315px;
    }

    .cell {
        width: 35px;

        height: 35px;

        font-size: 17px;
    }

    .top-bar {
        width: 315px;
    }

    h1 {
        font-size: 32px;
    }
}