/* ============ 基础 ============ */
:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e8eaf0;
  --brand: #2f6bff;
  --brand-dark: #1f55e0;
  --brand-soft: #eaf0ff;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 24px rgba(17, 24, 39, .05);
  --shadow-hover: 0 4px 10px rgba(17, 24, 39, .06), 0 16px 40px rgba(17, 24, 39, .09);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --card: #161b22;
    --text: #e6edf3;
    --muted: #8b949e;
    --line: #232a33;
    --brand: #4d86ff;
    --brand-dark: #3a74f0;
    --brand-soft: #16233a;
    --ok: #3fb950;
    --warn: #e3a008;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, .5), 0 16px 40px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }

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

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; gap: 14px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), #7a5cff);
  color: #fff; font-weight: 700; font-size: 17px;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: .2px; }
.brand-text small { font-size: 11px; color: var(--muted); }

.search {
  position: relative; flex: 1 1 auto; max-width: 420px; margin-left: auto;
  display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 4px 0 38px; height: 42px;
  transition: border-color .18s, box-shadow .18s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-icon { position: absolute; left: 13px; color: var(--muted); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14px; padding: 0;
}
.search input::placeholder { color: var(--muted); }
.search button {
  border: 0; background: var(--brand); color: #fff;
  height: 34px; padding: 0 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
}
.search button:hover { background: var(--brand-dark); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ============ 公告 ============ */
.notice {
  margin-top: 14px;
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 13.5px;
}
.notice svg { flex: 0 0 auto; margin-top: 2px; width: 16px; height: 16px; }

/* ============ 主体 ============ */
.main { padding-top: 22px; padding-bottom: 48px; min-height: 60vh; }

.hero { padding: 6px 0 18px; }
.hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.4px; }
.hero p { margin: 0; color: var(--muted); font-size: 14px; max-width: 640px; }

/* 分类 */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px; white-space: nowrap;
  transition: all .16s;
}
.chip em { font-style: normal; font-size: 11px; opacity: .7; }
.chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* 列表头 */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.list-title { display: flex; align-items: baseline; gap: 8px; font-weight: 600; }
.list-title small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.sorts { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.sorts a { padding: 4px 13px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.sorts a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* 卡片 */
.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.card-top { display: flex; gap: 12px; align-items: flex-start; position: relative; }
.app-icon {
  width: 52px; height: 52px; border-radius: 14px; flex: 0 0 auto;
  object-fit: cover; background: var(--bg);
  border: 1px solid var(--line);
}
.app-icon.lg { width: 68px; height: 68px; border-radius: 18px; }
.app-icon.letter {
  display: grid; place-items: center;
  background: hsl(var(--h) 80% 94%); color: hsl(var(--h) 55% 40%);
  font-weight: 700; font-size: 22px; border: 0;
}
@media (prefers-color-scheme: dark) {
  .app-icon.letter { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 80% 76%); }
}
.card-info { min-width: 0; flex: 1; }
.card-info h3 {
  margin: 2px 0 4px; font-size: 15.5px; font-weight: 600; letter-spacing: -.1px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.card-info p {
  margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.badge-top {
  position: absolute; right: 0; top: 0;
  font-size: 11px; padding: 1px 7px; border-radius: 6px;
  background: #fff3e0; color: #c2410c;
}
@media (prefers-color-scheme: dark) { .badge-top { background: #3a2410; color: #f0b27a; } }
.card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.mini {
  font-size: 11.5px; color: var(--muted);
  background: var(--bg); border-radius: 6px; padding: 2px 8px;
}
.mini.time { margin-left: auto; background: transparent; padding: 0; }

/* 分页 */
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 26px; flex-wrap: wrap; }
.pg {
  min-width: 38px; height: 38px; padding: 0 12px;
  display: inline-grid; place-items: center;
  border-radius: 10px; background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px;
}
.pg:hover { color: var(--text); border-color: var(--brand); }
.pg.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* 空状态 */
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; margin: 0 auto 12px; opacity: .35; }
.empty p { margin: 0 0 4px; font-size: 15px; color: var(--text); }
.empty small { font-size: 13px; }

/* ============ 详情 ============ */
.crumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 14px;
  overflow: hidden; white-space: nowrap;
}
.crumb a:hover { color: var(--brand); }
.crumb em { font-style: normal; color: var(--text); opacity: .8; }

.detail {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px; align-items: start;
}
.soft-head {
  grid-column: 1 / -1;
  display: flex; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.soft-head-body { min-width: 0; }
.soft-head h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -.3px; }
.soft-head p { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-row span {
  font-size: 12px; color: var(--muted); background: var(--bg);
  border-radius: 6px; padding: 2px 9px;
}
.meta-row b { color: var(--brand); font-weight: 600; }

.detail-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 6px; padding: 2px 9px;
}

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.panel-title { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

/* markdown 正文 */
.md { font-size: 14.5px; line-height: 1.8; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.md h3, .md h4 { margin: 20px 0 8px; font-size: 15.5px; color: var(--text); }
.md h3:first-child, .md h4:first-child { margin-top: 0; }
.md p { margin: 0 0 12px; }
.md ul { margin: 0 0 12px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md blockquote {
  margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--brand);
  background: var(--brand-soft); border-radius: 0 8px 8px 0; color: var(--muted);
}
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em; background: var(--bg); border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px;
}
.md a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.tips ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.tips li { margin: 5px 0; }

/* 下载卡 */
.download { display: flex; flex-direction: column; gap: 12px; }
.dl-head { display: flex; align-items: center; justify-content: space-between; }
.dl-badge {
  font-size: 12.5px; font-weight: 600; color: #fff;
  background: var(--c, var(--brand)); border-radius: 8px; padding: 3px 10px;
}
.dl-ok { font-size: 12px; color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }
.dl-ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: 14px; font-weight: 500; text-align: center;
  transition: all .16s;
}
.btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--brand); }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(47, 107, 255, .22);
}
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.big { height: 48px; width: 100%; font-size: 15px; font-weight: 600; }
.btn.ghost { border-style: dashed; background: transparent; }
.btn svg { width: 16px; height: 16px; }

.code-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 10px; padding: 8px 12px;
  font-size: 13px; color: var(--muted);
}
.code-row strong {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--text); letter-spacing: 1px; font-size: 14px;
}
.copy {
  margin-left: auto; border: 1px solid var(--line); background: var(--card);
  color: var(--brand); font-size: 12px; padding: 3px 10px; border-radius: 7px;
}
.copy:hover { border-color: var(--brand); }

.hint { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.hint.warn { color: var(--warn); }

/* 解锁卡 */
.unlock { display: flex; flex-direction: column; gap: 12px; }
.unlock-head { display: flex; align-items: center; gap: 8px; }
.unlock-head h3 { margin: 0; font-size: 16px; }
.lock-dot {
  width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
  background: var(--brand-soft); position: relative;
}
.lock-dot::after {
  content: ""; position: absolute; inset: 7px;
  border: 2px solid var(--brand); border-radius: 3px;
}
.unlock-desc { margin: 0; font-size: 13px; color: var(--muted); }
.qr {
  width: 100%; max-width: 200px; margin: 2px auto;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 8px;
}
.qr.placeholder {
  display: grid; place-items: center; min-height: 150px;
  background: var(--bg); border-style: dashed;
  color: var(--muted); font-size: 12.5px; text-align: center;
}
.gzh-name { text-align: center; font-size: 13px; font-weight: 600; color: var(--brand); margin-top: -4px; }
.steps { margin: 0; padding-left: 20px; font-size: 13px; color: var(--muted); }
.steps li { margin: 3px 0; }
.bind {
  display: flex; align-items: center; gap: 10px;
  background: var(--brand-soft); border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent);
  border-radius: 12px; padding: 10px 14px;
}
.bind-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 20px; font-weight: 700; letter-spacing: 4px; color: var(--brand);
  flex: 1; text-align: center;
}
.bind .copy { background: var(--brand); color: #fff; border-color: var(--brand); }
.unlock-status { margin: 0; font-size: 12.5px; text-align: center; color: var(--brand); min-height: 18px; }

/* 相关推荐 */
.related .rel-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.related .rel-item:last-child { border-bottom: 0; padding-bottom: 0; }
.rel-item img, .rel-icon {
  width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto;
  object-fit: cover; border: 1px solid var(--line);
}
.rel-icon {
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: hsl(var(--h) 80% 94%); color: hsl(var(--h) 55% 40%); border: 0;
}
@media (prefers-color-scheme: dark) {
  .rel-icon { background: hsl(var(--h) 30% 20%); color: hsl(var(--h) 80% 76%); }
}
.rel-body { min-width: 0; display: flex; flex-direction: column; }
.rel-body strong { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-body small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rel-item:hover .rel-body strong { color: var(--brand); }

/* 错误页 */
.error-page { text-align: center; padding: 70px 20px; }
.error-code { font-size: 64px; font-weight: 800; color: var(--brand); line-height: 1; letter-spacing: -2px; }
.error-page h1 { font-size: 18px; margin: 14px 0 6px; }
.error-page p { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

/* 页脚 */
.footer { border-top: 1px solid var(--line); padding: 26px 0 34px; margin-top: 20px; }
.footer-note { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.footer-copy { margin: 0; font-size: 12px; color: var(--muted); opacity: .8; }
.footer-copy a { color: var(--muted); text-decoration: underline; }

/* ============ 移动端 ============ */
@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; gap: 14px; }
  .detail-side { position: static; order: 1; }
  .detail-main { order: 2; }
  .soft-head { order: 0; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 13px; }
  .topbar-inner { height: 56px; gap: 10px; }
  .brand-text small { display: none; }
  .brand-mark { width: 34px; height: 34px; font-size: 15px; border-radius: 10px; }
  .brand-text strong { font-size: 15px; }
  .search { height: 38px; padding-left: 34px; }
  .search-icon { left: 11px; width: 16px; height: 16px; }
  .search button { height: 30px; padding: 0 12px; font-size: 12.5px; }
  .main { padding-top: 16px; }
  .hero { padding: 2px 0 14px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 13px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px; }
  .app-icon { width: 46px; height: 46px; border-radius: 12px; }
  .app-icon.lg { width: 58px; height: 58px; border-radius: 15px; }
  .soft-head { padding: 15px; gap: 12px; }
  .soft-head h1 { font-size: 18px; }
  .panel { padding: 15px; }
  .list-head { margin-bottom: 10px; }
  .pg { min-width: 34px; height: 34px; font-size: 13px; }
  .qr { max-width: 170px; }
  .bind-code { font-size: 18px; letter-spacing: 3px; }
}
