/* ==================== 头部：导航 + 居中搜索 ==================== */

.header_top {
  height: auto;
  border-bottom: 1px solid #eef2f5;
  background: #fff;
  line-height: normal;
}

/* 第一行：LOGO + 主导航（图标版，页面居中） */
.header_top .hd-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
  width: min(1450px, calc(100% - 40px));
  max-width: none;
  height: 84px;
  margin: 0 auto;
  /* 左右内边距必须为 0：宽度口径已与 .container 相同（min(1450px, 100% - 40px)），
     再叠加 padding 会让头部内容比下方内容区左右各内缩 20px、总宽差 40px。 */
  padding: 0;
}

.hd-head,
.hd-head *,
.hd-head *::before,
.hd-head *::after {
  box-sizing: border-box;
}

.hd-logo {
  display: block;
  grid-column: 1;
  justify-self: start;
  flex: 0 0 auto;
  float: none;
  width: auto;
  height: auto;
  text-decoration: none;
}

.hd-logo img {
  display: block;
  width: auto;
  height: 34px;
}

/* 主导航容器：图标版菜单页面居中
   宽度需给右侧账号区（搜索 + 消息 + 私信 + 头像）留够空间，
   否则 grid 第 3 列被挤，「消息 / 私信」会被压成竖排。数值见文件末尾 .hd-navwrap 覆写。 */
.hd-navwrap {
  display: block;
  grid-column: 2;
  justify-self: center;
  width: clamp(580px, 56vw, 830px);
  max-width: 100%;
  min-width: 0;
}

.hd-navwrap .navigation-menu {
  width: 100%;
}

/* 分类导航条 */
.hd-pillrow {
  overflow: hidden;
  border-bottom: 1px solid #eef2f5;
  background: #fff;
}

.hd-pillrow-inner {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: min(1450px, calc(100% - 40px));
  min-width: 0;
  margin: 0 auto;
  /* 只留上下内边距，左右与内容区 .container 对齐（详见 .hd-head 注释） */
  padding: 9px 0;
}

/* 分类胶囊（覆盖 style.css 旧样式） */
.hd-pillrow .category-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: none;
  height: 32px;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 0;
  white-space: nowrap;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
}

.hd-pillrow .category-nav::-webkit-scrollbar { display: none; }

/* 分类胶囊：这是频道入口，属于主导航的一部分，常态就要看得清。
   文字 #1d2939、图标 #344054（灰底上 13.5:1 / 10.2:1）。
   旧 style.css 里 active 本来是黑底白字，清晰度是对的、只是不合品牌色 ——
   这里换成品牌青实心 + 白字（#087e78 上 4.92:1），比「青字浅青底 3.8:1」清楚得多，
   同时避免「常态推黑之后选中反而更浅」的层级倒挂。 */
.hd-pillrow .category-tag {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  height: 30px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f2f5f8;
  color: #1d2939;
  font-size: 13px;
  font-weight: 400;
  line-height: 30px;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.hd-pillrow .category-tag a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
  text-decoration: none;
}

.hd-pillrow .category-tag i { margin: 0; font-size: 12.5px; color: #344054; }

.hd-pillrow .category-tag:hover {
  border-color: #b9ded9;
  background: #e8f6f4;
  color: #067069;
}

.hd-pillrow .category-tag:hover i { color: #087e78; }

.hd-pillrow .category-tag.active {
  border-color: #087e78;
  background: #087e78;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(8, 126, 120, .22);
}

.hd-pillrow .category-tag.active a {
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.hd-pillrow .category-tag.active i { color: #fff; }

/* 选中项再 hover 压深一档，不要退回浅色底 */
.hd-pillrow .category-tag.active:hover {
  border-color: #066a65;
  background: #066a65;
  color: #fff;
}

.hd-pillrow .category-tag.active:hover i { color: #fff; }

/* ==================== 第二行：居中搜索 ==================== */
.hd-searchband {
  padding: 12px 0 10px;
  border-bottom: 1px solid #e9eef3;
  background: #f7f9fb;
}

.hd-searchband-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 16px;
  box-sizing: border-box;
  width: min(1450px, calc(100% - 40px));
  margin: 0 auto;
  /* 左右 0：与内容区同宽（详见 .hd-head 注释） */
  padding: 0;
}

.hd-searchband-inner *,
.hd-searchband-inner *::before,
.hd-searchband-inner *::after {
  box-sizing: border-box;
}

/* 搜索组件 */
.hd-search {
  grid-column: 2;
  width: 620px;
  max-width: 100%;
  min-width: 0;
}

.hd-search-box {
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 2px;
  border: 2px solid #0a8f88;
  border-radius: 11px;
  background: #fff;
  transition: box-shadow .18s ease;
}

.hd-search-box:focus-within {
  box-shadow: 0 0 0 4px rgba(10, 143, 136, .12);
}

/* 框内左侧：类型下拉 */
.hd-type {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
}

.hd-type-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: transparent;
  color: #1d2939;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}

.hd-type-btn:hover { background: #f2fbf9; color: #087e78; }
.hd-type-btn i { color: #9aa5b1; font-size: 10px; transition: transform .18s ease; }
.hd-type.open .hd-type-btn { background: #f2fbf9; color: #087e78; }
.hd-type.open .hd-type-btn i { transform: rotate(180deg); }

.hd-type-list {
  position: absolute;
  top: calc(100% + 12px);
  left: -2px;
  z-index: 1300;
  visibility: hidden;
  width: 248px;
  max-height: min(400px, calc(100vh - 200px));
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #e9eef3;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(16, 24, 40, .14);
  list-style: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s;
}

/* 按钮与下拉之间的 12px 透明热区（挂在父级，避免被列表的滚动容器裁掉） */
.hd-type::after {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  width: 100%;
  height: 12px;
  content: '';
}
.hd-type.open::after { display: block; }

.hd-type.open .hd-type-list {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.hd-type-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  color: #475467;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.hd-type-list li i { color: #9aa5b1; font-size: 12px; }

.hd-type-list li em {
  margin-left: auto;
  color: #a6b0ba;
  font-size: 11px;
  font-style: normal;
}

.hd-type-list li:hover { background: #f2fbf9; color: #087e78; }
.hd-type-list li:hover i { color: #0a8f88; }
.hd-type-list li.on { background: #eefaf8; color: #087e78; font-weight: 600; }
.hd-type-list li.on i { color: #0a8f88; }

.hd-search-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 20px;
  margin: 0 2px 0 0;
  background: #e6ecf1;
}

.hd-search-icon {
  flex: 0 0 auto;
  margin: 0 9px 0 12px;
  color: #a7b2bd;
  font-size: 14px;
}

.hd-search .k {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #1d2939;
  font-size: 13.5px;
}

.hd-search .k::placeholder { color: #b3bcc7; }

.hd-search-btn {
  flex: 0 0 auto;
  height: 38px;
  margin-right: 0;
  padding: 0 26px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #0a8f88, #067069);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: filter .18s ease;
}

.hd-search-btn:hover { filter: brightness(1.07); }

.hd-hotwords {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 7px;
  color: #b3bcc7;
  font-size: 12px;
}

.hd-hotwords a { color: #7b8794; transition: color .15s ease; }
.hd-hotwords a:hover { color: #087e78; }

/* 发布 CTA：紧贴搜索框右侧 */
.hd-publish {
  display: inline-flex;
  grid-column: 3;
  align-items: center;
  justify-self: start;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 11px;
  background: linear-gradient(135deg, #0f9b93 0%, #087e78 55%, #066a65 100%);
  box-shadow: 0 8px 20px rgba(8, 126, 120, .24);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.hd-publish:hover {
  color: #fff;
  filter: brightness(1.06);
  box-shadow: 0 12px 26px rgba(8, 126, 120, .32);
  transform: translateY(-1px);
}

.hd-publish i { font-size: 17px; opacity: .95; }

/* ==================== 中间行右侧：账号区 ==================== */
.header_top .hd-user {
  display: flex;
  grid-column: 3;
  align-items: center;
  justify-self: end;
  gap: 6px;
  height: 34px;
  margin: 0;
  padding: 0;
  line-height: 1;
  list-style: none;
}

.hd-user .nav-link {
  display: inline-flex;
  align-items: center;
  height: 34px;
  line-height: 1;
  padding: 0 9px;
  border-radius: 7px;
  color: #344054;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color .16s ease, color .16s ease;
}

.hd-user .nav-link i { margin-right: 5px; color: #475467; font-size: 13.5px; }
.hd-user .nav-link:hover { background: #f2fbf9; color: #087e78; }
.hd-user .nav-link:hover i { color: #0a8f88; }

.hd-user .user-avatar { width: 28px; height: 28px; margin-right: 6px; border: 0; }
.hd-user .user-name { max-width: 92px; font-size: 13px; line-height: 1.2; }
.hd-user .dropdown-arrow { margin-left: 5px; font-size: 10px; }

/* 账号下拉：菜单本体样式由 _head 内联 <style>（.dropdown-menu / .dropdown-item）统一控制，
   这里只保留账号区专属的定位微调，别再重复定义圆角/间距，避免两套数值打架 */
.hd-user .dropdown-menu { top: calc(100% + 8px); }
.hd-user .hd-account-menu { min-width: 176px; }

/* style.css 的 .header_top a:hover(#00B38A) = 0,2,1 会压掉内联的 .dropdown-item:hover(0,2,0)，
   文字被带成低对比度的绿；这里用 0,3,x 提回品牌青（#087e78 on #f2fbf9 ≈ 4.9:1 达 AA） */
.hd-user .hd-account-menu .dropdown-item:hover,
.hd-user .hd-account-menu .dropdown-item:focus-visible {
  color: #087e78;
}

.hd-user .hd-account-menu .dropdown-item:focus-visible {
  outline: 2px solid rgba(8, 126, 120, .35);
  outline-offset: -2px;
}


.hd-user .auth-buttons { display: flex; align-items: center; gap: 8px; }

.hd-user .login-btn {
  height: 32px;
  margin-top: 0;
  padding: 0 14px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 30px;
}

.hd-user .login-btn-outline { border-color: #dbe4ea; color: #475467; }
.hd-user .login-btn-outline:hover { border-color: #087e78; color: #087e78; }
.hd-user .login-btn-primary { background: #087e78; }
.hd-user .login-btn-primary:hover { background: #066a65; }

/* ==================== 顶部账号区（窄条内） ==================== */
.topbar .nav-link {
  height: 34px;
  padding: 0 9px;
  color: #5c6b77;
  font-size: 12px;
  font-weight: 400;
  background: transparent !important;
}

.topbar .nav-link:hover { color: #087e78; }

.topbar .nav-link i { margin-right: 5px; font-size: 11.5px; color: #98a2b3; }
.topbar .nav-link:hover i { color: #0a8f88; }

.topbar .user-avatar {
  width: 18px;
  height: 18px;
  margin-right: 5px;
  border: 0;
}

.topbar .user-name { max-width: 84px; font-size: 12px; }

.topbar .dropdown-arrow { margin-left: 4px; font-size: 9px; }

.topbar .dropdown-menu {
  top: calc(100% + 6px);
  min-width: 132px;
  padding: 6px 0;
  border: 1px solid #eef2f5;
  box-shadow: 0 14px 34px rgba(16, 24, 40, .12);
}

.topbar .dropdown-item { padding: 7px 14px; font-size: 12.5px; }
.topbar .dropdown-item i { width: 16px; margin-right: 8px; font-size: 11.5px; }
.topbar .dropdown-divider { margin: 5px 0; }

.topbar .auth-buttons { display: flex; align-items: center; gap: 6px; }

.topbar .login-btn {
  height: 24px;
  margin-top: 0;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 22px;
}

.topbar .login-btn-outline { border-color: #dbe4ea; color: #5c6b77; }
.topbar .login-btn-outline:hover { border-color: #087e78; color: #087e78; }
.topbar .login-btn-primary { background: #087e78; }
.topbar .login-btn-primary:hover { background: #066a65; }

/* ==================== 响应式 ==================== */
@media (max-width: 1240px) {
  .hd-search { width: 560px; }
  .hd-publish { padding: 0 16px; font-size: 13.5px; }
  .hd-navwrap .nav-list { gap: 10px; }
  .hd-navwrap .nav-item a { padding: 8px 11px; }
  .hd-navwrap .nav-item span { font-size: 12.5px; }
}

@media (max-width: 1080px) {
  .hd-searchband-inner {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
  }
  .hd-search { flex: 1 1 auto; width: auto; max-width: 620px; }
  .hd-logo img { height: 30px; }
  .header_top .hd-head { height: 76px; }
  .hd-navwrap .nav-list { gap: 8px; }
  .hd-navwrap .nav-item a { padding: 8px 10px; }
  .hd-navwrap .nav-item i { font-size: 15px; width: auto; height: 30px; margin-bottom: 3px; }
  .hd-user .nav-link { padding: 0 6px; font-size: 13px; }
  .hd-user .nav-link i { margin-right: 0; }
  .hd-user > .hd-msg-entry .nav-link span:not(.notification-badge),
  .hd-user > .hd-dm-entry .nav-link span:not(.notification-badge) { display: none; }
  .hd-user .login-btn { padding: 0 10px; font-size: 12.5px; }
  .hd-navwrap .nav-item i { font-size: 16px; width: auto; height: 34px; }
  .hd-navwrap .nav-item span { font-size: 13px; }
  .hd-pillrow .category-tag { height: 28px; line-height: 28px; font-size: 12px; padding: 0 10px; }
}

/* 小屏：主导航改为横向滚动条 */
@media (max-width: 900px) {
  .header_top .hd-head {
    display: flex;
    flex-wrap: wrap;
    height: auto;
    padding: 8px 0 0;
    gap: 0;
  }
  .hd-logo { order: 1; flex: 1 1 auto; width: auto; }
  .hd-user { order: 2; margin-left: auto; grid-column: auto; }
  .hd-navwrap {
    order: 3;
    display: block;
    width: 100%;
    max-width: none;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .hd-navwrap::-webkit-scrollbar { display: none; }
  .hd-navwrap .navigation-menu { width: auto; min-width: 100%; }
  .hd-navwrap .nav-list {
    flex-wrap: nowrap;
    justify-content: space-between;
    height: 62px;
    max-width: none;
    padding: 0;
  }
  .hd-navwrap .nav-list { justify-content: space-between; gap: 4px; }
  .hd-navwrap .nav-item {
    flex: 0 0 auto;
    margin: 0 !important;
  }
  .hd-navwrap .nav-item a { padding: 8px 8px; }
  .hd-navwrap .nav-item a { height: 62px; padding: 6px 2px; }
  .hd-navwrap .nav-item i { font-size: 15px; width: 30px; height: 30px; margin-bottom: 2px; }
  .hd-navwrap .nav-item span { font-size: 12px; }
  .hd-navwrap .nav-item.active a::after { display: none; }
  .hd-searchband-inner { padding: 0; }
}

@media (max-width: 860px) {
  .hd-searchband { padding: 10px 0 9px; }
  /* 搜索按钮与发布按钮始终同一行：搜索收缩，发布不换行 */
  .hd-searchband-inner { flex-wrap: nowrap; gap: 10px; }
  .hd-search { flex: 1 1 auto; width: auto; max-width: none; min-width: 0; }
  .hd-publish { flex: 0 0 auto; height: 42px; padding: 0 12px; font-size: 13px; gap: 6px; }
  .hd-hotwords { display: none; }
}

@media (max-width: 640px) {
  /* 小屏同样沿用 .container 宽度口径，避免头部比内容区左右各宽/窄一截 */
  .header_top .hd-head {
    width: min(1450px, calc(100% - 40px));
    padding: 6px 0 0;
  }
  .hd-logo img { height: 26px; }
  .hd-navwrap .nav-list { height: 56px; }
  .hd-navwrap .nav-item a { height: 56px; }
  .hd-pillrow-inner {
    width: min(1450px, calc(100% - 40px));
    padding: 7px 0;
  }
  .hd-searchband { width: 100%; padding: 8px 0 6px; }
  .hd-searchband-inner {
    width: min(1450px, calc(100% - 40px));
    padding: 0;
  }
  .hd-search-box { height: 42px; }
  .hd-search .k { font-size: 13px; }
  .hd-search-btn { height: 34px; padding: 0 12px; font-size: 12.5px; letter-spacing: 0; }
  .hd-type-btn { padding: 0 6px; gap: 3px; font-size: 12.5px; }
  .hd-search-icon { display: none; }
  .hd-search .k { padding-left: 12px; font-size: 12.5px; }
  .hd-search-sep { margin: 0; }
  .hd-type-list { width: 244px; }
}

/* ==================== 头部搜索入口（消息左侧） ==================== */
.header_top { position: relative; }

/* 搜索入口：长矩形「图标 + 浅色文字」按钮。
   与未登录态「登录」按钮同一条描边口径（#dbe4ea / 7px），白底不填灰，
   框内文字用 #667085（白底 4.95:1，达 WCAG AA），比「消息 / 私信」更弱一档，
   既能一眼看懂是搜索，又不会跟主导航抢注意力。 */
.hd-search-entry {
  position: relative;
  display: flex;
  align-items: center;
}

.hd-search-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid #dbe4ea;
  border-radius: 7px;
  background: #fff;
  color: #667085;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

/* 长矩形宽度：分三档，全部按实测余量倒推。
   账号区在 .hd-head 第 3 列，可用余量随导航容器宽度变化：
   ≥1440 有 35px 以上余量 → 84px；1366~1439 只有 0~2px → 64px；
   ≤1300 第 3 列已吃满 → 34px 纯图标。多出的宽度由 .hd-navwrap 收掉空档来让出
   （该容器多数档位都大于导航真实内容宽，见文件末尾说明）。 */
@media (min-width: 1301px) {
  .hd-search-trigger { width: 64px; }
}

@media (min-width: 1440px) {
  .hd-search-trigger { width: 84px; }
}

.hd-search-trigger i {
  margin: 0;
  color: #6b7a86;
  font-size: 14px;
  transition: color .16s ease;
}

/* 框内文案：浅色、常规字重，与图标同处一个视觉层 */
.hd-search-trigger span {
  color: #667085;
  font-size: 12.5px;
  letter-spacing: .2px;
  transition: color .16s ease;
}

/* 窄档只留图标：34px 宽放不下「图标 + 两字」 */
@media (max-width: 1300px) {
  .hd-search-trigger { gap: 0; }
  .hd-search-trigger span { display: none; }
}

.hd-search-trigger:hover,
.hd-search-trigger.is-open {
  border-color: #087e78;
  background: #f2fbf9;
  color: #087e78;
}

.hd-search-trigger:hover i,
.hd-search-trigger.is-open i { color: #0a8f88; }

.hd-search-trigger:hover span,
.hd-search-trigger.is-open span { color: #087e78; }

.hd-search-trigger:focus-visible {
  outline: 2px solid #0a8f88;
  outline-offset: 2px;
}

/* ==================== 头部「+发布」入口（搜索与消息之间） ==================== */
/* 深青渐变实底 + 白字，是账号区里唯一的实色按钮，承担「发布」这一主行动点；
   与搜索浮层、下拉菜单的层级互不干扰。深底一律白字（品牌约定），hover 只提亮不换色。 */
.hd-publish-entry {
  display: flex;
  align-items: center;
}

/* 用 .hd-user 前缀抬优先级：base.css 的 a:link/a:visited(0,1,1) 会压过单类名(0,1,0)，把白字染黑 */
.hd-user .hd-publish-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  background: linear-gradient(135deg, #0a8f88, #04605c);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(8, 126, 120, .24);
  transition: filter .16s ease, box-shadow .16s ease, transform .16s ease;
}

.hd-user .hd-publish-btn i {
  margin: 0;
  color: #fff;
  font-size: 11.5px;
}

/* base.css 的 a:hover(#00B38A) / .ch-page a 会被这里的高优先级选择器压住，颜色不会被带偏 */
.hd-user .hd-publish-btn:hover,
.hd-user .hd-publish-btn:visited {
  color: #fff;
  filter: brightness(1.09);
  box-shadow: 0 6px 16px rgba(8, 126, 120, .34);
  transform: translateY(-1px);
}

.hd-user .hd-publish-btn:focus-visible {
  outline: 2px solid #0a8f88;
  outline-offset: 2px;
}

/* 窄屏账号区吃紧：收成 34×34 纯「+」图标钮，与搜索入口同口径 */
@media (max-width: 1300px) {
  .hd-user .hd-publish-btn { gap: 0; width: 34px; padding: 0; }
  .hd-user .hd-publish-btn span { display: none; }
}

/* ==================== 搜索浮层 ==================== */
.hd-searchpop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  pointer-events: none;
}

.hd-searchpop.is-open { display: block; }

.hd-searchpop-mask {
  position: absolute;
  top: var(--hd-mask-top, 85px);
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(16, 24, 40, .44);
  pointer-events: auto;
  animation: hd-mask-in .18s ease both;
}

.hd-searchpop-panel {
  position: relative;
  box-sizing: border-box;
  width: min(660px, calc(100% - 32px));
  margin: var(--hd-panel-top, 91px) auto 0;
  padding: 18px 20px 16px;
  border-radius: 16px;
  background: #fff;
  pointer-events: auto;
  box-shadow: 0 28px 70px rgba(16, 24, 40, .26);
  animation: hd-pop-in .22s cubic-bezier(.2, .8, .3, 1) both;
}

.hd-searchpop-panel *,
.hd-searchpop-panel *::before,
.hd-searchpop-panel *::after { box-sizing: border-box; }

@keyframes hd-mask-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes hd-pop-in {
  from { opacity: 0; transform: translateY(-12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .hd-searchpop-mask,
  .hd-searchpop-panel { animation: none; }
}

.hd-searchpop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hd-searchpop-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1d2939;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .2px;
}

.hd-searchpop-head strong i { color: #0a8f88; font-size: 13px; }

.hd-searchpop-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #98a2b3;
  font-size: 14px;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease;
}

.hd-searchpop-close:hover { background: #f2f4f7; color: #475467; }

/* 范围胶囊：7 类一次看全，省掉一层下拉 */
.hd-searchpop-types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.hd-searchpop-types button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f4f7f9;
  color: #5c6b77;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.hd-searchpop-types button i { color: #9aa5b1; font-size: 11.5px; transition: color .16s ease; }

.hd-searchpop-types button:hover { border-color: #cfe9e5; background: #fff; color: #087e78; }
.hd-searchpop-types button:hover i { color: #0a8f88; }

.hd-searchpop-types button.on {
  border-color: #b9e3dd;
  background: #eefaf8;
  color: #087e78;
  font-weight: 600;
}

.hd-searchpop-types button.on i { color: #0a8f88; }

/* 搜索行：复用大搜索框的图标 / 输入 / 按钮样式 */
.hd-searchpop .hd-search {
  grid-column: auto;
  width: 100%;
  max-width: none;
}

.hd-searchpop .hd-search-box {
  height: 48px;
  border-radius: 12px;
  background: #fff;
}

.hd-searchpop .hd-search-icon { display: block; margin: 0 10px 0 14px; font-size: 14px; }
.hd-searchpop .hd-search .k { font-size: 14px; }
.hd-searchpop .hd-search-btn { height: 38px; padding: 0 24px; border-radius: 9px; font-size: 14px; }

/* 热门词 */
.hd-pop-hot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 12px;
  color: #b3bcc7;
  font-size: 12px;
  line-height: 1.5;
}

.hd-pop-hot a { color: #7b8794; transition: color .15s ease; }
.hd-pop-hot a:hover { color: #087e78; }

@media (max-width: 760px) {
  .hd-searchpop-panel {
    width: calc(100% - 24px);
    padding: 16px 14px 14px;
    border-radius: 14px;
  }
  .hd-searchpop-types { gap: 5px; }
  .hd-searchpop-types button { height: 28px; padding: 0 10px; font-size: 12px; }
  .hd-searchpop .hd-search-box { height: 44px; }
  .hd-searchpop .hd-search-btn { height: 34px; padding: 0 16px; font-size: 13px; letter-spacing: 0; }
  .hd-searchpop .hd-search .k { font-size: 13px; }
}

/* ==================== 右侧账号区宽度保障 ====================
   账号区内容宽约 280px（搜索 34 + 消息 62 + 私信 64 + 头像 102 + 6px 间距 ×3）。
   .hd-head 是 `1fr auto 1fr`，第 3 列的宽度由内容撑开，第 1 列随之等宽；
   若第 2 列（主导航容器）占位过大，第 3 列就会被挤到小于内容宽，
   .nav-link 里的中文会逐字换行，「消息 / 私信」就变成竖排。
   对策：禁止账号区内部收缩 + 文字不换行，并按断点收敛主导航容器宽度，
   让左右两列都能容纳账号区内容，主导航仍然与页面中心对齐。 */
.hd-user > li { flex: 0 0 auto; }

.hd-user .nav-link,
.hd-user .nav-link span,
.hd-user .login-btn { white-space: nowrap; }

/* 主导航容器按断点收窄：值 ≈ 内容宽 − 2 × 账号区内容宽 − 列间距 32
   ≥1500 取 680、≤1499 取 640，都仍大于导航真实内容宽（624），
   收掉的空档让给两侧 1fr，用来容纳 84px 的长矩形搜索框；
   导航条目是容器内居中排布，容器变窄不会移动任何一项的位置。 */
.hd-navwrap { width: 680px; }

@media (max-width: 1499px) { .hd-navwrap { width: 640px; } }

/* ≤1300 时主导航同步变紧凑（内容宽 624 → 578），才够让左右两列等宽。
   限定 ≥901：更窄的屏幕导航已切成横滚布局，内距由原断点接管。 */
@media (max-width: 1300px) {
  .hd-navwrap { width: 618px; }
}

@media (max-width: 1300px) and (min-width: 901px) {
  .hd-navwrap .nav-list { gap: 10px; }
  .hd-navwrap .nav-item a { padding: 8px 11px; }
  .hd-navwrap .nav-item span { font-size: 12.5px; }
}

@media (max-width: 1180px) { .hd-navwrap { width: 610px; } }
@media (max-width: 1080px) { .hd-navwrap { width: 580px; } }
@media (max-width: 900px) { .hd-navwrap { width: 100%; } }

/* ≤1180 起「消息 / 私信」只留图标，把宽度还给账号区（与 ≤1080 的规则同源，提前生效避免挤压） */
@media (max-width: 1180px) {
  .hd-user > .hd-msg-entry .nav-link span:not(.hd-msg-badge),
  .hd-user > .hd-dm-entry .nav-link span:not(.notification-badge) { display: none; }
  .hd-user .nav-link { padding: 0 6px; }
  .hd-user .nav-link i { margin-right: 0; }
}


/* ==========================================================================
   手机端头部（≤640px）：单行不错位
   --------------------------------------------------------------------------
   现象：logo 原图 1000×127（7.87:1），在 26px 高时宽 205px；
        账号区（搜索/发布/消息/私信/登录/注册）实测 267px；
        两者相加 472px，远超手机容器（390 屏只有 350px），必然换行。
   错位根因有两个：
     ① .hd-logo 在 ≤900 用 flex:1 1 auto，会把换行后的第一行整个吃掉；
     ② .header_top .hd-user{margin:0}（0,2,0）特异性高于 ≤900 的
        .hd-user{margin-left:auto}（0,1,0），换行后丢失右对齐 → 贴左。
   对策：
     ① 账号区全部收成 36×36 等宽图标方格，宽度可精确计算；
     ② logo 不再吃剩余空间，按 max-width 等比缩放（不裁切、不变形）；
     ③ margin-left:auto 提特异性复原 —— 即便极窄屏仍换行，也贴右不贴左。
   ========================================================================== */
@media (max-width: 640px) {

  .header_top .hd-head {
    align-items: center;
    padding: 10px 0 4px;
    row-gap: 0;
  }

  /* 全局 .header_top a{margin-left:.1rem} 会给每个链接塞 5.2px，
     导致图标按钮被顶出格子、并让整行右侧顶到屏幕边缘。这里统一清零，
     改由 logo / 账号区各自的外边距控制贴边留白。 */
  .header_top .hd-logo,
  .header_top .hd-user a { margin-left: 0; }

  .header_top .hd-logo { margin-left: 12px; }
  .header_top .hd-user { margin-right: 12px; }

  /* ① logo：不吃剩余空间；max-width 与 max-height 同时约束，按原始比例缩放
        （原图 1000×127，等比缩到约 179×22.7，不变形、不裁切） */
  .header_top .hd-logo {
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
  }

  .header_top .hd-logo img {
    width: auto;
    height: auto;
    max-width: 50vw;
    max-height: 26px;
  }

  /* ② 账号区：图标方格组，右对齐（换行也不贴左） */
  .header_top .hd-user {
    order: 2;
    flex: 0 0 auto;
    gap: 2px;
    height: 36px;
    margin-left: auto;
  }

  .header_top .hd-user > .nav-item-right { flex: 0 0 auto; }

  /* 图标型条目精确锁宽：li 的 min-width:auto 会被内容顶开，实测多出 5px */
  .header_top .hd-user .hd-publish-entry,
  .header_top .hd-user .hd-msg-entry,
  .header_top .hd-user .hd-dm-entry {
    flex: 0 0 36px;
    width: 36px;
  }

  /* 搜索：手机端下方 57px 就是完整搜索框（.hd-searchband），此处是同一功能的第二个入口，
     收起后正好让出 36px，保证「发布 / 消息 / 私信 / 头像」能保持 36px 触控尺寸而不是缩到 28px */
  .header_top .hd-user .hd-search-entry { display: none; }

  /* 发布钮的 a 会被 flex-shrink 算成 30.8px（小于锁定的 36px 格子），用 min-width 顶住 */
  .header_top .hd-user .nav-link,
  .header_top .hd-user .hd-search-trigger,
  .header_top .hd-user .hd-publish-btn {
    box-sizing: border-box;
    width: 100%;
    height: 36px;
    padding: 0;
    gap: 0;
    justify-content: center;
    border-radius: 9px;
  }

  .header_top .hd-user .nav-link i,
  .header_top .hd-user .hd-search-trigger i,
  .header_top .hd-user .hd-publish-btn i {
    margin: 0;
    font-size: 16px;
  }

  .header_top .hd-user .hd-publish-btn i { font-size: 14px; }

  .header_top .hd-user .hd-publish-btn {
    flex: 0 0 36px;
    min-width: 36px;
  }


  /* 未登录（右侧是登录/注册组）：消息与私信点进去只会跳登录页，没有内容可看，
     收起后正好让「发布 + 登录 + 注册」稳在 36px 触控尺寸内 */
  .header_top .hd-user:has(.auth-buttons) .hd-msg-entry,
  .header_top .hd-user:has(.auth-buttons) .hd-dm-entry { display: none; }

  /* logo 与图标组垂直居中对齐（<a> 的行高会把图片压低几像素） */
  .header_top .hd-logo {
    display: flex;
    align-items: center;
    line-height: 0;
  }

  /* 文字标签一律收起，只留图标（数字角标保留） */
  .header_top .hd-user .nav-link > span:not(.hd-msg-badge):not(#navMsgBadge),
  .header_top .hd-user .hd-search-trigger > span,
  .header_top .hd-user .hd-publish-btn > span,
  .header_top .hd-user .user-name,
  .header_top .hd-user .dropdown-arrow { display: none; }

  /* 头像：锁成与其它图标同宽（40/41px 是 li 的 min-width:auto 撑出来的，不锁会参差） */
  .header_top .hd-user > .dropdown:has(.user-profile) {
    flex: 0 0 36px;
    width: 36px;
  }
  .header_top .hd-user .user-profile {
    box-sizing: border-box;
    width: 100%;
    padding: 0;
    justify-content: center;
  }
  .header_top .hd-user .user-avatar { width: 30px; height: 30px; margin: 0; }

  /* 角标贴图标右上角 */
  .header_top .hd-user .hd-msg-entry .nav-link { position: relative; }
  .header_top .hd-user .hd-msg-badge { top: 0; right: 0; }

  /* 未登录：登录/注册保留文字（转化入口不做图标），宽度压到最小 */
  .header_top .hd-user .auth-buttons { gap: 6px; }
  .header_top .hd-user .login-btn {
    height: 32px;
    padding: 0 11px;
    font-size: 12.5px;
    line-height: 30px;
  }
}

/* 极窄屏（≤380px，如 iPhone SE / 老安卓）：进一步收窄，仍保持单行 */
@media (max-width: 380px) {
  .header_top .hd-user { gap: 0; height: 34px; }

  .header_top .hd-user .hd-publish-entry,
  .header_top .hd-user .hd-msg-entry,
  .header_top .hd-user .hd-dm-entry {
    flex: 0 0 34px;
    width: 34px;
  }

  .header_top .hd-user .nav-link,
  .header_top .hd-user .hd-search-trigger,
  .header_top .hd-user .hd-publish-btn {
    width: 100%;
    height: 34px;
  }

  .header_top .hd-user .nav-link i,
  .header_top .hd-user .hd-search-trigger i { font-size: 15px; }

  .header_top .hd-user .hd-publish-btn {
    flex: 0 0 34px;
    min-width: 34px;
  }

  .header_top .hd-user > .dropdown:has(.user-profile) {
    flex: 0 0 34px;
    width: 34px;
  }

  .header_top .hd-user .user-avatar { width: 28px; height: 28px; }

  .header_top .hd-user .login-btn { padding: 0 8px; font-size: 12px; }
}
