/* =============================================================
 *  办公人导航 · 样式表
 *  配色取自参考站点：主色 #1e73be / 背景 #f9f9f9 / 强调红 #f1404b
 *  断点：375px（小屏手机）→ 640px → 900px → 1200px → 1440px+
 * ============================================================= */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 品牌色 */
  --brand: #1e73be;
  --brand-strong: #175d99;
  --brand-soft: #eaf2fb;
  --brand-ring: rgba(30, 115, 190, .28);
  --accent: #f1404b;          /* 推荐角标红 */
  --accent-soft: #ffecee;

  /* 中性色（浅色主题） */
  --bg: #f9f9f9;
  --bg-soft: #f1f4f8;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --text: #14171b;
  --text-2: #5b6470;
  --text-3: #8a94a6;
  --border: #e9edf2;
  --border-strong: #d9e0e9;

  /* 尺寸与效果 */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 27, .04), 0 2px 8px rgba(20, 23, 27, .04);
  --shadow: 0 1px 2px rgba(20, 23, 27, .04), 0 8px 24px rgba(20, 23, 27, .06);
  --shadow-hover: 0 6px 14px rgba(30, 115, 190, .10), 0 18px 40px rgba(20, 23, 27, .10);

  --header-h: 64px;
  --container: 1440px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: light;
}

/* 深色主题 */
[data-theme="dark"] {
  --bg: #12161c;
  --bg-soft: #171c24;
  --surface: #1b212a;
  --surface-2: #20272f;
  --text: #e8edf4;
  --text-2: #a4b0c0;
  --text-3: #74808f;
  --border: #2a323d;
  --border-strong: #37414e;
  --brand-soft: #16283a;
  --accent-soft: #3a1f23;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-hover: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- 2. 基础重置 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* 注意：这里不要再加 scroll-padding-top。
     锚点偏移由 .category-section 的 scroll-margin-top 负责，
     两者叠加会导致跳转后标题被推得过低（约 2 倍导航高度）。 */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

body.drawer-open { overflow: hidden; }

a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

/* hidden 属性必须优先于组件自身的 display 声明，否则 JS 切换显隐会失效 */
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  border-radius: 0 0 10px 10px;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 0; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 32px);
}

/* ---------- 3. 顶部导航栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  transition: box-shadow .25s var(--ease), background-color .3s var(--ease);
}
[data-theme="dark"] .site-header { background: rgba(18, 22, 28, .88); }
.site-header.is-scrolled { box-shadow: 0 4px 20px rgba(20, 23, 27, .08); }

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--header-h);
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 32px);
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; flex: none; }
.logo-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #4a9be0);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(30, 115, 190, .32);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: 17px; letter-spacing: .3px; }
.logo-text small { font-size: 11px; color: var(--text-3); }

/* 顶部水平导航已迁移到左侧栏；保留 .nav-menu 占位仅供抽屉/旧代码兼容 */
.nav-menu { display: none !important; }

/* ---------- 3.5 主布局：左侧栏 + 主内容 ---------- */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  align-items: start;
  max-width: var(--container);
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  padding: 22px 10px 24px;     /* 顶部 22px 让分类整体在 quicklinks 下再加间距，更"往下移" */
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

/* 侧栏顶部站内搜索：sticky 于侧栏顶部，分类标题下移到其下方 */
.sidebar-search {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(20, 23, 27, .05);
}
.sidebar-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sidebar-search .ss-icon { flex: none; width: 16px; height: 16px; fill: var(--text-3); }
.sidebar-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
}
.sidebar-search input::placeholder { color: var(--text-3); }
.sidebar-search .ss-clear {
  flex: none;
  width: 20px; height: 20px;
  border: 0; border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 15px; line-height: 1;
  cursor: pointer;
}
.sidebar-search .ss-clear:hover { background: var(--border); color: var(--text); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.sidebar-group { margin-bottom: 2px; }

.sidebar-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.sidebar-group-title:hover { color: var(--brand); background: var(--brand-soft); }
.sidebar-group-title .ic { flex: none; font-size: 15px; }
.sidebar-group-title .label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-group-title .count {
  flex: none;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 400;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}
.sidebar-group.is-active > .sidebar-group-title {
  background: var(--brand);
  color: #fff;
}
.sidebar-group.is-active > .sidebar-group-title .count {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  border-color: transparent;
}

.sidebar-group-children {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin: 4px 0 6px 12px;
  padding: 2px 0 2px 8px;
  border-left: 2px solid var(--border);
}
.sidebar-group.is-active .sidebar-group-children { display: flex; }

.sidebar-child-link {
  display: block;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--text-3);
  font-size: 13px;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.sidebar-child-link:hover { color: var(--brand); background: var(--brand-soft); }
.sidebar-child-link.is-active { color: var(--brand); font-weight: 600; }

/* 抽屉内复用 sidebar 样式时去掉外边距与边框 */
.drawer .sidebar-nav { gap: 0; }
.drawer .sidebar-group-title { font-size: 15px; padding: 10px 12px; }
.drawer .sidebar-child-link { font-size: 14px; padding: 6px 12px; }
.drawer .sidebar-group-children { margin-left: 14px; padding-left: 10px; }

/* 右侧操作区 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: none;
}

/* 推广位横幅（替换原桌面端搜索框）：保持 960×60 的原始比例，hover 轻微提亮 */
.header-banner {
  display: block;
  flex: none;
  width: clamp(320px, 38vw, 560px);
  min-height: 36px;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(20, 23, 27, .06);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .2s var(--ease);
}
.header-banner:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(30, 115, 190, .18); }
.header-banner:active { opacity: .85; }
.header-banner:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.header-banner img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 36px;
  aspect-ratio: 960 / 60;
  object-fit: cover;
  object-position: center;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- 4. 搜索框 ---------- */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  fill: var(--text-3);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.search-box input::-webkit-search-cancel-button { display: none; }

.search-box--header { width: clamp(170px, 22vw, 240px); }

.search-clear {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border-strong);
  color: var(--surface);
  font-size: 15px;
  line-height: 1;
}
.search-clear:hover { background: var(--accent); }

/* ---------- 4.5 顶部快捷区（hao123 风格）：与左侧栏顶端对齐 ---------- */
.quicklinks {
  /* 让 .quicklinks 在 .layout grid 中跨两列全宽，往左延伸覆盖 sidebar 之上 */
  grid-column: 1 / -1;
  /* 透明背景，与主区融为一体；与 sidebar 顶部齐平 */
  padding-top: 0;
  background: transparent;
  border-bottom: none;
}
.ql-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 0;        /* 顶部 8px 与 sidebar padding-top 18px 配合留出首行对齐线 */
}
.ql-row-tags {
  padding-top: 4px;
  padding-bottom: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--border);   /* 仅热榜下方一条细分隔，与 hero 区分 */
}

.ql-mini {
  display: none;          /* 桌面 ≥900px 显示 */
  flex: none;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-3);
}
.ql-mini-link:hover { color: var(--brand); }

.ql-search {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-width: 0;
  border: 2px solid var(--brand);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}

.ql-engines {
  display: flex;
  align-items: center;
  padding-left: 6px;
}
.ql-engine {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.ql-engine:hover { color: var(--brand); }
.ql-engine.is-active {
  background: var(--brand);
  color: #fff;
}

.ql-form {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
}
.ql-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}
.ql-form input:focus { outline: none; }
.ql-form input::placeholder { color: var(--text-3); }

.ql-go {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  width: 96px;
  height: 40px;
  border: 0;
  border-radius: 0 999px 999px 0;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.ql-go:hover { background: var(--brand-strong); }
.ql-go svg { width: 16px; height: 16px; fill: currentColor; }

/* 热榜标签行 */
.ql-tag-label {
  flex: none;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  transform: translateY(2px);
}
.ql-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  min-width: 0;
}
.ql-link {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  transition: color .2s var(--ease);
}
.ql-link:hover { color: var(--brand); }
.ql-link .ico {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 3px;
  vertical-align: -2px;
  border-radius: 3px;
  color: #fff;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
}

@media (max-width: 900px) {
  .ql-mini { display: flex; flex-direction: row; gap: 12px; }
  .ql-row { flex-wrap: wrap; gap: 10px; padding: 10px 0; }
  .ql-engine { padding: 7px 10px; font-size: 12px; }
  .ql-form input { height: 36px; font-size: 14px; }
  .ql-go { width: 80px; height: 36px; font-size: 13px; }
  .ql-go svg { display: none; }
  .ql-go span { margin: 0; }
}

/* ---------- 5. Hero 区 ---------- */
.hero {
  position: relative;
  padding: clamp(38px, 6vw, 72px) 0 clamp(28px, 4vw, 44px);
  text-align: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 70% at 50% 0%, var(--brand-soft) 0%, transparent 70%),
    linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  z-index: -1;
}
.hero-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.hero-title {
  margin: 0;
  font-size: clamp(24px, 4.4vw, 40px);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -.5px;
}
.hero-title .hl {
  background: linear-gradient(120deg, var(--brand), #3aa8f0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin: 0;
  max-width: 640px;
  color: var(--text-2);
  font-size: clamp(13px, 1.6vw, 15px);
}

.search-box--hero { width: min(620px, 100%); }
.search-box--hero input {
  height: 52px;
  padding: 0 92px 0 46px;
  border-radius: 999px;
  font-size: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.search-box--hero .search-icon { left: 18px; width: 19px; height: 19px; }
.search-box--hero input:focus { box-shadow: 0 0 0 3px var(--brand-ring), var(--shadow-hover); }
.search-kbd {
  position: absolute;
  right: 44px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-3);
  font-family: inherit;
  font-size: 12px;
}
.search-clear--hero { right: 14px; width: 24px; height: 24px; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
  margin-top: 6px;
}
.hero-stats li {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.hero-stats b { color: var(--brand); font-weight: 700; }

/* ---------- 6. 分类区块 ---------- */
.category-list { display: flex; flex-direction: column; gap: clamp(26px, 3vw, 40px); padding-bottom: 56px; }

.category-section { scroll-margin-top: calc(var(--header-h) + 12px); }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: clamp(17px, 2.2vw, 20px);
  font-weight: 700;
}
.section-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--brand-soft);
  font-size: 16px;
}
.section-desc { margin: 0; color: var(--text-3); font-size: 13px; }
.result-count { margin-left: 4px; color: var(--text-3); font-size: 14px; font-weight: 400; }

/* 子分类 Tab */
.tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  white-space: nowrap;
  transition: all .2s var(--ease);
}
.tab-btn:hover { color: var(--brand); border-color: var(--brand); }
.tab-btn.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 3px 10px rgba(30, 115, 190, .28);
}

/* ---------- 7. 卡片网格 ---------- */
.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.site-card {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease),
              border-color .22s var(--ease), background-color .3s var(--ease);
  animation: cardIn .32s var(--ease) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.site-card:hover,
.site-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: var(--shadow-hover);
}
.site-card:hover .card-title { color: var(--brand); }
.site-card:hover .card-icon { transform: scale(1.06) rotate(-3deg); }
.site-card:hover .card-arrow { opacity: 1; transform: translate(0, 0); }

.card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  overflow: hidden;
  transition: transform .25s var(--ease);
}
.card-icon img { width: 100%; height: 100%; object-fit: cover; }

.card-body { min-width: 0; flex: 1; }
.card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 600;
  transition: color .2s var(--ease);
}
.card-title .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge-hot {
  flex: none;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.card-desc {
  margin: 0;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 搜索结果卡片上的来源标注 */
.card-group {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--bg-soft);
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.7;
}

/* 启用 favicon 时的兜底文字（图片加载失败后自动露出） */
.card-fallback {
  position: absolute;
  font-size: 17px;
  font-weight: 700;
}
.card-icon { position: relative; }
.card-icon img { position: relative; z-index: 1; }

.card-arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 14px;
  height: 14px;
  fill: var(--brand);
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}

/* 搜索命中高亮 */
mark.hl-key { background: #fff2a8; color: inherit; border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] mark.hl-key { background: #6b5a16; color: #ffe9a8; }

.btn-reset, .link-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  font-size: 13px;
}
.btn-reset { margin-left: auto; }
.link-btn { padding: 0 4px; border: 0; background: none; text-decoration: underline; }

.empty-tip {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- 8. 移动端抽屉 ---------- */
.hamburger { display: none; flex-direction: column; gap: 4px; }
.hamburger span {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(20, 23, 27, .45);
  animation: fadeIn .2s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  width: min(300px, 82vw);
  height: 100%;
  padding: 16px;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(20, 23, 27, .16);
  animation: slideIn .26s var(--ease);
  overflow-y: auto;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-head .icon-btn { border: 0; background: none; font-size: 26px; }

.search-box--drawer { margin-bottom: 14px; }
.search-box--drawer input { width: 100%; }

.drawer-nav ul { display: flex; flex-direction: column; gap: 2px; }
.drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.drawer-link:hover, .drawer-link.is-active { background: var(--brand-soft); color: var(--brand); }
.drawer-link .n { margin-left: auto; color: var(--text-3); font-size: 12px; }

/* ---------- 9. 页脚 ---------- */
.site-footer {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  padding: 38px clamp(14px, 3vw, 32px) 28px;
}
.footer-brand { display: flex; gap: 12px; align-items: flex-start; max-width: 320px; }
.footer-name { margin: 0; font-size: 16px; font-weight: 700; }
.footer-slogan { margin: 4px 0 0; color: var(--text-3); font-size: 13px; }

.footer-cols { display: flex; flex-wrap: wrap; gap: 40px; margin-left: auto; }
.footer-col h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.footer-col li { margin-bottom: 7px; }
.footer-col a { color: var(--text-2); font-size: 13px; transition: color .2s var(--ease); }
.footer-col a:hover { color: var(--brand); }

/* 页脚微信二维码缩略图：80×80 圆角、hover 完整显示，点击新窗口放大 */
.footer-col li.wechat-qr {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.footer-col li.wechat-qr span { flex: none; line-height: 20px; }
.footer-col li.wechat-qr a {
  display: block;
  width: 88px;
  height: 88px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.footer-col li.wechat-qr a:hover {
  border-color: var(--brand);
  transform: scale(1.04);
}
.footer-col li.wechat-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.footer-bottom { border-top: 1px solid var(--border); }
.footer-bottom p { margin: 0; padding: 16px 0; color: var(--text-3); font-size: 12.5px; text-align: center; }

/* ---------- 10. 返回顶部 ---------- */
.back-to-top {
  position: fixed;
  right: clamp(14px, 3vw, 32px);
  bottom: clamp(14px, 3vw, 32px);
  z-index: 90;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.back-to-top:hover { transform: translateY(-3px); }
.back-to-top svg { width: 17px; height: 17px; fill: currentColor; }

/* ---------- 11. 响应式断点 ----------
 * 设备对照：
 *   ≤360px  iPhone SE(320) / Galaxy Z Fold 外屏
 *   361-414 iPhone XR(414) / 14 Pro Max(430) / 6/7/8 Plus(414)
 *   540-673 Surface Duo 单屏 / Galaxy Z Fold 内屏
 *   720-820 iPad Mini 横屏 / iPad Air 横屏
 *   912     Surface Pro 7 横屏
 *   1024    iPad Pro 竖屏 / Nest Hub / iPad 横屏
 *   1280    Nest Hub Max / Asus Zenbook Fold
 *   ≥1440   大桌面
 *  核心阈值：
 *   ≤900   单列 + 汉堡抽屉
 *   901-1023  单列无侧栏（小型平板/横屏）
 *   ≥1024  两列：左侧栏 + 主内容（iPad Pro 起步）
 *   ≥1280  容器拓宽到 1480px
 *   ≥1440  卡片更宽、字号略增
 */

/* === 大屏 ≥1440：更宽卡片与内边距 === */
@media (min-width: 1440px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
  body { font-size: 15.5px; }
}

/* === 1280-1439（Nest Hub Max / Zenbook Fold）：容器与卡片略宽 === */
@media (min-width: 1280px) and (max-width: 1439px) {
  .container { max-width: 1480px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
}

/* === 1024-1279（iPad Pro 竖屏 / Nest Hub / iPad 横屏）：两列布局 === */
@media (min-width: 1024px) {
  .layout { grid-template-columns: 240px 1fr; }
  .sidebar { padding: 18px 12px 22px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
}

/* === 901-1023（Surface Pro 7 / iPad 横屏临界 / 小型桌面）：单列但更宽敞 === */
@media (min-width: 901px) and (max-width: 1023px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
  .hero-title { font-size: 30px; }
  .hero-sub { font-size: 15px; }
  .hero-stats li { font-size: 13px; }
}

/* === ≤900：单列 + 汉堡按钮（移动端 / 小型竖屏） === */
@media (max-width: 900px) {
  :root { --header-h: 58px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .hamburger { display: flex; }
  .search-box--header { display: none; }
  .search-box--hero { width: 100%; }
  .header-banner { display: none; }
  .hero-stats li { font-size: 12px; padding: 4px 11px; }
  .footer-cols { margin-left: 0; gap: 28px; }
}

/* === 901-1200 收紧侧栏（与 1024 规则并存：1024+ 是 240，901-1023 单列无侧栏） === */
/* 注：旧版 "max-width: 1200" 把 sidebar 缩为 210，但 1024 起需 240。删除旧规则避免冲突。 */

/* === ≤720（iPad Mini 竖屏 / Galaxy Fold 内屏 / Surface Duo）：保持双列卡片但更紧凑 === */
@media (max-width: 720px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
  .hero-title { font-size: 24px; }
  .hero-sub { font-size: 13.5px; }
  .section-title { font-size: 18px; }
  .section-desc { display: none; }
  .footer-cols { gap: 24px; }
  .footer-col li.wechat-qr a { width: 80px; height: 80px; }
}

/* === ≤640：紧凑卡片（小屏手机到 iPhone Mini 竖屏） === */
@media (max-width: 640px) {
  .site-card { padding: 11px; gap: 10px; }
  .card-icon { width: 36px; height: 36px; font-size: 15px; border-radius: 9px; }
  .card-title { font-size: 14px; }
  .card-desc { font-size: 12px; -webkit-line-clamp: 2; }
  .hero { padding: 30px 0 22px; }
  .search-box--hero input { height: 46px; font-size: 14px; }
  .search-kbd { display: none; }
  .footer-inner { gap: 24px; padding-top: 28px; }
  .footer-cols { gap: 20px 28px; }
  .ql-mini { display: flex; flex-direction: row; gap: 12px; }
}

/* === ≤540（Surface Duo 单屏 / Z Fold 内屏临界）：两列紧凑卡片 === */
@media (max-width: 540px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
}

/* === ≤480：两列卡片（中等手机 iPhone Plus / XR / 14 Pro Max） === */
@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 9px; }
  .site-card { flex-direction: row; padding: 10px; gap: 10px; }   /* 保持横向排列，简介更紧凑 */
  .card-desc { -webkit-line-clamp: 2; line-clamp: 2; font-size: 11.5px; }
  .card-icon { width: 32px; height: 32px; font-size: 14px; }
  .hero-stats { gap: 6px 8px; }
  .hero-stats li { font-size: 11.5px; padding: 3px 10px; }
  .footer-col li.wechat-qr a { width: 76px; height: 76px; }
}

/* === ≤400（含 375px iPhone SE / 6/7/8 / X）：极紧凑两列 === */
@media (max-width: 400px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .site-card { padding: 10px; gap: 8px; }
  .card-icon { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }
  .card-desc { -webkit-line-clamp: 3; line-clamp: 3; font-size: 11.5px; }
  .card-arrow { display: none; }
  .logo-text strong { font-size: 15px; }
  .header-inner { gap: 8px; }
  .ql-engine { padding: 6px 9px; font-size: 12px; }
  .ql-go { width: 70px; }
}

/* === ≤360（iPhone 5/SE 320 / Galaxy Z Fold 外屏）：单列卡片 + 超紧凑 header === */
@media (max-width: 360px) {
  :root { --header-h: 52px; }
  .header-inner { gap: 6px; padding: 0 10px; }
  .logo-text strong { font-size: 14px; }
  .logo-mark { width: 32px; height: 32px; font-size: 17px; }
  .hero-title { font-size: 19px; }
  .hero-sub { font-size: 12px; }
  .ql-row { padding: 10px 0; gap: 8px; }
  .ql-engine { padding: 5px 7px; font-size: 11px; }
  .ql-form input { height: 32px; font-size: 13px; padding: 0 8px; }
  .ql-go { width: 56px; height: 32px; font-size: 12px; padding: 0; }
  .ql-go svg { display: none; }
  .ql-tags { gap: 3px 10px; }
  .ql-link { font-size: 12px; }
  .ql-tag-label { font-size: 10px; padding: 1px 6px; }
  .card-grid { grid-template-columns: 1fr; gap: 8px; }
  .site-card { padding: 10px 12px; }
  .site-card .card-body { min-width: 0; }
  .card-arrow { display: none; }
  .footer-col li.wechat-qr a { width: 70px; height: 70px; }
  .footer-col li.wechat-qr img { padding: 0; }
}

/* 无障碍：尊重系统「减少动效」设置 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* 打印：隐藏交互元素 */
@media print {
  .site-header, .drawer, .back-to-top, .hero { display: none; }
  .site-card { break-inside: avoid; box-shadow: none; }
}
