/* ============================================================
   zwdh.com UX 微调补丁 · 2026-11-11 v2
   注入方式：nginx sub_filter（不触碰应用构建，删除配置段即可回滚）
   v2 调整：AI 浮动按钮改为桌面端圆形图标；tab 条改用细滚动条
            （v1 的渐隐遮罩会覆盖图文卡片，已废弃）
   ============================================================ */

/* ---------- 1. 主导航断点：1200px 起显示（原 1280px），并压缩间距防溢出 ---------- */
@media (min-width: 1200px) and (max-width: 1279.98px) {
  header nav.hidden[class*="xl:flex"] {
    display: flex !important;
    gap: 0 !important;
  }
  header nav.hidden[class*="xl:flex"] > a,
  header nav.hidden[class*="xl:flex"] > button {
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
  }
  header div.hidden[class*="xl:flex"] {
    display: flex !important;
  }
  header div.flex[class*="xl:hidden"] {
    display: none !important;
  }
}

/* ---------- 2. 「最近访问」空态：隐藏空卡片，快捷入口占满整行 ---------- */
/* 空态特征：第二张卡片内是居中提示文字；有浏览记录后结构被替换，规则自动失效 */
section[aria-label="快捷入口与最近访问"] div.grid > div.bg-card:nth-child(2):has(> div.text-center) {
  display: none !important;
}
section[aria-label="快捷入口与最近访问"] div.grid:has(> div.bg-card:nth-child(2) > div.text-center) {
  grid-template-columns: minmax(0, 1fr) !important;
}

/* ---------- 3. 详情页截图区：降低高度，水印文字同步缩小 ---------- */
div[aria-label="查看截图大图"] {
  height: 190px;
}
@media (min-width: 640px) {
  div[aria-label="查看截图大图"] {
    height: 230px;
  }
}
@media (min-width: 1024px) {
  div[aria-label="查看截图大图"] {
    height: 280px;
  }
}
div[aria-label="查看截图大图"] [class*="text-[120px]"] {
  font-size: 72px;
}

/* ---------- 4. AI 浮动按钮：桌面端收为圆形图标，不再压住侧栏文字 ---------- */
@media (min-width: 1024px) {
  button[class*="fixed bottom-6 right-6"] {
    width: 56px;
    height: 56px;
    padding: 0 !important;
    gap: 0 !important;
    justify-content: center;
    border-radius: 9999px;
  }
  button[class*="fixed bottom-6 right-6"] > span {
    display: none;
  }
  /* 侧栏底部预留安全距离，避免内容贴到按钮区域 */
  aside[class*="lg:sticky"] {
    padding-bottom: 4.75rem;
  }
}

/* ---------- 5. 横向 tab 条：细滚动条提示可横向滚动（替代被裁切的观感） ---------- */
div.overflow-x-auto {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-bottom: 0.5rem;
  scroll-behavior: smooth;
}
div.overflow-x-auto::-webkit-scrollbar {
  height: 4px;
}
div.overflow-x-auto::-webkit-scrollbar-track {
  background: transparent;
}
div.overflow-x-auto::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}
div.overflow-x-auto::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* ---------- 6. favicon 兜底：统一底色 + 隐藏加载失败时的 alt 文字残影 ---------- */
img[src*="/api/favicon"],
img[src*="/api/favfile"] {
  object-fit: contain;
  background: var(--muted);
  color: transparent;
}
