:root {
    --primary: #000;
    --draft: #888;
    --bg: #fff;
    --bg-highlight: #ffd;
    --error: #a80000;
    --bg-error: #f6e5e5;
    --link-hover: #f22;
}

@media screen and (prefers-color-scheme: dark) {
    :root {
        --primary: #ddd;
        --draft: #969696;
        --bg: #222;
        --bg-highlight: #005;
        --error: #fcc;
        --bg-error: #500;
    }
}

body {
    padding: 10px;
    font-family: sans-serif;
    max-width: 500px;
    margin: 0 auto;
    color: var(--primary);
    background: var(--bg);
}

.board {
    margin: 0 auto 70px auto;
    width: 371px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
}

.sudoku-table {
    border-collapse: collapse;
    width: 100%;
    height: 100%;
    table-layout: fixed;
    -webkit-user-select: none;
    user-select: none;
    font-family: Georgia, serif;
    font-variant-numeric: lining-nums;
    cursor: pointer;
}

.sudoku-table td {
    border: 1px solid var(--primary);
    text-align: center;
    vertical-align: middle;
    font-size: 24px;
    line-height: 1;
    color: var(--draft);
}

.sudoku-table td:empty::before {
    content: '0';
    opacity: 0;
}

.sudoku-table td.locked {
    cursor: default;
    color: var(--primary);
}

.sudoku-table td.wrong {
    color: var(--error);
    background-color: var(--bg-error);
}

.sudoku-table td.current {
    background-color: var(--bg-highlight);
}

.sudoku-table tr:first-child td {
    border-top: 2px solid var(--primary);
}

.sudoku-table td:first-child {
    border-left: 2px solid var(--primary);
}

.sudoku-table tr:nth-child(3n) td {
    border-bottom: 2px solid var(--primary);
}

.sudoku-table td:nth-child(3n) {
    border-right: 2px solid var(--primary);
}

.numpad {
    width: 60px;
    height: 80px;
    color: var(--primary);
    background: var(--bg);
    border: 1px solid #ccc;
    position: absolute;
    z-index: 2;
    -webkit-user-select: none;
    user-select: none;
    font-size: 14px;
    margin-top: 10px;
    margin-left: 30px;
    top: -9999px;
    left: -9999px;
}

.numpad span {
    display: block;
    float: left;
    width: 20px;
    height: 20px;
    line-height: 20px;
    overflow: hidden;
    cursor: pointer;
    text-indent: 0;
    text-align: center;
}

@media screen and (max-width: 620px) {
    .numpad[class$="8"] {
        margin-left: -51px;
    }
}

.about {
    line-height: 1.4;
}

.about a {
    color: inherit;
}

.about a:hover {
    color: var(--link-hover);
}

@media print {
    .about,
    .numpad {
        display: none;
    }

    .sudoku-table td:not(.locked) {
        text-indent: -1000px;
        background: transparent;
    }
}
