/* ===================================================
   安徽教招教综知识点AI助手 - 毛玻璃+二次元风格
   =================================================== */

/* === CSS 变量 === */
:root {
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-bg-hover: rgba(255, 255, 255, 0.35);
  --glass-bg-card: rgba(255, 255, 255, 0.30);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
  --glass-blur: blur(20px);
  --glass-blur-light: blur(10px);
  --primary: #7c5cbf;
  --primary-light: #a78bfa;
  --pink: #f472b6;
  --pink-light: #f9a8d4;
  --blue: #60a5fa;
  --blue-light: #93c5fd;
  --text-primary: #2d1b69;
  --text-secondary: #5b4a8a;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --danger-light: #fca5a5;
  --success: #34d399;
  --success-light: #a7f3d0;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  /* 渐变背景 */
  --bg-gradient-1: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 30%, #e8eaf6 60%, #e3f2fd 100%);
  --bg-gradient-2: linear-gradient(135deg, #fce4ec, #f8bbd0, #e1bee7, #bbdefb);
  --bg-gradient-3: linear-gradient(180deg, #fce4ec 0%, #f3e5f5 50%, #ede7f6 100%);
  --card-gradient: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0.2));
}

/* === 基础样式 === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-gradient-1);
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
}

/* === 樱花飘落动画 === */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(252, 165, 165, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 85% 75%, rgba(196, 164, 235, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(147, 197, 253, 0.06) 0%, transparent 60%);
}

.sakura-petal {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  animation: sakuraFall linear infinite;
  opacity: 0.6;
}

.sakura-petal::before {
  content: '🌸';
  font-size: 16px;
}

.sakura-petal:nth-child(1) { left: 5%; animation-duration: 12s; animation-delay: 0s; font-size: 14px; }
.sakura-petal:nth-child(2) { left: 15%; animation-duration: 15s; animation-delay: 2s; font-size: 18px; }
.sakura-petal:nth-child(3) { left: 25%; animation-duration: 10s; animation-delay: 4s; font-size: 12px; }
.sakura-petal:nth-child(4) { left: 40%; animation-duration: 18s; animation-delay: 1s; font-size: 20px; }
.sakura-petal:nth-child(5) { left: 55%; animation-duration: 13s; animation-delay: 3s; font-size: 15px; }
.sakura-petal:nth-child(6) { left: 70%; animation-duration: 16s; animation-delay: 5s; font-size: 17px; }
.sakura-petal:nth-child(7) { left: 80%; animation-duration: 11s; animation-delay: 6s; font-size: 13px; }
.sakura-petal:nth-child(8) { left: 90%; animation-duration: 14s; animation-delay: 7s; font-size: 16px; }

@keyframes sakuraFall {
  0% { transform: translateY(-10vh) rotate(0deg) translateX(0px); opacity: 0.8; }
  25% { transform: translateY(25vh) rotate(90deg) translateX(30px); }
  50% { transform: translateY(50vh) rotate(180deg) translateX(-20px); opacity: 0.5; }
  75% { transform: translateY(75vh) rotate(270deg) translateX(15px); }
  100% { transform: translateY(105vh) rotate(360deg) translateX(-10px); opacity: 0; }
}

/* === 毛玻璃容器 === */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

.glass-card {
  background: var(--card-gradient);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(31, 38, 135, 0.2);
}

/* === Auth 页面 === */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.auth-container {
  width: 420px;
  padding: 40px;
  text-align: center;
}

.auth-container .logo {
  font-size: 48px;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

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

.auth-container h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-container .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-light);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s;
}

.form-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.15);
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 92, 191, 0.4);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--glass-border);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--primary-light);
  background: rgba(124, 92, 191, 0.1);
  transform: translateY(-2px);
}

/* 用户名提示 */
.username-hint {
  display: block;
  font-size: 11px;
  color: var(--primary-light);
  margin-top: 2px;
  cursor: pointer;
  transition: color 0.2s;
}
.username-hint:hover { color: var(--primary); }

/* 个人设置弹窗 */
.profile-modal {
  max-width: 400px;
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
}
.profile-modal-header {
  text-align: center;
  padding: 28px 24px 16px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
}
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,0.4);
}
.profile-modal-header h3 { font-size: 20px; margin: 0 0 4px; }
.profile-hint { font-size: 13px; opacity: 0.85; margin: 0; }
.profile-modal-body { padding: 24px; }
.profile-modal-body .form-group { margin-bottom: 16px; }
.profile-modal-body .form-group label {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 6px; display: block;
}
.profile-modal-body .form-group input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--glass-border); border-radius: 10px;
  background: var(--glass-bg); font-size: 14px;
  color: var(--text-primary); outline: none; transition: all 0.3s;
}
.profile-modal-body .form-group input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124,92,191,0.12);
}
.profile-modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px 24px;
}
.profile-modal-footer .btn { width: auto; padding: 10px 24px; }

/* === 刷题面板 === */
.quiz-panel { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.quiz-panel.show { display: flex; }
.quiz-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 14px; border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.quiz-header h2 { font-size: 18px; }
.quiz-filter-bar { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-shrink: 0; }
.quiz-select {
  padding: 6px 12px; border: 1px solid var(--glass-border); border-radius: 8px;
  background: var(--glass-bg); color: var(--text-primary); font-size: 13px; cursor: pointer;
}
.quiz-count { font-size: 13px; color: var(--text-muted); }
#quizQuestionsView { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
#quizBooksView { display: flex; flex-direction: column; flex: 1; overflow: hidden; min-height: 0; }
.quiz-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.quiz-card {
  padding: 16px; border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 8px;
}
.book-pub-btn {
  font-size: 12px; padding: 4px 10px; border: none; border-radius: 12px;
  cursor: pointer; color: #fff; white-space: nowrap;
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  transition: opacity 0.2s;
}
.book-pub-btn:hover { opacity: 0.85; }
.book-pub-btn.on { background: linear-gradient(135deg, #10b981, #34d399); }
.doc-pub-btn {
  font-size: 12px; padding: 4px 10px; border: none; border-radius: 12px;
  cursor: pointer; color: #fff; white-space: nowrap;
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  transition: opacity 0.2s;
}
.doc-pub-btn:hover { opacity: 0.85; }
.doc-pub-btn.on { background: linear-gradient(135deg, #10b981, #34d399); }
.quiz-card .q-type-badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.q-type-single { background: rgba(59,130,246,0.2); color: #3b82f6; }
.q-type-multi { background: rgba(168,85,247,0.2); color: #a855f7; }
.q-type-judge { background: rgba(34,197,94,0.2); color: #22c55e; }
.q-type-fill { background: rgba(245,158,11,0.2); color: #f59e0b; }
.q-type-short { background: rgba(239,68,68,0.2); color: #ef4444; }
.q-type-material { background: rgba(14,165,233,0.2); color: #0ea5e9; }
.q-type-design { background: rgba(124,92,191,0.2); color: #7c5cbf; }
.q-cat-badge { display: inline-block; white-space: nowrap; font-weight: 600; }
.q-cat-remember { background: rgba(20,184,166,0.15); color: #14b8a6; }
.q-cat-distinguish { background: rgba(99,102,241,0.15); color: #6366f1; }
.q-cat-subjective { background: rgba(236,72,153,0.15); color: #ec4899; }
.quiz-card .q-content { font-size: 14px; line-height: 1.6; }
.quiz-card .q-options { font-size: 13px; color: var(--text-secondary); line-height: 1.8; }
.quiz-card .q-answer { font-size: 13px; color: var(--success); }
.quiz-card .q-analysis { font-size: 13px; color: var(--text-muted); }
.quiz-card .q-actions { display: flex; gap: 8px; margin-top: 4px; }
.quiz-card .q-actions button { font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; border: 1px solid var(--glass-border); background: var(--glass-bg); color: var(--text-secondary); }
.quiz-card .q-actions button:hover { background: var(--primary); color: white; border-color: var(--primary); }
.quiz-pagination { display: flex; gap: 8px; justify-content: center; padding: 12px 0; flex-shrink: 0; }
.quiz-pagination button { padding: 4px 12px; border-radius: 6px; cursor: pointer; border: 1px solid var(--glass-border); background: var(--glass-bg); color: var(--text-secondary); font-size: 13px; }
.quiz-pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.quiz-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== 刷题子 Tab（题目/错题/收藏/统计） ===== */
#quizQuestionsView, #quizWrongView, #quizFavView, #quizStatsView, #quizPracticeView {
  flex: 1; flex-direction: column; overflow: hidden; min-height: 0;
}
.quiz-sub-tabs {
  display: flex; gap: 6px; padding: 10px 0 4px; flex-shrink: 0;
  border-bottom: 1px solid var(--glass-border); margin-bottom: 4px;
}
.quiz-sub-tabs button {
  flex: 1; padding: 8px 6px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  color: var(--text-secondary); font-size: 13px; transition: all .2s;
}
.quiz-sub-tabs button.active {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white; border-color: transparent; font-weight: 600;
}

/* ===== 快速练习按钮 ===== */
.quiz-quick-actions {
  display: flex; gap: 8px; padding: 8px 0; flex-shrink: 0; flex-wrap: wrap;
}
.quiz-action-btn {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white; border: none; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; transition: all .2s;
}
.quiz-action-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.quiz-action-btn:active { transform: scale(0.97); }

/* ===== 统计视图 ===== */
.quiz-stats-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; padding: 12px 0;
}
.quiz-stat-card {
  padding: 16px 10px; text-align: center; border-radius: 12px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.quiz-stat-card .sv { font-size: 26px; font-weight: 700; color: var(--text-primary); }
.quiz-stat-card .sl { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.quiz-section-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  padding: 12px 0 4px; flex-shrink: 0;
}
.quiz-record-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; background: var(--glass-bg);
  border: 1px solid var(--glass-border); font-size: 13px;
}
.quiz-record-item .r-icon { flex-shrink: 0; font-size: 18px; }
.quiz-record-item .r-content { flex: 1; min-width: 0; }
.quiz-record-item .r-content .r-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary);
}
.quiz-record-item .r-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.quiz-record-item .r-result { flex-shrink: 0; font-size: 12px; font-weight: 600; }
.r-correct { color: var(--success); }
.r-wrong { color: var(--danger); }

/* ===== 收藏按钮 ===== */
.q-fav-btn {
  background: transparent; border: 1px solid var(--glass-border);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
  font-size: 13px; color: var(--text-muted); transition: all .2s;
}
.q-fav-btn.faved { color: #f59e0b; border-color: #f59e0b; background: rgba(245,158,11,0.1); }

/* 练习模式中的收藏按钮 */
.practice-fav-btn {
  background: transparent; border: 1px solid var(--glass-border);
  border-radius: 6px; padding: 4px 10px; cursor: pointer;
  font-size: 12px; color: var(--text-muted); margin-left: auto; transition: all .2s;
}
.practice-fav-btn.faved { color: #f59e0b; border-color: #f59e0b; background: rgba(245,158,11,0.1); }

/* ===== 练习模式 ===== */
.practice-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; flex-shrink: 0; gap: 8px;
}
.practice-exit {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-secondary); padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.practice-sheet-btn {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  color: var(--text-secondary); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.practice-progress-text { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.practice-timer { font-size: 13px; color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; }
.practice-progress-track {
  height: 6px; border-radius: 3px; background: var(--glass-bg);
  border: 1px solid var(--glass-border); overflow: hidden; flex-shrink: 0;
}
.practice-progress-fill {
  height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--pink));
  transition: width .3s;
}
.practice-body { flex: 1; overflow-y: auto; padding: 8px 0; display: flex; flex-direction: column; gap: 12px; }
.practice-card {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px;
}
.practice-card .p-type-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.practice-card .p-content { font-size: 15px; line-height: 1.8; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }
.practice-option-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border: 2px solid var(--glass-border); border-radius: 10px; cursor: pointer;
  transition: all .2s; font-size: 14px; background: var(--bg-secondary);
}
.practice-option-row:hover { border-color: var(--primary-light); }
.practice-option-row.selected { border-color: var(--primary); background: rgba(124,92,191,0.12); }
.practice-option-row.correct { border-color: var(--success); background: rgba(34,197,94,0.12); }
.practice-option-row.wrong { border-color: var(--danger); background: rgba(239,68,68,0.12); }
.practice-option-row.disabled { pointer-events: none; }
.practice-option-row .opt-letter {
  font-weight: 700; min-width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border); flex-shrink: 0; font-size: 13px;
}
.practice-option-row.selected .opt-letter { background: var(--primary); color: white; border-color: var(--primary); }
.practice-option-row.correct .opt-letter { background: var(--success); color: white; border-color: var(--success); }
.practice-option-row.wrong .opt-letter { background: var(--danger); color: white; border-color: var(--danger); }
.practice-option-row .opt-text { flex: 1; word-break: break-word; line-height: 1.6; }
.practice-input {
  width: 100%; padding: 10px 12px; border: 2px solid var(--glass-border);
  border-radius: 10px; background: var(--bg-secondary); color: var(--text-primary);
  font-size: 14px; box-sizing: border-box; resize: vertical;
}
.practice-result {
  padding: 14px; border-radius: 10px; font-size: 13px; line-height: 1.7;
}
.practice-result.correct { background: rgba(34,197,94,0.1); border: 1px solid var(--success); }
.practice-result.wrong { background: rgba(239,68,68,0.1); border: 1px solid var(--danger); }
.practice-result .pr-title { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.practice-result .pr-analysis { color: var(--text-secondary); margin-top: 6px; }
.practice-bottombar {
  display: flex; gap: 8px; padding: 10px 0; flex-shrink: 0;
}
.practice-nav-btn {
  flex: 1; padding: 12px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  color: var(--text-secondary); font-size: 14px; transition: all .2s;
  min-height: 44px;
}
.practice-nav-btn.primary { background: linear-gradient(135deg, var(--primary), var(--pink)); color: white; border-color: transparent; font-weight: 600; }
.practice-nav-btn.submit { background: var(--success); color: white; border-color: transparent; font-weight: 600; }
.practice-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 清除使用数据弹窗选项 */
.clear-opt {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  margin-bottom: 8px; border: 1px solid var(--glass-border);
  border-radius: 8px; background: var(--glass-bg); font-size: 13px;
  cursor: pointer; transition: all .2s;
}
.clear-opt:hover { background: rgba(124,92,191,0.08); }
.clear-opt input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* 练习答题卡弹窗 */
.practice-sheet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 8px; max-height: 60vh; overflow-y: auto; padding: 4px;
}
.practice-sheet-item {
  aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--glass-border);
  background: var(--glass-bg); color: var(--text-secondary); font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.practice-sheet-item.answered { background: rgba(124,92,191,0.2); border-color: var(--primary); color: var(--primary); }
.practice-sheet-item.current { background: var(--primary); color: white; border-color: var(--primary); }
.practice-sheet-item.correct { background: rgba(34,197,94,0.25); border-color: var(--success); color: var(--success); }
.practice-sheet-item.wrong { background: rgba(239,68,68,0.25); border-color: var(--danger); color: var(--danger); }

/* 练习报告弹窗 */
.practice-report-card { text-align: center; }
.practice-report-score {
  font-size: 52px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.practice-report-stats { display: flex; justify-content: center; gap: 24px; margin-top: 16px; flex-wrap: wrap; }
.practice-report-stats .prs { text-align: center; }
.practice-report-stats .prs .v { font-size: 22px; font-weight: 700; }
.practice-report-stats .prs .l { font-size: 12px; color: var(--text-muted); }

/* 练习中收藏/答题卡按钮 */
.practice-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== 题目导入弹窗 ===== */
.import-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin-bottom: 18px; padding: 0 8px;
}
.import-step {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 13px; transition: all 0.3s;
}
.import-step .step-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  transition: all 0.3s;
}
.import-step.active .step-num {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white; border-color: transparent;
  box-shadow: 0 2px 8px rgba(124, 92, 191, 0.4);
}
.import-step.active { color: var(--text-primary); font-weight: 500; }
.import-step.done .step-num {
  background: var(--success); color: white; border-color: transparent;
}
.import-step.done .step-num::after { content: '✓'; }
.import-step.done .step-num > span { display: none; }
.step-line { flex: 1; height: 2px; background: var(--glass-border); border-radius: 1px; max-width: 60px; }
.step-line.done { background: var(--success); }

.quiz-dropzone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer;
  transition: all 0.3s; margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.3);
}
.quiz-dropzone:hover, .quiz-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(124, 92, 191, 0.08);
  transform: translateY(-1px);
}
.quiz-dropzone .dz-icon { font-size: 36px; margin-bottom: 8px; }
.quiz-dropzone .dz-text { font-size: 14px; color: var(--text-primary); font-weight: 500; margin-bottom: 4px; }
.quiz-dropzone .dz-hint { font-size: 12px; color: var(--text-muted); }
.quiz-dropzone .dz-file-info { margin-top: 8px; font-size: 12px; color: var(--success); }
.quiz-dropzone.disabled { opacity: 0.5; pointer-events: none; }

/* 文档选择器（刷题导入用） */
.doc-selector-list { background: var(--card-bg); }
.doc-selector-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.doc-selector-item:last-child { border-bottom: none; }
.doc-selector-item:hover { background: var(--hover); }
.doc-selector-item.selected { background: rgba(102,126,234,0.12); border-left: 3px solid var(--primary); }
.doc-selector-item .doc-icon {
  width: 36px; height: 36px; border-radius: 8px; background: rgba(102,126,234,0.1);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.doc-selector-item .doc-info { flex: 1; min-width: 0; }
.doc-selector-item .doc-name { font-size: 13px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-selector-item .doc-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.doc-selector-item .doc-check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.doc-selector-item.selected .doc-check {
  background: var(--primary); border-color: var(--primary); color: #fff; font-size: 12px;
}

.import-progress { margin-bottom: 14px; }
.import-progress .progress-info {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-secondary); margin-bottom: 6px;
}
.import-progress .progress-stage { display: flex; align-items: center; gap: 6px; }
.import-progress .progress-pct { font-weight: 600; color: var(--primary); }
.progress-bar-track {
  height: 8px; background: var(--glass-bg); border-radius: 4px;
  overflow: hidden; border: 1px solid var(--glass-border);
}
.progress-bar-fill {
  height: 100%; width: 0%; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--pink));
  transition: width 0.3s ease;
}
.progress-bar-fill.indeterminate {
  width: 40% !important;
  animation: indeterminate-slide 1.4s ease-in-out infinite;
}
@keyframes indeterminate-slide {
  0% { margin-left: -40%; }
  50% { margin-left: 100%; }
  100% { margin-left: -40%; }
}
.progress-bar-fill.spin-icon::before { content: '⟳'; }

.import-text-area { position: relative; }
.import-text-area textarea {
  width: 100%; resize: vertical; min-height: 120px;
  padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  font-size: 13px; line-height: 1.6; font-family: inherit;
  color: var(--text-primary);
}
.import-text-area textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.12);
}
.import-text-meta {
  font-size: 11px; color: var(--text-muted); text-align: right;
  margin-top: 4px; min-height: 14px;
}

/* ===== 导入模式切换 ===== */
.import-mode-tabs {
  display: flex; gap: 6px; margin-bottom: 8px;
  padding: 4px; background: var(--glass-bg); border-radius: var(--radius);
  border: 1px solid var(--glass-border);
}
.mode-tab {
  flex: 1; padding: 10px 16px; border: none; cursor: pointer;
  background: transparent; color: var(--text-secondary);
  font-size: 14px; font-weight: 500; border-radius: calc(var(--radius) - 2px);
  transition: all 0.25s;
}
.mode-tab:hover { color: var(--text-primary); }
.mode-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
  box-shadow: 0 2px 8px rgba(124, 92, 191, 0.3);
}
.mode-desc {
  font-size: 12px; color: var(--text-muted);
  text-align: center; margin-bottom: 14px;
}

/* ===== 分册模式布局 ===== */
.split-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.split-col { display: flex; flex-direction: column; gap: 8px; }
.split-col-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px;
}
.split-col-header h4 {
  margin: 0; font-size: 14px; color: var(--text-primary); font-weight: 600;
}
.split-status {
  font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--glass-bg); color: var(--text-muted);
  border: 1px solid var(--glass-border);
}
.split-status.done {
  background: rgba(52, 211, 153, 0.15); color: #059669;
  border-color: rgba(52, 211, 153, 0.3);
}
.split-status.loading {
  background: rgba(124, 92, 191, 0.15); color: var(--primary);
  border-color: rgba(124, 92, 191, 0.3);
}
.split-status.error {
  background: rgba(239, 68, 68, 0.15); color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.split-dropzone {
  padding: 18px 12px !important;
}
.split-dropzone .dz-icon { font-size: 28px; }
.split-dropzone .dz-text { font-size: 13px; }
.split-dropzone .dz-hint { font-size: 11px; }
.split-col textarea {
  width: 100%; resize: vertical; min-height: 100px;
  padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  font-size: 12px; line-height: 1.6; font-family: inherit;
  color: var(--text-primary);
}
.split-col textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.12);
}
.split-tip {
  margin-top: 12px; padding: 10px 14px;
  background: rgba(124, 92, 191, 0.08);
  border-left: 3px solid var(--primary);
  border-radius: 4px; font-size: 12px; color: var(--text-secondary);
  line-height: 1.6;
}
/* 多文件列表 */
.file-list { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; }
.file-list:empty { display: none; }
.file-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 6px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  font-size: 12px; color: var(--text-secondary);
}
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.file-item .file-remove {
  background: none; border: none; cursor: pointer;
  color: var(--danger); font-size: 14px; padding: 0 4px;
  flex-shrink: 0; line-height: 1;
}
.file-item .file-remove:hover { opacity: 0.7; }
.file-item.loading {
  background: rgba(124, 92, 191, 0.08);
  border-color: rgba(124, 92, 191, 0.2);
  color: var(--primary);
}
.file-item.error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}
@media (max-width: 640px) {
  .split-grid { grid-template-columns: 1fr; }
}

/* 练习区 */
.practice-area { flex: 1; overflow-y: auto; padding: 4px 0; }
.practice-card { padding: 24px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 16px; }
.practice-card .p-type { font-size: 12px; color: var(--text-muted); }

/* 章节管理 Tab */
.chapter-tab { background: transparent; color: var(--text-muted); font-size: 14px; transition: all .2s; border-right: 1px solid var(--border); }
.chapter-tab:last-child { border-right: none; }
.chapter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chapter-tab:hover:not(.active) { background: rgba(108,92,231,0.1); }
.practice-card .p-content { font-size: 16px; line-height: 1.8; font-weight: 500; }
.practice-card .p-chapter { font-size: 12px; color: var(--primary-light); background: rgba(124,92,191,0.1); padding: 4px 10px; border-radius: 6px; display: inline-block; }
.practice-card .p-options { display: flex; flex-direction: column; gap: 8px; }
.practice-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 2px solid var(--glass-border); border-radius: 10px; cursor: pointer;
  transition: all 0.2s; font-size: 14px;
}
.practice-option:hover { border-color: var(--primary-light); background: rgba(124,92,191,0.05); }
.practice-option.selected { border-color: var(--primary); background: rgba(124,92,191,0.1); }
.practice-option.correct { border-color: var(--success); background: rgba(34,197,94,0.1); }
.practice-option.wrong { border-color: var(--danger); background: rgba(239,68,68,0.1); }
.practice-option .opt-label { font-weight: 600; min-width: 24px; }
.practice-input { width: 100%; padding: 10px 14px; border: 2px solid var(--glass-border); border-radius: 10px; background: var(--glass-bg); color: var(--text-primary); font-size: 14px; }
.practice-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.practice-result { padding: 16px; border-radius: 10px; margin-top: 16px; }
.practice-result.correct { background: rgba(34,197,94,0.1); border: 1px solid var(--success); }
.practice-result.wrong { background: rgba(239,68,68,0.1); border: 1px solid var(--danger); }
.practice-result.pending { background: rgba(245,158,11,0.1); border: 1px solid #f59e0b; }
.practice-answer-toggle {
  display: inline-block; margin-top: 12px; padding: 7px 16px; font-size: 13px;
  border: 1px solid var(--primary); color: var(--primary); background: transparent;
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
}
.practice-answer-toggle:hover { background: rgba(124,92,191,0.1); }
.practice-report-list {
  margin-top: 12px; max-height: 260px; overflow-y: auto;
  border: 1px solid var(--glass-border); border-radius: 10px; padding: 6px;
}
.practice-report-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.practice-report-item:hover { background: rgba(124,92,191,0.08); }
.practice-report-item .rd-num { color: var(--text-muted); min-width: 30px; font-weight: 600; }
.practice-report-item .rd-type { flex: 1; color: var(--text-secondary); }
.practice-report-item .rd-status { font-weight: 700; }
.practice-report-item.rd-correct .rd-status { color: var(--success); }
.practice-report-item.rd-wrong .rd-status { color: var(--danger); }
.practice-report-item.rd-pending .rd-status { color: #f59e0b; }
.practice-report-item.rd-none .rd-status { color: var(--text-muted); }

/* 练习会话详情（统计页"每次练习记录"点开） */
.sess-q {
  border: 1px solid var(--glass-border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--card-bg);
}
.sess-q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sess-q-head .sess-num { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.sess-status { font-size: 12px; font-weight: 700; margin-left: auto; }
.sess-status.sess-correct { color: var(--success); }
.sess-status.sess-wrong { color: var(--danger); }
.sess-status.sess-pending { color: #f59e0b; }
.sess-q-content { font-size: 14px; margin-top: 6px; line-height: 1.7; }
.sess-opt {
  display: flex; gap: 8px; padding: 5px 8px; border-radius: 6px;
  font-size: 13px; margin-top: 4px; color: var(--text-secondary);
  border: 1px solid transparent;
}
.sess-opt .sess-opt-letter { font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.sess-opt.sel { border-color: var(--primary); background: rgba(124,92,191,0.08); }
.sess-opt.right { color: var(--success); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.08); }
.sess-opt.wrong { color: var(--danger); border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.08); }
.sess-ans-wrap {
  border-top: 1px dashed var(--glass-border); margin-top: 8px; padding-top: 8px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.8;
}
.sess-line b { color: var(--text-primary); }

/* 练习会话列表（操作条 + 复选框 + 删除/继续按钮） */
.sess-actions-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; margin-bottom: 8px;
  border: 1px solid var(--glass-border); border-radius: 10px;
  background: var(--glass-bg); font-size: 12px; color: var(--text-muted);
}
.sess-all-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.sess-all-label input[type="checkbox"] { accent-color: var(--primary); width: 14px; height: 14px; cursor: pointer; }
.sess-count { flex: 1; }
.sess-del-sel { display: none; }
.sess-item { display: flex; align-items: center; gap: 8px; }
.sess-chk { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.sess-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sess-resume-btn {
  padding: 3px 10px; font-size: 12px; border: 1px solid var(--primary);
  color: var(--primary); background: transparent; border-radius: 6px; cursor: pointer;
}
.sess-resume-btn:hover { background: rgba(124,92,191,0.1); }
.sess-del-btn {
  border: none; background: transparent; cursor: pointer; font-size: 14px;
  color: var(--text-muted); padding: 2px 4px; border-radius: 6px;
}
.sess-del-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
  padding: 8px 12px; border: 1px solid var(--glass-border); border-radius: 8px;
  background: var(--glass-bg); color: var(--text-primary); font-size: 14px;
}
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 20px 0; }
.stat-card { padding: 24px; text-align: center; border-radius: var(--radius); }
.stat-value { font-size: 36px; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--pink)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
/* 弹窗显示 */
.modal-overlay.show { display: flex !important; }


.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 26px; transition: 0.3s; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
input:checked + .slider { background: linear-gradient(135deg, var(--primary), var(--pink)); }
input:checked + .slider:before { transform: translateX(22px); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #f87171);
  color: white;
}

.btn-secondary {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-light);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.auth-link {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: block;
}

.alert-success {
  background: rgba(52, 211, 153, 0.15);
  color: #059669;
  border: 1px solid rgba(52, 211, 153, 0.3);
  display: block;
}

/* === 主页面布局 === */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* 工作台切换栏 */
.workspace-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.ws-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.ws-tab:hover { background: rgba(124,92,191,0.1); color: var(--primary); }
.ws-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
}

.workspace-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 侧边栏 */
.sidebar {
  width: 240px;
  height: 100%;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  transition: width 0.25s ease;
}

/* 侧边栏收缩展开 */
.sidebar.collapsed {
  width: 64px;
  padding-left: 8px;
  padding-right: 8px;
}
.sidebar-collapse-btn {
  position: absolute;
  top: 10px;
  right: 8px;
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.65);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.95);
  color: var(--text);
}
.sidebar.collapsed .sidebar-logo .name,
.sidebar.collapsed .sidebar-logo .username-display,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-divider,
.sidebar.collapsed .sidebar-reward {
  display: none;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
}
.sidebar.collapsed .sidebar-footer {
  border-top: none;
  padding-top: 0;
}

.sidebar-logo {
  text-align: center;
  margin-bottom: 24px;
}

.sidebar-logo .icon {
  font-size: 32px;
  animation: float 3s ease-in-out infinite;
  display: block;
}

.sidebar-logo .name {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 2px;
}

.sidebar-logo .username-display {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.3s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(124, 92, 191, 0.2), rgba(244, 114, 182, 0.2));
  color: var(--primary);
  font-weight: 600;
}

.nav-item .nav-icon { font-size: 18px; }

.nav-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 12px 0;
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
}

/* 赞赏码 */
.sidebar-reward {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 6px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.sidebar-reward .reward-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--pink);
  margin-bottom: 6px;
}
.sidebar-reward .reward-qr {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: transform 0.3s;
}
.sidebar-reward .reward-qr:hover {
  transform: scale(1.08);
}
.sidebar-reward .reward-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 主内容区 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 24px;
}

/* === 聊天面板 === */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  min-width: 0;
}

/* === Live2D 角色区（固定定位，右下角） === */
.live2d-side {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: 280px;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 1;
  transform: translateY(0);
}

.live2d-side.hidden {
  opacity: 0;
  transform: translateY(30px);
  pointer-events: none;
}
/* 隐藏时所有子元素都不能点击 */
.live2d-side.hidden > * {
  pointer-events: none !important;
}

.live2d-side > * {
  pointer-events: auto;
}

/* 角色区域不拦截点击，避免遮挡聊天区域的再次播放按钮 */
.live2d-stage,
.live2d-stage canvas {
  pointer-events: none;
}
/* 但控制按钮、选择器和气泡仍然可点击 */
.live2d-controls,
.live2d-selectors,
.live2d-bubble {
  pointer-events: auto;
}

.live2d-stage {
  position: relative;
  width: 260px;
  height: 380px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}
.live2d-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* 对话气泡 */
.live2d-bubble {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 240px;
  margin-bottom: 12px;
  position: relative;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(124,92,191,0.1);
}

.live2d-bubble.show {
  opacity: 1;
  transform: translateY(0);
}

.live2d-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 20px;
  width: 16px;
  height: 16px;
  background: rgba(255,255,255,0.85);
  border-right: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  transform: rotate(45deg);
}

/* 语音控制 */
.live2d-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.voice-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s;
  position: relative;
}

.voice-btn:hover {
  background: rgba(168,130,255,0.15);
  border-color: var(--primary-light);
  transform: scale(1.1);
}

.voice-btn.active {
  background: rgba(244,114,182,0.15);
  border-color: var(--pink);
  box-shadow: 0 0 12px rgba(244,114,182,0.3);
}

.voice-btn.active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--pink);
  animation: voicePulse 1.5s ease-out infinite;
}

@keyframes voicePulse {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* 音色和角色选择器 */
.live2d-selectors {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}

.selector-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.5);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 3px 8px;
}

.selector-group label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.selector-dropdown {
  font-size: 11px;
  padding: 2px 4px;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  background: rgba(255,255,255,0.8);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  max-width: 100px;
}

.selector-dropdown:focus {
  border-color: var(--primary-light);
}

/* 音量指示条 */
.voice-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 16px;
  margin-left: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.voice-bars.active { opacity: 1; }

.voice-bar {
  width: 3px;
  background: var(--pink);
  border-radius: 2px;
  animation: voiceBar 0.6s ease-in-out infinite alternate;
}

.voice-bar:nth-child(1) { height: 6px; animation-delay: 0s; }
.voice-bar:nth-child(2) { height: 10px; animation-delay: 0.1s; }
.voice-bar:nth-child(3) { height: 14px; animation-delay: 0.2s; }
.voice-bar:nth-child(4) { height: 8px; animation-delay: 0.15s; }

@keyframes voiceBar {
  0% { height: 4px; }
  100% { height: 16px; }
}

/* 小装饰粒子 */
.live2d-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.live2d-particles .particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0;
  animation: floatParticle 4s ease-in-out infinite;
}

.live2d-particles .particle:nth-child(1) { left: 10%; top: 20%; background: var(--pink-light); animation-delay: 0s; }
.live2d-particles .particle:nth-child(2) { left: 80%; top: 30%; background: var(--primary-light); animation-delay: 1s; }
.live2d-particles .particle:nth-child(3) { left: 30%; top: 60%; background: var(--blue-light); animation-delay: 2s; }
.live2d-particles .particle:nth-child(4) { left: 70%; top: 10%; background: var(--pink-light); animation-delay: 0.5s; }
.live2d-particles .particle:nth-child(5) { left: 50%; top: 80%; background: var(--success-light); animation-delay: 1.5s; }

@keyframes floatParticle {
  0%, 100% { opacity: 0; transform: translateY(0) scale(0.5); }
  50% { opacity: 0.6; transform: translateY(-20px) scale(1); }
}

/* 聊天布局包装 */
.chat-wrapper {
  display: flex;
  height: 100%;
  gap: 0;
}

/* Live2D 切换按钮 */
.live2d-toggle-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  cursor: grab;
  touch-action: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(124,92,191,0.15);
  transition: all 0.3s ease;
}

.live2d-toggle-btn:hover {
  transform: scale(1.1);
  border-color: var(--primary-light);
  box-shadow: 0 6px 20px rgba(124,92,191,0.25);
}

/* 角色隐藏时，切换按钮在右下角显示 */
.live2d-side.hidden + .live2d-toggle-btn,
.live2d-side.hidden ~ .live2d-toggle-btn {
  bottom: 20px;
  right: 20px;
}

/* 赞赏码浮窗按钮 */
.reward-float-btn {
  position: fixed;
  bottom: 80px;
  left: 20px;
  z-index: 1002;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  background: linear-gradient(135deg, #f472b6, #ec4899);
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  animation: rewardPulse 2s ease-in-out infinite;
  user-select: none;
  touch-action: none;
}
.reward-float-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 24px rgba(236, 72, 153, 0.5);
}
.reward-float-btn.dragging {
  cursor: grabbing;
  animation: none;
  transform: scale(1.2);
  box-shadow: 0 8px 32px rgba(236, 72, 153, 0.6);
  transition: box-shadow 0.2s, transform 0.2s;
}
.reward-float-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 24px rgba(236, 72, 153, 0.5);
}
@keyframes rewardPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
/* 赞赏码弹窗 */
#rewardFloatModal .modal-content {
  border-radius: 16px;
  padding: 28px 24px;
}
#rewardFloatModal.show {
  display: flex;
}
#rewardFloatModal img {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* 朗读按钮 */
.read-aloud-btn {
  cursor: pointer;
  border: none;
  background: none;
  transition: transform 0.2s;
  font-size: 13px;
}
.read-aloud-btn:hover {
  transform: scale(1.15);
}
.msg-read-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  opacity: 0.5;
  font-size: 14px;
  padding: 2px;
  border-radius: 50%;
  background: rgba(124,92,191,0.1);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg-read-btn:hover {
  opacity: 1;
  background: rgba(124,92,191,0.2);
}
.message-bubble {
  position: relative;
}
.history-read-btn {
  padding: 2px 8px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
  font-size: 12px;
  margin-left: 8px;
  font-weight: 500;
}
.history-read-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(124,92,191,0.4);
}

/* === 聊天面板 === */

.chat-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h2 {
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header .session-title {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 14px;
}

.chat-intro {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.chat-intro .intro-icon {
  font-size: 56px;
  margin-bottom: 12px;
  display: block;
}

.chat-intro h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.chat-intro p {
  font-size: 13px;
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msgSlideIn 0.3s ease;
}

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

.message.user { align-self: flex-end; flex-direction: row-reverse; }

.message.assistant { align-self: flex-start; }

.message-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, var(--primary), var(--pink));
}

.message.assistant .message-avatar {
  background: linear-gradient(135deg, var(--pink-light), var(--blue-light));
}

.message-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--primary), #9b7fd4);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
  background: var(--glass-bg-card);
  backdrop-filter: var(--glass-blur-light);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
  white-space: normal;
}

/* Markdown 内容美化 */
.markdown-body {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-primary);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 1em 0 0.5em;
  font-weight: 600;
  line-height: 1.4;
}
.markdown-body h1 { font-size: 1.4em; color: var(--text-primary); border-bottom: 2px solid var(--primary); padding-bottom: 6px; }
.markdown-body h2 { font-size: 1.25em; color: var(--text-primary); border-bottom: 1px solid var(--glass-border); padding-bottom: 4px; }
.markdown-body h3 { font-size: 1.1em; color: var(--primary); }
.markdown-body h4 { font-size: 1em; color: var(--text-muted); }

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child,
.markdown-body h4:first-child { margin-top: 0; }

.markdown-body p { margin: 0 0 0.7em; }
.markdown-body p:last-child { margin-bottom: 0; }

.markdown-body ul, .markdown-body ol {
  margin: 0 0 0.8em;
  padding-left: 1.5em;
}
.markdown-body li { margin-bottom: 0.25em; }

.markdown-body blockquote {
  margin: 0 0 0.8em;
  padding: 10px 16px;
  border-left: 4px solid var(--primary);
  background: rgba(59, 130, 246, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.markdown-body blockquote p:last-child { margin-bottom: 0; }

.markdown-body code {
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 0.88em;
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  padding: 2px 6px;
  border-radius: 4px;
}

.markdown-body pre {
  margin: 0 0 1em;
  padding: 14px 18px;
  background: #1e1e2e;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
}
.markdown-body pre code {
  background: none;
  color: #cdd6f4;
  padding: 0;
  font-size: inherit;
}

.markdown-body table {
  width: 100%;
  margin: 0 0 1em;
  border-collapse: collapse;
  font-size: 14px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
}
.markdown-body th, .markdown-body td {
  padding: 8px 14px;
  border: 1px solid var(--glass-border);
  text-align: left;
}
.markdown-body th {
  background: var(--glass-bg);
  font-weight: 600;
  color: var(--text-primary);
}
.markdown-body tr:nth-child(even) td {
  background: rgba(255,255,255,0.3);
}

.markdown-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.markdown-body em {
  color: var(--pink);
}

.markdown-body hr {
  margin: 1em 0;
  border: none;
  border-top: 1px solid var(--glass-border);
}

.markdown-body a {
  color: var(--primary);
  text-decoration: none;
}
.markdown-body a:hover { text-decoration: underline; }

.message-loading .message-bubble {
  display: flex;
  gap: 6px;
  padding: 16px 20px;
}

.typing-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary-light);
  animation: typingBounce 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-10px); }
}

/* 聊天工具栏（题库范围选择 + AI出题） */
.chat-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 0;
  flex-wrap: wrap;
}
.chat-toolbar-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.chat-book-select {
  flex: 1;
  min-width: 0;
  max-width: 320px;
  padding: 6px 10px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.chat-quiz-btn {
  padding: 6px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s;
}
.chat-quiz-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(124, 92, 191, 0.35);
}

/* 输入区 */
.chat-input-area {
  padding: 12px 0 0;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur-light);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  font-family: inherit;
  transition: all 0.3s;
}

.chat-input-area textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.1);
}

.chat-input-area .send-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  color: white;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.chat-input-area .send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(124, 92, 191, 0.4);
}

.chat-input-area .send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === 文档管理面板 === */
.documents-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.documents-panel.show { display: flex; }

.doc-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.doc-header h2 { font-size: 18px; }

.upload-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(124, 92, 191, 0.08);
}

.upload-zone .upload-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.upload-zone p { font-size: 13px; color: var(--text-secondary); }
.upload-zone .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.upload-zone.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.doc-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
}

.doc-item .doc-icon { font-size: 28px; flex-shrink: 0; }
.doc-item .doc-info { flex: 1; min-width: 0; }
.doc-item .doc-name {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-item .doc-meta {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}
.doc-item .doc-delete {
  padding: 6px 14px;
  border: 1px solid var(--danger-light);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s;
}
.doc-item .doc-delete:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* === 历史记录面板 === */
.history-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.history-panel.show { display: flex; }

.history-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.history-header h2 { font-size: 18px; }

.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-session {
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-session:hover {
  background: var(--glass-bg-hover);
}

.history-session .session-info { flex: 1; min-width: 0; }
.history-session .session-title {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-session .session-meta {
  font-size: 12px; color: var(--text-muted); margin-top: 2px;
}
.history-session .session-delete {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.3s;
}
.history-session:hover .session-delete { opacity: 1; }

/* 历史记录详情弹窗 */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 100;
  display: none;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show { display: flex; }

.modal {
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 16px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--glass-bg);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.history-message {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  position: relative;
}

.history-message .msg-question {
  font-size: 14px; font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
  padding: 8px 12px;
  background: rgba(124,92,191,0.1);
  border-radius: var(--radius-xs);
}

.history-message .msg-answer {
  font-size: 13px; line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.history-message .msg-meta {
  font-size: 11px; color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-message .msg-delete {
  padding: 2px 10px;
  border: 1px solid var(--danger-light);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-size: 11px;
}

/* Toast 提示 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  z-index: 9999;
  animation: toastIn 0.3s ease;
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { background: rgba(52,211,153,0.3); color: #065f46; border: 1px solid var(--success-light); }
.toast.error { background: rgba(239,68,68,0.3); color: #991b1b; border: 1px solid var(--danger-light); }
.toast.info { background: rgba(96,165,250,0.3); color: #1e40af; border: 1px solid var(--blue-light); }

/* === 管理员页面 === */
.admin-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.admin-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.admin-header h2 { font-size: 18px; }

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-actions button,
.admin-actions a {
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  transition: all 0.3s;
}

.admin-actions button:hover,
.admin-actions a:hover {
  background: var(--glass-bg-hover);
}

.admin-table-wrapper {
  flex: 1;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--glass-bg-card);
  backdrop-filter: var(--glass-blur);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
  z-index: 1;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  vertical-align: middle;
}

tbody tr { transition: background 0.2s; }
tbody tr:hover { background: var(--glass-bg-hover); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(52,211,153,0.2); color: #065f46; }
.badge-danger { background: rgba(239,68,68,0.2); color: #991b1b; }
.badge-info { background: rgba(96,165,250,0.2); color: #1e40af; }
.badge-public { background: rgba(16,185,129,0.15); color: #059669; }
.badge-shared { background: rgba(99,102,241,0.15); color: var(--primary); }
.badge-admin { background: linear-gradient(135deg, rgba(124,92,191,0.2), rgba(244,114,182,0.2)); color: var(--primary); }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 24px;
  background: #ccc;
  transition: 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  border-radius: 50%;
  background: white;
  transition: 0.3s;
}
input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--primary), var(--pink));
}
input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s;
}
.btn-sm:hover { background: var(--glass-bg-hover); }
.btn-sm.danger { color: var(--danger); border-color: var(--danger-light); }
.btn-sm.danger:hover { background: rgba(239,68,68,0.1); }

/* Token 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 28px; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--pink));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card .stat-label {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}

/* 设置页面 */
.settings-form {
  max-width: 600px;
}

.settings-form .form-group {
  margin-bottom: 20px;
}

.settings-form label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.settings-form input, .settings-form select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  background: var(--glass-bg);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.settings-form input:focus {
  border-color: var(--primary-light);
}

.settings-form .btn {
  width: auto;
  padding: 10px 24px;
}

/* === 响应式 === */
/* 平板 */
@media (max-width: 768px) {
  .sidebar { width: 200px; padding: 16px 12px; }
  .main-content { padding: 16px; }
  .auth-container { width: 100%; padding: 30px 20px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .live2d-side { width: 200px; bottom: 10px; right: 10px; }
  .live2d-stage canvas { width: 180px !important; height: 260px !important; }
  .live2d-bubble { font-size: 12px; max-width: 180px; }
  .live2d-selectors { flex-direction: column; gap: 3px; }
}

/* 手机 */
@media (max-width: 600px) {
  .app-layout { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 240px; height: 100%;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    padding: 20px 16px;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    border-radius: 0;
  }
  .sidebar.collapsed {
    width: 240px;
    padding: 20px 16px;
  }
  .sidebar-collapse-btn {
    display: none;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-logo, .sidebar-footer { display: flex; }
  .nav-menu { flex-direction: column; justify-content: flex-start; }
  .nav-item { padding: 10px 14px; font-size: 13px; }

  /* 遮罩层 */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 1999;
  }
  .sidebar-overlay.show {
    display: block;
  }

  .main-content { padding: 12px; margin-left: 0; }

  /* 汉堡菜单按钮 */
  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 10px; left: 10px;
    z-index: 2001;
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-primary);
  }

  .workspace-bar { padding-left: 48px; }
  .live2d-side { width: 180px; bottom: 8px; right: 8px; }
  .live2d-stage canvas { width: 160px !important; height: 220px !important; }
  .live2d-controls { gap: 4px; }
  .live2d-controls .voice-btn { width: 28px; height: 28px; font-size: 12px; }
  .live2d-selectors { flex-direction: column; gap: 3px; }
  .selector-dropdown { max-width: 80px; font-size: 10px; }
  .live2d-bubble { font-size: 11px; max-width: 160px; }
  .live2d-toggle-btn { bottom: 10px; right: 10px; width: 36px; height: 36px; font-size: 16px; }
  .live2d-side { width: 160px; bottom: 6px; right: 6px; }
  .live2d-stage canvas { width: 140px !important; height: 200px !important; }
  .live2d-controls { gap: 3px; }
  .live2d-controls .voice-btn { width: 26px; height: 26px; font-size: 11px; }
  .live2d-selectors { flex-direction: column; gap: 2px; }
  .selector-dropdown { max-width: 70px; font-size: 9px; }
  .live2d-bubble { font-size: 10px; max-width: 140px; }
  .live2d-side.hidden ~ .live2d-toggle-btn { bottom: 10px; right: 10px; }
  .reward-float-btn { bottom: 10px; left: 10px; width: 44px; height: 44px; font-size: 20px; }

  .profile-modal { max-width: calc(100vw - 32px); margin: 16px; }

  .chat-messages { padding: 8px; }
  .message-bubble { font-size: 13px; padding: 10px 14px; max-width: 85%; }
  .chat-input-area textarea { font-size: 14px; padding: 10px; }
  .upload-zone { padding: 20px; }
  .doc-list, .history-list { gap: 6px; }
  .auth-container { width: 100%; padding: 20px; }
  .stat-cards { grid-template-columns: 1fr; }

  /* ===== 刷题移动端适配 ===== */
  .quiz-panel { padding-bottom: 70px; }
  .quiz-sub-tabs button { font-size: 12px; padding: 9px 4px; }
  .quiz-filter-bar { flex-wrap: wrap; gap: 8px; }
  .quiz-select { flex: 1; min-width: 0; font-size: 13px; }
  .quiz-card { padding: 14px; }
  .quiz-card .q-content { font-size: 14px; }
  .quiz-card .q-options label { font-size: 13px; padding: 8px 0; }
  .practice-topbar { flex-wrap: wrap; }
  .practice-bottombar { position: sticky; bottom: 0; background: var(--bg-primary); padding: 10px 0; }
  .practice-nav-btn { font-size: 13px; padding: 14px 6px; }
  .practice-card { padding: 14px; }
  .practice-card .p-content { font-size: 15px; }
  .practice-option-row { padding: 13px 12px; font-size: 14px; }
  .quiz-stats-cards { grid-template-columns: repeat(2, 1fr); }
  .practice-report-score { font-size: 44px; }
}

/* 桌面端隐藏汉堡菜单按钮 */
@media (min-width: 601px) {
  .mobile-menu-btn { display: none; }
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }

/* ========== 进度条 ========== */
.progress-bar-wrapper {
  width: 100%;
  height: 6px;
  background: var(--glass-bg);
  border-radius: 3px;
  margin-top: 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--pink));
  border-radius: 3px;
  transition: width 0.5s ease;
  position: absolute;
  left: 0;
  top: 0;
}

.progress-pct {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 查看内容按钮 */
.btn-view-content {
  padding: 3px 12px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  margin-left: 8px;
  transition: all 0.2s;
}

.btn-view-content:hover {
  background: var(--primary);
  color: white;
}

.btn-view-original {
  padding: 3px 12px;
  border: 1px solid var(--success);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--success);
  cursor: pointer;
  font-size: 12px;
  margin-left: 4px;
  transition: all 0.2s;
}

.btn-view-original:hover {
  background: var(--success);
  color: white;
}

.doc-error-hint {
  font-size: 11px;
  color: var(--danger);
  margin-left: 8px;
}

/* ========== 内容查看弹窗 ========== */
.content-modal .modal { max-width: 920px; max-height: 88vh; }
.content-modal-box {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}
.content-modal-box .modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass-bg);
}
.content-modal-box .modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

/* 分页工具栏 */
.content-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--glass-border);
  background: var(--surface);
  flex-shrink: 0;
}

/* 底部分页栏去掉底部边框，加顶部边框 */
.content-pagination-bottom {
  border-bottom: none;
  border-top: 1px solid var(--glass-border);
}

.content-pagination button {
  padding: 7px 18px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.25s;
}

.content-pagination button:hover:not(:disabled) {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.content-pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#contentPageInfo {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 内容滚动区 */
.content-modal-box .modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--bg);
  max-height: calc(85vh - 120px);
}

/* 加载状态 */
.content-loading {
  text-align: center;
  padding: 60px 40px;
  color: var(--text-muted);
  font-size: 15px;
}
.content-loading.error { color: var(--danger); }

/* === A4 纸张样式（文档内容查看） === */
.content-modal-box .modal-body {
  background: #e8eaf0;
  padding: 24px 16px;
}

.a4-page {
  position: relative;
  width: 210mm;
  max-width: 100%;
  min-height: 297mm;
  margin: 0 auto 28px;
  padding: 18mm 16mm 20mm;
  background: #ffffff;
  border-radius: 3px;
  box-shadow: 0 4px 24px rgba(31, 38, 135, 0.18), 0 1px 4px rgba(0,0,0,0.08);
  box-sizing: border-box;
  color: #1a1a1a;
  font-family: 'Songti SC', 'STSong', 'SimSun', 'Source Han Serif SC', 'Noto Serif CJK SC', Georgia, serif;
  font-size: 14px;
  line-height: 1.95;
  letter-spacing: 0.2px;
}

/* 页码角标 */
.a4-page-number {
  position: absolute;
  bottom: 8mm;
  right: 16mm;
  font-size: 11px;
  color: #9ca3af;
  font-family: -apple-system, 'PingFang SC', sans-serif;
  letter-spacing: 0.5px;
  background: rgba(255,255,255,0.9);
  padding: 2px 8px;
  border-radius: 8px;
}

.a4-page-body {
  text-align: justify;
  word-break: break-word;
}

/* Markdown 内容在 A4 纸上的排版 */
.a4-page-body markdown-body,
.a4-page-body.markdown-body {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.a4-page-body h1,
.a4-page-body h2,
.a4-page-body h3,
.a4-page-body h4 {
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: #111827;
  font-weight: 600;
  margin: 1.2em 0 0.6em;
  line-height: 1.4;
}
.a4-page-body h1 { font-size: 1.6em; border-bottom: 2px solid #e5e7eb; padding-bottom: 0.3em; }
.a4-page-body h2 { font-size: 1.35em; border-bottom: 1px solid #e5e7eb; padding-bottom: 0.25em; }
.a4-page-body h3 { font-size: 1.18em; }
.a4-page-body h4 { font-size: 1.05em; }

.a4-page-body p {
  margin: 0 0 0.85em 0;
  text-indent: 2em;
}
.a4-page-body p:first-child { margin-top: 0; }
.a4-page-body p:last-child { margin-bottom: 0; }

.a4-page-body ul,
.a4-page-body ol {
  margin: 0.5em 0 0.85em 2em;
  padding-left: 0.5em;
}
.a4-page-body li { margin: 0.25em 0; }
.a4-page-body li > p { text-indent: 0; }

.a4-page-body blockquote {
  margin: 0.8em 0;
  padding: 0.5em 1em;
  border-left: 4px solid var(--primary, #7c5cbf);
  background: #f9fafb;
  color: #4b5563;
}
.a4-page-body blockquote p { text-indent: 0; }

.a4-page-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95em;
}
.a4-page-body th,
.a4-page-body td {
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  text-align: left;
}
.a4-page-body th {
  background: #f3f4f6;
  font-weight: 600;
  font-family: 'PingFang SC', sans-serif;
}
.a4-page-body tr:nth-child(even) td { background: #fafbfc; }

.a4-page-body code {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.9em;
  background: #f3f4f6;
  padding: 2px 5px;
  border-radius: 4px;
  color: #be185d;
}
.a4-page-body pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 14px 18px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1em 0;
}
.a4-page-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}
.a4-page-body hr {
  border: none;
  border-top: 1px dashed #d1d5db;
  margin: 1.5em 0;
}
.a4-page-body strong { font-weight: 600; color: #111827; }
.a4-page-body a { color: var(--primary, #7c5cbf); text-decoration: none; }

/* 滚动条美化 */
.content-modal-box .modal-body::-webkit-scrollbar {
  width: 6px;
}
.content-modal-box .modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.content-modal-box .modal-body::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}
.content-modal-box .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========== AI 生成 HTML 页面 ========== */
.html-tools {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0,0,0,0.12);
}
.html-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #7c5cbf, #5b8def);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.html-tool-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.html-tool-btn:active { transform: translateY(0); }

.html-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 20, 35, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.html-modal {
  width: min(960px, 94vw);
  height: min(680px, 90vh);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.html-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #f7f7fb;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
  color: #1f2937;
  flex-wrap: wrap;
}
.html-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.html-modal-actions button,
.html-modal-actions a {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
.html-modal-actions button:hover,
.html-modal-actions a:hover { background: #eef0f5; }
.html-modal-url {
  padding: 8px 16px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  border-bottom: 1px solid #e5e7eb;
}
.html-modal-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

