/* ═══════════════════════════════════════════
   Navbar — 双层顶栏
   顶1：黑底白字 (品牌)   顶2：无底功能栏 (主图上白字 / 他页实底)
   ═══════════════════════════════════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  width: 100%;
}

/* ── 顶1栏：黑底白字 ── */
.nav__tier1 {
  height: var(--nav1-h);
  background: #000000;
  color: #FFFFFF;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.nav__t1-inner {
  width: 100%; height: 100%; margin: 0 auto;
  padding: 0 32px;
  display: flex; align-items: center; gap: 16px;
}
.nav__brand {
  display: flex; align-items: center; gap: 8px;
  height: 100%; flex-shrink: 0;
}
.nav__brand-logo {
  height: 26px; width: auto; object-fit: contain;
  filter: brightness(0) invert(1);  /* logo 白色化 */
  transition: filter 0.3s;
}
.nav__ad {
  flex: 1; text-align: center;
  font-size: 0.72rem; font-weight: 300;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav__help {
  flex-shrink: 0;
  font-size: 0.75rem; font-weight: 400;
  color: rgba(255,255,255,0.85);
  padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.25);
  transition: all 0.2s;
}
.nav__help:hover { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.5); }

/* ── 需要帮助下拉 (同更多设置样式) ── */
.nav__help-wrap { position: relative; flex-shrink: 0; }
.nav__help-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 200;
}
.nav__help-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav__help-panel .nav__menu-item { color: var(--fg); }

/* ── 顶2栏：功能栏 ── */
.nav__tier2 {
  height: var(--nav2-h);
  background: transparent;
  color: rgba(255,255,255,0.92);
  border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), color 0.35s, border-color 0.35s;
}
.nav--solid .nav__tier2 {
  background: var(--bg);
  color: var(--fg);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nav__t2-inner {
  width: 100%; height: 100%; margin: 0 auto;
  padding: 0 32px;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 16px;
}

/* 顶2左：导航链接 */
.nav__links {
  display: flex; align-items: center; gap: 4px;
  justify-self: start;
  height: 100%;
}
.nav__links a {
  position: relative;
  padding: 0 12px;
  font-size: 0.82rem; font-weight: 400;
  color: inherit; opacity: 0.8;
  display: inline-flex; align-items: center;
  height: 100%;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.nav__links a:hover { opacity: 1; }
.nav__links a.active { opacity: 1; font-weight: 500; }
/* 当前页白色横杠 */
.nav__links a.active::after {
  content: ''; position: absolute;
  left: 12px; right: 12px; bottom: 8px;
  height: 2px; background: currentColor; border-radius: 1px;
}

/* 顶2中：网站 logo */
.nav__weblogo {
  justify-self: center;
  display: flex; align-items: center;
  height: 100%;
}
.nav__weblogo img {
  height: 34px; width: auto; object-fit: contain;
  filter: brightness(0) invert(1);  /* 默认白字 */
  transition: filter 0.35s;
}
.nav--solid .nav__weblogo img { filter: none; }

/* 顶2右：功能区 */
.nav__right {
  justify-self: end;
  display: flex; align-items: center; gap: 4px;
  height: 100%;
}
.nav__iconbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px;
  font-size: 0.78rem; font-weight: 400;
  color: inherit; opacity: 0.85;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s, background 0.2s;
  white-space: nowrap;
}
.nav__iconbtn:hover { opacity: 1; background: rgba(128,128,128,0.12); }
.nav__iconbtn .icon-svg { width: 18px; height: 18px; }
.nav__menu-item .icon-svg { width: 16px; height: 16px; color: var(--fg-muted); }
.nav__menu-item:hover .icon-svg { color: var(--fg); }
.nav__toggle-row .icon-svg { width: 16px; height: 16px; color: var(--fg-muted); }

/* 头像 (登录后) — 不显示用户名 */
.nav__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%; overflow: hidden;
  background: rgba(128,128,128,0.25);
  flex-shrink: 0;
  border: 1px solid rgba(128,128,128,0.3);
  transition: transform 0.2s;
}
.nav__avatar:hover { transform: scale(1.06); }
.nav__avatar img { width: 100%; height: 100%; object-fit: cover; }
#navUser { font-size: 0; position: relative; gap: 0 !important; }  /* 隐藏用户名文字，避免 gap 撑爆圆形 */
#navUser > span { position: absolute !important; inset: 0 !important; width: auto !important; height: auto !important; border-radius: 50% !important; }
#navUser img { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; object-fit: cover; }
#navPts { display: none !important; }  /* 积分不在顶栏显示 */

/* 通知红点 */
.nav__notif { position: relative; }
.nav__notif-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: 0.6rem; font-weight: 700; line-height: 16px;
  text-align: center;
  display: none;  /* pollNotifs 控制显隐 */
  border: 2px solid var(--bg);
}
.nav--solid .nav__notif-dot { border-color: var(--bg); }
.nav:not(.nav--solid) .nav__notif-dot { border-color: transparent; }

/* ── 更多设置下拉 ── */
.nav__menu { position: relative; }
.nav__menu-panel {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 200;
}
.nav__menu-panel.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav__menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  font-size: 0.82rem; color: var(--fg);
  border-radius: var(--radius);
  transition: background 0.15s;
  text-align: left;
}
.nav__menu-item:hover { background: var(--bg-hover); }
.nav__menu-item .icon-svg { width: 16px; height: 16px; color: var(--fg-muted); }
.nav__menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.nav__menu-sub {
  display: flex; gap: 4px; padding: 4px 12px 8px;
}
.nav__menu-sub button {
  flex: 1; padding: 6px 8px; font-size: 0.74rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--fg-muted); background: transparent;
  transition: all 0.15s;
}
.nav__menu-sub button:hover { color: var(--fg); border-color: var(--border-strong); }
.nav__menu-sub button.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
/* 水印开关 */
.nav__toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; font-size: 0.82rem;
}
.nav__switch {
  position: relative; width: 36px; height: 20px;
  background: var(--border-strong); border-radius: 999px;
  cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.nav__switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.nav__switch.on { background: var(--fg); }
.nav__switch.on::after { transform: translateX(16px); }

/* ── 移动端 (≤900px) ── */
.nav__toggle { display: none; }
@media (max-width: 900px) {
  :root { --nav1-h: 36px; --nav2-h: 54px; }
  .nav__t1-inner { padding: 0 16px; gap: 8px; }
  .nav__ad { font-size: 0.66rem; }

  /* tier-2 从 grid 切换为 flex，保证 ☰-logo-图标 三区分布 */
  .nav__t2-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; gap: 8px;
  }

  /* 左侧：汉堡 + 导航链接下拉 */
  .nav__links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    flex-direction: column; padding: 8px 16px; gap: 0;
    opacity: 0; visibility: hidden;
    transform: translateY(-8px); transition: opacity 0.25s, transform 0.25s, visibility 0.25s; z-index: 99;
    height: auto; justify-self: auto;
  }
  .nav__links.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav__links a { width: 100%; height: 44px; padding: 0; color: var(--fg); }
  .nav__links a.active::after { left: 0; right: auto; width: 24px; bottom: 6px; }
  .nav__toggle { display: inline-flex; }

  /* 中：logo 保持原位（弹性居中） */
  .nav__weblogo { justify-self: auto; flex: 1; justify-content: center; }
  .nav__weblogo img { height: 28px; }

  /* 右：功能图标（仅显图标不显文字） */
  .nav__right { justify-self: auto; }
  .nav__iconbtn span { display: none; }
  .nav__iconbtn { padding: 0 8px; }
  .nav__iconbtn .icon-svg { width: 20px; height: 20px; }

  /* 帮助/设置下拉面板防溢出 */
  .nav__help-panel, .nav__menu-panel { right: -8px; }
}
@media (max-width: 500px) {
  :root { --nav1-h: 32px; --nav2-h: 48px; }
  .nav__t1-inner { padding: 0 10px; }
  .nav__t2-inner { padding: 0 10px; }
  .nav__weblogo img { height: 24px; }
  .nav__help { padding: 3px 8px; font-size: 0.68rem; }
  .nav__help-panel, .nav__menu-panel { min-width: 180px; }
}
