/* ===== TT API 前端定制 v3 =====
 * 目标：导航栏浮动胶囊 + 全局网格背景 + 隐藏版本号胶囊
 * 全部原创样式，不复用第三方代码
 */

/* ---------- 1. 全局背景：网格 + 光晕 ---------- */
html, body {
  background-color: #f4fbfa !important;
  background-image:
    linear-gradient(rgba(15, 118, 110, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, .022) 1px, transparent 1px) !important;
  background-size: 46px 46px !important;
  background-attachment: fixed !important;
  background-position: center top !important;
}

/* 主容器让出背景 */
#root > div {
  background: transparent !important;
}

/* ---------- 2. 导航栏 → 浮动胶囊 ---------- */
header {
  position: sticky !important;
  top: 12px !important;
  margin: 12px auto 0 !important;
  max-width: 1200px !important;
  width: calc(100% - 52px) !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, .82) !important;
  backdrop-filter: blur(22px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(180%) !important;
  border: 1px solid rgba(15, 23, 42, .06) !important;
  border-bottom: 1px solid rgba(15, 23, 42, .06) !important;
  box-shadow: 0 12px 36px -24px rgba(15, 23, 42, .45) !important;
  z-index: 1000 !important;
}

/* 导航内部留白：只作用于最外层，避免挤去 Logo */
header > div:first-child {
  padding-left: 20px !important;
  padding-right: 16px !important;
  min-height: 58px !important;
}

/* 让导航内容垂直居中，不被压扁 */
header {
  min-height: 58px !important;
  display: flex !important;
  align-items: center !important;
}
header > div {
  width: 100% !important;
}

/* 站名和 Logo 保持紧凑 */
header img, header svg {
  flex-shrink: 0 !important;
}

/* 右侧图标间距收紧 */
header button, header [role="button"] {
  margin-left: 2px !important;
}

/* 导航链接 */
header a {
  border-radius: 9999px !important;
  transition: color .16s ease, background-color .16s ease !important;
}
header a:hover {
  color: #0d9488 !important;
  background-color: rgba(20, 184, 166, .09) !important;
}

/* ---------- 3. 主按钮统一青绿 ---------- */
button[type="submit"],
.btn-primary,
header button:last-child {
  background: linear-gradient(135deg, #14b8a6, #0d9488) !important;
  border: none !important;
  border-radius: 9999px !important;
  box-shadow: 0 8px 22px -12px rgba(13, 148, 136, .8) !important;
}
button[type="submit"]:hover,
.btn-primary:hover,
header button:last-child:hover {
  background: linear-gradient(135deg, #0d9488, #0f766e) !important;
}

/* ---------- 4. 卡片圆角 ---------- */
.rounded-lg, .rounded-xl, .rounded-2xl {
  border-radius: 18px !important;
}

/* ---------- 5. 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(20, 184, 166, .28);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(20, 184, 166, .45); }

/* ---------- 6. 浮动社群按钮 ---------- */
.tt-float {
  position: fixed !important;
  right: 22px !important;
  bottom: 88px !important;
  z-index: 9998 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif !important;
}
.tt-float a {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 11px 17px !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, .96) !important;
  border: 1px solid rgba(15, 23, 42, .08) !important;
  box-shadow: 0 10px 28px -14px rgba(15, 23, 42, .4) !important;
  color: #334155 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  backdrop-filter: blur(14px) !important;
  transition: transform .18s ease, box-shadow .18s ease, color .18s ease !important;
  white-space: nowrap !important;
}
.tt-float a:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 16px 34px -14px rgba(13, 148, 136, .55) !important;
  color: #0d9488 !important;
  border-color: rgba(13, 148, 136, .32) !important;
}
.tt-float .tt-ico {
  width: 19px !important;
  height: 19px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  color: #fff !important;
  flex-shrink: 0 !important;
}

@media (max-width: 760px) {
  header {
    width: calc(100% - 24px) !important;
    top: 8px !important;
    margin-top: 8px !important;
  }
  .tt-float a span.tt-label { display: none !important; }
  .tt-float a { padding: 11px !important; }
  .tt-float { right: 14px !important; bottom: 76px !important; }
}

/* ---------- 7. 隐藏导航栏左侧版本号胶囊 ----------
 * 结构（New API v1.0.0-rc.47）：
 *   div.@container/system-brand
 *     > a            → Logo + 站名
 *     > button       → 版本号（span.font-mono "v1.0.0-rc.47"）+ 更新检查弹窗
 * 该按钮仅对管理员可见，且没有稳定的 class，所以按位置与内容特征双重命中。
 * 只隐藏这一个按钮，右侧的语言/主题/通知/头像全部保留。
 */
header div[class*="system-brand"] > button,
header div[class*="system-brand"] button:has(span[class*="font-mono"]),
header button:has(> span[class*="font-mono"]:not(:empty)) {
  display: none !important;
}
