/* 顶栏宽度与 .main 完全一致：同一 max-width + 同一边距（1150 & 左右 16px border-box） */
.site-header-lm .header-lm-shell {
    width: 100%;
    max-width: var(--site-max-width, 1150px);
    margin-left: auto;
    margin-right: auto;
    /* 与浏览器顶边：略留即可，避免顶栏悬空过高 */
    padding-top: 6px;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
}
body.page-home .site-header-lm .header-lm-shell {
    max-width: var(--home-max-width, 1150px);
}

.site-header-lm {
    margin-bottom: 2px;
    --lm-r: 10px;
}

.site-header-lm .header-lm-card {
    max-width: 100%;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e2e6ec);
    border-bottom: none;
    border-radius: var(--lm-r) var(--lm-r) 0 0;
    box-shadow: var(--shadow-card, 0 2px 14px rgba(15, 23, 42, 0.05));
}
[data-theme="dark"] .site-header-lm .header-lm-card {
    background: var(--bg-card, #1a1a2e);
    border-color: var(--header-border, rgba(255, 255, 255, 0.1));
}

/* 上排：单行垂直居中 — Logo | 导航 + 搜索（不再上下错位） */
.site-header-lm .header-lm-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    /* 白底顶栏上沿与内容区略放宽，避免贴顶 */
    padding: 14px 14px;
    min-height: 74px;
    box-sizing: border-box;
}
.site-header-lm .header-lm-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 0;
}
.site-header-lm .header-lm-logo-img.logo-icon {
    width: 248px;
    height: 64px;
}
.site-header-lm .header-lm-logo-img .logo-emoji {
    font-size: 45px;
}

.site-header-lm .header-lm-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 10px;
    flex: 1 1 240px;
    min-width: 0;
}

.site-header-lm .header-lm-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px 2px;
}
.site-header-lm .header-lm-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 4px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary, #475569);
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}
[data-theme="dark"] .site-header-lm .header-lm-menu-link {
    color: rgba(255, 255, 255, 0.78);
}
.site-header-lm .header-lm-menu-link:hover {
    background: color-mix(in srgb, var(--primary, #3088a3) 12%, transparent);
    color: var(--primary, #3088a3);
}
.site-header-lm .header-lm-menu-link.is-active {
    color: var(--primary, #3088a3);
    background: color-mix(in srgb, var(--primary, #3088a3) 10%, transparent);
}
[data-theme="dark"] .site-header-lm .header-lm-menu-link.is-active {
    color: #7dd3fc;
}

/* 圆形图标：与站点主色一致，去掉刺眼橙色 */
.site-header-lm .header-lm-nav-ico {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    background: linear-gradient(145deg, var(--primary-light, #4db3c5), var(--primary, #3088a3));
    box-shadow: 0 2px 6px rgba(48, 136, 163, 0.35);
    color: #fff;
}
.site-header-lm .header-lm-menu-link.is-active .header-lm-nav-ico {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #3088a3) 45%, transparent);
}

.site-header-lm .header-lm-toolbar {
    display: flex;
    align-items: center;
}
.site-header-lm .header-lm-toolbar .header-right {
    height: 36px;
    min-height: 36px;
    align-items: center;
}
.site-header-lm .header-lm-toolbar .header-top-search {
    height: 36px;
}
.site-header-lm .header-lm-toolbar .header-top-search-box {
    width: min(200px, 36vw);
    height: 36px;
}

/* 下条：青绿系，与栏目头统一，不用高饱和紫 */
.site-header-lm .header-lm-sub {
    max-width: 100%;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary, #3088a3) 95%, #0e7490) 0%,
        color-mix(in srgb, var(--primary, #3088a3) 75%, #134e4a) 100%
    );
    border: 1px solid color-mix(in srgb, var(--primary, #3088a3) 55%, #94a3b8);
    border-top: none;
    border-radius: 0 0 var(--lm-r) var(--lm-r);
    box-shadow: 0 4px 16px -6px rgba(48, 136, 163, 0.25);
}
[data-theme="dark"] .site-header-lm .header-lm-sub {
    background: linear-gradient(180deg, #164e63 0%, #0f172a 100%);
    border-color: rgba(255, 255, 255, 0.1);
}

.site-header-lm .header-lm-sub-inner {
    padding: 8px 12px 9px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
}
.site-header-lm .header-lm-sub-inner--no-ann {
    justify-content: flex-end;
}
.site-header-lm .header-lm-sub-left {
    flex: 1 1 200px;
    min-width: 0;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.96);
    text-align: left;
}
.site-header-lm .header-lm-sub-right {
    flex: 0 1 auto;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.95);
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px 8px;
}
.site-header-lm .header-lm-coop strong {
    font-weight: 700;
}
.site-header-lm .header-lm-warn {
    color: #fde68a;
    font-weight: 700;
}

/* 合作提示条右侧「添加网站」：主色渐变+白字（避免 color-mix/继承导致白底白字不可见）；手机端单独隐藏 */
.site-header-lm a.header-lm-submit-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: #fff !important;
    background: linear-gradient(135deg, var(--primary, #3088a3), var(--primary-light, #4db3c5)) !important;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.site-header-lm a.header-lm-submit-btn:hover {
    filter: brightness(1.08);
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.25);
    color: #fff !important;
}
[data-theme="dark"] .site-header-lm a.header-lm-submit-btn {
    color: #fff !important;
    background: linear-gradient(135deg, var(--primary, #38bdf8), var(--primary-light, #7dd3fc)) !important;
    border-color: rgba(255, 255, 255, 0.25);
}

@media (max-width: 768px) {
    .site-header-lm a.header-lm-submit-btn {
        display: none !important;
    }
}

@media (max-width: 900px) {
    /*
     * 窄屏不用 flex-direction:column（易与 justify-content:space-between、子项 flex 增长产生「中间留白」）。
     * 改用横向 wrap + 子块各占 100% 宽，强制上下两行紧贴。
     */
    .site-header-lm .header-lm-top {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        align-content: flex-start;
        justify-content: flex-start;
        gap: 8px 0;
        /* 取消桌面 min-height，避免强撑高度 */
        min-height: unset;
    }
    .site-header-lm .header-lm-brand {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }
    .site-header-lm .header-lm-actions {
        flex: 0 1 100%;
        width: 100%;
        max-width: 100%;
        min-height: 0;
        justify-content: flex-start;
        align-items: center;
    }
    .site-header-lm .header-lm-menu {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }
    .site-header-lm .header-lm-menu-list {
        justify-content: flex-start;
    }
    .site-header-lm .header-lm-toolbar {
        flex: 0 0 auto;
        align-self: flex-end;
        margin-left: auto;
    }
    .site-header-lm .header-lm-toolbar .header-top-search {
        display: none;
    }
    /* header.css 里 .header-right 固定 height:36px，窄屏必须覆盖，否则与换行冲突产生错位 */
    .site-header-lm .header-lm-toolbar .header-right {
        height: auto !important;
        min-height: 36px;
        align-items: center;
        flex-wrap: wrap;
        row-gap: 6px;
    }
    .site-header-lm .header-lm-sub-inner:not(.header-lm-sub-inner--no-ann) {
        flex-direction: column;
        align-items: stretch;
    }
    .site-header-lm .header-lm-sub-left {
        text-align: left;
    }
    .site-header-lm .header-lm-sub-right {
        justify-content: flex-end;
        text-align: right;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .site-header-lm .header-lm-top {
        padding: 10px 12px;
    }
    .site-header-lm .header-lm-logo-img.logo-icon {
        width: 208px;
        height: 54px;
    }
    .site-header-lm .header-lm-logo-img .logo-emoji {
        font-size: 38px;
    }
    /* 更窄：导航与工具分两行但左对齐，避免右侧工具「悬」在中间空白处 */
    .site-header-lm .header-lm-actions {
        flex-wrap: wrap;
        align-items: flex-start;
        align-content: flex-start;
        row-gap: 8px;
    }
    .site-header-lm .header-lm-menu {
        flex: 1 1 100%;
        width: 100%;
    }
    .site-header-lm .header-lm-toolbar {
        width: 100%;
        align-self: stretch;
        margin-left: 0;
        justify-content: flex-end;
    }
    .site-header-lm .header-lm-toolbar .header-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
    }
}
