/* 哐哐学长（中国矿业大学AI助手）— 鸿蒙蓝主题 */
:root {
  --primary: #007DFF;
  --primary-2: #00C9FF;
  --primary-dark: #0066CC;
  --primary-light: #E8F4FF;
  --bg: #F5F8FC;
  --card-bg: #ffffff;
  --text: #1A2332;
  --text-secondary: #5B6B7F;
  --border: #E3EAF3;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 125, 255, 0.08);
  --glow: 0 8px 24px rgba(0, 125, 255, 0.16);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'HarmonyOS Sans SC', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(600px 240px at 15% -40px, rgba(0, 125, 255, 0.10), transparent),
    radial-gradient(600px 240px at 85% -40px, rgba(0, 201, 255, 0.10), transparent);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 导航 ── */
.nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-weight: 800; font-size: 19px; letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-brand small { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-left: 8px; -webkit-text-fill-color: var(--text-secondary); }
.nav-links { display: flex; gap: 14px; align-items: center; }
.nav-links a {
  font-size: 13px; color: var(--text-secondary); padding: 6px 12px;
  border-radius: 8px; transition: all 0.2s;
}
.nav-links a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-user { font-size: 13px; color: var(--text-secondary); }

/* ── 容器 ── */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.container.wide { max-width: 1200px; }

/* ── 卡片 ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; color: var(--text); }
.data-source { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.form-info { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.form-disclaimer { font-size: 12px; color: #98A2B3; margin-top: 10px; }

/* ── 首页 Hero ── */
.hero { text-align: center; padding: 34px 16px 8px; }
.hero h1 {
  font-size: 28px; font-weight: 800;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-secondary); margin-top: 8px; font-size: 14px; }
.hero-title { position: relative; display: inline-block; }
.hero-title .ai-badge-svg { position: absolute; top: -10px; right: -50px; }
.ai-badge-card { position: absolute; top: 10px; right: 10px; z-index: 3; }

/* ── 板块宫格 ── */
.boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: clamp(18px, 3vw, 34px);
  margin: 28px 0;
}
.board-card {
  background: var(--card-bg);
  border-radius: 18px;
  padding: clamp(20px, 3vw, 36px) clamp(16px, 2.5vw, 28px);
  cursor: pointer;
  transition: all 0.22s;
  position: relative;
  overflow: hidden;
}
.board-icon {
  width: clamp(44px, 5vw, 66px);
  height: clamp(44px, 5vw, 66px);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary-light), #E6F7FF);
}
.board-icon svg {
  width: clamp(22px, 2.5vw, 32px);
  height: clamp(22px, 2.5vw, 32px);
}
.board-name {
  font-weight: 700;
  font-size: clamp(15px, 1.5vw, 20px);
}
.board-desc {
  font-size: clamp(12px, 1.2vw, 15px);
  color: var(--text-secondary);
  margin-top: 6px;
}
.board-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 125, 255, 0.45);
  box-shadow: var(--glow);
}
.board-card::after {
  content: '';
  position: absolute;
  top: -60%; right: -30%;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(0, 125, 255, 0.10), transparent 70%);
  pointer-events: none;
}
.board-icon {
  width: clamp(44px, 5vw, 64px); height: clamp(44px, 5vw, 64px); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary-light), #E6F7FF);
}
.board-name { font-weight: 700; font-size: clamp(15px, 1.5vw, 20px); }
.board-desc { font-size: clamp(12px, 1.2vw, 15px); color: var(--text-secondary); margin-top: 4px; }
.board-arrow { position: absolute; right: 12px; top: 12px; color: var(--primary); font-size: 15px; opacity: 0; transition: opacity 0.2s; }
.board-card:hover .board-arrow { opacity: 1; }

/* ── 首页特展双卡（分类文件夹） ── */
.featured-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 22px 0;
}
.featured-card {
  cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 18px; position: relative; overflow: hidden;
}
.featured-card::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 125, 255, 0.14), transparent 60%);
  opacity: 0; transition: opacity 0.3s ease; pointer-events: none; z-index: 1;
}
.featured-card:hover::before { opacity: 1; }
.featured-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(0,125,255,0.6);
  box-shadow: 0 12px 32px rgba(0,125,255,0.2), 0 0 60px rgba(0,201,255,0.15);
}
.featured-card:hover .featured-title { color: var(--primary); }
.featured-card:hover .featured-more { text-decoration: underline; }
.featured-card .featured-head, .featured-card .featured-sub, .featured-card .chip-wrap { position: relative; z-index: 2; }
.featured-head { display: flex; align-items: center; justify-content: space-between; }
.featured-title { font-size: 17px; font-weight: 800; color: var(--text); }
.featured-more { font-size: 12px; color: var(--primary); font-weight: 600; }
.featured-sub { font-size: 12px; color: var(--text-secondary); margin: 6px 0 12px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12.5px; color: var(--text); background: var(--bg);
  cursor: pointer; transition: all 0.18s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.chip .chip-count { font-size: 11px; color: var(--text-secondary); }
.chip-skeleton { font-size: 12px; color: var(--text-secondary); }

/* 手机端：AI 卡片不在视野时底部悬浮按钮 */
.ask-ai-fab {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: none; align-items: center; gap: 6px;
  padding: 12px 24px; border: none; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 125, 255, 0.4); z-index: 900;
  white-space: nowrap;
}
.ask-ai-fab.show { display: inline-flex; }
@media (min-width: 901px) { .ask-ai-fab { display: none !important; } }

@media (max-width: 760px) {
  .featured-row { grid-template-columns: 1fr; gap: 6px; margin: 6px 0; }
}

/* ── 按钮 ── */
.btn {
  display: inline-block;
  border: none; border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary {
  color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  box-shadow: 0 4px 14px rgba(0, 125, 255, 0.3);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--glow); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-border {
  background: #fff;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 125, 255, 0.18);
}
.btn-border:hover { background: var(--primary-light); }
.btn-border:disabled { opacity: 0.45; box-shadow: none; }

/* ── 表单（登录页等） ── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--glow);
  padding: 32px 28px;
}
.auth-card h2 { text-align: center; margin-bottom: 18px; font-size: 24px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; background: var(--bg); border-radius: 10px; padding: 4px; }
.auth-tab { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 14px; color: var(--text-secondary); cursor: pointer; }
.auth-tab.active { background: #fff; color: var(--primary); font-weight: 700; box-shadow: var(--shadow); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; color: var(--text); background: #fff;
  outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,125,255,0.12); }
textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,125,255,0.12); }
.form-error { color: #ef4444; font-size: 13px; min-height: 18px; margin-top: 8px; }
.form-actions { margin-top: 14px; }

/* ── 问答 ── */
.chat-box { display: flex; flex-direction: column; gap: 14px; max-height: 56vh; overflow-y: auto; padding: 4px 2px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.msg.bot { justify-content: flex-start; }
.bubble {
  max-width: 86%; padding: 12px 16px;
  border-radius: 16px; font-size: 14px; line-height: 1.7;
  word-break: break-word;
}
.msg.user .bubble {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff; border-bottom-right-radius: 6px;
}
.msg.bot .bubble { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.input-group { display: flex; gap: 10px; margin-top: 14px; }
.input-group input {
  flex: 1; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px; outline: none;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,125,255,0.12); }
.input-group textarea, .ai-input-area textarea {
  flex: 1; min-height: 46px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 14px; font-family: inherit; line-height: 1.6;
  outline: none; resize: none; overflow-y: hidden;
}
.input-group textarea:focus, .ai-input-area textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,125,255,0.12);
}
.feedback { margin-top: 8px; display: flex; gap: 8px; }
.fb-btn { font-size: 12px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; color: var(--text-secondary); }
.fb-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.fb-btn.disabled { opacity: 0.5; pointer-events: none; }
.loading { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 资料库：搜索 + 树 + 文件列表 ── */
.search-box { display: flex; gap: 10px; margin-bottom: 16px; }
.search-box input {
  flex: 1; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 12px; font-size: 14px; outline: none;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,125,255,0.12); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search-box { flex: 1 1 auto; min-width: 200px; margin-bottom: 0; }
.toolbar-row2 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.library-layout { display: flex; gap: 18px; align-items: flex-start; }
.tree-panel {
  width: 260px; flex-shrink: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; max-height: 72vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.tree-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; font-weight: 700; }
.tree-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tree-close { display: none; }
.tree-divider { border-top: 1px dashed var(--border); margin: 10px 0; }
#fileList { flex: 1; min-height: 0; overflow-y: auto; }
.file-row {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s;
}
.file-row:hover { background: var(--primary-light); }
.file-row.active { background: var(--primary-light); box-shadow: inset 2px 0 0 var(--primary); }
.file-row .fr-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.file-row .fr-sum {
  font-size: 11px; color: var(--text-secondary); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tree-node { margin: 2px 0; }
.tree-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13.5px; color: var(--text); transition: all 0.15s;
}
.tree-row:hover { background: var(--primary-light); }
.tree-row.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.tree-toggle { width: 16px; text-align: center; color: var(--text-secondary); font-size: 11px; flex-shrink: 0; }
.tree-count { margin-left: auto; font-size: 11px; color: var(--text-secondary); background: var(--bg); padding: 1px 7px; border-radius: 999px; }
.tree-folder > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 8px;
  font-size: 13.5px; color: var(--text);
  transition: background 0.15s;
}
.tree-folder > summary:hover { background: var(--primary-light); }
.tree-folder > summary.active {
  background: var(--primary-light);
  box-shadow: inset 2px 0 0 var(--primary);
  color: var(--primary);
  font-weight: 700;
}
.tree-folder > summary::-webkit-details-marker { display: none; }
.tree-folder > summary .tree-toggle {
  display: inline-block; font-size: 11px;
  transition: transform 0.15s;
}
.tree-folder[open] > summary .tree-toggle { transform: rotate(90deg); }
.tree-folder .tree-folder { margin-left: 18px; border-left: 1px dashed var(--border); padding-left: 6px; }
.tree-folder > .file-row { margin-left: 18px; }
.files-panel { flex: 1; min-width: 0; }
.file-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  transition: all 0.18s;
}
.file-item:hover { border-color: rgba(0,125,255,0.4); box-shadow: var(--shadow); }
.file-icon { font-size: 22px; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.file-cat { display: inline-block; font-size: 11px; color: var(--primary); background: var(--primary-light); border-radius: 6px; padding: 2px 8px; margin-right: 6px; }
.empty-state { text-align: center; color: var(--text-secondary); padding: 40px 0; font-size: 14px; }

/* ── 面包屑 / 徽标 ── */
.breadcrumb { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; }
.breadcrumb a { color: var(--primary); }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--primary-light); color: var(--primary); }

/* ── 页脚 ── */
.footer {
  text-align: center; color: #98A2B3; font-size: 12px;
  padding: 26px 16px 34px; line-height: 2;
}
.footer a { color: var(--primary); }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #FFB25E, #FF7A00);
  color: #fff; font-size: 13px;
  padding: 10px 20px; border-radius: 999px; opacity: 0;
  transition: all 0.3s; pointer-events: none; z-index: 99999;
  box-shadow: 0 6px 20px rgba(255, 122, 0, 0.35);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── 公告弹窗 ── */
.popup-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s;
}
.popup-overlay.show { opacity: 1; }
.popup-box {
  background: #fff; border-radius: 16px; width: 90%; max-width: 440px;
  max-height: 80vh; overflow: hidden; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(20px); transition: transform 0.3s;
  display: flex; flex-direction: column;
}
.popup-overlay.show .popup-box { transform: translateY(0); }
.popup-close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  background: rgba(0,0,0,0.4); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  font-size: 16px; line-height: 28px; text-align: center;
  transition: background 0.2s;
}
.popup-close:hover { background: rgba(0,0,0,0.7); }
.popup-carousel { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.popup-slide { display: none; }
.popup-slide.active { display: block; }
.popup-slide img {
  width: 100%; display: block; border-radius: 16px 16px 0 0;
  max-height: 50vh; object-fit: contain; background: #f8f8f8;
}
.popup-slide .popup-text { padding: 16px 20px 20px; }
.popup-slide .popup-title { font-size: 17px; font-weight: 700; color: #111; margin-bottom: 8px; }
.popup-slide .popup-content { font-size: 14px; color: #555; line-height: 1.7; white-space: pre-wrap; }
.popup-dots { display: flex; justify-content: center; gap: 8px; padding: 8px 0; flex-shrink: 0; }
.popup-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ddd;
  transition: all 0.3s; cursor: pointer;
}
.popup-dot.active { background: var(--primary); width: 20px; border-radius: 4px; }
.popup-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.85); border: none; color: #333;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  font-size: 18px; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s; display: none;
}
.popup-arrow:hover { background: #fff; }
.popup-arrow.prev { left: 10px; }
.popup-arrow.next { right: 10px; }
.popup-carousel:hover .popup-arrow { display: flex; align-items: center; justify-content: center; }
.popup-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 14px; flex-shrink: 0;
}
.popup-dismiss {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: #999; cursor: pointer;
}
.popup-dismiss input { accent-color: var(--primary); }
.popup-counter { font-size: 12px; color: #bbb; }

/* ── 通用弹窗（解惑文档等） ── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(6px);
  z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-content {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto; padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}
.modal-content h2 {
  font-size: 18px; font-weight: 700; margin-bottom: 14px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal-content .form-group { margin-bottom: 12px; }
.modal-content select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; background: #fff; color: var(--text); outline: none;
}
.modal-content input[type="file"] { font-size: 13px; color: var(--text-secondary); }

/* ── 阅读页（轻松阅读模式） ── */
.reading-panel {
  flex: 1;
  min-width: 0;
  min-height: 55vh;
  max-height: 72vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #FAF8F3;
  border: 1px solid #ECE7DC;
  border-radius: var(--radius);
  padding: 26px 34px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 74px;
}
#readingEmpty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reading-wrap {
  max-width: 760px;
  margin: 0 auto 24px;
  background: #FAF8F3;
  border: 1px solid #ECE7DC;
  border-radius: 16px;
  padding: 44px 52px;
  box-shadow: var(--shadow);
}
.reading-title {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', serif;
  font-size: 26px; font-weight: 700; color: #1F2937;
  line-height: 1.55; margin-bottom: 10px;
}
.reading-meta { font-size: 13px; color: #9CA3AF; margin-bottom: 26px; }
.reading-body {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'SimSun', serif;
  font-size: 17px; line-height: 1.95; color: #2D2A26;
}
.reading-body p { margin-bottom: 1em; }
.reading-body img { max-width: 100%; border-radius: 8px; }
.reading-body table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.reading-body td, .reading-body th { border: 1px solid #E2DCD0; padding: 8px 10px; }

@media (max-width: 760px) {
  .reading-wrap { padding: 22px 18px; border-radius: 12px; }
  .reading-title { font-size: 21px; }
  .reading-body { font-size: 16px; line-height: 1.85; }
}

@media (max-width: 900px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search-box { width: 100%; max-width: none; }
  .toolbar-row2 { width: 100%; }
  .library-layout { flex-direction: column; align-items: stretch; }
  .reading-panel { width: 100%; flex: none; max-width: 100%; }
  #treeToggle { display: inline-flex; }
  .library-layout { position: relative; }
  .tree-panel {
    position: absolute; top: 0; left: 0; right: 0;
    width: auto; max-width: none; z-index: 1500;
    border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    display: none; max-height: 58vh;
  }
  .tree-panel.open { display: flex; }
  .tree-close { display: inline-flex; }
  .reading-panel { max-height: none; min-height: calc(100vh - 240px); }
}

@media (min-width: 901px) {
  #treeToggle { display: none; }
  .tree-panel { width: 300px; position: sticky; top: 74px; }
}

/* ── 光效动效 ── */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 125, 255, 0.15); }
  50% { box-shadow: 0 0 40px rgba(0, 125, 255, 0.3); }
}

@keyframes float-glow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-4px); }
}

@keyframes border-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* 导航栏光效 */
.nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 125, 255, 0.05), transparent);
  animation: shimmer 8s infinite linear;
  pointer-events: none;
}

/* 板块卡片光效 */
.board-card {
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* 鼠标跟踪高光效果 */
.board-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 125, 255, 0.15), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.board-card:hover::before {
  opacity: 1;
}

.board-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(0, 125, 255, 0.6);
  box-shadow: 
    0 12px 32px rgba(0, 125, 255, 0.2),
    0 0 60px rgba(0, 201, 255, 0.15),
    inset 0 0 20px rgba(0, 125, 255, 0.05);
}

.board-card:hover .board-icon {
  animation: float-glow 2s ease-in-out infinite;
  background: linear-gradient(135deg, var(--primary-light), #B3E5FC);
  box-shadow: 0 4px 16px rgba(0, 125, 255, 0.3);
}

/* 按钮光效 */
.btn-primary {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  pointer-events: none;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px rgba(0, 125, 255, 0.4),
    0 0 40px rgba(0, 201, 255, 0.2);
}

/* 卡片光效 */
.card {
  position: relative;
  transition: all 0.3s ease;
}

.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 125, 255, 0), rgba(0, 125, 255, 0.2), rgba(0, 201, 255, 0));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card:hover::after {
  opacity: 1;
  animation: border-flow 3s linear infinite;
  background-size: 200% 200%;
}

/* Hero 标题光效 */
.hero h1 {
  position: relative;
  display: inline-block;
}

.hero h1::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--primary));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
  border-radius: 2px;
}

/* ── AI 卡片展开/收起 ── */
.board-card.ai-card {
  cursor: pointer;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.board-card.ai-card.expanded {
  position: fixed !important;
  top: 5vh !important;
  left: 5vw !important;
  width: 90vw !important;
  height: 90vh !important;
  max-width: none !important;
  max-height: none !important;
  z-index: 1000 !important;
  padding: 0 !important;
  border-radius: 20px !important;
  box-shadow: 
    0 25px 80px rgba(0, 125, 255, 0.4),
    0 0 120px rgba(0, 201, 255, 0.3) !important;
  cursor: default !important;
  transform: none !important;
}

/* 展开后隐藏原始元素 */
.board-card.ai-card.expanded .board-icon,
.board-card.ai-card.expanded .board-name,
.board-card.ai-card.expanded .board-desc,
.board-card.ai-card.expanded .board-arrow,
.board-card.ai-card.expanded .ai-badge-card {
  display: none !important;
}

/* 展开后禁用高光效果 */
.board-card.ai-card.expanded::before {
  display: none !important;
}

.ai-card-content {
  display: none;
  flex-direction: column;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s ease 0.2s;
}

.board-card.ai-card.expanded .ai-card-content {
  display: flex;
  opacity: 1;
}

.ai-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary-light), #E6F7FF);
  flex-shrink: 0;
}

.ai-card-header h3 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
}

.ai-card-brand {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ai-minimize-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 125, 255, 0.1);
  color: var(--primary);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-minimize-btn:hover {
  background: var(--primary);
  color: white;
  transform: rotate(90deg);
}

.ai-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px;
}

.ai-greeting {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  animation: fadeInUp 0.5s ease;
}

.ai-greeting h4 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 12px;
}

.ai-greeting p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.ai-chat-box {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: none;
}

.ai-chat-box.active {
  display: block;
}

.ai-input-area {
  display: flex;
  gap: 12px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  align-items: flex-end;
}

.ai-input-area input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 14px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

.ai-input-area input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 125, 255, 0.1);
}

.ai-send-btn {
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: white;
  border: none;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 125, 255, 0.4);
}

.ai-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* 其他卡片挤压动画（只影响非 AI 卡片，避免模糊到展开的聊天界面） */
.boards.has-expanded .board-card:not(.ai-card) {
  opacity: 0.3;
  pointer-events: none;
  transform: scale(0.95);
  filter: blur(2px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 遮罩层 */
.ai-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.ai-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── 移动端 ── */
@media (max-width: 760px) {
  .nav { padding: 0 12px; height: 54px; }
  .nav-brand { font-size: 16px; }
  .nav-brand small { display: none; }
  .nav-links {
    gap: 4px; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 8px; font-size: 12px; }
  .container { padding: 8px 12px; }
  .hero { padding: 6px 8px 2px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 13px; }
  .boards { grid-template-columns: repeat(2, 1fr); gap: 5px; margin: 6px 0; }
  .board-card { padding: 14px 12px; }
  .board-icon { width: 38px; height: 38px; font-size: 20px; }
  .board-desc { font-size: 11px; }
  .card { padding: 16px; }
  .chat-box { max-height: 50vh; }
  .input-group input { font-size: 16px; }
  .search-box { flex-wrap: wrap; }
  .file-item { flex-wrap: wrap; }
  .file-item .file-info { min-width: 60%; }
  .footer { padding: 18px 12px 26px; }
  .auth-card { padding: 24px 18px; }
  
  /* 移动端 AI 卡片展开适配 */
  .board-card.ai-card.expanded {
    width: 95vw !important;
    height: 90vh !important;
    left: 2.5vw !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 16px !important;
  }

  /* 触摸设备：清除任何残留的 3D 倾斜变换，防止卡片偏斜 */
  .board-card,
  .featured-card {
    transform: none !important;
  }
  
  .ai-card-header {
    padding: 16px 18px;
  }
  
  .ai-card-header h3 {
    font-size: 16px;
  }
  
  .ai-minimize-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  
  .ai-greeting {
    padding: 30px 16px;
  }
  
  .ai-greeting h4 {
    font-size: 20px;
  }
  
  .ai-greeting p {
    font-size: 13px;
  }
  
  .ai-chat-container {
    padding: 16px;
  }
  
  .ai-input-area {
    padding: 12px 0 0;
  }
  
  .ai-input-area input {
    padding: 12px 14px;
    font-size: 13px;
  }
  
  .ai-send-btn {
    padding: 12px 20px;
    font-size: 13px;
  }
}

/* ── 个人主页弹窗（QQ 绑定） ── */
.profile-popup {
  position: fixed;
  top: 62px;
  right: 16px;
  width: 340px;
  background: #fff;
  border: 1px solid var(--border, #E3EAF3);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  z-index: 9999;
  display: none;
  overflow: hidden;
  font-size: 14px;
  color: var(--text, #0F172A);
}
.profile-popup.open {
  display: block;
  animation: ppIn 0.18s ease;
}
@keyframes ppIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.profile-popup .pp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(0, 125, 255, 0.08), rgba(0, 201, 255, 0.06));
  border-bottom: 1px solid var(--border, #E3EAF3);
}
.profile-popup .pp-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #007DFF, #00C9FF);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.profile-popup .pp-info { min-width: 0; }
.profile-popup .pp-name { font-weight: 600; font-size: 15px; }
.profile-popup .pp-sub { color: #64748B; font-size: 12px; margin-top: 2px; }
.profile-popup .pp-close {
  margin-left: auto;
  border: none;
  background: none;
  font-size: 20px;
  color: #94A3B8;
  cursor: pointer;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
}
.profile-popup .pp-close:hover { background: rgba(0, 0, 0, 0.06); color: #334155; }
.profile-popup .pp-body { padding: 14px 16px; }
.profile-popup .pp-title { font-weight: 600; }
.profile-popup .pp-desc { color: #64748B; font-size: 12px; margin: 4px 0 12px; line-height: 1.5; }
.profile-popup .pp-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border, #E3EAF3);
  color: #94A3B8;
  font-size: 12px;
}
.qq-bind-area { display: flex; flex-direction: column; gap: 10px; }
.qq-bind-area .pp-row { display: flex; gap: 8px; align-items: center; }
.qq-bind-area .pp-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border, #CBD5E1);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: #0F172A;
}
.qq-bind-area .pp-row input:focus {
  border-color: var(--primary, #007DFF);
  box-shadow: 0 0 0 3px rgba(0, 125, 255, 0.12);
}
.qq-bind-area .pp-status { font-size: 12px; color: #475569; line-height: 1.5; }
.qq-bind-area .pp-status.ok { color: #16a34a; }
.qq-bind-area .pp-status.err { color: #dc2626; }
.qq-bind-area .pp-bound {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border, #E3EAF3);
  border-radius: 10px;
  background: #F8FAFC;
}
.qq-bind-area .pp-bound .qq { font-weight: 600; }
.qq-bind-area .pp-hint { color: #94A3B8; font-size: 12px; margin-top: 2px; }

/* AI 回答页脚（前端静态渲染，不进入模型文本） */
.ai-answer-footer {
  margin-top: 10px;
  font-size: 12px;
  color: #94A3B8;
  text-align: center;
}

/* AI 回答相关资料（前端渲染） */
.ai-related {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border, #E3EAF3);
}
.ai-related-title {
  font-size: 12px;
  color: #64748B;
  margin-bottom: 6px;
}
.ai-related-item {
  margin: 4px 0;
  font-size: 13px;
}
.ai-related-item a:hover { text-decoration: underline; }

/* AI 对话记录回看面板 */
/* 倒置刘海：贴在输入框上缘、向上凸起的胶囊 */
.ai-input-area {
  position: relative;
}
.ai-notch-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100%;
  padding: 7px 26px;
  background: linear-gradient(135deg, var(--primary, #007DFF), var(--primary-2, #00C9FF));
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 16px 16px 12px 12px;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 -4px 14px rgba(0, 125, 255, 0.22);
  white-space: nowrap;
}
.ai-notch-btn:hover {
  filter: brightness(1.08);
}

/* 历史记录加载到对话界面时的分隔提示 */
.ai-history-divider {
  text-align: center;
  color: #94A3B8;
  font-size: 12px;
  margin: 8px 0 16px;
}
@media (max-width: 720px) {
  .profile-popup { left: 12px; right: 12px; width: auto; top: 58px; }
}
