/* 全站设置 Popover：沿用 Hao 变量，组件命名与 HeroUI/Halo 后台隔离。 */
#page-header #nav #nav-right #hao-site-settings-nav {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
}

#page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger {
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: transparent !important;
    border: 0 !important;
    border-radius: 999px;
    box-shadow: none !important;
    cursor: pointer;
    display: inline-flex;
    height: 35px;
    justify-content: center;
    margin: 0;
    padding: 0;
    position: relative;
    touch-action: manipulation;
    transition: background-color 160ms ease, color 160ms ease, opacity 160ms ease;
    width: 35px;
}

#page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger::after {
    content: "";
    inset: -4.5px;
    position: absolute;
}

#page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger .hao-site-settings-icon {
    align-items: center;
    color: currentColor;
    display: inline-flex;
    flex: 0 0 18px;
    font-size: 18px !important;
    height: 18px;
    justify-content: center;
    line-height: 18px !important;
    transition: none;
    width: 18px;
}

#page-header #nav #nav-right #search-button > .hao-search-trigger:hover,
#page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger:hover {
    background: rgba(0, 0, 0, 0.04) !important;
}

#page-header #nav #nav-right #search-button > .hao-search-trigger:active,
#page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger:active {
    opacity: 0.72;
}

#page-header #nav #nav-right #search-button > .hao-search-trigger:focus-visible,
#page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger:focus-visible {
    outline: 2px solid var(--heo-main);
    outline-offset: 2px;
}

.hao-site-settings {
    box-sizing: border-box;
    left: 0;
    max-width: calc(100vw - 24px);
    pointer-events: none;
    position: fixed;
    top: 0;
    visibility: hidden;
    width: min(280px, calc(100vw - 24px));
    z-index: 1250;
}

.hao-site-settings[hidden] {
    display: none !important;
}

.hao-site-settings[data-state="opening"],
.hao-site-settings[data-state="open"],
.hao-site-settings[data-state="closing"] {
    visibility: visible;
}

.hao-site-settings[data-state="opening"],
.hao-site-settings[data-state="open"] {
    pointer-events: auto;
}

.hao-site-settings__panel {
    -webkit-backdrop-filter: blur(16px) saturate(1.08);
    backdrop-filter: blur(16px) saturate(1.08);
    background: var(--heo-card-bg);
    background: color-mix(in srgb, var(--heo-card-bg) 96%, transparent);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border: 1px solid color-mix(in srgb, var(--heo-fontcolor) 9%, transparent);
    border-radius: 16px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
    box-sizing: border-box;
    color: var(--heo-fontcolor);
    max-height: calc(100dvh - 24px);
    opacity: 0;
    overflow: auto;
    overscroll-behavior: contain;
    transform: translateY(-6px) scale(0.985);
    transform-origin: top right;
    transition: opacity 170ms ease, transform 210ms cubic-bezier(0.22, 1, 0.36, 1);
    width: 100%;
}

.hao-site-settings[data-placement="top"] .hao-site-settings__panel {
    transform: translateY(6px) scale(0.985);
    transform-origin: bottom right;
}

.hao-site-settings[data-state="opening"] .hao-site-settings__panel,
.hao-site-settings[data-state="open"] .hao-site-settings__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.hao-site-settings__panel:focus {
    outline: none;
}

.hao-site-settings__header {
    padding: 14px 16px 13px;
}

.hao-site-settings__header h2 {
    color: var(--heo-fontcolor);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.35;
    margin: 0;
}

.hao-site-settings__body {
    display: block;
}

.hao-site-settings__group {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    border-top: 1px solid color-mix(in srgb, var(--heo-fontcolor) 8%, transparent);
    padding: 13px 16px 15px;
}

.hao-site-settings__copy h3 {
    color: var(--heo-secondtext);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
}

.hao-site-settings__segments {
    background: rgba(15, 23, 42, 0.05);
    background: color-mix(in srgb, var(--heo-fontcolor) 7%, transparent);
    border: 1px solid color-mix(in srgb, var(--heo-fontcolor) 7%, transparent);
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 10px;
    padding: 4px;
    position: relative;
    width: 100%;
}

.hao-site-settings__segment-indicator {
    background: #fff;
    border-radius: 9px;
    bottom: 4px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
    left: 4px;
    pointer-events: none;
    position: absolute;
    top: 4px;
    transform: translateX(calc(var(--hao-settings-theme-index, 0) * 100%));
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    width: calc((100% - 8px) / 3);
    z-index: 0;
}

.hao-site-settings__segments button {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: var(--heo-secondtext);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 400;
    min-height: 44px;
    min-width: 0;
    padding: 10px 2px;
    position: relative;
    touch-action: manipulation;
    transition: color 160ms ease;
    white-space: nowrap;
    z-index: 1;
}

.hao-site-settings__segments button[aria-checked="true"] {
    color: #17191f;
    font-weight: 500;
}

.hao-site-settings__segments button:not([aria-checked="true"]):hover {
    color: var(--heo-fontcolor);
}

.hao-site-settings__setting-row {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 7px;
    min-height: 44px;
}

.hao-site-settings__setting-row > span:first-child {
    color: var(--heo-fontcolor);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    min-width: 0;
}

.hao-site-settings__sr-only {
    border: 0;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.hao-site-settings__switch {
    align-items: center;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 44px;
    height: 44px;
    justify-content: center;
    margin: 0;
    padding: 0;
    touch-action: manipulation;
    width: 44px;
}

.hao-site-settings__switch-track {
    background: color-mix(in srgb, var(--heo-fontcolor) 18%, transparent);
    border: 1px solid color-mix(in srgb, var(--heo-fontcolor) 10%, transparent);
    border-radius: 999px;
    box-sizing: border-box;
    display: block;
    height: 20px;
    padding: 2px;
    transition: background-color 200ms ease, border-color 200ms ease;
    width: 36px;
}

.hao-site-settings__switch-thumb {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0.0625rem 0.25rem rgba(15, 23, 42, 0.25);
    display: block;
    height: 14px;
    transform: translateX(0);
    transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
    width: 14px;
}

.hao-site-settings__switch[aria-checked="true"] .hao-site-settings__switch-track {
    background: var(--heo-main);
    border-color: var(--heo-main);
}

.hao-site-settings__switch[aria-checked="true"] .hao-site-settings__switch-thumb {
    transform: translateX(16px);
}

.hao-site-settings__segments button:focus-visible,
.hao-site-settings__switch:focus-visible {
    outline: 2px solid var(--heo-main);
    outline-offset: 2px;
}

[data-theme="dark"] .hao-site-settings__panel,
html.color-scheme-dark .hao-site-settings__panel {
    background: var(--heo-card-bg);
    background: color-mix(in srgb, var(--heo-card-bg) 96%, transparent);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .hao-site-settings__segments,
html.color-scheme-dark .hao-site-settings__segments {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .hao-site-settings__segment-indicator,
html.color-scheme-dark .hao-site-settings__segment-indicator {
    background: rgba(255, 255, 255, 0.94);
}

@media screen and (max-width: 1100px) {
    #page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger {
        color: var(--heo-fontcolor) !important;
        height: 40px;
        width: 40px;
    }

    #page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger::after {
        inset: -2px;
    }
}

@media screen and (max-width: 640px) {
    .hao-site-settings {
        max-width: calc(100vw - 16px);
        width: min(280px, calc(100vw - 16px));
    }

    .hao-site-settings__header {
        padding-inline: 14px;
    }

    .hao-site-settings__group {
        padding-inline: 14px;
    }

    .hao-site-settings__segments button {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hao-site-settings__panel,
    .hao-site-settings__segment-indicator,
    .hao-site-settings__switch-track,
    .hao-site-settings__switch-thumb,
    #page-header #nav #nav-right #hao-site-settings-nav > .hao-site-settings-trigger {
        transition-duration: 1ms !important;
    }
}
