/* ============================================================
   NISKLE WIKI 前台样式 — 苹果式 · 黑白蓝亮色 · H5 响应式
   参考主站 NISKLEWEB 设计系统
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-soft: #f4f7fb;
  --surface: rgba(15, 23, 42, 0.035);
  --surface-strong: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --text: #0a0f1a;
  --text-dim: rgba(10, 15, 26, 0.66);
  --text-faint: rgba(10, 15, 26, 0.44);
  --primary: #0284c7;
  --accent: #0ea5e9;
  --grad: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --grad-soft: linear-gradient(180deg, #e0f2fe, #ffffff);
  --radius: 18px;
  --radius-lg: 28px;
  --header-h: 64px;
  --sidebar-w: 280px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 26px); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border-radius: 999px; font-size: .98rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease, color .25s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 28px -8px rgba(2,132,199,.5), 0 4px 16px -6px rgba(14,165,233,.45); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px -8px rgba(2,132,199,.6); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-strong); backdrop-filter: blur(8px); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-danger-ghost { background: transparent; color: #be123c; border-color: rgba(225,29,72,.3); }
.btn-danger-ghost:hover { border-color: #be123c; }
.btn-sm { padding: 8px 18px; font-size: .88rem; }
.btn-block { width: 100%; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--header-h);
  display: flex; align-items: center;
  background: rgba(255,255,255,.62);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: background .35s ease, box-shadow .35s ease, border-color .35s ease;
}
.site-header.scrolled { background: rgba(255,255,255,.78); border-bottom-color: var(--border); box-shadow: 0 6px 24px -14px rgba(2,132,199,.25); }
.header-inner { display: flex; align-items: center; gap: 18px; height: 100%; }
.header-left { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { height: 32px; width: auto; }

.header-search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,.7);
  color: var(--text-faint); transition: border-color .2s ease, box-shadow .2s ease;
}
.header-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.15); color: var(--accent); }
.header-search input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .95rem; }

.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link { padding: 8px 14px; border-radius: 999px; font-size: .95rem; color: var(--text-dim); transition: color .2s, background .2s; }
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px rgba(2,132,199,.5); }
.nav-cta { margin-left: 6px; }

.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  padding: 8px;
  background: none; border: 0; border-radius: 8px; cursor: pointer; z-index: 110;
}
.nav-toggle span { display: block; height: 2px; width: 20px; background: var(--text); border-radius: 2px; transition: transform .3s, opacity .3s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.search-toggle {
  display: none; align-items: center; justify-content: center;
  margin-left: auto; padding: 8px;
  background: none; border: 0; border-radius: 8px;
  color: var(--text-dim); cursor: pointer; transition: color .2s;
}
.search-toggle:hover { color: var(--primary); }

/* ---------- 布局：侧栏 + 主内容 ---------- */
.layout { display: flex; min-height: 100svh; padding-top: var(--header-h); }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid var(--border);
  position: sticky; top: var(--header-h); height: calc(100svh - var(--header-h));
  overflow-y: auto; z-index: 50;
}
.sidebar-inner { padding: 18px 12px 40px; }
.sidebar-brand { font-weight: 800; font-size: 1.02rem; letter-spacing: .3px; padding: 6px 12px 14px; color: var(--text); }

.sidebar-quick { display: none; padding: 0 4px 14px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.sidebar-quick a { display: block; padding: 9px 12px; border-radius: 10px; font-size: .95rem; color: var(--text-dim); transition: color .2s, background .2s; }
.sidebar-quick a:hover { color: var(--text); background: var(--surface); }
.sidebar-quick a.active { color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px rgba(2,132,199,.5); }

.tree { padding-left: 0; }
.tree .tree { padding-left: 14px; border-left: 1px solid var(--border); margin-left: 12px; }
.tree-link {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px;
  color: var(--text-dim); font-size: .94rem; transition: background .2s, color .2s;
}
.tree-link svg { flex-shrink: 0; color: var(--text-faint); }
.tree-link:hover { background: var(--surface); color: var(--text); }
.tree-link:hover svg { color: var(--accent); }
li.active > .tree-link { color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px rgba(2,132,199,.5); }
li.active > .tree-link svg { color: #fff; }

.main { flex: 1; min-width: 0; }
.main > .container, .main #page { width: 100%; }
.sidebar-backdrop { display: none; }

/* 页头（内页） */
.page-wrap { padding: 40px 24px 90px; }
/* 文章页：内容靠左对齐（不随容器居中），目录贴着左侧导航栏 */
.page-wrap.page-wrap--article { max-width: none; margin: 0; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--text-faint); margin-bottom: 18px; flex-wrap: wrap; }
.crumbs a { color: var(--text-dim); }
.crumbs a:hover { color: var(--accent); }
.crumb-sep { color: var(--text-faint); }

.page-title-main {
  font-size: clamp(1.9rem, 4.5vw, 2.6rem); font-weight: 800; letter-spacing: -1px; margin-bottom: 22px;
  background: linear-gradient(180deg, #0a0f1a 40%, rgba(10,15,26,.6));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
}

.page-layout { display: flex; gap: 36px; align-items: flex-start; }
.page-toc {
  flex: 0 0 220px; position: sticky; top: calc(var(--header-h) + 30px);
  max-height: calc(100svh - var(--header-h) - 60px); overflow-y: auto;
  background: transparent; border: 0; box-shadow: none; padding: 0;
  /* 滚动条占位恒定：内容宽度不再随滑条显隐跳动（修复目录乱跳） */
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  -ms-overflow-style: auto;
}
/* 目录与左侧导航栏保留一点间距（桌面端），与正文保持间距 */
@media (min-width: 961px) {
  .page-toc { margin-left: -12px; }
}
/* 目录滑条：透明设计，滑条默认隐藏、滚动时短暂显示（仅变色，不改宽度） */
.page-toc::-webkit-scrollbar { width: 6px; }
.page-toc::-webkit-scrollbar-track { background: transparent; }
.page-toc::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.page-toc.scrolling::-webkit-scrollbar-thumb { background: rgba(15,23,42,.16); }
.page-toc.scrolling { scrollbar-color: rgba(15,23,42,.16) transparent; }
.toc-title {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 800; color: var(--primary);
  letter-spacing: .6px;
  padding: 2px 6px 9px; margin: 0 2px 8px;
  border-bottom: 1px solid rgba(14,165,233,.18);
}
.toc-title svg { flex-shrink: 0; color: var(--accent); }
.toc-list li { margin: 1px 0; }
.toc-list a {
  display: block; padding: 5px 8px 5px 10px; border-radius: 8px;
  color: var(--text-dim); font-size: .86rem; line-height: 1.5;
  border-left: 2px solid transparent; overflow-wrap: anywhere;
  transition: color .18s, background .18s, border-color .18s;
}
.toc-list a:hover { color: var(--accent); background: var(--surface-strong); border-left-color: rgba(14,165,233,.6); }
.toc-list a.active { color: var(--primary); background: rgba(14,165,233,.08); border-left-color: var(--accent); }
.toc-l2 a { padding-left: 18px; }
.toc-l3 a { padding-left: 30px; }
.toc-l4 a { padding-left: 42px; }
.page-body { flex: 1; min-width: 0; display: flex; justify-content: center; }
.page-main { width: 100%; min-width: 0; max-width: 820px; }

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; letter-spacing: -1px; line-height: 1.15; margin-bottom: 12px;
  background: linear-gradient(180deg, #0a0f1a 30%, rgba(10,15,26,.55));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.page-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); font-size: .84rem; transition: all .2s;
}
.tag:hover { color: var(--accent); border-color: var(--accent); background: rgba(14,165,233,.06); }
.tag em { font-style: normal; color: var(--text-faint); }
.tag-lg { padding: 6px 16px; font-size: .92rem; }
.tag-lg.active { background: var(--grad); color: #fff; border-color: transparent; }
.page-meta { color: var(--text-faint); font-size: .86rem; }
.page-actions { display: flex; gap: 10px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--border); }
.page-edit-btn { margin-top: 24px; }

/* 内容 Markdown */
.contents { line-height: 1.85; color: var(--text); overflow-wrap: break-word; word-break: break-word; min-width: 0; max-width: 100%; }
.contents a { overflow-wrap: anywhere; }
.contents h1 { font-size: 2rem; margin: 0 0 18px; font-weight: 800; letter-spacing: -.5px; }
.contents h2 { font-size: 1.65rem; font-weight: 800; margin: 34px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); letter-spacing: -.5px; }
.contents h3 { font-size: 1.3rem; font-weight: 700; margin: 26px 0 10px; }
.contents h4 { font-size: 1.1rem; font-weight: 700; margin: 20px 0 8px; }
.contents p { margin: 0 0 16px; }
.contents a { color: var(--accent); border-bottom: 1px solid rgba(14,165,233,.35); transition: border-color .2s, color .2s; }
.contents a:hover { color: var(--primary); border-bottom-color: var(--primary); }
.contents a.wiki-link { color: var(--primary); border-bottom: 1px dashed rgba(2,132,199,.4); }
.contents strong { font-weight: 700; }
.contents code { font-family: "SF Mono", Consolas, "JetBrains Mono", Menlo, monospace; font-size: .87em; background: var(--surface-strong); color: var(--primary); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; }
.contents pre { position: relative; background: #0f172a; color: #e2e8f0; border-radius: 14px; padding: 18px 20px; overflow: visible; max-width: 100%; margin: 18px 0; border: 1px solid var(--border-strong); box-shadow: 0 18px 40px -24px rgba(2,132,199,.4); }
/* 横向滚动放在 code 内部，复制按钮固定在 pre 上不随内容滚动 */
.contents pre code { display: block; overflow-x: auto; max-width: 100%; background: transparent; color: inherit; border: 0; padding: 0; -webkit-overflow-scrolling: touch; }
.contents pre::before { content: attr(data-lang); display: block; font-size: .75rem; color: rgba(226,232,240,.5); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.contents .code-copy { position: absolute; top: 10px; right: 12px; padding: 4px 10px; font-size: .75rem; line-height: 1.4; color: rgba(226,232,240,.75); background: rgba(148,163,184,.14); border: 1px solid rgba(148,163,184,.28); border-radius: 7px; cursor: pointer; transition: background .2s, color .2s; }
.contents .code-copy:hover { background: rgba(14,165,233,.28); color: #fff; }
.contents .code-copy.ok { color: #4ade80; border-color: rgba(74,222,128,.5); }
.contents .code-copy.err { color: #f87171; border-color: rgba(248,113,113,.5); }
.contents blockquote { margin: 20px 0; padding: 14px 20px; border-left: 4px solid var(--accent); border-radius: 0 14px 14px 0; background: var(--grad-soft); color: var(--text-dim); }
.contents blockquote p { margin: 0; }
.contents hr { border: 0; height: 1px; margin: 28px 0; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); }
.contents img { border-radius: 14px; box-shadow: 0 24px 60px -28px rgba(0,0,0,.5); margin: 14px 0; }
.contents .embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; margin: 18px 0; border: 1px solid var(--border); box-shadow: 0 24px 60px -28px rgba(2,132,199,.4); background: #000; }
.contents .embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.contents .embed-media { display: block; width: 100%; max-width: 820px; border-radius: 14px; margin: 18px 0; background: #000; box-shadow: 0 24px 60px -28px rgba(2,132,199,.4); }
.contents ul, .contents ol { padding-left: 24px; margin: 0 0 16px; }
.contents li { line-height: 1.85; }
.contents li::marker { color: var(--accent); }
.contents .table-container { overflow-x: auto; max-width: 100%; margin: 20px 0; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 14px 40px -24px rgba(2,132,199,.35); -webkit-overflow-scrolling: touch; }
.contents table { width: 100%; border-collapse: separate; border-spacing: 0; }
.contents th { background: #0ea5e9; color: #fff; font-weight: 600; text-align: left; padding: 12px 16px; }
.contents td { padding: 11px 16px; border-top: 1px solid var(--border); color: var(--text); }
.contents tr:nth-child(even) td { background: var(--surface); }
.contents tr:hover td { background: rgba(14,165,233,.06); }

/* 任务列表 */
.contents li.task-list-item { list-style: none; }
.contents li.task-list-item input[type="checkbox"] { accent-color: var(--primary); margin-right: 8px; transform: translateY(1px); }

/* 脚注 */
.contents .footnotes { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--border); font-size: .92em; color: var(--text-dim); }
.contents .footnotes h2 { font-size: 1.05rem; border-bottom: 0; margin: 0 0 12px; padding: 0; letter-spacing: 0; }
.contents .footnotes ol { padding-left: 22px; margin: 0; }
.contents .footnotes li { margin-bottom: 8px; }
.contents .fn-back { border: 0 !important; margin-left: 6px; text-decoration: none; }
.contents sup.footnote-ref a { border: 0; font-weight: 600; }

/* 历史版本横幅 */
.rev-banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; background: rgba(234,179,8,.1); border: 1px solid rgba(234,179,8,.3); color: #92400e; margin-bottom: 20px; font-size: .9rem; }
.rev-banner a { color: var(--primary); font-weight: 600; }

/* ---------- 首页 Hero ---------- */
.hero { position: relative; min-height: 78svh; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: calc(var(--header-h) + 40px) 0 80px; }
.fluid-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; filter: blur(30px) contrast(150%) saturate(160%); transform: scale(1.12); }
.hero-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(120% 90% at 50% 10%, transparent 40%, rgba(15,23,42,.06) 100%), linear-gradient(180deg, rgba(255,255,255,.6), transparent 30%, transparent 70%, var(--bg) 100%); }
.hero-content { position: relative; z-index: 2; text-align: center; }
.hero-title { font-size: clamp(2.6rem, 7vw, 4.8rem); font-weight: 800; line-height: 1.08; letter-spacing: -1.5px; margin-bottom: 24px;
  background: linear-gradient(180deg, #0a0f1a 30%, rgba(10,15,26,.55)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: 0 0 60px rgba(14,165,233,.2); }
.hero-sub { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--text-dim); max-width: 680px; margin: 0 auto 36px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.scroll-hint { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 2; width: 26px; height: 42px; border: 2px solid rgba(15,23,42,.3); border-radius: 14px; display: flex; justify-content: center; padding-top: 8px; }
.scroll-hint span { width: 4px; height: 8px; border-radius: 4px; background: var(--accent); animation: scrollDot 1.8s ease-in-out infinite; }
@keyframes scrollDot { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { transform: translateY(0); opacity: 0; } }

/* ---------- 区块 / 卡片 ---------- */
.section { padding: 30px 0 70px; }
.section-title { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -1px; margin-bottom: 24px;
  background: linear-gradient(180deg, #0a0f1a 40%, rgba(10,15,26,.6)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { display: block; padding: 28px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(14px); position: relative; overflow: hidden; transition: transform .3s, border-color .3s, box-shadow .3s, background .3s; }
.card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 0%, rgba(14,165,233,.14), transparent 60%); opacity: 0; transition: opacity .3s; }
.card:hover { transform: translateY(-6px); border-color: var(--border-strong); background: var(--surface-strong); box-shadow: 0 24px 60px -24px rgba(2,132,199,.4); }
.card:hover::before { opacity: 1; }
.card-icon { width: 50px; height: 50px; border-radius: 16px; background: var(--surface-strong); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--accent); margin-bottom: 16px; }
.card-icon svg { width: 24px; height: 24px; }
.card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.card p { color: var(--text-dim); font-size: .92rem; }
.card-date { color: var(--text-faint); font-size: .8rem; }
.card a { position: relative; z-index: 1; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.empty-tip { color: var(--text-dim); padding: 20px 0; }
.empty-tip a { color: var(--accent); }

/* ---------- 搜索 ---------- */
.search-big { display: flex; align-items: center; gap: 10px; max-width: 640px; padding: 10px 16px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text-faint); margin-bottom: 24px; }
.search-big:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
.search-big input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 1.02rem; color: var(--text); }
.search-count { color: var(--text-faint); font-size: .9rem; margin-bottom: 14px; }
.search-results { display: flex; flex-direction: column; gap: 14px; }
.search-item { display: block; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform .25s, border-color .25s, box-shadow .25s; }
.search-item:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 18px 44px -22px rgba(2,132,199,.4); }
.search-item h3 { font-size: 1.15rem; margin-bottom: 4px; color: var(--text); }
.search-path { color: var(--accent); font-size: .84rem; margin-bottom: 6px; }
.search-excerpt { color: var(--text-dim); font-size: .92rem; }

/* ---------- 历史 ---------- */
.history-list, .rev-list, .admin-list { display: flex; flex-direction: column; gap: 10px; }
.history-item, .rev-item, .admin-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); flex-wrap: wrap; }
.history-item:hover { border-color: var(--accent); }
.history-item strong { flex: 1; }
.history-item span { color: var(--text-dim); font-size: .86rem; }
.history-item em, .admin-row em { color: var(--text-faint); font-size: .82rem; font-style: normal; }
.rev-item { justify-content: space-between; }
.rev-info { color: var(--text-dim); font-size: .9rem; }
.rev-actions { display: flex; gap: 8px; }
.history-meta { display: flex; gap: 12px; align-items: center; color: var(--text-dim); margin-bottom: 20px; }
.admin-row > strong { flex: 1; }
.admin-row > span { color: var(--text-dim); font-size: .86rem; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: .84rem; width: 130px; }

/* ---------- 页脚 ---------- */
.site-footer { border-top: 1px solid var(--border); background: linear-gradient(180deg, transparent, rgba(14,165,233,.05)); padding: 34px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--text-faint); font-size: .88rem; }
.footer-inner a { color: var(--accent); }
.footer-copy { color: var(--text-faint); opacity: .85; }

/* ---------- Flash / Alert ---------- */
.flash-wrap { position: fixed; top: calc(var(--header-h) + 12px); left: 50%; transform: translateX(-50%); z-index: 200; width: min(92vw, 480px); }
.alert-box { border-radius: 12px; padding: 12px 16px; font-size: .92rem; margin-bottom: 14px; backdrop-filter: blur(8px); }
.alert-box.ok { background: rgba(5,150,105,.1); border: 1px solid rgba(5,150,105,.3); color: #047857; }
.alert-box.err { background: rgba(225,29,72,.08); border: 1px solid rgba(225,29,72,.3); color: #be123c; }

/* ---------- 登录 / 认证 ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 70px 24px; }
.auth-card { width: 100%; max-width: 400px; padding: 36px 30px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); box-shadow: 0 24px 60px -26px rgba(2,132,199,.35); }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.auth-sub { color: var(--text-dim); font-size: .92rem; margin-bottom: 22px; }
.auth-card label { display: block; font-size: .86rem; color: var(--text-dim); margin: 14px 0 6px; }
.auth-card input { width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 12px; font-size: .95rem; outline: none; }
.auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
.auth-card .btn { margin-top: 22px; }
.auth-back { display: inline-block; margin-top: 16px; color: var(--text-faint); font-size: .86rem; }
.auth-back:hover { color: var(--accent); }

/* ---------- 编辑页 ---------- */
.edit-wrap { max-width: 1180px; }
.edit-grid { display: grid; grid-template-columns: 1fr 280px; gap: 26px; align-items: start; }
.edit-main label, .edit-side label, .settings-form label, .upload-form label { display: block; font-size: .86rem; color: var(--text-dim); margin: 14px 0 6px; }
.edit-main input, .edit-side input, .settings-form input, .settings-form textarea, .settings-form select, .upload-form input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: .95rem; outline: none; background: var(--bg); color: var(--text);
}
.edit-main input:focus, .edit-side input:focus, .settings-form input:focus, .settings-form textarea:focus, .settings-form select:focus, .upload-form input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.18);
}
.md-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.md-toolbar button { padding: 6px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text-dim); cursor: pointer; font-size: .9rem; transition: all .2s; }
.md-toolbar button:hover { color: var(--accent); border-color: var(--accent); background: rgba(14,165,233,.06); }
#content { width: 100%; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 12px; font-family: "SF Mono", Consolas, Menlo, monospace; font-size: .92rem; line-height: 1.7; resize: vertical; outline: none; background: var(--bg); color: var(--text); }
#content:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14,165,233,.18); }
.edit-side { position: sticky; top: calc(var(--header-h) + 24px); }
.edit-help { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: .86rem; }
.edit-help h4 { font-size: .95rem; margin-bottom: 10px; }
.edit-help li { margin: 5px 0; color: var(--text-dim); }
.edit-help code { font-size: .8em; background: var(--surface-strong); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.hint { color: var(--text-faint); font-size: .8rem; margin-top: 4px; }
.edit-actions { display: flex; gap: 12px; margin-top: 26px; }
.preview-panel { margin-top: 30px; padding: 26px; border: 1px solid var(--accent); border-radius: var(--radius-lg); background: var(--bg-soft); }
.preview-panel h3 { margin-bottom: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.settings-form select { width: auto; }

/* ---------- 后台 ---------- */
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.admin-link { padding: 8px 16px; border-radius: 999px; font-size: .92rem; color: var(--text-dim); border: 1px solid transparent; transition: all .2s; }
.admin-link:hover { color: var(--text); background: var(--surface); }
.admin-link.active { color: #fff; background: var(--grad); box-shadow: 0 6px 18px -6px rgba(2,132,199,.5); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin-bottom: 34px; }
.stat-card { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-align: center; }
.stat-card strong { display: block; font-size: 2rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.stat-card span { color: var(--text-dim); font-size: .9rem; }
.admin-user { color: var(--text-faint); font-size: .86rem; margin-top: 24px; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 80px 0; }
.notfound h1 { font-size: 4rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
.notfound p { color: var(--text-dim); margin: 12px 0 24px; }

/* 上传 */
.upload-form { max-width: 520px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.upload-result { padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); margin-bottom: 20px; }
.upload-result p { margin: 6px 0; color: var(--text-dim); font-size: .92rem; }
.upload-list { display: flex; flex-direction: column; gap: 8px; }
.upload-item { display: flex; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: .9rem; }
.upload-item:hover { border-color: var(--accent); }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .header-search { display: none; }
  .header-search.open { display: flex; order: 3; flex-basis: 100%; margin-top: -6px; }
  .header-inner { flex-wrap: wrap; padding: 10px 16px; height: auto; min-height: var(--header-h); }
  .site-header { position: fixed; top: 0; left: 0; right: 0; height: auto; }
  .search-toggle { display: flex; }
  .hero { padding-top: 40px; }
  body { padding-top: var(--header-h); }
  .layout { padding-top: 0; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100svh; width: min(82vw, 320px); transform: translateX(-100%); transition: transform .35s cubic-bezier(.2,.65,.25,1); z-index: 120; border-right: 1px solid var(--border); background: rgba(255,255,255,.94); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.35); backdrop-filter: blur(3px); z-index: 115; opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .nav-toggle { display: flex; }
  .sidebar-quick { display: block; }
  .site-nav { position: fixed; top: 0; right: 0; height: 100svh; width: min(78vw, 320px); flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; padding: calc(var(--header-h) + 20px) 26px 40px; background: rgba(255,255,255,.92); backdrop-filter: blur(24px); border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .35s; z-index: 120; }
  .site-nav.open { transform: translateX(0); }
  .site-nav .nav-link, .site-nav .nav-cta { width: 100%; font-size: 1.1rem; padding: 12px 16px; border-radius: 14px; }
  .nav-cta { margin: 14px 0 0; }
  .page-layout { flex-direction: column; align-items: stretch; }
  .page-body { width: 100%; }
  .page-main { width: 100%; min-width: 0; }
  .page-toc { flex: none; width: 100%; position: static; max-height: none; margin-bottom: 22px; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-side { position: static; }
  .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .hero { min-height: 70svh; }
  .hero-actions .btn { flex: 1 1 100%; }
  .card-grid { grid-template-columns: 1fr; }
  .page-wrap { padding: 26px 20px 70px; }
  .footer-inner { justify-content: center; text-align: center; }
}
