/* === 共享基础层 === */
/* ==========================================================================
   优码仓 · 前台模板共享基础层
   --------------------------------------------------------------------------
   由生成器与各模板 style.css **拼接**：本文件提供结构、组件、响应式与动效，
   模板 style.css 只提供主题变量与调性覆写（皮肤）。

   占位符：#8B5CF6 14px 3

   主题变量契约（模板必须定义，缺失则回落到下方默认值）：
     --bg --bg-soft --panel --panel-2 --line --line-soft
     --text --muted --dim --accent --accent-text --accent-soft
     --shadow-card --shadow-hover
   可选调性变量：
     --radius-sm --font-sans --font-mono --card-lift --hero-align --cover-zoom
   ========================================================================== */

:root {
  /* ---- 主题令牌（模板会覆写，此处为兜底） ---- */
  --radius: 14px;
  --radius-sm: 10px;
  --cols: 3;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow-hover: 0 14px 34px -16px rgba(0, 0, 0, .55);

  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  /* ---- 调性开关 ---- */
  --card-lift: -4px;          /* 卡片 hover 抬升距离 */
  --cover-zoom: 1.05;         /* 封面 hover 缩放倍数 */
  --hero-align: center;       /* Hero 对齐：center | left */
  --dur: .22s;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --topbar-h: 62px;
}

/* ============================ 基础 ============================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

code, kbd, pre, .mono { font-family: var(--font-mono); }

.container { width: min(1200px, 92vw); margin: 0 auto; }

/* 键盘可达性：统一的聚焦环，鼠标点击不显示 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* 跳转锚点目标不要被吸顶栏盖住 */
[id] { scroll-margin-top: calc(var(--topbar-h) + 16px); }

/* ============================ 顶栏 ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--topbar-bg, var(--bg-soft));
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  transition: box-shadow var(--dur) var(--ease);
}
.topbar.is-scrolled { box-shadow: 0 8px 26px -18px rgba(0, 0, 0, .8); }

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: var(--topbar-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px -4px var(--accent);
}

.nav-links { display: flex; gap: 20px; font-size: 14px; color: var(--muted); }
.nav-links a { position: relative; padding: 4px 0; transition: color var(--dur) var(--ease); }
.nav-links a::after {
  content: '';
  position: absolute; left: 0; right: 100%; bottom: 0;
  height: 2px; border-radius: 2px; background: var(--accent);
  transition: right var(--dur) var(--ease);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { right: 0; }

.topbar-search { flex: 1 1 320px; max-width: 400px; position: relative; }
.topbar-search input {
  width: 100%; height: 38px;
  padding: 0 52px 0 38px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.topbar-search input::placeholder { color: var(--dim); }
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.topbar-search::before {
  content: '';
  position: absolute; left: 14px; top: 50%;
  width: 13px; height: 13px; margin-top: -7px;
  border: 1.6px solid var(--dim); border-radius: 50%;
  pointer-events: none;
}
.topbar-search::after {
  content: '';
  position: absolute; left: 24px; top: 50%;
  width: 5px; height: 1.6px; margin-top: 3px;
  background: var(--dim); transform: rotate(45deg);
  pointer-events: none;
}
.search-kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  pointer-events: none;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; flex-shrink: 0; }

/* ---- 移动端菜单：基于原生 <details>，不依赖 JS 即可展开 ---- */
.mobile-nav { display: none; position: relative; }
.mobile-nav > details > summary {
  list-style: none;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav > details > summary::-webkit-details-marker { display: none; }
.mobile-nav > details > summary::before {
  content: '';
  width: 16px; height: 1.6px;
  background: var(--text);
  box-shadow: 0 5px 0 var(--text), 0 -5px 0 var(--text);
  border-radius: 2px;
}
.mobile-nav > details[open] > summary { border-color: var(--accent); }

.mobile-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 70;
  width: min(280px, 86vw);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 12px 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}
.mobile-panel a {
  display: block; padding: 10px 6px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted); font-size: 15px;
}
.mobile-panel a:last-of-type { border-bottom: none; }
.mobile-panel a:hover { color: var(--accent); }
.mobile-panel .drawer-title {
  margin: 14px 6px 6px;
  color: var(--dim); font-size: 11px;
  letter-spacing: 1.2px; text-transform: uppercase;
}
.mobile-panel .drawer-actions { display: flex; gap: 10px; margin-top: 14px; }
.mobile-panel .drawer-actions .btn { flex: 1; }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), filter var(--dur) var(--ease),
              border-color var(--dur) var(--ease), color var(--dur) var(--ease),
              background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text, #fff);
  box-shadow: 0 8px 22px -10px var(--accent);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: var(--panel); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ============================ Hero ============================ */
.hero { padding: 64px 0 34px; position: relative; overflow: hidden; }
.hero::before {
  content: '';
  position: absolute; inset: -55% 25% auto -8%;
  height: 560px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 72%);
  pointer-events: none;
}
/* 细网格底纹，纯 CSS，不增加请求 */
.hero::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 0%, transparent 75%);
  opacity: .5;
  pointer-events: none;
}
.hero-inner { position: relative; text-align: var(--hero-align); }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px; border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
  font-family: var(--font-mono);
}
.badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hero-title {
  margin: 22px 0 14px;
  font-size: clamp(30px, 4.4vw, 48px);
  line-height: 1.24;
  letter-spacing: -.6px;
  font-weight: 700;
}
.hero-desc {
  margin: 0 auto 28px;
  max-width: 640px;
  color: var(--muted);
  font-size: 16px;
}
.hero-actions { display: flex; gap: 12px; justify-content: var(--hero-align); flex-wrap: wrap; margin-bottom: 46px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 780px;
  margin: 0 auto;
  box-shadow: var(--shadow-card);
}
.stat {
  background: var(--panel);
  padding: 20px 8px;
  transition: background-color var(--dur) var(--ease);
}
.stat:hover { background: var(--panel-2); }
.stat b { display: block; font-size: 22px; font-family: var(--font-mono); letter-spacing: -.5px; }
.stat span { color: var(--dim); font-size: 13px; }

/* ============================ 通用区块 ============================ */
.section { padding: 34px 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: 21px; letter-spacing: -.2px; }
.section-head p { margin: 4px 0 0; color: var(--dim); font-size: 13px; }
.more { color: var(--muted); font-size: 13px; white-space: nowrap; transition: color var(--dur) var(--ease); }
.more:hover { color: var(--accent); }

/* ============================ 分类入口 ============================ */
.cat-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.cat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
/* hover 时从底部渗出的一层强调色光 */
.cat-card::after {
  content: '';
  position: absolute; inset: auto 0 0 0; height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.cat-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}
.cat-card:hover::after { transform: scaleX(1); }
.cat-icon {
  display: block;
  font-size: 22px;
  color: var(--accent);
  font-family: var(--font-mono);
  line-height: 1;
}
.cat-name { display: block; margin-top: 10px; font-size: 14px; font-weight: 500; }
.cat-count { display: block; color: var(--dim); font-size: 12px; font-family: var(--font-mono); }

/* ============================ 产品网格 · 卡片 ============================ */
.product-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 18px; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(var(--card-lift));
  box-shadow: var(--shadow-hover);
}

.card-cover {
  position: relative;
  display: block;
  height: 158px;
  overflow: hidden;
  background: var(--panel-2);
}
.card-cover img,
.card-cover .cover-art {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .42s var(--ease);
}
.card:hover .card-cover img,
.card:hover .card-cover .cover-art { transform: scale(var(--cover-zoom)); }

/* 无图时的生成式封面：渐变 + 斜纹 + 角标 + 底部压暗 */
.card-cover.is-placeholder .cover-art {
  display: grid;
  place-items: center;
  position: relative;
}
.cover-mark {
  position: relative;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.cover-mark.big { font-size: 58px; }
.card-cover.is-placeholder::after {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.07) 0 1px, transparent 1px 11px),
    linear-gradient(to top, rgba(0,0,0,.45), transparent 62%);
  pointer-events: none;
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 9px;
}
.tag {
  font-size: 12px; padding: 2px 9px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  white-space: nowrap;
}
.tag-tech { background: var(--tag-tech-bg, rgba(128,128,128,.14)); color: var(--muted); }
.tag-tax { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.tag-tax:hover { filter: brightness(1.08); }
.card-sales { color: var(--dim); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; }

.card-title {
  margin: 0 0 7px;
  font-size: 15px; line-height: 1.5; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title a { transition: color var(--dur) var(--ease); }
.card:hover .card-title a { color: var(--accent); }

.card-desc {
  margin: 0 0 14px;
  color: var(--muted); font-size: 13px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: auto;
}
.card-author { color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-price { font-family: var(--font-mono); color: var(--accent); font-weight: 600; white-space: nowrap; }
.card-price.is-free { color: var(--free, #4ADE80); }

/* 评分星级 */
.stars { display: inline-flex; gap: 1px; color: var(--star, #FACC15); letter-spacing: 1px; font-size: 13px; }
.stars .off { color: var(--line); }

/* 空状态 */
.empty {
  grid-column: 1 / -1;
  padding: 54px 20px;
  text-align: center;
  color: var(--dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.empty-mark { display: block; font-size: 30px; margin-bottom: 10px; opacity: .55; }
.empty-hint { display: block; margin-top: 6px; font-size: 13px; color: var(--dim); }
.empty-inline { padding: 14px 0; color: var(--dim); font-size: 14px; }

/* 骨架屏（JS 渲染前的占位） */
.sk {
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--line-soft) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: sk-pan 1.4s ease infinite;
  border-radius: 6px;
}
.sk-line { height: 12px; margin-bottom: 9px; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }
.sk-block { height: 90px; margin-bottom: 14px; }
.sk-cover { height: 158px; border-radius: 0; }
.card.is-loading { min-height: 268px; }
.card.is-loading .card-body { padding-top: 16px; }
.card.is-loading:hover { transform: none; box-shadow: var(--shadow-card); border-color: var(--line-soft); }
@keyframes sk-pan {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ============================ 转化区 ============================ */
.cta { padding: 18px 0 46px; }
.cta-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 22px; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 34px;
  position: relative;
  overflow: hidden;
}
.cta-inner::before {
  content: '';
  position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: var(--accent-soft);
  pointer-events: none;
}
.cta-inner h3 { margin: 0 0 6px; font-size: 19px; }
.cta-inner p { margin: 0; color: var(--muted); font-size: 14px; max-width: 560px; }
.cta-copy { position: relative; }

/* ============================ 面包屑 ============================ */
.breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center;
  padding: 20px 0 8px;
  color: var(--dim); font-size: 13px;
}
.breadcrumb ol { display: contents; }
.breadcrumb .sep { margin: 0 8px; opacity: .6; }
.breadcrumb .cur { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

/* ============================ 列表页 ============================ */
.list-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 14px 0 20px;
}
.list-title { margin: 0 0 6px; font-size: clamp(22px, 3vw, 28px); letter-spacing: -.3px; }
.list-sub { margin: 0; color: var(--muted); font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px; font-size: 13px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-active {
  border-color: var(--accent);
  color: var(--accent-text, #fff);
  background: var(--accent);
}

.list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 12px 0 18px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
}
.list-toolbar .result-count { color: var(--muted); font-size: 13px; }
.list-toolbar .result-count b { color: var(--text); font-family: var(--font-mono); }
.list-sort { display: flex; gap: 8px; flex-wrap: wrap; }

.list-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 26px; align-items: start; }
.filters { position: sticky; top: calc(var(--topbar-h) + 20px); }
.filter-block {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.filter-block h4 { margin: 0 0 12px; font-size: 14px; }
.filter-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; margin: 0 -9px;
  border-radius: 8px;
  color: var(--muted); font-size: 14px;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.filter-item:hover { background: var(--panel-2); color: var(--text); }
.filter-item.is-active { color: var(--accent); background: var(--accent-soft); }
.filter-item .cnt { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
/* 分类树：次级缩进，形成上下级视觉关系 */
.filter-item.tax-lv1 { padding-left: 22px; font-size: 13px; position: relative; }
.filter-item.tax-lv1::before {
  content: ''; position: absolute; left: 10px; top: 50%;
  width: 6px; height: 1px; background: var(--line);
}
.filter-item.tax-lv2 { padding-left: 34px; font-size: 13px; }
.filter-check {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 0; color: var(--muted); font-size: 14px; cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.filter-check:hover { color: var(--text); }
.filter-check input { accent-color: var(--accent); }
.filter-note { color: var(--dim); font-size: 12px; line-height: 1.7; margin: 10px 0 0; }
.filter-note code { color: var(--accent); font-size: 11px; }

/* 分页 */
.pagination { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 32px 0 4px; }
.page-num {
  min-width: 38px; height: 38px; padding: 0 11px;
  display: grid; place-items: center;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.page-num:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.page-num.is-active { border-color: var(--accent); color: var(--accent-text, #fff); background: var(--accent); }
.page-num.is-disabled { opacity: .45; pointer-events: none; }
.page-ellipsis { display: grid; place-items: center; min-width: 24px; color: var(--dim); }

/* ============================ 搜索页 ============================ */
body.page-search .search-head { padding: 30px 0 20px; text-align: center; }
.search-big { display: flex; gap: 10px; max-width: 640px; margin: 0 auto; }
.search-big input {
  flex: 1; height: 50px; padding: 0 18px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text); font-size: 15px; outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-big input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-big button {
  height: 50px; padding: 0 26px;
  border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: var(--accent-text, #fff);
  font-size: 15px; cursor: pointer;
  transition: filter var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.search-big button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.search-tip { color: var(--dim); font-size: 13px; margin: 14px 0 0; }
.search-tip code { color: var(--accent); }
kbd {
  padding: 1px 6px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-bottom-width: 2px;
  font-size: 12px;
}
.search-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 16px 0 20px;
  color: var(--muted); font-size: 14px;
}
.search-tags { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-tags .tag-label { color: var(--dim); font-size: 13px; }

/* ============================ 详情页 ============================ */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 28px; align-items: start; }

.preview-main {
  position: relative;
  aspect-ratio: 16 / 10;
  height: auto;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  display: grid; place-items: center;
}
.preview-main img { width: 100%; height: fit-content; object-fit: cover; }
.preview-main .cover-mark { font-size: 62px; }

/* 画廊：主图与生成式占位层互斥，切换时淡出淡入 */
.preview-main > [hidden] { display: none !important; }
.preview-art {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--panel-2);
}
.preview-art::after {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.07) 0 1px, transparent 1px 12px),
    linear-gradient(to top, rgba(0,0,0,.42), transparent 62%);
  pointer-events: none;
}
.preview-image {
  transition: opacity .3s var(--ease);
}
.preview-image.is-swapping { opacity: .28; }
@media (prefers-reduced-motion: reduce) {
  .preview-image { transition: none; }
}
.preview-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center; gap: 10px;
  color: var(--dim); font-size: 14px;
}

.preview-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumb {
  width: 82px; height: 58px;
  border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  padding: 0;
  line-height: 0;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
  opacity: .72;
}
.thumb img, .thumb .cover-art { width: 100%; height: 100%; object-fit: cover; }
.thumb .cover-art { display: grid; place-items: center; }
.thumb:hover { opacity: 1; transform: translateY(-2px); }
.thumb.is-active { border-color: var(--accent); opacity: 1; }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb.is-placeholder { display: grid; place-items: center; }
.thumb .cover-mark { font-size: 15px; }

.detail-title { margin: 22px 0 10px; font-size: clamp(22px, 2.8vw, 30px); line-height: 1.35; letter-spacing: -.3px; }
.detail-sub { margin: 0 0 14px; color: var(--muted); font-size: 15px; }
.detail-meta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--muted); font-size: 14px;
}
.detail-meta .meta-item { display: inline-flex; align-items: center; gap: 6px; }
.rating { display: inline-flex; align-items: center; gap: 6px; }
.json-flag { color: var(--dim); font-family: var(--font-mono); font-size: 12px; }
.json-flag.is-ok { color: var(--free, #4ADE80); }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 24px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}
.panel-title { margin: 0 0 14px; font-size: 16px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.panel-head .panel-title { margin: 0; }

.markdown { color: var(--muted); font-size: 14.5px; line-height: 1.85; }
.markdown p:first-child { margin-top: 0; }
.markdown p:last-child { margin-bottom: 0; }
.markdown img { border-radius: var(--radius-sm); margin: 8px 0; }
.markdown h3, .markdown h4 { color: var(--text); margin: 20px 0 10px; }
.markdown code {
  background: var(--panel-2); padding: 2px 6px;
  border-radius: 5px; font-size: 13px; color: var(--accent);
}
.markdown pre {
  background: var(--bg-soft); padding: 14px 16px;
  border-radius: var(--radius-sm); overflow-x: auto;
  border: 1px solid var(--line-soft);
}
.markdown pre code { background: none; padding: 0; color: var(--text); }
.markdown blockquote {
  margin: 12px 0; padding: 2px 0 2px 14px;
  border-left: 3px solid var(--accent); color: var(--dim);
}

.file-list { list-style: none; }
.file-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 14px;
}
.file-list li:last-child { border-bottom: none; }
.file-ext {
  font-family: var(--font-mono); font-size: 11px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  text-transform: uppercase; flex-shrink: 0;
}
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--dim); font-family: var(--font-mono); font-size: 13px; flex-shrink: 0; }

.detail-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
.buy-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.price-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.price-now { font-size: 30px; font-family: var(--font-mono); color: var(--accent); font-weight: 700; letter-spacing: -.5px; }
.price-origin { color: var(--dim); text-decoration: line-through; font-size: 14px; }
.price-off {
  font-size: 12px; padding: 2px 8px; border-radius: 6px;
  background: rgba(248, 113, 113, .14); color: var(--danger, #F87171);
}
.license { display: block; margin-bottom: 14px; }
.license-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; margin-bottom: 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.license-item:hover { border-color: var(--accent); }
.license-item.is-active { border-color: var(--accent); background: var(--accent-soft); }
.license-item input { accent-color: var(--accent); }
.license-name { flex: 1; min-width: 0; }
.license-price { font-family: var(--font-mono); color: var(--accent); }
.buy-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.buy-actions .btn-primary { grid-column: 1 / -1; }
.buy-note { color: var(--dim); font-size: 12px; margin: 14px 0 0; line-height: 1.7; }
.buy-note code { color: var(--accent); }

.author-card {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.author-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; flex-shrink: 0;
}
.author-name { font-weight: 600; font-size: 15px; }
.author-desc { display: block; color: var(--dim); font-size: 12px; }
.include-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 2; }

/* 相关推荐 */
.related { margin-top: 40px; }

/* ============================ 滚动渐显 ============================ */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}

/* ============================ 页脚 ============================ */
.footer {
  margin-top: 54px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-soft);
  padding: 44px 0 26px;
}
.footer-inner { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 30px; }
/* 后台配置了联系方式时，页脚多一列「联系我们」 */
.footer-inner.has-contact { grid-template-columns: 2fr repeat(4, 1fr); }
.footer-brand p { color: var(--dim); font-size: 13px; margin: 12px 0 0; max-width: 300px; line-height: 1.8; }
.footer-tpl {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
}
.footer-col h5 { margin: 0 0 12px; font-size: 14px; }
.footer-col a {
  display: block; color: var(--dim); font-size: 13px; padding: 4px 0;
  transition: color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.footer-col a:hover { color: var(--accent); transform: translateX(2px); }
.footer-bottom {
  margin-top: 30px; padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  color: var(--dim); font-size: 13px; text-align: center;
}

/* ============================ 联系方式 ============================ */
/* 页脚与详情页右侧共用 _shared/pages/partials/contact.php */
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.contact-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  transition: border-color var(--dur) var(--ease);
}
.contact-item:hover { border-color: var(--accent-ring); }
.contact-icon {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.contact-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.contact-main b { font-size: 11px; font-weight: 500; color: var(--dim); letter-spacing: .04em; }
.contact-value {
  font-family: var(--font-mono); font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.contact-value { text-decoration: none; }
a.contact-value:hover { color: var(--accent); }
/* 无 JS 时复制按钮无意义，默认隐藏 */
.contact-copy {
  display: none; flex-shrink: 0;
  padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--dim);
  font-family: inherit; font-size: 11px; cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.js .contact-copy { display: inline-block; }
.contact-copy:hover { color: var(--accent); border-color: var(--accent); }
.contact-copy.is-done { color: var(--accent); border-color: var(--accent); }
.contact-qr { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.contact-qr img {
  width: 84px; height: 84px; padding: 4px;
  object-fit: contain; background: #fff;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
}
.contact-qr-tip { color: var(--dim); font-size: 12px; line-height: 1.6; }
.contact-note { margin: 10px 0 0; color: var(--dim); font-size: 12px; line-height: 1.7; }
.contact-card .contact-list { margin-top: 2px; }

/* 页脚变体：融入 footer-col 的纯链接列表观感 */
.footer .contact-list { gap: 8px; }
.footer .contact-item { background: none; border-color: transparent; padding: 0; gap: 8px; }
.footer .contact-item:hover { border-color: transparent; }
.footer .contact-main b { display: none; }
.footer .contact-value { font-size: 13px; }
.footer .contact-qr { margin-top: 10px; }
.footer .contact-qr img { width: 68px; height: 68px; }

/* ============================ 响应式 ============================ */
@media (max-width: 1080px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 920px) {
  /* 顶栏折叠：隐藏导航与次要操作，改用原生 details 菜单 */
  .mobile-nav { display: block; margin-left: auto; }
  .topbar-search { flex: 1 1 auto; max-width: none; }
  .topbar-actions { margin-left: 0; }
  .search-kbd { display: none; }
  .nav-links,
  .topbar-actions { display: none; }

  .list-layout, .detail-layout { grid-template-columns: 1fr; }
  .filters, .detail-side { position: static; }
  .hero { padding: 44px 0 24px; }
  .hero-title { font-size: clamp(26px, 6vw, 34px); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; gap: 24px; }
  .detail-title { font-size: 24px; }
}

@media (max-width: 640px) {
  .container { width: 94vw; }
  .product-grid { grid-template-columns: 1fr; gap: 14px; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-actions .btn { flex: 1 1 auto; }
  .cta-inner { padding: 24px 20px; }
  .cta-inner .btn { width: 100%; }
  .stats { max-width: none; }
  .search-meta { flex-direction: column; align-items: flex-start; gap: 10px; }
  .preview-main { aspect-ratio: 4 / 3; }
  .buy-actions { grid-template-columns: 1fr; }
  .list-toolbar { flex-direction: column; align-items: flex-start; }
  .footer-inner { grid-template-columns: 1fr; }
  .topbar-actions { gap: 8px; }
  .detail-side { top: 0; }
  .pagination .page-num { min-width: 34px; height: 34px; font-size: 13px; }
}

/* ============================ 无障碍与降级 ============================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .topbar, .footer, .topbar-search, .cta, .pagination, .filters, .detail-side { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .panel { border-color: #ddd; box-shadow: none; break-inside: avoid; }
}


/* === 皮肤层：极简白卡片 === */
/* ==========================================================================
   模板 B · 极简白卡（Minimal Light）
   --------------------------------------------------------------------------
   明亮、透气、大圆角，靠浅灰背景与白色卡片做层次，强调色点到为止。
   占位符：#8B5CF6 rgba(139, 92, 246, 0.14) rgba(139, 92, 246, 0.3) #6140AC #FFFFFF 14px 3
   ========================================================================== */

:root {
  /* 底色与层次 */
  --bg: #F7F7F8;
  --bg-soft: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #FAFAFA;
  --line: #E4E4E7;
  --line-soft: #EDEDF0;

  /* 文字 */
  --text: #18181B;
  --muted: #52525B;
  --dim: #8B8B94;

  /* 强调 */
  --accent: #8B5CF6;
  --accent-text: #FFFFFF;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-ring: rgba(139, 92, 246, 0.3);
  --accent-deep: #6140AC;

  /* 语义色 */
  --free: #16A34A;
  --danger: #DC2626;
  --star: #F59E0B;
  --tag-tech-bg: rgba(0, 0, 0, .05);

  /* 形状：比默认更大一圈，强调圆润 */
  --radius: 14px;
  --radius-sm: 12px;
  --cols: 3;

  /* 字体 */
  --font-sans: 'Noto Sans SC', -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;

  /* 阴影：柔和、扩散，模拟纸感 */
  --shadow-card: 0 1px 3px rgba(24, 24, 27, .06), 0 1px 2px rgba(24, 24, 27, .04);
  --shadow-hover: 0 16px 32px -14px rgba(24, 24, 27, .18);

  /* 调性 */
  --topbar-bg: rgba(255, 255, 255, .85);
  --card-lift: -3px;
  --cover-zoom: 1.04;
  --hero-align: center;
}

/* ---- 差异化装饰 ---- */
body { letter-spacing: .1px; }

.topbar { border-bottom-color: var(--line); }

.logo-mark {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 6px 14px -6px var(--accent-ring);
}

/* Hero 在浅色下改用居中的柔和色晕，避免脏 */
.hero::before {
  inset: -60% 20% auto -6%;
  height: 520px;
  background: radial-gradient(closest-side, var(--accent-ring), transparent 70%);
  opacity: .55;
}
.hero::after { opacity: .32; }

.hero-title { background: none; -webkit-text-fill-color: var(--text); }

/* 卡片：白卡 + 淡描边，hover 抬起 */
.card { border-color: var(--line); }
.card:hover { border-color: var(--accent-ring); }

.stat { background: var(--panel); }
.stat:hover { background: var(--panel-2); }

.cat-card { border-color: var(--line); }
.filter-block, .buy-panel, .author-card { border-color: var(--line); }

/* 输入控件 */
.topbar-search input,
.search-big input {
  background: #fff;
  border-color: var(--line);
}
.topbar-search input::before { border-color: var(--dim); }

.cta-inner {
  background: linear-gradient(120deg, #FFFFFF, #FAFAFB);
  border-color: var(--line);
}

/* 页脚留白更舒展 */
.footer { background: var(--bg); padding: 52px 0 28px; }
.footer-brand p { max-width: 320px; }

