body {
    font-family: sans-serif;
}

h1 {
    text-align: center;
    margin: 0.5em;
}

section, div, footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.5em;
    column-gap: 0.5em;
    margin: 0.8em auto;
    justify-content: center;
    text-align: center;
}

.grid {
    border-spacing: 0;
    border: 1px solid black;
    border-radius: 6px;
}
.grid td, tr {
    padding: 0;
}
.grid tr:first-child td:first-child {
    border-top-left-radius: 5px;
}
.grid tr:first-child td:first-child input {
    border-top-left-radius: 4px;
}
.grid tr:first-child td:last-child {
    border-top-right-radius: 5px;
}
.grid tr:first-child td:last-child input {
    border-top-right-radius: 4px;
}
.grid tr:last-child td:first-child {
    border-bottom-left-radius: 5px;
}
.grid tr:last-child td:first-child > input {
    border-bottom-left-radius: 4px;
}
.grid tr:last-child td:last-child {
    border-bottom-right-radius: 5px;
}
.grid tr:last-child td:last-child input {
    border-bottom-right-radius: 4px;
}
.grid tr:nth-child(3n+1) td {
    border-top: 1px solid black;
}
.grid tr:nth-child(3n+2) td {
    border-top: 1px solid grey;
    border-bottom: 1px solid grey;
}
.grid tr:nth-child(3n) td {
    border-bottom: 1px solid black;
}
.grid td:nth-child(3n+1) {
    border-left: 1px solid black;
}
.grid td:nth-child(3n+2) {
    border-left: 1px solid grey;
    border-right: 1px solid grey;
}
.grid td:nth-child(3n+3) {
    border-right: 1px solid black;
}

.grid input {
    width: 1.5em;
    height: 1.5em;
    font-size: 1.5em;
    border: 0;
    padding: 0;
    text-align: center;
    transition: background 0.5s;
    -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input::-webkit-calendar-picker-indicator {
    display: none;
}
.grid input:enabled {
    background: white;
}
.grid input:disabled, button:enabled {
    color: white;
    background: #6666ff;
}
.grid input.same-value:enabled {
    background: #ffff33;
}
.grid input.forbidden-value:enabled {
    background: #ffff77;
}
.grid input.same-value:disabled, button.same-value:enabled {
    color: #ffff99;
    background: #00cc66;
}
.grid input.forbidden-value:disabled {
    color: #ffff99;
    background: #6666ff;
}
input::placeholder {
    color: #888;
}
.grid input.ink-pen {
    color: darkblue;
}
.grid input.pencil {
    color: #666;
}

.highlight-buttons {
    column-gap: 2px;
}
button, input[type="color"] {
    border: 2px outset #6666ff;
    border-radius: 4px;
    font-size: 1.2em;
    padding: 2px 9px 5px 9px;
    margin:  0px 0px 1px 2px;
}
button:enabled:hover {
    border-width: 1px;
    border-style: outset;
    padding: 3px 9px 5px 10px;
    margin:  1px 0px 1px 3px;
}
button:enabled:active,
button.pressed:enabled:hover {
    border-width: 3px;
    border-style: inset;
    padding: 2px 6px 2px 9px;
    margin:  1px 0px 1px 3px;
}
button.pressed {
    border: 2px inset #00cc66;
    background: #00cc66;
    padding: 2px 8px 4px 9px;
    margin:  1px 0px 0px 3px;
}
button.pressed:enabled:active {
    border-width: 4px;
    border-style: inset;
    padding: 2px 4px 0px 9px;
    margin:  0px 0px 0px 3px;
}
button:disabled {
    color: #666;
    background: darkgrey;
    border: 1px outset darkgrey;
    padding: 3px 10px 6px 10px;
    margin:  0px 0px 1px 2px;
}
input[type="color"] {
    padding: 0;
}

a {
    text-decoration: none;
}

.context-menu {
    display: none;
    z-index: 1000;
    position: absolute;
    overflow: hidden;
    border: 1px solid #CCC;
    white-space: nowrap;
    font-family: sans-serif;
    background: #EEE;
    color: #333;
    border-top-right-radius: 3px;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    padding: 0;
    margin: 0;
}

.context-menu li {
    padding: 6px 10px;
    cursor: default;
    list-style-type: none;
    transition: all .3s ease;
    user-select: none;
    font-size: 0.8em;
}

.context-menu li:hover {
    background-color: #DEF;
}

.context-menu li.error {
    color: #888
}

.context-menu li.error:hover {
    background-color: #EEE;
}