/* 前台下载页样式（后台仍使用 style.css） */
:root {
  color-scheme: light dark;
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #f0f3f7; --text: #111827; --muted: #5b6474; --faint: #8a93a3;
  --line: #e3e7ee; --line-strong: #cfd6e0;
  --primary: #2563eb; --primary-hover: #1d4ed8; --primary-ink: #ffffff; --primary-soft: #e8efff;
  --fw: #2563eb; --fw-soft: #e8efff; --doc: #0f8a5f; --doc-soft: #e3f5ed;
  --hero-from: #eef3ff; --hero-to: #f5f7fa;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 12px; --control-h: 40px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --surface: #151a22; --surface-2: #1c222c; --text: #e6e9ef; --muted: #a0a8b6; --faint: #737c8c;
    --line: #262d38; --line-strong: #333c4a;
    --primary: #4c8dff; --primary-hover: #6a9fff; --primary-ink: #ffffff; --primary-soft: #1a2740;
    --fw: #6ea2ff; --fw-soft: #1a2740; --doc: #3ccf91; --doc-soft: #12291f;
    --hero-from: #131b2b; --hero-to: #0d1117;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column;
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
main { flex: 1; width: 100%; }
button { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 16px; min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.lang { display: flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 9px; flex: none; }
.lang button { border: 0; background: none; padding: 4px 12px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.lang button[aria-pressed=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }

/* 标题区与搜索 */
.hero { background: linear-gradient(180deg, var(--hero-from), var(--hero-to)); padding: 44px 0 32px; }
.hero h1 { margin: 0; font-size: 28px; line-height: 1.3; letter-spacing: -.01em; }
.hero-sub { margin: 8px 0 22px; color: var(--muted); }
.search { position: relative; display: flex; align-items: center; max-width: 640px; }
.search input { -webkit-appearance: none; appearance: none; width: 100%; height: 48px; padding: 0 44px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.search-icon { position: absolute; left: 15px; color: var(--faint); pointer-events: none; }
.search-clear { position: absolute; right: 8px; width: 32px; height: 32px; border: 0; background: none; border-radius: 8px;
  color: var(--faint); cursor: pointer; display: grid; place-items: center; }
.search-clear[hidden] { display: none; }
.search-clear:hover { background: var(--surface-2); color: var(--text); }

/* 筛选栏 */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 24px 0 16px; }
.seg { display: flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; height: var(--control-h); }
.seg button { border: 0; background: none; padding: 0 16px; border-radius: 7px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed=true] { background: var(--primary); color: var(--primary-ink); }
.select { position: relative; display: flex; align-items: center; }
.select select { -webkit-appearance: none; appearance: none; height: var(--control-h); padding: 0 36px 0 14px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; max-width: 240px; text-overflow: ellipsis; }
.select select:hover { border-color: var(--line-strong); }
.select select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.select svg { position: absolute; right: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.count { margin-left: auto; color: var(--muted); font-size: 14px; }

/* 文件列表 */
.list { display: grid; gap: 12px; padding-bottom: 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start; transition: border-color .15s; }
.card:hover { border-color: var(--line-strong); }
.icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; }
.icon svg { width: 22px; height: 22px; }
.icon.firmware { background: var(--fw-soft); color: var(--fw); }
.icon.doc { background: var(--doc-soft); color: var(--doc); }
.body { min-width: 0; }
.title { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 12px; line-height: 20px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.firmware { background: var(--fw-soft); color: var(--fw); }
.chip.doc { background: var(--doc-soft); color: var(--doc); }
.meta { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 8px; color: var(--faint); font-size: 13px; }
.desc { margin: 10px 0 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.desc.open { display: block; }
.more { border: 0; background: none; padding: 0; margin-top: 4px; color: var(--primary); font-size: 13px; cursor: pointer; }
.hash { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--faint); min-width: 0; }
.hash > span { white-space: nowrap; }
.hash code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.copy { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 1px 8px; font-size: 12px; color: var(--muted); cursor: pointer; flex: none; }
.copy:hover { color: var(--text); border-color: var(--line-strong); }
.dl { display: inline-flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 18px; border-radius: 10px;
  background: var(--primary); color: var(--primary-ink); text-decoration: none; font-weight: 500; white-space: nowrap; transition: background .15s; }
.dl:hover { background: var(--primary-hover); }

/* 状态：加载 / 空 / 错误 */
.skeleton { height: 112px; border-radius: var(--radius); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.state { text-align: center; padding: 56px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.state svg { width: 36px; height: 36px; color: var(--faint); stroke-width: 1.5; }
.state p { margin: 10px 0 0; }
.state button { margin-top: 14px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 6px 14px; cursor: pointer; }
.state button:hover { border-color: var(--primary); color: var(--primary); }

.footer { border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; padding: 20px 0; text-align: center; }

@media (max-width: 640px) {
  .hero { padding: 28px 0 22px; }
  .hero h1 { font-size: 22px; }
  .hero-sub { margin-bottom: 16px; font-size: 14px; }
  .filters { margin-top: 18px; }
  .seg { flex: 1; }
  .seg button { flex: 1; padding: 0 8px; }
  .select { flex: 1; }
  .select select { width: 100%; max-width: none; }
  .count { width: 100%; margin-left: 0; }
  .card { grid-template-columns: auto 1fr; padding: 16px; gap: 12px; }
  .icon { width: 38px; height: 38px; }
  .card .dl { grid-column: 1 / -1; justify-content: center; }
}
