.endless-runner-page {
    --runner-ink: var(--color-text);
    --runner-muted: var(--color-muted);
    --runner-surface: var(--color-surface);
    --runner-surface-muted: var(--color-surface-muted);
    --runner-border: var(--color-border);
    --runner-accent: var(--color-secondary-accent);
    --runner-action: var(--color-action-bg);
    --runner-focus: var(--color-focus);
}

.endless-runner-page .runner-panel {
    display: grid;
    gap: clamp(1rem, 2vw, 1.5rem);
    padding: clamp(0.85rem, 2vw, 1.5rem);
    overflow: hidden;
    background: var(--runner-surface);
}

.runner-scorebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.runner-state {
    color: var(--runner-accent);
    font-size: 0.9rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.runner-score-list {
    display: flex;
    gap: clamp(0.8rem, 3vw, 2rem);
    margin: 0;
}

.runner-score-item {
    display: grid;
    gap: 0.1rem;
    min-width: 5rem;
    text-align: right;
}

.runner-score-item dt {
    color: var(--runner-muted);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.runner-score-item dd {
    margin: 0;
    color: var(--runner-ink);
    font-variant-numeric: tabular-nums;
    font-size: clamp(1.25rem, 1rem + 1vw, 1.7rem);
    font-weight: 800;
    line-height: 1;
}

.runner-stage {
    position: relative;
    width: 100%;
    min-height: 15rem;
    max-height: 30rem;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    border: 1px solid var(--runner-border);
    border-radius: calc(var(--tool-radius) + 0.15rem);
    background: var(--runner-surface-muted);
    isolation: isolate;
}

.runner-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
    touch-action: none;
    user-select: none;
}

.runner-canvas:focus-visible {
    outline: 3px solid var(--runner-focus);
    outline-offset: -3px;
}

.runner-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 0.7rem;
    padding: 1.5rem;
    text-align: center;
    background: color-mix(in srgb, var(--runner-surface) 87%, transparent);
}

.runner-overlay[hidden] {
    display: none;
}

.runner-overlay__eyebrow,
.runner-overlay__message,
.runner-overlay__hint {
    margin: 0;
}

.runner-overlay__eyebrow {
    color: var(--runner-accent);
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.runner-overlay__message {
    color: var(--runner-ink);
    font-size: clamp(1.35rem, 1rem + 1vw, 2rem);
    font-weight: 800;
}

.runner-overlay__hint {
    max-width: 34rem;
    color: var(--runner-muted);
    font-size: 0.95rem;
}

.runner-live-status {
    min-height: 1.4em;
    margin: 0;
    padding-inline: 0.5rem;
    color: var(--runner-muted);
    font-size: 0.95rem;
    text-align: center;
}

.runner-instructions {
    display: grid;
    gap: 0.8rem;
    padding: 0.95rem 0 0.15rem;
    border-top: 1px solid var(--runner-border);
}

.runner-instructions h3 {
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.runner-instructions ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.6rem clamp(1rem, 4vw, 3.5rem);
    margin: 0;
    padding: 0;
    color: var(--runner-muted);
    list-style: none;
}

.runner-instructions li {
    max-width: 28rem;
    margin: 0;
    color: var(--runner-muted);
    text-align: center;
}

.runner-noscript {
    margin: 0;
    color: var(--color-error);
}

@media (max-width: 560px) {
    .runner-scorebar {
        align-items: flex-start;
        flex-direction: column;
    }

    .runner-score-list {
        width: 100%;
        justify-content: space-between;
    }

    .runner-score-item {
        text-align: left;
    }

    .runner-stage {
        min-height: 16rem;
        aspect-ratio: 1.18;
    }

    .runner-instructions {
        gap: 0.65rem;
        padding-top: 0.8rem;
    }

    .runner-instructions ul {
        display: grid;
        gap: 0.45rem;
    }

    .runner-instructions li {
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .runner-canvas {
        scroll-behavior: auto;
    }
}
