:root {
  --bg: #f7f8fa;
  --fg: #1b1f24;
  --muted: #6b7280;
  --card: #fff;
  --line: #e5e7eb;
  --brand: #1668dc;
  --brand-ink: #fff;
  --ok: #12a150;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a;
    --fg: #e6e8eb;
    --muted: #98a2b3;
    --card: #1a1e25;
    --line: #2a303a;
    --brand: #4b8ef8;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  background: var(--card); position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 700; font-size: 16px; color: var(--fg); }
.top nav a { margin-left: 16px; font-size: 14px; color: var(--muted); }
main { max-width: 1120px; margin: 0 auto; padding: 24px 20px 60px; }
h1 { font-size: 26px; margin: 8px 0 10px; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 760px; }
.filters { display: grid; gap: 10px; margin-bottom: 16px; }
.filters input, .filters select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--fg); font-size: 14px; outline: none;
}
.filters input:focus { border-color: var(--brand); }
.selects { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .selects { grid-template-columns: repeat(2, minmax(0, 1fr)); } h1 { font-size: 21px; } }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; flex-wrap: wrap; }
.count { color: var(--muted); font-size: 13px; }
.toolbar-btns { display: flex; gap: 8px; }
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--fg);
  padding: 9px 14px; border-radius: 10px; font-size: 14px; cursor: pointer; transition: .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.06); color: var(--brand-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; position: relative;
}
.card .cover { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; background: var(--line); }
.card h3 { font-size: 14px; line-height: 1.45; margin: 0; min-height: 40px; font-weight: 600; }
.card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 1px 7px; border-radius: 20px; }
.card .row { display: flex; gap: 8px; margin-top: auto; }
.card .row .btn { flex: 1; text-align: center; padding: 7px 8px; font-size: 13px; }
.card input[type=checkbox] { position: absolute; top: 18px; left: 18px; width: 18px; height: 18px; accent-color: var(--brand); }
.center { text-align: center; margin: 22px 0; }
.detail { max-width: 760px; }
.detail h1 { font-size: 24px; }
.detail .sub { color: var(--muted); margin-top: -4px; }
.detail .cover { max-width: 220px; width: 60%; border-radius: 10px; border: 1px solid var(--line); margin: 12px 0; }
.actions { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.note { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 18px 0; }
.note h2 { font-size: 16px; margin: 0 0 8px; }
.note ol { margin: 0; padding-left: 20px; color: var(--muted); }
.back { margin-top: 20px; }
.seo { margin-top: 44px; border-top: 1px solid var(--line); padding-top: 20px; }
.seo h2 { font-size: 17px; margin: 18px 0 8px; }
.seo p { color: var(--muted); font-size: 14px; }
.popular { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; padding: 0; list-style: none; font-size: 13px; }
.foot { border-top: 1px solid var(--line); padding: 20px; text-align: center; color: var(--muted); font-size: 12px; }
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal[hidden] { display: none; }
.modal .box { background: var(--card); border-radius: 16px; padding: 20px; max-width: 560px; width: 100%; max-height: 86vh; overflow: auto; }
.modal h2 { margin: 0 0 10px; font-size: 18px; }
.modal p, .modal li { color: var(--muted); font-size: 13px; }
.modal textarea { width: 100%; min-height: 76px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font: 12px/1.5 ui-monospace, monospace; }
.modal pre { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; overflow: auto; font-size: 11.5px; }
.modal .modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.dlpanel {
  position: fixed; right: 16px; bottom: 16px; width: 300px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; z-index: 55; box-shadow: 0 10px 30px rgba(0,0,0,.18); font-size: 12.5px;
}
.dlpanel[hidden] { display: none; }
.dlpanel .item { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.dlpanel .item:last-child { border-bottom: 0; }
.dlpanel .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlpanel .bar { height: 4px; background: var(--line); border-radius: 4px; margin-top: 5px; overflow: hidden; }
.dlpanel .bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
