/* ==========================================================================
   下载站 - 前台样式（极简版：白底、细边框、无渐变）
   ========================================================================== */

:root {
  --bg: #f7f7f8;
  --panel: #ffffff;
  --text: #16181d;
  --text-2: #3f434a;
  --muted: #74797f;
  --faint: #9aa0a6;
  --line: #e9e9ec;
  --line-strong: #dcdce0;
  --accent: #18181b;
  --radius: 12px;
  --radius-sm: 8px;
}

* { 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", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.4; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.main { min-height: 62vh; padding-bottom: 30px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__inner {
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
}

.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand__mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
}
.brand__mark svg { width: 16px; height: 16px; }
.brand__name { font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; }

.searchbar {
  flex: 1;
  max-width: 660px;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 4px 0 12px;
  background: #f4f4f5;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background .15s, border-color .15s;
}
.searchbar:focus-within { background: #fff; border-color: var(--line-strong); }
.searchbar__icon { width: 17px; height: 17px; color: var(--faint); flex: none; }
.searchbar__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 14px;
  padding: 0 8px;
}
.searchbar__input::placeholder { color: var(--faint); }
.searchbar__sep { width: 1px; height: 18px; background: var(--line-strong); flex: none; }
.searchbar__select {
  height: 30px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--muted);
  padding: 0 4px;
  max-width: 108px;
  cursor: pointer;
}
.searchbar__btn {
  height: 32px;
  padding: 0 16px;
  margin-left: 2px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  flex: none;
}
.searchbar__btn:hover { background: #000; }

.topbar__admin {
  margin-left: auto;
  flex: none;
  font-size: 13px;
  color: var(--muted);
}
.topbar__admin:hover { color: var(--text); }

/* ---------- 提示 ---------- */
.alert {
  margin: 16px 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.alert--success { color: #047857; border-color: #d7ecdf; background: #f2faf5; }
.alert--danger { color: #be123c; border-color: #f6d7de; background: #fdf3f5; }
.alert--warn { color: #b45309; border-color: #f0e2c4; background: #fdf9f0; }
.alert--info { color: var(--text-2); }

/* ---------- 结果栏 ---------- */
.resultbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 14px;
  font-size: 13px;
  color: var(--faint);
}
.resultbar__reset { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.resultbar__reset:hover { color: var(--text); }

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

.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.card:hover { border-color: var(--line-strong); }

.card__cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #f4f4f5;
  overflow: hidden;
}
.card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card__badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(22, 24, 29, .72);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
}
.card__pin {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid #f0e2c4;
  color: #b45309;
  font-size: 10.5px;
}

.card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 10px;
}
.card__title { font-size: 14.5px; font-weight: 600; }
.card__title a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__title a:hover { color: #000; text-decoration: underline; text-underline-offset: 3px; }
.card__desc {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: auto;
  font-size: 11.5px;
  color: var(--faint);
}
.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid #f2f2f4;
}
.card__stat { font-size: 11.5px; color: var(--faint); }

/* 无封面时的占位 */
.cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 12px;
  text-align: center;
  background: #f4f4f5;
  color: #6b7079;
}
.cover__ext { font-size: 20px; font-weight: 700; letter-spacing: .06em; }
.cover__title {
  font-size: 11px;
  color: var(--faint);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover--lg .cover__ext { font-size: 40px; }
.cover--lg .cover__title { font-size: 13px; }

.cover--tone-zip   { background: #fdf4e7; color: #a16207; }
.cover--tone-win   { background: #eef4fe; color: #1d4ed8; }
.cover--tone-app   { background: #ecf8f2; color: #047857; }
.cover--tone-img   { background: #f5eefe; color: #6d28d9; }
.cover--tone-doc   { background: #fdeef1; color: #be123c; }
.cover--tone-media { background: #fdeef6; color: #be185d; }
.cover--tone-file  { background: #f4f4f5; color: #52525b; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #000; }
.btn--ghost { background: var(--panel); border-color: var(--line-strong); color: var(--text-2); }
.btn--ghost:hover { border-color: var(--accent); color: var(--text); }
.btn--disabled { background: #f4f4f5; color: var(--faint); cursor: default; }
.btn--sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 7px; }
.btn--lg { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 10px; }
.btn--block { width: 100%; }

/* ---------- 空状态 ---------- */
.empty {
  padding: 70px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty__title { font-size: 15px; font-weight: 600; }
.empty__desc { font-size: 13px; color: var(--muted); }
.empty__desc a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 26px 0 6px;
}
.pager__item {
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-2);
  font-size: 13px;
}
.pager__item:hover { border-color: var(--line-strong); color: var(--text); }
.pager__item.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager__item.is-disabled { color: var(--faint); }
.pager__gap { color: var(--faint); padding: 0 2px; }

/* ---------- 详情页 ---------- */
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0 14px;
  font-size: 12.5px;
  color: var(--faint);
}
.crumb a:hover { color: var(--text); }
.crumb__current { color: var(--muted); max-width: 56vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.detail__main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail__side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 82px; }

.detail__head {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.detail__cover { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius-sm); overflow: hidden; background: #f4f4f5; }
.detail__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail__info { min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.detail__pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f4f4f5;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}
.pill--brand { color: var(--text-2); font-weight: 600; }
.detail__title { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.detail__summary { font-size: 13px; color: var(--muted); }
.detail__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 12px; color: var(--muted); background: #f4f4f5; padding: 2px 8px; border-radius: 4px; }
.tag:hover { color: var(--text); }
.detail__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.detail__tally { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--faint); }

.panel {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel__title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

.metagrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 18px; }
.metagrid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metagrid dt { font-size: 11.5px; color: var(--faint); }
.metagrid dd { margin: 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }

.prose { font-size: 13.5px; line-height: 1.85; color: var(--text-2); }
.prose p { margin: 0 0 10px; }

.hint {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.hint svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

.panel--download { padding: 16px; }
.dlbox { display: flex; flex-direction: column; gap: 11px; }
.dlbox__file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dlbox__ext {
  width: 38px; height: 38px; border-radius: var(--radius-sm); flex: none;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700;
}
.dlbox__text { min-width: 0; }
.dlbox__name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlbox__size { font-size: 11.5px; color: var(--faint); }
.dlbox__safe { font-size: 11.5px; color: var(--faint); text-align: center; }

.related { display: flex; flex-direction: column; gap: 10px; }
.related a { display: flex; align-items: center; gap: 10px; min-width: 0; }
.related__thumb {
  width: 44px; height: 34px; border-radius: 6px; flex: none;
  display: grid; place-items: center;
  font-size: 10.5px; font-weight: 700;
}
.related__text { min-width: 0; display: flex; flex-direction: column; }
.related__title { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related a:hover .related__title { text-decoration: underline; text-underline-offset: 3px; }
.related__meta { font-size: 11px; color: var(--faint); }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 40px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 20px;
  font-size: 12.5px;
  color: var(--faint);
}
.footer__brand { color: var(--text-2); font-weight: 600; }
.footer__desc { margin-top: 2px; }
.footer__right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer__right a:hover { color: var(--text); }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 16px; height: 16px; }
.to-top:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail__side { position: static; }
}

@media (max-width: 820px) {
  .topbar__inner { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 0 12px; }
  .searchbar { order: 3; flex-basis: 100%; max-width: none; }
  .topbar__admin { margin-left: auto; }
  .detail__head { grid-template-columns: minmax(0, 1fr); }
  .detail__cover { aspect-ratio: 16 / 9; }
  .detail__title { font-size: 19px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
}

@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .brand__name { font-size: 14.5px; }
  .searchbar { height: 38px; padding-left: 10px; }
  .searchbar__select { max-width: 82px; font-size: 12px; }
  .searchbar__btn { padding: 0 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .card__body { padding: 10px 11px 8px; }
  .card__foot { padding: 8px 11px; }
  .card__desc { display: none; }
  .detail__actions .btn { flex: 1; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
}
