/* ==========================================================================
   base.css — 全站公共样式（设计变量 / 头部导航 / 面包屑 / 页脚 / 通用组件）
   维护说明：
     · 颜色、圆角、阴影统一走这里的 CSS 变量，改一处全站生效。
     · 本文件的 :root 是**「不写 data-skin 时的兜底」，值取自站点默认模板（当前 = 干净纯净）**。
       站点默认模板由 theme.js 的 DEFAULT_SKIN 决定；theme.js 在 <head> 同步执行、
       首次绘制前就把 data-skin 挂上，所以正常情况 7 套模板一律走 theme.css 里各自的块。
       :root 只在「theme.js 没跑起来」时可见（JS 被禁用 / 加载失败），
       所以它的值必须与 DEFAULT_SKIN 保持一致 —— 否则兜底会和默认模板给出两套答案。
     · 外观有三个维度，都由 theme.css 覆盖同一批变量名：
         data-skin   颜色模板 → 品牌色阶 + 环境色 + 圆角/阴影质感
         data-theme  明暗模式 → 结构明暗
         data-skin="custom"   用户自定义（theme.js 用内联样式注入）
       所以组件里**不要写死颜色 / 圆角 / 阴影**，一律引用变量，换肤才能自动生效。
     · 「中性层」不是写死的灰，而是由 --env-* 派生（见下面的环境色一节）：
       每套颜色模板给自己的 7 个 --env-* 值，页面底/卡片/描边/页脚就都会跟着变。
   ========================================================================== */

/* ---------- 1. 设计变量 Design Tokens ---------- */
:root {
  /* 品牌色阶 —— 这里是「兜底模板 = 站点默认（当前 干净纯净）」的浅色值，
     必须与 theme.js 的 DEFAULT_SKIN 指的那套逐个对齐。
     其余 6 套（靛蓝/松绿/赭橙/绛红/石墨/亚克力）的浅色块与全部深色块都在 theme.css。
     档位分工（7 套模板完全一致）：
       50 / 100   soft 软底：选中态、图标底衬、tag 背景
       200 / 300  描边 · 禁用轨 · 分割线（预留）
       500        实心主色（白字对比 ≥4.5:1）  600 hover   700 active / 正文链接
       800 / 900  更深一档（预留）
     换默认模板时：改这一组 + theme.css 的深色兜底块（见 theme.css 第一节），
     再确认 theme.css 里有原默认模板自己的浅/深两个块（否则它就没有规则来源了）。 */
  --blue-50: #f1f3f5;
  --blue-100: #e9ecef;
  --blue-200: #dee2e6;
  --blue-300: #ced4da;
  --blue-500: #0d6efd;
  --blue-600: #0b5ed7;
  --blue-700: #0a58ca;
  --blue-800: #0a58ca;
  --blue-900: #0a58ca;
  /* 主色的 R, G, B —— 给 rgba() 拼透明度用（焦点环、巨幕网格线），
     这样这些「主色 + 透明度」也自动跟着颜色模板走 */
  --brand-rgb: 13, 110, 253;
  /* 语义色（固定四色，不随颜色模板变） */
  --green-500: #198754;
  --yellow-500: #997404;
  --red-500: #dc3545;
  --purple-500: #495057;
  --cyan-500: #495057;
  --orange-500: #495057;

  /* ---------- 环境色：跟着颜色模板走的「中性层」----------
     换颜色模板时，整页观感的变化就来自这一层 —— 把品牌色相以很低的色度
     混进中性底，得到页面底 / 卡片 / 沉底 / 描边 / 页脚。
     为什么不做成色相插值：直接按色相构造、再二分求明度使**相对亮度 = 统一目标**，
     于是 5 套模板在每一层上的亮度完全相同 —— 换模板只换色相，不动对比度
     （与品牌色阶用的是同一套方法）。
       env-bg        页面底（色相最直观的一层）
       env-surface   卡片 / 面板 / 控件底（只带一丝色相，保持干净）
       env-sunken    沉底：输入框 / 轨道 / hover
       env-line-soft 弱描边 / 分割线
       env-line      强描边 / 控件边框
       env-header    页头（表面色 + 90% 不透明度）
       env-footer    页脚底（深色块，色相最重，换模板时最醒目）
     下面的 --gray-50…300 与 --body-bg / --surface* / --footer-bg 全部由这层派生，
     所以每套模板只需要覆盖这 7 个值（见 theme.css），结构层不用改。
     这里的 7 个值 = 默认模板「干净纯净」的浅色值：纯白页面底、白色卡片、柔和描边。 */
  --env-bg: #ffffff;
  --env-surface: #ffffff;
  --env-sunken: #f4f6f8;
  --env-line-soft: #dee2e6;
  --env-line: #dee2e6;
  --env-header: #ffffff;
  --env-footer: #f8f9fa;

  /* 中性色
     浅色端（底 / 描边）由环境色派生 → 跟着颜色模板走；
     深色端（文字）保持中性 → 不随模板泛色，可读性不受影响。
     500 / 600 / 700 是按 WCAG 4.5:1 反解过的（原 #9aa0a6 仅 2.30:1、
     #80868b 仅 3.21:1，都低于正文要求），括号内为在页面底上的实测值。 */
  /* 次级底不再直接等于页面底：页面底改纯白后，行悬浮 / 条纹需要自己留一点灰。
     用 color-mix 从「沉底 + 卡面」推，明暗模式与自定义配色都会自动跟着变。 */
  --gray-50: color-mix(in srgb, var(--env-sunken) 60%, var(--env-surface));
  --gray-100: var(--env-sunken);
  --gray-200: var(--env-line-soft);
  --gray-300: var(--control-border);
  /* 文字灰阶：三段必须拉开，否则整页「一片灰」看着发昏。
     500 辅助 / 600 次要 / 700 正文 / 900 标题，白底对比约 4.7 : 6.9 : 10.8 : 15.1。
     （旧值 600 与 700 都是 #495057，正文和辅助说明同色，层次就没了） */
  --gray-500: #6c757d;
  --gray-600: #4b5259;
  --gray-700: #343a40;
  --gray-900: #1f2328;
  /* 圆角 —— 「质感」维度之一。下面这组是染色型模板共用的默认值；
     theme.css 里中性型的两套（云白 / 亚克力）会覆盖它做出质感差。 */
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  /* 阴影 —— 同样属于「质感」。默认值偏中性；云白更轻、亚克力更厚，
     云白 / 亚克力 / 全部深色模式都在 theme.css 里覆盖了这一组。 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.075), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.075), 0 4px 12px rgba(0, 0, 0, 0.05);
  /* 卡片「静止态」的阴影（hover 的那层阴影由 --shadow-lg 负责）。
     默认 none —— 层次靠描边建立；只有「亚克力」把卡片抬起来做出厚度。 */
  --card-shadow: none;
  /* 字体与布局 */
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei UI', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --max-width: 1440px;
  --page-gutter: clamp(20px, 2.5vw, 40px);
  --header-h: 68px;
  --transition: .2s cubic-bezier(.2, .7, .2, 1);
  --ambient-violet-rgb: 111, 84, 255;
  --ambient-cyan-rgb: 31, 190, 230;
  --surface-glow: rgba(0, 0, 0, 0.04);
  --banner-control-bg: rgba(0, 0, 0, 0.075);
  --banner-dot: rgba(255, 255, 255, .6);
  --banner-dot-active: #fff;
  --body-ambient: none;
  --section-ambient: none;
  --header-accent-bg: transparent;
  --logo-bg: var(--primary);
  --nav-hover-bg: var(--surface-3);
  --nav-active-bg: var(--surface-3);
  --dropdown-accent-bg: var(--primary);
  --control-surface-bg: var(--surface);
  --hero-surface-bg: var(--surface);
  --hero-decoration-opacity: 0;
  --hero-grid-opacity: 0;
  --banner-viewport-bg: var(--surface);
  --banner-placeholder-bg: var(--surface-3);
  --banner-placeholder-alt-bg: var(--surface-3);
  --banner-decoration-opacity: 0;
  --section-title-accent-bg: var(--primary);
  --card-surface-bg: var(--surface);
  --card-line-opacity: 0;
  --card-icon-tint-strength: 20%;
  --cta-surface-bg: var(--surface);
  --cta-decoration-opacity: 0;
  --detail-header-bg: var(--surface);
  --detail-decoration-opacity: 0;
  --detail-icon-bg: var(--surface-3);
  --detail-section-bg: var(--surface);
  --sidebar-card-bg: var(--surface);
  --ui-control-surface-bg: var(--ui-bg);
  --ui-panel-surface-bg: var(--ui-bg);
  --ui-upload-surface-bg: var(--surface-3);
  --ui-upload-hover-bg: var(--neutral-hover);
  --ui-card-surface-bg: var(--ui-bg);
  --ui-demo-decoration: none;
  --ui-primary-button-bg: var(--primary);
  --ui-primary-button-hover-bg: var(--primary-hover);
  --tint-strength: 0%;

  /* 表面层（换肤主战场：底 → 卡片 → 沉底，三层拉开层次）
     全部由环境色派生 → 换颜色模板时这三层一起跟着变。 */
  --body-bg: var(--env-bg);
  --surface: var(--env-surface);       /* 卡片 / 面板 / 对话框底 */
  --surface-2: color-mix(in srgb, var(--env-sunken) 55%, var(--env-surface));  /* 次级底：悬浮行、条纹 */
  --surface-3: var(--env-sunken);      /* 更沉一层：输入框、分段控制器轨道 */
  --header-bg: var(--env-header);
  --shade: rgba(32, 33, 36, .45);      /* 遮罩 */

  /* 页脚（深底，浅色主题下也是深色）—— 深底色最吃得住色相，
     所以这一块是换模板时最醒目的地方。文字色固定，对比度实测 5.98:1。 */
  --footer-bg: var(--env-footer);
  --footer-text: #495057;
  --footer-heading: #212529;
  --footer-line: #dee2e6;

  /* 图标底衬：替代原来写在 HTML 上的内联 style="background:#e8f0fe"，
     让这类小色块也归主题管（深色下自动换成同色系深色）。
     tint-blue 是「跟品牌走」的那一档，由上面的 --blue-50 派生；
     其余 8 个是内容色（分类图标用），不随颜色模板变。 */
  --tint-blue: var(--surface-3);
  --tint-green: var(--surface-3);
  --tint-yellow: var(--surface-3);
  --tint-red: var(--surface-3);
  --tint-purple: var(--surface-3);
  --tint-cyan: var(--surface-3);
  --tint-orange: var(--surface-3);
  --tint-lime: var(--surface-3);
  --tint-amber: var(--surface-3);

  /* 巨幕（首页 / 栏目页共用）：底纹与描边都由主色 + 环境色派生，换模板时跟着变。
     只做「主色软底 → 环境卡面 → 页面底」的同色相渐变，不掺第二个色相。 */
  --hero-border: var(--gray-200);
  --hero-bg: var(--surface);
  --hero-grid-line: transparent;
  --hero-tag-bg: var(--surface-3);

  /* 首页「投稿 CTA」横条底 */
  --cta-bg: var(--surface);
}

/* ---------- 2. 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  color: var(--gray-900);
  background-color: var(--body-bg);
  background-image: var(--body-ambient);
  background-repeat: no-repeat;
  line-height: 1.68;
  /* 不要再写 text-rendering: optimizeLegibility / -webkit-font-smoothing: antialiased：
     Windows 上这两条会把中文从 ClearType 次像素渲染降级成灰度抗锯齿，
     15px 的微软雅黑就会显得发虚、发灰（用户反馈的「字体发昏」就是这个）。
     保持浏览器默认的渲染方式，中文笔画才会实。 */
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }

/* 通用容器 */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--page-gutter); }
.site-content { min-height: calc(100vh - 365px); }

/* ---------- 3. 顶部导航 Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.header::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 2px;
  background: var(--header-accent-bg);
  opacity: .72; pointer-events: none;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--page-gutter);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
}
.logo { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 21px; letter-spacing: -.02em; flex-shrink: 0; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--logo-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(0, 0, 0, 0.04);
}
/* min-width:0 让导航可以收缩到容器给定的宽度，而不是被内容撑开把右侧操作区顶出屏幕；
   放不下的栏目由 site-shell.js 收进「更多」面板。 */
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; position: relative; }
.nav-item { position: relative; }
.nav-item[hidden] { display: none !important; }
.nav-link {
  padding: 9px 11px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--gray-700);
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.nav-link:hover, .nav-item:hover .nav-link { background: var(--nav-hover-bg); color: var(--gray-900); }
.nav-link.active { background: var(--nav-active-bg); color: var(--blue-700); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04); }
.nav-link .arrow { font-size: 10px; transition: transform .2s; }
.nav-item:hover .nav-link .arrow { transform: rotate(180deg); }

/* 下拉面板 */
.dropdown {
  position: absolute; top: 100%; left: 0; min-width: 560px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); border: 1px solid var(--gray-200);
  padding: 20px;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: var(--transition);
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px;
}
.dropdown::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--dropdown-accent-bg); opacity: .75; }
.nav-item:hover .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header {
  grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100);
}
.dropdown-header span { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.dropdown-header a { font-size: 12px; color: var(--blue-700); }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); transition: var(--transition); }
.dropdown-item:hover { background: var(--blue-50); }
.dropdown-item .di-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.dropdown-item .di-name { font-size: 13px; font-weight: 500; color: var(--gray-900); }
.dropdown-item .di-desc { font-size: 11px; color: var(--gray-500); }
.dropdown-more { border: 1px dashed var(--gray-300); }
.dropdown-more .di-icon { font-weight: 700; }

/* 靠右的栏目下拉改为右对齐，避免 560px 宽的面板从左侧展开顶出容器（JS 会按实际位置逐项修正） */
.nav-item:nth-last-child(-n + 4) .dropdown,
.nav-item.drop-right .dropdown { left: auto; right: 0; }

/* 「更多」面板只有 250px 宽，且它已在导航最右端，改成左对齐让面板左边缘与按钮对齐 */
.nav-item.nav-more .dropdown { left: 0; right: auto; }

/* 「更多」收纳项：由 site-shell.js 动态插入，放不下才显示 */
.nav-more-btn {
  border: 0; background: none; cursor: pointer; font: inherit; color: inherit;
  font-weight: 500;
}
.nav-more-panel { min-width: 250px; grid-template-columns: 1fr; padding: 14px; }
.nav-more-panel .dropdown-header { padding-bottom: 10px; }
.nav-item.open .dropdown { opacity: 1; visibility: visible; transform: translateY(0); }

/* 头部右侧操作区
   搜索框与「提交工具」按钮已统一换成控件库的 .ui-input / .ui-btn（见 static/css/ui-form.css、ui-kit.css），
   这里只负责它们在头部的尺寸与间距，不再重复定义控件外观。 */
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.header-actions .header-search { width: 210px; flex-shrink: 0; }
.header-actions .ui-btn { flex-shrink: 0; }
.mobile-menu-btn { display: none; }

/* 站内搜索：索引仅首次聚焦加载，筛选与键盘交互全部由浏览器完成。 */
.site-search { position: relative; }
.site-search__box {
  height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 11px 0 13px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--control-surface-bg);
  box-shadow: inset 0 1px 0 var(--surface-glow);
  transition: var(--transition);
}
.site-search.is-focus .site-search__box { border-color: var(--blue-500); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-500) 14%, transparent), 0 12px 28px rgba(var(--brand-rgb), .1); }
.site-search__icon { width: 17px; height: 17px; color: var(--gray-500); flex: 0 0 auto; }
.site-search__icon svg { width: 100%; height: 100%; display: block; }
.site-search__input { min-width: 0; flex: 1; height: 36px; border: 0; outline: 0; padding: 0; background: transparent; color: var(--gray-900); font: inherit; font-size: 13px; }
.site-search__input::placeholder { color: var(--gray-500); }
.site-search__kbd { padding: 1px 5px; border: 1px solid var(--gray-300); border-radius: 4px; background: var(--surface); color: var(--gray-500); font-size: 11px; font-family: inherit; }
.site-search.is-focus .site-search__kbd, .site-search.has-value .site-search__kbd { display: none; }
.site-search__panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 100;
  width: 400px; max-height: 440px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow-xl);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.site-search__panel[hidden] { display: none; }
.site-search__tip { padding: 14px 12px; color: var(--gray-500); font-size: 12px; }
.site-search__item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: inherit; }
.site-search__item:hover, .site-search__item.is-active { background: var(--blue-50); }
.site-search__emoji { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: var(--gray-100); font-size: 16px; }
.site-search__meta { flex: 1; min-width: 0; }
.site-search__name, .site-search__desc { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-search__name { color: var(--gray-900); font-size: 13px; font-weight: 600; }
.site-search__name em { padding: 0 1px; border-radius: 3px; background: var(--yellow-100, var(--surface-3)); color: var(--orange-700, var(--gray-700)); font-style: normal; }
.site-search__desc { margin-top: 2px; color: var(--gray-500); font-size: 11px; }
.site-search__cat { flex: 0 0 auto; padding: 2px 7px; border-radius: 10px; background: var(--blue-50); color: var(--blue-700); font-size: 11px; }
.site-search__all { display: block; margin-top: 4px; padding: 9px 10px; border-top: 1px solid var(--gray-200); color: var(--blue-700); font-size: 13px; text-align: center; }
.site-search__all:hover { border-radius: 8px; background: var(--gray-100); }

/* ---------- 3.1 外观切换（右上角：颜色模板 × 明暗模式）
   面板内容由 static/js/theme.js 按注册表生成，这里只管外观。
   加一套颜色模板：改 theme.css + theme.js，本段不用动。 */
.theme-dd { position: relative; display: inline-flex; flex-shrink: 0; }
/* 只放一个图标（明亮=太阳 / 深色=月亮 / 自定义=调色盘），跟头部其它图标按钮同一规格。
   模式名放在视觉隐藏的 .tt-name 里，读屏和 title 仍能读到「外观：明亮」。 */
.theme-trigger {
  width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--gray-700);
  transition: var(--transition);
}
.theme-trigger .tt-ico { display: inline-flex; }
.theme-trigger .tt-ico svg { width: 18px; height: 18px; display: block; }
.theme-trigger .tt-name {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.theme-trigger:hover { background: var(--surface-3); color: var(--blue-700); }
.theme-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--blue-100); }
.theme-trigger[aria-expanded="true"] { background: var(--surface-3); color: var(--blue-700); }

.theme-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 120;
  width: 300px; padding: 6px;
  background: var(--surface); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); box-shadow: var(--shadow-xl);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97); transform-origin: top right;
  transition: opacity .18s ease, transform .22s cubic-bezier(.16, 1, .3, 1), visibility .18s;
}
.theme-dd.open .theme-menu { opacity: 1; visibility: visible; transform: none; }

/* 分组标题 + 组间分隔 */
.theme-menu-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px 7px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--gray-500);
  text-transform: uppercase;
}
.theme-menu-head span { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .8; }
.theme-menu-sep { height: 1px; margin: 7px 8px; background: var(--gray-200); }

/* 颜色模板：两列色卡，点一下即切换；圆点就是该模板的主色 */
.theme-swaps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 4px 4px; }
/* 模板数为奇数时，最后一项占满整行，避免右下角留一个空洞 */
.theme-swaps .theme-swap:last-child:nth-child(odd) { grid-column: 1 / -1; }
.theme-swap {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  height: 36px; padding: 0 10px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--gray-700);
  font-size: 12.5px; font-weight: 500; text-align: left;
  transition: var(--transition);
}
.theme-swap:hover, .theme-swap:focus-visible {
  border-color: var(--gray-300); background: var(--surface-2); color: var(--gray-900); outline: none;
}
.theme-swap[aria-checked="true"] {
  border-color: var(--blue-500); background: var(--blue-50); color: var(--blue-700); font-weight: 600;
}
.theme-swap .ts-dot {
  width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.075);
  transition: var(--transition);
}
.theme-swap[aria-checked="true"] .ts-dot {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.075), 0 0 0 3px var(--blue-100);
}
.theme-swap .ts-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 「自定义」那一项：虚线边框提示它和其它 7 套性质不同（用户可调） */
.theme-swap-custom { border-style: dashed; }
.theme-swap-custom[aria-checked="true"] { border-style: solid; }
.ts-dot-custom {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--blue-500);
}
.ts-dot-custom svg { width: 11px; height: 11px; }

/* 自定义配色面板：选中「自定义」时展开，两支颜色都实时生效 */
.theme-custom {
  margin: 4px 4px 2px; padding: 9px 10px 8px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--surface-3);
}
.theme-custom[hidden] { display: none; }
.tc-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--gray-500); text-transform: uppercase;
}
.tc-head span { font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .75; }
.tc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.tc-row:last-of-type { margin-bottom: 8px; }
.tc-label { width: 52px; flex: none; font-size: 12px; color: var(--gray-700); }
/* 原生取色器：input[type=color]，点一下弹系统调色板 */
.tc-pick {
  width: 30px; height: 28px; flex: none; padding: 2px; cursor: pointer;
  border: 1px solid var(--gray-300); border-radius: 6px; background: var(--surface);
}
.tc-pick::-webkit-color-swatch-wrapper { padding: 0; }
.tc-pick::-webkit-color-swatch { border: none; border-radius: 3px; }
.tc-pick::-moz-color-swatch { border: none; border-radius: 3px; }
.tc-hex {
  flex: 1; min-width: 0; height: 28px; padding: 0 8px;
  border: 1px solid var(--gray-300); border-radius: 6px;
  background: var(--surface); color: var(--gray-900);
  font-family: var(--font-mono); font-size: 12px;
}
.tc-hex:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.tc-foot { display: flex; align-items: center; gap: 8px; }
.tc-a11y { flex: 1; min-width: 0; font-size: 11px; color: var(--gray-500); }
.tc-a11y.is-ok { color: var(--green-500); }
.tc-a11y.is-bad { color: var(--red-500); }
.tc-reset {
  flex: none; height: 24px; padding: 0 9px; border-radius: 6px;
  border: 1px solid var(--gray-300); background: var(--surface);
  color: var(--gray-700); font-size: 11.5px; cursor: pointer; transition: var(--transition);
}
.tc-reset:hover:not(:disabled) { border-color: var(--blue-500); color: var(--blue-700); }
.tc-reset:disabled { opacity: .45; cursor: default; }

/* 明暗模式：一行一项，带说明 */
.theme-modes { padding: 0 4px 2px; }
.theme-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm); text-align: left;
  transition: var(--transition);
}
.theme-item:hover, .theme-item:focus-visible { background: var(--gray-100); outline: none; }
.theme-item[aria-checked="true"] { background: var(--blue-50); }
.theme-item .ti-ico {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--gray-700);
  transition: var(--transition);
}
.theme-item[aria-checked="true"] .ti-ico { background: var(--surface); color: var(--blue-700); }
.theme-item .ti-text { flex: 1; min-width: 0; }
.theme-item .ti-text b { display: block; font-size: 13px; font-weight: 600; color: var(--gray-900); }
.theme-item[aria-checked="true"] .ti-text b { color: var(--blue-700); }
.theme-item .ti-text em { display: block; font-size: 11px; font-style: normal; color: var(--gray-500); }
.theme-item .ti-check { color: var(--blue-700); opacity: 0; transform: scale(.7); transition: var(--transition); }
.theme-item[aria-checked="true"] .ti-check { opacity: 1; transform: none; }

/* 面板底部入口：挑颜色的时候，正好是最想知道「这套色怎么定义」的时候 */
.theme-menu-foot {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 4px 2px; padding: 10px 10px 6px;
  border-top: 1px solid var(--gray-200);
  color: var(--gray-500);
  font-size: 11.5px; line-height: 1.35;
  transition: var(--transition);
}
.theme-menu-foot span { flex: 1; min-width: 0; }
.theme-menu-foot svg { flex-shrink: 0; opacity: .55; transition: var(--transition); }
.theme-menu-foot:hover, .theme-menu-foot:focus-visible { color: var(--blue-700); outline: none; }
.theme-menu-foot:hover svg { opacity: 1; transform: translateX(2px); }
.theme-menu-foot:focus-visible { box-shadow: 0 0 0 3px var(--blue-100); border-radius: var(--radius-sm); }

/* ---------- 4. 面包屑 ---------- */
.breadcrumb {
  max-width: var(--max-width); margin: 0 auto; padding: 20px var(--page-gutter) 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--gray-600);
}
.breadcrumb a:hover { color: var(--blue-700); }
.breadcrumb .sep { color: var(--gray-300); }
.breadcrumb .current { color: var(--gray-900); font-weight: 500; }

/* ---------- 5. 标签徽标 ---------- */
.tool-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 600;
}
.badge-hot { background: var(--tint-red); color: var(--red-500); }
.badge-new { background: var(--tint-green); color: var(--green-500); }
.badge-pro { background: var(--tint-blue); color: var(--blue-700); }

/* 通用图标按钮 */
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gray-600); transition: var(--transition); flex-shrink: 0;
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-900); }

/* ---------- 6. 页脚 Footer ---------- */
.footer {
  position: relative; overflow: hidden;
  background:
    var(--surface);
  color: var(--footer-text); padding: 64px var(--page-gutter) 30px; margin-top: 64px;
  border-top: 1px solid var(--gray-200);
}
.footer-inner { max-width: var(--max-width); margin: 0 auto; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 36px; margin-bottom: 40px; }
.footer-brand .logo { color: var(--footer-heading); margin-bottom: 14px; }
.footer-brand p { font-size: 13px; color: var(--footer-text); line-height: 1.7; max-width: 260px; }
.footer-col h4 { font-size: 14px; font-weight: 600; color: var(--footer-heading); margin-bottom: 14px; }
.footer-col a { display: block; font-size: 13px; color: var(--footer-text); padding: 4px 0; transition: color .2s; cursor: pointer; }
.footer-col a:hover { color: var(--blue-700); }
.footer-bottom {
  border-top: 1px solid var(--footer-line); padding-top: 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-wrap: wrap; font-size: 12px; color: var(--footer-text);
}

/* ---------- 7~8. 轻提示与弹层 ----------
   已统一换成控件库实现，本文件不再维护重复版本：
     Toast   → UI.toast()          样式 static/css/ui-display.css 的 .ui-toast
     对话框  → UI.openModal()      样式 static/css/ui-display.css 的 .ui-mask / .ui-modal
   旧页面上遗留的 window.showToast / openModal / closeModal 由 common.js 转发过去。 */

/* ==========================================================================
   9. 巨幕 Hero + 图片轮播位（首页 / 栏目页共用组件）
   维护说明：巨幕下方留了两张图的轮播位，两页共用同一套标记。
   换图：把图片放到 static/img/banner-1.jpg、banner-2.jpg 即可（尺寸见 9.2）。
   切换间隔：给 .hero-banner 写 data-banner-interval="5000"（毫秒，默认 4000）。
   ========================================================================== */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hero-border);
  background: var(--hero-surface-bg);
  margin-bottom: 32px;
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.04), inset 0 1px 0 var(--surface-glow);
}
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 360px; height: 360px; right: -100px; top: -210px; background: transparent; filter: blur(3px); opacity: var(--hero-decoration-opacity); }
.hero::after { width: 330px; height: 330px; left: 18%; bottom: -260px; background: transparent; filter: blur(4px); opacity: var(--hero-decoration-opacity); }
/* 细网格底纹：只在上半部分可见，制造克制的「技术图纸」感 */
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    none;
  background-size: 28px 28px;
  opacity: var(--hero-grid-opacity);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .4) 58%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .4) 58%, transparent 100%);
}

/* 9.1 巨幕头部 */
.hero-head { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: 25px 30px 17px; }
.hero-text { min-width: 0; flex: 1; }
.hero-title { font-size: 28px; font-weight: 750; letter-spacing: -.04em; line-height: 1.3; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-sub { font-size: 14px; color: var(--gray-600); margin-top: 7px; }
.hero-tag {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--blue-700); background: var(--hero-tag-bg);
  border: 1px solid var(--blue-100); padding: 3px 10px 3px 8px; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 6px; letter-spacing: 0;
}
.hero-tag::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--green-500); animation: heroPulse 2.2s ease-out infinite; }
@keyframes heroPulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 168, 83, .5); }
  70% { box-shadow: 0 0 0 7px rgba(52, 168, 83, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 168, 83, 0); }
}
.hero-stats { display: flex; gap: 30px; flex-shrink: 0; }
.hero-stat { text-align: right; line-height: 1.2; }
.hero-stat b { display: block; font-family: var(--font-mono); font-size: 19px; font-weight: 700; color: var(--blue-700); font-variant-numeric: tabular-nums; }
.hero-stat span { font-size: 12px; color: var(--gray-600); }

/* 9.2 图片轮播位（替换掉原来的文字滚动跑马灯）
   ┌──────────────────────────────────────────────────────────┐
   │ 图片位尺寸：桌面端 1200 × 150                            │
   │   .hero 内宽 1230px（1280 视口 − 左右 24px 容器内边距     │
   │   − 2px 边框）− 左右各 15px 内边距 = 1200 × 150           │
   │   出图建议 2400 × 300（2 倍图），会以 object-fit:cover 铺满│
   │ 小屏高度自动变矮，图片按中心裁切，无需另出小图             │
   └──────────────────────────────────────────────────────────┘ */
.hero-banner { position: relative; z-index: 2; padding: 0 15px 15px; }
.banner-viewport {
  position: relative; overflow: hidden;
  height: var(--banner-h, 150px);
  border-radius: var(--radius-md);
  background: var(--banner-viewport-bg);
  border: 1px solid var(--gray-200);
  box-shadow: inset 0 1px 0 var(--surface-glow), 0 10px 28px rgba(0, 0, 0, 0.04);
}
.banner-slide {
  position: absolute; inset: 0; display: block;
  opacity: 0; visibility: hidden; transform: scale(1.04);
  transition: opacity .8s ease, transform 2.6s ease, visibility .8s;
}
.banner-slide.is-active { opacity: 1; visibility: visible; transform: scale(1); }
.banner-img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s ease; }
/* 图片加载成功后占位层让位 */
.banner-slide.is-loaded .banner-img { opacity: 1; }

/* 占位层：图片还没放进来时显示，标出尺寸与文件名 */
.banner-ph {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: flex-start; gap: 16px;
  padding: 28px 46px;
  background: var(--banner-placeholder-bg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  color: var(--gray-500);
}
.banner-slide:nth-child(2) .banner-ph {
  background: var(--banner-placeholder-alt-bg);
}
.banner-ph::before, .banner-ph::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.banner-ph::before { width: 170px; height: 170px; right: 8%; top: -72px; border: 1px solid transparent; box-shadow: 0 0 0 28px rgba(0, 0, 0, 0), 0 0 0 58px rgba(0, 0, 0, 0); opacity: var(--banner-decoration-opacity); }
.banner-ph::after { width: 8px; height: 8px; right: 23%; bottom: 28px; background: transparent; box-shadow: 48px -52px 0 rgba(0, 0, 0, 0), 92px 8px 0 rgba(0, 0, 0, 0); opacity: var(--banner-decoration-opacity); }
.banner-slide.is-loaded .banner-ph { display: none; }
.banner-ph-ico {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  display: flex; align-items: center; justify-content: center; color: var(--blue-500);
  backdrop-filter: blur(8px);
}
.banner-ph-txt { position: relative; z-index: 1; }
.banner-ph-txt b { display: block; font-size: 18px; font-weight: 700; color: var(--gray-900); margin-bottom: 3px; letter-spacing: -.02em; }
.banner-ph-txt span { font-size: 13px; color: var(--gray-600); letter-spacing: .1px; }

/* 轮播指示点（浮在图片右下角，带毛玻璃底保证任何图片上都看得清） */
.banner-dots {
  position: absolute; right: 27px; bottom: 27px; z-index: 3;
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px; border-radius: 999px;
  background: var(--banner-control-bg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.banner-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--banner-dot); transition: all .35s ease; }
.banner-dot:hover { background: var(--banner-dot-active); }
.banner-dot.is-active { width: 20px; background: var(--banner-dot-active); }

/* 9.5 巨幕响应式 */
@media (max-width: 1024px) {
  /* 注意：列方向不要用 align-items:flex-start，否则子元素按 max-content 撑开、右侧被裁 */
  .hero-head { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 20px 10px; }
  .hero-stat { text-align: left; }
  .hero-banner { padding: 0 12px 12px; }
  .banner-viewport { height: 132px; }
  .banner-dots { right: 24px; bottom: 24px; }
}
@media (max-width: 768px) {
  .hero-title { font-size: 17px; }
  .hero-sub { font-size: 12px; }
  .hero-stats { gap: 20px; }
  .banner-viewport { height: 116px; }
  .banner-ph-txt span { display: none; }
}
@media (max-width: 480px) {
  .hero-stats { display: none; }
  .hero-title { font-size: 16px; }
  .banner-viewport { height: 96px; }
  .banner-dots { right: 20px; bottom: 20px; padding: 4px 6px; }
  .banner-ph-ico { width: 26px; height: 26px; }
  .banner-ph-txt b { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .banner-slide { transition: opacity .2s ease; transform: none; }
  .banner-slide.is-active { transform: none; }
  .hero-tag::before { animation: none; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 10. 响应式 ---------- */

/* 10.1 导航密度
   头部回到 1440 居中容器后，≥1500 视口下导航可用宽度是恒定的（容器不变宽），
   所以字号与内边距只用一套值，放不下的栏目统一交给 site-shell.js 收进「更多」；
   只有视口真正小于容器（≤1499）时再缩一点搜索框，把宽度让给栏目。 */
@media (max-width: 1499px) {
  .header-actions { gap: 10px; }
  .header-actions .header-search { width: 190px; }
}

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .dropdown { min-width: 480px; }
  /* 平板宽度下导航放不下，收进汉堡菜单，避免链接被挤压换行 */
  .nav { display: none; }
  .header-actions .header-search { display: none; }
  .mobile-menu-btn {
    display: flex; width: 40px; height: 40px;
    align-items: center; justify-content: center; border-radius: var(--radius-sm);
  }
  .header-inner { gap: 16px; }
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .logo { font-size: 18px; }
  input[type="text"], input[type="number"], input[type="search"], textarea { font-size: 16px; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .header-actions { gap: 8px; }
  .header-actions .ui-btn { display: none; }
}

/* ==========================================================================
   11. 移动端抽屉菜单（≤1024px 点右上角汉堡按钮打开）
   维护说明：抽屉里的内容**不用在 HTML 里写**，common.js 的 initMobileNav()
   会读取桌面 .nav 自动生成（含下拉分组）—— 加一个栏目只需改桌面导航一处。
   分组标题带 ▸，点一下展开子项；当前栏目对应的分组打开时自动展开。
   ========================================================================== */
.mobile-menu-btn[aria-expanded="true"] { background: var(--gray-100); color: var(--gray-900); }

/* 11.1 遮罩 */
.mobile-mask {
  position: fixed; inset: 0; z-index: 998;
  background: var(--shade);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.mobile-mask.show { opacity: 1; visibility: visible; }

/* 11.2 抽屉本体：右侧滑出 */
.mobile-nav {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 999;
  width: min(88vw, 360px);
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  transform: translateX(100%); visibility: hidden;
  transition: transform .32s cubic-bezier(.22, .61, .36, 1), visibility .32s ease;
}
.mobile-nav.show { transform: translateX(0); visibility: visible; }

/* 11.3 抽屉头部 */
.mnav-head {
  flex-shrink: 0; padding: 12px 10px 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.mnav-title { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; min-width: 0; }
.mnav-title .logo-icon { width: 30px; height: 30px; border-radius: 9px; }
.mnav-close {
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-600); transition: var(--transition);
}
.mnav-close:hover { background: var(--gray-100); color: var(--gray-900); }

/* 11.4 抽屉内搜索（桌面搜索框在小屏被隐藏，这里补一个）
   克隆的是头部的 .ui-input，所以只需撑满宽度 */
.mnav-search { flex-shrink: 0; padding: 14px 20px 4px; }
.mnav-search .ui-input { width: 100%; }

/* 11.5 导航列表 */
.mnav-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 8px 12px 16px; }
.mnav-link, .mnav-group-btn {
  width: 100%; padding: 12px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 15px; font-weight: 500; color: var(--gray-900); text-align: left;
  transition: var(--transition);
}
.mnav-link:hover, .mnav-group-btn:hover { background: var(--gray-50); }
.mnav-link.active, .mnav-group-btn.active { color: var(--blue-700); background: var(--blue-50); }
.mnav-arrow { color: var(--gray-500); flex-shrink: 0; transition: transform .28s ease; }
.mnav-group.open .mnav-arrow { transform: rotate(180deg); }
.mnav-group.open > .mnav-group-btn { color: var(--blue-700); }

/* 子项展开：max-height 由 JS 按内容高度设，动画不会忽快忽慢 */
.mnav-sub { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.mnav-sub-inner { padding: 2px 0 6px 8px; }
.mnav-sub-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-700); transition: var(--transition);
}
.mnav-sub-item:hover { background: var(--blue-50); color: var(--blue-700); }
.mnav-sub-item .di-icon {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.mnav-all { display: inline-block; padding: 8px 12px 4px; font-size: 12.5px; font-weight: 500; color: var(--blue-700); }
.mnav-all:hover { text-decoration: underline; }

/* 11.6 抽屉底部 */
.mnav-foot {
  flex-shrink: 0; padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--gray-100);
}
.mnav-foot .ui-btn { width: 100%; height: 44px; }

/* 打开抽屉时锁住页面滚动 */
body.nav-open { overflow: hidden; }

/* 桌面端不出现（宽度回到 >1024 时 JS 也会自动收起） */
@media (min-width: 1025px) {
  .mobile-nav, .mobile-mask { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-nav, .mobile-mask, .mnav-sub { transition: none; }
}

/* Neutral color contracts: color properties only. */
:root {
  --primary: var(--blue-500);
  --primary-hover: var(--blue-600);
  --control-border: #d1d5db;
  --secondary-button-bg: var(--surface);
  --neutral-hover: #e9ecef;
  --neutral-border-hover: #adb5bd;
  --danger-subtle: #fff5f5;
  --success-subtle: #eaf4ee;
  --ui-red: var(--red-500);
  --ui-green: var(--green-500);
  --ui-amber: var(--ui-warning);
  --ui-amber-text: var(--ui-warning-text);
  --ui-blue: var(--primary);
}
.badge-hot { background: var(--danger-subtle); color: var(--red-500); }
.badge-new { background: var(--success-subtle); color: var(--green-500); }
.tint-blue, .tint-green, .tint-yellow, .tint-red, .tint-purple,
.tint-cyan, .tint-orange, .tint-lime, .tint-amber { color: var(--gray-700); }
.tool-meta .star { color: var(--gray-500); }

/* ==========================================================================
   9. 我的工具（头部图标 + 右侧抽屉）
   数据全部来自本机 localStorage（jqc.favorites.v1 / jqc.recent.v1），
   与 /favorites/、/recent/ 两个列表页共用同一份数据，不经过后端。
   ========================================================================== */
.header-actions .mt-open {
  position: relative; flex: 0 0 auto;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gray-700);
  transition: var(--transition);
}
.header-actions .mt-open:hover { background: var(--surface-3); color: var(--blue-700); }
.header-actions .mt-open[aria-expanded="true"] { background: var(--surface-3); color: var(--blue-700); }
.mt-open-dot {
  position: absolute; top: 9px; right: 10px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--red-500);
  box-shadow: 0 0 0 2px var(--header-bg);
}
.mt-open-dot[hidden] { display: none; }

.mt-drawer { position: fixed; inset: 0; z-index: 1200; }
.mt-drawer[hidden] { display: none !important; }
.mt-mask {
  position: absolute; inset: 0; background: var(--shade);
  opacity: 0; transition: opacity .22s ease;
}
.mt-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(384px, 92vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--gray-200);
  box-shadow: -18px 0 48px rgba(15, 23, 42, .16);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.2, .7, .2, 1);
}
.mt-drawer.in .mt-mask { opacity: 1; }
.mt-drawer.in .mt-panel { transform: none; }

.mt-panel-head {
  flex: 0 0 auto; height: 56px; padding: 0 16px 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}
.mt-panel-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.mt-x {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--gray-600); transition: var(--transition);
}
.mt-x:hover { background: var(--surface-3); color: var(--gray-900); }

.mt-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 20px 28px; }
.mt-sec { padding: 14px 0; border-bottom: 1px solid var(--gray-100); }
.mt-sec:last-child { border-bottom: 0; }
.mt-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.mt-sec-title { font-size: 12px; font-weight: 700; color: var(--gray-600); letter-spacing: .02em; }
.mt-sec-title em {
  font-style: normal; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--blue-700); background: var(--blue-50);
  padding: 1px 6px; border-radius: 20px; margin-left: 5px;
}
.mt-sec-links { display: flex; align-items: center; gap: 12px; }
.mt-link { font-size: 11.5px; font-weight: 400; color: var(--blue-700); cursor: pointer; }
.mt-link:hover { text-decoration: underline; }

.mt-list { display: flex; flex-direction: column; gap: 1px; }
.mt-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; margin: 0 -8px; border-radius: 9px;
  transition: background .16s ease;
}
.mt-item:hover { background: var(--surface-2); }
.mt-item:hover .mt-name { color: var(--blue-700); }
.mt-ico {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--surface-3);
}
.mt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mt-name {
  font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .16s ease;
}
.mt-sub { font-size: 11.5px; color: var(--gray-500); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-del {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  color: var(--gray-500); cursor: pointer; opacity: 0;
  transition: opacity .16s ease, background .16s ease, color .16s ease;
}
.mt-item:hover .mt-del { opacity: 1; }
.mt-del:hover { background: var(--tint-red); color: var(--red-500); opacity: 1; }
.mt-empty { font-size: 12px; line-height: 1.7; color: var(--gray-500); padding: 6px 0 2px; }

@media (hover: none) {
  .mt-del { opacity: .55; }
}
@media (max-width: 560px) {
  .mt-panel { width: 100%; border-left: 0; }
  .header-actions .mt-open { width: 36px; height: 36px; }
}
body.mt-lock { overflow: hidden; }

/* ==========================================================================
   重构底部 tools-footer 样式
   ========================================================================== */
.tools-footer {
  position: relative;
  overflow: hidden;
  background: var(--surface, #ffffff);
  color: var(--gray-600, #475467);
  padding: 44px 24px 32px;
  margin-top: 56px;
  border-top: 1px solid var(--gray-200, #eaecf0);
  text-align: center;
}
.tools-footer .container {
  max-width: 1200px;
  margin: 0 auto;
}
.tools-footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}
.tools-footer-links li a {
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700, #344054);
  text-decoration: none;
  transition: color .15s ease;
}
.tools-footer-links li a:hover {
  color: var(--primary, #2563eb);
}
.tools-footer-hint {
  font-size: 13.5px;
  margin-bottom: 8px;
  font-weight: 500;
}
.tools-footer-email {
  font-size: 13px;
  color: var(--gray-600, #475467);
  margin-bottom: 10px;
}
.tools-footer-email a {
  color: var(--primary, #2563eb);
  text-decoration: none;
  font-weight: 500;
}
.tools-footer-email a:hover {
  text-decoration: underline;
}
.tools-footer-copy {
  font-size: 12.5px;
  color: var(--gray-500, #667085);
  line-height: 1.8;
  margin: 8px 0;
}
.tools-footer-copy a {
  color: var(--gray-700, #344054);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tools-footer-copy a:hover {
  color: var(--primary, #2563eb);
}
.tools-footer-beian {
  margin: 10px 0 18px;
}
.tools-footer-beian a {
  font-size: 12px;
  color: var(--gray-500, #98a2b3);
  text-decoration: none;
}
.tools-footer-beian a:hover {
  color: var(--gray-700, #475467);
  text-decoration: underline;
}
.friend-links-section {
  border-top: 1px dashed var(--gray-200, #eaecf0);
  padding-top: 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.friend-links-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-500, #667085);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.friend-links-grid {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.friend-links-grid a {
  font-size: 12.5px;
  color: var(--gray-600, #475467);
  text-decoration: none;
  transition: color .15s ease;
}
.friend-links-grid a:hover {
  color: var(--primary, #2563eb);
}

html[data-theme="dark"] .tools-footer {
  background: var(--ap-bg-card, #1e293b);
  border-color: var(--ap-line, #334155);
  color: var(--ap-ink-2, #94a3b8);
}
html[data-theme="dark"] .tools-footer-links li a {
  color: var(--ap-ink, #f1f5f9);
}
html[data-theme="dark"] .tools-footer-copy {
  color: var(--ap-ink-3, #64748b);
}
html[data-theme="dark"] .tools-footer-copy a {
  color: var(--ap-ink-2, #94a3b8);
}
html[data-theme="dark"] .friend-links-section {
  border-color: var(--ap-line, #334155);
}
html[data-theme="dark"] .friend-links-title {
  color: var(--ap-ink-3, #64748b);
}
html[data-theme="dark"] .friend-links-grid a {
  color: var(--ap-ink-2, #94a3b8);
}
