/* ======================
GLASS NAVBAR
====================== */

.nav-mobile-menu, .nav-icon-definitions, .nav-item-icon, .nav-item-chevron { display: none; }

/* Shared edge alignment overrides the older page-specific floating insets. */
body > .navbar {
    width: 100% !important;
    margin: 0 !important;
    top: 0 !important;
}

.navbar {
    --hood-depth: 0px;
    --nav-glass-control: linear-gradient(165deg, #fff 0%, #fbfdff 28%, #e2f2fc 66%, #c6e8f7 88%, #f5fcff 100%);
    /* Blurred menus retain the same cyan transmission as the reference. */
    --nav-glass-panel: linear-gradient(135deg, rgba(246, 253, 255, .76), rgba(204, 241, 254, .53));
    --nav-glass-edge: var(--glass-edge, rgba(255, 255, 255, .95));
    /* Pearl uses reflective highlights and contact shadows without a halo. */
    --nav-control-shadow: inset 0 0 0 1px rgba(255, 255, 255, .9), inset 0 1px 2px #fff, inset 0 -2px 3px rgba(126, 169, 194, .12), 0 2px 3px rgba(22, 61, 84, .12), 0 4px 8px rgba(22, 61, 84, .08);
    --nav-glass-ink: #07112e;
    --nav-glass-muted: #315f8d;
    --nav-glass-menu-shadow: inset 0 1px 2px #fff,
        inset 0 -1px 1px rgba(255, 255, 255, .6), 0 12px 28px rgba(22, 61, 84, .18);
    --nav-selected-radius: 7px;
    --nav-selected-shadow: var(--nav-control-shadow);
    view-transition-name: site-navbar;

    position: sticky;
    top: var(--navbar-inset);
    z-index: 1000;

    width: calc(100% - 32px);
    height: var(--navbar-height);
    flex-shrink: 0;

    margin: var(--navbar-inset) auto 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 24px;

    /* Visual finish lives on .navbar-surface so dropdowns stay unclipped */
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;

    overflow: visible;
}

/* Hand off the shared bar without the browser's default fade or movement. */
::view-transition-group(site-navbar),
::view-transition-old(site-navbar),
::view-transition-new(site-navbar) {
    animation: none;
}

::view-transition-old(site-navbar) {
    display: none;
}

::view-transition-new(site-navbar) {
    mix-blend-mode: normal;
}

/* ======================
FROSTED SURFACE
====================== */

.navbar-surface {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: calc(var(--hood-depth) * -1);

    pointer-events: none;
    z-index: 0;

    /* Cool pearl body with a broad reflection and blue at its lower edge. */
    background:
        radial-gradient(ellipse 38% 220% at 7% 5%, rgba(218, 205, 246, .32), transparent 78%),
        radial-gradient(ellipse 44% 230% at 92% 85%, rgba(136, 220, 246, .35), transparent 80%),
        linear-gradient(180deg, #fff 0%, #fafcff 16%, #edf5fc 40%, #d3e7f4 73%, #c4e3f3 88%, #f4fbff 100%);

    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);

    border-radius: inherit;
    border: 1px solid var(--nav-glass-edge);

    box-shadow:
        0 3px 8px rgba(22, 61, 84, .12),
        inset 0 2px 1px #fff,
        inset 0 -2px 1px rgba(255, 255, 255, .9);
}

.navbar-surface::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(112deg, transparent 12%, rgba(255, 255, 255, .18) 23%, rgba(255, 255, 255, .85) 36%, rgba(255, 255, 255, .4) 49%, transparent 65%);
}

/* ======================
LOGO
====================== */

.logo {
    position: relative;
    z-index: 2;

    display: flex;
    align-items: center;
}

/* Shared by the navbar and the "Get LooksRanked" button. */
.wordmark {
    display: inline-block;
    font-family: "Mozilla Text", sans-serif;
    font-weight: 850;
    letter-spacing: -0.03em;

    color: #07112e;

    text-decoration: none;
    filter: drop-shadow(0 1px 2px rgba(24, 48, 64, 0.12));
}

.logo a {
    font-size: 30px;
}

.wordmark-ranked {
    color: #009aff;
    font-style: italic;
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    .wordmark-ranked {
        /* Paint the italic overhang without changing the wordmark's width. */
        padding-right: 0.2em;
        margin-right: -0.2em;
        background-image: linear-gradient(to bottom, #009dff, #008dff);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
}

.logo a:visited {
    color: #181818;
}

.logo a:hover {
    color: #181818;
    text-decoration: none;

    opacity: 0.72;
}

/* ======================
NAV LINKS
====================== */

.nav-links {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;

    display: flex;
    align-items: center;

    gap: 8px;

    transform: translate(-50%, -50%);
}

.nav-links a {
    text-decoration: none;

    color: rgba(20, 20, 20, 0.82);

    font-size: 16px;
    font-weight: 700;

    padding: 12px 19px;

    border-radius: 7px;

    transition:
        background 0.2s ease,
        box-shadow 0.2s ease,
        color 0.2s ease;
}

.nav-links a:hover {
    color: #111;

    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.88),
            rgba(232, 240, 246, 0.78)
        );

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 1px rgba(140, 165, 185, 0.12),
        0 6px 14px rgba(42, 78, 112, 0.10);
}

.nav-links a:focus-visible {
    outline: 3px solid #278fc7;
    outline-offset: 3px;
}

/* ======================
LOGIN BUTTON
====================== */

.login-btn {
    position: relative;
    z-index: 2;

    color: #111;

    background:
        radial-gradient(
            ellipse at 25% 10%,
            rgba(255, 255, 255, 0.96),
            rgba(255, 255, 255, 0) 48%
        ),
        linear-gradient(
            145deg,
            #fffdf9,
            #edf2f5
        );

    border: 1px solid rgba(255, 255, 255, 0.92);

    border-radius: 999px;

    padding: 12px 24px;

    font-size: 15px;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 7px 15px rgba(42, 78, 112, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 2px rgba(145, 170, 190, 0.16);

    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.login-btn:hover {
    box-shadow:
        0 10px 20px rgba(42, 78, 112, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 2px rgba(145, 170, 190, 0.18);
}

.login-btn:active {
    box-shadow:
        inset 0 2px 4px rgba(120, 145, 168, 0.16),
        inset 0 -1px 0 rgba(255, 255, 255, 0.9);
}

/* ======================
ACCOUNT MENU
====================== */

.nav-account {
    position: relative;
    z-index: 3;

    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-mobile-controls {
    display: contents;
}

.nav-menu-toggle {
    display: none;
}

.account-menu {
    position: relative;
}

/* ======================
NOTIFICATIONS BELL
====================== */

.nav-notifications {
    position: relative;
}

.nav-notifications[hidden] {
    display: none !important;
}

.nav-bell-btn {
    position: relative;
    z-index: 2;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;
    padding: 0;

    border: 0;
    border-radius: 14px;

    color: #111;
    cursor: pointer;

    background:
        radial-gradient(
            ellipse at 25% 10%,
            rgba(255, 255, 255, 0.96),
            rgba(255, 255, 255, 0) 48%
        ),
        linear-gradient(
            145deg,
            #fffdf9,
            #edf2f5
        );

    box-shadow:
        0 8px 16px rgba(42, 78, 112, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 2px rgba(145, 170, 190, 0.16);
}

.nav-bell-btn:hover {
    box-shadow:
        0 10px 18px rgba(42, 78, 112, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 2px rgba(145, 170, 190, 0.18);
}

.nav-bell-btn:active {
    box-shadow:
        inset 0 2px 4px rgba(120, 145, 168, 0.16),
        inset 0 -1px 0 rgba(255, 255, 255, 0.9);
}

.nav-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;

    min-width: 18px;
    height: 18px;
    padding: 0 5px;

    border-radius: 999px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: #1f4f7a;
    color: #fff;

    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.nav-bell-badge[hidden] {
    display: none !important;
}

.nav-notifications-dropdown {
    position: absolute;

    top: calc(100% + 10px);
    right: 0;

    width: min(340px, calc(100vw - 24px));

    padding: 8px;

    border-radius: 18px;

    background:
        radial-gradient(
            ellipse at 18% 8%,
            rgba(255, 243, 230, 0.56),
            transparent 40%
        ),
        radial-gradient(
            ellipse at 82% 82%,
            rgba(205, 236, 255, 0.42),
            transparent 44%
        ),
        linear-gradient(
            145deg,
            rgba(255, 253, 251, 0.82) 0%,
            rgba(242, 245, 247, 0.80) 70%,
            rgba(248, 246, 243, 0.82) 100%
        );

    backdrop-filter: blur(20px) saturate(1.12);
    -webkit-backdrop-filter: blur(20px) saturate(1.12);

    border: 1px solid rgba(255, 255, 255, 0.86);

    box-shadow:
        0 16px 36px rgba(42, 78, 112, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 2px rgba(145, 170, 190, 0.14);

    z-index: 25;
}

.nav-notifications-dropdown[hidden] {
    display: none !important;
}

.nav-notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    padding: 8px 10px 10px;

    border-bottom: 1px solid rgba(20, 20, 20, 0.08);

    font-size: 13px;
    font-weight: 700;
    color: rgba(20, 20, 20, 0.72);
}

.nav-notifications-mark-all {
    border: 0;
    background: transparent;
    color: rgba(31, 79, 122, 0.95);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 6px;
    border-radius: 8px;
    transition: transform 0.12s ease, background 0.12s ease;
}

.nav-notifications-mark-all:hover {
    background: rgba(255, 255, 255, 0.55);
}

.nav-notifications-mark-all:active {
    transform: translateY(1px);
    background: rgba(224, 237, 246, 0.75);
}

.nav-notifications-list {
    max-height: 320px;
    overflow: auto;
    padding: 6px 0;
}

.nav-notifications-empty {
    margin: 0;
    padding: 14px 12px;
    color: rgba(20, 20, 20, 0.55);
    font-size: 13px;
}

.nav-notification-row {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    font: inherit;
    color: rgba(20, 20, 20, 0.88);
}

.nav-notification-row:hover {
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.82),
            rgba(224, 237, 246, 0.65)
        );
}

.nav-notification-row.is-unread {
    box-shadow: inset 3px 0 0 rgba(31, 79, 122, 0.55);
}

.nav-notification-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 3px;
}

.nav-notification-meta {
    display: block;
    font-size: 11px;
    color: rgba(20, 20, 20, 0.5);
}

.nav-notifications-footer {
    display: block;
    text-align: center;
    text-decoration: none;
    padding: 10px 12px 6px;
    border-top: 1px solid rgba(20, 20, 20, 0.08);
    color: rgba(31, 79, 122, 0.95);
    font-size: 13px;
    font-weight: 700;
}

.account-menu-toggle {
    max-width: 160px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ======================
ACCOUNT DROPDOWN
====================== */

.account-dropdown {
    position: absolute;

    top: calc(100% + 10px);
    right: 0;

    min-width: 200px;

    padding: 8px;

    border-radius: 18px;

    /*
    Smaller pearl surface for dropdown.
    */
    background:
        radial-gradient(
            ellipse at 18% 8%,
            rgba(255, 243, 230, 0.56),
            transparent 40%
        ),
        radial-gradient(
            ellipse at 82% 82%,
            rgba(205, 236, 255, 0.42),
            transparent 44%
        ),
        linear-gradient(
            145deg,
            rgba(255, 253, 251, 0.82) 0%,
            rgba(242, 245, 247, 0.80) 70%,
            rgba(248, 246, 243, 0.82) 100%
        );

    backdrop-filter: blur(20px) saturate(1.12);
    -webkit-backdrop-filter: blur(20px) saturate(1.12);

    border: 1px solid rgba(255, 255, 255, 0.86);

    box-shadow:
        0 16px 36px rgba(42, 78, 112, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 2px rgba(145, 170, 190, 0.14);

    display: flex;
    flex-direction: column;

    gap: 4px;

    z-index: 20;
}

.account-credits {
    padding: 8px 12px 10px;
    margin-bottom: 2px;

    border-bottom: 1px solid rgba(20, 20, 20, 0.08);

    color: rgba(20, 20, 20, 0.62);

    font-size: 13px;
    font-weight: 700;

    pointer-events: none;
    user-select: none;
}

/* Author display otherwise wins over the hidden attribute. */

.account-dropdown[hidden],
.account-menu[hidden],
.account-dropdown a[hidden],
.account-dropdown button[hidden] {
    display: none !important;
}

.account-dropdown a,
.account-dropdown button {
    display: block;

    width: 100%;

    text-align: left;
    text-decoration: none;

    border: 0;

    background: transparent;

    color: rgba(20, 20, 20, 0.88);

    font: inherit;
    font-size: 14px;
    font-weight: 700;

    padding: 10px 12px;

    border-radius: 12px;

    cursor: pointer;

    transition:
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.account-dropdown a:hover,
.account-dropdown button:hover {
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.82),
            rgba(224, 237, 246, 0.65)
        );

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 4px 10px rgba(42, 78, 112, 0.07);
}

/* ======================
RESPONSIVE
====================== */

/* Scale the existing desktop controls from the shared bar height. Keep bounds
   for legibility and usable targets; phone controls retain their own sizing. */
@media (min-width: 801px) {
    :root { --navbar-height: clamp(64px, 5.208333vw, 80px); }
    .navbar {
        --navbar-size-unit: calc(var(--navbar-height) / 78);
        width: calc(100% - clamp(24px, var(--navbar-size-unit) * 32, 44px));
        padding-inline: clamp(16px, calc(var(--navbar-size-unit) * 24), 32px);
        gap: clamp(8px, calc(var(--navbar-size-unit) * 12), 16px);
    }
    .navbar .logo a { font-size: clamp(25px, calc(var(--navbar-size-unit) * 30), 40px); }
    .nav-links {
        gap: clamp(4px, calc(var(--navbar-size-unit) * 8), 11px);
        padding: 4px;
        border-radius: 10px;
        background: linear-gradient(145deg, rgba(210, 237, 253, .5), rgba(161, 217, 244, .32));
        box-shadow:
            inset 0 0 0 2px rgba(255, 255, 255, .82),
            inset 0 1px 2px #fff,
            0 3px 8px rgba(22, 61, 84, .1);
    }
    .nav-links a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: clamp(40px, calc(var(--navbar-size-unit) * 46), 56px);
        font-size: clamp(14px, calc(var(--navbar-size-unit) * 16), 20px);
        padding: clamp(9px, calc(var(--navbar-size-unit) * 12), 16px)
            clamp(12px, calc(var(--navbar-size-unit) * 19), 25px);
        white-space: nowrap;
        color: #07112e;
        background: transparent;
        box-shadow: none;
    }
    .nav-links a:hover {
        background: rgba(244, 251, 255, .68);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
    }
    .nav-links a:active {
        box-shadow:
            inset 0 0 0 1px #b8d3e3,
            inset 0 2px 4px rgba(42, 78, 112, .15);
    }
    .navbar .login-btn {
        font-size: clamp(13px, calc(var(--navbar-size-unit) * 15), 19px);
        padding: clamp(9px, calc(var(--navbar-size-unit) * 12), 16px)
            clamp(16px, calc(var(--navbar-size-unit) * 24), 32px);
        min-height: 40px;
    }
    .nav-account { gap: clamp(8px, calc(var(--navbar-size-unit) * 10), 14px); }
    .nav-bell-btn {
        width: clamp(40px, calc(var(--navbar-size-unit) * 44), 58px);
        height: clamp(40px, calc(var(--navbar-size-unit) * 44), 58px);
        border-radius: clamp(12px, calc(var(--navbar-size-unit) * 14), 18px);
    }
    .nav-bell-icon {
        width: clamp(16px, calc(var(--navbar-size-unit) * 18), 24px);
        height: clamp(16px, calc(var(--navbar-size-unit) * 18), 24px);
    }
    .account-dropdown,
    .nav-notifications-dropdown {
        max-height: calc(var(--page-available-height) - var(--navbar-inset) - 20px);
        overflow-y: auto;
    }
}

/* In narrower desktop windows, flow links between the logo and account so
   their click targets cannot overlap the absolutely centered navigation. */
@media (min-width: 801px) and (max-width: 1519px) {
    .navbar { padding-inline: 12px; }
    .navbar .logo a { font-size: clamp(26px, min(2.25vw, calc(var(--navbar-size-unit) * 30)), 36px); }
    .nav-links { position: relative; left: auto; top: auto; transform: none; gap: clamp(4px, .65vw, 10px); }
    .nav-links a { font-size: clamp(15px, min(1.3vw, calc(var(--navbar-size-unit) * 16)), 18px); padding-inline: clamp(7px, 1vw, 18px); }
    .navbar .login-btn { font-size: clamp(15px, min(1.3vw, calc(var(--navbar-size-unit) * 16)), 18px); padding-inline: clamp(10px, calc(var(--navbar-size-unit) * 12), 16px); }
    .account-menu-toggle { max-width: clamp(88px, 10vw, 120px); }
}

/* Keep all six browse links within the bar in narrow desktop windows. */
@media (min-width: 801px) and (max-width: 900px) {
    .navbar { gap: 8px; }
    .nav-links { gap: 2px; }
    .nav-links a { padding-inline: 4px; }
    .nav-account { gap: 8px; }
    .nav-bell-btn { width: 40px; height: 40px; }
}

@media (max-width: 800px) {
    .navbar {
        --hood-depth: 0px;
        /* Keep the live bar painted on iOS instead of capturing its fixed,
           out-of-scrollport layer during navigation. */
        view-transition-name: none;

        width: calc(100% - 20px);

        height: auto;
        min-height: 64px;

        margin: 10px auto 0;
        top: 10px;

        padding: 10px 12px;
    }

    /* This surface is already opaque; it does not need another filter layer. */
    .navbar-surface {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .logo {
        min-width: 0;
    }

    .logo a {
        font-size: 21px;
    }

    .nav-mobile-controls {
        /* Let the notifications panel use the whole navbar as its anchor. */
        position: static;
        z-index: 4;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .nav-menu-toggle {
        position: relative;
        z-index: 4;
        width: 44px;
        height: 44px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        padding: 0;
        border: 1px solid rgba(255, 255, 255, .8);
        border-radius: 14px;
        background: linear-gradient(145deg, #fffdf9, #edf2f5);
        box-shadow:
            0 7px 15px rgba(42, 78, 112, .12),
            inset 0 1px 0 rgba(255, 255, 255, 1),
            inset 0 -2px 2px rgba(145, 170, 190, .16);
        cursor: pointer;
    }

    .nav-menu-toggle span {
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #181818;
    }

    .nav-links {
        position: absolute;
        top: calc(100% + 8px);
        left: 12px;
        right: 12px;
        z-index: 5;
        display: none;
        align-items: stretch;
        gap: 4px;
        padding: 10px;
        border: 1px solid rgba(255, 255, 255, .68);
        border-radius: 22px;
        background:
            radial-gradient(ellipse at 20% 0%, rgba(255, 255, 255, .86), transparent 52%),
            linear-gradient(145deg, rgba(255, 253, 249, .94), rgba(229, 239, 246, .92));
        box-shadow:
            0 20px 42px rgba(42, 78, 112, .18),
            inset 0 1px 0 rgba(255, 255, 255, .95);
        backdrop-filter: blur(24px) saturate(1.15);
        -webkit-backdrop-filter: blur(24px) saturate(1.15);
        transform: none;
    }

    .navbar.mobile-menu-open .nav-links {
        display: flex;
        flex-direction: column;
    }

    .nav-links a {
        width: 100%;
        padding: 13px 15px;
        border-radius: 14px;
        font-size: 15px;
        text-align: left;
    }

    .login-btn {
        max-width: 112px;
        overflow: hidden;
        padding: 10px 14px;
        font-size: 13px;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .nav-account {
        position: static;
        gap: 7px;
    }

    .nav-notifications {
        position: static;
    }

    .nav-notifications-dropdown {
        top: calc(100% + 8px);
        left: 12px;
        right: 12px;
        width: auto;
        /* Reserve the navbar, its gap, and the phone's safe areas. */
        max-height: calc(100vh - 110px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        max-height: calc(100dvh - 110px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .nav-notifications-header,
    .nav-notifications-footer {
        flex-shrink: 0;
    }

    .nav-notifications-list {
        min-height: 0;
        overscroll-behavior: contain;
    }

    .nav-notification-row {
        overflow-wrap: anywhere;
    }

    .nav-bell-btn {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 420px) {
    .logo a {
        font-size: 19px;
    }


}

@media (max-width: 850px) {
    .account-dropdown,
    .nav-notifications-dropdown,
    .nav-links {
        background: linear-gradient(145deg, #fffdf9 0%, #edf2f5 100%);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* One phone navbar size across all pages, matching the Compare layout. */
@media (max-width: 600px) {
    .navbar {
        top: calc(12px + env(safe-area-inset-top, 0px));
        width: calc(100% - var(--mobile-page-gutter) * 2);
        min-height: clamp(58px, 14.5vw, 68px);
        padding: clamp(8px, 2vw, 10px) clamp(12px, 3.6vw, 18px);
    }

    body > .navbar {
        width: calc(100% + env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px)) !important;
        margin-left: calc(-1 * env(safe-area-inset-left, 0px)) !important;
        margin-right: calc(-1 * env(safe-area-inset-right, 0px)) !important;
        min-height: calc(clamp(58px, 14.5vw, 68px) + env(safe-area-inset-top, 0px));
        padding-top: calc(clamp(8px, 2vw, 10px) + env(safe-area-inset-top, 0px));
        padding-left: calc(clamp(12px, 3.6vw, 18px) + env(safe-area-inset-left, 0px));
        padding-right: calc(clamp(12px, 3.6vw, 18px) + env(safe-area-inset-right, 0px));
    }

    .logo a {
        font-size: clamp(19px, 5.3vw, 25px);
    }

    .nav-mobile-controls {
        gap: clamp(6px, 1.8vw, 9px);
    }

    .nav-menu-toggle {
        width: clamp(38px, 10vw, 46px);
        height: clamp(38px, 10vw, 46px);
    }

    #navLoginBtn {
        font-size: clamp(12px, 3.3vw, 14px);
        padding-inline: clamp(12px, 3.5vw, 18px);
    }
}

/* One compact mobile dropdown. Its tabs stay outside the scrolling panels. */
@media (max-width: 800px) {
    .nav-account .account-menu { display: none !important; }
    .nav-mobile-menu[hidden], .nav-mobile-menu [hidden] { display: none !important; }
    .nav-mobile-menu,
    .nav-notifications-dropdown {
        left: auto;
        right: 0;
        width: min(280px, 100%);
    }
    .nav-mobile-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 30;
        display: flex;
        flex-direction: column;
        max-height: calc(100dvh - 110px - env(safe-area-inset-bottom, 0px));
        max-height: max(0px, calc(var(--nav-menu-available-height, 100dvh - 110px) - env(safe-area-inset-bottom, 0px) - 12px));
        padding: 8px;
        border: 1px solid #fff;
        border-radius: 24px;
        background: linear-gradient(145deg, #fff, #edf4f9);
        box-shadow: 0 16px 36px rgba(42, 78, 112, .18), inset 0 1px 0 #fff;
        overflow: hidden;
        color: rgba(20, 20, 20, .88);
    }
    .nav-menu-tabs {
        position: relative;
        isolation: isolate;
        display: flex;
        flex: 0 0 auto;
        height: clamp(42px, 5svh, 46px);
        padding: 4px;
        gap: 0;
        border: 1px solid rgba(255, 255, 255, .36);
        border-radius: 999px;
        background: rgba(255, 255, 255, .22);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55);
    }
    /* Match the Leaderboard's single sliding glass selection surface. */
    .nav-menu-tabs::before {
        content: "";
        position: absolute;
        z-index: -1;
        pointer-events: none;
        top: 4px;
        bottom: 4px;
        left: 4px;
        width: calc(50% - 4px);
        box-sizing: border-box;
        border-radius: inherit;
        background: rgba(225, 240, 252, .66);
        border: 1px solid rgba(255, 255, 255, .78);
        box-shadow: 0 3px 10px rgba(44, 73, 98, .12), inset 0 1px 0 rgba(255, 255, 255, .6);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
        transform: translateX(0);
        transition: transform 200ms ease-out;
    }
    .nav-menu-tabs:has(#navAccountTab[aria-selected="true"])::before {
        transform: translateX(100%);
    }
    .nav-menu-tabs button {
        flex: 1 1 0;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 0;
        padding: 0 14px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: rgba(35, 51, 67, .64);
        font: 850 clamp(15px, 3.6vw, 16px)/1.2 "Mozilla Text", sans-serif;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        transition: color 200ms ease-out;
    }
    .nav-menu-tabs button[aria-selected="true"] {
        color: #233e56;
    }
    .nav-menu-panel {
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        padding-top: 8px;
    }
    .nav-mobile-menu .nav-links,
    .nav-mobile-menu .account-dropdown {
        position: static;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        min-width: 0;
        width: 100%;
        padding: 0;
        margin: 0;
        gap: 1px;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        transform: none;
    }
    .nav-mobile-menu .nav-links a,
    .nav-mobile-menu .account-dropdown :is(a, button) {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-height: 44px;
        padding: 9px 12px;
        border-radius: 13px;
        color: rgba(20, 20, 20, .88);
        font: 700 14px/1.3 "Mozilla Text", sans-serif;
        text-align: left;
        text-decoration: none;
        transform: none;
        border: 0;
        transition: background .2s ease, box-shadow .2s ease, color .2s ease;
    }
    .nav-mobile-menu :is(a, button):focus-visible { outline: 2px solid #278fc7; outline-offset: -2px; }
    /* Browse and Account use one inner panel material and spacing. */
    .nav-mobile-menu :is(.nav-links, .account-dropdown, .nav-menu-guest) {
        padding: 4px;
        border-radius: 10px;
        background: rgba(196, 224, 238, .44);
        box-shadow: inset 0 0 0 1px rgba(249, 253, 255, .68);
    }
    .nav-mobile-menu .nav-item-icon, .nav-mobile-menu .nav-item-chevron {
        display: block;
        flex: 0 0 21px;
        width: 21px;
        height: 21px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }
    .nav-mobile-menu .nav-item-icon { fill: currentColor; stroke: none; }
    .nav-mobile-menu .nav-item-chevron { margin-left: auto; color: #8b9bae; width: 14px; height: 14px; flex-basis: 14px; }
    .nav-mobile-menu .account-credits { margin-bottom: 4px; padding: 9px 12px 13px; color: rgba(20, 20, 20, .62); font-size: 13px; }
    .nav-menu-guest { padding: 8px 12px 12px; font-size: 14px; line-height: 1.4; }
    .nav-menu-guest .nav-guest-signin {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 36px;
        margin-top: 12px;
        padding: 8px 18px;
        color: #111;
        font-size: 13px;
        line-height: 1.2;
        text-decoration: none;
    }
    #dashboardProgress { scroll-margin-top: calc(100px + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 800px) and (prefers-reduced-motion: reduce) {
    .nav-menu-tabs::before, .nav-menu-tabs button { transition: none; }
}
.nav-preview-menu { position: relative; }
.nav-preview-menu[hidden] { display: none !important; }
.navbar .nav-preview-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; min-height: 44px; padding: 10px; list-style: none; }
.nav-preview-toggle::-webkit-details-marker { display: none; }
.nav-preview-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.nav-preview-dropdown { min-width: 230px; max-height: min(480px, calc(100dvh - 120px)); overflow-y: auto; }
.nav-preview-toggle:focus-visible { outline: 3px solid #298bcb; outline-offset: 3px; }
@media (max-width: 800px) {
    .nav-preview-menu { display: none; }
}

/* Keep the same glass finish on both desktop and phone controls. */
.navbar :is(.login-btn, .nav-bell-btn, .nav-menu-toggle) {
    border: 1px solid var(--nav-glass-edge);
    border-radius: 8px;
    color: #07112e;
    background: var(--nav-glass-control);
    box-shadow: var(--nav-control-shadow);
}

.navbar :is(.login-btn, .nav-bell-btn, .nav-menu-toggle):hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .9),
        0 1px 2px rgba(22, 61, 84, .14),
        0 4px 9px rgba(22, 61, 84, .12);
}

.navbar :is(.login-btn, .nav-bell-btn, .nav-menu-toggle):active {
    box-shadow:
        inset 0 1px 3px rgba(22, 61, 84, .14),
        inset 0 -1px 0 rgba(255, 255, 255, .7);
}

.navbar .nav-mobile-menu,
.navbar .nav-notifications-dropdown,
.navbar .account-menu > .account-dropdown,
.navbar .nav-preview-dropdown {
    border: 1px solid var(--nav-glass-edge);
    border-radius: 10px;
    background: var(--nav-glass-panel);
    color: var(--nav-glass-ink);
    box-shadow: var(--nav-glass-menu-shadow);
    -webkit-backdrop-filter: blur(22px) saturate(1.05);
    backdrop-filter: blur(22px) saturate(1.05);
    scrollbar-width: thin;
    scrollbar-color: rgba(49, 131, 168, .5) transparent;
}

/* A named view-transition capture isolates the bar's backdrop. Let open
   menus sample the page beneath them, then restore the navigation handoff
   when the menu closes. */
.navbar:has(.nav-mobile-menu:not([hidden]), .nav-notifications-dropdown:not([hidden])) {
    view-transition-name: none;
}
@media (min-width: 801px) {
    .navbar:has(.account-menu:not([hidden]) > .account-dropdown:not([hidden]),
        .nav-preview-menu:not([hidden])[open]) { view-transition-name: none; }
}

.navbar .account-dropdown :is(a, button),
.navbar .nav-mobile-menu .nav-links a,
.navbar .nav-notification-row {
    color: var(--nav-glass-ink);
    border-radius: 6px;
}
.navbar .account-dropdown :is(a, button):is(:hover, :focus-visible),
.navbar .nav-mobile-menu .nav-links a:is(:hover, :focus-visible),
.navbar .nav-notification-row:is(:hover, :focus-visible) {
    background: linear-gradient(135deg, rgba(244, 251, 255, .88), rgba(220, 239, 248, .82));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .78), 0 1px 3px rgba(22, 61, 84, .1);
}
.navbar .nav-notification-row.is-unread {
    background: rgba(218, 239, 248, .68);
    box-shadow: inset 3px 0 0 #008fbd;
}
.navbar .nav-notification-row.is-unread:is(:hover, :focus-visible) {
    background: var(--nav-glass-control);
    box-shadow: inset 3px 0 0 #008fbd, inset 0 1px 0 rgba(255, 255, 255, .78);
}
.navbar :is(.account-credits, .nav-notifications-header, .nav-notifications-footer) {
    color: var(--nav-glass-ink);
    border-color: rgba(255, 255, 255, .8);
}
.navbar :is(.nav-notification-meta, .nav-notifications-empty, .nav-menu-guest, .nav-item-chevron) {
    color: var(--nav-glass-muted);
}
.navbar .nav-notifications-mark-all {
    color: var(--nav-glass-ink);
    border-radius: 6px;
    background: var(--nav-glass-control);
    box-shadow: var(--nav-control-shadow);
}
.navbar .nav-notifications-footer:is(:hover, :focus-visible) { background: rgba(255, 255, 255, .36); border-radius: 0 0 6px 6px; }

/* One persistent current-page highlight for Browse, Account and guest links.
   Keep it above hover/focus paint so moving the pointer cannot erase it. */
.navbar :is(.nav-links, .account-dropdown) a[aria-current="page"],
.navbar .nav-mobile-menu :is(.nav-links, .account-dropdown) a[aria-current="page"] {
    color: var(--nav-glass-ink);
    background: var(--nav-glass-control);
    border-radius: var(--nav-selected-radius);
    box-shadow: var(--nav-selected-shadow);
}

@media (max-width: 800px) {
    .navbar {
        --nav-selected-radius: 6px;
        --nav-selected-shadow: var(--nav-control-shadow);
    }
    .navbar .nav-menu-tabs {
        border-color: var(--nav-glass-edge);
        border-radius: 8px;
        background: rgba(196, 224, 238, .44);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .68);
    }
    .navbar .nav-menu-tabs::before {
        border-radius: 6px;
        background: var(--nav-glass-control);
        box-shadow: var(--nav-control-shadow);
    }
    .navbar .nav-menu-tabs button { color: var(--nav-glass-muted); border-radius: 6px; }
    .navbar .nav-menu-tabs button[aria-selected="true"] { color: var(--nav-glass-ink); }
    /* The shared outer menu supplies the blur for both tab contents. */
    .navbar .nav-mobile-menu :is(.nav-links, .account-dropdown) { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .navbar .nav-mobile-menu .account-credits { color: var(--nav-glass-muted); }
    .navbar .nav-mobile-menu .nav-menu-guest p { padding: 9px 12px; }
    .navbar .nav-mobile-menu .nav-guest-signin { margin: 4px 12px 9px; }
}

@media (prefers-contrast: more) {
    .navbar { --nav-glass-panel: linear-gradient(135deg, #f6fdff, #d8f5ff); }
}

/* Match the reference's proportions on roomy desktops. Narrow desktop and
   mobile menus keep their existing fit and touch targets. */
@media (min-width: 1100px) {
    .navbar { padding-inline: clamp(24px, 2.6vw, 40px); --nav-selected-radius: 8px; }
    .navbar .logo a { font-size: clamp(28px, 2.34vw, 36px); }
    .navbar .nav-links { gap: 2px; padding: 3px; border-radius: 12px; }
    .navbar .nav-links a {
        min-height: clamp(42px, 3.255vw, 50px);
        padding: 8px clamp(12px, 1.73vw, 27px);
        font-size: clamp(16px, 1.3vw, 20px);
        font-weight: 750;
        border-radius: 8px;
    }
    .navbar .login-btn {
        min-height: clamp(44px, 3.255vw, 50px);
        padding: 8px 16px;
        font-size: clamp(16px, 1.3vw, 20px);
        border-radius: 10px;
    }
    .navbar .nav-preview-toggle {
        width: clamp(44px, 3.255vw, 50px);
        min-width: clamp(44px, 3.255vw, 50px);
        padding: 10px;
    }
    .nav-preview-toggle svg { width: 24px; height: 24px; }
    .nav-account { gap: clamp(12px, 1.55vw, 24px); }
}
