:root {
  --brand: #4f6ef7;
  --brand-2: #7c5cfc;
  --brand-grad: linear-gradient(135deg, #4f6ef7, #7c5cfc);
  --brand-soft: #eef1ff;
  --free: #16a34a;
  --free-light: #ecfdf5;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #171e2e;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --border: #e5e7eb;
  --radius: 14px;
  --max: 1080px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* 头部 */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { font-size: 20px; font-weight: 800; color: var(--brand); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow: hidden; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--text-2); font-size: 14px; white-space: nowrap; }
.nav a:hover { background: var(--brand-soft); color: var(--brand); }
.nav-admin { color: var(--text-3) !important; }
.search { display: flex; }
.search input {
  width: 180px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px 0 0 8px; font-size: 14px; outline: none;
}
.search button {
  border: none; background: var(--brand); color: #fff; padding: 0 16px;
  border-radius: 0 8px 8px 0; cursor: pointer; font-size: 14px;
}

/* 内容 */
main { padding: 24px 0 60px; }
.page-title { font-size: 24px; font-weight: 800; margin: 8px 0 20px; }
.page-sub { color: var(--text-3); font-size: 14px; margin: -10px 0 20px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 12px rgba(17,24,39,.05); }

/* Hero */
.hero {
  background: var(--brand-grad);
  color: #fff; border-radius: 16px; padding: 40px; margin-bottom: 24px;
}
.hero h1 { margin: 0 0 8px; font-size: 28px; }
.hero p { margin: 0; opacity: .9; }

/* 热门标签 */
.sec-title { font-size: 18px; font-weight: 800; margin: 0 0 14px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: #fff; padding: 18px; border-radius: var(--radius); box-shadow: 0 2px 12px rgba(17,24,39,.05); margin-bottom: 28px; }
.tag-cloud-chip { font-size: 13px; color: var(--brand); background: var(--brand-soft); border-radius: 16px; padding: 6px 14px; }
.tag-cloud-chip:hover { background: var(--brand); color: #fff; }

/* 区块 */
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 18px; font-weight: 800; }
.section-more { color: var(--text-3); font-size: 13px; }

/* 资源网格：各档设备固定列数，卡片尺寸固定不拉伸 */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.grid > * { min-width: 0; }
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px)  { .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.res-card { display: block !important; width: 100% !important; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 12px rgba(17,24,39,.05); transition: transform .15s; text-decoration: none; color: inherit; box-sizing: border-box; }
.res-card:hover { transform: translateY(-3px); }
.res-cover { display: block !important; width: 100% !important; height: 120px; padding: 14px; color: #fff; font-weight: 700; font-size: 16px; box-sizing: border-box; }
.res-body { display: block !important; width: 100% !important; padding: 14px; box-sizing: border-box; }
.res-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.res-tags { display: flex; flex-wrap: nowrap; overflow: hidden; gap: 6px; margin-bottom: 10px; }
.res-tags .tag { flex-shrink: 0; white-space: nowrap; }
.tag { font-size: 12px; color: var(--brand); background: var(--brand-soft); border-radius: 4px; padding: 2px 8px; text-decoration: none; }
.tag:hover { background: var(--brand); color: #fff; }
.res-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.res-meta .cat { font-weight: 600; }

/* 资源列表（分类/搜索页） */
.list-card { display: flex; align-items: center; background: #fff; border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 2px 12px rgba(17,24,39,.05); }
.list-card .block { width: 56px; height: 56px; border-radius: 12px; color: #fff; font-weight: 700; font-size: 22px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-card .info { flex: 1; margin-left: 16px; min-width: 0; }
.list-card .title { font-weight: 700; margin-bottom: 4px; }
.list-card .meta { font-size: 12px; color: var(--text-3); }
.list-card .views { font-size: 13px; color: var(--text-2); white-space: nowrap; margin-left: 12px; }

/* 详情 */
.detail-hero { background: var(--brand-grad); color: #fff; border-radius: 16px; padding: 32px; margin-bottom: 20px; }
.detail-hero .icon { font-size: 34px; }
.detail-hero h1 { margin: 10px 0 6px; font-size: 26px; }
.detail-hero .cat { opacity: .9; font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 12px rgba(17,24,39,.05); }
.detail-card h2 { font-size: 17px; margin: 0 0 12px; }
.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.meta-cell .label { font-size: 12px; color: var(--text-3); }
.meta-cell .value { font-weight: 700; font-size: 15px; }
.get-card { border: 2px solid var(--brand); }
.copy-btn { width: 100%; margin-top: 12px; background: var(--brand); color: #fff; border: none; padding: 12px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer; }
.tip { color: var(--text-3); font-size: 12px; margin-top: 10px; text-align: center; }

/* 空态 */
.empty { text-align: center; color: var(--text-3); padding: 80px 0; }

/* 底部 */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--text-3); font-size: 13px; text-align: center; background: #fff; }

/* 分类筛选 */
.cats-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.fchip { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; font-size: 14px; color: var(--text-2); }
.fchip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.sort-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sort-row .count { color: var(--text-3); font-size: 13px; }
.sort-links { display: flex; gap: 4px; }
.sort-links a { padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.sort-links a.on { color: var(--brand); background: var(--brand-soft); font-weight: 600; }


/* 领取链接弹层 */
.mask { position: fixed; inset: 0; background: rgba(17,24,39,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--border); }
.modal-close { cursor: pointer; color: var(--text-3); font-size: 18px; }
.modal-body { padding: 16px 20px; }
.link-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.link-item:last-child { margin-bottom: 0; }
.link-info { flex: 1; min-width: 0; }
.link-name { font-weight: 700; font-size: 14px; }
.link-url { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-ops { display: flex; gap: 8px; }
.link-open, .link-copy { border: none; border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; text-decoration: none; }
.link-open { background: var(--brand); color: #fff; }
.link-copy { background: var(--bg); color: var(--text-2); }
.modal-tip { padding: 12px 20px 16px; color: var(--text-3); font-size: 12px; border-top: 1px solid var(--border); }
/* 正文富文本排版 */
.rich-content { color: var(--text-2); font-size: 14px; line-height: 1.8; word-break: break-word; }
.rich-content p { margin: 0 0 12px; }
.rich-content img { max-width: 100%; max-height: 460px; width: auto; border-radius: 8px; margin: 8px auto; display: block; cursor: zoom-in; }
.img-cap { text-align: center; font-size: 12px; color: var(--text-3); margin: -2px 0 12px; }
.rich-content h1,.rich-content h2,.rich-content h3 { color: var(--text); margin: 14px 0 8px; font-size: 16px; }
.rich-content a { color: var(--brand); }
.rich-content ul,.rich-content ol { padding-left: 20px; margin: 0 0 12px; }
.rich-content blockquote { border-left: 3px solid var(--brand-soft); padding: 4px 12px; margin: 0 0 12px; color: var(--text-3); background: var(--bg); border-radius: 4px; }

/* ============ 首页 ============ */

/* Hero：渐变大卡 + 左文案右统计 */
.home-hero {
  position: relative;
  overflow: hidden;
  background: var(--brand-grad);
  color: #fff;
  border-radius: 20px;
  padding: 44px 40px;
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 32px;
  justify-content: space-between;
}
/* 装饰圆 */
.home-hero::before, .home-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.home-hero::before { width: 220px; height: 220px; top: -90px; right: -60px; }
.home-hero::after { width: 140px; height: 140px; bottom: -70px; left: 30%; background: rgba(255,255,255,.07); }
.home-hero-main { position: relative; z-index: 1; }
.home-hero h1 { margin: 0 0 10px; font-size: 30px; font-weight: 800; letter-spacing: .5px; }
.home-hero .hero-slogan { margin: 0 0 18px; font-size: 15px; opacity: .92; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25);
  backdrop-filter: blur(4px);
  border-radius: 999px; padding: 6px 14px;
  font-size: 13px; font-weight: 600;
}
.home-hero-stats {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(6px);
  border-radius: 16px; padding: 18px 22px;
  gap: 24px; flex-shrink: 0;
}
.hh-stat { text-align: center; }
.hh-num { font-size: 24px; font-weight: 800; line-height: 1.2; }
.hh-label { font-size: 12px; opacity: .85; margin-top: 2px; white-space: nowrap; }

/* 分类宫格 */
.home-cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}
.cat-cell {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 18px rgba(79,110,247,.06);
  transition: transform .15s, box-shadow .15s;
}
.cat-cell:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(79,110,247,.13); }
.cat-cell .cell-icon {
  width: 46px; height: 46px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
}
.cat-cell .cell-name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.cat-cell .cell-count { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cat-cell .cell-count b { color: var(--brand); font-weight: 700; }

/* 首页资源卡（封面 = 分类图标，不重复标题） */
.home-card {
  position: relative;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 18px rgba(79,110,247,.06);
  transition: transform .15s, box-shadow .15s;
}
.home-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(79,110,247,.14); }
.home-card .hc-cover {
  flex: none;             /* 封面不参与 flex 收缩，保证同行所有卡片封面高度一致（3:4） */
  height: auto;
  aspect-ratio: 3 / 4;    /* 显示比例 3:4：原图 9:16 由 object-fit:cover 裁去上下留白，卡片更紧凑 */
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; color: #fff;
}
.home-card .hc-free {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; font-weight: 700; color: var(--free);
  background: var(--free-light);
  border-radius: 999px; padding: 3px 10px;
}
.home-card .hc-body { padding: 12px 13px 13px; display: flex; flex-direction: column; flex: 1; }
.home-card .hc-title {
  font-weight: 700; font-size: 14px; line-height: 1.45; color: var(--text);
  margin-bottom: 7px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 41px;
}
.home-card .hc-tags { display: flex; gap: 5px; overflow: hidden; margin-bottom: 8px; }
.home-card .hc-tags .tag { white-space: nowrap; flex-shrink: 0; }
.home-card .hc-meta {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--text-3);
}
.home-card .hc-meta .cat { font-weight: 600; }

/* 热门排行列表 */
.rank-list { background: #fff; border-radius: 16px; box-shadow: 0 4px 18px rgba(79,110,247,.06); overflow: hidden; }
.rank-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); transition: background .12s; }
.rank-item:last-child { border-bottom: none; }
.rank-item:hover { background: var(--brand-soft); }
.rank-item .rk { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rank-item:nth-child(1) .rk { background: var(--brand-grad); color: #fff; }
.rank-item:nth-child(2) .rk { background: var(--brand-grad); color: #fff; opacity: .75; }
.rank-item:nth-child(3) .rk { background: var(--brand-grad); color: #fff; opacity: .55; }
.rank-item .rk-body { flex: 1; min-width: 0; }
.rank-item .rk-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-item .rk-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.rank-item .rk-views { font-size: 12px; color: var(--text-2); white-space: nowrap; }

/* 页脚标签条 */
.home-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 6px 4px 0;
}
.home-tags .ht-label { font-size: 13px; color: var(--text-3); margin-right: 2px; }
.home-tags a { font-size: 13px; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 5px 14px; transition: background .12s, color .12s; }
.home-tags a:hover { background: var(--brand); color: #fff; }

/* 首页响应式 */
@media (max-width: 860px) {
  .home-hero { flex-direction: column; align-items: stretch; padding: 32px 24px; }
  .home-hero-stats { grid-template-columns: repeat(3, 1fr); padding: 14px 16px; gap: 12px; }
  .home-cats { grid-template-columns: repeat(2, 1fr); }
  .home-hero h1 { font-size: 24px; }
}
@media (max-width: 480px) {
  .home-cats { gap: 10px; }
  .cat-cell { padding: 12px 14px; }
  .cat-cell .cell-icon { width: 38px; height: 38px; font-size: 18px; }
}

/* 有图显图 / 无图显图标 */
.hc-cover { padding: 0; position: relative; }
.hc-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.list-card .block-img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex-shrink: 0; }
/* 详情页正文封面图（标题区不用图片做背景） */
.detail-cover { width: 100%; display: block; border-radius: 10px; object-fit: cover; aspect-ratio: 16 / 9; }

/* ============ 整站响应式（手机 / 平板） ============ */
@media (max-width: 640px) {
  .container { padding: 0 14px; }
  main { padding: 16px 0 44px; }

  /* 头部：小屏换两行——第一行 logo+搜索，第二行导航（可横向滑动） */
  .header-inner { flex-wrap: wrap; height: auto; padding: 8px 0; gap: 8px; }
  .logo { font-size: 17px; flex: 1; }
  .search { margin-left: auto; }
  .search input { width: 110px; padding: 7px 10px; font-size: 13px; }
  .search button { padding: 0 12px; font-size: 13px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav a { padding: 5px 9px; font-size: 13px; }

  /* 标题与区块 */
  .page-title { font-size: 20px; margin: 6px 0 16px; }
  .section { margin-bottom: 22px; }
  .section-title { font-size: 16px; }
  .sec-title { font-size: 16px; }

  /* 首页 Hero */
  .home-hero { padding: 28px 20px; border-radius: 16px; }
  .home-hero h1 { font-size: 22px; }
  .home-hero .hero-slogan { font-size: 14px; margin-bottom: 14px; }
  .hero-badge { font-size: 12px; padding: 5px 11px; }
  .home-hero-stats { padding: 14px 12px; gap: 10px; }
  .hh-num { font-size: 20px; }

  /* 详情页 */
  .detail-hero { padding: 24px 20px; border-radius: 16px; }
  .detail-hero h1 { font-size: 21px; }
  .detail-card { padding: 16px; }
  .meta-grid { gap: 10px; }

  /* 排行列表与卡片正文 */
  .rank-item { padding: 12px 14px; gap: 10px; }
  .home-card .hc-free { top: 8px; right: 8px; font-size: 10px; padding: 2px 8px; }

  /* 筛选与排序 */
  .fchip { padding: 5px 13px; font-size: 13px; }
  .sort-row { flex-wrap: wrap; gap: 8px; }
}