 
#header {
  /* 设计变量 */
  --primary: #1677ff;
  --primary-hover: #4096ff;
  --primary-active: #0958d9;
  --text: rgba(0, 0, 0, 0.88);
  --text-secondary: rgba(0, 0, 0, 0.65);
  --text-tertiary: rgba(0, 0, 0, 0.45);
  --border: #f0f0f0;
  --fill: #f5f5f5;
  --fill-hover: #f0f0f0;
  --bg-container: #ffffff;
  --error: #ff4d4f;
  --radius: 6px;
  --radius-lg: 8px;
  --header-height: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
          'Apple Color Emoji', 'Segoe UI Emoji';
  --shadow-dropdown:
    0 6px 16px 0 rgba(0, 0, 0, 0.08),
    0 3px 6px -4px rgba(0, 0, 0, 0.12),
    0 9px 28px 8px rgba(0, 0, 0, 0.05);

  /* 布局 */
  position: fixed;
  width:100%;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.2s ease;

  /* 字体与盒模型 */
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5714;
  color: var(--text);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

#header *,
#header *::before,
#header *::after { box-sizing: border-box; }

#header.is-scrolled { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); }

#header a { text-decoration: none; color: inherit; }
#header button { font-family: inherit; }

#header .header-inner {
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
 * Logo
 * ========================================================= */
#header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  margin-right: 12px;
  transition: opacity 0.2s;
}
#header .logo:hover { opacity: 0.85; }

#header .logo-mark {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1677ff 0%, #69b1ff 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(22, 119, 255, 0.35);
  overflow: hidden;
}
#header .logo-mark.has-img { background: transparent; box-shadow: none; }
#header .logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

#header .logo-text {
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
  white-space: nowrap;
}

/* =========================================================
 * 桌面导航
 * ========================================================= */
#header .nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 2px;
}

#header .nav-item-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

#header .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 0 16px;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.2s ease;
}
#header .nav-item:hover { color: var(--primary); }

/* 激活态下划线 */
#header .nav-item::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
  transform: scaleX(0);
  transition: transform 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
#header .nav-item.is-active { color: var(--primary); font-weight: 500; }
#header .nav-item.is-active::after,
#header .nav-item:hover::after { transform: scaleX(1); }

#header .nav-item-wrap:hover > .nav-item { color: var(--primary); }
#header .nav-item-wrap:hover > .nav-item::after { transform: scaleX(1); }

/* 带二级菜单时的箭头 */
#header .nav-item .chev {
  flex: none;
  transition: transform 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
#header .nav-item-wrap:hover > .nav-item .chev { transform: rotate(180deg); }

/* =========================================================
 * 二级菜单
 * 只靠 :hover 控制显隐；不再使用 :focus-within
 * 避免点击后 <a> 保持焦点导致菜单常驻
 * ========================================================= */
#header .submenu {
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  min-width: 200px;
  padding: 4px;
  background: var(--bg-container);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.97);
  transform-origin: top center;
  transition:
    opacity 0.18s cubic-bezier(0.645, 0.045, 0.355, 1),
    transform 0.18s cubic-bezier(0.645, 0.045, 0.355, 1),
    visibility 0.18s;
  z-index: 20;
}
#header .nav-item-wrap:hover > .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* 小三角箭头 */
#header .submenu::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 22px;
  width: 10px;
  height: 10px;
  background: var(--bg-container);
  transform: rotate(45deg);
  border-radius: 2px 0 0 0;
}

/* 二级菜单项（默认：单行，不带描述） */
#header .submenu-item {
  display: block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}
#header .submenu-item:hover { background: var(--fill); color: var(--primary); }

/* ---------------------------------------------------------
 * 二级菜单 —— 带描述项（在 item 里带 desc 字段时生效）
 * --------------------------------------------------------- */
#header .submenu-item .label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
#header .submenu-item:hover .label { color: var(--primary); }

#header .submenu-item .desc {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* label 前面的小圆点（有 desc 时自动显示） */
#header .submenu-item .dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.65;
}

/* ---------------------------------------------------------
 * 二级菜单 —— 分组标题与分隔线（groups 结构时生效）
 * --------------------------------------------------------- */
#header .submenu-group-title {
  padding: 6px 12px 4px;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.2px;
}

#header .submenu-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}

/* ---------------------------------------------------------
 * 二级菜单 —— 靠右对齐（数据里加 alignRight => true 时生效）
 * 用于避免屏幕右侧导航的下拉溢出视口
 * --------------------------------------------------------- */
#header .nav-item-wrap.align-right > .submenu {
  left: auto;
  right: 0;
  transform-origin: top right;
}
#header .nav-item-wrap.align-right > .submenu::before {
  left: auto;
  right: 22px;
  border-radius: 0 2px 0 0;
}

/* =========================================================
 * 右侧区
 * ========================================================= */
#header .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------------------------------------------------------
 * PC 搜索：左侧图标按钮 + 右侧输入框
 * 搜索按钮无 hover / active 装饰
 * --------------------------------------------------------- */
#header .search-wrap {
  position: relative;
  margin-right: 8px;
}

#header .search {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 200px;
  height: 36px;
  padding: 0 12px 0 4px;
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}
#header .search:hover { background: var(--fill-hover); }
#header .search:focus-within,
#header .search-wrap.is-open .search {
  background: var(--bg-container);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1);
}

/* 搜索图标按钮：无任何 hover / active 装饰 */
#header .search-submit {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
}

#header .search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
#header .search input::placeholder { color: var(--text-tertiary); }

/* ---------------------------------------------------------
 * PC 搜索下拉面板
 * 固定宽度，长内容截断，不被撑开
 * --------------------------------------------------------- */
#header .search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 290px;
  max-width: calc(100vw - 32px);
  padding: 4px;
  background: var(--bg-container);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: all 0.18s cubic-bezier(0.645, 0.045, 0.355, 1);
  z-index: 40;
}
#header .search-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#header .sd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px 5px;
  font-size: 12px;
  color: var(--text-tertiary);
  letter-spacing: 0.2px;
}
#header .sd-clear {
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s;
}
#header .sd-clear:hover { color: var(--primary); }

/* 历史项：min-width:0 让内部 sd-text 的 ellipsis 生效 */
#header .sd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 0;
  transition: background 0.15s ease;
}
#header .sd-item:hover { background: var(--fill); }
#header .sd-item .sd-icon {
  flex: none;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
}
#header .sd-item .sd-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#header .sd-item:hover .sd-text { color: var(--primary); }

#header .sd-item .sd-del {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s ease;
}
#header .sd-item:hover .sd-del { opacity: 1; }
#header .sd-item .sd-del:hover { background: rgba(0, 0, 0, 0.08); color: var(--text); }

#header .sd-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* PC 下拉：热门搜索板块 */
#header .sd-header-hot {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

#header .sd-hot-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 8px 8px;
  overflow: hidden;
}

#header .sd-hot-item {
  display: inline-block;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--fill);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
#header .sd-hot-item:hover { background: #e6f4ff; color: var(--primary); }

/* ---------------------------------------------------------
 * 通用图标按钮
 * --------------------------------------------------------- */
#header .icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
#header .icon-btn:hover { background: rgba(0, 0, 0, 0.06); color: var(--text); }
#header .icon-btn:active { background: rgba(0, 0, 0, 0.1); }

#header .search-toggle { display: none; }

/* 未读消息红点 */
#header .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--error);
  box-shadow: 0 0 0 2px #fff;
}

/* ---------------------------------------------------------
 * 发布按钮
 * --------------------------------------------------------- */
#header .release-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  margin: 0 4px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s ease;
}
#header .release-btn:hover { background: var(--primary-hover); }
#header .release-btn:active { background: var(--primary-active); }
#header .release-btn svg { flex: none; }

#header .divider {
  width: 1px;
  height: 24px;
  margin: 0 8px;
  background: var(--border);
  flex: none;
}

/* =========================================================
 * 用户区域
 * ========================================================= */
#header .user-wrap { position: relative; }

#header .user {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px 0 4px;
  border: 0;
  background: transparent;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}
#header .user:hover { background: rgba(0, 0, 0, 0.04); }

#header .avatar {
  position: relative;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  background: linear-gradient(135deg, #597ef7 0%, #9254de 100%);
  overflow: hidden;
}
#header .avatar.has-img { background: transparent; }
#header .avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

#header .user-name {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* 用户类型徽章（管理员 / 企业 / 创作者） */
#header .user-badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  width: 18px;
  height: 18px;
}
#header .user-badge svg { width: 100%; height: 100%; display: block; }

/* 用户下拉菜单 */
#header .dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 4px;
  background: var(--bg-container);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: all 0.18s cubic-bezier(0.645, 0.045, 0.355, 1);
  z-index: 30;
}
#header .dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

#header .dropdown-item {
  display: block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}
#header .dropdown-item:hover { background: var(--fill); }
#header .dropdown-item.danger { color: var(--error); }
#header .dropdown-item.danger:hover { background: #fff2f0; }

#header .dropdown-sep { height: 1px; margin: 4px 0; background: var(--border); }

/* ---------------------------------------------------------
 * 未登录：登录/注册
 * --------------------------------------------------------- */
#header .auth-btns {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 4px;
  border-radius: var(--radius);
  background: var(--fill);
  transition: background 0.2s ease;
}
#header .auth-btns:hover { background: var(--fill-hover); }
#header .auth-btns a {
  padding: 0 10px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: color 0.15s;
}
#header .auth-btns a:hover { color: var(--primary); }
#header .auth-btns .sep {
  width: 1px;
  height: 14px;
  background: rgba(0, 0, 0, 0.15);
}

/* =========================================================
 * 移动端搜索面板
 * ========================================================= */
#header .mobile-search {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 12px 16px 20px;
  background: var(--bg-container);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  z-index: 45;
}
#header .mobile-search.is-open {
  display: block;
  animation: hdrMSearchIn 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
}
@keyframes hdrMSearchIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

#header .mobile-search-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

#header .mobile-search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}
#header .mobile-search-field:focus-within {
  background: var(--bg-container);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1);
}
#header .mobile-search-field > svg {
  flex: none;
  color: var(--text-tertiary);
}
#header .mobile-search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
#header .mobile-search-field input::placeholder { color: var(--text-tertiary); }

#header .mobile-search-submit {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}
#header .mobile-search-submit:hover { background: var(--primary-hover); }
#header .mobile-search-submit:active { background: var(--primary-active); }

#header .mobile-search-cancel {
  flex: none;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}
#header .mobile-search-cancel:hover { color: var(--primary); }

/* ---------- 面板内容 ---------- */
#header .mobile-search-body { margin-top: 20px; }
#header .ms-section + .ms-section { margin-top: 22px; }

#header .ms-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-tertiary);
}
#header .ms-clear {
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s;
}
#header .ms-clear:hover { color: var(--primary); }

#header .ms-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 标签：整体不超容器宽，文字截断 */
#header .ms-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  height: 30px;
  padding: 0 4px 0 12px;
  border-radius: 15px;
  background: var(--fill);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
#header .ms-tag:hover { background: #e6f4ff; color: var(--primary); }

#header .ms-tag .ms-tag-text {
  min-width: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#header .ms-tag .ms-del {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}
#header .ms-tag .ms-del:hover { background: rgba(0, 0, 0, 0.1); color: var(--text); }

#header .ms-hot-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 12px;
}
#header .ms-hot-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  min-width: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
#header .ms-hot-item:hover { background: var(--fill); color: var(--primary); }

/* 热门排名，前 3 名用不同颜色 */
#header .ms-hot-rank {
  flex: none;
  width: 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
  color: var(--text-tertiary);
}
#header .ms-hot-item:nth-child(1) .ms-hot-rank { color: #ff4d4f; }
#header .ms-hot-item:nth-child(2) .ms-hot-rank { color: #fa8c16; }
#header .ms-hot-item:nth-child(3) .ms-hot-rank { color: #faad14; }

#header .ms-hot-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
 * 移动端导航
 * ========================================================= */
#header .menu-toggle { display: none; }

#header .mobile-nav {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 8px 16px 16px;
  background: var(--bg-container);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  z-index: 44;
}
#header .mobile-nav.is-open { display: flex; }

/* 一级项 + 分组标题按钮 */
#header .mobile-nav > a,
#header .m-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#header .mobile-nav > a:hover,
#header .m-group-title:hover { background: var(--fill); color: var(--primary); }
#header .mobile-nav > a.is-active {
  color: var(--primary);
  background: #e6f4ff;
  font-weight: 500;
}

/* 展开态 */
#header .m-group-title .chev { transition: transform 0.2s ease; }
#header .m-group.is-open .m-group-title { color: var(--primary); background: #e6f4ff; }
#header .m-group.is-open .m-group-title .chev { transform: rotate(180deg); }

/* 二级菜单容器 */
#header .m-sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 4px 12px;
  margin-left: 8px;
  border-left: 1px solid var(--border);
}
#header .m-group.is-open .m-sub { display: flex; }

#header .m-sub a {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-tertiary);
}
#header .m-sub a:hover { background: var(--fill); color: var(--primary); }

/* ---------------------------------------------------------
 * 移动端二级菜单：分组标题与分隔线
 * --------------------------------------------------------- */
#header .m-sub-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

#header .m-sub-title {
  padding: 6px 12px 2px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* 移动端二级菜单：带描述的项 */
#header .m-sub a .m-sub-desc {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* =========================================================
 * 响应式
 * ========================================================= */
@media (max-width: 1100px) {
  /* 窄屏时下拉右对齐，避免溢出屏幕 */
  #header .search-dropdown {
    left: auto;
    right: 0;
    transform-origin: top right;
  }
}

@media (max-width: 1024px) {
  #header .search { width: 160px; }
}

@media (max-width: 900px) {
  #header .header-inner { padding: 0 16px; }

  /* 隐藏桌面导航、桌面搜索、用户名、发布文字 */
  #header .nav,
  #header .search-wrap,
  #header .user-name,
  #header .release-btn .release-text { display: none; }

  /* 显示移动端按钮 */
  #header .menu-toggle,
  #header .search-toggle { display: grid; }

  #header .divider { margin: 0 4px; }
  #header .logo-text { display: none; }

  /* 发布按钮变方形图标按钮 */
  #header .release-btn {
    width: 36px;
    padding: 0;
    margin: 0 2px;
    justify-content: center;
  }
}

/* 桌面端强制隐藏移动搜索面板 */
@media (min-width: 901px) {
  #header .mobile-search { display: none !important; }
}