#games-top,
#games-top > .container > section[id] {
    scroll-margin-top: calc(var(--navbar-height, 56px) + 16px);
}

/* Keep the navbar blur off the ancestor of the viewport-docked menu. */
.navbar:has(.dash-jump) {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.navbar:has(.dash-jump)::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
}

.dash-jump {
    --jump-safe-left: env(safe-area-inset-left, 0px);
    --jump-safe-right: env(safe-area-inset-right, 0px);
    --jump-safe-top: env(safe-area-inset-top, 0px);
    --jump-safe-bottom: env(safe-area-inset-bottom, 0px);
    position: fixed;
    left: env(safe-area-inset-left, 0px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 85;
    color: var(--text-color);
    transition-property: none;
}

.dash-jump-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 56px;
    min-height: 80px;
    padding: 10px 6px;
    border: 1px solid var(--brand-navy-deep);
    border-left: 0;
    border-radius: 0 16px 16px 0;
    background: var(--brand-navy-deep);
    color: #fff;
    box-shadow: 2px 3px 12px rgba(30, 58, 95, 0.16);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    list-style: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 160ms ease, box-shadow 160ms ease;
}

.dash-jump-die {
    flex: none;
    color: #ffe0a3;
}

.dash-jump-toggle span {
    max-width: 2.5em;
    text-align: center;
}

.dash-jump-toggle::-webkit-details-marker { display: none; }
.dash-jump-move-hint { display: none; }

@media (max-width: 1024px) {
    .dash-jump:not([data-edge], [data-dragging]) {
        position: relative;
        inset: auto;
        transform: none;
        margin-left: auto;
    }
    .dash-jump-toggle {
        flex-direction: row;
        gap: 5px;
        width: max-content;
        min-height: 44px;
        padding: 0 12px;
        border: 1px solid var(--brand-navy-deep);
        border-radius: 999px;
        box-shadow: none;
    }
    .dash-jump-die { width: 22px; height: 22px; }
    .dash-jump-toggle span { max-width: none; white-space: nowrap; }
    .dash-jump:not([data-edge], [data-dragging]) .dash-jump-panel {
        top: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        max-height: calc(100dvh - var(--navbar-height) - 20px - env(safe-area-inset-bottom, 0px));
    }
    .dash-jump[open]:not([data-edge], [data-dragging])::before {
        left: 0;
        top: 100%;
        width: 100%;
        height: 8px;
    }
}

@media (max-width: 1024px) and (any-pointer: coarse) {
    .dash-jump-toggle {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    .dash-jump[data-edge],
    .dash-jump[data-dragging] { transform: none; }
    .dash-jump[data-edge] .dash-jump-toggle {
        border: 1px solid var(--brand-navy-deep);
    }
    .dash-jump[data-edge="left"] .dash-jump-toggle { border-radius: 0 16px 16px 0; }
    .dash-jump[data-edge="right"] .dash-jump-toggle { border-radius: 16px 0 0 16px; }
    .dash-jump[data-edge="top"] .dash-jump-toggle { border-radius: 0 0 16px 16px; }
    .dash-jump[data-edge="bottom"] .dash-jump-toggle { border-radius: 16px 16px 0 0; }
    .dash-jump[data-dragging] .dash-jump-toggle {
        border-radius: 16px;
        outline: 3px solid #ffe0a3;
        outline-offset: -3px;
        box-shadow: 0 8px 24px rgba(30, 58, 95, 0.3);
        cursor: grabbing;
    }
    .dash-jump[data-edge] .dash-jump-panel {
        position: fixed;
        transform: none;
    }
    .dash-jump[data-edge]::before { display: none; }
    .dash-jump-move-hint {
        display: block;
        margin: 8px 10px 4px;
        color: var(--text-color);
        font-size: 12px;
        line-height: 1.5;
    }
}

.dash-jump[open] .dash-jump-toggle {
    background: var(--brand-navy);
    border-color: var(--brand-navy);
}

.dash-jump-panel {
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    width: min(256px, calc(100vw - 88px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    max-height: calc(100dvh - 160px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 1px solid #dce4ef;
    border-radius: 20px;
    background: var(--bg-color);
    box-shadow: 0 12px 36px rgba(30, 58, 95, 0.14), 0 2px 6px rgba(30, 58, 95, 0.04);
    transition-property: none;
}

.dash-jump-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 10px;
    border-radius: 12px;
    color: var(--text-color);
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
    touch-action: manipulation;
    transition: background-color 160ms ease, color 160ms ease;
}

.dash-jump-icon {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    height: 34px;
    border-radius: 11px;
}

.dash-jump-icon--ranking { color: #a76a13; background: #fff4d9; }
.dash-jump-icon--online { color: #365caf; background: #edf2ff; }
.dash-jump-icon--special { color: #8560a8; background: #f4edfa; }
.dash-jump-icon--offline { color: #397b68; background: #eaf5ef; }

.dash-jump-panel a[aria-current="location"] {
    background: #edf3ff;
    color: var(--brand-navy);
    font-weight: 700;
    box-shadow: inset 0 0 0 1px #dce7fc;
}

.dash-jump-panel a:not(.dash-jump-top)::after {
    content: "";
    flex: 0 0 6px;
    height: 6px;
    margin-left: auto;
    border-radius: 50%;
    background: transparent;
}

.dash-jump-panel a[aria-current="location"]::after {
    background: currentColor;
    box-shadow: 0 0 0 3px #dce7fc;
}

.dash-jump-panel .dash-jump-top {
    justify-content: space-between;
    min-height: 44px;
    margin-top: 6px;
    padding-inline: 12px;
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 10px 10px;
    color: #626f82;
}

.dash-jump-top-icon {
    display: grid;
    place-items: center;
    flex: 0 0 26px;
    height: 26px;
    border-radius: 50%;
    background: #f0f3f8;
}

.dash-jump-toggle:focus-visible,
.dash-jump-panel a:focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 2px;
}

@media (hover: hover) {
    .dash-jump-toggle:hover { background: var(--brand-navy); }
    .dash-jump-panel a:hover { background: var(--bg-light); }
    .dash-jump-panel a[aria-current="location"]:hover { background: #e5edff; }
}

@media (any-hover: hover) {
    /* Keep the path from the trigger into the offset card hoverable. */
    .dash-jump[open]::before {
        content: "";
        position: absolute;
        left: 100%;
        top: 0;
        width: 10px;
        height: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dash-jump-toggle,
    .dash-jump-panel a { transition: none; }
}

body.nav-menu-open .dash-jump,
body:has(input:focus, textarea:focus, [contenteditable="true"]:focus) .dash-jump,
body:has(.custom-modal.show, .modal.active, .modal.show, .modal-overlay.active) .dash-jump {
    display: none;
}

@media print {
    .dash-jump { display: none; }
}
