:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --card-2: #f3f4f8;
  --text: #1b1d23;
  --text-2: #5b6070;
  --text-3: #9aa0ae;
  --line: #e6e8f0;
  --brand: #4f5bd5;
  --brand-soft: #eceefe;
  --shadow: 0 1px 2px rgba(20, 22, 33, .05), 0 8px 24px rgba(20, 22, 33, .06);
  --radius: 16px;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --card: #171a22;
  --card-2: #1e222c;
  --text: #e9ebf2;
  --text-2: #a2a9bb;
  --text-3: #6c7285;
  --line: #262b36;
  --brand: #7b86ff;
  --brand-soft: #1e2233;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

/* 关键：作者样式的 display 会盖过浏览器默认的 [hidden]，必须显式兜底 */
[hidden] { display: none !important; }

.modal[hidden], .login[hidden], .more[hidden], .empty[hidden], .view[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .25s, color .25s;
}

.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.hdr {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.hdr-in {
  display: flex; align-items: center; gap: 14px;
  height: 62px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.logo {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  font-size: 20px;
  background: var(--brand-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.brand-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-txt b { font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.brand-txt i { font-style: normal; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hdr-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search {
  display: flex; align-items: center; gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  height: 38px;
  width: 240px;
  transition: border-color .2s, box-shadow .2s;
}

.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.search svg { width: 16px; height: 16px; flex: none; stroke: var(--text-3); fill: none; stroke-width: 2; stroke-linecap: round; }

.search input {
  border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14px; width: 100%;
}

.search input::-webkit-search-cancel-button { display: none; }

.q-clear {
  border: 0; background: var(--card-2); color: var(--text-2);
  width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1;
  display: none; place-items: center; flex: none;
}

.q-clear.show { display: grid; }

.icon-btn {
  border: 1px solid var(--line); background: var(--card);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  font-size: 16px; flex: none;
  transition: transform .2s, border-color .2s;
}

.icon-btn:hover { transform: translateY(-1px); border-color: var(--brand); }

/* ---------- 公告与筛选 ---------- */
.main-wrap { padding-top: 18px; padding-bottom: 8px; }

.notice {
  background: var(--brand-soft);
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  white-space: nowrap;
  transition: all .18s;
}

.chip:hover { border-color: var(--brand); color: var(--text); }

.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.chip em { font-style: normal; opacity: .6; font-size: 12px; margin-left: 4px; }

/* 网盘筛选行：与分类行平行，视觉上轻一档 */
.chips-pf { padding: 0 0 12px; }
.chips-pf .chip { padding: 5px 12px; font-size: 13px; border-style: dashed; }
.chips-pf .chip.on { border-style: solid; }

.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 2px 14px;
}

.count { font-size: 13px; color: var(--text-3); }

.sortsel { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }

.sortsel select {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 8px; padding: 5px 8px; font-size: 13px; outline: 0;
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s;
}

.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

.cover {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c1, #6a7bff), var(--c2, #8f6bff));
}

.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cover .folder { font-size: 40px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .18)); }

.cover .badge-n {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0, 0, 0, .45); color: #fff;
  backdrop-filter: blur(4px);
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
}

.cover .pin {
  position: absolute; top: 8px; left: 8px;
  background: #ffb300; color: #3a2a00;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
}

.card-b { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }

.card-t {
  font-size: 14.5px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 40px;
}

.card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-m { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.dot-row { display: flex; gap: 3px; }

.dot { width: 14px; height: 14px; border-radius: 4px; color: #fff; font-size: 9px; display: grid; place-items: center; font-weight: 700; }

.meta { font-size: 12px; color: var(--text-3); }

/* ---------- 空态 / 加载更多 ---------- */
.empty { text-align: center; padding: 60px 16px; color: var(--text-3); }
.empty-ico { font-size: 44px; margin-bottom: 8px; }
.empty p { margin: 0 0 14px; }

.btn {
  border: 1px solid var(--line); background: var(--brand); color: #fff;
  border-radius: 10px; padding: 8px 16px; font-size: 14px; cursor: pointer;
  transition: filter .2s;
}

.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--card); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }

.more {
  display: block; margin: 26px auto 40px;
  border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  border-radius: 999px; padding: 10px 26px; cursor: pointer; font-size: 14px;
}

.more:hover { border-color: var(--brand); color: var(--text); }

/* ---------- 详情弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }

.mask { position: absolute; inset: 0; background: rgba(10, 12, 18, .55); backdrop-filter: blur(3px); }

.sheet {
  position: relative;
  width: min(560px, calc(100% - 28px));
  max-height: 86vh; overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
  animation: pop .22s ease;
}

@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.sheet-x {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 0; background: rgba(0, 0, 0, .4); color: #fff; font-size: 18px; line-height: 1;
}

.sheet-banner {
  height: 150px; display: grid; place-items: center; font-size: 52px;
  background: linear-gradient(135deg, var(--c1, #6a7bff), var(--c2, #8f6bff));
}

.sheet-banner img { width: 100%; height: 150px; object-fit: cover; display: block; }

.sheet-body { padding: 16px 20px 22px; }

.sheet-cat { font-size: 12px; color: var(--brand); font-weight: 600; margin-bottom: 4px; }

.sheet-body h2 { margin: 0 0 8px; font-size: 19px; line-height: 1.4; }

.sheet-desc { margin: 0 0 12px; color: var(--text-2); font-size: 14px; white-space: pre-wrap; }

.tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.tag { background: var(--card-2); color: var(--text-2); font-size: 12px; padding: 3px 9px; border-radius: 999px; }

.links { display: flex; flex-direction: column; gap: 8px; }

.link-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 10px; background: var(--card-2);
}

.link-pf {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700;
}

.link-name { font-size: 14px; font-weight: 500; }

.link-note { font-size: 11.5px; color: var(--text-3); }

.link-code {
  font: 12px/1 ui-monospace, Menlo, Consolas, monospace;
  background: var(--card); border: 1px dashed var(--line);
  padding: 3px 6px; border-radius: 6px; color: var(--text-2);
}

.link-acts { margin-left: auto; display: flex; gap: 6px; flex: none; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 9px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 99;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 页脚 ---------- */
.ft { border-top: 1px solid var(--line); margin-top: 30px; padding: 24px 0 34px; color: var(--text-3); font-size: 13px; }
.ft p { margin: 0; }
.ft-sub { margin-top: 4px; opacity: .8; }

.ft-contact {
  margin-top: 12px;
  border: 1px dashed var(--line);
  background: var(--card);
  color: var(--text-2);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
}

.ft-contact:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- 内置浏览器（微信 / QQ）提示条 ---------- */
.inapp {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff7e6; color: #8a5a00;
  border-bottom: 1px solid #ffe0a3;
  padding: 9px 16px; font-size: 13px;
}
[data-theme="dark"] .inapp {
  background: #3b2f14; color: #ffd591; border-bottom-color: #5c481f;
}
.inapp b { font-weight: 700; }
.inapp button {
  margin-left: auto; flex: none;
  border: 1px solid currentColor; background: transparent; color: inherit;
  border-radius: 8px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit;
}
@media (max-width: 720px) {
  .inapp { font-size: 12.5px; padding: 8px 14px; }
  .inapp button { margin-left: 0; width: 100%; text-align: center; }
}

/* ---------- 联系站长 ---------- */
.qr-wrap { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.qr-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  width: 150px;
  text-align: center;
  background: var(--card-2);
}

.qr-card img {
  width: 124px; height: 124px; object-fit: cover;
  border-radius: 10px; display: block; margin: 0 auto 8px; background: var(--card);
}

.qr-card .qr-label { font-size: 13px; font-weight: 600; color: var(--text); }
.qr-card .qr-tip { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.contact-rows { display: flex; flex-direction: column; gap: 8px; }

.contact-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 10px; background: var(--card-2);
}

.contact-row .c-ico { font-size: 18px; flex: none; }
.contact-row .c-name { font-size: 13.5px; font-weight: 500; }
.contact-row .c-val {
  font: 12.5px/1.4 ui-monospace, Menlo, Consolas, monospace; color: var(--text-3);
}
.contact-row .c-act { margin-left: auto; flex: none; }

.ct-empty { color: var(--text-3); font-size: 13.5px; margin: 0; }
.ct-note { font-size: 12.5px; color: var(--text-3); margin: 14px 0 0; }

/* ---------- 移动端 ---------- */
/* 手机端下拉筛选：默认隐藏，小屏才显示 */
.m-sel { display: none; gap: 8px; margin: 0 0 12px; }

.m-sel select {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 9px 10px; font-size: 14px; outline: 0;
  font-family: inherit;
}

@media (max-width: 720px) {
  .hdr-in { flex-wrap: wrap; height: auto; padding-top: 9px; padding-bottom: 9px; }
  .hdr-actions { width: 100%; }
  .search { width: auto; flex: 1; }

  /* 手机端：两排胶囊换成两个下拉，不占地方 */
  .chips, .chips-pf { display: none; }
  .m-sel { display: flex; }

  /* 手机端：卡片改成横向条状，封面缩到 62px */
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card { flex-direction: row; align-items: center; gap: 10px; padding: 8px; }
  .cover { width: 62px; height: 62px; aspect-ratio: 1 / 1; border-radius: 10px; flex: none; }
  .cover .folder { font-size: 24px; }
  .cover .badge-n, .cover .pin { display: none; }
  .card-b { padding: 0; gap: 2px; }
  .card-t { min-height: 0; font-size: 14px; line-height: 1.35; }
  .card-foot { gap: 5px; }
  .card-m { gap: 4px; }
  .dot { width: 12px; height: 12px; font-size: 8px; }
  .meta { font-size: 11.5px; }

  .sheet { max-height: 90vh; }
  .sheet-banner { height: 120px; }
  .sheet-banner img { height: 120px; }
  .link-item { flex-wrap: wrap; }
  .link-acts { margin-left: 0; width: 100%; }
  .link-acts .btn { flex: 1; text-align: center; }
  .qr-card { width: 100%; }
}

@media (max-width: 420px) {
  .brand-txt i { display: none; }
}
