:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --text: #1a1f36;
  --muted: #6b7785;
  --border: #e3e8ef;
  --accent: #5b68f4;
  --accent-hover: #4755e0;
  --accent-2: #7c5ff8;
  --success: #0cbc87;
  --danger: #f04438;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.03);
  --shadow-lg: 0 20px 60px rgba(16, 24, 40, 0.15);
  --ring: 0 0 0 3px rgba(91, 104, 244, 0.25);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

/* 全局兜底：任何带 hidden 属性的元素必须隐藏（防止 display 样式覆盖 hidden） */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 键盘可见焦点环：保证 Tab 导航可见，符合 WCAG 2.4.7 */
.btn:focus-visible,
.cat-chip:focus-visible,
.cat-tab:focus-visible,
.sort-pill:focus-visible,
.page-btn:focus-visible,
.tab:focus-visible,
.fav-btn:focus-visible,
.copy-btn:focus-visible,
.banner-dot:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
.btn, .cat-chip, .cat-tab, .sort-pill, .page-btn, .tab, .fav-btn, .copy-btn, .banner-dot {
  -webkit-tap-highlight-color: transparent;
  /* 分类栏预渲染用 <a>、运行时重渲染用 <button>，浏览器默认给 <a> 加下划线 →
     二者视觉不一致，首屏会「闪一下」下划线。统一置空让两条路径渲染一致。 */
  text-decoration: none;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; text-decoration: none; color: inherit; cursor: pointer; }
.brand:hover .brand-name { color: var(--accent); }
.brand:active { opacity: .85; }
.brand:focus-visible { outline: 2px solid var(--ring, #5b68f4); outline-offset: 3px; border-radius: 10px; }
.brand-mark {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.brand-mark .brand-logo {
  width: 100%; height: 100%;
  display: block;
  border-radius: 12px;
  filter: drop-shadow(0 2px 6px rgba(91, 104, 244, 0.30));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand-sub { font-size: 12px; color: var(--muted); }
.header-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.header-features {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.hf-item {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: #5b21b6;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.22);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.hf-item:nth-child(-n+3) {
  background: linear-gradient(135deg, #6366f1, #9333ea);
  color: #fff;
  border-color: transparent;
}
@media (max-width: 880px) {
  .header-features { display: none; }
}
.quota {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.quota b { color: var(--accent); }

/* Buttons */
.btn {
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  transition: transform 0.06s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.28);
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(99, 102, 241, 0.36); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #d8d9e0; }
.btn-block { width: 100%; padding: 11px; margin-top: 4px; }

/* Layout */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 20px 60px; }
/* 首页轮播 Banner */
.banner-section {
  margin: 0 0 22px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.banner-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1120 / 320;
  height: auto;
  overflow: hidden;
  touch-action: pan-y;
}
.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.35s ease;
  will-change: transform;
}
.banner-slide {
  flex: 0 0 100%;
  height: 100%;
  display: block;
  position: relative;
}
.banner-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
}
.banner-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-size: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  z-index: 2;
}
.banner-viewport:hover .banner-arrow,
.banner-viewport:active .banner-arrow { opacity: 1; }
.banner-arrow:hover { background: #fff; }
.banner-prev { left: 12px; }
.banner-next { right: 12px; }
.banner-dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
}
/* 触摸区与可视圆点分离（2026-10-06 手机适配）：
   按钮本体 30x30 保证手指能点中，可视圆点 8x8 由 ::after 画在中心。
   桌面端原本是 8x8 实体按钮 + active 用 scale 放大，鼠标尚可、
   手指完全点不准，故桌面端同样改用本方案（视觉完全一致）。 */
.banner-dot {
  position: relative;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
}
.banner-dot::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transition: background .2s ease, transform .2s ease;
  pointer-events: none;          /* 避免 ::after 挡住点击 */
}
.banner-dot.active::after {
  background: #fff;
  transform: translate(-50%, -50%) scale(1.25);
}

/* ---------- 分类导航：折叠式分类栏 ---------- */
.cats {
  display: flex;
  flex-direction: column;
  padding: 4px 0 18px;
}

/* 板块行：每个板块自己一块，边界清晰 */
.cats-tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
}
.cat-tab .tab-ico { font-size: 15px; line-height: 1; }
/* 悬停：整块上色（底色 + 边界 + 文字都变主题色） */
.cat-tab:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(91, 104, 244, 0.16);
}
.cat-tab.active,
.cat-tab.active:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.26);
}

/* 展开区：仅在选择板块后出现 */
.cats-sub {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
}
.cat-chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip-row + .cat-chip-row { margin-top: 9px; }
.cat-chip-row-2 {
  margin-left: 6px;
  padding-left: 12px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 28%, var(--border));
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
}
.cat-chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.cat-chip .chip-ico { font-size: 14px; line-height: 1; }
.cat-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 5px 14px rgba(99, 102, 241, 0.26);
}

/* ---------- 顶部 Header 搜索 ---------- */
.header-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-search input {
  width: 140px;
  padding: 7px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-family: inherit;
  transition: width .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.header-search input:focus {
  outline: none;
  width: 180px;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.header-search .btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
}

@media (max-width: 560px) {
  .cats-tabs { gap: 8px; }
  .cat-tab { padding: 8px 14px; font-size: 13px; }
  .cats-sub { margin-top: 12px; padding-top: 11px; }
}

/* Grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

/* 列表工具条：排序 */
.list-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 14px;
}
.sort-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sort-label {
  font-size: 13px;
  color: var(--muted);
  margin-right: 2px;
}
.sort-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s ease;
}
.sort-pill:hover { border-color: #d8d9e0; color: var(--text); }
.sort-pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 24px 0 8px;
}
/* hidden 属性必须生效（display:flex 会覆盖默认隐藏，导致单页分类残留旧分页） */
.pager[hidden] { display: none !important; }
.page-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--muted); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #e3e4ea;
}
.thumb {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.thumb .fallback-emoji {
  font-size: 56px;
  line-height: 1;
  color: #fff;
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-cat {
  display: inline-flex;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(99, 102, 241, 0.08);
  padding: 3px 9px;
  border-radius: 999px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 卡片标题里的 <a> 只作 SEO 可爬内链用，视觉上必须与普通正文一致：
   不继承浏览器默认链接色（紫）与下划线。缺了这条规则，预渲染卡片的标题
   就会露出「紫色+下划线」的默认链接样式（曾经就是这样）。 */
.card-title a,
.card-title a:hover,
.card-title a:visited,
.card-title a:active {
  color: inherit;
  text-decoration: none;
}

/* 信息流广告卡 */
.ad-card {
  border-style: dashed;
  border-color: #e0c3fc;
  background: linear-gradient(180deg, #ffffff, #faf7ff);
}
.ad-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #c4a3ff;
}
.ad-thumb { aspect-ratio: 1 / 1; }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(17, 24, 39, 0.55);
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 1px;
}
.ad-card .card-cat {
  color: #9333ea;
  background: rgba(147, 51, 234, 0.1);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px 20px 40px;
}

.footer .footer-tag { display: block; margin-top: 12px; }

.copyright {
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
}
.copyright summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--text);
  padding: 12px 4px;
  user-select: none;
}
.copyright summary::-webkit-details-marker { display: none; }
.copyright summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  color: var(--accent);
  transition: transform 0.2s ease;
}
.copyright[open] summary::before { transform: rotate(90deg); }
.copyright-body {
  padding: 0 4px 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.copyright-body p { margin: 8px 0; }

.footer-contact {
  max-width: 720px;
  margin: 14px auto 0;
  font-size: 13px;
  color: var(--muted);
}
.footer-contact .link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.footer-contact .link:hover { text-decoration: underline; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(17, 20, 35, 0.45);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border: 1px solid #eceff4;
  border-radius: 20px;
  padding: 26px;
  width: min(440px, calc(100vw - 36px));
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.22);
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  width: 30px; height: 30px; display: grid; place-items: center;
  border: none; background: transparent; border-radius: 50%;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover { color: var(--text); background: var(--bg); }

.res-thumb {
  height: 120px; border-radius: 14px; margin-bottom: 16px;
  display: grid; place-items: center; font-size: 46px; color: #fff;
}
.res-title { margin: 0 0 6px; font-size: 19px; }
.res-desc { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.res-body { display: flex; flex-direction: column; gap: 12px; }
.link-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
}
.link-row .link-text { flex: 1; font-size: 13px; word-break: break-all; color: var(--text); }
.copy-btn {
  flex: 0 0 auto; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 9px;
}
.code-box {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px dashed var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.code-box b { letter-spacing: 2px; font-size: 16px; }
.res-note { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }

/* Auth modal —— 2026-10-10 重设计：品牌头 + 分段控件 + 清晰边框 + SVG 眼睛 */
.modal-auth { width: min(392px, calc(100vw - 36px)); padding: 22px 24px 20px; }

/* 顶行：品牌名 + 关闭按钮（并排，避免 × 压住 tab） */
.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.auth-brand { font-size: 17px; letter-spacing: 0.3px; }
.modal-auth .modal-close { position: static; }

/* 分段控件：浅灰轨道 + 白色激活胶囊，边界清晰、无 1px 边框抖动 */
.tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: #eef1f6; border-radius: 12px; padding: 4px;
}
.tab {
  flex: 1; border: none; cursor: pointer; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 9px 10px; border-radius: 9px; font-family: inherit;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 2px 6px rgba(16, 24, 40, 0.06);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: #4b5563; font-weight: 500; }
.field input {
  width: 100%; background: #fff;
  border: 1.5px solid #d5dbe5; border-radius: 12px;
  padding: 12px 14px; font-size: 14px; line-height: 1.4; color: var(--text);
  outline: none; font-family: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field input::placeholder { color: #9aa4b2; }
.field input:hover { border-color: #c3ccda; }
.field input:focus { border-color: var(--accent); box-shadow: var(--ring); }

/* 密码输入框包装 */
.password-wrapper { position: relative; width: 100%; }
.password-wrapper input { padding-right: 46px !important; }
.password-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0; display: grid; place-items: center;
  background: none; border: none; border-radius: 8px; cursor: pointer;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.password-toggle:hover { color: var(--text); background: var(--bg); }
.password-toggle svg { width: 19px; height: 19px; display: block; }
.password-toggle .ico-eye-off { display: none; }
.password-toggle.revealed .ico-eye { display: none; }
.password-toggle.revealed .ico-eye-off { display: block; }

#authSubmit { padding: 13px 16px; font-size: 15px; font-weight: 700; border-radius: 12px; }
#authSubmit:hover { transform: translateY(-1px); }
#authSubmit:active { transform: translateY(0); }

.form-error { color: var(--danger); font-size: 13px; margin: 2px 0 0; }
.auth-hint { font-size: 12px; line-height: 1.65; color: var(--muted); text-align: center; margin: 18px 0 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: #1c2030; color: #fff; font-size: 14px;
  padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  z-index: 60; animation: pop 0.18s ease;
}
.toast[hidden] { display: none; }
.toast.err { background: var(--danger); }

/* ---------- 资料详情页（闲鱼风） ---------- */
#detailView { max-width: 720px; margin: 0 auto; padding-bottom: 120px; }
.back-btn {
  border: none; background: transparent; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 6px 0; margin: 6px 0 14px; font-family: inherit;
}
.back-btn:hover { color: var(--text); }
.detail-title { margin: 18px 0 8px; font-size: 24px; letter-spacing: -0.01em; }
.detail-meta {
  display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-bottom: 16px;
}
.detail-meta span { display: inline-flex; align-items: center; gap: 4px; }
.section-h {
  font-size: 16px; margin: 0 0 10px; padding-left: 10px;
  border-left: 3px solid var(--accent);
}
.detail-content {
  font-size: 14px; line-height: 1.75; color: #3a3f4f;
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px;
}
.detail-content p { margin: 0 0 10px; }
.detail-content p:last-child { margin-bottom: 0; }
.detail-content img { max-width: 100%; border-radius: 10px; margin: 8px 0; display: block; }
.detail-content ul, .detail-content ol { padding-left: 22px; margin: 8px 0; }
.detail-content li { margin: 4px 0; }
.detail-content a { color: var(--accent); text-decoration: none; }
.detail-content a:hover { text-decoration: underline; }
.detail-content h1, .detail-content h2, .detail-content h3 { margin: 12px 0 8px; }
/* ---------- GEO 答案块（正文最前的客观速览）----------
   给 AI 爬虫一个「可直接摘取」的自包含段落 + 键值列表，
   同时让读者一眼看清这份资料是什么、适不适合自己。
   ⚠️ .detail-content 有 white-space: pre-wrap，故快照 HTML 必须紧凑拼接（不留换行缩进），
      否则会渲染出多余空行。 */
.geo-snapshot {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.geo-snapshot .geo-tldr {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.geo-snapshot .geo-facts {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.85;
  color: var(--muted);
}
.geo-snapshot .geo-facts li { margin: 0; }
.geo-snapshot .geo-facts strong { color: var(--text); font-weight: 600; }
/* 正文内语义小标题（由 content-fix.js 从「【小节名】」升级而来）
   目的：让用户一眼看出分区，同时给 AI/爬虫明确的语义锚点。
   注意 white-space:pre-wrap 会继承，这里用 inline-block 避免多余空行撑高。 */
.detail-content .sec-h {
  font-size: 15px; font-weight: 700; color: #1f2333;
  margin: 18px 0 8px; padding: 0 0 0 10px;
  border-left: 3px solid var(--accent); line-height: 1.5;
}
.detail-content .sec-h:first-child { margin-top: 4px; }
.detail-access { margin-top: 22px; }
.link-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm);
  animation: pop 0.18s ease;
}
.link-box > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.link-row { display: flex; align-items: center; gap: 10px; }
.link-input, .link-textarea {
  flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; font-size: 13px; color: var(--text);
  background: var(--bg); outline: none; font-family: inherit;
}
.link-textarea { resize: vertical; line-height: 1.6; }
.link-input:focus, .link-textarea:focus { border-color: var(--accent); }
.code-line {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  font-size: 14px; color: var(--muted);
}
.code-line b { color: var(--text); letter-spacing: 2px; font-size: 16px; }
.copy-btn.ghost {
  background: transparent; color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* 底部固定获取栏 */
.detail-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 18px; width: min(680px, calc(100vw - 28px));
  display: flex; align-items: center; gap: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 12px 16px;
  box-shadow: var(--shadow-lg); z-index: 30;
}
.detail-bar .btn-primary { flex: 1; padding: 13px; font-size: 15px; }
.bar-quota { font-size: 13px; color: var(--muted); white-space: nowrap; }
.bar-quota b { color: var(--accent); }

/* 卡片收藏按钮（右下角） */
.fav-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 17px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 2;
}
.fav-btn:hover { transform: scale(1.08); background: rgba(0, 0, 0, 0.55); }
.fav-btn.faved { background: var(--accent); color: #fff; }

/* 详情页收藏按钮 */
.fav-toggle {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  color: var(--muted);
}
.fav-toggle.faved { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

/* 我的收藏夹 */
.my-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.my-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }
.my-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.my-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef1ff, #f5f3ff);
}
.my-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-thumb .fallback-emoji { font-size: 30px; }
.my-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.my-title { font-size: 15px; font-weight: 700; color: var(--text); }
.my-desc {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.my-actions { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

/* ============ 移动端适配 ============ */
@media (max-width: 560px) {
  /* 顶栏：缩小、不溢出，适配刘海屏 */
  .header-inner {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
    gap: 10px;
  }
  .brand-mark { width: 34px; height: 34px; }
  .brand-name { font-size: 16px; }
  .brand-sub { display: none; }
  .header-right { gap: 8px; min-width: 0; }

  /* 🔴 header 溢出修复（2026-10-06 手机适配）：
     原来只写了 min-width: 0 —— 那只是允许 flex 子项收缩，但子项内容
     （用户中心 / 登录 两个按钮 + 搜索）本身有 min-content 宽度，
     撑到 385px 宽，比 iPhone 视口 390px 还宽 → 全站横向溢出 133px。
     改用 flex-wrap 兜底换行。 */
  .header-inner { flex-wrap: wrap; row-gap: 8px; }
  .brand { flex: 0 0 auto; }
  /* 右侧按钮组允许换行，绝不撑破视口 */
  .header-right {
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }
  /* 🔴 视觉修复（2026-10-06）：「用户中心」在手机上纯浪费一整行 ——
     未登录时它和「登录/注册」功能重复，登录后它又该隐藏。
     手机上直接**隐藏它**，只保留「登录/注册」：
     登录后出现的是 #userMenu（用户名下拉），功能不丢。 */
  .header-right .btn { flex: 0 0 auto; min-width: 0; padding: 6px 10px; font-size: 12px; }
  /* 品牌名在极窄屏（iPhone SE 320px）下让位给按钮 */
  .brand-name { font-size: 15px; }

  .btn { padding: 8px 12px; font-size: 13px; }
  .quota { padding: 5px 10px; font-size: 12px; }

  /* 搜索框不再整体隐藏 —— 手机上也要能搜。
     改为「🔍 图标按钮」，点击后在下方展开一条全宽搜索栏。
     注意：.header-search 在窄屏虽然只露出 .btn，但那个 btn 必须藏起来 ——
     它是「提交搜索」按钮，移动端走独立图标+ 展开栏，挤在 header 里既占位又会文字竖排。 */
  .header-search { display: none; }
  .header-search.open {
    display: flex;
    width: 100%;
    order: 99;
    gap: 8px;
  }
  .header-search.open input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 38px;
    /* 🔴 16px 是 iOS Safari 的临界值：小于它会自动放大整个页面，
       用户点完输入框发现页面变粗、且要手动缩回去。用 14px 看着小，16px 反而体验好。 */
    font-size: 16px;
  }
  .header-search.open .btn {
    flex: 0 0 auto;
    width: auto;
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    white-space: nowrap;   /* 🔴 不加这句「搜索」会竖排成两行 */
  }

  .container { padding: 18px 14px 48px; }
  .banner-section { margin-bottom: 16px; border-radius: 14px; }
  /* 🔴 视觉修复（2026-10-06）：原来是 height:160px，
     把桌面 aspect-ratio: 1120/320 的比例彻底破坏 —— 390px 宽配160px 高
     变成 2.4:1，banner 图被拉高、文字被切一半，还白吃掉首屏 1/4。
     移动端正确做法是**保留比例**，只调矮一点：
     1120/320 ≈ 3.5:1 → 390px 宽对应 111px 高，正好。 */
  .banner-viewport { aspect-ratio: 1120 / 300; height: auto; }
  /* 🔴 手机端隐藏左右箭头（2026-10-06 第三轮复查）：
     banner 是 1120x300 的大字图，390px 宽下「海量资料·每日更新」这类
     文案正好落在图的中右侧，30px 的白色圆钮直接压住末字（实测「新」被遮）。
     手机端不缺切换能力 —— 已有左右滑动（ontouchstart/ontouchend，阈值 40px）
     + 底部圆点直接点选 + 5s 自动轮播，箭头是冗余的。
     桌面端保留：鼠标 hover 才显影，不挡常态阅读。 */
  .banner-arrow { display: none; }

  /* 排序栏：「排序」标签 + 三个 pill 同行铺满整行 */
  .list-toolbar {
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin: 2px 0 12px;
  }
  .sort-bar { flex: 1 1 auto; width: auto; display: flex; gap: 6px; }
  /* 三pill 均分剩余宽度 —— 填满整行、不留右侧空白、每项 ≥1/5 屏宽好点按 */
  .sort-pill { flex: 1 1 0; text-align: center; min-width: 0; padding: 7px 6px; }
  /* 「排序」二字标签不换行 */
  .list-toolbar > span, .list-toolbar > label {
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
    flex: 0 0 auto;
  }

  /* 卡片网格：🔴 视觉修复（2026-10-06）—— 原为固定两列（175px/卡）。
     手机上两列太窄：标题 14px 只能放 2 行、长标题被截断（实测「需 57px 只有 38px」），
     封面也压成 173x173 看不清。改成**单列 + 横向卡布局**：
     封面在左（约 108px）、文字在右，标题可占3 行不截断，
     且一屏能完整看到 1 张卡的全部信息，不会「信息不全」。 */
  .grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  /* 🔴 flex-direction: row 必须显式写 —— 基础规则 .card{flex-direction:column}
     写在文件更前面（456行），同权重下后写的赢，不写 row 就会被 column 覆盖，
     结果封面在上、文字在下，文字区占满全宽（实测 body宽360 = 卡片全宽）。 */
  .card {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: stretch;
  }
  /* 🔴 高度收口：内容只有 63px（标签 22 + 标题 41），若封面 104px 则卡片
     被撑到 106px、文字区空白率 34% → 视觉松散。
     做法：封面缩到 88px（仍够看清缩略图），
     **且封面不设 aspect-ratio**，高度由 align-self:stretch 跟随内容 →
     卡片高度 = 内容高度，不会出现「内容很少却被封面撑高 + 大片空白」。 */
  .card .thumb {
    width: 88px;
    flex: 0 0 88px;
    /* 🔴 不设 aspect-ratio —— 让高度跟着 stretch 走，卡片高度由内容决定。
       若设 aspect-ratio:1 会强制造出 88x88 的正方形，内容少时必然留白。 */
    min-height: 72px;
    align-self: stretch;   /* 高度跟随卡片内容，不自己撑 */
  }
  .thumb img {
    /* 封面在非正方形盒子里用 cover 裁切，不变形 */
    object-fit: cover;
  }
  /* 文字区：占剩余空间、垂直居中、无多余留白 */
  .card-body {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 0;
    justify-content: center;
    gap: 6px;
  }
  /* 封面小一点，文字就多一点；同时标题给足 3 行上限 */
  .card-title {
    font-size: 14px;
    line-height: 1.45;
    -webkit-line-clamp: 3;
    min-height: 0;
  }
  .card-title {
    font-size: 14px;
    min-height: 0;
    line-height: 1.45;
    /* 手机上放开到 3 行，长标题不再被拦腰截断 */
    -webkit-line-clamp: 3;
  }
  .fav-btn { width: 32px; height: 32px; font-size: 16px; right: 6px; bottom: 6px; }

  /* 详情页 */
  .detail-title { font-size: 20px; line-height: 1.4; }
  .detail-meta { flex-wrap: wrap; gap: 10px; }
  .detail-content { font-size: 15px; padding: 14px; line-height: 1.75; }

  /* 🔴「← 返回列表」在移动端纯浪费一整行（740px 首屏里独占约 50px）。
     手机上 header 已有原生返回手势与浏览器返回键，
     且页面底部就有操作入口 —— 视觉上收成一行小字、把空间还给正文。 */
  .back-btn {
    font-size: 13px;
    padding: 2px 0;
    margin: 0 0 8px;
    display: inline-block;
  }

  /* 底部固定获取栏：移动端换行，获取按钮占满整行；适配底部安全区 */
  .detail-bar {
    width: calc(100vw - 16px);
    left: 50%;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  .detail-bar .btn-primary { flex: 1 1 100%; order: 2; padding: 13px; font-size: 15px; }
  .bar-quota { order: 1; flex: 1 1 auto; }
  #detailView { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }

  .footer { padding: 24px 14px 32px; }

  /* 弹窗在手机上更贴边 */
  .modal-card { padding: 22px 18px; }
  .modal-auth { padding-top: 26px; }
}

/* 触屏设备：放大点按目标，避免误触 */
@media (hover: none) and (pointer: coarse) {
  .cat-chip, .cat-tab, .sort-pill, .page-btn, .copy-btn { min-height: 40px; }
  .tab { padding: 12px; }
  .fav-btn { width: 36px; height: 36px; }
}

/* 尊重用户的减少动态偏好（无障碍） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* ---------- 用户行为轨迹面板 ---------- */
.behavior-detail { margin-top: 16px; background: var(--card, #fff); border: 1px solid var(--border, #e6e8ee); border-radius: 14px; padding: 16px 18px; box-shadow: 0 4px 18px rgba(40,60,120,.06); }
.behavior-detail .bh-head { font-size: 16px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.bh-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .bh-cols { grid-template-columns: 1fr; } }
.bh-col h4 { font-size: 13px; color: var(--muted, #7a8499); margin: 0 0 8px; font-weight: 600; }
.bh-trail, .bh-rec { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.bh-trail li, .bh-rec li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px; font-size: 13px; }
.bh-trail li:nth-child(odd), .bh-rec li:nth-child(odd) { background: rgba(120,130,160,.06); }
.bh-type { flex: 0 0 auto; font-size: 11px; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.type-view { background: #e8f0ff; color: #2b6cff; }
.type-access { background: #e8fff2; color: #1aa179; }
.type-favorite { background: #fff0f5; color: #e0457b; }
.bh-title { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bh-time { flex: 0 0 auto; color: var(--muted, #9aa3b5); font-size: 11px; }
.bh-emoji { flex: 0 0 auto; }
.bh-prefs { margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag.pref { background: #f0f3ff; color: #3a55d6; border: 1px solid #d9e0ff; padding: 3px 9px; border-radius: 999px; font-size: 12px; }
.empty-cell { text-align: center; color: var(--muted, #9aa3b5); padding: 18px; }

/* ---------- 用户下拉菜单 ---------- */
.user-menu { position: relative; }
.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.user-menu-toggle:hover { border-color: #d8d9e0; }
.user-menu-toggle.active { border-color: var(--accent); box-shadow: var(--ring); }
.user-name {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform .2s ease;
}
.user-menu-toggle.active .user-chevron { transform: rotate(180deg); }
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 110px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 30;
}
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.user-menu-item:hover { background: var(--bg); }

/* ---------- 卡片标签（分类 pill + 免费/NEW/热门 同排于信息区首行） ---------- */
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.card-meta .card-cat { align-self: center; }
.card-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  line-height: 1.4;
}
.card-badge.free { background: rgba(16, 185, 129, 0.94); }
.card-badge.new { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.card-badge.hot { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* 后台：开关类复选框字段 */
.field.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.field.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------- 我的页面三 tab ---------- */
.my-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.my-tab {
  flex: 1 1 auto;
  min-width: 100px;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}
.my-tab:hover { border-color: var(--accent); color: var(--accent); }
.my-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.25);
}
.my-time {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-top: 2px;
}
@media (max-width: 560px) {
  .my-tabs { gap: 8px; }
  .my-tab { min-width: 0; padding: 10px 12px; font-size: 13px; }
}



/* =====================================================================
   SEO 预渲染新增样式（P0）
   .breadcrumb / .related-list / .detail-section / .cat-intro
   预渲染页直接输出这些结构，缺样式会掉成裸文本。
   ===================================================================== */

/* 面包屑 */
.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 4px;
  line-height: 1.7;
  word-break: break-word;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--muted); }
.breadcrumb > span:last-child { color: var(--text); }

/* 详情区块（相关资源 / 子分类） */
.detail-section { margin-top: 26px; }
.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.related-list li {
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  line-height: 1.55;
}
.related-list li:last-child { border-bottom: none; }
.related-list a { color: var(--text); text-decoration: none; }
.related-list a:hover { color: var(--accent); text-decoration: underline; }
.muted { color: var(--muted); font-size: 12px; }

/* 首页站点标题（h1 载体）
   —— 首页 hero 板块已按要求移除，视觉上不再占用空间；
   h1 以 sr-only 保留在 DOM 里，只供屏幕阅读器与爬虫读取。
   这是标准做法：h1 是页面主题信号（exactlyOneH1 断言 + SEO 都依赖），
   纯视觉删除不能把语义主标题一起删掉。 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 分类标题区（分类页 h1 载体）
   2026-10-06 两次改版：
     ① 原是带边框+阴影的白卡片，内含子分类列表 —— 与下方 #cats 折叠式导航完全重复；
     ② 分类描述段落也删了 —— 与 meta description 同源，正文再展示属冗余。
   现在是无框简约样式，只剩分类标题（h1）。 */
.cat-intro {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 4px 2px 0;
  margin-bottom: 14px;
}
.cat-intro-title { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.cat-intro .detail-meta { margin: 6px 0 0; }

@media (max-width: 560px) {
  .cat-intro { padding: 2px 2px 0; }
  .cat-intro-title { font-size: 18px; }
}

/* =====================================================================
   手机端适配（2026-10-06）
   目标：iPhone SE(375) ~ iPhone 15 Pro Max(430) 全区间无横向滚动、
   可点区域≥32px（Apple 建议 44）、表单不触发 iOS 自动放大。

   体检数据（iPhone 13 视口 390px，改造前）：
     · 全站 5/6 页横向溢出 +133px，源头是 .header-right 宽 385px
     · .header-search 在 ≤560px 被整体 display:none → 手机上没法搜索
     · .card-badge / .user-chevron 10px 字、banner-dot 15x10 过小
     · 模态框 .modal-card 354px 宽 + 左右 padding 溢出
   ===================================================================== */

@media (max-width: 560px) {
  /* ---------- 全局兜底：任何元素都不许撑破视口 ---------- */
  /* 用 overflow-x: clip 而非 hidden —— hidden 会让 position:sticky 失效 */
  html, body {
    max-width: 100%;
    overflow-x: clip;
  }
  /* 长串英文/URL 在窄屏撑破容器是第二大溢出源 */
  body, p, div, span, td, th, li, h1, h2, h3, h4 {
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  img, video, canvas { max-width: 100%; height: auto; }

  /* ---------- 点击区：触摸设备上放大 ---------- */
  @media (hover: none) and (pointer: coarse) {
    .btn, .cat-tab, .cat-chip, .sort-pill, .tab,
    .back-btn, .banner-arrow, .modal-close, .pager button {
      min-height: 34px;
    }
  }

  /* ---------- 可读性：10-11px 字在手机上不可读 ---------- */
  /* 实测分类页 11px 文字有 29 处、10px 有若干，密度过高。
     统一抬到 12px：够读，且不会把卡片撑破。 */
  .card-badge,
  .user-chevron,
  .hf-item,
  .card-cat,
  .bh-type,
  .bh-time,
  .brand-sub,
  .quota { font-size: 12px; }
  /* 卡片分类标签也要看清 */
  .card-cat { font-size: 12px; }

  /* 面包屑在手机上换行太占高度，压缩成单行可滚动 */
  .breadcrumb {
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    font-size: 12px;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }

  /* ---------- 留白收紧：手机上不必有桌面那么大的间距 ---------- */
  .cats { padding: 2px 0 12px; }
  .list-toolbar { margin: 0 0 10px; }

  /* iOS Safari 对 <16px 的输入框会自动放大页面，加 16px 阻止 */
  input, textarea, select { font-size: 16px; }

  /* ---------- 模态框：底部抽屉化，比居中弹窗更适合单手 ---------- */
  .modal-backdrop { align-items: flex-end; }
  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .tabs { width: 100%; }
  .tab { flex: 1 1 0; }

  /* ---------- 详情页 ---------- */
  #detailView { padding-bottom: 140px; }
  .d-title { font-size: 19px; }
  .related-list li { padding: 9px 0; }
  /* 底部获取栏：留出iPhonehome indicator 安全区 */
  .getbar, .detail-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  /* ---------- 分类导航 ----------
     🔴 视觉修复（2026-10-06）：原来两块都设nowrap+横向滚动，结果
     子分类「高中」右边界 389px > 容器 362px，被切在屏幕外——
     用户必须横向滑动才能看到，而「看不到」等于没有。
     改为：**顶层板块（只有 3 个）横向滚动；子分类换行铺满，一眼看全。**
     （板块栏3 个本来就不溢出，滚动只是兜底；子分类才是必须全显的那个。） */
  .cats-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cats-tabs::-webkit-scrollbar { display: none; }

  .cat-chip-row {
    flex-wrap: wrap;          /* 子分类换行，不藏内容 */
    overflow-x: visible;
    gap: 7px;
  }
  .cat-chip {
    flex: 0 0 auto;
    /* 换行后让 chip 均匀分布，视觉更整齐 */
    padding: 7px 11px;
    font-size: 13px;
  }

  /* ---------- 我的页面 ---------- */
  .my-tabs { overflow-x: auto; scrollbar-width: none; }
  .my-tabs::-webkit-scrollbar { display: none; }

  /* ---------- 表格：允许横向滚动而不是撑破 ---------- */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }
}

/* 超窄屏（iPhone SE 320px / 老安卓） */
@media (max-width: 360px) {
  .header-inner { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .brand-name { font-size: 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .header-right .btn { padding: 6px 9px; font-size: 12px; }
  .container { padding: 14px 10px 44px; }
}

/* 横屏矮屏（如 iPhone 横放）：减少纵向留白，避免必须滚动两次 */
@media (max-width: 900px) and (max-height: 500px) {
  /* 🔴 不能用 height:130px —— 横屏时 banner 宽可达 800px+，配 130px 高
     变成 6:1，与图片自身 1120:300（3.7:1）严重不符，object-fit:cover
     会把上下大片裁掉、图里的文案被切一半（与竖屏箭头遮挡同一类问题）。
     正确做法：限宽居中，让 aspect-ratio 自己算高度。460 → 123px 高。 */
  .banner-section { max-width: 460px; margin-left: auto; margin-right: auto; }
  .banner-viewport { height: auto; }
  .header-inner { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; }
}

/* ---------- 移动端搜索图标按钮（桌面端隐藏） ---------- */
.mobile-search-toggle {
  display: none;              /* 桌面端不显示 */
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  place-items: center;
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .mobile-search-toggle { display: grid; }
}
