/* 资源站 · 前台样式（手机优先，自动深色） */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #e7e9ee;
  --text: #14161b;
  --text-2: #565c69;
  --text-3: #8b919d;
  --accent: #2d5bff;
  --accent-ink: #ffffff;
  --accent-soft: #e9eeff;
  --hot: #ff5a2c;
  --ok: #16a05a;
  --warn: #e0454b;
  --warn-soft: #fff1f0;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .05);
  --r: 14px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --surface: #17191d;
    --surface-2: #1f2126;
    --line: #2a2d34;
    --text: #eceef2;
    --text-2: #a7adb9;
    --text-3: #747a86;
    --accent: #6b8cff;
    --accent-ink: #0b0d12;
    --accent-soft: #1b2341;
    --hot: #ff7a52;
    --warn-soft: #2a1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
p { margin: 0; }
[hidden] { display: none !important; }
.i { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }
.muted { color: var(--text-3); font-size: 13px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 16px; padding-bottom: 32px; min-height: 60vh; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface-2); border-color: transparent; }
.btn-ghost:hover { background: var(--line); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 52px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; color: var(--accent); font-size: 14px; }
.link-muted { color: var(--text-3); font-size: 13px; }

/* ---------- 顶部 ---------- */
.inapp-bar, .notice {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; font-size: 13px; line-height: 1.5;
}
.inapp-bar { background: #fff6dd; color: #7a5a00; }
@media (prefers-color-scheme: dark) { .inapp-bar { background: #2b2410; color: #e8c766; } }
.notice { background: var(--accent-soft); color: var(--accent); }
.notice span, .inapp-bar span { flex: 1; }

.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.top-inner { display: flex; align-items: center; gap: 20px; height: 56px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px;
  color: #fff; background: linear-gradient(135deg, var(--accent), #8b5cff);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.top-nav { display: none; gap: 4px; }
.top-nav a { padding: 6px 12px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 14px; }
.top-nav a:hover { background: var(--surface-2); color: var(--text); }
.top-nav a.on { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.top-search { display: none; }
.top-search-btn { margin-left: auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; background: var(--surface); box-shadow: var(--shadow); }
@media (min-width: 860px) {
  .top-nav { display: flex; }
  .top-search {
    display: flex; align-items: center; gap: 8px; margin-left: auto; height: 38px; padding: 0 14px; width: 260px;
    border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-3);
  }
  .top-search:focus-within { border-color: var(--accent); }
  .top-search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--text); }
  .top-search-btn { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- 底部 Tab（手机） ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; color: var(--text-3); }
.tabbar .i { font-size: 22px; }
.tabbar a.on { color: var(--accent); }
@media (min-width: 860px) { .tabbar { display: none; } }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 28px 18px 22px; text-align: center;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(90% 80% at 100% 0%, color-mix(in srgb, #8b5cff 14%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid var(--line);
}
.hero h1 { font-size: clamp(24px, 6vw, 38px); font-weight: 800; letter-spacing: .5px; }
.hero-sub { margin-top: 6px; color: var(--text-2); font-size: 14px; }
.hero-sub b { color: var(--accent); }
.hero-search {
  display: flex; align-items: center; gap: 8px; max-width: 560px; margin: 18px auto 0; padding: 5px 5px 5px 16px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; color: var(--text-3);
  box-shadow: var(--shadow);
}
.hero-search:focus-within { border-color: var(--accent); }
.hero-search .i { font-size: 18px; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; color: var(--text); }
.hot-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; margin-top: 14px; font-size: 13px; }
.hot-tags span { color: var(--hot); font-weight: 600; }
.hot-tags a { color: var(--text-2); padding: 2px 10px; border-radius: 999px; background: var(--surface-2); }
.hot-tags a:hover { color: var(--accent); }

.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 640px) { .cat-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); } }
.cat-tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 4px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: transform .15s, border-color .15s;
}
.cat-tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.cat-icon {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; font-size: 20px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none;
}
.cat-name { font-weight: 600; font-size: 14px; }
.cat-count { font-size: 11px; color: var(--text-3); }

.sec { margin-top: 22px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-head h2 { display: flex; align-items: center; gap: 6px; font-size: 17px; font-weight: 700; }
.sec-head h2 .i { color: var(--accent); }
.sec-head a { display: flex; align-items: center; gap: 2px; font-size: 13px; color: var(--text-3); }
.sec-head a:hover { color: var(--accent); }

.cols { display: grid; gap: 0 24px; }
@media (min-width: 960px) { .cols { grid-template-columns: minmax(0, 1fr) 340px; } }

/* ---------- 封面 ---------- */
.cover { position: relative; overflow: hidden; border-radius: 12px; background: var(--surface-2); flex: none; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-ph {
  display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, hsl(var(--h) 78% 62%), hsl(calc(var(--h) + 38) 72% 50%));
}
.cover-ph span { text-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.cover-sm { width: 60px; height: 60px; }
.cover-sm.cover-ph span { font-size: 24px; }
.cover-card { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px 12px 0 0; }
.cover-card.cover-ph span { font-size: 40px; }
.cover-lg { width: 112px; height: 112px; border-radius: 16px; }
.cover-lg.cover-ph span { font-size: 46px; }
@media (min-width: 640px) { .cover-lg { width: 168px; height: 168px; } .cover-lg.cover-ph span { font-size: 64px; } }

/* ---------- 列表 ---------- */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); transition: background .12s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sum { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 3px; font-size: 12px; color: var(--text-3); }
.meta-hot { display: inline-flex; align-items: center; gap: 2px; color: var(--hot); }
.badge { display: inline-block; font-size: 11px; line-height: 17px; padding: 0 5px; border-radius: 5px; margin-right: 5px; vertical-align: 1px; font-weight: 700; }
.badge-hot { background: var(--hot); color: #fff; }
.rank { width: 22px; flex: none; text-align: center; font-weight: 800; font-size: 15px; color: var(--text-3); font-style: italic; }
.rank-1 { color: #ff4d2e; } .rank-2 { color: #ff8a1f; } .rank-3 { color: #f5b400; }
.list-compact .cover-sm { width: 44px; height: 44px; border-radius: 10px; }
.list-compact .cover-sm.cover-ph span { font-size: 18px; }
.list-compact .row { padding: 10px 12px; }
.list-compact .row-sum { display: none; }
@media (min-width: 760px) {
  .list-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .list-grid .row:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
  .list-grid .row:nth-child(odd) { border-right: 1px solid var(--line); }
}

.cards { display: grid; grid-auto-flow: column; grid-auto-columns: 148px; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.cards::-webkit-scrollbar { display: none; }
@media (min-width: 860px) {
  .cards { grid-auto-flow: row; grid-template-columns: repeat(5, 1fr); overflow: visible; margin: 0; padding: 0; }
  .cards > :nth-child(n+6) { display: none; }  /* 桌面只放一排，手机横滑看全部 */
}
.card { scroll-snap-align: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card-body { padding: 8px 10px 10px; }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }

/* ---------- 通用块 ---------- */
.page-title { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; margin: 4px 0 14px; }
.page-title .i { color: var(--accent); }
.page-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.page-head .page-title { margin-bottom: 10px; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); margin-bottom: 10px; }
.crumbs a:hover { color: var(--accent); }
.crumbs .i { font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.chip i { font-style: normal; font-size: 11px; color: var(--text-3); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.on i { color: inherit; opacity: .7; }
.chip-sm { padding: 2px 10px; font-size: 12px; color: var(--text-2); }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs a { padding: 8px 0; color: var(--text-3); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 16px; text-align: center; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty > .i { font-size: 34px; opacity: .6; }
.empty-lg { padding: 72px 16px; border: 0; background: none; }
.empty-lg h1 { color: var(--text); font-size: 22px; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.pager-info { color: var(--text-3); font-size: 13px; }
.warn { color: var(--warn); font-size: 13px; }
.ok { color: var(--ok); display: inline-flex; align-items: center; gap: 2px; }

.cat-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.cat-block-head { display: flex; align-items: center; gap: 10px; }
.cat-block-head b { font-size: 16px; }
.cat-block-head .i { margin-left: auto; color: var(--text-3); }
.cat-block .chips { margin-top: 12px; }

.day-group { margin-bottom: 18px; }
.day-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; }
.day-head b { font-size: 15px; }

/* ---------- 加群卡片 ---------- */
.group-card {
  display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 16px; border-radius: var(--r);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}
.group-text { flex: 1; min-width: 0; }
.group-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 16px; }
.group-title .i { color: var(--accent); }
.group-text p { color: var(--text-2); font-size: 13px; margin: 4px 0 10px; }
.group-qr { width: 92px; height: 92px; border-radius: 10px; background: #fff; padding: 4px; flex: none; }

/* ---------- 详情 ---------- */
.detail-top { display: flex; gap: 16px; align-items: flex-start; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { font-size: clamp(19px, 4.6vw, 26px); font-weight: 800; }
.detail-sum { color: var(--text-2); margin-top: 6px; font-size: 14px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 0; font-size: 13px; color: var(--text-3); }
.detail-meta span { display: inline-flex; align-items: center; gap: 4px; }
.get-box { display: grid; gap: 10px; margin-top: 18px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.get-box .btn-primary { box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 32%, transparent); }
.get-box > .link-btn { justify-self: center; }
.code-line { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.code-line code { font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--text); background: var(--surface-2); padding: 2px 12px; border-radius: 8px; }
.detail-content { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--text-2); font-size: 14px; line-height: 1.8; }

/* ---------- 求资源 ---------- */
.field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 15px; color: var(--text); outline: 0;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.wish-list { display: grid; gap: 8px; }
.wish { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.wish-main { flex: 1; min-width: 0; }
.wish-main p { word-break: break-word; }
.wish-done { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.wish-res { display: inline-flex; align-items: center; gap: 2px; margin-top: 6px; font-size: 13px; color: var(--accent); }
.vote { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 44px; padding: 6px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 12px; color: var(--text-2); }
.vote.voted { color: var(--accent); border-color: var(--accent); }

/* ---------- 防失联 / 引导 ---------- */
.addr { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.addr code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; }
.steps { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--text-2); font-size: 14px; }
.steps b { color: var(--text); }
.guide { max-width: 480px; margin: 12px auto; display: grid; gap: 12px; }
.guide h1 { display: flex; gap: 8px; align-items: center; font-size: 19px; }
.guide-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 8px; }
.guide-step p { color: var(--text-2); font-size: 14px; }
.guide > .link-btn { justify-self: center; }

/* ---------- 弹窗 / 提示 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 10, 14, .45); animation: fade .15s; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal-box {
  position: relative; width: 100%; max-width: 420px; background: var(--surface); padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0; animation: up .2s ease-out;
}
@media (min-width: 640px) { .modal-box { border-radius: 20px; padding-bottom: 18px; } }
.modal-box h3 { font-size: 18px; margin-bottom: 8px; }
.modal-box > p { color: var(--text-2); font-size: 14px; }
.modal-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 22px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 10px);
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

/* ---------- 页脚 ---------- */
.foot { padding-top: 24px; padding-bottom: 28px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; display: grid; gap: 6px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.foot-links a { display: inline-flex; align-items: center; gap: 4px; }
.foot-links a:hover { color: var(--accent); }
