:root {
  --purple: #7b5cd6;
  --purple-dark: #6743c7;
  --purple-soft: #f3efff;
  --purple-border: #e4dcfb;
  --gold: #c9a227;
  --gold-dark: #b18d1c;
  --gold-soft: #fdf6e3;
  --bg: #faf8fd;
  --card: #ffffff;
  --border: #d6cce8;
  --text: #2f2640;
  --sub: #8a8096;
  --danger: #e05b5b;
  --danger-soft: #fdeeee;
  --ok: #3fa66f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 100, 0.05), 0 4px 14px rgba(60, 40, 100, 0.06);
  --shadow-hover: 0 2px 4px rgba(60, 40, 100, 0.06), 0 10px 26px rgba(60, 40, 100, 0.1);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
}

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

.hidden { display: none; }
[hidden] { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--gold));
  display: inline-block;
}
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  color: var(--sub);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14.5px;
  transition: all 0.15s;
}
.nav a:hover { color: var(--purple); background: var(--purple-soft); }
.nav a.active { color: var(--purple); background: var(--purple-soft); font-weight: 600; }

.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-msg { position: relative; color: var(--sub); font-size: 14.5px; }
.nav-msg:hover { color: var(--purple); }
.badge {
  position: absolute;
  top: -7px;
  right: -12px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.nav-login { color: var(--sub); font-size: 14.5px; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}
.role-owner, .role-admin, .role-mentor {
  font-style: normal;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--gold-soft);
  color: var(--gold-dark);
  font-weight: 600;
}
.role-admin { background: var(--purple-soft); color: var(--purple-dark); }
.role-mentor { background: #fdeaf4; color: #c24a86; }
.user-menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  min-width: 140px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  z-index: 60;
}
.user-menu-pop a, .user-menu-pop .link-btn {
  padding: 8px 12px;
  border-radius: 8px;
  text-align: left;
  color: var(--text);
  font-size: 14px;
}
.user-menu-pop a:hover, .user-menu-pop .link-btn:hover { background: var(--purple-soft); color: var(--purple); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  background: var(--purple);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: 10px;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: var(--purple-dark); color: #fff; }
.btn-gold { background: var(--gold); }
.btn-gold:hover { background: var(--gold-dark); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; font-weight: 500; }
.btn-outline { background: #fff; color: var(--purple); border: 1.5px solid var(--purple-border); }
.btn-outline:hover { background: var(--purple-soft); color: var(--purple-dark); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c94f4f; color: #fff; }
.btn-block { width: 100%; }

.link-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--purple);
  font-size: 13px;
  padding: 2px 6px;
  font-family: inherit;
}
.link-btn:hover { color: var(--purple-dark); text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ---------- 布局 ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 28px 20px 60px; min-height: calc(100vh - 140px); }
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px 24px;
  flex-wrap: wrap;
  text-align: center;
  color: var(--sub);
  font-size: 13px;
  padding: 26px 0 34px;
  border-top: 1px solid var(--border);
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--sub); }
.footer-links a:hover { color: var(--purple); }

/* ---------- 静态内容页（关于我们 / 加入我们 / FAQ） ---------- */
.prose { max-width: 760px; margin-left: auto; margin-right: auto; }
.prose-title { font-size: 24px; font-weight: 800; margin-bottom: 16px; }
.prose h2 { font-size: 18px; margin: 18px 0 10px; }
.prose p { margin: 8px 0; line-height: 1.8; }
.prose ul, .prose ol { margin: 8px 0 8px 22px; line-height: 1.9; }
.prose-note { color: var(--sub); font-size: 13px; margin-top: 16px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { font-size: 15.5px; margin-bottom: 6px; }
.faq-item p { color: var(--sub); }

/* ---------- 消息 / 聊天 / 反馈 ---------- */
.msg-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.msg-tab { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--purple-soft); color: var(--purple-dark); font-size: 13.5px; font-weight: 600; }
.msg-tab.on { background: var(--purple); color: #fff; }
.msg-tab .badge { position: static; top: auto; right: auto; }
.msg-link { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--purple); }

.conv-list { display: flex; flex-direction: column; }
.conv-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); color: var(--text); }
.conv-item:last-child { border-bottom: none; }
.conv-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--purple-soft); color: var(--purple-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv-name { font-weight: 600; font-size: 14px; }
.conv-last { color: var(--sub); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { color: var(--sub); font-size: 12px; flex: none; }
.conv-new-title { font-size: 14px; margin: 16px 0 8px; color: var(--sub); }
.conv-new { display: flex; flex-wrap: wrap; gap: 8px; }

.chat-card { display: flex; flex-direction: column; }
.chat-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.chat-box { display: flex; flex-direction: column; gap: 10px; max-height: 56vh; overflow-y: auto; padding: 8px 4px; scrollbar-width: thin; scrollbar-color: #cdbdf2 transparent; }
.chat-line { display: flex; flex-direction: column; max-width: 78%; }
.chat-line.other { align-self: flex-start; align-items: flex-start; }
.chat-line.mine { align-self: flex-end; align-items: flex-end; }
.chat-bubble { padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.chat-line.other .chat-bubble { background: var(--purple-soft); color: var(--text); }
.chat-line.mine .chat-bubble { background: var(--purple); color: #fff; }
.chat-time { font-size: 11px; color: var(--sub); margin-top: 2px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.chat-form textarea { flex: 1; border: 1.5px solid var(--border); border-radius: 10px; padding: 9px 12px; font-family: inherit; font-size: 14px; resize: vertical; background: #fff; color: var(--text); outline: none; }
#fb-content, #report-reason, #reply-edit-content { width: 100%; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 14px; resize: vertical; background: #fff; color: var(--text); outline: none; }
#fb-content:focus, #report-reason:focus, #reply-edit-content:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }

.feedback-fab { position: fixed; right: 20px; bottom: 20px; z-index: 80; border: none; border-radius: 999px; background: var(--gold); color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 700; padding: 10px 16px; cursor: pointer; box-shadow: var(--shadow-hover); }
.feedback-fab:hover { background: var(--gold-dark); }

/* ---------- 聊天页：撑满整屏 ---------- */
.page-chat { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.page-chat .flash { flex-shrink: 0; }
.page-chat main.container {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 0;
}
.page-chat .back-link { flex-shrink: 0; }
.page-chat .chat-card { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-bottom: 0; }
.page-chat .chat-box { flex: 1; min-height: 0; max-height: none; }
.page-chat .chat-form { flex-shrink: 0; padding-bottom: 4px; }
.page-chat .footer { flex-shrink: 0; padding: 12px 0 16px; }
html[data-theme="dark"] .chat-form textarea,
html[data-theme="dark"] #fb-content { background: #221c33; }

/* ---------- 提示条 ---------- */
.flash {
  max-width: 1080px;
  margin: 16px auto 0;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  animation: slideDown 0.25s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash-error { background: var(--danger-soft); color: #b34040; border: 1px solid #f6d5d5; }
.flash-success { background: #eef9f2; color: #2f8a58; border: 1px solid #d2eedd; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.card-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; color: var(--text); }

/* ---------- 主页 hero ---------- */
.hero { text-align: center; padding: 26px 0 20px; }
.hero-title { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.hero-sub { color: var(--sub); margin: 4px 0 22px; }
.search-row {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
}
.search-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 54px 10px 16px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  bottom: 3px;
  width: 46px;
  border: none;
  border-radius: 9px;
  background: var(--purple);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.search-btn:hover { background: var(--purple-dark); }
.search-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}
.tag-bar-wrap { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--sub);
  font-size: 13px;
  font-family: inherit;
  padding: 4px 12px;
  border-radius: 999px;
  transition: all 0.15s;
  cursor: pointer;
}
.tag-chip:hover { border-color: var(--purple); color: var(--purple); }
.tag-on { background: var(--purple); border-color: var(--purple); color: #fff; }
.tag-on:hover { color: #fff; }
.tag-sm { padding: 2px 9px; font-size: 12px; }
.tag-clear {
  color: var(--danger);
  border-color: #f6d5d5;
  background: var(--danger-soft);
  font-size: 13px;
  padding: 4px 12px;
}
.tag-clear:hover { border-color: var(--danger); color: var(--danger); }
.tag-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex: none; }
.tag-edit-btn {
  flex: none;
  border: 1.5px solid var(--purple-border);
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tag-edit-btn:hover { border-color: var(--purple); }

/* ---------- 标签栏拖拽编辑器 ---------- */
.tbe-classes {
  max-height: 56vh;
  overflow-y: auto;
  margin: 8px 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: #cdbdf2 transparent;
}
.tbe-classes::-webkit-scrollbar { width: 10px; }
.tbe-classes::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.tbe-classes::-webkit-scrollbar-thumb {
  background: #d7cbf5;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.tbe-classes::-webkit-scrollbar-thumb:hover { background: var(--purple); background-clip: padding-box; }
html[data-theme="dark"] .tbe-classes { scrollbar-color: #4a3d6b transparent; }
html[data-theme="dark"] .tbe-classes::-webkit-scrollbar-thumb { background: #4a3d6b; background-clip: padding-box; }
.tbe-class {
  border: 1px dashed var(--purple-border);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: var(--bg);
}
.tbe-class:last-child { margin-bottom: 0; }
.tbe-class.dragging { opacity: 0.55; }
.tbe-class-head { display: flex; align-items: center; gap: 6px; cursor: grab; user-select: none; margin-bottom: 6px; touch-action: none; }
.tbe-grip { color: var(--sub); }
.tbe-class-name { font-size: 13px; font-weight: 700; color: var(--sub); }
.tbe-tags { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; }
.tbe-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--sub);
  cursor: pointer;
  user-select: none;
  touch-action: none;
}
.tbe-tag.shown { background: var(--purple-soft); border-color: var(--purple-border); color: var(--purple-dark); }
.tbe-tag.dragging { opacity: 0.5; pointer-events: none; }
.tbe-class[data-show="0"] { opacity: 0.55; }
.tbe-class[data-show="0"] .tbe-class-name { text-decoration: line-through; }
.tbe-class[data-show="1"] .tbe-class-name { color: var(--purple-dark); }
.tbe-add-tag {
  display: inline-flex;
  align-items: center;
  border: 1px dashed #ecdfae;
  background: #fefcf6;
  color: var(--gold-dark);
  border-radius: 999px;
  padding: 3px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}
.tbe-add-tag:hover { background: #fbf4e2; }
.tbe-add-class {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1.5px dashed #ecdfae;
  background: #fefcf6;
  color: var(--gold-dark);
  border-radius: 10px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.tbe-add-class:hover { background: #fbf4e2; }
html[data-theme="dark"] .tbe-add-tag,
html[data-theme="dark"] .tbe-add-class { color: #d9bc5e; background: var(--gold-soft); border-color: #5a4c25; }
html[data-theme="dark"] .tbe-tag { background: var(--card); }
html[data-theme="dark"] .tbe-tag.shown { background: var(--purple-soft); color: #c9b8f5; }

.tbe-menu {
  position: fixed;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-hover);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.tbe-menu button {
  background: none;
  border: none;
  text-align: left;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.tbe-menu button:hover { background: var(--purple-soft); color: var(--purple); }

/* ---------- 撤销提示 ---------- */
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #2f2640;
  color: #fff;
  border-radius: 999px;
  padding: 10px 12px 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-hover);
  z-index: 210;
  font-size: 14px;
  animation: slideDown 0.2s ease;
  max-width: 92vw;
}
.undo-toast .undo-btn {
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 5px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.undo-toast .undo-btn:hover { background: var(--gold-dark); }
.undo-toast .undo-sec { color: #bdb2d4; font-size: 12.5px; white-space: nowrap; }

/* ---------- 轻量弹层（输入/确认） ---------- */
.mini-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 60, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}
.mini-box {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow-hover);
  padding: 18px 20px;
  width: 100%;
  max-width: 340px;
  animation: pop 0.15s ease;
}
.mini-title { font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.mini-hint { font-size: 12.5px; color: var(--sub); margin-bottom: 10px; line-height: 1.5; }
.mini-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  margin-bottom: 14px;
}
.mini-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.mini-actions { display: flex; justify-content: flex-end; gap: 10px; }
.mini-btn {
  border: none;
  border-radius: 9px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mini-cancel { background: var(--purple-soft); color: var(--purple-dark); }
.mini-cancel:hover { background: #e9e0ff; }
.mini-ok { background: var(--purple); color: #fff; }
.mini-ok:hover { background: var(--purple-dark); }
.mini-danger { background: var(--danger); color: #fff; }
.mini-danger:hover { background: #c94f4f; }
html[data-theme="dark"] .mini-input { background: #221c33; }
html[data-theme="dark"] .mini-cancel { color: #c9b8f5; }
.result-note { color: var(--sub); font-size: 13.5px; margin-top: 16px; }
.time-filter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.tf { font-size: 12.5px; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--sub); }
.tf:hover { border-color: var(--purple); color: var(--purple); }
.tf.on { background: var(--purple); border-color: var(--purple); color: #fff; }

/* ---------- 搜索联想下拉 ---------- */
.search-box { position: relative; flex: 1; }
.search-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  z-index: 40;
  padding: 6px;
  text-align: left;
}
.ss-group-label { font-size: 12px; color: var(--sub); padding: 6px 12px 3px; }
.ss-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.ss-item:hover { background: var(--purple-soft); color: var(--purple); }

/* ---------- 筛选开关（∩交集 / ∪并集） ---------- */
.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--sub);
  user-select: none;
}
.filter-toggle input { display: none; }
.ft-track {
  width: 56px;
  height: 29px;
  border-radius: 999px;
  background: var(--purple-soft);
  border: 1.5px solid var(--purple-border);
  position: relative;
  display: inline-block;
  transition: background 0.25s;
  flex-shrink: 0;
}
.ft-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: var(--purple);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s;
}
.ft-knob::before { content: '∩'; }
.filter-toggle input:checked + .ft-track { background: var(--gold); border-color: var(--gold); }
.filter-toggle input:checked + .ft-track .ft-knob { transform: translateX(27px); color: var(--gold-dark); }
.filter-toggle input:checked + .ft-track .ft-knob::before { content: '∪'; }

/* ---------- 标签勾选 ---------- */
.tag-check-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.tag-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13.5px;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  transition: all 0.15s;
  user-select: none;
}
.tag-check input { display: none; }
.tag-check:has(input:checked) { background: var(--purple); border-color: var(--purple); color: #fff; }
html[data-theme="dark"] .tag-check { background: var(--card); }
html[data-theme="dark"] .tag-check:has(input:checked) { background: var(--purple); color: #fff; }

/* ---------- 文件墙 ---------- */
.file-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 8px auto 0;
  max-width: 1320px;
}
.file-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  transition: box-shadow 0.18s, transform 0.18s;
}
.file-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.file-card-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px; }
.file-type {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 8px;
  letter-spacing: 0.5px;
}
.ft-red { background: #fdeaea; color: #c04a4a; }
.ft-blue { background: #e8f1fd; color: #3a6fc4; }
.ft-green { background: #e8f8ee; color: #2f8a58; }
.ft-orange { background: #fdf0e3; color: #c27a2e; }
.ft-yellow { background: var(--gold-soft); color: var(--gold-dark); }
.ft-pink { background: #fdeaf4; color: #c24a86; }
.ft-purple { background: var(--purple-soft); color: var(--purple-dark); }
.ft-cyan { background: #e7f7f9; color: #2e8c97; }
.ft-gray { background: #f1eff5; color: #6b6478; }
.file-actions { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.file-card .btn-sm { padding: 4px 10px; font-size: 12.5px; }
.file-title {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.45;
  min-height: 2.9em;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-desc {
  color: var(--sub);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--sub);
  font-size: 12.5px;
}
.file-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.file-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.file-stats { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #ecdfae;
  background: #fefcf6;
  color: var(--gold-dark);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.stat-chip:hover { background: #fbf4e2; }
.stat-chip.on { background: var(--gold); border-color: var(--gold); color: #fff; }
html[data-theme="dark"] .stat-chip { background: var(--gold-soft); border-color: #5a4c25; color: #d9bc5e; }
html[data-theme="dark"] .stat-chip.on { background: var(--gold); color: #fff; }

/* ---------- 板块页（学习讨论/日常吐槽）固定布局 ---------- */
.page-board { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.page-board .flash { flex-shrink: 0; }
.page-board main.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 0;
}
.page-board .board-hero,
.page-board .post-new-row,
.page-board .login-tip,
.page-board .pager,
.page-board .footer { flex-shrink: 0; }
.page-board .post-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: #cdbdf2 transparent;
}
.page-board .post-list::-webkit-scrollbar { width: 10px; }
.page-board .post-list::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.page-board .post-list::-webkit-scrollbar-thumb {
  background: #d7cbf5;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.page-board .post-list::-webkit-scrollbar-thumb:hover { background: var(--purple); background-clip: padding-box; }
html[data-theme="dark"] .page-board .post-list { scrollbar-color: #4a3d6b transparent; }
html[data-theme="dark"] .page-board .post-list::-webkit-scrollbar-thumb { background: #4a3d6b; background-clip: padding-box; }

/* ---------- 资源页固定布局 + 左侧操作栏 ---------- */
.page-files { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.page-files .flash { flex-shrink: 0; }
.page-files main.container {
  max-width: none;
  width: 100%;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 0 12px;
}
.page-files .hero { flex-shrink: 0; padding: 8px 0 12px; }
.page-files .footer { flex-shrink: 0; }
.page-files .file-grid { width: 100%; max-width: 1240px; margin: 8px 0 0; }
.page-files .file-grid .empty { grid-column: 1 / -1; }

.files-body { flex: 1; min-height: 0; width: 100%; display: flex; align-items: stretch; gap: 0; }
.file-side {
  flex: 0 0 176px;
  width: 176px;
  align-self: flex-start;
  margin-top: 8px;
  padding: 0 18px 0 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid var(--purple-border);
  background: #e4d9ff;
  color: var(--purple-dark);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  width: 100%;
}
.side-btn:hover { border-color: var(--purple); background: #d8cbff; }
.side-btn.on { background: var(--purple); border-color: var(--purple); color: #fff; }

.files-main {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding: 2px 8px 18px 18px;
  scrollbar-width: thin;
  scrollbar-color: #cdbdf2 transparent;
}
.files-main::-webkit-scrollbar { width: 10px; }
.files-main::-webkit-scrollbar-track { background: transparent; margin: 4px 0; }
.files-main::-webkit-scrollbar-thumb {
  background: #d7cbf5;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.files-main::-webkit-scrollbar-thumb:hover { background: var(--purple); background-clip: padding-box; }
html[data-theme="dark"] .files-main { scrollbar-color: #4a3d6b transparent; }
html[data-theme="dark"] .files-main::-webkit-scrollbar-thumb { background: #4a3d6b; background-clip: padding-box; }
.mode-hint {
  background: var(--gold-soft);
  color: var(--gold-dark);
  border: 1px solid #f0e0b0;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.files-main.mode-comment .file-card,
.files-main.mode-edit .file-card { cursor: pointer; }
.files-main.mode-edit .file-card[data-can-edit="0"] {
  opacity: 0.38;
  filter: grayscale(0.7);
  pointer-events: none;
}

/* ---------- 文件评论 ---------- */
.file-comment { padding: 10px 0; border-bottom: 1px solid var(--border); }
.file-comment:last-child { border-bottom: none; }
.file-comment-head { display: flex; align-items: center; gap: 10px; }
.fc-author { font-weight: 600; font-size: 13.5px; color: var(--purple-dark); }
.fc-time { font-size: 12px; color: var(--sub); margin-left: auto; }
.fc-content { font-size: 14px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.comment-form { margin-top: 12px; }
.file-comment.depth2 { margin-left: 18px; border-left: 2px solid var(--border); padding-left: 10px; }
.file-comment.depth3 { margin-left: 36px; border-left: 2px solid var(--border); padding-left: 10px; }
.comment-children { margin-top: 4px; }
.comment-like { font-size: 12.5px; color: var(--sub); }
.comment-like.on { color: var(--gold-dark); font-weight: 700; }
.reply-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  margin-bottom: 8px;
}
.reply-chip[hidden] { display: none; }
.reply-cancel { background: none; border: none; color: var(--purple-dark); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px; }
.comment-tools { position: relative; display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.emoji-btn {
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  padding: 5px 10px;
  cursor: pointer;
}
.emoji-btn:hover { border-color: var(--purple); }
.emoji-panel {
  position: fixed;
  z-index: 400;
  width: 328px;
  max-width: 82vw;
  max-height: 216px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
.emoji-panel[hidden] { display: none; }
.emoji-item {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  padding: 5px 0;
  border-radius: 8px;
  cursor: pointer;
}
.emoji-item:hover { background: var(--purple-soft); }
html[data-theme="dark"] .emoji-btn { background: var(--card); }
.comment-form textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  resize: vertical;
  outline: none;
  margin-bottom: 8px;
}
.comment-form textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }

/* ---------- 编辑器工具栏 ---------- */
.editor-wrap { position: relative; }
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  border: 1.5px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  padding: 5px 6px;
  background: var(--card);
}
.et-btn {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 4px 9px;
  color: var(--sub);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.et-btn:hover { background: var(--purple-soft); color: var(--purple); }
.et-btn:disabled { opacity: 0.5; cursor: wait; }
.et-btn.et-on { background: var(--purple-soft); color: var(--purple); }
.et-sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; }
.et-right { margin-left: auto; }
.editor-wrap textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 0 0 10px 10px;
  padding: 9px 13px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  resize: vertical;
  outline: none;
  line-height: 1.6;
}
.editor-wrap textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.editor-preview {
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 12px 14px;
  min-height: 120px;
  background: #fff;
}
html[data-theme="dark"] .editor-wrap textarea,
html[data-theme="dark"] .editor-preview { background: #221c33; color: var(--text); }
.markdown-body video, .markdown-body audio {
  max-width: 100%;
  border-radius: 10px;
  display: block;
  margin: 0.6em 0;
}

/* ---------- 板块 banner ---------- */
.board-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(120deg, var(--purple-soft), #fff);
  border: 1px solid var(--purple-border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 18px;
}
.board-hero.accent-fun { background: linear-gradient(120deg, var(--gold-soft), #fff); border-color: #efe3c2; }
.board-hero-icon { font-size: 34px; }
.board-title { font-size: 22px; font-weight: 800; }
.board-desc { color: var(--sub); font-size: 14px; }

/* ---------- 表单 ---------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.field-hint { font-weight: 400; color: var(--sub); font-size: 12.5px; margin-left: 6px; }
.field input[type="text"], .field input[type="password"], .field textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 14.5px;
  font-family: inherit;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--text);
}
.field input:focus, .field textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}
.field textarea { resize: vertical; line-height: 1.6; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  color: var(--sub);
  cursor: pointer;
}
.check-label input { accent-color: var(--purple); width: 15px; height: 15px; cursor: pointer; }
.anon-check { display: flex; margin: 8px 0 10px; font-size: 13px; }
.form-note { color: var(--sub); font-size: 12.5px; margin: 8px 0 12px; line-height: 1.6; }
.login-tip { text-align: center; color: var(--sub); margin: 18px 0; }

/* ---------- 帖子列表 ---------- */
.post-item { transition: box-shadow 0.18s; }
.post-item:hover { box-shadow: var(--shadow-hover); }
.post-item-main { display: block; color: var(--text); }
.post-item-title { font-size: 16.5px; font-weight: 700; margin-bottom: 4px; }
.post-item-excerpt { color: var(--sub); font-size: 13.5px; }
.post-item-meta {
  display: flex;
  align-items: center;
  gap: 4px 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  color: var(--sub);
  font-size: 12.5px;
}
.post-author { color: var(--purple); font-weight: 600; }
.real-tag { font-size: 11.5px; color: var(--gold-dark); background: var(--gold-soft); padding: 1px 7px; border-radius: 6px; }
.op-tag { font-size: 11px; font-weight: 700; color: var(--gold-dark); background: var(--gold-soft); border: 1px solid #ecdca6; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.post-anon-hint { font-size: 12.5px; color: var(--sub); margin-left: 10px; }
.post-item-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.post-new-row { margin: 14px 0 18px; }
.post-item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.post-item-main { flex: 1; min-width: 0; }
.post-item-actions { display: flex; gap: 6px; flex: none; }
.post-item-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.post-stats { display: flex; align-items: center; gap: 8px; }
.post-stats .stat-chip { text-decoration: none; }

/* ---------- 发帖编辑器 ---------- */
.pe-modes { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.pe-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  background: var(--purple-soft);
  border: 1.5px solid var(--purple-border);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.pe-seg {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 7px 22px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--purple-dark);
  transition: color 0.2s;
  white-space: nowrap;
}
.pe-seg.on { color: #fff; }
.pe-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--purple);
  transition: transform 0.2s;
}
.pe-switch.extended .pe-thumb { transform: translateX(100%); }
.pe-mode-hint { font-size: 12px; color: var(--sub); }
.pe-toolbar { border-radius: 10px 10px 0 0; }
.pe-content {
  width: 100%;
  min-height: 260px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.7;
  background: #fff;
  color: var(--text);
  resize: vertical;
  outline: none;
}
.pe-content:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-soft); }
.pe-preview {
  min-height: 260px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.pe-tags-field { margin-top: 12px; }
.pe-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pe-actions .pe-submit { margin-left: auto; }
html[data-theme="dark"] .pe-content,
html[data-theme="dark"] .pe-preview { background: #221c33; }

/* ---------- 帖子详情 ---------- */
.back-link { display: inline-block; color: var(--sub); font-size: 14px; margin-bottom: 14px; }
.back-link:hover { color: var(--purple); }
.post-detail-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 6px; }
.post-detail-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; line-height: 1.4; }
.post-detail-meta {
  display: flex;
  align-items: center;
  gap: 4px 14px;
  flex-wrap: wrap;
  color: var(--sub);
  font-size: 13px;
}

/* ---------- Markdown 正文 ---------- */
.markdown-body { font-size: 15px; word-break: break-word; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 1.1em 0 0.5em;
  font-weight: 700;
  line-height: 1.4;
}
.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body p { margin: 0.55em 0; }
.markdown-body ul, .markdown-body ol { margin: 0.55em 0; padding-left: 1.6em; }
.markdown-body li { margin: 0.2em 0; }
.markdown-body a { text-decoration: underline; }
.markdown-body blockquote {
  margin: 0.7em 0;
  padding: 6px 14px;
  border-left: 3px solid var(--gold);
  background: var(--gold-soft);
  border-radius: 0 8px 8px 0;
  color: #7a6a3a;
}
.markdown-body img { max-width: 100%; border-radius: 10px; }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.markdown-body code {
  background: var(--purple-soft);
  color: var(--purple-dark);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.88em;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.markdown-body pre {
  background: #2b2440;
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0.8em 0;
  line-height: 1.55;
}
.markdown-body pre code {
  background: none;
  color: #e6e1f2;
  padding: 0;
  font-size: 13px;
}
.markdown-body table { border-collapse: collapse; margin: 0.8em 0; width: 100%; font-size: 14px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 7px 12px; text-align: left; }
.markdown-body th { background: var(--purple-soft); }

.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: #c792ea; }
.hljs-string, .hljs-attr, .hljs-template-tag { color: #e6c07b; }
.hljs-comment, .hljs-quote { color: #7a7294; font-style: italic; }
.hljs-number, .hljs-symbol { color: #f78c6c; }
.hljs-title, .hljs-function .hljs-title, .hljs-section { color: #82aaff; }
.hljs-built_in, .hljs-type { color: #ffcb6b; }
.hljs-variable, .hljs-params { color: #e6e1f2; }
.hljs-meta { color: #89ddff; }

/* ---------- 回复区 ---------- */
.reply-list { display: flex; flex-direction: column; gap: 12px; }
.reply-item { display: flex; gap: 12px; }
.reply-item.depth-2 { margin-left: 40px; }
.reply-item.depth-3 { margin-left: 80px; }
.reply-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), #b39ef0);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}
.reply-main {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
}
.reply-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reply-author { font-weight: 700; font-size: 14px; color: var(--purple-dark); }
.reply-to { font-size: 12.5px; color: var(--sub); }
.reply-time { font-size: 12px; color: var(--sub); margin-left: auto; }
.reply-content { font-size: 14.5px; margin-top: 6px; }
.reply-actions { margin-top: 8px; display: flex; gap: 4px; }
.reply-form-card .field { margin-bottom: 10px; }
.reply-to-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--purple-soft);
  color: var(--purple-dark);
  font-size: 13px;
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 10px;
}
.chip-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--purple-dark);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
}

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--sub); }
.empty.small { padding: 24px 10px; }
.empty-icon { font-size: 42px; margin-bottom: 8px; }
.empty h1 { color: var(--text); margin-bottom: 6px; }
.empty p { margin-bottom: 14px; }

/* ---------- 分页 ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 22px 0 4px; }
.pager-note { color: var(--sub); font-size: 13.5px; }

/* ---------- 通用页头 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-title { font-size: 24px; font-weight: 800; }
.page-sub { color: var(--sub); font-size: 13.5px; margin-bottom: 16px; }

/* ---------- 私信 ---------- */
.msg-item {
  display: flex;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.msg-unread { border-color: var(--purple); background: var(--purple-soft); }
.msg-main { flex: 1; }
.msg-head { display: flex; align-items: center; gap: 10px; }
.msg-from { font-weight: 700; font-size: 14px; }
.msg-time { color: var(--sub); font-size: 12px; margin-left: auto; }
.msg-content { font-size: 14px; margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.msg-del { flex-shrink: 0; }

/* ---------- 登录/注册 ---------- */
.auth-card { max-width: 420px; margin: 36px auto; padding: 32px 30px; }
.auth-title { font-size: 24px; font-weight: 800; text-align: center; }
.auth-sub { text-align: center; color: var(--sub); margin: 4px 0 22px; }
.auth-foot { text-align: center; color: var(--sub); font-size: 13.5px; margin-top: 16px; }

/* ---------- 管理页 ---------- */
.admin-form { max-width: 420px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--sub); font-weight: 600; font-size: 12.5px; }
.role-badge {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f1eff5;
  color: var(--sub);
}
.role-badge.role-owner { background: var(--gold-soft); color: var(--gold-dark); }
.role-badge.role-admin { background: var(--purple-soft); color: var(--purple-dark); }
.role-badge.role-mentor { background: #fdeaf4; color: #c24a86; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.stat-box { background: var(--purple-soft); border-radius: 12px; padding: 14px 8px; text-align: center; }
.stat-num { display: block; font-size: 22px; font-weight: 800; color: var(--purple-dark); }
.stat-label { font-size: 12px; color: var(--sub); }
.upload-progress { margin: 12px 0; }
.up-bar { height: 8px; background: var(--purple-soft); border-radius: 999px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--purple); transition: width 0.15s; }
.up-text { font-size: 12px; color: var(--sub); text-align: center; margin-top: 4px; }
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--purple-soft); color: var(--purple-dark); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; flex: none; }
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-sub { color: var(--sub); font-size: 13px; }
.profile-activity { text-align: center; }
.profile-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); color: var(--text); }
.profile-item:last-child { border-bottom: none; }
.profile-item-title { font-weight: 600; word-break: break-all; }
.profile-item-meta { color: var(--sub); font-size: 12.5px; flex: none; }
.admin-actions { display: flex; gap: 6px; align-items: center; }
.admin-actions form { margin: 0; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(40, 30, 60, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(40, 30, 60, 0.25);
  animation: pop 0.18s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 0;
  font-weight: 700;
  font-size: 16px;
}
.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--sub);
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-form { padding: 16px 20px 20px; }
.modal:not(.modal-preview) { max-height: 90vh; display: flex; flex-direction: column; }
.modal:not(.modal-preview) #modal-body { overflow-y: auto; }
.modal:not(.modal-preview) .modal-head { flex: none; }
.modal.modal-lg { width: 96vw; max-width: min(1600px, 96vw); height: 90vh; max-height: 94vh; }
.modal.modal-lg #modal-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.comment-modal { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.comment-modal #comments-box { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }

/* ---------- 预览大弹窗 ---------- */
.modal-preview {
  width: 74vw;
  height: 90vh;
  max-width: 1040px;
  display: flex;
  flex-direction: column;
}
.modal-head-right { display: flex; align-items: center; gap: 10px; }
.preview-body { flex: 1; overflow: auto; padding: 4px 20px 20px; }
.preview-img-wrap { display: flex; justify-content: center; align-items: center; min-height: 300px; }
.preview-img-wrap img { max-width: 100%; max-height: calc(90vh - 130px); border-radius: 8px; }
.preview-media-wrap { display: flex; justify-content: center; }
.preview-media-wrap video { max-width: 100%; max-height: calc(90vh - 130px); border-radius: 8px; }
.preview-audio { padding: 40px 0; }
.preview-audio audio { width: 100%; max-width: 480px; }
.preview-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  font-family: Consolas, Menlo, monospace;
  background: #f7f5fb;
  border-radius: 10px;
  padding: 16px;
  line-height: 1.6;
  margin: 0;
}
.preview-loading, .preview-fallback { text-align: center; padding: 60px 20px; color: var(--sub); }
.preview-tip { display: block; margin-top: 10px; font-size: 13px; line-height: 1.7; color: var(--sub); }

/* ---------- 预览缩放工具条 ---------- */
.pv-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.pv-zoom-ico { font-size: 14px; }
.pv-zoom { width: 180px; accent-color: var(--purple); cursor: pointer; }
.pv-zoom-val { font-size: 13px; color: var(--sub); min-width: 44px; text-align: center; }

/* ---------- PDF 阅读器 ---------- */
.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.pdf-scale { font-size: 13px; color: var(--sub); min-width: 48px; text-align: center; }
.pdf-pages { font-size: 13px; color: var(--sub); margin-left: auto; }
.pdf-pages-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-bottom: 10px; }
.pdf-page-box {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  line-height: 0;
}
.pdf-page { display: block; }
.docx-wrap { background: #fff; border-radius: 8px; }
.docx-wrap .docx { padding: 20px; }
.sheet-wrap { overflow: auto; background: #fff; border-radius: 8px; }
.sheet-wrap table { border-collapse: collapse; font-size: 13px; }
.sheet-wrap td, .sheet-wrap th { border: 1px solid #e3e0ea; padding: 4px 8px; }
.pptx-wrap { display: flex; justify-content: center; background: #fff; border-radius: 8px; }
.zip-list { list-style: none; margin: 0; }
.zip-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.zip-name { word-break: break-all; }
.zip-size { color: var(--sub); flex-shrink: 0; }
.zip-note { color: var(--sub); font-size: 13px; margin-bottom: 8px; }

/* ---------- 上传拖选区 ---------- */
.drop-zone {
  display: block;
  border: 2px dashed var(--purple-border);
  background: var(--purple-soft);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 14px;
  transition: all 0.15s;
}
.drop-zone:hover { border-color: var(--purple); }
.drop-zone input[type="file"] { display: none; }
.drop-text { color: var(--purple-dark); font-size: 14.5px; font-weight: 600; }

/* ---------- 响应式 ---------- */
@media (max-width: 1150px) {
  .file-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .search-row { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .file-grid { grid-template-columns: 1fr; max-width: none; }
  .reply-item.depth-2 { margin-left: 14px; }
  .reply-item.depth-3 { margin-left: 28px; }
  .hero-title { font-size: 25px; }
  .container { padding: 20px 14px 50px; }
  .modal-preview { width: 96vw; height: 92vh; }
  .page-files { height: auto; overflow: visible; display: block; }
  .page-files main.container { display: block; }
  .files-body { flex-direction: column; gap: 10px; }
  .file-side { flex-direction: row; flex-wrap: wrap; align-items: center; width: auto; gap: 8px; padding-right: 0; }
  .side-btn { width: auto; }
  .files-main { overflow: visible; border-left: none; padding: 0 0 18px; }
  .tag-edit-btn { position: static; transform: none; }
}

/* ---------- 深色模式开关 ---------- */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
}
.theme-track {
  position: relative;
  width: 56px;
  height: 29px;
  border-radius: 999px;
  background: var(--purple-soft);
  border: 1.5px solid var(--purple-border);
  display: inline-block;
  transition: background 0.25s;
}
.theme-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s;
}
.theme-knob::before { content: '☀️'; }
html[data-theme="dark"] .theme-knob { transform: translateX(27px); }
html[data-theme="dark"] .theme-knob::before { content: '🌙'; }
html[data-theme="dark"] .theme-track { background: #3a2f55; }

/* ---------- 深色模式配色 ---------- */
html[data-theme="dark"] {
  --bg: #16121f;
  --card: #201a2e;
  --border: #3f3457;
  --text: #eae4f5;
  --sub: #a296b8;
  --purple-soft: #2b2342;
  --purple-border: #4a3b6b;
  --gold-soft: #2f2815;
  --danger-soft: #402328;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.4), 0 10px 26px rgba(0, 0, 0, 0.45);
}
body { transition: background 0.25s, color 0.25s; }
.card, .topbar, .modal, .reply-main, .msg-item, .search-input { transition: background 0.25s, border-color 0.25s; }
html[data-theme="dark"] .topbar { background: rgba(22, 18, 31, 0.92); }
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .field input[type="text"],
html[data-theme="dark"] .field input[type="password"],
html[data-theme="dark"] .field textarea {
  background: #221c33;
  color: var(--text);
}
html[data-theme="dark"] .search-input:focus,
html[data-theme="dark"] .field input:focus,
html[data-theme="dark"] .field textarea:focus {
  background: #221c33;
}
html[data-theme="dark"] .user-menu-pop,
html[data-theme="dark"] .tag-chip,
html[data-theme="dark"] .reply-main,
html[data-theme="dark"] .msg-item,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .btn-outline { background: var(--card); }
html[data-theme="dark"] .flash-error { background: #3a2126; color: #e89393; border-color: #57303a; }
html[data-theme="dark"] .flash-success { background: #1d3a2a; color: #8fd8ad; border-color: #2c4f3c; }
html[data-theme="dark"] .markdown-body blockquote { color: #cbb25a; }
html[data-theme="dark"] .preview-text { background: #221c33; color: var(--text); }
html[data-theme="dark"] .docx-wrap,
html[data-theme="dark"] .sheet-wrap,
html[data-theme="dark"] .pptx-wrap { background: var(--card); }
html[data-theme="dark"] .sheet-wrap td,
html[data-theme="dark"] .sheet-wrap th { border-color: #453a5e; }
html[data-theme="dark"] .role-badge { background: #342a48; color: var(--sub); }
html[data-theme="dark"] .role-badge.role-mentor { background: #3c2132; color: #e293bd; }
html[data-theme="dark"] .role-admin { background: var(--purple-soft); color: #c9b8f5; }
html[data-theme="dark"] .role-mentor { background: #3c2132; color: #e293bd; }
html[data-theme="dark"] .role-owner { background: var(--gold-soft); color: #d9bc5e; }
html[data-theme="dark"] .board-hero { background: linear-gradient(120deg, #241d3a, #1b1528); border-color: #3a2f55; }
html[data-theme="dark"] .board-hero.accent-fun { background: linear-gradient(120deg, #2c2512, #1b1528); border-color: #4a3f1e; }
html[data-theme="dark"] .ft-red { background: #3d2226; color: #e39393; }
html[data-theme="dark"] .ft-blue { background: #1e2b44; color: #8db6e8; }
html[data-theme="dark"] .ft-green { background: #1d3427; color: #8ccfab; }
html[data-theme="dark"] .ft-orange { background: #3a2a18; color: #e0ab6d; }
html[data-theme="dark"] .ft-yellow { background: var(--gold-soft); color: #d9bc5e; }
html[data-theme="dark"] .ft-pink { background: #3c2132; color: #e293bd; }
html[data-theme="dark"] .ft-purple { background: var(--purple-soft); color: #c9b8f5; }
html[data-theme="dark"] .ft-cyan { background: #1c3238; color: #8ccdd6; }
html[data-theme="dark"] .ft-gray { background: #2d2737; color: #b3a9c4; }
html[data-theme="dark"] .msg-unread { background: var(--purple-soft); }
html[data-theme="dark"] .fc-author { color: #c9b8f5; }
html[data-theme="dark"] .comment-form textarea { background: #221c33; color: var(--text); }
html[data-theme="dark"] .tag-chip:hover { border-color: var(--purple); color: #c9b8f5; }
html[data-theme="dark"] .tag-clear { border-color: #57303a; }
html[data-theme="dark"] .mode-hint { background: var(--gold-soft); color: #d9bc5e; border-color: #4a3f1e; }
html[data-theme="dark"] .side-btn { background: #3a2f55; border-color: var(--purple-border); color: #c9b8f5; }
html[data-theme="dark"] .side-btn.on { background: var(--purple); color: #fff; }
html[data-theme="dark"] .tag-edit-btn { color: #c9b8f5; }
html[data-theme="dark"] .user-menu-pop a:hover,
html[data-theme="dark"] .user-menu-pop .link-btn:hover { background: var(--purple-soft); color: #c9b8f5; }
