/* ==========================================================================
   新版顶部栏（B 站风格） — 所有登录用户加载（等级限制已取消）
   --------------------------------------------------------------------------
   - 由 stdhead() 在 <head> 中加载，固定路径 styles/Aurora/topbar.css，
     不随当前主题 uri 变化，因此 Aurora / AuroraNight 共用这一份。
   - 所有颜色走 Aurora/theme.css 的 --au-* 令牌；深色由 AuroraNight 覆盖令牌，
     本文件只需少量深色专属项（头图压暗）。
   - 顶栏 position:fixed 通栏，DOM 上仍位于 td#nav_block 内，
     因此不改动 stdhead() 的表格结构，旧版输出完全不受影响。
   ========================================================================== */

/* ---------- 0. 重置所在单元格 ---------- */
body.nx-new-topbar { padding-top: 0; position: relative; }
body.nx-new-topbar #nav_block {
  height: 190px;          /* 头图改 absolute 后靠这行占位，正文才从 190px 下开始 */
  padding: 0 !important;
  border-bottom: 0 !important;
  text-align: left;
}
/* 头图通栏溢出单元格，去掉左上圆角避免出现白边 */
body.nx-new-topbar table.mainouter > tbody > tr:first-child > td:first-child {
  border-radius: 0 !important;
}
/* 顶栏通栏，但正文内容区仍限制最大宽度，与旧版保持一致 */
body.nx-new-topbar table.mainouter {
  max-width: var(--au-max-width) !important;
}

/* ---------- 1. 顶栏骨架 ---------- */
.nx-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 60px;
  color: #fff !important;
  background: linear-gradient(180deg, rgba(0, 0, 0, .46), rgba(0, 0, 0, 0));
  transition: background .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.nx-topbar.is-scrolled {
  background: var(--au-card);
  color: var(--au-fg) !important;
  border-bottom: 1px solid var(--au-border);
  box-shadow: var(--au-shadow);
}
.nx-topbar-inner {
  width: 100%;
  height: 100%;
  padding: 0 clamp(12px, 1.5vw, 28px);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--au-font);
}
.nx-ico { width: 15px; height: 15px; flex: 0 0 auto; }

/* theme.css 的 a:link / a:hover 会把链接染成 --au-fg 并在 hover 加下划线。
   只让「顶栏上直接可见」的导航项 / 右侧图标继承顶栏颜色（头图上白色、吸顶后深色）；
   下拉与卡片内的链接必须保留各自的 --au-fg，否则会被染成白字，在白底上看不清。 */
.nx-topbar a,
.nx-topbar a:link,
.nx-topbar a:visited,
.nx-topbar a:hover { text-decoration: none !important; }
.nx-topbar .nx-nav-item,
.nx-topbar .nx-icon { color: inherit !important; }
.nx-topbar .nx-more-menu,
.nx-topbar .nx-user-card,
.nx-topbar .nx-publish-card,
.nx-topbar .nx-scope-menu { color: var(--au-fg); }
.nx-uc-logout { color: var(--au-danger) !important; }
.nx-pc-tip strong { color: var(--au-primary) !important; }

/* ---------- 2. 左区主导航 ---------- */
.nx-nav-left { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.nx-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-family: var(--au-font);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s ease;
}
.nx-nav-item:hover { background: rgba(255, 255, 255, .18); }
.nx-topbar.is-scrolled .nx-nav-item:hover { background: var(--au-sub); }
/* 当前页选中态统一放文件末尾（第 11 节），避免被第 9 节的
   background: transparent !important 压成透明——这正是默认态选中态丢失的原因。 */
.nx-nav-item .nx-ico { width: 14px; height: 14px; }

.nx-more-wrap { position: relative; }
.nx-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 150px;
  padding: 6px;
  background: var(--au-popover);
  border: 1px solid var(--au-border);
  border-radius: var(--au-r);
  box-shadow: var(--au-shadow-lg);
  display: none;
  z-index: 130;
}
.nx-more-wrap.is-open .nx-more-menu,
.nx-more-wrap:hover .nx-more-menu { display: block; }
.nx-more-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--au-fg);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.nx-more-menu a:hover { background: var(--au-sub); }

/* ---------- 3. 中区搜索 ----------
   按 bilibili 的胶囊搜索框 + 独立的分类下拉浮层：
   整框大圆角半透明、右侧只留放大镜图标（无实心色块）；
   分类用自定义 button + 带阴影的下拉面板（原生 select 无法自定义面板）。 */
.nx-search {
  flex: 0 1 500px;
  min-width: 230px;
  max-width: 500px;
  height: 42px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px 0 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
  transition: box-shadow .18s ease, background .18s ease;
}
.nx-topbar.is-scrolled .nx-search {
  background: var(--au-sub);
  box-shadow: inset 0 0 0 1px var(--au-border);
}
/* 提高特异性 + !important：否则滚动吸顶态的 .nx-topbar.is-scrolled .nx-search
   (0,3,0) 会盖掉这里 (0,2,0) 的红色描边，导致吸顶后 focus 没有红色元素。 */
.nx-topbar .nx-search:focus-within {
  background: #fff;
  box-shadow: 0 0 0 2px var(--au-primary), 0 6px 20px rgba(251, 114, 153, .28) !important;
}
.nx-search--empty { background: transparent !important; box-shadow: none !important; }

/* 分类下拉 */
.nx-scope-wrap { position: relative; flex: 0 0 auto; }
.nx-scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--au-fg);
  font-family: var(--au-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.nx-scope-btn .nx-ico { width: 12px; height: 12px; opacity: .7; }
.nx-scope-btn:hover { background: var(--au-sub); }
.nx-scope-wrap.is-open .nx-scope-btn {
  border-color: var(--au-primary);
  background: var(--au-card);
  box-shadow: 0 0 0 3px var(--au-primary-tint);
}
.nx-scope-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 132px;
  padding: 6px;
  background: var(--au-popover);
  border: 1px solid var(--au-border);
  border-radius: 10px;
  box-shadow: var(--au-shadow-lg);
  display: none;
  z-index: 150;
}
.nx-scope-wrap.is-open .nx-scope-menu { display: block; }
.nx-scope-menu button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--au-fg);
  font-family: var(--au-font);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.nx-scope-menu button:hover { background: var(--au-sub); }
.nx-scope-menu button.is-active { background: var(--au-sub); color: var(--au-primary); font-weight: 650; }

.nx-search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0 !important;
  padding: 0 6px;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  background: transparent !important;
  color: var(--au-fg) !important;
  font-family: var(--au-font);
  font-size: 13px;
}
.nx-search-input::placeholder { color: var(--au-muted); opacity: 1; }
.nx-search-btn {
  width: 36px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--au-muted);
  cursor: pointer;
}
.nx-search-btn .nx-ico { width: 19px; height: 19px; }
.nx-search-btn:hover { background: var(--au-sub); color: var(--au-primary); }

/* ---------- 4. 右区图标 ---------- */
.nx-nav-right { display: flex; align-items: center; gap: 1px; flex: 0 0 auto; }
.nx-icon {
  position: relative;
  min-width: 48px;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 8px;
  color: inherit;
  font-size: 13px;
  text-decoration: none;
  transition: background .16s ease;
}
.nx-icon:hover { background: rgba(255, 255, 255, .16); }
.nx-topbar.is-scrolled .nx-icon:hover { background: var(--au-sub); }
.nx-icon .nx-ico { width: 20px; height: 20px; }
.nx-badge {
  position: absolute;
  top: 3px;
  right: 5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--au-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 1.5px var(--au-card);
}

/* ---------- 5. 头像与用户卡片 ---------- */
/* 头像排到右区最左（消息左边）；历史图标已在模板中移除 */
.nx-avatar-wrap { position: relative; margin: 0 6px; order: -1; }
.nx-avatar {
  width: 36px; height: 36px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: var(--au-sub);
  box-shadow: 0 0 0 1px var(--au-border);
  overflow: hidden;
  cursor: pointer;
}
.nx-avatar img, .nx-uc-avatar { width: 100%; height: 100%; object-fit: cover; display: block; }
.nx-user-card {
  position: absolute;
  top: calc(100% + 14px);
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--au-popover);
  border: 1px solid var(--au-border);
  border-radius: 16px;
  box-shadow: var(--au-shadow-lg);
  color: var(--au-fg);
  z-index: 130;
  display: none;
  overflow: hidden;
  /* 菜单项增多（含任务 / 邀请 / 认领）后避免卡片超出视口、底部内容点不到 */
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.nx-avatar-wrap.is-open .nx-user-card,
.nx-avatar-wrap:hover .nx-user-card,
.nx-avatar-wrap:focus-within .nx-user-card { display: block; }

.nx-uc-head {
  padding: 18px 16px 8px;
  text-align: center;
  background: var(--au-primary-tint);
}
.nx-uc-avatar-link {
  position: relative;
  display: block;
  width: 64px; height: 64px;   /* 58 内容 + 3px 边框 ×2 */
  margin: 0 auto 8px;
  border-radius: 50%;
  text-decoration: none !important;
}
.nx-uc-avatar {
  width: 100%; height: 100%;
  margin: 0;
  border: 3px solid var(--au-popover);
  border-radius: 50%;
  box-shadow: var(--au-shadow-sm);
  object-fit: cover;
  display: block;
  box-sizing: border-box;
}
/* hover 时半透明遮罩 +「更换头像」文字 + 右下角相机角标 */
.nx-uc-avatar-tip {
  position: absolute;
  inset: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.nx-uc-avatar-link:hover .nx-uc-avatar-tip,
.nx-uc-avatar-link:focus-visible .nx-uc-avatar-tip { opacity: 1; }
.nx-uc-avatar-cam {
  position: absolute;
  right: 0; bottom: 0;
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--au-primary);
  color: #fff;
}
.nx-uc-avatar-cam .nx-ico { width: 12px; height: 12px; }
.nx-uc-name {
  font-size: 16px;
  font-weight: 750;
  color: var(--au-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.nx-uc-level {
  font-size: 11px;
}
.nx-uc-sub { margin-top: 3px; font-size: 11px; color: var(--au-muted); }

.nx-uc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 8px 12px 10px;
  padding: 10px 4px;
  border-radius: 10px;
  background: var(--au-sub);
}
.nx-uc-stats div { text-align: center; min-width: 0; }
.nx-uc-stats b {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--au-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nx-uc-stats span { font-size: 10px; color: var(--au-muted); }

/* 当前活动 / 可连接 / 连接数：做成与上方 stats 呼应的三列指标格 */
.nx-uc-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0 12px 10px;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--au-border);
}
.nx-uc-status > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px;
  background: var(--au-card);
  text-align: center;
}
.nx-uc-status span { font-size: 10px; color: var(--au-muted); }
.nx-uc-status b { font-size: 12px; font-weight: 700; color: var(--au-fg); white-space: nowrap; }
.nx-uc-status i { font-style: normal; }
.nx-uc-up { color: var(--au-ok); }
.nx-uc-down { color: var(--au-danger); }

.nx-uc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--au-primary-tint);
  text-decoration: none;
}
.nx-uc-banner b { display: block; font-size: 12px; color: var(--au-primary); }
.nx-uc-banner small { display: block; font-size: 10px; color: var(--au-muted); }
.nx-uc-banner em {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--au-primary);
  color: #fff;
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
}

.nx-uc-menu { padding: 2px 14px; }
.nx-uc-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--au-border);
  color: var(--au-fg);
  font-size: 13px;
  text-decoration: none;
}
.nx-uc-menu a:last-child { border-bottom: 0; }
.nx-uc-menu a:hover { color: var(--au-primary); }
.nx-uc-menu .nx-ico { width: 16px; height: 16px; color: var(--au-muted); }
.nx-uc-menu i { margin-left: auto; font-style: normal; color: var(--au-muted); }

/* 主题快捷入口（与 bilibili.com 一致） */
.nx-uc-theme-wrap { padding: 8px 14px 10px; }
.nx-uc-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--au-sub);
  color: var(--au-fg);
  font-family: var(--au-font);
  font-size: 13px;
}
.nx-uc-theme-info { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.nx-uc-theme-info .nx-ico { width: 15px; height: 15px; color: var(--au-muted); }
/* 右侧分段选择器：每格自带边框拼成圆角外框，选中格主色边框提到上层完整可见。
   不用外层 overflow:hidden——它会把选中项边框的圆角端裁掉，看起来「被遮住」。 */
.nx-uc-theme-seg {
  display: inline-flex;
  flex: 0 0 auto;
}
.nx-uc-theme-opt {
  position: relative;
  padding: 5px 12px;
  margin-left: -1px;            /* 合并相邻格的边框 */
  border: 1px solid var(--au-border);
  color: var(--au-fg) !important;
  background: var(--au-card);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background .16s ease;
}
.nx-uc-theme-opt:first-child { margin-left: 0; border-radius: 8px 0 0 8px; }
.nx-uc-theme-opt:last-child { border-radius: 0 8px 8px 0; }
.nx-uc-theme-opt:not(.is-active):hover { background: var(--au-sub); }
.nx-uc-theme-opt.is-active {
  z-index: 1;                   /* 主色边框盖住相邻格的灰边，四边完整 */
  border-color: var(--au-primary);
  color: var(--au-primary) !important;
  background: var(--au-primary-tint);
}

.nx-uc-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--au-border);
  color: var(--au-danger);
  font-size: 13px;
  text-decoration: none;
}
.nx-uc-logout:hover { background: var(--au-danger-tint); }
.nx-uc-logout .nx-ico { width: 16px; height: 16px; }

/* ---------- 6. 发布按钮与 hover 卡片 ---------- */
.nx-publish-wrap { position: relative; }
.nx-publish-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px;
  border-radius: 9px;
  background: var(--au-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(251, 114, 153, .28);
}
.nx-publish-btn:hover { filter: brightness(1.06); }
.nx-publish-btn .nx-ico { width: 15px; height: 15px; }
.nx-publish-card {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 330px;
  padding: 14px 12px 12px;
  background: var(--au-popover);
  border: 1px solid var(--au-border);
  border-radius: 14px;
  box-shadow: var(--au-shadow-lg);
  color: var(--au-fg);
  z-index: 130;
  display: none;
}
.nx-publish-wrap:hover .nx-publish-card,
.nx-publish-wrap.is-open .nx-publish-card { display: block; }
.nx-pc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--au-border);
}
.nx-pc-grid a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border-radius: 8px;
  color: var(--au-fg);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.nx-pc-grid a:hover { background: var(--au-sub); }
.nx-pc-grid .nx-ico { width: 24px; height: 24px; }
.nx-pc-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--au-primary-tint);
  color: var(--au-fg);
  text-decoration: none;
}
.nx-pc-tip small { display: block; font-size: 11px; color: var(--au-muted); }
.nx-pc-tip strong { display: block; font-size: 13px; color: var(--au-primary); }
.nx-pc-tip .nx-ico { width: 14px; height: 14px; color: var(--au-primary); }

/* ---------- 7. 头图（通栏，一张图，深浅共用） ---------- */
/* 头图脱离文档流通栏铺满：不能用 width:100vw 撑在 td 里，
   否则 auto 布局的 table 会被撑到 100vw，导致下面正文也顶到屏幕两边。 */
.nx-hero {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 190px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  text-align: left;
}
.nx-hero--default {
  background: linear-gradient(115deg, #8c4a34 0%, #c9743f 28%, #e6a65f 55%, #f0cd8e 76%, #9c6138 100%);
}
.nx-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .30), rgba(0, 0, 0, .04) 58%, rgba(0, 0, 0, .20));
}
.nx-hero-inner {
  position: relative;
  max-width: var(--au-max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--au-gutter) 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
}
.nx-hero-logo {
  font-size: 32px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -1.5px;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .3);
  line-height: 1.15;
}
.nx-hero-logo-img { max-height: 76px; width: auto; border-radius: var(--au-r); }

/* 深色态：头图压暗（浅/深共用同一张配置图） */
body.nx-dark .nx-hero--default {
  background: linear-gradient(115deg, #241513 0%, #4a2a1c 28%, #6b4527 55%, #8a6236 76%, #2a1a14 100%);
}
body.nx-dark .nx-hero::before {
  background: linear-gradient(180deg, rgba(0, 0, 0, .50), rgba(0, 0, 0, .22) 58%, rgba(0, 0, 0, .42));
}

/* ---------- 8. 响应式 ---------- */
@media (max-width: 1280px) {
  .nx-nav-item { padding: 5px 8px; font-size: 14px; }
  .nx-icon { min-width: 42px; }
  .nx-topbar-inner { gap: 6px; }
}
@media (max-width: 1024px) {
  .nx-nav-left > .nx-nav-item:nth-child(5),
  .nx-nav-left > .nx-nav-item:nth-child(6) { display: none; }
}
@media (max-width: 768px) {
  :root { --au-gutter: 12px; }
  .nx-topbar { height: 54px; }
  .nx-nav-left > .nx-nav-item:nth-child(3),
  .nx-nav-left > .nx-nav-item:nth-child(4) { display: none; }
  .nx-search { min-width: 90px; }
  .nx-search select[name="search_area"] { display: none; }
  .nx-icon { min-width: 38px; }
  .nx-icon span { display: none; }
  /* 窄屏隐藏「收藏」（原依赖 nth-child 序号，插入铃铛后序号已变，改用显式类避免误伤铃铛/消息） */
  .nx-icon-bookmark { display: none; }
  .nx-publish-btn { padding: 6px 14px; }
  .nx-hero { height: 132px; }
  .nx-hero-logo { font-size: 24px; }
  .nx-user-card { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; transform: none; }
  .nx-publish-card { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .nx-topbar, .nx-nav-item, .nx-icon { transition: none !important; }
}

/* ---------- 9. 覆盖 theme.css 对 button 的全局 !important ----------
   Aurora/theme.css 给所有 button 施加了 !important 的粉色背景 + 白字，
   会覆盖普通 class 规则，导致「更多 / 头像 / 主题」按钮被染成实心粉色。
   这里只针对带 !important 的属性逐一压回；padding / 圆角 / 字号等
   仍由上面各组件自身规则控制（class 优先级高于 button 标签选择器）。 */
.nx-nav-item {
  color: inherit !important;
  background: transparent !important;
  border: 0 !important;
}
.nx-nav-item:hover {
  background: rgba(255, 255, 255, .18) !important;
  box-shadow: none !important;
  transform: none !important;
}
.nx-topbar.is-scrolled .nx-nav-item:hover { background: var(--au-sub) !important; }

.nx-avatar {
  color: inherit !important;
  background: var(--au-sub) !important;
  border: 2px solid rgba(255, 255, 255, .92) !important;
  box-shadow: 0 0 0 1px var(--au-border) !important;
  padding: 0 !important;
  border-radius: 50% !important;
}
.nx-avatar:hover {
  background: var(--au-sub) !important;
  box-shadow: 0 0 0 1px var(--au-border) !important;
  transform: none !important;
}
body.nx-dark .nx-avatar { border-color: var(--au-border) !important; }


.nx-search-btn {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  color: var(--au-muted) !important;
  box-shadow: none !important;
  transform: none !important;
}
.nx-search-btn:hover {
  background: var(--au-sub) !important;
  color: var(--au-primary) !important;
  box-shadow: none !important;
  transform: none !important;
}
.nx-scope-btn {
  color: var(--au-fg) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  box-shadow: none !important;
  font-weight: 600 !important;
  padding: 0 10px !important;
  border-radius: 9px !important;
  transform: none !important;
}
.nx-scope-btn:hover {
  background: var(--au-sub) !important;
  box-shadow: none !important;
  transform: none !important;
}
.nx-scope-wrap.is-open .nx-scope-btn {
  background: var(--au-card) !important;
  border-color: var(--au-primary) !important;
  box-shadow: 0 0 0 3px var(--au-primary-tint) !important;
}
.nx-scope-menu button {
  color: var(--au-fg) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  font-weight: 400 !important;
  padding: 8px 10px !important;
  border-radius: 7px !important;
  transform: none !important;
}
.nx-scope-menu button:hover {
  background: var(--au-sub) !important;
  box-shadow: none !important;
  transform: none !important;
}
.nx-scope-menu button.is-active {
  background: var(--au-sub) !important;
  color: var(--au-primary) !important;
  font-weight: 650 !important;
}

/* ---------- 10. hover 菜单可移入 ----------
   卡片与触发元素之间留有 12~14px 间隙，纯 CSS :hover 会在鼠标经过间隙时丢失，
   卡片立刻 display:none，导致「菜单移不上去、里面内容点不到」。
   改由 topbar.js 的 hover intent 处理：进入触发区加 .is-open（各卡片已有
   .wrap.is-open .card { display:block } 规则），离开后延迟 220ms 才移除，
   期间鼠标可平滑移入卡片并点击内容。不用大面积透明伪元素，
   避免鼠标划过头图时误触发卡片。 */

/* ---------- 11. 当前页选中态 & 弹出层文字色 ----------
   放在最后：第 9 节为压住 theme.css 的 button 全局样式用了
   background: transparent !important，必须用同等 !important 且更具体的规则压回来。
   头图上 / 吸顶后统一主色实底白字（不再用半透明白或 --au-sub）。 */
.nx-topbar .nx-nav-item.is-active,
.nx-topbar .nx-nav-item.is-active:hover {
  background: var(--au-primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(251, 114, 153, .32) !important;
  transform: none !important;
}

/* 弹出层内链接：不继承顶栏的白色，保证白底深字可读 */
.nx-topbar .nx-more-menu a,
.nx-topbar .nx-pc-grid a,
.nx-topbar .nx-pc-tip,
.nx-topbar .nx-uc-menu a,
.nx-topbar .nx-uc-banner { color: var(--au-fg) !important; }
.nx-topbar .nx-more-menu a:hover,
.nx-topbar .nx-uc-menu a:hover { color: var(--au-primary) !important; }
.nx-topbar .nx-uc-logout { color: var(--au-danger) !important; }
.nx-topbar .nx-pc-tip strong { color: var(--au-primary) !important; }

/* 「更多」不再单独加边框，与其它导航项完全一致（第 9 节 .nx-nav-item 已 border:0 !important）。
   theme.css:565 给所有 button 加了粉色 box-shadow，其它导航项都是 <a> 不受影响，
   只有「更多」是 <button> 会带一圈粉色光晕，这里单独压平。 */
.nx-topbar .nx-more-btn,
.nx-topbar .nx-more-btn:hover,
.nx-topbar .nx-more-btn:focus { box-shadow: none !important; }

/* 滚动吸顶后搜索框与初始态一致：只有 :focus-within 时整框一圈主色描边，
   分类按钮不再常显红框红字（否则双层红框过多）。 */

/* 发布按钮：theme.css 的 a:hover 会把链接染成主色，红底红字看不见，
   这里强制白字；hover 时背景改蓝、文字仍白（B 站式对比）。 */
.nx-topbar .nx-publish-btn,
.nx-topbar .nx-publish-btn:link,
.nx-topbar .nx-publish-btn:visited,
.nx-topbar .nx-publish-btn:hover { color: #fff !important; }
.nx-topbar .nx-publish-btn:hover {
  background: #00a1d6 !important;
  box-shadow: 0 3px 10px rgba(0, 161, 214, .3) !important;
  filter: none !important;
}

/* UID 后的魔力值链接 */
.nx-topbar .nx-uc-bonus,
.nx-topbar .nx-uc-medal { color: var(--au-primary) !important; text-decoration: none !important; }

/* 消息下拉（hover 浮层），每项右侧红色数字角标 */
.nx-message-wrap { position: relative; }
.nx-message-menu {
  position: absolute;
  top: calc(100% + 8px);
  /* 与头像 / 提醒下拉一致：相对「消息」图标水平居中，宽度按内容收缩 */
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  min-width: 132px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  background: var(--au-popover);
  border: 1px solid var(--au-border);
  border-radius: 10px;
  box-shadow: var(--au-shadow-lg);
  display: none;
  z-index: 130;
}
.nx-message-wrap.is-open .nx-message-menu,
.nx-message-wrap:hover .nx-message-menu { display: block; }
.nx-message-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--au-fg) !important;
  font-size: 13px;
  text-decoration: none !important;
  white-space: nowrap;
}
.nx-message-menu a:hover { background: var(--au-sub); }
.nx-menu-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--au-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* 提醒下拉（与「消息」同款 hover 浮层），列出原页面顶部的各色提醒横幅 */
.nx-notify-wrap { position: relative; }
.nx-notify-menu {
  position: absolute;
  top: calc(100% + 8px);
  /* 与头像卡片同款：相对铃铛图标水平居中，避免窄屏向右溢出视口 */
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  width: 340px;
  max-width: calc(100vw - 24px);
  /* 提醒条数多时限制高度并允许滚动，避免菜单超出视口、底部内容点不到 */
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  padding: 6px;
  background: var(--au-popover, #fff);
  border: 1px solid var(--au-border, #e4e8ef);
  border-radius: 10px;
  box-shadow: var(--au-shadow-lg, 0 12px 32px rgba(16,24,40,.16));
  display: none;
  z-index: 130;
}
.nx-notify-wrap.is-open .nx-notify-menu,
.nx-notify-wrap:hover .nx-notify-menu { display: block; }
.nx-notify-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 7px;
  color: var(--au-fg, #1b2430);
  font-size: 13px;
  line-height: 1.5;
}
.nx-notify-item:hover { background: var(--au-sub, #eef1f6); }
.nx-notify-item a { color: inherit !important; text-decoration: none !important; }
.nx-notify-item a:hover { color: var(--au-primary, #fb7299) !important; }
.nx-notify-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--au-muted, #6b7280);
}
.nx-notify-ok .nx-notify-dot { background: var(--au-ok, #2e9e6b); }
.nx-notify-info .nx-notify-dot { background: var(--au-info, #3b82f6); }
.nx-notify-warn .nx-notify-dot { background: var(--au-warn, #e9a23b); }
.nx-notify-danger .nx-notify-dot { background: var(--au-danger, #e5484d); }
.nx-notify-empty {
  padding: 18px 12px;
  text-align: center;
  color: var(--au-muted, #6b7280);
  font-size: 13px;
}

/* 提醒菜单窄屏兜底：fixed 全宽、去掉居中位移。必须放在 .nx-notify-menu 主体之后，
   否则会被主体里同特异性的 position/left/transform 反向覆盖（源顺序靠后者胜）。 */
@media (max-width: 768px) {
  .nx-notify-menu { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; transform: none; }
}

/* ---------- 12. 游客版顶栏 ----------
   游客正文已和登录版一样进入 td#outer，nav_block 只放顶栏，因此这里复用登录版
   同款布局：nav_block 撑 190px 给 absolute 头图占位，正文从 190px 下开始，
   #outer 下所有卡片 / 表格 / 居中样式自动生效。顶栏右侧「登录 / 注册」推到最右。 */

/* 右侧「登录 / 注册」推到最右：左边是欢迎文案，nx-nav-right 用 margin-left:auto 顶到最右 */
.nx-topbar--guest .nx-nav-right { margin-left: auto; }
/* 游客顶栏左侧欢迎文案：比右侧登录 / 注册(nx-nav-item 15px)更大更醒目。
   颜色继承顶栏（头图上白色、吸顶后 --au-fg），加轻微阴影提升头图可读性。 */
.nx-guest-welcome {
  font-family: var(--au-font);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  line-height: 1.2;
  color: inherit;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .45);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .nx-guest-welcome { font-size: 16px; }
}

body.nx-guest-topbar { padding-top: 0; position: relative; }
body.nx-guest-topbar #nav_block {
  height: 190px;               /* 与登录版一致：给 absolute 头图占位 */
  padding: 0 !important;
  border-bottom: 0 !important;
  text-align: left;
}
body.nx-guest-topbar table.mainouter {
  max-width: var(--au-max-width) !important;
}
body.nx-guest-topbar table.mainouter > tbody > tr:first-child > td:first-child {
  border-radius: 0 !important;
}
/* 头图仍是 absolute 通栏，与登录版观感完全一致 */
body.nx-guest-topbar .nx-hero { height: 190px; z-index: 0; }
