/* 横向分类菜单栏（公共组件，首页与工具页共用）。依赖 --border/--primary/--text/--muted 变量。 */
.navbar { display: flex; flex-wrap: wrap; align-items: stretch;
  border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 2px; }
.navitem { position: relative; }
.navitem > button { border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--text); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.navitem > button:hover { background: #f3f4f6; color: var(--primary); }
.navitem > button .cx { color: var(--muted); font-size: 11px; }
.navdrop { display: none; position: absolute; top: 100%; left: 0; z-index: 60; min-width: 180px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.14);
  padding: 6px; margin-top: 2px; max-height: 70vh; overflow-y: auto; }
.navitem.open .navdrop { display: block; }
/* 向上展开变体（用于放在页面底部的菜单栏，避免下拉出屏） */
.navbar.up .navdrop { top: auto; bottom: 100%; margin: 0 0 2px; }
.navdrop a { display: block; color: var(--text); font-size: 13px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; text-decoration: none; }
.navdrop a:hover { background: #eff6ff; color: var(--primary); }
.navdrop a.cur { color: var(--primary); font-weight: 600; background: #eff6ff; }
/* 工具搜索框（桌面靠右） */
.nav-search { position: relative; margin-left: auto; align-self: center; }
.nav-search-in { border: 1px solid var(--border); background: #f9fafb; border-radius: 8px; font-family: inherit;
  font-size: 13px; color: var(--text); padding: 7px 10px; width: 160px; transition: width .15s, background .15s; }
.nav-search-in:focus { outline: none; border-color: var(--primary); background: #fff; width: 210px; }
.nav-results { display: none; position: absolute; top: 100%; right: 0; z-index: 70; min-width: 240px; max-width: 320px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.16);
  padding: 6px; margin-top: 4px; max-height: 60vh; overflow-y: auto; }
.navbar.up .nav-results { top: auto; bottom: 100%; margin: 0 0 4px; }
.nav-results a { display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  color: var(--text); font-size: 13px; padding: 7px 10px; border-radius: 6px; text-decoration: none; }
.nav-results a:hover { background: #eff6ff; color: var(--primary); }
.nav-results .rslug { color: var(--muted); font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; flex-shrink: 0; }
.nav-nores { padding: 8px 10px; color: var(--muted); font-size: 13px; }
/* 手机折叠按钮：桌面隐藏 */
.nav-toggle { display: none; border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--text); padding: 9px 12px; border-radius: 8px; width: 100%; text-align: left; }
@media (max-width: 640px) {
  .navbar { flex-direction: column; }
  .nav-toggle { display: block; }
  .nav-toggle:hover { background: #f3f4f6; }
  .navbar .navitem { display: none; width: 100%; }   /* 默认折叠，只显示按钮 */
  .navbar.nav-open .navitem { display: block; }       /* 点开后展开分类 */
  .navdrop { position: static; box-shadow: none; border: none; padding: 0 0 4px 12px; max-height: none; }
  .navitem > button { width: 100%; text-align: left; }
  /* 搜索框手机端常显、占满整行 */
  .nav-search { margin: 4px 0 0; width: 100%; }
  .nav-search-in, .nav-search-in:focus { width: 100%; box-sizing: border-box; }
  .nav-results { left: 0; right: 0; max-width: none; }
}

/* 搜索结果带描述 */
.nav-results a { display: block; }
.nav-results .rname { display: flex; justify-content: space-between; gap: 8px; }
.nav-results .rdesc { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.nav-adv { flex: 0 0 auto; margin-left: 6px; padding: 7px 10px; font-size: 12px; border: 1px solid var(--border); border-radius: 8px; background: #f9fafb; color: var(--muted); cursor: pointer; white-space: nowrap; }
.nav-adv:hover { color: var(--primary); border-color: var(--primary); background: #fff; }

/* 高级搜索弹窗 */
.advsearch { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; z-index: 200; align-items: flex-start; justify-content: center; padding: 64px 16px; }
.advsearch.show { display: flex; }
.advsearch-box { background: #fff; width: 100%; max-width: 580px; border-radius: 14px; box-shadow: 0 24px 64px rgba(0,0,0,.32); overflow: hidden; max-height: 76vh; display: flex; flex-direction: column; }
.advsearch-in { border: 0; border-bottom: 1px solid var(--border); padding: 15px 18px; font-size: 16px; outline: none; font-family: inherit; }
.advsearch-list { overflow-y: auto; }
.advsearch-list a { display: flex; gap: 11px; align-items: flex-start; padding: 10px 16px; text-decoration: none; color: var(--text); border-bottom: 1px solid #f3f4f6; }
.advsearch-list a.sel, .advsearch-list a:hover { background: #eff6ff; }
.advsearch-list .aicon { font-size: 18px; flex: 0 0 auto; line-height: 1.5; }
.advsearch-list .amain { flex: 1; min-width: 0; }
.advsearch-list .aname { font-weight: 600; font-size: 14px; }
.advsearch-list .acat { font-size: 11px; color: var(--primary); margin-left: 6px; font-weight: 400; }
.advsearch-list .adesc { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.advsearch-empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.advsearch-hint { padding: 8px 16px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); background: #fafbfc; }

/* 搜索框移到顶栏「最近使用」左边后的样式 */
.top { flex-wrap: wrap; row-gap: 6px; }
.nav-search.in-top { margin-left: 0; margin-right: 10px; align-self: center; }
.nav-search.in-top .nav-search-in { width: 150px; }
.nav-search.in-top .nav-search-in:focus { width: 190px; }
@media (max-width: 640px) {
  .nav-search.in-top { flex: 0 1 auto; margin-right: 8px; width: auto; }
  .nav-search.in-top .nav-search-in { width: 110px; }
  .nav-search.in-top .nav-search-in:focus { width: 130px; }
}

/* —— 面包屑（工具页顶部，与 BreadcrumbList 结构化数据三级一致）—— */
.crumb { font-size: 13px; color: var(--muted); margin: 2px 0 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.crumb a { color: var(--primary); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.crumb .sep { color: var(--muted); }
.crumb .cur { color: var(--text); font-weight: 600; }

/* —— 同类相关工具（工具页底部，按分类自动生成）—— */
.related-auto { margin-top: 18px; }
.related-auto h2 { font-size: 15px; margin: 0 0 10px; }
.ra-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ra-grid a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); font-size: 13px; background: #fff; }
.ra-grid a:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.ra-grid .ra-ic { font-size: 14px; }
