﻿html {
    background-color: #aaa;
    height: 100%;
    display: grid;
    align-items: center;
    justify-items: center;
    user-select: none;
}

body {
    margin: 0;
}

main {
    margin: 2px 24px;
}

nav {
    display: flex;
    flex-flow: row nowrap;
    justify-content: start;
    font-family: sans-serif;
    font-size: 12px;
}

nav button {
    background-color: #aaa;
    border: 1px solid #0000;
    padding: 3px 5px;
    font-family: sans-serif;
    font-size: 12px;
}

dialog {
    border: 2px solid #ccc;
    border-right-color: #555;
    border-bottom-color: #555;
    background-color: #aaa;
    color: #000;
    padding: 0;
    font-family: sans-serif;
    width: 500px;
    flex-flow: column nowrap;
    align-items: stretch;
}

dialog:popover-open {
    display: flex;
}

dialog p, dialog h3, dialog div {
    margin: 10px;
    font-size: 14px;
}

dialog h3 {
    margin-bottom: 0;
}

dialog p {
    line-height: 1.3em;
}

dialog h2 {
    color: #fff;
    font-size: 14px;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
    padding: 3px 5px;
    background: linear-gradient(to right, #008, #08f);
    margin: 1px;
}

dialog button {
    background-color: #aaa;
    color: #000;
    border: 2px solid #fff;
    border-right-color: #555;
    border-bottom-color: #555;
    font-size: 14px;
    margin: 8px;
    padding: 3px;
    width: 80px;
    align-self: end;
}

button:active {
    border-color: #555;
    border-right-color: #fff;
    border-bottom-color: #fff;
}

dialog h2 button {
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 23px;
    padding: 1px 0 0 0;
    margin: -1px -3px;
}

.game {
    gap: 3px;
    align-items: center;
    display: flex;
    flex-flow: column nowrap;
    font-family: monospace;
    border: 3px solid #fff;
    border-right-color: #888;
    border-bottom-color: #888;
}

header {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
    align-self: stretch;
    border: 2px solid #888;
    border-right-color: #fff;
    border-bottom-color: #fff;
    grid-auto-flow: column;
    user-select: none;
    padding: 6px;
    flex: 1 0 auto;
}

header > div {
    flex: 1 0 55px;
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
}

header > div:first-child {justify-content: start; }
header > div:last-child {justify-content: end; }

#mines, #time {
    border: 1px solid #888;
    border-right-color: #fff;
    border-bottom-color: #fff;
    background-color: #000;
    color: #f00;
    font-size: 32px;
}

#smiley {
    border: 1px solid #fff;
    outline: 1px solid #444;
    border-right-color: #888;
    border-bottom-color: #888;
    font-size: 24px;
    display: flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
}


#smiley:active {
    border-right-color: #fff;
    border-bottom-color: #fff;
    border-left-color: #888;
    border-top-color: #888;
}

.field {
    display: grid;
    border: 2px solid #888;
    border-right-color: #fff;
    border-bottom-color: #fff;
    grid-auto-flow: column;
    width: fit-content;
    user-select: none;
    flex: 0 0 auto;
}

.cell {
    box-sizing: border-box;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-right-color: #888;
    border-bottom-color: #888;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-family: monospace;
}

.cell[cell-value="1"]::before { color: #00f; content: '1' }
.cell[cell-value="2"]::before { color: #080; content: '2' }
.cell[cell-value="3"]::before { color: #f00; content: '3' }
.cell[cell-value="4"]::before { color: #008; content: '4' }
.cell[cell-value="5"]::before { color: #800; content: '5' }
.cell[cell-value="6"]::before { color: #088; content: '6' }
.cell[cell-value="7"]::before { color: #f08; content: '7' }
.cell[cell-value="8"]::before { color: #000; content: '8' }
.cell[cell-value="mine"]::before { color: #000; content: '☀'; font-size: 13px; }
.cell[cell-value="flag"]::before { color: #f00; content: '⚑'; text-decoration: underline; text-decoration-color: #000; font-size: 12px; }

.cell[cell-terrain="water"] { background-color: #bed4fd; }
.cell[cell-terrain="grass"] { background-color: #a3cf98; }
.cell[cell-terrain="sand"] { background-color: #efd9b6; }


.cell.explored, .cell:active {
    border: solid #888;
    border-width: 1px 0 0 1px;
}

.cell.focus {
    outline: 18px solid #c003;
    z-index: 1;
}

#map-list {
    display: grid;
    grid-auto-flow: row;
    gap: 10px;
    padding: 0;
    border: 1px solid #555;
    border-right-color: #fff;
    border-bottom-color: #fff;
    background-color: #fff;
}

#map-list a {
    grid-column: 1 / span 2;
    text-decoration: none;
    gap: 10px;
    display: grid;
    grid-template-columns: 100px auto;
    align-items: center;
    justify-content: start;
    flex-flow: row nowrap;
    height: 70px;
    padding: 2px 10px;
}
#map-list a:hover {
    background-color: #008;
    color: #fff;
}

#map-list a img {
    image-rendering: pixelated;
    grid-column: 1;
    justify-self: center;
    filter: grayscale() contrast(2);
    mix-blend-mode: darken;
    outline: 1px solid #555;
}

#map-list a:hover img {
    filter: grayscale() contrast(2) invert();
    mix-blend-mode: lighten;
}

#map-list a div {
    grid-column: 2;
    justify-self: start;
}
