/* ==========================================================
   HCIA-Datacom 学习空间 · 设计系统
   风格：清新、通透、柔光
   ========================================================== */

:root {
  --bg: #f4f8fb;
  --bg-grad-1: rgba(70, 179, 157, .18);
  --bg-grad-2: rgba(61, 139, 255, .14);
  --bg-grad-3: rgba(124, 92, 240, .10);

  --surface: #ffffff;
  --surface-2: #f8fbfe;
  --surface-3: #eef5fa;
  --border: #e2ecf4;
  --border-2: #d3e3ee;

  --text: #17293a;
  --text-2: #55708a;
  --text-3: #8ba3b8;

  --brand: #2f8f7f;
  --brand-2: #46b39d;
  --brand-soft: #e6f6f2;
  --accent: #3d8bff;
  --accent-2: #7cc0ff;
  --accent-soft: #e8f2ff;
  --warn: #e0912f;
  --danger: #e2606a;
  --danger-soft: #fdecee;

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 22px;
  --shadow-xs: 0 1px 2px rgba(23, 41, 58, .04);
  --shadow-sm: 0 2px 6px rgba(23, 41, 58, .05), 0 8px 20px -8px rgba(23, 41, 58, .10);
  --shadow-md: 0 8px 28px -10px rgba(23, 41, 58, .18), 0 2px 8px rgba(23, 41, 58, .04);
  --shadow-lg: 0 24px 60px -20px rgba(23, 41, 58, .26);

  --header-h: 62px;
  --maxw: 1280px;
  --app-vw: 100vw;
  --app-vh: 100vh;
  --page-max: 1280px;
  --page-wide: 1560px;
  --ease: cubic-bezier(.32, .72, .28, 1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
}

html[data-theme="dark"] {
  --bg: #0e1620;
  --bg-grad-1: rgba(70, 179, 157, .14);
  --bg-grad-2: rgba(61, 139, 255, .12);
  --bg-grad-3: rgba(124, 92, 240, .10);

  --surface: #16212e;
  --surface-2: #1b2837;
  --surface-3: #223243;
  --border: #27384a;
  --border-2: #33475c;

  --text: #e8f0f7;
  --text-2: #a3b8ca;
  --text-3: #6f889f;

  --brand: #4fc3ab;
  --brand-2: #6bd6bd;
  --brand-soft: #14342f;
  --accent: #5aa4ff;
  --accent-2: #8cc6ff;
  --accent-soft: #14263d;
  --danger-soft: #3a2024;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, .28), 0 8px 20px -8px rgba(0, 0, 0, .5);
  --shadow-md: 0 8px 28px -10px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }

@supports (height: 100dvh) { :root { --app-vh: 100dvh; } }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: var(--app-vh);
  transition: background .3s var(--ease), color .3s var(--ease);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vw 60vw at 8% -6%, var(--bg-grad-1), transparent 62%),
    radial-gradient(52vw 52vw at 96% 4%, var(--bg-grad-2), transparent 60%),
    radial-gradient(48vw 48vw at 46% 108%, var(--bg-grad-3), transparent 62%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--brand-soft); color: var(--text); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ========================= 顶栏 ========================= */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 70%, transparent);
  color: #fff; font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 15px; white-space: nowrap; }
.brand-text span { font-size: 11px; color: var(--text-3); letter-spacing: .6px; font-weight: 500; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.nav a {
  padding: 7px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  color: var(--text-2); transition: all .18s var(--ease); white-space: nowrap;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 11px; padding: 7px 12px; width: 240px;
  transition: all .2s var(--ease); cursor: text;
}
.searchbox:focus-within {
  border-color: var(--brand-2); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 16%, transparent);
  width: 300px;
}
.searchbox svg { flex: none; color: var(--text-3); }
.searchbox input {
  border: 0; background: transparent; outline: none; width: 100%; font-size: 14px;
}
.searchbox input::placeholder { color: var(--text-3); }
.kbd {
  font-size: 11px; padding: 1px 6px; border-radius: 6px; color: var(--text-3);
  border: 1px solid var(--border-2); background: var(--surface); font-family: var(--mono);
}

.icon-btn {
  width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid transparent;
  background: transparent; display: grid; place-items: center; cursor: pointer;
  color: var(--text-2); transition: all .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.avatar-btn {
  display: flex; align-items: center; gap: 9px; padding: 4px 11px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: all .18s var(--ease);
}
.avatar-btn:hover { border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  color: #fff; font-size: 13px; font-weight: 700;
}
.avatar-btn .who { font-size: 13px; font-weight: 600; }
.avatar-btn .role { font-size: 11px; color: var(--text-3); }

/* ========================= 布局 ========================= */
.page { width: 100%; max-width: min(var(--page-max), calc(var(--app-vw) - 44px)); margin: 0 auto; padding: 26px 22px 90px; }
.page.wide { max-width: min(var(--page-wide), calc(var(--app-vw) - 44px)); }

.view { animation: fadeUp .38s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: flex-end; gap: 14px; margin: 34px 0 16px; }
.section-head h2 { margin: 0; font-size: 20px; letter-spacing: -.2px; }
.section-head p { margin: 0; color: var(--text-3); font-size: 13px; }
.section-head .spacer { flex: 1; }

/* ========================= 通用组件 ========================= */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: all .24s var(--ease);
}
.card.pad { padding: 20px 22px; }
.card.hoverable:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2);
}

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 17px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .18s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--border-2); box-shadow: var(--shadow-xs); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand) 85%, transparent);
}
.btn.primary:hover { box-shadow: 0 12px 26px -10px color-mix(in srgb, var(--brand) 90%, transparent); }
.btn.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); box-shadow: none; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.danger {
  background: linear-gradient(135deg, var(--danger), color-mix(in srgb, var(--danger) 72%, #ff9aa2));
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--danger) 80%, transparent);
}
.btn[disabled] { opacity: .45; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.chip.brand { background: var(--brand-soft); color: var(--brand); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }

.input, .textarea, .select {
  width: 100%; padding: 10px 13px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2);
  outline: none; transition: all .18s var(--ease); font-size: 14px;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-2); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 15%, transparent);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

/* ========================= 首页 Hero ========================= */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-l); padding: 40px 42px;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--brand-soft) 92%, var(--surface)) 0%,
    color-mix(in srgb, var(--accent-soft) 85%, var(--surface)) 55%,
    var(--surface) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.hero::after {
  content: ""; position: absolute; right: -110px; top: -130px; width: 420px; height: 420px;
  border-radius: 50%; background: radial-gradient(circle at 32% 32%, var(--bg-grad-1), transparent 68%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.35fr .95fr; gap: 36px; align-items: center; position: relative; }
.hero h1 { margin: 0 0 12px; font-size: 33px; line-height: 1.3; letter-spacing: -.7px; }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin: 0 0 22px; color: var(--text-2); font-size: 15.5px; max-width: 560px; }
.hero-actions { display: flex; gap: 11px; flex-wrap: wrap; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.profile-mini {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--radius-l);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.profile-mini .pm-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-mini .pm-avatar {
  width: 60px; height: 60px; border-radius: 19px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  color: #fff; font-size: 24px; font-weight: 700;
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--brand) 90%, transparent);
  overflow: hidden;
}
.profile-mini .pm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-mini .pm-name { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.profile-mini .pm-sub { font-size: 13px; color: var(--text-3); }
.pm-meta { display: grid; gap: 9px; }
.pm-meta .row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.pm-meta .row svg { color: var(--text-3); flex: none; }

/* 数据卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 19px; box-shadow: var(--shadow-xs); transition: all .22s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat .k { font-size: 12.5px; color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 750; letter-spacing: -.8px; margin-top: 5px; }
.stat .v small { font-size: 13px; font-weight: 600; color: var(--text-3); margin-left: 3px; }
.stat .v.grad { background: linear-gradient(120deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.quick {
  display: flex; gap: 14px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); transition: all .22s var(--ease); cursor: pointer; text-align: left;
}
.quick:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.quick .qi {
  width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.quick > span:last-child { display: block; min-width: 0; }
.quick .qt { display: block; font-weight: 650; font-size: 14.5px; margin-bottom: 3px; }
.quick .qd { display: block; font-size: 12.5px; color: var(--text-3); line-height: 1.55; }

/* 文档卡 */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.doc-card {
  position: relative; overflow: hidden; padding: 20px 21px 18px; cursor: pointer;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); transition: all .24s var(--ease);
}
.doc-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.doc-card .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.doc-card .dt { font-size: 16px; font-weight: 700; margin: 0 0 5px; letter-spacing: -.2px; }
.doc-card .dd { font-size: 12.5px; color: var(--text-3); margin: 0 0 15px; min-height: 34px; line-height: 1.5; }
.doc-card .dm { display: flex; gap: 7px; flex-wrap: wrap; }
.doc-card .progress-line { margin-top: 15px; }
.doc-card .arrow { position: absolute; right: 18px; top: 20px; color: var(--text-3); transition: all .24s var(--ease); }
.doc-card:hover .arrow { color: var(--brand); transform: translateX(3px); }

.progress-track { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-2), var(--accent));
  transition: width .5s var(--ease);
}

/* ========================= 学习中心 ========================= */
.learn-layout { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }

.side {
  position: sticky; top: calc(var(--header-h) + 18px);
  max-height: calc(var(--app-vh) - var(--header-h) - 40px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-xs);
}
.side::-webkit-scrollbar { width: 7px; }

.side-pages {
  max-height: 46vh; overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 5px; background: var(--surface-2);
}
.side-pages::-webkit-scrollbar { width: 7px; }

.doc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-tab {
  padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  cursor: pointer; transition: all .18s var(--ease);
}
.doc-tab:hover { border-color: var(--border-2); color: var(--text); }
.doc-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.tree { list-style: none; margin: 0; padding: 0; }
.tree .node { margin-bottom: 2px; }
.tree .node > .link {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 9px; cursor: pointer; font-size: 13.5px; color: var(--text-2);
  transition: all .16s var(--ease);
}
.tree .node > .link:hover { background: var(--surface-3); color: var(--text); }
.tree .node > .link.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.tree .node > .link .num {
  font-family: var(--mono); font-size: 11px; color: var(--text-3); flex: none; min-width: 20px;
}
.tree .node > .link .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .node > .link .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); flex: none;
}
.tree .sub { list-style: none; margin: 2px 0 4px; padding: 0 0 0 20px; }
.tree .sub li {
  padding: 5px 9px; border-radius: 8px; font-size: 12.5px; color: var(--text-3);
  cursor: pointer; transition: all .16s var(--ease);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree .sub li:hover { background: var(--surface-3); color: var(--text-2); }
.tree .sub li.active { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

/* ========================= 阅读器 ========================= */
.reader-layout { display: grid; grid-template-columns: 296px minmax(0, 1fr); gap: 20px; align-items: start; }

.reader-main {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  min-height: 60vh;
}
.reader-bar {
  position: sticky; top: var(--header-h); z-index: 20;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px);
}
.reader-bar .crumb { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 7px; min-width: 0; }
.reader-bar .crumb b { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-bar .spacer { flex: 1; }

.seg {
  display: flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px;
}
.seg button {
  padding: 5px 12px; border-radius: 7px; border: 0; background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--text-3); cursor: pointer;
  transition: all .18s var(--ease);
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.reader-body { padding: 26px 30px 40px; }
.reader-body.narrow { max-width: 860px; margin: 0 auto; }

.page-head {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px;
  padding-bottom: 14px; border-bottom: 1px dashed var(--border);
}
.page-head .pn {
  font-family: var(--mono); font-size: 12px; color: var(--brand); font-weight: 700;
  background: var(--brand-soft); padding: 2px 9px; border-radius: 7px; flex: none;
}
.page-head h2 { margin: 0; font-size: 19px; letter-spacing: -.3px; }
.page-head .spacer { flex: 1; }

/* 幻灯片视图 */
.slide-wrap {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  background: var(--surface-2); box-shadow: var(--shadow-xs);
}
.slide-wrap img { width: 100%; height: auto; cursor: zoom-in; }

/* 结构化正文 */
.prose { font-size: var(--read-fs, 15.5px); line-height: 1.85; color: var(--text); }
.prose h3 {
  font-size: 1.15em; margin: 30px 0 12px; padding-left: 12px;
  border-left: 3px solid var(--brand-2); letter-spacing: -.2px; line-height: 1.5;
}
.prose h3:first-child { margin-top: 4px; }
.prose h4 { font-size: 1.02em; margin: 22px 0 9px; color: var(--text); }
.prose p { margin: 0 0 13px; }
.prose ul { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin-bottom: 7px; }
.prose img {
  margin: 16px auto; border-radius: var(--radius-s); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs); cursor: zoom-in;
}
.prose .codeblock {
  position: relative; margin: 15px 0; border-radius: var(--radius-s); overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--border);
}
.prose .codeblock pre {
  margin: 0; padding: 15px 16px; overflow-x: auto; font-family: var(--mono);
  font-size: 13px; line-height: 1.75; white-space: pre; color: var(--text);
}
.prose .codeblock .copy {
  position: absolute; right: 9px; top: 9px; padding: 4px 10px; font-size: 11.5px;
  border-radius: 7px; border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text-2); cursor: pointer; opacity: 0; transition: all .18s var(--ease);
  font-weight: 600;
}
.prose .codeblock:hover .copy { opacity: 1; }
.prose .codeblock .copy:hover { color: var(--brand); border-color: var(--brand-2); }

/* 文字版（幻灯片模式） */
.textsheet {
  white-space: pre-wrap; font-size: 14.5px; line-height: 1.9; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}

/* 底部翻页 */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 30px; }
.pager .jump {
  display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-3);
  font-family: var(--mono);
}
.pager .jump input {
  width: 62px; text-align: center; padding: 6px 8px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none;
  font-family: var(--mono); font-size: 13px;
}

/* 笔记面板 */
.note-panel {
  margin-top: 22px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); padding: 18px 20px;
}
.note-panel .np-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 12px;
  font-size: 13.5px; font-weight: 650;
}
.note-list { display: grid; gap: 9px; margin-top: 12px; }
.note-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 11px 13px; font-size: 13.5px; position: relative;
}
.note-item .meta { font-size: 11.5px; color: var(--text-3); margin-bottom: 5px; display: flex; gap: 8px; align-items: center; }
.note-item .del {
  position: absolute; right: 8px; top: 8px; border: 0; background: transparent;
  color: var(--text-3); cursor: pointer; padding: 3px; border-radius: 6px; opacity: 0;
  transition: all .18s var(--ease);
}
.note-item:hover .del { opacity: 1; }
.note-item .del:hover { color: var(--danger); background: var(--danger-soft); }

/* ========================= 检索 ========================= */
.search-hero { text-align: center; padding: 34px 0 8px; }
.search-hero h1 { margin: 0 0 9px; font-size: 28px; letter-spacing: -.6px; }
.search-hero p { margin: 0 0 22px; color: var(--text-3); font-size: 14px; }
.search-big {
  display: flex; align-items: center; gap: 11px; max-width: 660px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 15px;
  padding: 13px 18px; box-shadow: var(--shadow-sm); transition: all .2s var(--ease);
}
.search-big:focus-within { box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand-2) 16%, transparent); border-color: var(--brand-2); }
.search-big input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; }
.search-filters { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }

.result-list { display: grid; gap: 12px; margin-top: 22px; }
.result {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 19px; cursor: pointer; transition: all .2s var(--ease);
}
.result:hover { border-color: var(--brand-2); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.result .r-top { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; flex-wrap: wrap; }
.result .r-doc { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 6px; }
.result .r-loc { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.result .r-txt { font-size: 14px; color: var(--text-2); line-height: 1.75; }
.result mark {
  background: color-mix(in srgb, var(--warn) 28%, transparent); color: var(--text);
  padding: 1px 3px; border-radius: 4px; font-weight: 650;
}

.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .ei { font-size: 42px; margin-bottom: 14px; opacity: .5; }
.empty h3 { margin: 0 0 7px; font-size: 16px; color: var(--text-2); }
.empty p { margin: 0; font-size: 13.5px; }

/* ========================= 个人主页 ========================= */
.profile-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.profile-hero { padding: 30px; display: flex; gap: 24px; align-items: center; }
.profile-hero .ph-avatar {
  width: 104px; height: 104px; border-radius: 30px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  color: #fff; font-size: 42px; font-weight: 700; overflow: hidden;
  box-shadow: 0 16px 38px -18px color-mix(in srgb, var(--brand) 95%, transparent);
}
.profile-hero .ph-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.5px; }
.profile-hero .ph-sub { color: var(--text-2); font-size: 14px; margin-bottom: 12px; }
.profile-hero .ph-tags { display: flex; gap: 7px; flex-wrap: wrap; }

.kv-list { display: grid; gap: 12px; }
.kv { display: flex; gap: 12px; font-size: 14px; align-items: flex-start; }
.kv .k { color: var(--text-3); flex: none; width: 76px; font-size: 13px; padding-top: 1px; }
.kv .v { flex: 1; color: var(--text); word-break: break-word; }

.skill-row { margin-bottom: 15px; }
.skill-row .sr-top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.skill-row .sr-top .pct { color: var(--text-3); font-family: var(--mono); font-size: 12px; }

/* 时间线 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(var(--brand-2), var(--accent)); opacity: .35; border-radius: 2px;
}
.tl-item { position: relative; padding-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 7px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--brand-2);
}
.tl-item .tl-time { font-size: 12px; color: var(--text-3); font-family: var(--mono); }
.tl-item .tl-title { font-weight: 650; font-size: 14.5px; margin: 2px 0 3px; }
.tl-item .tl-desc { font-size: 13px; color: var(--text-2); }

/* ========================= 权限 / 管理 ========================= */
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 15px; }
.role-card { padding: 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.role-card.current { border-color: var(--brand-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 13%, transparent); }
.role-card h4 { margin: 0 0 4px; font-size: 15.5px; }
.role-card .rp { font-size: 12.5px; color: var(--text-3); margin-bottom: 14px; }
.perm-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.perm-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--text-2); }
.perm-list li.no { color: var(--text-3); opacity: .62; }
.perm-list li svg { flex: none; }

.lock-note {
  display: flex; gap: 13px; padding: 16px 18px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent);
  font-size: 13.5px; line-height: 1.7;
}
.lock-note .li { color: var(--warn); flex: none; }

table.matrix { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.matrix th, table.matrix td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.matrix th { font-size: 12.5px; color: var(--text-3); font-weight: 650; background: var(--surface-2); }
table.matrix tr:last-child td { border-bottom: 0; }
table.matrix td.c { text-align: center; }

/* ========================= 命令速查 ========================= */
.cmd-search { max-width: 520px; margin-bottom: 18px; }
.cmd-grid { display: grid; gap: 11px; }
.cmd-item {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  overflow: hidden; transition: all .2s var(--ease);
}
.cmd-item:hover { border-color: var(--border-2); box-shadow: var(--shadow-xs); }
.cmd-item .ci-head {
  display: flex; align-items: center; gap: 11px; padding: 13px 17px; cursor: pointer;
}
.cmd-item .ci-head code {
  font-family: var(--mono); font-size: 13.5px; font-weight: 650; color: var(--brand);
  background: var(--brand-soft); padding: 3px 10px; border-radius: 7px; flex: none;
}
.cmd-item .ci-head .desc { flex: 1; font-size: 13.5px; color: var(--text-2); }
.cmd-item .ci-body { padding: 0 17px 15px; display: none; }
.cmd-item.open .ci-body { display: block; }
.cmd-item .ci-body pre {
  margin: 0 0 10px; padding: 12px 14px; background: var(--surface-3); border-radius: var(--radius-s);
  font-family: var(--mono); font-size: 13px; line-height: 1.75; overflow-x: auto;
  border: 1px solid var(--border);
}
.cmd-item .ci-body .tip { font-size: 13px; color: var(--text-3); line-height: 1.7; }

/* ========================= 抽屉 / 弹层 ========================= */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(15, 28, 40, .38);
  backdrop-filter: blur(3px); z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .26s var(--ease);
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 400px; max-width: 92vw; z-index: 91;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); transform: translateX(102%);
  transition: transform .32s var(--ease); display: flex; flex-direction: column;
}
.drawer.show { transform: none; }
.drawer .dh {
  display: flex; align-items: center; gap: 10px; padding: 17px 20px;
  border-bottom: 1px solid var(--border); font-weight: 700;
}
.drawer .db { padding: 20px; overflow-y: auto; flex: 1; }

.lightbox {
  position: fixed; inset: 0; z-index: 120; background: rgba(10, 20, 30, .9);
  display: none; align-items: center; justify-content: center; padding: 30px;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox .close {
  position: absolute; right: 22px; top: 20px; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(255, 255, 255, .1);
  color: #fff; cursor: pointer; display: grid; place-items: center;
}

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 18px);
  background: var(--text); color: var(--surface); padding: 11px 20px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 200;
  opacity: 0; pointer-events: none; transition: all .3s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ========================= 骨架屏 ========================= */
.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ========================= 页脚 ========================= */
.footer {
  border-top: 1px solid var(--border); margin-top: 60px; padding: 26px 22px;
  text-align: center; color: var(--text-3); font-size: 12.5px; line-height: 1.9;
}
.footer a { color: var(--text-2); border-bottom: 1px dashed var(--border-2); }

/* ========================= 登录 / 注册 ========================= */
.auth-wrap { display: grid; place-items: center; min-height: 62vh; padding: 20px 0; }
.auth-card { width: 100%; max-width: 430px; padding: 28px 30px 24px; }
.auth-head { display: flex; align-items: center; gap: 13px; }
.auth-seg { width: 100%; }
.auth-seg button { flex: 1; padding: 8px 12px; font-size: 13.5px; }
.auth-foot {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  margin-top: 20px; padding-top: 15px; border-top: 1px dashed var(--border);
}

/* ========================= 站内确认弹窗 ========================= */
.modal-mask {
  position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 24px;
  background: rgba(15, 28, 40, .34); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .22s var(--ease);
}
.modal-mask.show { opacity: 1; }
.modal {
  width: 100%; max-width: 400px; padding: 24px 26px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.98);
  transition: transform .26s var(--ease);
}
.modal-mask.show .modal { transform: none; }
.modal-title { margin: 0 0 10px; font-size: 16.5px; letter-spacing: -.2px; }
.modal-body {
  font-size: 13.8px; color: var(--text-2); line-height: 1.75;
  white-space: pre-line; word-break: break-word;
}
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }

/* ========================= 我的资料 ========================= */
.quota { display: grid; gap: 10px; }
.quota-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--text-2);
}
.quota-top b { color: var(--text); font-weight: 700; }
.quota .muted { color: var(--text-3); font-size: 12.5px; }
.quota-top + .muted { margin-left: auto; }

.dropzone {
  position: relative; border: 2px dashed var(--border-2); border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  padding: 30px 22px; text-align: center; transition: all .22s var(--ease); cursor: default;
}
.dropzone.over {
  border-color: var(--brand-2); background: var(--brand-soft);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--brand-2) 14%, transparent);
  transform: scale(1.004);
}
.dz-inner { display: grid; gap: 6px; justify-items: center; color: var(--text-3); font-size: 13px; }
.dz-inner b { color: var(--text); font-size: 15px; }
.dz-icon {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 4px;
}
.dropzone.over .dz-icon { background: var(--surface); }

.files-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 18px; align-items: start; }

.fd-side { padding: 12px; position: sticky; top: calc(var(--header-h) + 16px); }
.fd-list { display: grid; gap: 2px; }
.fd-row { display: flex; align-items: center; gap: 2px; }
.fd-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
  font-size: 13.5px; color: var(--text-2); cursor: pointer; text-align: left;
  transition: all .16s var(--ease);
}
.fd-item:hover { background: var(--surface-3); color: var(--text); }
.fd-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.fd-item .fdi { display: grid; place-items: center; flex: none; }
.fd-item .fdt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-item .fdc {
  font-family: var(--mono); font-size: 11px; color: var(--text-3); flex: none;
  background: var(--surface-3); padding: 1px 6px; border-radius: 6px;
}
.fd-item.active .fdc { background: var(--surface); color: var(--brand); }
.fd-del {
  flex: none; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  padding: 5px; border-radius: 7px; opacity: 0; transition: all .16s var(--ease);
}
.fd-row:hover .fd-del { opacity: 1; }
.fd-del:hover { color: var(--danger); background: var(--danger-soft); }
.fd-sep { height: 1px; background: var(--border); margin: 9px 4px; }
.fd-title { font-size: 11.5px; color: var(--text-3); font-weight: 700; letter-spacing: .5px; padding: 2px 10px 5px; }
.fd-empty { font-size: 12.5px; color: var(--text-3); padding: 6px 10px; }
.fd-new { display: flex; align-items: center; gap: 5px; padding: 4px 6px 7px; }
.fd-new .input { padding: 7px 10px; font-size: 13px; border-radius: 9px; }
.fd-new .btn { padding: 6px 9px; flex: none; }

.files-main { min-width: 0; }
.files-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.files-toolbar .spacer { flex: 1; }
.files-toolbar .searchbox { cursor: text; }
.files-toolbar .searchbox:focus-within { width: 100%; }
.files-toolbar .seg button { display: grid; place-items: center; padding: 5px 10px; }

.file-list { display: grid; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 13px; padding: 12px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-xs); transition: all .2s var(--ease);
}
.file-row:hover { border-color: var(--border-2); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.file-row .fi, .q-item .fi {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
}
.file-row .fn { flex: 1; min-width: 0; }
.file-row .fname {
  font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.file-row .fmeta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.file-row .fa { display: flex; gap: 4px; flex: none; }
.file-row .fa .icon-btn { width: 33px; height: 33px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 13px; }
.file-card {
  position: relative; padding: 17px 15px 13px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  transition: all .22s var(--ease); display: flex; flex-direction: column; gap: 8px;
}
.file-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-2); }
.file-card .fc-icon {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
}
.file-card .fc-name {
  font-size: 13px; font-weight: 600; line-height: 1.45; word-break: break-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 38px;
}
.file-card .fc-meta { font-size: 11.5px; color: var(--text-3); }
.file-card .fc-badge { position: absolute; right: 11px; top: 11px; font-size: 10.5px; }
.file-card .fc-actions { display: flex; gap: 6px; margin-top: 2px; }
.file-card .fc-actions .btn { flex: 1; }
.file-card .fc-actions .btn.ghost { flex: none; }

.queue { display: grid; gap: 10px; }
.q-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-s);
}
.q-item .fname { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-item .fmeta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ========================= 响应式 ========================= */
@media (max-width: 1180px) {
  .learn-layout, .reader-layout { grid-template-columns: 250px minmax(0, 1fr); }
  .profile-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .hero { padding: 30px 26px; }
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
  .searchbox { width: 150px; }
  .searchbox:focus-within { width: 190px; }
  .files-layout { grid-template-columns: 1fr; }
  .fd-side { position: static; }
  .fd-list { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; padding-bottom: 3px; }
  .fd-row { flex: none; }
  .fd-item { width: auto; flex: none; }
  .fd-new { flex: none; min-width: 230px; }
  .fd-sep, .fd-title, .fd-empty { display: none; }
  .fd-del { opacity: 1; }
}

@media (max-width: 820px) {
  .learn-layout, .reader-layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .side-pages { max-height: 208px; }
  .reader-bar { position: static; padding: 9px 12px; gap: 6px; }
  .reader-bar .crumb { font-size: 12px; width: 100%; }
  #btnPrint { display: none; }
  .page { padding: 18px 14px 80px; }
  .reader-body { padding: 20px 17px 32px; }
  .profile-hero { flex-direction: column; text-align: center; align-items: center; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .hero h1 { font-size: 25px; }
  .brand-text { display: none; }
  .avatar-btn .who, .avatar-btn .role { display: none; }
  .pager { flex-wrap: wrap; }
  .page-head h2 { font-size: 17px; }
  .files-toolbar { flex-wrap: wrap; }
  .files-toolbar .searchbox { max-width: none !important; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .file-row { padding: 10px 12px; gap: 10px; }
  .auth-card { padding: 22px 20px 20px; }
  .dropzone { padding: 22px 16px; }
}

@media print {
  .topbar, .mobile-tabs, .mobile-only, .side, .reader-bar, .pager, .note-panel, .footer { display: none !important; }
  .reader-main { border: 0; box-shadow: none; }
}


/* ========================= 手机端轻量重构 ========================= */
.mobile-only, .mobile-tabs { display: none; }

@media (max-width: 820px) {
  :root { --header-h: 56px; }

  body {
    font-size: 14.5px;
    overscroll-behavior-y: none;
  }

  .topbar {
    height: var(--header-h);
    padding: 0 12px;
    gap: 8px;
  }

  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .brand-text { display: flex; }
  .brand-text b { font-size: 14px; }
  .brand-text span { display: none; }

  .nav { display: none; }
  .topbar-right { gap: 3px; }
  .mobile-only { display: grid; }
  .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
  .avatar-btn { padding: 3px; border-color: transparent; background: transparent; }
  .avatar-btn:hover { background: var(--surface-3); }
  .avatar { width: 30px; height: 30px; }

  .searchbox { width: min(176px, 40vw); padding: 6px 10px; border-radius: 10px; }
  .searchbox:focus-within { width: min(220px, 52vw); }
  .searchbox .kbd { display: none; }

  .page {
    padding: 16px 12px 106px;
  }

  .footer {
    margin-top: 34px;
    padding: 22px 16px 96px;
    font-size: 11.5px;
    line-height: 1.75;
  }

  .section-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin: 25px 0 13px;
  }
  .section-head h2 { font-size: 18px; }
  .section-head p { font-size: 12px; line-height: 1.6; }
  .section-head .spacer { display: none; }
  .page-head { flex-wrap: wrap; gap: 7px; }

  .card.pad { padding: 16px; }
  .hero { padding: 22px 18px; border-radius: 20px; }
  .hero::after { width: 260px; height: 260px; right: -150px; top: -160px; }
  .hero-grid { gap: 18px; }
  .hero h1 { font-size: 26px; line-height: 1.3; margin-bottom: 10px; }
  .hero p.lead { font-size: 13.8px; line-height: 1.72; margin-bottom: 17px; }
  .hero-tags { gap: 6px; margin-bottom: 13px; }
  .hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .hero-actions .btn:first-child { grid-column: 1 / -1; }
  .hero-actions .btn { justify-content: center; min-height: 42px; padding: 9px 10px; }
  .profile-mini { padding: 17px; border-radius: 18px; }
  .profile-mini .pm-top { gap: 11px; margin-bottom: 13px; }
  .profile-mini .pm-avatar { width: 52px; height: 52px; border-radius: 16px; font-size: 21px; }
  .profile-mini .pm-name { font-size: 16px; }
  .profile-mini .pm-sub, .pm-meta .row { font-size: 12.5px; }

  .stat-grid { gap: 8px; }
  .stat { padding: 13px 14px; border-radius: 14px; }
  .stat .k { font-size: 11.5px; }
  .stat .v { font-size: 22px; margin-top: 2px; }

  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .quick {
    min-height: 106px; padding: 13px 12px; flex-direction: column; gap: 9px;
    border-radius: 14px; align-items: flex-start;
  }
  .quick .qi { width: 38px; height: 38px; border-radius: 12px; }
  .quick .qt { font-size: 13.5px; }
  .quick .qd { display: none; }

  .doc-grid { grid-template-columns: 1fr; gap: 10px; }
  .doc-card { padding: 16px 17px 15px; border-radius: 15px; }
  .doc-card .dt { font-size: 15.5px; }
  .doc-card .dd { min-height: 0; margin-bottom: 12px; }

  .search-hero { padding: 20px 0 4px; }
  .search-hero h1 { font-size: 25px; }
  .search-hero p { margin-bottom: 16px; font-size: 13px; }
  .search-big { padding: 11px 13px; border-radius: 14px; }
  .search-big input { font-size: 15px; }
  .result { padding: 14px 15px; border-radius: 14px; }
  .result .r-txt { font-size: 13.5px; }

  .learn-layout, .reader-layout { gap: 12px; }
  .side {
    position: static;
    max-height: 310px;
    overflow-y: auto;
    border-radius: 15px;
    padding: 12px;
  }
  .doc-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 5px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .doc-tabs::-webkit-scrollbar { display: none; }
  .doc-tab { flex: none; padding: 6px 10px; font-size: 12.5px; }
  .tree .node > .link { padding: 7px 8px; }
  .reader-bar { padding: 9px 10px; row-gap: 5px; }
  .reader-bar .crumb { width: 100%; min-width: 0; flex: 1 0 100%; font-size: 12px; }
  .reader-bar .spacer { display: none; }
  .reader-bar .seg button { padding: 5px 8px; }
  .reader-bar > .icon-btn { width: 32px; height: 32px; }
  .reader-body { padding: 16px 12px 28px; }
  .note-panel { padding: 15px; border-radius: 14px; }

  .profile-hero { padding: 22px 17px; gap: 14px; border-radius: 16px; }
  .profile-hero .ph-avatar { width: 82px; height: 82px; border-radius: 24px; font-size: 32px; }
  .profile-hero h1 { font-size: 22px; }
  .profile-hero .ph-sub { font-size: 13px; margin-bottom: 9px; }
  .profile-layout { gap: 14px; }
  .kv .k { width: 66px; font-size: 12px; }
  .timeline { padding-left: 19px; }

  .files-head { margin-top: 4px !important; }
  .files-head > div:first-child { flex: 1 0 100%; }
  .files-head > .btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 8px 6px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .files-head > .btn svg { width: 14px; height: 14px; }
  .dropzone { padding: 20px 14px; border-radius: 16px; }
  .dz-inner > span:last-child { line-height: 1.65; }
  .files-layout { gap: 12px; }
  .fd-side { padding: 9px; border-radius: 14px; }
  .fd-list { padding-bottom: 2px; scrollbar-width: none; }
  .fd-list::-webkit-scrollbar { display: none; }
  .files-toolbar { gap: 8px; }
  .files-toolbar .searchbox { flex: 1 0 100%; max-width: none !important; }
  .file-card { padding: 14px 13px 12px; }
  .file-row { padding: 11px 12px; }
  .file-row .fa { gap: 1px; }

  .role-grid { gap: 12px; }
  .role-card { padding: 16px; border-radius: 15px; }
  .matrix { min-width: 620px; }
  .lock-note { padding: 14px; gap: 10px; }

  .modal-mask { padding: 14px; }
  .modal { padding: 20px 18px 17px; border-radius: 20px; max-height: 86vh; overflow: auto; }
  .modal-foot .btn { flex: 1; }

  .drawer {
    width: min(88vw, 370px);
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
  }
  .drawer .dh { padding: 15px 17px; }
  .drawer .db { padding: 15px 15px calc(22px + env(safe-area-inset-bottom)); }
  .drawer-profile {
    display: flex; align-items: center; gap: 12px; padding: 15px;
    border: 1px solid var(--border); border-radius: 16px;
    background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
  }
  .drawer-avatar {
    width: 46px; height: 46px; flex: none; display: grid; place-items: center;
    border-radius: 15px; overflow: hidden; color: #fff; font-size: 18px; font-weight: 800;
    background: linear-gradient(135deg, var(--brand-2), var(--accent));
  }
  .drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .drawer-profile b { display: block; font-size: 15px; }
  .drawer-profile span:not(.drawer-avatar) { display: block; color: var(--text-3); font-size: 12px; }
  .drawer-label { margin: 20px 2px 9px; color: var(--text-3); font-size: 11.5px; font-weight: 700; letter-spacing: .6px; }
  .drawer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .drawer-nav a {
    display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 11px 12px;
    border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2);
    color: var(--text-2); font-size: 13.5px; font-weight: 650;
  }
  .drawer-nav a:active { background: var(--brand-soft); color: var(--brand); transform: scale(.98); }
  .drawer-nav a svg { color: var(--brand); flex: none; }
  .drawer-actions { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); }

  .mobile-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 85;
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
    background: color-mix(in srgb, var(--surface) 91%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    box-shadow: 0 -10px 28px -20px rgba(23, 41, 58, .42);
  }
  .mobile-tabs a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-width: 0; min-height: 48px; border-radius: 12px;
    color: var(--text-3); font-size: 10.5px; font-weight: 650;
  }
  .mobile-tabs a.active { color: var(--brand); background: var(--brand-soft); }
  .mobile-tabs a svg { width: 18px; height: 18px; }

  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .topbar .searchbox { display: none; }
  .brand-text b { font-size: 13.5px; }
  .page { padding-left: 11px; padding-right: 11px; }
  .hero-actions { grid-template-columns: 1fr; }
  .hero-actions .btn:first-child { grid-column: auto; }
  .stat { padding: 12px; }
  .stat .k svg { width: 14px; height: 14px; }
  .quick-grid { gap: 8px; }
  .quick { min-height: 100px; padding: 12px 10px; }
  .forum-page .forum-stat-grid { gap: 7px; }
}

@media (max-width: 370px) {
  .brand-text { display: none; }
  .quick-grid { grid-template-columns: 1fr; }
}


/* ========================= 客户端分辨率自适应 ========================= */
html[data-screen="xl"] .page { padding-left: 28px; padding-right: 28px; }
html[data-screen="xl"] .page.wide { max-width: min(var(--page-wide), calc(var(--app-vw) - 72px)); }
html[data-screen="xl"] .community-feed { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
html[data-screen="xl"] .home-video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
html[data-aspect="ultrawide"] .forum-page,
html[data-aspect="ultrawide"] .community-page { max-width: min(var(--page-wide), calc(var(--app-vw) - 80px)); }
html[data-aspect="ultrawide"] .reader-main { max-width: 1120px; }

@media (orientation: landscape) and (max-height: 600px) {
  :root { --header-h: 52px; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .page { padding-top: 10px; padding-bottom: 78px; }
  .hero { padding: 20px 22px; }
  .hero-grid { gap: 16px; }
  .hero h1 { font-size: 24px; }
  .mobile-tabs { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .mobile-tabs a { min-height: 42px; }
  .feed-page { padding-bottom: 74px; }
  .feed-scroll { height: calc(var(--app-vh) - 112px); }
}

@media (max-aspect-ratio: 0.64) {
  .hero { border-radius: 18px; }
  .community-feed,
  .home-video-grid,
  .doc-grid { grid-template-columns: 1fr; }
}
