/*
 * layout.css —— 项目自定义布局 / 组件样式 / 断点（任务 T010/T016/T018/T020/T021/T022/T039）
 *
 * 断点口径（站点规范冻结参数，plan 边界约束 8；与 Bootstrap 内置档位叠加不冲突）：
 *   @media (max-width: 767.98px) → 侧边栏转移动端导航形式（FR-M01S02FR05）
 *   @media (max-width: 999.98px) → 版块排布切换 + 广告容器纵向排布（FR-M01S02FR06）
 *   两段规则各自独立生效；768–1000px 区间仅 999.98 段生效。
 *   1000px 非 Bootstrap 内置断点，必须自定义媒体查询（禁止以内置档位凑数）。
 *
 * 锚点定位（NFR-PERF-003）：CSS scroll-behavior: smooth 兜底 + scroll-margin-top
 * 预留顶栏高度；JS 侧 scrollIntoView smooth 见 catalog/static/catalog/js/lazy-mount.js。
 */

/* ===== 基础骨架 ===== */
html {
  scroll-behavior: smooth;
}
body {
  background: var(--mp-bg);
  color: var(--mp-text);
  font-family: "MiSans", "PingFang SC", "HarmonyOS Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-width: 320px; /* 极小视口下限：不破版 */
}
.mp-header {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: var(--mp-header-h);
  padding: 8px 16px;
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-border);
}
.mp-site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--mp-primary);
  text-decoration: none;
  white-space: nowrap;
}
.mp-search-form {
  display: flex;
  gap: 8px;
  flex: 1 1 auto;
  max-width: 460px;
}
.mp-theme-toggle {
  border: 1px solid var(--mp-border);
  background: var(--mp-surface);
  color: var(--mp-text);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.875rem;
  white-space: nowrap;
}
.mp-theme-toggle:hover {
  border-color: var(--mp-primary);
  color: var(--mp-primary);
}
.mp-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}
.mp-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  color: var(--mp-text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ===== 侧边栏分类树（固定宽度，桌面态 sticky） ===== */
.mp-sidebar {
  flex: 0 0 var(--mp-sidebar-w);
  width: var(--mp-sidebar-w);
  position: sticky;
  top: calc(var(--mp-header-h) + 12px);
  max-height: calc(100vh - var(--mp-header-h) - 24px);
  overflow: auto;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 12px;
}
.mp-cat-tree,
.mp-cat-subs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mp-cat-top + .mp-cat-top {
  border-top: 1px solid var(--mp-border);
  margin-top: 6px;
  padding-top: 6px;
}
.mp-cat-top-link {
  display: block;
  font-weight: 600;
  color: var(--mp-text);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 6px;
}
.mp-cat-top-link:hover {
  color: var(--mp-primary);
  background: var(--mp-primary-soft);
}
.mp-cat-subs {
  margin: 2px 0 4px;
  padding-left: 12px;
}
.mp-cat-sub-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--mp-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 3px 6px;
  border-radius: 6px;
}
.mp-cat-sub-link:hover {
  color: var(--mp-primary);
  background: var(--mp-primary-soft);
}
.mp-cat-count {
  flex: 0 0 auto;
  min-width: 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--mp-primary);
  background: var(--mp-primary-soft);
  border-radius: 999px;
  padding: 0 6px;
}

/* ===== 主内容区一级分区 ===== */
.mp-main {
  flex: 1 1 auto;
  min-width: 0; /* 栅格下限约束：不横向溢出 */
}
.mp-top-section {
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  scroll-margin-top: calc(var(--mp-header-h) + 12px); /* 锚点定位预留顶栏 */
}
.mp-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 4px solid var(--mp-primary);
}

/* ===== 折叠面板（DC-1 骨架；展开/懒挂载状态样式） ===== */
.mp-sub-panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--mp-border);
  scroll-margin-top: calc(var(--mp-header-h) + 12px); /* 锚点定位预留顶栏 */
}
.mp-sub-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--mp-border);
  background: var(--mp-bg);
  color: var(--mp-text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.95rem;
}
.mp-sub-toggle:hover {
  border-color: var(--mp-primary);
  color: var(--mp-primary);
}
.mp-sub-toggle[aria-expanded="true"] {
  border-color: var(--mp-primary);
  color: var(--mp-primary);
}
.mp-count-badge {
  min-width: 20px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--mp-primary-contrast);
  background: var(--mp-primary);
  border-radius: 999px;
  padding: 0 7px;
}
.mp-sub-arrow {
  font-size: 0.8em;
  transition: transform 0.15s ease;
}
.mp-sub-toggle[aria-expanded="true"] .mp-sub-arrow {
  transform: rotate(180deg);
}
.mp-sub-cards {
  margin-top: 10px;
}
.mp-sub-loading,
.mp-sub-empty {
  color: var(--mp-text-muted);
  font-size: 0.9rem;
  padding: 8px 2px;
}

/* ===== 卡片（浏览/搜索共用 partial，零分叉） ===== */
.mp-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 12px;
}
.mp-card {
  position: relative;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);   /* CHG-2026-003 DC-UI-1 设计系统圆角 */
  min-width: 0;
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
}
.mp-card:hover {
  border-color: var(--brand-500);            /* 悬停主色高亮（令牌消费点） */
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);               /* CHG-2026-003 UI-F05 悬停浮起 */
}
.mp-card:hover .mp-card-icon { transform: scale(1.05); }
.mp-card-icon { transition: transform var(--dur-base) var(--ease-out); }
/* CHG-2026-003 UI-F06：「荐」标（is_recommended 视觉升级；推广徽标数据面移出） */
.mp-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #92400e;
  background: var(--accent-100);
  border: 1px solid var(--accent-500);
  border-radius: var(--radius-full);
  line-height: 1.5;
}
[data-bs-theme="dark"] .mp-card-badge {
  color: #ffedd5;
  background: rgba(249, 115, 22, 0.18);
  border-color: var(--accent-500);
}
.mp-card-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 12px;
  color: var(--mp-text);
  text-decoration: none;
}
.mp-card-icon {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mp-primary);
  color: var(--mp-primary-contrast);
  font-size: 20px;
  font-weight: 600;
}
.mp-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* DC-2 图标回退：img 加载失败 → 隐藏图片、以 data-char 首字占位（与服务端占位块同形） */
.mp-card-icon.mp-icon-failed::before {
  content: attr(data-char);
}
.mp-card-icon.mp-icon-failed img {
  display: none;
}
.mp-card-icon-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.mp-card-title {
  color: var(--card-link-color, var(--mp-link-color)); /* FR-M01S03FR09 链接色令牌 */
  font-weight: 600;
  word-break: break-word;
}
.mp-card-desc {
  color: var(--mp-text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  word-break: break-word;
}
.mp-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
}
.mp-tag {
  font-size: 0.72rem;
  color: var(--mp-primary);
  border: 1px solid var(--mp-primary);
  border-radius: 999px;
  padding: 0 8px;
  line-height: 18px;
  white-space: nowrap;
}

/* ===== 广告版块容器（FR-M01S02FR06 结构就绪；SL01 数据恒空不渲染） ===== */
.mp-ad-container {
  border: 1px dashed var(--mp-border);
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

/* ===== 加载遮罩（T021：head 内联脚本注入，DOMContentLoaded 移除） ===== */
.mp-loading-mask {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mp-bg);
  color: var(--mp-text-muted);
  font-size: 1rem;
  letter-spacing: 2px;
}

/* ===== 搜索页（结果 / 无结果 / 引导三分支共用容器） ===== */
.mp-search-page {
  max-width: 100%;
}
.mp-page-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 10px;
}
.mp-search-guide,
.mp-search-results,
.mp-search-empty {
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  width: 100%;
}
.mp-search-hint {
  color: var(--mp-text-muted);
}
.mp-search-guide-form,
.mp-empty-search {
  display: flex;
  gap: 8px;
  max-width: 460px;
  margin: 10px 0 16px;
}
.mp-result-count {
  color: var(--mp-text-muted);
  margin-bottom: 10px;
}
.mp-filter-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--mp-border);
  border-radius: 8px;
  margin-bottom: 12px;
}
.mp-filter-label {
  font-size: 0.9rem;
  color: var(--mp-text-muted);
}
.mp-filter-form select {
  max-width: 240px;
}
.mp-filter-clear {
  color: var(--mp-primary);
  text-decoration: none;
  font-size: 0.9rem;
}
.mp-pagination {
  margin-top: 14px;
}
.mp-pagination .page-link {
  color: var(--mp-primary);
  background: var(--mp-surface);
  border-color: var(--mp-border);
}
.mp-pagination .page-item.active .page-link,
.mp-pagination .page-item.disabled .page-link {
  color: var(--mp-text-muted);
}
.mp-pagination .page-item.active .page-link {
  background: var(--mp-primary);
  border-color: var(--mp-primary);
  color: var(--mp-primary-contrast);
}
.mp-empty-actions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}

/* ===== 零状态引导（T039，home/search 共用 include） ===== */
.mp-empty-state {
  text-align: center;
  padding: 48px 16px;
  border: 1px dashed var(--mp-border);
  border-radius: 10px;
  background: var(--mp-surface);
}
.mp-empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.mp-empty-text {
  color: var(--mp-text-muted);
  margin-bottom: 4px;
}
.mp-empty-search {
  margin: 14px auto 0;
  justify-content: center;
}

/* ===== 错误页（T022：404/500 友好页共用） ===== */
.mp-body-error {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}
.mp-error-page {
  max-width: 560px;
  width: 100%;
  text-align: center;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: 12px;
  padding: 40px 24px;
}
.mp-error-code {
  font-size: 3rem;
  font-weight: 700;
  color: var(--mp-primary);
  line-height: 1;
  margin: 0 0 12px;
}
.mp-error-page a {
  color: var(--mp-primary);
}

/* ===== 断点一：<768px 侧边栏转移动端导航形式（FR-M01S02FR05） ===== */
@media (max-width: 767.98px) {
  .mp-header {
    row-gap: 8px;
  }
  .mp-search-form {
    flex-basis: 100%;
    max-width: none;
  }
  .mp-layout {
    flex-direction: column;
    padding: 12px;
  }
  /* 侧边栏 → 顶置块状导航：分类导航完整可达（不硬套 Bootstrap 组件类） */
  .mp-sidebar {
    position: static;
    flex: 1 1 auto;
    width: 100%;
    max-height: none;
    overflow: visible;
  }
  .mp-cat-subs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding-left: 6px;
  }
}

/* ===== 断点二：<1000px 版块排布切换 + 广告容器纵向排布（FR-M01S02FR06） ===== */
@media (max-width: 999.98px) {
  .mp-ad-container {
    width: 100%; /* 广告容器纵向排布（SL04 接入生效） */
  }
  .mp-card-list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); /* 版块内卡片换排 */
  }
}


/* ============================================================
 * CHG-2026-003 UI-F07/08/09 —— 搜索联想 + Ctrl+K 命令面板样式
 * 纯前端（CSS Variables 双主题；零依赖）
 * ============================================================ */
.mp-search-wrap { position: relative; }
.mp-search-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  max-height: 320px;
  overflow-y: auto;
}
.mp-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--mp-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: 0.9rem;
}
.mp-search-item.is-active,
.mp-search-item:hover { background: var(--mp-primary-soft); }
.mp-search-item mark { background: var(--accent-100); color: inherit; padding: 0 1px; border-radius: 2px; }
[data-bs-theme="dark"] .mp-search-item mark { background: rgba(249, 115, 22, 0.35); }
.mp-search-item-cat { font-size: 0.75rem; color: var(--mp-text-muted); flex: 0 0 auto; }
.mp-search-empty { padding: 10px 12px; font-size: 0.85rem; color: var(--mp-text-muted); }

/* 命令面板（Ctrl+K） */
.mp-command-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(0, 0, 0, 0.4);
}
.mp-command-panel.is-open { display: flex; }
.mp-command-box {
  width: min(640px, 92vw);
  background: var(--mp-surface);
  border: 1px solid var(--mp-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.mp-command-input {
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--mp-border);
  background: transparent;
  color: var(--mp-text);
  font-size: 1rem;
  outline: none;
}
.mp-command-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.mp-command-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--mp-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-size: 0.92rem;
}
.mp-command-item.is-active,
.mp-command-item:hover {
  background: var(--mp-primary-soft);
  box-shadow: inset 2px 0 0 var(--brand-600);   /* 选中项品牌色指示条 */
}
[data-bs-theme="dark"] .mp-command-item.is-active,
[data-bs-theme="dark"] .mp-command-item:hover { box-shadow: inset 2px 0 0 var(--brand-500); }
.mp-command-item-cat { font-size: 0.75rem; color: var(--mp-text-muted); flex: 0 0 auto; }
.mp-command-hint, .mp-command-empty { padding: 14px; font-size: 0.85rem; color: var(--mp-text-muted); }

@media (prefers-reduced-motion: reduce) {
  .mp-card { transition: none; }
  .mp-card:hover { transform: none; }
}


/* ============================================================
 * CHG-2026-003 首页布局重构 —— 对齐 bgrdh-redesign 高保真原型
 * （Topbar / Hero / 我的常用 / 今日精选 / 板块卡片流 / 命令面板）
 * 纯 CSS Variables，零依赖；数据冻结（仅展示层）
 * ============================================================ */
.wrap { max-width: 1200px; margin: 0 auto; padding: 28px 24px 0; }

/* ===== 顶栏 ===== */
.topbar { position: sticky; top: 0; z-index: 100; background: color-mix(in srgb, var(--bg-page) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text-1); text-decoration: none; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; font-weight: 700; }
.search-trigger { flex: 1; max-width: 460px; margin-left: auto; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; color: var(--text-3); font-size: 13px; cursor: pointer; transition: all .12s var(--ease-out); font-family: inherit; }
.search-trigger:hover { border-color: var(--brand-500); box-shadow: var(--shadow-sm); }
.kbd { margin-left: auto; font-family: ui-monospace, monospace; font-size: 11px; padding: 2px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg-subtle); color: var(--text-2); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card); cursor: pointer; font-size: 15px; transition: all .12s var(--ease-out); flex: none; }
.icon-btn:hover { border-color: var(--brand-500); transform: translateY(-1px); }

/* ===== Hero ===== */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 10px; color: var(--text-1); }
.hero .sub { color: var(--text-2); font-size: 14px; margin-bottom: 32px; }
.big-search { display: flex; align-items: center; gap: 12px; max-width: 600px; margin: 0 auto; height: 58px; padding: 0 22px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; font-size: 15px; color: var(--text-3); box-shadow: var(--shadow-sm); cursor: pointer; transition: all .2s var(--ease-out); }
.big-search:hover { border-color: var(--brand-500); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.hot-words { margin-top: 22px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.chip { font-size: 12px; color: var(--text-2); background: var(--bg-subtle); border-radius: 999px; padding: 6px 14px; cursor: pointer; transition: all .12s; border: 1px solid transparent; font-family: inherit; }
.chip:hover { background: var(--brand-100); color: var(--brand-700); border-color: var(--brand-500); }

/* ===== 通用区块 ===== */
section.blk { margin-top: 44px; }
.blk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.blk-head h2 { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 9px; color: var(--text-1); margin: 0; }
.blk-head h2 .ico { font-size: 17px; }
.blk-head .more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--brand-600); cursor: pointer; text-decoration: none; white-space: nowrap; padding-right: 2px; }
.blk-head .more:hover { text-decoration: underline; }

/* ===== 我的常用 ===== */
.common-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px; }
.common-item { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 10px; border-radius: var(--radius-md); cursor: pointer; transition: all .12s var(--ease-out); text-decoration: none; }
.common-item:hover { background: var(--bg-card); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.common-item .name { font-size: 12px; color: var(--text-2); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.common-item .sc-logo { width: 44px; height: 44px; }
.common-add { border: 1.5px dashed var(--border); display: flex; align-items: center; justify-content: center; min-height: 86px; color: var(--text-3); font-size: 22px; cursor: pointer; border-radius: var(--radius-md); transition: all .12s; }
.common-add:hover { border-color: var(--brand-500); color: var(--brand-600); background: var(--brand-50); }

/* ===== 今日精选 ===== */
.featured { display: flex; gap: 24px; align-items: center; background: linear-gradient(120deg, var(--brand-600), var(--brand-700) 60%, #1e3a8a); border-radius: var(--radius-lg); padding: 28px 32px; color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-md); cursor: pointer; transition: transform .16s var(--ease-out), box-shadow .16s; text-decoration: none; }
.featured:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.featured::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.featured::before { content: ""; position: absolute; right: 40px; bottom: -80px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .05); }
.f-logo { width: 64px; height: 64px; border-radius: 16px; background: rgba(255, 255, 255, .16); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; flex: none; backdrop-filter: blur(4px); overflow: hidden; }
.f-body { flex: 1; min-width: 0; }
.f-tag { font-size: 11px; letter-spacing: 2px; opacity: .75; margin-bottom: 6px; display: block; }
.f-name { font-size: 20px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.f-desc { font-size: 13px; opacity: .85; max-width: 640px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.f-go { flex: none; background: #fff; color: var(--brand-700); font-weight: 600; font-size: 13px; padding: 10px 22px; border-radius: 10px; transition: all .12s; }
.f-go:hover { transform: translateX(2px); }

/* ===== 板块卡片流 ===== */
.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.site-card { display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; text-decoration: none; transition: all .12s var(--ease-out); position: relative; }
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.site-card:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.site-card > a { color: var(--text-1); text-decoration: none; display: block; }
.sc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.sc-logo { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; color: #fff; flex: none; overflow: hidden; transition: transform .12s var(--ease-out); }
.site-card:hover .sc-logo { transform: scale(1.07); }
.sc-logo img { width: 100%; height: 100%; object-fit: contain; }
.sc-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 5px; min-width: 0; }
.sc-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-ext { color: var(--text-3); font-size: 11px; flex: none; }
.badge-promo { font-size: 11px; font-weight: 600; color: #9a3412; background: var(--accent-100); border-radius: 4px; padding: 1px 5px; flex: none; }
[data-bs-theme="dark"] .badge-promo, [data-theme="dark"] .badge-promo { color: #fdba74; background: #431407; }
.sc-brief { font-size: 12px; color: var(--text-2); margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.sc-meta { font-size: 11px; color: var(--text-3); display: flex; gap: 6px; overflow: hidden; white-space: nowrap; }

/* ===== 命令面板（原型） ===== */
.cmd-mask { position: fixed; inset: 0; background: rgb(15 18 22 / .45); backdrop-filter: blur(2px); z-index: 200; opacity: 0; pointer-events: none; transition: opacity .18s; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 20px 20px; }
.cmd-mask.open { opacity: 1; pointer-events: auto; }
.cmd { width: 100%; max-width: 600px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(-8px) scale(.98); transition: transform .18s var(--ease-out); }
.cmd-mask.open .cmd { transform: none; }
.cmd-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.cmd-input input { flex: 1; border: none; outline: none; background: transparent; color: var(--text-1); font-size: 16px; font-family: inherit; }
.cmd-input input::placeholder { color: var(--text-3); }
.cmd-list { max-height: 46vh; overflow-y: auto; padding: 8px; }
.cmd-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.cmd-item.sel { background: var(--brand-50); box-shadow: inset 2px 0 0 var(--brand-600); }
[data-bs-theme="dark"] .cmd-item.sel, [data-theme="dark"] .cmd-item.sel { background: #1e2a44; }
.ci-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-1); }
.ci-name mark { background: var(--brand-100); color: var(--brand-700); border-radius: 3px; padding: 0 1px; }
[data-bs-theme="dark"] .ci-name mark, [data-theme="dark"] .ci-name mark { background: #312e81; color: #bfdbfe; }
.ci-cat { margin-left: auto; font-size: 11px; color: var(--text-3); flex: none; }
.cmd-empty { padding: 36px 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.cmd-empty b { color: var(--text-1); }
.cmd-hint { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); display: flex; gap: 16px; }
.cmd-hint .kbd { padding: 1px 5px; }

/* ===== 页脚 ===== */
.page-foot { margin-top: 72px; padding: 28px 0; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); text-align: center; }

/* ===== 响应式 ===== */
@media (max-width: 1080px) { .cards { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px) {
  .kbd { display: none; }
  .hero { padding: 36px 0 24px; } .hero h1 { font-size: 24px; }
  .featured { flex-direction: column; text-align: center; padding: 24px; }
  .f-desc { max-width: none; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .common-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* CHG-2026-003 链接色读侧校验消费（link_color_css 过滤器产出 --card-link-color） */
.sc-name { color: var(--card-link-color, var(--text-1)); }

/* ===== 胶囊标签（规范 .pill——分类切换，选中态品牌色实底） ===== */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill { font-size: 13px; padding: 7px 16px; border-radius: 999px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-2); cursor: pointer; transition: all .12s; font-family: inherit; text-decoration: none; }
.pill:hover { border-color: var(--brand-500); color: var(--brand-600); }
.pill.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; font-weight: 600; box-shadow: var(--shadow-sm); }
.pill .cnt { font-size: 11px; opacity: .6; margin-left: 2px; }

/* ===== 分类列表页（05 原型） ===== */
.cate-layout { display: flex; gap: 24px; margin: 20px 0 40px; }
.cate-side { flex: 0 0 200px; position: sticky; top: 80px; align-self: flex-start; }
.cate-side-back { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 14px; text-decoration: none; }
.cate-side-back:hover { color: var(--brand-600); }
.cate-side-link { display: block; font-size: 14px; color: var(--text-1); padding: 7px 10px; border-radius: 8px; text-decoration: none; }
.cate-side-link:hover { background: var(--bg-subtle); }
.cate-side-link.act { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.cate-side-subs { list-style: none; margin: 2px 0 8px; padding-left: 12px; }
.cate-side-subs a { display: block; font-size: 12.5px; color: var(--text-2); padding: 5px 8px; border-radius: 6px; text-decoration: none; }
.cate-side-subs a:hover { color: var(--brand-600); background: var(--bg-subtle); }
.cate-side-count { font-size: 11px; color: var(--text-3); margin-left: 4px; }
.cate-main { flex: 1; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.tb-search { flex: 1; display: flex; }
.tb-search input { width: 100%; height: 38px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-1); font-size: 13px; outline: none; }
.tb-search input:focus { border-color: var(--brand-500); }
.tb-count { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.sort { height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-2); font-size: 12.5px; outline: none; cursor: pointer; }
.seg { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg a { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; font-size: 13px; color: var(--text-2); text-decoration: none; }
.seg a.act { background: var(--brand-600); color: #fff; }
.cards.list-view { grid-template-columns: 1fr; }
.cards.list-view .site-card { display: flex; align-items: center; gap: 14px; }
.cards.list-view .sc-brief { margin-bottom: 0; }
.more-btn { display: block; margin: 28px auto 0; padding: 10px 32px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-card); color: var(--text-2); font-size: 13px; cursor: pointer; text-align: center; text-decoration: none; }
.more-btn:hover { border-color: var(--brand-500); color: var(--brand-600); }
@media (max-width: 768px) { .cate-layout { flex-direction: column; } .cate-side { position: static; flex: none; } }

/* ===== 站点详情页（06 原型） ===== */
.detail-wrap { max-width: 960px; margin: 20px auto 40px; }
.detail-hero { display: flex; gap: 24px; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 32px; margin: 16px 0 24px; }
.detail-logo { width: 64px; height: 64px; font-size: 24px; flex: none; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; color: var(--text-1); }
.detail-desc { color: var(--text-2); font-size: 14px; margin: 0 0 12px; }
.detail-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-tags .pill { cursor: default; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; flex: none; }
.detail-go, .detail-btn { padding: 9px 20px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.detail-go { background: var(--brand-600); color: #fff; border: none; }
.detail-go:hover { background: var(--brand-700); }
.detail-btn { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-2); }
.detail-btn:disabled { opacity: .5; cursor: not-allowed; }
.detail-body { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 28px; margin-bottom: 24px; }
.detail-body h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; color: var(--text-1); }
.detail-content { font-size: 14px; line-height: 1.7; color: var(--text-2); }
@media (max-width: 768px) { .detail-hero { flex-direction: column; } .detail-actions { flex-direction: row; flex-wrap: wrap; } }

/* 卡片"详情"入口（CHG-2026-003 06 详情页可达性） */
.sc-meta { align-items: center; }
.sc-meta-sep { opacity: .5; }


/* 板块标题图标：统一放入柔和圆角底 */
.blk-head h2 .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 15px;
  background: var(--brand-50);
  border-radius: 8px;
  flex: none;
}
[data-bs-theme="dark"] .blk-head h2 .ico, [data-theme="dark"] .blk-head h2 .ico { background: #1e2a44; }

/* 板块区块留白与分隔 */
section.blk { margin-top: 36px; }
.blk-head { margin-bottom: 16px; }
.blk-head h2 { letter-spacing: -.2px; }

/* 胶囊标签行与卡片对齐（pills 下边缘与卡片上边缘留白一致） */
.pills { margin-bottom: 14px; }

/* 卡片查看详情提示（CHG-2026-003 修复：卡片进详情页） */
.sc-go { color: var(--brand-600); font-size: 11px; font-weight: 600; margin-left: auto; }
.site-card:hover .sc-go { text-decoration: underline; }


/* ===== CHG-2026-010 R-01 单动作卡片（整卡 → 站内详情页新标签；取代 CHG-2026-004 双动作） ===== */
.site-card { position: relative; display: flex; flex-direction: column; }
.site-card .sc-main { flex: 1; display: flex; flex-direction: column; color: var(--text-1); text-decoration: none; min-width: 0; }
/* 域名灰字 */
.sc-name .sc-ext { font-size: 10px; color: var(--text-3); flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 90px; }
/* ===== R-06 板块图标色底（--brand-50 → 板块色 8% 透明度由 JS/data-sec 覆盖，此处先通用） ===== */
.blk-head h2 .ico { background: var(--bg-subtle); }

/* ===== R-10 featured 渐变消费 ===== */
.featured { background: var(--featured-grad); }

/* ===== R-13 页脚三列 ===== */
.page-foot { text-align: left; padding: 28px 0; }
.page-foot-in { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.page-foot h4 { font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
.page-foot p, .page-foot a { font-size: 12px; color: var(--text-3); line-height: 1.8; text-decoration: none; }
.page-foot a:hover { color: var(--brand-600); }

/* R-09 侧栏子分类限 10（前 10 显示，其余隐藏，"更多分类"展开） */
.cate-side-subs[data-subs-limit] li:nth-child(n+11) { display: none; }
.cate-side-more { font-size: 12px; color: var(--link-on-card); background: none; border: none; cursor: pointer; padding: 4px 8px; }
.cate-side-more:hover { text-decoration: underline; }

/* ===== R-12 移动端底部 Tab ===== */
.mobile-tabbar { display: none; }
@media (max-width: 768px) {
  .mobile-tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--border);
    z-index: 90; padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  }
  .mobile-tabbar a { flex: 1; text-align: center; font-size: 11px; color: var(--text-2); text-decoration: none; padding: 6px 0; }
  .mobile-tabbar a.act { color: var(--brand-600); }
  .mobile-tabbar .i { font-size: 20px; display: block; margin-bottom: 2px; }
  body { padding-bottom: 64px; }
}

/* ===== R-11 详情页报错表单 ===== */
.report-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 24px; }
.report-panel h3 { font-size: 16px; margin: 0 0 12px; color: var(--text-1); }
.report-panel form { display: flex; flex-direction: column; gap: 10px; }
.report-panel select, .report-panel textarea { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); color: var(--text-1); font-size: 13px; }
.report-panel button { align-self: flex-start; padding: 8px 20px; background: var(--brand-600); color: #fff; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; }
.report-panel button:hover { background: var(--brand-700); }

/* ===== R-20 骨架屏（懒加载/异步内容的占位块） ===== */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-subtle);
  border-radius: 8px;
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: skeleton-shimmer 1.2s infinite;
}
@keyframes skeleton-shimmer { 100% { transform: translateX(100%); } }
[data-bs-theme="dark"] .skeleton::after, [data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
}
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }
/* 命令面板骨架条目 */
.cmd-skeleton { padding: 8px 12px; }
.cmd-skeleton .skeleton { height: 16px; margin-bottom: 8px; }
.cmd-skeleton .skeleton:last-child { width: 60%; margin-bottom: 0; }
/* 卡片网格骨架（懒加载区） */
.skeleton-card { height: 120px; }
.skeleton-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 1080px) { .skeleton-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px) { .skeleton-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== 卡片网格右边界修复（CHG-2026-004 续） =====
 * 问题：右列图标右边缘溢出/参差。根因：grid item 默认 min-width:auto 被长内容撑大、
 *      .sc-logo/.sc-ext 可被挤压、容器用固定 6 列 1fr。
 * 修复：auto-fill minmax + justify-content:start（列自适应不溢出）；
 *      site-card min-width:0（防 grid 被内容撑开）；
 *      .sc-logo 固定 40px flex:0 0 40px；.sc-ext 限宽省略。
 */
.cards {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  justify-content: start;          /* 避免最后一列被推到右侧 */
}
.site-card {
  min-width: 0;                    /* 防止 grid item 被内容撑大 */
  box-sizing: border-box;
  overflow: hidden;
}
.sc-logo {
  width: 40px; height: 40px; flex: 0 0 40px;   /* 固定尺寸，禁止压缩 */
}
.sc-name { min-width: 0; }
.sc-name .nm { min-width: 0; flex: 1 1 auto; }
.sc-ext {
  max-width: 80px; flex: 0 1 auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.site-card .sc-main .sc-brief {
  overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
/* 今日精选 f-name 也不溢出 */
.f-name { min-width: 0; overflow: hidden; }
@media (max-width: 1080px) { .cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); } }
@media (max-width: 768px) { .cards { grid-template-columns: repeat(2, 1fr); } }

/* CHG-2026-006 详情页截图画廊 */
.shot-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.shot-item { display: block; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; transition: all .15s var(--ease-out); }
.shot-item:hover { border-color: var(--brand-500); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.shot-item img { display: block; width: 100%; height: auto; }
@media (max-width: 768px) { .shot-gallery { grid-template-columns: 1fr; } }
