/* ============================================================
   VGo 资料库 · 设计系统
   ============================================================ */
:root {
  --bg: #f4efe6;
  --bg-soft: #faf6ef;
  --card: #ffffff;
  --ink: #15231f;
  --ink-2: #3c4b45;
  --muted: #7c8a83;
  --line: #e5dccd;
  --accent: #ea6437;
  --accent-soft: #fdece4;
  --teal: #0f5a4b;
  --teal-soft: #e2efe9;
  --gold: #c8963e;
  --ok: #2f8a5b;
  --danger: #c8432f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-1: 0 1px 2px rgba(21, 35, 31, .05), 0 8px 24px -12px rgba(21, 35, 31, .18);
  --shadow-2: 0 24px 64px -20px rgba(21, 35, 31, .35);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-x: hidden;   /* chips 横向滚动条不应撑开页面 */
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 80% -10%, rgba(15, 90, 75, .07), transparent 60%),
    radial-gradient(900px 420px at -10% 10%, rgba(234, 100, 55, .07), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.modal-open { overflow: hidden; }

a { color: var(--teal); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: rgba(234, 100, 55, .22); }

/* ---------- 布局 ---------- */
.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 20px; }

.site-header { padding: 26px 0 0; }

.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }

.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  background: linear-gradient(145deg, var(--teal), #0b4438);
  color: #f4efe6; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; letter-spacing: .5px;
  box-shadow: 0 6px 16px -6px rgba(15, 90, 75, .6), inset 0 1px 0 rgba(255, 255, 255, .18);
}

.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: -.2px; font-weight: 800; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); letter-spacing: .3px; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .6);
  color: var(--ink-2); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: background .18s, border-color .18s, transform .18s;
  backdrop-filter: blur(6px);
}
.ghost-btn:hover { background: #fff; border-color: #d5c9b6; }
.ghost-btn:active { transform: scale(.97); }
.ghost-btn.dark { background: var(--teal); border-color: var(--teal); color: #f6f2ea; }
.ghost-btn.dark:hover { background: #0c4a3d; }
.ghost-btn svg { width: 15px; height: 15px; }

/* 标题区 */
.hero { padding: 34px 0 22px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 40px; }
.hero-main { min-width: 0; flex: 1 1 420px; }
.hero-stat { flex: none; margin-top: 0; padding-bottom: 6px; }
.hero h2 {
  margin: 0; font-size: clamp(26px, 4.6vw, 40px); line-height: 1.16;
  letter-spacing: -.8px; font-weight: 800; max-width: 18em;
}
.hero h2 em { font-style: normal; color: var(--accent); }
.hero p { margin: 12px 0 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; max-width: 30em; }
.hero-stat { display: flex; flex-wrap: wrap; gap: 18px 26px; margin-top: 18px; }
.hero-stat div { display: flex; align-items: baseline; gap: 6px; font-size: 13px; color: var(--muted); }
.hero-stat b { font-size: 20px; color: var(--ink); letter-spacing: -.4px; font-variant-numeric: tabular-nums; }

/* ---------- 搜索 & 筛选 ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 30; padding: 12px 0 10px;
  background: linear-gradient(180deg, rgba(244, 239, 230, .98) 72%, rgba(244, 239, 230, .86));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.search-row { display: flex; gap: 10px; align-items: center; }

.search-box {
  position: relative; flex: 1; display: flex; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-1); transition: border-color .18s, box-shadow .18s;
}
.search-box:focus-within { border-color: #cbbfa9; box-shadow: 0 0 0 4px rgba(234, 100, 55, .1), var(--shadow-1); }
.search-box svg { width: 18px; height: 18px; margin-left: 14px; color: var(--muted); flex: none; }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 13px 12px; font-size: 15px; min-width: 0;
}
.search-box input::placeholder { color: #a5afa9; }
.search-clear {
  border: 0; background: transparent; color: var(--muted); padding: 6px 12px; display: none;
  font-size: 16px; line-height: 1;
}
.search-box.has-value .search-clear { display: block; }

.select-wrap { position: relative; flex: none; }
.select-wrap svg { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 32px 13px 14px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  box-shadow: var(--shadow-1); outline: 0;
}

.chips { display: flex; gap: 8px; width: 100%; overflow-x: auto; overflow-y: hidden; padding: 12px 14px 2px; margin: 0 -14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: rgba(255, 255, 255, .7);
  color: var(--ink-2); border-radius: 999px; padding: 8px 15px; font-size: 13.5px;
  font-weight: 600; white-space: nowrap; transition: all .16s;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip-ico { font-size: 14px; line-height: 1; margin-right: -2px; }
.chip:hover { border-color: #d5c9b6; background: #fff; }
.chip.active { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 8px 18px -10px rgba(15, 90, 75, .9); }
.chip.active small { color: rgba(255, 255, 255, .72); }

/* ---------- 结果栏 ---------- */
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 14px; color: var(--muted); font-size: 13px; }
.result-bar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.view-toggle { display: flex; gap: 4px; background: rgba(255, 255, 255, .7); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.view-toggle button { border: 0; background: transparent; border-radius: 7px; padding: 5px 8px; color: var(--muted); display: grid; place-items: center; }
.view-toggle button svg { width: 15px; height: 15px; }
.view-toggle button.active { background: var(--teal); color: #fff; }

/* ---------- 资料卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 14px; padding-bottom: 40px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: left; box-shadow: var(--shadow-1);
  transition: transform .2s cubic-bezier(.2, .8, .3, 1), box-shadow .2s, border-color .2s;
  cursor: pointer; overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}
.card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -22px rgba(21, 35, 31, .4); border-color: #dccfba; }
.card:active { transform: translateY(-1px) scale(.995); }

.card-head { display: flex; align-items: flex-start; gap: 12px; }
.file-badge {
  flex: none; width: 46px; height: 52px; border-radius: 10px;
  display: grid; place-items: center; position: relative;
  font-weight: 800; font-size: 11.5px; letter-spacing: .3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
}
.file-badge::before {
  content: ""; position: absolute; top: 0; right: 0; width: 12px; height: 12px;
  background: linear-gradient(225deg, transparent 50%, rgba(255, 255, 255, .55) 50%);
  border-bottom-left-radius: 3px;
}
.file-badge span { transform: translateY(1px); }

.b-pdf   { background: #fdecec; color: #b23a2f; }
.b-doc   { background: #e8f0fb; color: #2b5fa8; }
.b-sheet { background: #e6f5ec; color: #1f7a4d; }
.b-slide { background: #fdf0e3; color: #b56a1c; }
.b-image { background: #f0ebfa; color: #6a45a8; }
.b-video { background: #fce8f1; color: #a83670; }
.b-audio { background: #e4f4f5; color: #227d82; }
.b-archive { background: #f3efe6; color: #7a6a48; }
.b-other { background: #eef1f0; color: #5a6a63; }

.card-title {
  margin: 0; font-size: 15px; font-weight: 700; line-height: 1.45; letter-spacing: -.1px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}
.card-desc {
  margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 1px;
}

.card-meta { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 14px; flex-wrap: wrap; }
.cat-pill {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal); font-size: 11.5px; font-weight: 700;
}
.meta-text { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dot { width: 3px; height: 3px; border-radius: 50%; background: #c6cfc9; flex: none; }

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.dl-count { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.dl-count svg { width: 13px; height: 13px; }
.card-actions { display: flex; gap: 6px; }

.mini-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 9px;
  padding: 7px 11px; font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px; text-decoration: none;
  transition: all .16s;
}
.mini-btn:hover { border-color: #cfc0a8; background: var(--bg-soft); }
.mini-btn:active { transform: scale(.96); }
.mini-btn svg { width: 13px; height: 13px; }
.mini-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mini-btn.primary:hover { background: #d9562c; }
.mini-btn[disabled] { opacity: .45; pointer-events: none; }

/* 列表模式 */
.grid.list { grid-template-columns: 1fr; gap: 8px; }
.grid.list .card { flex-direction: row; align-items: center; padding: 12px 14px; gap: 14px; }
.grid.list .card-head { flex: 1; min-width: 0; align-items: center; }
.grid.list .file-badge { width: 38px; height: 42px; font-size: 10px; }
.grid.list .card-title { -webkit-line-clamp: 1; }
.grid.list .card-desc { display: none; }
.grid.list .card-meta { margin: 0; padding: 0; flex-wrap: nowrap; }
.grid.list .card-meta .cat-pill, .grid.list .card-meta .meta-date { display: none; }
.grid.list .card-foot { margin: 0; padding: 0; border: 0; flex: none; gap: 4px; }
.grid.list .dl-count { display: none; }

/* ---------- 骨架屏 ---------- */
.skeleton { pointer-events: none; }
.sk-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #eee7db 25%, #f6f1e7 37%, #eee7db 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
.sk-badge { width: 46px; height: 52px; border-radius: 10px; background: #efe8dc; flex: none; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

/* ---------- 空状态 / 错误 ---------- */
.empty { text-align: center; padding: 64px 20px 80px; color: var(--muted); }
.empty-icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 20px; display: grid; place-items: center; background: #fff; box-shadow: var(--shadow-1); color: #b9b0a1; }
.empty-icon svg { width: 28px; height: 28px; }
.empty h3 { margin: 0 0 6px; color: var(--ink); font-size: 16px; }
.empty p { margin: 0; font-size: 13.5px; line-height: 1.7; }
.empty .ghost-btn { margin-top: 18px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 0 56px; }
.pager button {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  min-width: 38px; height: 38px; padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.pager button.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.pager button[disabled] { opacity: .4; }
.pager span { color: var(--muted); font-size: 13px; padding: 0 4px; }

/* ---------- 详情弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: flex; flex-direction: column; justify-content: flex-end; }
.modal-backdrop {
  position: absolute; inset: 0; z-index: 0; background: rgba(16, 26, 22, .5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade .22s ease;
}
.modal-panel {
  position: relative; z-index: 2; margin: 0 auto;
  width: min(680px, 100%); max-height: 92vh; background: var(--bg-soft);
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; overflow: hidden;
  animation: slideUp .28s cubic-bezier(.2, .85, .3, 1);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .5 } to { transform: none; opacity: 1 } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal-grab { display: flex; justify-content: center; padding: 10px 0 2px; }
.modal-grab i { width: 40px; height: 4px; border-radius: 99px; background: #d8cfc0; }
.modal-head { position: relative; z-index: 3; display: flex; align-items: flex-start; gap: 12px; padding: 8px 20px 0; }
.modal-head .file-badge { width: 42px; height: 48px; }
.modal-head-text { flex: 1; min-width: 0; }
.modal-head h3 { margin: 0; font-size: 17px; line-height: 1.45; font-weight: 800; word-break: break-word; }
.modal-sub { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.modal-close {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--muted); display: grid; place-items: center; font-size: 16px;
}
.modal-close svg { width: 15px; height: 15px; }
.modal-body { overflow-y: auto; padding: 16px 20px calc(12px + var(--safe-b)); -webkit-overflow-scrolling: touch; }

.preview-box {
  background: #101815; border-radius: 14px; overflow: hidden; margin-bottom: 14px;
  min-height: 120px; display: none; position: relative;
}
.preview-box.on { display: block; }
.preview-box img, .preview-box video { display: block; width: 100%; max-height: 46vh; object-fit: contain; background: #101815; }
.preview-box audio { width: 100%; display: block; padding: 18px 14px; background: #17211d; }
.preview-box iframe { width: 100%; height: 50vh; border: 0; display: block; background: #fff; }
.preview-box pre {
  margin: 0; padding: 16px; max-height: 46vh; overflow: auto; color: #d8e3dc;
  font: 12.5px/1.7 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.preview-loading { display: grid; place-items: center; height: 140px; color: #8ea39a; font-size: 13px; }
.preview-fallback { padding: 26px 20px; text-align: center; color: #a9b8b1; font-size: 13px; line-height: 1.7; }

.desc-block { font-size: 14px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 12px; color: var(--teal); background: var(--teal-soft); border-radius: 7px; padding: 4px 9px; font-weight: 600; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 16px 0 4px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.info-grid div { font-size: 12.5px; color: var(--muted); }
.info-grid b { display: block; margin-top: 3px; color: var(--ink); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-all; }

.modal-foot { display: flex; gap: 10px; padding: 14px 20px calc(16px + var(--safe-b)); background: var(--bg-soft); border-top: 1px solid var(--line); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 13px; padding: 13px 18px; font-size: 14.5px; font-weight: 700;
  border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none;
  transition: all .16s;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 10px 22px -12px rgba(234, 100, 55, .9); flex: 1; }
.btn.primary:hover { background: #d9562c; }
.btn.ghost { flex: none; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(24px + var(--safe-b)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  background: rgba(21, 35, 31, .94); color: #f4efe6; font-size: 13.5px; font-weight: 500;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .6);
  max-width: 88vw; text-align: center; line-height: 1.5;
  animation: toastIn .24s cubic-bezier(.2, .8, .3, 1);
}
.toast.err { background: rgba(160, 44, 30, .96); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- 微信引导（只在微信内显示） ---------- */
.wx-tip { display: none; }
  display: flex; gap: 10px; align-items: flex-start; background: #fff7e8; border: 1px solid #f0dfb9;
  color: #6f5620; border-radius: 12px; padding: 11px 13px; font-size: 12.5px; line-height: 1.65;
  margin-bottom: 14px;
}
.wx-tip svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
body.in-wechat .wx-tip { display: flex; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0 40px; color: var(--muted); font-size: 12.5px; line-height: 1.8; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dashed #c9bda9; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .site-header { padding-top: 16px; }
  .brand-mark { width: 38px; height: 38px; font-size: 13px; border-radius: 11px; }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { font-size: 11px; }
  .header-actions .ghost-btn span { display: none; }
  .header-actions .ghost-btn { padding: 9px; }
  .hero { padding: 24px 0 12px; }
  .hero p { font-size: 13.5px; }
  .hero-stat { gap: 14px 20px; margin-top: 14px; }
  .hero-stat b { font-size: 17px; }
  .toolbar { padding: 8px 0 6px; }
  .search-box input { padding: 12px 10px; font-size: 16px; }
  .select-wrap select { padding: 12px 28px 12px 12px; font-size: 13px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }   /* 手机单列更好读 */
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.list { gap: 8px; }
  .card { padding: 14px; }
  .result-bar { padding: 4px 0 10px; }
  .modal-panel { border-radius: 20px 20px 0 0; max-height: 94vh; }
  .modal-head { padding: 6px 16px 0; }
  .modal-body { padding: 14px 16px calc(10px + var(--safe-b)); }
  .modal-foot { padding: 12px 16px calc(14px + var(--safe-b)); }
  .info-grid { grid-template-columns: 1fr 1fr; }
  .site-footer { padding-bottom: calc(28px + var(--safe-b)); }
}
@media (min-width: 641px) {
  .modal-panel { z-index: 2; margin: 0; border-radius: 22px; max-height: 88vh; animation: modalIn .24s cubic-bezier(.2, .85, .3, 1); }
  @keyframes modalIn { from { transform: translateY(14px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* 工具栏吸顶后的分隔感 */
.toolbar.stuck { box-shadow: 0 12px 24px -24px rgba(21, 35, 31, .5); }
.site-header.scrolled { background: rgba(244, 239, 230, .9); backdrop-filter: blur(10px); }


/* 兜底：任何元素带 hidden 都必须隐藏（防被 display 规则覆盖） */
[hidden] { display: none !important; }
