.minesweeper {
    width: min(100%, 620px);
    margin: 0 auto;
    color: #000000;
    font-family: "Microsoft Sans Serif", "Pixelated MS Sans Serif", sans-serif;
}

.minesweeper_controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.minesweeper button {
    padding: 3px 10px;
    color: #000000;
    background: #c0c0c0;
    border-width: 2px;
    border-style: outset;
    border-color: #ffffff #000000 #000000 #ffffff;
    font: inherit;
}

.minesweeper button:active,
.minesweeper button:focus-visible {
    border-style: inset;
}

/* --- Game panel: the recessed window that holds the counter row and board --- */
.minesweeper_panel {
    padding: 5px;
    background: #c0c0c0;
    border-width: 2px;
    border-style: outset;
    border-color: #ffffff #000000 #000000 #ffffff;
}

.minesweeper_status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 6px;
    margin-bottom: 6px;
    border-width: 2px;
    border-style: inset;
    border-color: #808080 #ffffff #ffffff #808080;
}

.minesweeper_counter {
    min-width: 4ch;
    padding: 2px 4px;
    color: #ff0000;
    background: #000000;
    border: 1px inset #808080;
    font-family: "Courier New", monospace;
    font-weight: bold;
    text-align: right;
}

.minesweeper_reset {
    min-width: 34px;
    padding: 1px 6px;
    font-family: "Courier New", monospace;
    font-weight: bold;
    line-height: 1.2;
}

.minesweeper_reset.is-lost {
    content: "X";
}

.minesweeper_board {
    display: grid;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    overflow: auto;
    border-width: 3px;
    border-style: inset;
    border-color: #808080 #ffffff #ffffff #808080;
}

.minesweeper_cell {
    width: 26px;
    height: 26px;
    padding: 0;
    color: #000000;
    background: #c0c0c0;
    border-width: 2px;
    border-style: outset;
    border-color: #ffffff #000000 #000000 #ffffff;
    font-family: "Courier New", monospace;
    font-weight: bold;
    line-height: 1;
}

.minesweeper_cell:active:not(.revealed) {
    border-style: inset;
}

.minesweeper_cell:focus-visible {
    outline: 2px dotted #000000;
    outline-offset: -4px;
}

.minesweeper_cell.revealed {
    background: #c0c0c0;
    border-width: 1px;
    border-style: solid;
    border-color: #808080;
}

.minesweeper_cell.revealed.mine {
    color: #ff0000;
}

.minesweeper_cell.revealed.mistake {
    color: #808080;
}

.minesweeper_cell.revealed.safecell {
    background: #ffff00;
}

/* Classic Minesweeper number colours. */
.minesweeper_cell.revealed.n1 { color: #0000ff; }
.minesweeper_cell.revealed.n2 { color: #008000; }
.minesweeper_cell.revealed.n3 { color: #ff0000; }
.minesweeper_cell.revealed.n4 { color: #000080; }
.minesweeper_cell.revealed.n5 { color: #800000; }
.minesweeper_cell.revealed.n6 { color: #008080; }
.minesweeper_cell.revealed.n7 { color: #000000; }
.minesweeper_cell.revealed.n8 { color: #808080; }

.minesweeper_message {
    min-height: 1.2em;
    margin: 10px 0 0;
    text-align: center;
}

.minesweeper_message:empty {
    margin: 0;
}
