/* Homepage navigation stays in document flow so wrapped actions never cover search. */
body { padding-top: max(12px, env(safe-area-inset-top, 0px)) !important; }
#topNav {
    --nav-surface: #fffafc;
    --nav-button: #fff;
    --nav-border: #efdee6;
    --nav-ink: #654655;
    --nav-accent: #af476e;
    position: relative;
    inset: auto;
    z-index: 10;
    padding: 0;
    border: 1px solid var(--nav-border);
    border-radius: 22px;
    background: var(--nav-surface);
    box-shadow: 0 8px 28px rgba(95, 54, 73, .05);
}
#topNav .top-nav-inner { max-width: none; padding: 12px 14px; }
#topNav .top-nav-row { flex-direction: column; align-items: stretch; gap: 10px !important; }
#topNav .top-nav-logo {
    flex: none;
    margin: 0;
    padding-left: 12px;
    border-left: 3px solid var(--nav-accent);
    color: var(--nav-ink);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .8px;
    line-height: 24px;
}
#topNav .top-nav-links {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    flex: auto;
    width: 100%;
    min-width: 0;
    gap: 6px;
    overflow: visible;
}
#topNav .top-nav-links :is(.top-nav-link, .top-nav-btn) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 6px !important;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid var(--nav-border) !important;
    border-radius: 10px !important;
    background: var(--nav-button) !important;
    color: var(--nav-ink) !important;
    box-shadow: none !important;
    font: 600 12px/1.4 "Microsoft YaHei", sans-serif;
    white-space: nowrap;
    text-decoration: none;
    animation: none !important;
    transition: background .18s, border-color .18s, box-shadow .18s !important;
}
#topNav .top-nav-links .icon-text {
    margin: 0;
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit;
}
#topNav .top-nav-links svg {
    flex: 0 0 18px;
    width: 18px !important;
    height: 18px !important;
    color: var(--nav-accent);
}
#topNav .top-nav-links .nav-symbol :is(path, line, circle, rect, polyline) {
    stroke: currentColor !important;
    fill: none !important;
}
#topNav #modeToggle::after { content: "切换主题"; }
#topNav #wechatNavBtn .wechat-symbol { color: #169c54; }
#topNav #wechatNavBtn .wechat-symbol path { fill: currentColor !important; stroke: none !important; }
#topNav #wechatNavBtn .wechat-symbol circle { fill: var(--nav-button) !important; stroke: none !important; }
body.night-mode #topNav #wechatNavBtn .wechat-symbol { color: #65d991; }
#topNav .top-nav-links .nav-gacha,
#topNav .top-nav-links .login {
    background: #f9e9f0 !important;
    border-color: #ebccda !important;
    color: #953958 !important;
}
#topNav .top-nav-links :is(.top-nav-link, .top-nav-btn):hover {
    transform: none;
    border-color: var(--nav-accent) !important;
    box-shadow: 0 3px 10px rgba(95, 54, 73, .08) !important;
}
#topNav .top-nav-links :is(a, button):focus-visible {
    outline: 2px solid var(--nav-accent);
    outline-offset: 3px;
}
#topNav ~ #mainContent { margin-top: 16px !important; }
body.night-mode #topNav {
    --nav-surface: #29242c;
    --nav-button: #342d37;
    --nav-border: #51404e;
    --nav-ink: #f0dae6;
    --nav-accent: #eba6c1;
    background: var(--nav-surface);
}
body.night-mode #topNav .top-nav-links .nav-gacha,
body.night-mode #topNav .top-nav-links .login {
    background: #513244 !important;
    border-color: #79526a !important;
    color: #ffd5e5 !important;
}
@media (max-width: 1099px) {
    #topNav .top-nav-links { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    #topNav { border-radius: 16px; }
    #topNav .top-nav-inner { padding: 12px 10px 10px; }
    #topNav .top-nav-logo { font-size: 15px; line-height: 22px; }
    #topNav .top-nav-links :is(.top-nav-link, .top-nav-btn) {
        height: 64px;
        min-height: 64px;
        flex-direction: column;
        padding: 5px 4px !important;
        gap: 3px;
        font-size: 12px;
        line-height: 28px;
        white-space: normal;
        text-align: center;
    }
    #topNav .top-nav-links :is(.icon-text, .top-nav-link > span),
    #topNav #modeToggle::after {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 28px;
        line-height: 14px;
        max-width: 100%;
    }
    #topNav :is(#wechatNavBtn, #navActivateBtn) > span { word-break: keep-all; }
    #topNav ~ #mainContent { margin-top: 14px !important; }
}
