/* PlayBed navigation — desktop + app-like mobile navigation */
.pb-header-shell {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.pb-navbar {
    width: min(1180px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.pb-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    font-size: 1.22rem;
    font-weight: 950;
    letter-spacing: -.035em;
}

.pb-brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(124, 92, 255, .26), rgba(49, 215, 199, .12));
    border: 1px solid rgba(124, 92, 255, .22);
}

.pb-primary-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
}

.pb-nav-link,
.pb-profile-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 13px;
    border-radius: 12px;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 800;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}

.pb-nav-link:hover,
.pb-profile-link:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.pb-nav-link.is-active,
.pb-profile-link.is-active {
    color: var(--text);
    background: rgba(124, 92, 255, .14);
}

.pb-nav-link.is-active::after,
.pb-profile-link.is-active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -15px;
    height: 3px;
    border-radius: 99px 99px 0 0;
    background: var(--primary);
}

.pb-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pb-player-chip {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 9px 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 800;
}

.pb-theme-toggle,
.pb-mobile-menu-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
}

.pb-mobile-menu-button,
.pb-mobile-nav,
.pb-mobile-drawer,
.pb-mobile-drawer-backdrop {
    display: none;
}

@media (max-width: 820px) {
    body:not(.pb-immersive-page) {
        padding-bottom: calc(82px + env(safe-area-inset-bottom));
    }

    body.pb-drawer-open {
        overflow: hidden;
    }

    .pb-navbar {
        width: min(100% - 24px, 1180px);
        min-height: 62px;
    }

    .pb-primary-nav,
    .pb-player-chip {
        display: none;
    }

    .pb-brand {
        font-size: 1.08rem;
    }

    .pb-brand-mark {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .pb-mobile-menu-button {
        display: inline-grid;
        place-items: center;
        font-size: 1.15rem;
    }

    .pb-mobile-nav {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
        z-index: 1200;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        min-height: 70px;
        padding: 6px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background: color-mix(in srgb, var(--surface-solid) 94%, transparent);
        box-shadow: 0 18px 45px rgba(0, 0, 0, .36);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .pb-mobile-link {
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 7px 2px;
        border-radius: 16px;
        color: var(--muted);
        font-size: .68rem;
        font-weight: 800;
        line-height: 1;
    }

    .pb-mobile-link .pb-mobile-icon {
        font-size: 1.32rem;
        line-height: 1;
    }

    .pb-mobile-link.is-active {
        color: var(--text);
        background: color-mix(in srgb, var(--primary) 19%, var(--surface));
        box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--primary) 80%, transparent);
    }

    .pb-mobile-link:active {
        transform: scale(.96);
    }

    .pb-mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1300;
        display: block;
        background: rgba(0, 0, 0, .56);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    .pb-mobile-drawer-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .pb-mobile-drawer {
        position: fixed;
        top: 10px;
        left: 10px;
        bottom: calc(86px + env(safe-area-inset-bottom));
        z-index: 1400;
        display: flex;
        flex-direction: column;
        width: min(78vw, 390px);
        max-width: calc(100vw - 70px);
        padding: 22px 20px 28px;
        border: 1px solid var(--border);
        border-radius: 26px;
        background: color-mix(in srgb, var(--surface-solid) 96%, transparent);
        box-shadow: 22px 0 55px rgba(0, 0, 0, .42);
        transform: translateX(calc(-100% - 24px));
        transition: transform .24s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .pb-mobile-drawer.is-open {
        transform: translateX(0);
    }

    .pb-mobile-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding-bottom: 18px;
    }

    .pb-mobile-drawer-head strong {
        color: var(--text);
        font-size: 1.2rem;
        letter-spacing: .14em;
    }

    .pb-mobile-drawer-head button {
        width: 38px;
        height: 38px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--surface);
        color: var(--muted);
        font-size: 1.55rem;
        line-height: 1;
        cursor: pointer;
    }

    .pb-drawer-sections {
        display: grid;
        gap: 0;
    }

    .pb-drawer-section {
        padding: 20px 0;
        border-top: 1px solid var(--border);
    }

    .pb-drawer-section h2 {
        margin: 0 0 12px;
        color: var(--primary);
        font-size: .78rem;
        letter-spacing: .08em;
        text-transform: uppercase;
    }

    .pb-drawer-section a,
    .pb-drawer-section button {
        width: 100%;
        min-height: 46px;
        display: grid;
        grid-template-columns: 26px 1fr;
        align-items: center;
        gap: 10px;
        padding: 8px 0;
        border: 0;
        background: transparent;
        color: var(--muted);
        text-align: left;
        font: inherit;
        font-weight: 750;
        cursor: pointer;
    }

    .pb-drawer-section a:hover,
    .pb-drawer-section button:hover {
        color: var(--text);
    }

    .pb-drawer-install {
        display: grid;
    }

    .pb-site-footer .pb-footer-panel {
        display: none;
    }

    .pb-site-footer {
        margin-top: 26px;
    }

    .pb-site-footer .pb-footer-bottom {
        margin: 0 0 96px;
        padding: 20px 16px;
        border-radius: 20px;
    }

    body.pb-immersive-page .pb-mobile-nav,
    body.pb-immersive-page .pb-mobile-menu-button,
    body.pb-immersive-page .pb-mobile-drawer,
    body.pb-immersive-page .pb-mobile-drawer-backdrop {
        display: none;
    }
}

@media (max-width: 390px) {
    .pb-mobile-link {
        font-size: .62rem;
    }

    .pb-mobile-drawer {
        width: min(84vw, 360px);
        max-width: calc(100vw - 46px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .pb-nav-link,
    .pb-profile-link,
    .pb-mobile-link,
    .pb-mobile-drawer,
    .pb-mobile-drawer-backdrop {
        transition: none;
    }
}

/* Liquid Glass: translucent surfaces, luminous edges and accessible focus. */
.pb-header-shell {
    border-bottom: 1px solid rgba(255, 255, 255, .18);
    background: color-mix(in srgb, var(--bg) 52%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(28px);
    backdrop-filter: saturate(180%) blur(28px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .10), inset 0 1px rgba(255, 255, 255, .15);
}
.pb-navbar { position: relative; }
.pb-primary-nav {
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 48%, transparent);
    box-shadow: inset 0 1px rgba(255, 255, 255, .17), 0 8px 24px rgba(0, 0, 0, .10);
}
.pb-nav-link, .pb-profile-link {
    border: 1px solid transparent;
    border-radius: 15px;
    transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.pb-nav-link:hover, .pb-profile-link:hover,
.pb-nav-link.is-active, .pb-profile-link.is-active {
    color: var(--text);
    border-color: rgba(255, 255, 255, .22);
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    box-shadow: inset 0 1px rgba(255, 255, 255, .24), 0 5px 14px rgba(0, 0, 0, .10);
}
.pb-nav-link.is-active::after, .pb-profile-link.is-active::after { display: none; }
.pb-brand-mark, .pb-theme-toggle, .pb-mobile-menu-button, .pb-player-chip {
    border-color: rgba(255, 255, 255, .24);
    background: color-mix(in srgb, var(--surface) 58%, transparent);
    box-shadow: inset 0 1px rgba(255, 255, 255, .24), 0 5px 16px rgba(0, 0, 0, .10);
}
.pb-nav-link:focus-visible, .pb-profile-link:focus-visible,
.pb-mobile-link:focus-visible, .pb-theme-toggle:focus-visible,
.pb-mobile-menu-button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}
@media (max-width: 820px) {
    .pb-mobile-nav {
        border-color: rgba(255, 255, 255, .30);
        background: color-mix(in srgb, var(--surface-solid) 62%, transparent);
        -webkit-backdrop-filter: saturate(190%) blur(30px);
        backdrop-filter: saturate(190%) blur(30px);
        box-shadow: inset 0 1px rgba(255, 255, 255, .28), 0 14px 40px rgba(0, 0, 0, .25);
    }
    .pb-mobile-link {
        transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
    }
    .pb-mobile-link.is-active {
        border: 1px solid rgba(255, 255, 255, .28);
        background: color-mix(in srgb, var(--primary) 24%, transparent);
        box-shadow: inset 0 1px rgba(255, 255, 255, .32), 0 4px 12px rgba(0, 0, 0, .12);
    }
    .pb-mobile-drawer {
        border-color: rgba(255, 255, 255, .24);
        background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
        -webkit-backdrop-filter: saturate(170%) blur(28px);
        backdrop-filter: saturate(170%) blur(28px);
        box-shadow: inset 0 1px rgba(255, 255, 255, .2), 22px 0 55px rgba(0, 0, 0, .32);
    }
}
@media (prefers-reduced-transparency: reduce) {
    .pb-header-shell, .pb-primary-nav, .pb-mobile-nav, .pb-mobile-drawer {
        background: var(--surface-solid);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .pb-nav-link, .pb-profile-link, .pb-mobile-link { transition: none; }
}


/* iOS-style liquid glass: explicit alpha is essential in light mode. */
.pb-header-shell {
    background: linear-gradient(120deg, rgba(255,255,255,.28), rgba(255,255,255,.07) 48%, rgba(124,92,255,.08)), rgba(235,241,255,.36);
    border-bottom-color: rgba(255,255,255,.55);
    -webkit-backdrop-filter: blur(32px) saturate(210%);
    backdrop-filter: blur(32px) saturate(210%);
    box-shadow: inset 0 1px rgba(255,255,255,.72), 0 8px 28px rgba(30,44,82,.09);
}
html[data-theme="dark"] .pb-header-shell {
    background: linear-gradient(120deg, rgba(255,255,255,.13), rgba(255,255,255,.02) 55%, rgba(124,92,255,.11)), rgba(12,23,43,.40);
    border-bottom-color: rgba(255,255,255,.19);
}
@media (max-width:820px) {
    .pb-mobile-nav {
        isolation: isolate;
        overflow: hidden;
        border: 1px solid rgba(255,255,255,.82);
        background: linear-gradient(135deg, rgba(255,255,255,.50), rgba(255,255,255,.16) 45%, rgba(199,187,255,.20) 100%), rgba(235,241,255,.27);
        -webkit-backdrop-filter: blur(38px) saturate(220%);
        backdrop-filter: blur(38px) saturate(220%);
        box-shadow: inset 0 1.5px 0 rgba(255,255,255,.96), inset 0 -1px 0 rgba(255,255,255,.28), 0 14px 34px rgba(42,48,91,.20), 0 2px 7px rgba(42,48,91,.09);
    }
    .pb-mobile-nav::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        border-radius: inherit;
        background: linear-gradient(165deg, rgba(255,255,255,.48), transparent 37%, transparent 70%, rgba(255,255,255,.18));
    }
    .pb-mobile-link { position: relative; z-index: 1; border: 1px solid transparent; }
    .pb-mobile-link.is-active {
        border: 1px solid rgba(255,255,255,.85);
        background: linear-gradient(145deg, rgba(255,255,255,.70), rgba(191,169,255,.48) 70%, rgba(164,137,255,.30));
        box-shadow: inset 0 1px rgba(255,255,255,.95), 0 3px 12px rgba(96,68,180,.15);
    }
    html[data-theme="dark"] .pb-mobile-nav {
        border-color: rgba(255,255,255,.34);
        background: linear-gradient(135deg, rgba(255,255,255,.19), rgba(255,255,255,.035) 52%, rgba(124,92,255,.16)), rgba(14,25,46,.34);
        box-shadow: inset 0 1px rgba(255,255,255,.34), 0 16px 40px rgba(0,0,0,.36);
    }
    html[data-theme="dark"] .pb-mobile-link.is-active {
        border-color: rgba(255,255,255,.33);
        background: linear-gradient(145deg, rgba(174,153,255,.38), rgba(124,92,255,.20));
        box-shadow: inset 0 1px rgba(255,255,255,.34), 0 4px 12px rgba(0,0,0,.14);
    }
}
@media (prefers-reduced-transparency:reduce) {
    .pb-header-shell, .pb-mobile-nav { background: var(--surface-solid); -webkit-backdrop-filter:none; backdrop-filter:none; }
}
