/* ==========================================================================
   文档站样式 —— 液态玻璃（Liquid Glass）
   版式沿用洛谷：蓝色主色、紧凑行距、细边框、小圆角。
   材质换成液态玻璃：
     · 磨砂层  backdrop-filter: blur + saturate
     · 边缘高光 inset 亮线（模拟光打在玻璃厚边上）
     · 折射渐变 145deg 斜向高光面
     · 掠光扫过（specular sweep，hover 时缓慢移动）
     · 背景是缓慢流动的极光，玻璃才有东西可以折射
   降级：不支持 backdrop-filter 的浏览器退回纯色卡片；「减少动态效果」下关掉动画。
   ========================================================================== */

/* ------------------------------- 变量 ------------------------------- */
:root {
  --brand: #0e90d2;
  --brand-dark: #0b76ad;
  --brand-light: #e8f4fb;
  --brand-fade: rgba(14, 144, 210, 0.1);

  --green: #0f9d58;
  --green-bg: rgba(15, 157, 88, 0.12);
  --orange: #d98a1f;
  --orange-bg: rgba(217, 138, 31, 0.14);
  --red: #d9534f;
  --red-bg: rgba(217, 83, 79, 0.12);
  --purple: #7d5ba6;
  --purple-bg: rgba(125, 91, 166, 0.14);

  /* 玻璃材质 */
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-soft: rgba(255, 255, 255, 0.34);
  --glass-input: rgba(255, 255, 255, 0.6);
  --rim-top: rgba(255, 255, 255, 0.9);
  --rim-bottom: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.6);
  --glass-sheen: rgba(255, 255, 255, 0.55);

  --bg: #eef3f9;
  --card: #ffffff;
  --text: #16202b;
  --text-2: #4a5a6b;
  --text-3: #7d8b9a;
  --border: rgba(140, 165, 190, 0.28);
  --border-2: rgba(140, 165, 190, 0.45);

  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow: 0 1px 2px rgba(16, 32, 56, 0.05), 0 4px 16px -4px rgba(16, 32, 56, 0.1);
  --shadow-lg: 0 8px 32px -8px rgba(16, 32, 56, 0.22), 0 2px 8px rgba(16, 32, 56, 0.06);
  --shadow-float: 0 12px 40px -12px rgba(16, 32, 56, 0.28), 0 2px 6px rgba(16, 32, 56, 0.06);

  --header-h: 58px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;

  /* 极光背景的四个色团 */
  --aurora-1: #a8d8f0;
  --aurora-2: #c8b6e8;
  --aurora-3: #ffd9c0;
  --aurora-4: #b8e6d0;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --brand: #4cb8e8;
    --brand-dark: #6ec6ee;
    --brand-light: rgba(76, 184, 232, 0.14);
    --brand-fade: rgba(76, 184, 232, 0.16);

    --green: #4ccc8c;
    --green-bg: rgba(76, 204, 140, 0.14);
    --orange: #e0a94e;
    --orange-bg: rgba(224, 169, 78, 0.16);
    --red: #e87874;
    --red-bg: rgba(232, 120, 116, 0.16);
    --purple: #b39ddb;
    --purple-bg: rgba(179, 157, 219, 0.16);

    --glass: rgba(28, 36, 47, 0.62);
    --glass-strong: rgba(28, 36, 47, 0.82);
    --glass-soft: rgba(28, 36, 47, 0.4);
    --glass-input: rgba(18, 24, 33, 0.6);
    --rim-top: rgba(255, 255, 255, 0.16);
    --rim-bottom: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-sheen: rgba(255, 255, 255, 0.09);

    --bg: #0d1219;
    --card: #18202b;
    --text: #e4ebf3;
    --text-2: #a8b6c6;
    --text-3: #6f7f91;
    --border: rgba(150, 175, 200, 0.16);
    --border-2: rgba(150, 175, 200, 0.28);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px -4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px -8px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 12px 40px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);

    --aurora-1: #1b4a6b;
    --aurora-2: #3a2d5c;
    --aurora-3: #5c3a2e;
    --aurora-4: #1d4a3a;
  }
}

html[data-theme="dark"] {
  --brand: #4cb8e8;
  --brand-dark: #6ec6ee;
  --brand-light: rgba(76, 184, 232, 0.14);
  --brand-fade: rgba(76, 184, 232, 0.16);

  --green: #4ccc8c;
  --green-bg: rgba(76, 204, 140, 0.14);
  --orange: #e0a94e;
  --orange-bg: rgba(224, 169, 78, 0.16);
  --red: #e87874;
  --red-bg: rgba(232, 120, 116, 0.16);
  --purple: #b39ddb;
  --purple-bg: rgba(179, 157, 219, 0.16);

  --glass: rgba(28, 36, 47, 0.62);
  --glass-strong: rgba(28, 36, 47, 0.82);
  --glass-soft: rgba(28, 36, 47, 0.4);
  --glass-input: rgba(18, 24, 33, 0.6);
  --rim-top: rgba(255, 255, 255, 0.16);
  --rim-bottom: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-sheen: rgba(255, 255, 255, 0.09);

  --bg: #0d1219;
  --card: #18202b;
  --text: #e4ebf3;
  --text-2: #a8b6c6;
  --text-3: #6f7f91;
  --border: rgba(150, 175, 200, 0.16);
  --border-2: rgba(150, 175, 200, 0.28);

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px -8px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 12px 40px -12px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);

  --aurora-1: #1b4a6b;
  --aurora-2: #3a2d5c;
  --aurora-3: #5c3a2e;
  --aurora-4: #1d4a3a;
}

/* ------------------------------- 基础 ------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* 极光背景：四团缓慢漂移的色斑，玻璃层才有可折射的东西 */
body::before {
  content: "";
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 18% 22%, var(--aurora-1) 0%, transparent 62%),
    radial-gradient(42vmax 42vmax at 82% 18%, var(--aurora-2) 0%, transparent 62%),
    radial-gradient(46vmax 46vmax at 72% 82%, var(--aurora-3) 0%, transparent 62%),
    radial-gradient(40vmax 40vmax at 22% 78%, var(--aurora-4) 0%, transparent 62%);
  filter: blur(28px) saturate(120%);
  opacity: 0.85;
  animation: aurora-drift 42s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -2.5%, 0) scale(1.06); }
  100% { transform: translate3d(-2.5%, 2%, 0) scale(1.03); }
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.35; }

img { max-width: 100%; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

::selection { background: var(--brand); color: #fff; }

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

/* ------------------------------- 玻璃核心 ------------------------------- */
/*
 * .glass 是这块材质的基础。四层叠出来：
 *   1. 半透明底色       —— 让背后颜色透上来
 *   2. backdrop-filter —— 模糊 + 提饱和，真正的磨砂感
 *   3. inset 亮线      —— 上边亮、下边暗，模拟玻璃厚边受光
 *   4. ::before 斜向渐变 —— 玻璃折角的高光面
 */
.glass,
.card,
.topbar,
.usermenu-pop,
.auth-card,
.hero {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
}

/* 斜向高光面：玻璃折角那道反光 */
.glass::before,
.card::before,
.auth-card::before,
.usermenu-pop::before,
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    var(--glass-sheen) 0%,
    transparent 38%,
    transparent 62%,
    rgba(255, 255, 255, 0.04) 100%
  );
  opacity: 0.75;
  z-index: 0;
}

/* 让内容浮在玻璃高光之上 */
.card > *, .auth-card > *, .usermenu-pop > *, .hero > * { position: relative; z-index: 1; }

/* ------------------------------- 布局 ------------------------------- */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 820px; }

main { flex: 1 0 auto; padding: 22px 0 56px; }

/* ------------------------------- 顶栏 ------------------------------- */
/*
 * 悬浮式玻璃条：不贴顶，四周留白，圆角。
 * 这比「贴着屏幕顶边一条实心色带」更像液态玻璃。
 */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 50;
  margin: 10px 16px 0;
  height: var(--header-h);
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    var(--shadow-float);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  backdrop-filter: blur(26px) saturate(190%);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--header-h);
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  flex: none;
}
.brand:hover { color: var(--text); }

/* 玻璃质感的图标底 */
.brand-mark {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 8px;
  background: linear-gradient(145deg, #3fb0e8, var(--brand-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    0 2px 6px rgba(14, 144, 210, 0.35);
}
.brand-dot { color: var(--brand); }

.nav { display: flex; align-items: center; gap: 3px; flex: 1; min-width: 0; }

.nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.nav-link:hover {
  background: var(--brand-fade);
  color: var(--brand);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.nav-link.is-active {
  color: var(--brand);
  font-weight: 600;
  background: var(--brand-fade);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 1px 3px rgba(14, 144, 210, 0.15);
}

.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }

/* 搜索：内凹玻璃槽 */
.search-mini { position: relative; width: 186px; }
.search-mini input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 31px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--glass-input);
  outline: none;
  font-size: 13px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  box-shadow: inset 0 1px 2px rgba(16, 32, 56, 0.06);
}
.search-mini input:focus {
  border-color: var(--brand);
  background: var(--glass-strong);
  box-shadow: 0 0 0 3px var(--brand-fade), inset 0 1px 2px rgba(16, 32, 56, 0.04);
}
.search-mini::before {
  content: "";
  position: absolute;
  left: 11px; top: 50%;
  width: 11px; height: 11px;
  margin-top: -6px;
  border: 1.6px solid var(--text-3);
  border-radius: 50%;
  pointer-events: none;
}
.search-mini::after {
  content: "";
  position: absolute;
  left: 20px; top: 50%;
  width: 4px; height: 1.6px;
  margin-top: 3px;
  background: var(--text-3);
  transform: rotate(45deg);
  pointer-events: none;
}

/* 头像：玻璃球 */
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #45b4ea, var(--brand-dark));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
  text-transform: uppercase;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 4px rgba(0, 0, 0, 0.12),
    0 2px 6px rgba(14, 144, 210, 0.28);
}
.avatar-lg { width: 68px; height: 68px; font-size: 26px; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

/* 用户菜单 */
.usermenu { position: relative; }
.usermenu-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 3px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.usermenu-btn:hover {
  background: var(--brand-fade);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.usermenu-name {
  font-size: 13px;
  color: var(--text-2);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usermenu-pop {
  position: absolute;
  right: 0; top: calc(100% + 10px);
  min-width: 186px;
  border-radius: var(--radius-lg);
  padding: 6px;
  display: none;
  z-index: 60;
  background: var(--glass-strong);
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    var(--shadow-float);
}
.usermenu-pop.is-open { display: block; }
.usermenu-pop a,
.usermenu-pop button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.usermenu-pop a:hover,
.usermenu-pop button:hover { background: var(--brand-fade); color: var(--brand); }
.usermenu-pop .sep { height: 1px; background: var(--border); margin: 5px 8px; }
.usermenu-pop .danger:hover { background: var(--red-bg); color: var(--red); }

/* ------------------------------- 按钮 ------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-soft);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
  user-select: none;
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    0 1px 2px rgba(16, 32, 56, 0.06);
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  position: relative;
  overflow: hidden;
}
.btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-fade);
  transform: translateY(-0.5px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 3px 10px -2px rgba(14, 144, 210, 0.3);
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(145deg, #3fb0e8, var(--brand-dark));
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.18),
    0 3px 10px -2px rgba(14, 144, 210, 0.45);
}
.btn-primary:hover {
  background: linear-gradient(145deg, #4cbcf0, #0c82bd);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 5px 16px -3px rgba(14, 144, 210, 0.55);
}

.btn-danger { color: var(--red); border-color: rgba(217, 83, 79, 0.4); }
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 4px 12px -2px rgba(217, 83, 79, 0.4);
}

.btn-ghost { background: none; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--brand-fade); border-color: transparent; box-shadow: none; }

.btn-sm { height: 28px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 26px; font-size: 14px; }
.btn-block { width: 100%; }

/* ------------------------------- 卡片 ------------------------------- */
.card {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--glass-soft);
  position: relative;
  z-index: 1;
}
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.card-title::before {
  content: "";
  width: 3px; height: 14px;
  background: linear-gradient(180deg, #4cb8e8, var(--brand-dark));
  border-radius: 2px;
  flex: none;
  box-shadow: 0 1px 3px rgba(14, 144, 210, 0.4);
}
.card-body { padding: 18px; position: relative; z-index: 1; }
.card-body-flush { padding: 0; }

/* ------------------------------- 首页 ------------------------------- */
.hero {
  border-radius: var(--radius-xl);
  padding: 38px 34px 34px;
  margin-bottom: 22px;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(14, 144, 210, 0.16) 0%, rgba(125, 91, 166, 0.1) 50%, rgba(15, 157, 88, 0.08) 100%),
    var(--glass);
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    var(--shadow-lg);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  backdrop-filter: blur(28px) saturate(200%);
}
.hero h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--text) 20%, var(--brand) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}
.hero p { margin: 9px 0 0; color: var(--text-2); font-size: 14px; }
.hero-stats { display: flex; gap: 30px; margin-top: 22px; flex-wrap: wrap; }
.hero-stat { position: relative; padding-left: 12px; }
.hero-stat::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px;
  border-radius: 1px;
  background: linear-gradient(180deg, var(--brand), transparent);
  opacity: 0.5;
}
.hero-stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--text); }
.hero-stat span { font-size: 12px; color: var(--text-3); }

/* 文档列表 */
.doc-list { list-style: none; margin: 0; padding: 0; }

.doc-item {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.18s;
  position: relative;
}
.doc-item:last-child { border-bottom: 0; }
.doc-item:hover { background: var(--brand-fade); }
.doc-item:hover::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}

.doc-item-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 5px;
  transition: color 0.16s;
}
.doc-item:hover .doc-item-title { color: var(--brand); }

.doc-item-excerpt {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 9px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-3);
}
.doc-meta .who { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.doc-meta .dot::before { content: "·"; margin-right: 4px; }

/* 标签：玻璃药丸 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-fade);
  color: var(--brand);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
  border: 1px solid rgba(14, 144, 210, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: all 0.16s;
}
.tag:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 2px 8px -1px rgba(14, 144, 210, 0.45);
}
.tag-gray {
  background: var(--glass-soft);
  color: var(--text-2);
  border-color: var(--border);
}
.tag-gray:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.tag-plain { pointer-events: none; }

/* 状态徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 17px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.badge-public { background: var(--green-bg); color: var(--green); border-color: rgba(15, 157, 88, 0.22); }
.badge-pending { background: var(--orange-bg); color: var(--orange); border-color: rgba(217, 138, 31, 0.24); }
.badge-private { background: var(--glass-soft); color: var(--text-3); border-color: var(--border); }
.badge-rejected { background: var(--red-bg); color: var(--red); border-color: rgba(217, 83, 79, 0.22); }
.badge-super { background: var(--purple-bg); color: var(--purple); border-color: rgba(125, 91, 166, 0.26); }
.badge-admin { background: var(--brand-fade); color: var(--brand); border-color: rgba(14, 144, 210, 0.24); }
.badge-user { background: var(--glass-soft); color: var(--text-3); border-color: var(--border); }
.badge-banned { background: var(--red-bg); color: var(--red); border-color: rgba(217, 83, 79, 0.22); }

/* ------------------------------- 表单 ------------------------------- */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

/* 输入框：内凹玻璃槽 */
.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--glass-input);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(16, 32, 56, 0.05);
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--brand);
  background: var(--glass-strong);
  box-shadow: 0 0 0 3px var(--brand-fade), inset 0 1px 2px rgba(16, 32, 56, 0.03);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 94px; line-height: 1.7; }
.select { cursor: pointer; }

.input-lg { padding: 11px 14px; font-size: 15px; border-radius: var(--radius); }

/* ------------------------------- 提示 ------------------------------- */
.alert {
  padding: 11px 15px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.alert-error { background: var(--red-bg); color: var(--red); border-color: rgba(217, 83, 79, 0.28); }
.alert-ok { background: var(--green-bg); color: var(--green); border-color: rgba(15, 157, 88, 0.28); }
.alert-warn { background: var(--orange-bg); color: var(--orange); border-color: rgba(217, 138, 31, 0.3); }
.alert-info { background: var(--brand-fade); color: var(--brand); border-color: rgba(14, 144, 210, 0.3); }

.empty {
  padding: 60px 22px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.empty-title { font-size: 15px; color: var(--text-2); font-weight: 500; margin-bottom: 7px; }

/* ------------------------------- 登录 ------------------------------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
}

.auth-card {
  width: 100%;
  max-width: 392px;
  border-radius: var(--radius-xl);
  padding: 34px 30px;
  background: var(--glass-strong);
  box-shadow:
    inset 0 1px 0 var(--rim-top),
    inset 0 -1px 0 var(--rim-bottom),
    var(--shadow-float);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  backdrop-filter: blur(30px) saturate(200%);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 7px;
  justify-content: center;
}
.auth-sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 24px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-3); }

/* ------------------------------- 文档页 ------------------------------- */
.doc-layout { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 980px) {
  .doc-layout { grid-template-columns: 1fr 232px; align-items: start; }
  .doc-side { position: sticky; top: calc(var(--header-h) + 22px); }
}

.doc-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); }
.doc-title { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 11px; }

.doc-content { padding: 24px; }

.toc {
  padding: 14px 16px;
  font-size: 13px;
  border-radius: var(--radius-lg);
}
.toc-title {
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 9px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 4px 0 4px 10px;
  border-left: 2px solid var(--border);
  color: var(--text-2);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.toc a:hover { color: var(--brand); border-left-color: var(--brand); }
.toc .lv3 a { padding-left: 21px; font-size: 12px; }
.toc .lv4 a { padding-left: 32px; font-size: 12px; color: var(--text-3); }

/* ------------------------------- Markdown ------------------------------- */
.md { font-size: 15px; line-height: 1.8; color: var(--text); word-wrap: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }

.md-h { margin: 1.55em 0 0.68em; font-weight: 600; scroll-margin-top: calc(var(--header-h) + 26px); }
.md h1.md-h { font-size: 1.55em; }
.md h2.md-h { font-size: 1.32em; padding-bottom: 0.32em; border-bottom: 1px solid var(--border); }
.md h3.md-h { font-size: 1.15em; }
.md h4.md-h, .md h5.md-h, .md h6.md-h { font-size: 1em; }

.md-p { margin: 0 0 1em; }
.md-ul, .md-ol { margin: 0 0 1em; padding-left: 1.7em; }
.md-ul li, .md-ol li { margin: 0.32em 0; }
.md-ul { list-style: disc; }
.md-ol { list-style: decimal; }

.md-tasks { list-style: none; padding-left: 0.2em; }
.md-tasks li { display: flex; align-items: flex-start; gap: 8px; }
.md-task-box {
  width: 15px; height: 15px;
  margin-top: 4px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  flex: none;
  background: var(--glass-input);
  box-shadow: inset 0 1px 1px rgba(16, 32, 56, 0.06);
}
.md-task.is-done .md-task-box {
  background: linear-gradient(145deg, #4cb8e8, var(--brand-dark));
  border-color: var(--brand);
  position: relative;
  box-shadow: 0 1px 3px rgba(14, 144, 210, 0.4);
}
.md-task.is-done .md-task-box::after {
  content: "";
  position: absolute;
  left: 4px; top: 0.5px;
  width: 4px; height: 9px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(42deg);
}
.md-task.is-done > span:last-child { color: var(--text-3); text-decoration: line-through; }

.md-quote {
  margin: 0 0 1em;
  padding: 2px 17px;
  border-left: 3px solid var(--brand);
  background: var(--brand-fade);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.md-quote .md-p { margin: 0.72em 0; }

.md-hr { border: 0; border-top: 1px solid var(--border); margin: 1.9em 0; }

.md-code {
  padding: 0.15em 0.45em;
  background: var(--brand-fade);
  border: 1px solid rgba(14, 144, 210, 0.18);
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 0.88em;
  color: #0b6f9e;
}
html[data-theme="dark"] .md-code,
html[data-theme="auto"] .md-code { color: #7fd4f5; }

.md-pre {
  position: relative;
  margin: 0 0 1em;
  padding: 15px 17px;
  background: rgba(20, 28, 38, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 2px 12px -4px rgba(0, 0, 0, 0.35);
}
.md-pre code { font-family: var(--mono); color: #d6deeb; background: none; border: 0; padding: 0; }
.md-pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  right: 12px; top: 7px;
  font-size: 11px;
  color: #5f7186;
  font-family: var(--mono);
  text-transform: lowercase;
  user-select: none;
}

.md-img { border-radius: var(--radius-lg); margin: 0.45em 0; box-shadow: var(--shadow); }

.md-table-wrap { overflow-x: auto; margin: 0 0 1em; border-radius: var(--radius); }
.md-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md-table th, .md-table td { padding: 8px 13px; border: 1px solid var(--border); text-align: left; }
.md-table th { background: var(--glass-soft); font-weight: 600; }
.md-table tbody tr:nth-child(even) { background: var(--glass-soft); }

.md-math-block { display: block; overflow-x: auto; overflow-y: hidden; margin: 0.5em 0; }

/* ------------------------------- 编辑器 ------------------------------- */
.editor-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: var(--glass-soft);
  position: relative;
  z-index: 1;
}
.tool-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.tool-btn:hover {
  background: var(--brand-fade);
  color: var(--brand);
  border-color: rgba(14, 144, 210, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.tool-sep { width: 1px; height: 17px; background: var(--border); margin: 0 5px; }
.tool-spacer { flex: 1; }

.editor-panes { display: grid; grid-template-columns: 1fr; position: relative; z-index: 1; }
@media (min-width: 900px) {
  .editor-panes.is-split { grid-template-columns: 1fr 1fr; }
}

.editor-input {
  width: 100%;
  min-height: 480px;
  padding: 18px;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.78;
  resize: vertical;
  tab-size: 2;
}

.editor-preview {
  padding: 18px 22px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  max-height: 780px;
  background: var(--glass-soft);
}
@media (max-width: 899px) {
  .editor-preview { border-left: 0; border-top: 1px solid var(--border); }
}

.editor-statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  background: var(--glass-soft);
  position: relative;
  z-index: 1;
}

/* ------------------------------- 表格页 ------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 15px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  background: var(--glass-soft);
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  font-size: 12px;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: var(--brand-fade); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }

/* ------------------------------- 用户主页 ------------------------------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.profile-name { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.profile-sub { color: var(--text-3); font-size: 13px; margin-top: 3px; }
.profile-bio { color: var(--text-2); font-size: 13px; margin-top: 9px; }
.profile-stats { display: flex; gap: 24px; margin-top: 13px; flex-wrap: wrap; }
.profile-stats div { font-size: 12px; color: var(--text-3); }
.profile-stats b { display: block; font-size: 18px; color: var(--text); font-weight: 600; }

/* ------------------------------- 分页 ------------------------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 18px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--glass-soft);
  box-shadow: inset 0 1px 0 var(--rim-top);
  transition: all 0.16s;
}
.pager a:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-fade);
  transform: translateY(-0.5px);
}
.pager .is-current {
  background: linear-gradient(145deg, #3fb0e8, var(--brand-dark));
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 3px 10px -2px rgba(14, 144, 210, 0.45);
}
.pager .is-disabled { opacity: 0.42; pointer-events: none; }

/* ------------------------------- Tab ------------------------------- */
.tabs {
  display: flex;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  overflow-x: auto;
  background: var(--glass-soft);
  position: relative;
  z-index: 1;
}
.tab {
  padding: 11px 15px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color 0.16s, border-color 0.16s;
}
.tab:hover { color: var(--brand); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab .count { font-size: 11px; opacity: 0.7; margin-left: 4px; }

/* ------------------------------- 页脚 ------------------------------- */
.footer {
  flex: none;
  padding: 22px 0;
  font-size: 12px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  background: var(--glass-soft);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--brand); }

/* ------------------------------- 工具类 ------------------------------- */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.wrap-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-sm { font-size: 12px; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 主题切换：玻璃圆钮 */
.theme-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--glass-soft);
  color: var(--text-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex: none;
  transition: all 0.18s;
  box-shadow: inset 0 1px 0 var(--rim-top);
}
.theme-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-fade);
  transform: rotate(18deg);
}

/* ------------------------------- 降级与无障碍 ------------------------------- */
/* 不支持 backdrop-filter：退回不透明卡片，别糊成一团 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .card, .topbar, .usermenu-pop, .auth-card, .hero, .footer,
  .btn, .alert, .tag, .pager a, .pager span, .theme-btn, .tool-btn {
    background: var(--card);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .topbar { background: var(--card); }
  .auth-card { background: var(--card); }
  .hero { background: linear-gradient(140deg, var(--brand-light), var(--card)); }
  body::before { opacity: 0.35; }
}

/* 玻璃高光在暗色下会过曝，压低一点 */
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .glass::before,
  html[data-theme="auto"] .card::before,
  html[data-theme="auto"] .auth-card::before,
  html[data-theme="auto"] .hero::before { opacity: 0.45; }
}
html[data-theme="dark"] .glass::before,
html[data-theme="dark"] .card::before,
html[data-theme="dark"] .auth-card::before,
html[data-theme="dark"] .hero::before { opacity: 0.45; }

/* 减少动态效果 */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .btn:hover { transform: none; }
  .theme-btn:hover { transform: none; }
}

/* ------------------------------- 移动端 ------------------------------- */
/* 小屏关掉重度模糊，省电防掉帧（材料还是半透明，只是不糊背景） */
@media (max-width: 720px) {
  .topbar { margin: 8px 10px 0; top: 8px; }
  .topbar-inner { padding: 0 10px; gap: 12px; }
  .search-mini { display: none; }
  .usermenu-name { display: none; }

  .card, .hero, .glass, .auth-card, .usermenu-pop, .footer {
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    backdrop-filter: blur(14px) saturate(150%);
  }
  .topbar {
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
  }
  .btn, .tag, .pager a, .pager span, .theme-btn {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .hero { padding: 28px 22px 24px; border-radius: var(--radius-lg); }
  .hero h1 { font-size: 22px; }
  .doc-head, .doc-content { padding: 17px; }
  .doc-title { font-size: 20px; }
  .wrap { padding: 0 12px; }
  body::before { filter: blur(40px) saturate(110%); opacity: 0.6; }
}
