    :root {
        --bg: #eceff1;
        --fg: #23272e;
        --mut: #7b838d;
        --bar: #dfe4e8;
        color-scheme: light;
        box-sizing: border-box;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px)
    }

    @media (prefers-color-scheme:dark) {
        :root:not([data-theme="light"]) {
            --bg: #16181d;
            --fg: #e8eaed;
            --mut: #8a919b;
            --bar: #21242b;
            color-scheme: dark
        }
    }

    :root[data-theme="dark"] {
        --bg: #16181d;
        --fg: #e8eaed;
        --mut: #8a919b;
        --bar: #21242b;
        color-scheme: dark
    }

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

    body {
        height: 100%;
        margin: 0;
        background: var(--bg);
        color: var(--fg);
        font: 15px/1.3 "Trebuchet MS", system-ui, sans-serif;
        display: flex;
        flex-direction: column;
        overflow: hidden
    }

    #hud {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 16px;
        align-items: center;
        padding: 10px 16px;
        font-size: 14px;
        color: var(--mut);
        background: var(--bg);
        border-bottom: 1px solid color-mix(in srgb, var(--fg) 8%, transparent);
    }

    #hud b {
        color: var(--fg);
        font-size: 18px;
        font-weight: 700
    }

    #progWrap {
        display: flex;
        flex-direction: column;
        gap: 3px;
        min-width: 140px;
        flex: 0 1 180px;
    }

    .prog-label {
        display: flex;
        justify-content: space-between;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--mut);
    }

    .prog-val {
        color: var(--fg);
        font-weight: 600;
        font-size: 12px;
    }

    .prog-val b {
        font-size: 13px !important;
    }

    .prog-track {
        height: 7px;
        background: color-mix(in srgb, var(--fg) 12%, transparent);
        border-radius: 999px;
        overflow: hidden;
        position: relative;
    }

    #progBar {
        height: 100%;
        width: 0%;
        background: linear-gradient(90deg, #3bb273, #2e86ab);
        border-radius: 999px;
        transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #progBar.done {
        background: linear-gradient(90deg, #f7b731, #20bf6b);
        box-shadow: 0 0 8px rgba(32, 191, 107, 0.6);
    }

    #hud span:last-child {
        margin-left: auto
    }

    #game {
        flex: 1;
        min-height: 0;
        width: 100%;
        display: block;
        touch-action: none
    }

    #bar {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
        background: var(--bar);
        align-items: center
    }

    button {
        font: inherit;
        color: var(--fg);
        background: transparent;
        border: 2px solid var(--mut);
        border-radius: 20px;
        padding: 6px 14px;
        cursor: pointer;
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

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

    button.on {
        background: var(--fg);
        color: var(--bg);
    }

    .badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 18px;
        height: 18px;
        padding: 0 5px;
        border-radius: 10px;
        font-size: 11px;
        font-weight: 700;
        background: var(--fg);
        color: var(--bg);
        box-sizing: border-box;
    }

    button.on .badge {
        background: var(--bg);
        color: var(--fg);
    }

    button.active-mode {
        background: #e63946;
        color: #fff;
        border-color: #e63946;
    }

    button.active-mode .badge {
        background: #fff;
        color: #e63946;
    }

    button.ln {
        border-color: var(--c)
    }

    button.ln:disabled {
        opacity: 0.35;
        cursor: not-allowed;
        filter: grayscale(60%);
    }

    button.ln.on {
        background: var(--c);
        color: #fff
    }

    #bar .sp {
        flex: 1
    }

    #toast {
        position: absolute;
        top: 56px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--fg);
        color: var(--bg);
        padding: 8px 16px;
        border-radius: 18px;
        opacity: 0;
        transition: opacity .3s;
        pointer-events: none;
        white-space: nowrap
    }

    #toast.on {
        opacity: 1
    }

    #end {
        position: absolute;
        inset: 0;
        background: color-mix(in srgb, var(--bg) 88%, transparent);
        display: none;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 14px;
        text-align: center
    }

    #end.on {
        display: flex
    }

    #menu {
        position: absolute;
        inset: 0;
        display: none;
        align-items: center;
        justify-content: center;
        pointer-events: none
    }

    #menu.on {
        display: flex
    }

    #menu .card {
        pointer-events: auto;
        background: var(--bar);
        border-radius: 18px;
        padding: 20px 26px;
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 280px
    }

    #menu #lvlDesc {
        margin: 0;
        font-size: 14px;
        color: var(--mut);
        line-height: 1.4;
        min-height: 2.8em
    }

    #menu h1 {
        margin: 0 0 4px;
        font-size: 26px
    }

    #menu label {
        display: flex;
        gap: 10px;
        align-items: center;
        font-size: 17px;
        cursor: pointer
    }

    #menu input {
        width: 20px;
        height: 20px
    }

    #menu #start {
        background: var(--fg);
        color: var(--bg);
        border-color: var(--fg);
        font-weight: 700;
        margin-top: 6px
    }

    #end h1 {
        margin: 0;
        font-size: 34px
    }

    #end p {
        margin: 0;
        color: var(--mut)
    }