:root {
    --bg: #eef2f6;
    --fg: #15202b;
    --card: #fff;
    --mut: #5d6b7a;
    --line: #d3dce5;
    --sel: #15202b;
    --selfg: #fff;
    --found: #ff4a68;
    --span: #f3c94b;
    --foundfg: #0d2035;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    color-scheme: light;
}

@media (prefers-color-scheme:dark) {
    :root:not([data-theme="light"]) {
        --bg: #10171e;
        --fg: #e8eef4;
        --card: #1a242e;
        --mut: #93a3b3;
        --line: #2b3946;
        --sel: #e8eef4;
        --selfg: #10171e;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #10171e;
    --fg: #e8eef4;
    --card: #1a242e;
    --mut: #93a3b3;
    --line: #2b3946;
    --sel: #e8eef4;
    --selfg: #10171e;
    color-scheme: dark;
}

html {
    scroll-padding-top: env(safe-area-inset-top, 0px);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    /*font: 400 16px/1.4 "Familjen Grotesk", system-ui, sans-serif;*/
    font-family: montserrat;
}

@font-face {
  font-family: montserrat;
  src: url('../Montserrat/Montserrat-VariableFont_wght.ttf');
}

main {
    max-width: 460px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

h1 {
    font-size: 22px;
    margin: 0;
    font-weight: 700;
    letter-spacing: -.01em;
}

button {
    font: inherit;
    color: inherit;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 14px;
    cursor: pointer;
}

button:hover {
    border-color: var(--mut);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px;
}

button.pri {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
    font-weight: 600;
}

.theme {
    margin: 18px 0 6px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.theme small {
    color: var(--mut);
    display: block;
}

.theme b {
    font-size: 24px;
    letter-spacing: -.01em;
}

.bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 2px;
    color: var(--mut);
}

#msg {
    min-height: 26px;
    text-align: center;
    font-weight: 600;
    margin: 4px 0;
}

#board {
    position: relative;
    container-type: inline-size;
    width: 100%;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    margin: 0 auto;
}

#board svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(var(--cols), 1fr);
    width: 100%;
    height: 100%;
}

.cell {
    display: grid;
    place-items: center;
}

.dot {
    width: 80%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: calc(100cqw / var(--cols) * .4);
    transition: background .12s;
}

.dot.f {
    background: var(--found);
    color: var(--foundfg);
}

.dot.s {
    background: var(--span);
    color: var(--foundfg);
}

.dot.sel {
    background: var(--sel);
    color: var(--selfg);
}

.dot.hint {
    box-shadow: 0 0 0 3px var(--fg);
    animation: pulse 1s 3;
}

@keyframes pulse {
    50% {
        transform: scale(1.12);
    }
}

.shake {
    animation: shake .3s;
}

@keyframes shake {
    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

@media (prefers-reduced-motion:reduce) {

    .dot.hint,
    .shake {
        animation: none;
    }
}

#ed {
    margin-top: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

#ed label {
    display: block;
    font-weight: 600;
    margin: 12px 0 4px;
}

#ed label:first-child {
    margin-top: 0;
}

input[type=password],
input[type=text],
input[type=number],
textarea {
    width: 100%;
    font: inherit;
    color: inherit;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

.row {
    display: flex;
    gap: 10px;
}

.row>div {
    flex: 1;
}

input[type=color] {
    width: 100%;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    padding: 2px;
}

#count {
    margin: 10px 0;
    font-weight: 600;
}

#count.bad {
    color: #d0453a;
}

#count.ok {
    color: #2e9a5b;
}

.acts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

[hidden] {
    display: none !important;
}

#sub label,
#gate label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

#pwMsg {
    color: #d0453a;
    font-weight: 600;
    margin-top: 8px;
}

#sub a {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
    color: var(--fg);
}

#list div {
    padding: 6px 0;
    border-top: 1px solid var(--line);
}