:root {
    color-scheme: light;
    --paper: #f4f3ed;
    --ink: #252723;
    --muted: #676960;
    --line: #c9cbc0;
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    color: var(--ink);
    background: var(--paper);
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
button,
input,
a {
    -webkit-tap-highlight-color: transparent;
}
button,
input {
    font: inherit;
    color: inherit;
}
button,
a {
    touch-action: manipulation;
}
button {
    cursor: pointer;
}
a {
    color: inherit;
    text-underline-offset: 4px;
}
:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
}
::selection {
    background: var(--ink);
    color: var(--paper);
}
[hidden] {
    display: none !important;
}
.game {
    height: 100svh;
    overflow: hidden;
}
#world {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}
.menu-toggle {
    position: fixed;
    top: max(18px, env(safe-area-inset-top));
    right: max(18px, env(safe-area-inset-right));
    width: 48px;
    height: 48px;
    border: 0;
    background: var(--paper);
    border-radius: 50%;
    display: grid;
    place-items: center;
}
.menu-toggle svg {
    width: 23px;
    height: 23px;
}
.menu-toggle:hover {
    background: #e7e8df;
}
dialog {
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 32px;
    width: min(380px, calc(100% - 32px));
    max-height: calc(100svh - 40px);
    overflow: auto;
}
dialog::backdrop {
    background: rgb(244 243 237 / 0.86);
}
h1,
h2,
p {
    margin: 0;
}
h1 {
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.03em;
}
h2 {
    font-size: 18px;
    font-weight: 500;
}
.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.close {
    border: 0;
    background: transparent;
    min-height: 44px;
    padding: 8px;
    color: var(--muted);
}
.menu-items {
    display: grid;
    gap: 4px;
}
.menu-items > button,
.menu-items > a {
    text-align: left;
    padding: 13px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-decoration: none;
    font-size: 17px;
}
.menu-items > :hover {
    color: #66705a;
}
.help,
.status {
    font-size: 13px;
    line-height: 1.6;
    color: var(--muted);
}
.help {
    margin-top: 28px;
}
.status:not(:empty) {
    margin-top: 16px;
}
.levels {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.level-dot {
    width: 48px;
    height: 48px;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
}
.level-dot::before {
    content: '';
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
}
.level-dot[aria-current='true']::before {
    background: var(--ink);
}
.level-dot:hover::before {
    transform: scale(1.15);
}
.editor {
    min-height: 100svh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}
.tools {
    padding: 28px 24px;
    border-right: 1px solid var(--line);
    height: 100svh;
    overflow: auto;
}
.tools header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}
.tools header a {
    font-size: 13px;
    color: var(--muted);
}
.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 16px 0 24px;
}
.tool-grid button,
.actions button {
    min-height: 44px;
    border: 1px solid var(--line);
    background: transparent;
    padding: 10px;
    border-radius: 4px;
}
.tool-grid button[aria-pressed='true'],
.actions .primary {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.tool-grid button:hover,
.actions button:hover {
    border-color: var(--ink);
}
button:disabled {
    cursor: default;
    opacity: 0.4;
}
.field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    margin: 16px 0;
}
.field input[type='number'] {
    width: 90px;
    min-height: 40px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
}
input[type='checkbox'] {
    accent-color: var(--ink);
    width: 18px;
    height: 18px;
}
.actions {
    display: grid;
    gap: 8px;
    margin-top: 24px;
}
.editor-stage {
    min-width: 0;
    height: 100svh;
    padding: 32px;
    display: grid;
    place-items: center;
}
.editor-stage #world {
    max-width: calc(100svh - 64px);
    aspect-ratio: 1;
    height: auto;
    border: 1px solid var(--line);
}
.editor-stage.testing #world {
    border-color: transparent;
}
.share-output {
    width: 100%;
    min-height: 44px;
    margin-top: 12px;
    background: transparent;
    border: 1px solid var(--line);
    padding: 8px;
}
.board-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: 24px;
}
.field-help {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    margin-top: 8px;
}
.tools .status:empty {
    display: none;
}
.tools .status:not(:empty) {
    position: sticky;
    top: -28px;
    z-index: 2;
    background: var(--paper);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding: 16px 0;
    margin: 0 0 16px;
}
.tool-grid {
    grid-template-columns: repeat(3, 1fr);
}
.screen-notice {
    display: none;
}
@media (max-width: 899px), (max-height: 599px) {
    .editor {
        display: block;
    }
    .editor .tools,
    .editor .editor-stage {
        display: none;
    }
    .screen-notice {
        min-height: 100svh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        gap: 24px;
        max-width: 500px;
        margin: auto;
        padding: 32px;
    }
    .screen-notice h1 {
        font-size: 28px;
        line-height: 1.2;
    }
    .screen-notice p {
        font-size: 14px;
        line-height: 1.7;
        color: var(--muted);
    }
    .screen-notice a {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}