:root {
  --bg: #12100e;
  --bg-soft: #1a1714;
  --surface: #221e19;
  --surface-2: #2b2620;
  --line: #3a332b;
  --line-soft: #2e2823;
  --gold: #d4a44a;
  --gold-dim: #8a6b2f;
  --text: #e8e0d0;
  --muted: #9a9186;
  --dim: #6f675d;
  --ok: #6ea86e;
  --warn: #d98f3f;
  --err: #cf6b5a;
  --radius: 10px;
  --font: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  border-bottom: 1px solid var(--line-soft);
  background: rgba(18, 16, 14, .92);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.topbar .container { display: flex; align-items: center; gap: 24px; height: 58px; }
.brand {
  font-size: 16px; font-weight: 600; color: var(--gold);
  letter-spacing: .5px; white-space: nowrap;
}
.brand small { display: block; font-size: 11px; color: var(--dim); font-weight: 400; letter-spacing: 1px; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: var(--muted); font-size: 13px; }
.nav a:hover, .nav a.on { color: var(--gold); text-decoration: none; }
.user-area { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user-area .name { color: var(--text); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: .15s; font-size: 13px; white-space: nowrap;
}
.btn:hover { border-color: var(--gold-dim); background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1408; font-weight: 600; }
.btn.primary:hover { background: #e2b45c; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.danger { border-color: #6b3630; color: var(--err); }

/* ---------- 首页 hero ---------- */
.hero {
  padding: 44px 0 28px;
  border-bottom: 1px solid var(--line-soft);
  background: radial-gradient(120% 100% at 50% 0%, rgba(212,164,74,.09), transparent 60%);
}
.hero h1 { font-size: 26px; font-weight: 600; letter-spacing: .5px; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 13px; }

.packbox {
  margin-top: 20px; padding: 16px 18px; border: 1px solid var(--gold-dim);
  border-radius: var(--radius); background: rgba(212,164,74,.06);
}
.packbox h3 { font-size: 14px; color: var(--gold); margin-bottom: 8px; }
.packbox .links { display: flex; flex-wrap: wrap; gap: 10px; }
.packbox .note { color: var(--dim); font-size: 12px; margin-top: 8px; }

/* ---------- 搜索 / 筛选 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 20px 0 14px; }
.search {
  flex: 1; min-width: 220px; display: flex; gap: 8px;
}
.search input, .field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.search input:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--gold-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line);
  font-size: 12px; color: var(--muted); cursor: pointer; background: transparent;
}
.chip:hover { border-color: var(--gold-dim); color: var(--text); }
.chip.on { background: var(--gold); border-color: var(--gold); color: #1a1408; font-weight: 600; }
select.sort {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid; gap: 16px; padding-bottom: 40px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; display: flex; flex-direction: column;
  transition: .15s;
}
.card:hover { border-color: var(--gold-dim); transform: translateY(-2px); }
.card .cover {
  aspect-ratio: 16 / 9; background: var(--bg-soft); display: flex;
  align-items: center; justify-content: center; color: var(--dim); font-size: 12px;
  background-size: cover; background-position: center;
}
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.card .title:hover { color: var(--gold); }
.card .author { font-size: 12px; color: var(--dim); }
.card .sum {
  font-size: 12px; color: var(--muted); display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .meta { display: flex; gap: 10px; font-size: 11px; color: var(--dim); margin-top: auto; padding-top: 6px; }
.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft);
}
.tag.cat { background: rgba(212,164,74,.12); color: var(--gold); border-color: transparent; }

/* ---------- 详情 ---------- */
.detail { display: grid; grid-template-columns: 1fr 300px; gap: 28px; padding: 24px 0 50px; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } }
.crumb { font-size: 12px; color: var(--dim); padding: 16px 0 0; }
.crumb a { color: var(--muted); }
h1.mod-title { font-size: 24px; font-weight: 600; margin: 10px 0 6px; }
.mod-sub { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.gallery { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0; }
.gallery img { height: 120px; border-radius: 8px; border: 1px solid var(--line-soft); cursor: pointer; flex: none; }
.hero-img {
  width: 100%; aspect-ratio: 16/9; border-radius: var(--radius);
  background: var(--bg-soft); background-size: cover; background-position: center;
  border: 1px solid var(--line-soft); margin-bottom: 14px;
}
.panel {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); padding: 16px 18px; margin-bottom: 16px;
}
.panel h3 { font-size: 14px; color: var(--gold); margin-bottom: 10px; font-weight: 600; }
.md { font-size: 14px; line-height: 1.8; color: var(--text); }
.md h1,.md h2,.md h3 { color: var(--gold); margin: 16px 0 8px; font-size: 15px; font-weight: 600; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0 8px 20px; }
.md li { margin: 3px 0; }
.md code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.md pre { background: var(--bg-soft); padding: 12px; border-radius: 8px; overflow-x: auto; margin: 10px 0; }
.md pre code { background: none; padding: 0; }
.md img { border-radius: 8px; margin: 10px 0; }
.md blockquote { border-left: 3px solid var(--gold-dim); padding-left: 12px; color: var(--muted); margin: 10px 0; }

.side .panel { padding: 14px 16px; }
.kv { display: flex; justify-content: space-between; font-size: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); }
.kv:last-child { border: 0; }
.kv .k { color: var(--dim); }
.kv .v { color: var(--text); text-align: right; }
.author-card { display: flex; gap: 12px; align-items: center; }
.author-card .av {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2);
  display: flex; align-items: center; justify-content: center; color: var(--gold); font-weight: 600;
  background-size: cover; flex: none;
}
.ext-links { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ext-links a { font-size: 12px; }

/* ---------- 表单 ---------- */
.form { max-width: 720px; padding: 24px 0 60px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field label .req { color: var(--err); }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.field .hint { font-size: 12px; color: var(--dim); margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 26px;
  text-align: center; color: var(--muted); cursor: pointer; background: var(--bg-soft);
}
.dropzone:hover, .dropzone.over { border-color: var(--gold-dim); background: var(--surface); }
.dropzone .big { color: var(--text); font-size: 14px; }
.file-info { margin-top: 10px; font-size: 12px; color: var(--ok); }

/* ---------- 列表页 ---------- */
.list { padding: 20px 0 50px; }
.list-item {
  display: flex; gap: 14px; align-items: center; padding: 12px 14px;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); margin-bottom: 10px;
}
.list-item .thumb {
  width: 64px; height: 44px; border-radius: 6px; background: var(--bg-soft);
  background-size: cover; background-position: center; flex: none;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .t { font-size: 14px; color: var(--text); }
.list-item .m { font-size: 12px; color: var(--dim); }
.list-item .ops { display: flex; gap: 8px; flex: none; }
.badge {
  padding: 1px 8px; border-radius: 4px; font-size: 11px; border: 1px solid;
}
.badge.pending { color: var(--warn); border-color: #6b4a24; background: rgba(217,143,63,.1); }
.badge.approved { color: var(--ok); border-color: #37502f; background: rgba(110,168,110,.1); }
.badge.rejected { color: var(--err); border-color: #6b3630; background: rgba(207,107,90,.1); }
.badge.update { color: #1a1408; background: var(--gold); border-color: var(--gold); font-weight: 600; }

/* ---------- 空状态 / 分页 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--dim); }
.empty .big { font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 10px 0 50px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 999;
  opacity: 0; transition: .2s; pointer-events: none; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: #6b3630; color: var(--err); }
.toast.ok { border-color: #37502f; color: var(--ok); }

/* ---------- 登录 ---------- */
.authbox {
  max-width: 380px; margin: 70px auto; padding: 26px;
  border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface);
}
.authbox h2 { font-size: 18px; margin-bottom: 4px; font-weight: 600; }
.authbox .sub { color: var(--dim); font-size: 12px; margin-bottom: 20px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button { flex: 1; }
.switch { text-align: center; margin-top: 16px; font-size: 12px; color: var(--dim); }

.footer {
  border-top: 1px solid var(--line-soft); padding: 24px 0; margin-top: 20px;
  color: var(--dim); font-size: 12px; text-align: center;
}
.footer a { color: var(--muted); }

.spinner {
  width: 18px; height: 18px; border: 2px solid var(--line);
  border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.warn-line { font-size: 12px; color: var(--dim); margin-top: 14px; line-height: 1.7; }

/* ---------- Wiki 布局 ---------- */
.wiki-layout {
  display: grid; grid-template-columns: 200px minmax(0, 1fr) 190px;
  gap: 28px; max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px;
}
@media (max-width: 1100px) { .wiki-layout { grid-template-columns: 200px minmax(0, 1fr); } .wiki-toc { display: none; } }
@media (max-width: 780px) { .wiki-layout { grid-template-columns: 1fr; } .wiki-side { display: none; } }

.wiki-side-inner, .wiki-toc-inner { position: sticky; top: 76px; }
.wiki-side-title {
  font-size: 13px; color: var(--gold); font-weight: 600;
  padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.wiki-side nav { display: flex; flex-direction: column; gap: 2px; }
.wiki-side nav a {
  font-size: 13px; color: var(--muted); padding: 5px 9px; border-radius: 6px;
}
.wiki-side nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.wiki-side nav a.on { background: var(--surface); color: var(--gold); }
.wiki-side-home { display: block; margin-top: 14px; font-size: 12px; color: var(--dim); }

.wiki-main { min-width: 0; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 26px 30px; }
@media (max-width: 780px) { .wiki-main { padding: 18px 16px; } }
.wiki-main h1 { font-size: 24px; color: var(--gold); margin-bottom: 6px; }
.wiki-main h2 { font-size: 18px; margin-top: 26px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.wiki-main h3 { font-size: 15px; margin-top: 18px; color: var(--gold); }
.wiki-main h4 { font-size: 14px; margin-top: 14px; color: var(--text); }
.wiki-foot { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--dim); }

.wiki-toc-inner { max-height: calc(100vh - 100px); overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.wiki-toc a { font-size: 12px; color: var(--dim); padding: 3px 8px; border-left: 2px solid var(--line-soft); }
.wiki-toc a:hover { color: var(--gold); border-left-color: var(--gold); text-decoration: none; }
.wiki-toc a.toc-3 { padding-left: 18px; font-size: 11px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 12px 0; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line-soft); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); color: var(--gold); font-weight: 600; white-space: nowrap; }
.md tbody tr:nth-child(even) { background: rgba(255, 255, 255, .015); }
.md tbody tr:hover { background: rgba(212, 164, 74, .06); }

/* ---------- 提示框 / 折叠块 ---------- */
.admo {
  margin: 14px 0; border-radius: 8px; border: 1px solid var(--line);
  border-left: 3px solid var(--dim); background: var(--bg-soft); overflow: hidden;
}
.admo-title { font-size: 13px; font-weight: 600; padding: 8px 14px 4px; }
.admo-body { padding: 4px 14px 12px; font-size: 13px; }
.admo-body > :first-child { margin-top: 0; }
.admo-body > :last-child { margin-bottom: 0; }

.admo.tip     { border-left-color: #3d8b6d; } .admo.tip .admo-title { color: #6fbf9b; }
.admo.note, .admo.info { border-left-color: #4a7ba7; } .admo.note .admo-title, .admo.info .admo-title { color: #7fb3e0; }
.admo.warning { border-left-color: #b8862f; } .admo.warning .admo-title { color: #e0b45c; }
.admo.danger  { border-left-color: #a84c3d; } .admo.danger .admo-title { color: #e08a7a; }
.admo.bug     { border-left-color: #8a5ca8; } .admo.bug .admo-title { color: #c08ae0; }
.admo.success { border-left-color: #3d8b6d; } .admo.success .admo-title { color: #6fbf9b; }
.admo.failure { border-left-color: #a84c3d; } .admo.failure .admo-title { color: #e08a7a; }

details.admo { cursor: pointer; }
details.admo summary {
  padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text);
  list-style: none; user-select: none;
}
details.admo summary::-webkit-details-marker { display: none; }
details.admo summary::before { content: '▸ '; color: var(--gold); }
details.admo[open] summary::before { content: '▾ '; }
details.admo .admo-body { border-top: 1px solid var(--line-soft); padding-top: 10px; }
