/* 全站统一抬头 topbar.css — 深色毛玻璃悬浮条，各页共用 */

:root {
  --tb-h: 56px;
  --tb-bg: rgba(14, 27, 42, 0.82);
  --tb-line: #24405E;
  --tb-ink: #F2F6FA;
  --tb-muted: #8FA3B8;
  --tb-accent: #E8A33D;
  --tb-on-accent: #16293F;   /* 主按钮上的文字色，浅色主题覆盖为白 */
  --tb-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

.tb {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1040px, calc(100vw - 32px));
  height: var(--tb-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 10px 0 18px;
  border-radius: 16px;
  background: var(--tb-bg);
  border: 1px solid var(--tb-line);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  z-index: 900;
  font-family: "Manrope", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  box-sizing: border-box;
}

.tb * { box-sizing: border-box; }

.tb-brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--tb-ink);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.tb-brand:hover { color: var(--tb-accent); }

.tb-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.tb-link {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--tb-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 0.3s var(--tb-ease), background 0.3s var(--tb-ease);
}
.tb-link:hover { color: var(--tb-ink); background: rgba(36, 64, 94, 0.6); }
.tb-link.on {
  color: var(--tb-accent);
  background: rgba(232, 163, 61, 0.13);
}

.tb-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tb-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tb-ink);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--tb-line);
  background: rgba(36, 64, 94, 0.35);
  transition: border-color 0.3s var(--tb-ease);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-user:hover { border-color: var(--tb-accent); }
.tb-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--tb-accent);
  box-shadow: 0 0 8px var(--tb-accent);
  animation: tbPulse 2.4s var(--tb-ease) infinite;
  flex-shrink: 0;
}
@keyframes tbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.tb-out, .tb-admin {
  font-size: 13px;
  color: var(--tb-muted);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.tb-out:hover { color: #F0968A; background: rgba(224, 100, 77, 0.12); }
.tb-admin { color: var(--tb-accent); border: 1px solid var(--tb-accent); border-color: color-mix(in srgb, var(--tb-accent) 32%, transparent); }
.tb-admin:hover { background: color-mix(in srgb, var(--tb-accent) 14%, transparent); }

.tb-login {
  font-size: 14px;
  font-weight: 700;
  color: var(--tb-on-accent);
  background: var(--tb-accent);
  padding: 7px 16px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.3s var(--tb-ease), transform 0.4s var(--tb-ease);
}
.tb-login:hover { filter: brightness(1.08); transform: translateY(-1px); }

/* 内容避让：页面自带顶部内边距可用 body.has-topbar */
body.has-topbar { padding-top: calc(var(--tb-h) + 24px); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .tb { gap: 8px; padding: 0 8px 0 12px; width: calc(100vw - 20px); }
  .tb-brand { font-size: 14px; }
  .tb-link { padding: 6px 8px; font-size: 13px; }
  .tb-out, .tb-admin { display: none; }
}

@media (max-width: 560px) {
  .tb { height: 50px; border-radius: 14px; }
  .tb-brand { display: none; }
  .tb-links { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .tb-links::-webkit-scrollbar { display: none; }
  .tb-link { padding: 5px 7px; font-size: 12.5px; }
  .tb-user { max-width: 84px; padding: 4px 8px; font-size: 13px; }
  .tb-login { padding: 6px 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  .tb-dot { animation: none; }
  .tb-link, .tb-login, .tb-user { transition: none; }
}
/* 全站统一抬头：各模块布局适配（追加到模块 CSS 末尾） */

/* ---------- 笔记 ---------- */
body.has-topbar .app {
  height: calc(100dvh - 80px);
  margin-top: 0;
}

/* ---------- 人物星图 ---------- */
body.has-topbar .g-app {
  height: calc(100dvh - 80px);
}
/* 星图顶部工具条已去掉品牌/回退链接，保留按钮组右对齐 */
body.has-topbar .g-top {
  justify-content: flex-end;
}
body.has-topbar .g-top .g-actions {
  flex: 1;
  justify-content: flex-end;
}

/* ---------- 视频工具 ---------- */
body.has-topbar .m-app {
  height: calc(100dvh - 80px);
}

/* ---------- 环境自检（demo，普通文档流） ---------- */
body.has-topbar .detail {
  padding-top: 20px;
}

/* ---------- 移动端：头部更矮 ---------- */
@media (max-width: 560px) {
  body.has-topbar .app,
  body.has-topbar .g-app,
  body.has-topbar .m-app {
    height: calc(100dvh - 74px);
  }
}
