@font-face
{
    font-family: Syne;
    src: url("./fonts/syne-latin-700-normal.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face
{
    font-family: Syne;
    src: url("./fonts/syne-latin-800-normal.woff2") format("woff2");
    font-weight: 800;
    font-display: swap;
}
@font-face
{
    font-family: Outfit;
    src: url("./fonts/outfit-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}
@font-face
{
    font-family: "IBM Plex Mono";
    src: url("./fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
:root
{
    color-scheme: dark;
    --void: #07080A;
    --mist: #D5E8E2;
    --mute: #8AA39A;
    --head: #E9FFF8;
    --green: #2EE6A6;
    --stroke: #234840;
    --pink: #FF5D73;
    font: 400 15px/1.45 Outfit, sans-serif;
    color: var(--mist);
    background: var(--void);
    -webkit-tap-highlight-color: transparent;
}
*
{
    box-sizing: border-box;
}
body
{
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    background: var(--void);
}
[hidden]
{
    display: none !important;
}
button, input
{
    font: inherit;
}
button, a, input, summary
{
    -webkit-tap-highlight-color: transparent;
}
button, summary
{
    cursor: pointer;
}
button
{
    min-height: 44px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: transparent;
    color: var(--mist);
    transition: background 120ms, transform 80ms;
    font-weight: 500;
}
button:hover
{
    background: rgba(46, 230, 166, 0.08);
}
button:active
{
    transform: scale(0.98);
}
button:disabled
{
    cursor: default;
    opacity: 0.65;
}
:focus-visible
{
    outline: 2px solid var(--green);
    outline-offset: 3px;
}
#floor
{
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    display: block;
    touch-action: none;
}
.topbar
{
    position: fixed;
    z-index: 3;
    top: 0;
    left: 0;
    width: 100%;
    padding: calc(12px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    pointer-events: none;
}
.brand
{
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.brand-mark
{
    width: 24px;
    height: 24px;
    border: 3px solid var(--green);
    border-right-color: transparent;
    border-radius: 50%;
    transform: rotate(-35deg);
    flex-shrink: 0;
}
.wordmark
{
    font: 700 18px/1.15 Syne, sans-serif;
    color: var(--head);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.studio-small
{
    font-size: 12px;
    color: var(--mute);
    display: block;
    margin-top: 3px;
}
.top-actions
{
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.icon-button
{
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    pointer-events: auto;
    background: rgba(7, 8, 10, 0.64);
}
.card
{
    width: 400px;
    padding: 28px;
    border: 1px solid var(--stroke);
    border-radius: 20px;
    background: rgba(12, 20, 20, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    scrollbar-width: thin;
    scrollbar-color: var(--stroke) transparent;
}
.start-card
{
    position: fixed;
    z-index: 4;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    max-height: calc(100dvh - 112px);
    overflow: auto;
}
.eyebrow
{
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--mute);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
}
.eyebrow::before
{
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green);
}
h1, h2
{
    font-family: Syne, sans-serif;
    font-weight: 800;
    letter-spacing: -0.055em;
    color: var(--head);
    margin: 0 0 16px;
    line-height: 1.07;
}
h1
{
    font-size: 44px;
}
h2
{
    font-size: 36px;
}
p
{
    margin: 0;
}
.deck
{
    font-size: 16px;
    line-height: 1.45;
    margin-bottom: 12px;
    max-width: 31ch;
}
.collect
{
    color: var(--mute);
    font-size: 14px;
    margin-bottom: 4px;
}
.rule-line
{
    color: var(--mute);
    font-size: 12px;
    max-width: 38ch;
}
.primary
{
    background: var(--green);
    color: #071410;
    border-color: var(--green);
    font-weight: 600;
    min-height: 48px;
}
.primary:hover
{
    background: #76F6C4;
    border-color: #76F6C4;
}
.start-button
{
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    margin-top: 24px;
}
.start-button span
{
    font-size: 22px;
    font-weight: 400;
}
details
{
    margin: 12px 0 24px;
    font-size: 13px;
}
summary
{
    min-height: 44px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    border-radius: 12px;
    border: 1px solid var(--stroke);
    padding: 0 14px;
}
summary::-webkit-details-marker
{
    display: none;
}
summary::after
{
    content: "+";
    color: var(--mute);
    font-size: 20px;
}
details[open] summary::after
{
    content: "−";
}
.instructions
{
    padding: 12px 4px 0;
    color: var(--mute);
}
.instructions p + p
{
    margin-top: 8px;
}
fieldset
{
    padding: 0;
    border: 0;
    margin: 0;
    min-width: 0;
}
legend, .section-label
{
    padding: 0;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--mute);
    margin: 0 0 10px;
}
.rule-options
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.rule-option
{
    position: relative;
    cursor: pointer;
}
.rule-option input
{
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}
.rule-option span
{
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    padding: 12px 14px;
    min-height: 46px;
    font-size: 14px;
}
.rule-option span::before
{
    content: "";
    width: 12px;
    height: 12px;
    border: 1px solid var(--stroke);
    border-radius: 50%;
}
.rule-option input:checked + span
{
    border-color: var(--green);
    background: rgba(46, 230, 166, 0.05);
}
.rule-option input[value="walls"]:checked + span
{
    border-color: var(--pink);
}
.rule-option input:checked + span::before
{
    border: 3px solid #0C1414;
    background: var(--green);
    box-shadow: 0 0 0 1px var(--green);
}
.rule-option input[value="walls"]:checked + span::before
{
    background: var(--pink);
    box-shadow: 0 0 0 1px var(--pink);
}
.rule-option input:focus-visible + span
{
    outline: 2px solid var(--green);
    outline-offset: 3px;
}
.rule-hint
{
    min-height: 20px;
    font-size: 12px;
    color: var(--mute);
    margin-top: 8px;
}
.bests
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 20px 0;
    margin: 20px 0;
    border-top: 1px solid var(--stroke);
    border-bottom: 1px solid var(--stroke);
}
.bests span
{
    font-size: 12px;
    color: var(--mute);
    display: block;
}
.bests strong
{
    display: block;
    font: 500 23px/1.3 "IBM Plex Mono", monospace;
    color: var(--head);
    margin-top: 4px;
}
.empty
{
    color: var(--mute);
    font-size: 12px;
}
.board
{
    list-style: none;
    padding: 0;
    margin: 0;
}
.board li
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    font: 500 12px/1.5 "IBM Plex Mono", monospace;
    border-bottom: 1px solid rgba(35, 72, 64, 0.5);
    padding: 8px 0;
}
.board .rank
{
    color: var(--mute);
    padding-right: 12px;
}
.place
{
    color: var(--mute);
    font-size: 11px;
    margin-top: 24px;
    line-height: 1.5;
}
.credit
{
    display: inline-block;
    color: var(--mute);
    font-size: 12px;
    margin-top: 8px;
    text-decoration: none;
    text-underline-offset: 3px;
}
.credit:hover
{
    text-decoration: underline;
}
.scene-note
{
    position: fixed;
    right: 36px;
    bottom: 32px;
    text-align: right;
    pointer-events: none;
}
.scene-note strong
{
    display: block;
    font: 500 12px "IBM Plex Mono", monospace;
    color: var(--green);
    margin-bottom: 10px;
}
.scene-note p
{
    font-size: 12px;
    color: var(--mute);
}
.scene-note small
{
    display: block;
    font: 500 9px "IBM Plex Mono", monospace;
    color: var(--mute);
    letter-spacing: 0.13em;
    margin-top: 8px;
}
.hud
{
    display: flex;
    gap: 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.chip
{
    font: 500 13px "IBM Plex Mono", monospace;
    background: rgba(7, 8, 10, 0.72);
    border: 1px solid var(--stroke);
    border-radius: 30px;
    padding: 10px 12px;
    white-space: nowrap;
}
.chip span
{
    color: var(--mute);
    font-size: 11px;
    margin-right: 8px;
}
.chip b
{
    font-weight: 500;
    display: inline-block;
}
.rule-chip
{
    border-color: var(--green);
}
.rule-chip.walls
{
    border-color: var(--pink);
}
.pips
{
    display: inline-flex;
    gap: 3px;
    margin-left: 8px;
    vertical-align: middle;
}
.pips i
{
    height: 6px;
    width: 6px;
    border-radius: 50%;
    background: #1A3330;
}
.pips i.filled
{
    background: var(--green);
}
.scrim
{
    position: fixed;
    inset: 0;
    z-index: 5;
    background: rgba(7, 8, 10, 0.45);
    display: grid;
    place-items: center;
}
.dialog-card
{
    max-height: calc(100dvh - 48px);
    overflow: auto;
    animation: appear 160ms ease;
}
.dialog-card .deck
{
    margin-bottom: 24px;
}
.dialog-buttons
{
    display: grid;
    gap: 10px;
    margin-top: 20px;
}
.stats
{
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-block: 1px solid var(--stroke);
    padding-block: 20px;
    margin: 20px 0;
    gap: 8px;
}
.stats span
{
    display: block;
    color: var(--mute);
    font-size: 11px;
    margin-bottom: 6px;
}
.stats b
{
    font: 500 16px "IBM Plex Mono", monospace;
}
.new-best
{
    color: var(--green);
    font-size: 13px;
    margin: 0 0 20px;
}
.save-label
{
    font-size: 12px;
    display: block;
    color: var(--mute);
    margin-bottom: 8px;
}
.save-row
{
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}
.save-row input
{
    min-width: 0;
    width: 100%;
    background: rgba(7, 8, 10, 0.6);
    border: 1px solid var(--stroke);
    color: var(--head);
    border-radius: 12px;
    padding: 10px 14px;
    font: 500 16px "IBM Plex Mono", monospace;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.save-row button
{
    min-width: 86px;
}
.privacy
{
    color: var(--mute);
    font-size: 11px;
    text-align: center;
    margin-top: 16px;
}
.pad
{
    display: none;
    position: fixed;
    z-index: 4;
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    grid-template-columns: repeat(3, 64px);
    grid-template-rows: repeat(3, 64px);
    gap: 8px;
}
.pad button
{
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: rgba(12, 20, 20, 0.8);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    touch-action: none;
}
.pad button::after
{
    content: "";
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--mist);
    border-right: 2px solid var(--mist);
}
.pad button:active
{
    background: rgba(46, 230, 166, 0.16);
}
.pad [data-direction="north"]
{
    grid-column: 2;
    grid-row: 1;
}
.pad [data-direction="north"]::after
{
    transform: translateY(3px) rotate(-45deg);
}
.pad [data-direction="west"]
{
    grid-column: 1;
    grid-row: 2;
}
.pad [data-direction="west"]::after
{
    transform: translateX(3px) rotate(-135deg);
}
.pad [data-direction="east"]
{
    grid-column: 3;
    grid-row: 2;
}
.pad [data-direction="east"]::after
{
    transform: translateX(-3px) rotate(45deg);
}
.pad [data-direction="south"]
{
    grid-column: 2;
    grid-row: 3;
}
.pad [data-direction="south"]::after
{
    transform: translateY(-3px) rotate(135deg);
}
.play-hints
{
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--mute);
    font: 500 10px "IBM Plex Mono", monospace;
    letter-spacing: 0.08em;
    display: flex;
    gap: 28px;
}
.sr-only
{
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.score-pop
{
    animation: pop 120ms ease-in-out;
}
@keyframes pop
{
    50% { transform: scale(1.08); }
}
@keyframes appear
{
    from { opacity: 0; }
    to { opacity: 1; }
}
@media (max-width: 1050px) and (min-width: 800px)
{
    .studio-small { display: none; }
    .brand { gap: 8px; }
    .wordmark { font-size: 15px; }
    .hud { left: 51%; gap: 5px; }
    .chip { padding: 10px; }
}
@media (max-width: 899px)
{
    .start-card, .dialog-card
    {
        position: fixed;
        left: max(12px, env(safe-area-inset-left));
        right: max(12px, env(safe-area-inset-right));
        bottom: calc(12px + env(safe-area-inset-bottom));
        top: auto;
        transform: none;
        width: auto;
        padding: 20px;
        max-height: 58dvh;
    }
    .dialog-card { max-height: 70dvh; }
    h1 { font-size: 34px; margin-bottom: 12px; }
    h2 { font-size: 32px; }
    .eyebrow { margin-bottom: 12px; }
    .start-button { margin-top: 20px; }
    .scene-note { right: 20px; bottom: auto; top: 100px; }
    .scene-note p, .scene-note small { display: none; }
}
@media (max-width: 799px)
{
    .wordmark { max-width: 58vw; }
    .brand { gap: 10px; }
    .hud
    {
        left: 12px;
        right: 12px;
        top: calc(76px + env(safe-area-inset-top));
        transform: none;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
    }
    .chip { padding: 9px 7px; text-align: center; font-size: 12px; }
    .chip span { font-size: 9px; margin-right: 4px; }
    .pips { display: flex; justify-content: center; margin: 5px 0 0; gap: 3px; }
    .pad:not([hidden]) { display: grid; }
    .play-hints { display: none; }
}
@media (pointer: coarse)
{
    .pad:not([hidden]) { display: grid; }
    .play-hints { display: none; }
}
@media (prefers-reduced-motion: reduce)
{
    *, *::before, *::after
    {
        animation: none !important;
        transition: none !important;
    }
    button:active { transform: none; }
}
