.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 14px 0;
    background: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.topbar::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: 64px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    z-index: -1;
    transition: background-color 0.24s var(--ease-smooth), border-color 0.24s var(--ease-smooth), backdrop-filter 0.24s var(--ease-smooth);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: max-content;
}

.nav-content a,
.theme-toggle,
.nav-icon-link,
.mobile-btn {
    min-height: 36px;
    padding: 7px 11px;
    border: 0;
    border-radius: 999px;
    color: var(--sub);
    background: transparent;
    font-size: 0.92rem;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: color 0.22s var(--ease-smooth), background-color 0.22s var(--ease-smooth), transform 0.22s var(--ease-smooth);
}

.nav-content a::after {
    content: "";
    position: absolute;
    right: 11px;
    bottom: 5px;
    left: 11px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: scaleX(0.45);
    transition: opacity 0.22s var(--ease-smooth), transform 0.22s var(--ease-smooth);
}

.theme-toggle,
.nav-icon-link {
    width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
}

.nav-icon-link::after {
    display: none;
}

.nav-content a:hover,
.nav-icon-link:hover,
.theme-toggle:hover,
.mobile-btn:hover {
    color: var(--txt);
    background: rgba(255, 255, 255, 0.055);
    transform: translateY(-1px);
}

.nav-content a:hover::after {
    opacity: 0.32;
    transform: scaleX(1);
}

body.light-mode .nav-content a:hover,
body.light-mode .nav-icon-link:hover,
body.light-mode .theme-toggle:hover,
body.light-mode .mobile-btn:hover {
    background: rgba(25, 26, 43, 0.06);
}

.mobile-btn {
    display: none;
}
