/* ===== 日昇极客 - 明亮专注学生友好型样式 ===== */
/* 设计理念：明亮不刺眼、专注不分散、适合长时间学习 */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* 主色调：科技蓝 - 专注且信任 */
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  
  /* 背景色：柔和米白 - 护眼不刺眼 */
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-warm: #f1f5f9;
  
  /* 文字色：深灰 - 高对比度易读 */
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --white: #ffffff;
  
  /* 边框与分割 */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  /* 功能色 */
  --error: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* 阴影：柔和层次 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  
  /* 圆角 */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  min-height: 100vh;
}

/* ===== 通用工具类 ===== */
.hidden { display: none !important; }

/* ===== 页面容器 ===== */
.page { display: none; padding-bottom: 80px; animation: fadeInUp 0.3s ease-out; }
.page.active { display: block; }
.page.hidden { display: none; }

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Toast 提示 ===== */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); color: var(--primary); padding: 12px 24px;
  border-radius: var(--radius-sm); border: 1px solid var(--primary);
  font-size: 14px; z-index: 10000; transition: opacity 0.3s;
  max-width: 90%; text-align: center; font-family: 'PingFang SC', sans-serif;
  box-shadow: var(--shadow-md);
}
.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { background: #ecfdf5; color: var(--success); border-color: var(--success); }
.toast.error { background: #fef2f2; color: var(--error); border-color: var(--error); }

/* ===== Loading ===== */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(248,250,252,0.95);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
  backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none; }

.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 登录页 ===== */
.login-container {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 40px 20px;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
}

.login-logo {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 22px; display: flex; align-items: center; justify-content: center;
  font-size: 44px; color: white; margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(79,70,229,0.25);
  transition: transform 0.3s;
}
.login-logo:hover { transform: scale(1.05); }

.login-title {
  font-size: 32px; font-weight: 700; color: var(--text);
  margin-bottom: 4px; letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 14px; color: var(--text-light); margin-bottom: 36px;
}

.login-form { width: 100%; max-width: 340px; }

.login-input {
  width: 100%; padding: 16px 18px;
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 16px;
  color: var(--text); outline: none; transition: all 0.3s;
  font-family: 'PingFang SC', sans-serif;
}
.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.login-input::placeholder { color: var(--text-lighter); }

.login-status { font-size: 12px; color: var(--error); margin-top: 6px; min-height: 20px; }

.login-btn {
  width: 100%; padding: 16px; border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; letter-spacing: 2px; margin-top: 14px;
  box-shadow: 0 4px 12px rgba(79,70,229,0.25);
  font-family: 'PingFang SC', sans-serif;
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,70,229,0.35);
}
.login-btn:active { transform: translateY(0); }

.login-btn.secondary {
  background: transparent; color: var(--primary);
  border: 2px solid var(--primary);
}
.login-btn.secondary:hover { background: rgba(79,70,229,0.04); }

/* ===== Tab导航栏 ===== */
.nav-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 64px;
  background: rgba(255,255,255,0.98); border-top: 1px solid var(--border);
  display: flex; z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; cursor: pointer; color: var(--text-lighter);
  transition: color 0.2s; padding: 6px 0; position: relative;
}
.nav-item.active { color: var(--primary); }
.nav-item.active::after {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 30px; height: 2px; background: var(--primary);
  border-radius: 0 0 2px 2px;
}
.nav-item .nav-icon { font-size: 22px; margin-bottom: 2px; }
.nav-item .nav-label { font-size: 11px; font-weight: 500; }

/* ===== 通用卡片 ===== */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 18px; margin: 12px 16px;
  border: 1px solid var(--border);
  transition: all 0.3s;
  box-shadow: var(--shadow);
}
.card:hover { border-color: rgba(79,70,229,0.2); }
.card-header {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text);
}

/* ===== 首页 ===== */
.home-header {
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  color: var(--text); padding: 36px 20px 20px; position: relative;
  overflow: hidden;
}
.home-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 200%;
  background: radial-gradient(circle, rgba(79,70,229,0.03) 0%, transparent 70%);
  pointer-events: none;
}
.home-greeting { font-size: 20px; font-weight: 600; }
.home-sub { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.stats-row {
  display: flex; gap: 8px; margin: -16px 12px 0; position: relative; z-index: 1;
}
.stat-card {
  flex: 1; background: var(--bg-card); border-radius: 10px;
  padding: 10px 4px; text-align: center;
  border: 1px solid var(--border);
  transition: all 0.3s;
  box-shadow: var(--shadow);
}
.stat-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(79,70,229,0.12);
}
.stat-number {
  font-size: 20px; font-weight: 700; color: var(--primary);
  font-family: 'SF Mono', 'Courier New', monospace;
}
.stat-label { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* 紧凑进度条（升级+题库覆盖率） */
.home-compact-bar {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 14px 16px; margin: 12px; border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hcb-row { display: flex; justify-content: space-between; font-size: 13px; }
.hcb-label { color: var(--text-light); }
.hcb-value { font-weight: 600; color: var(--primary); }

/* 进度条 */
.progress-bar {
  height: 8px; background: var(--border); border-radius: 4px;
  overflow: hidden; margin: 10px 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px; transition: width 0.5s ease;
}

/* 模式卡片网格 */
.modes-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 0 12px;
}
.mode-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 16px 12px; text-align: center;
  border: 1px solid var(--border);
  cursor: pointer; transition: all 0.3s; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.mode-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  opacity: 0; transition: opacity 0.3s;
}
.mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(79,70,229,0.12);
}
.mode-card:hover::before { opacity: 1; }
.mode-card .mode-icon { font-size: 28px; margin-bottom: 6px; display: block; }
.mode-card .mode-title { font-size: 14px; font-weight: 600; color: var(--text); }
.mode-card .mode-desc { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* AI建议卡片 */
.ai-card {
  background: linear-gradient(135deg, #eef2ff, #f0f9ff);
  border: 1px solid rgba(79,70,229,0.15);
}
.ai-advice { font-size: 14px; line-height: 1.8; color: var(--text); }
.ai-advice p { margin: 4px 0; }

/* ===== 答题页 ===== */
.quiz-header {
  position: sticky; top: 0; background: rgba(255,255,255,0.98);
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.quiz-progress { font-size: 14px; color: var(--text-light); font-family: 'SF Mono', 'Courier New', monospace; }
.quiz-timer { font-size: 14px; font-weight: 600; color: var(--primary); font-family: 'SF Mono', 'Courier New', monospace; }
.quiz-timer.warning { color: var(--error); animation: pulse 1s infinite; }

.question-area { padding: 22px 16px; }
.question-type-badge {
  display: inline-block; padding: 3px 12px; border-radius: 12px;
  font-size: 12px; background: rgba(79,70,229,0.08); color: var(--primary);
  margin-bottom: 10px; border: 1px solid rgba(79,70,229,0.15);
  font-family: 'SF Mono', 'Courier New', monospace; font-weight: 500;
}
.question-text {
  font-size: 17px; font-weight: 500; line-height: 1.8; margin-bottom: 22px;
  color: var(--text);
}

.options-list { display: flex; flex-direction: column; gap: 12px; }
.option-item {
  padding: 16px 18px; background: var(--bg-card);
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s; font-size: 15px;
  position: relative; overflow: hidden;
}
.option-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent; transition: background 0.2s;
}
.option-item:hover {
  border-color: var(--primary);
  background: rgba(79,70,229,0.02);
}
.option-item:hover::before { background: var(--primary); }
.option-item.selected {
  border-color: var(--primary);
  background: rgba(79,70,229,0.04);
}
.option-item.selected::before { background: var(--primary); }
.option-item.correct {
  border-color: var(--success); background: #f0fdf4;
}
.option-item.correct::before { background: var(--success); }
.option-item.wrong {
  border-color: var(--error); background: #fef2f2;
}
.option-item.wrong::before { background: var(--error); }
.opt-letter { font-weight: 700; color: var(--primary); margin-right: 6px; }
.option-item.correct .opt-letter { color: var(--success); }
.option-item.wrong .opt-letter { color: var(--error); }

.quiz-actions {
  position: fixed; bottom: 64px; left: 0; right: 0;
  background: rgba(255,255,255,0.98); padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.04);
}
.quiz-actions button {
  flex: 1; padding: 15px; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: 'SF Mono', 'Courier New', monospace; letter-spacing: 1px;
  transition: all 0.2s;
}
.btn-prev { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-prev:hover { border-color: var(--primary); }
.btn-next {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}
.btn-next:hover { box-shadow: 0 6px 20px rgba(79,70,229,0.35); }
.btn-submit {
  background: linear-gradient(135deg, var(--error), #f87171);
  color: white;
  box-shadow: 0 4px 12px rgba(239,68,68,0.25);
}
.btn-submit:hover { box-shadow: 0 6px 20px rgba(239,68,68,0.35); }
.btn-ai {
  background: linear-gradient(135deg, var(--primary-light), #a78bfa);
  color: white;
}
.btn-ai-home {
  display: block; width: calc(100% - 32px); margin: 0 16px 16px; padding: 14px;
  background: linear-gradient(135deg, var(--primary-light), #a78bfa);
  color: white; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.btn-ai-home:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ai-home:active { transform: scale(0.98); }

/* AI解析弹窗 */
.ai-modal {
  position: fixed; inset: 0; background: rgba(248,250,252,0.92);
  display: flex; align-items: flex-end; z-index: 5000;
}
.ai-modal.hidden { display: none; }
.ai-content {
  background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0;
  padding: 26px 20px; max-height: 60vh; overflow-y: auto; width: 100%;
  border-top: 1px solid var(--primary);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
}
.ai-content h3 { margin-bottom: 14px; color: var(--primary); }
.ai-content .explanation { font-size: 14px; line-height: 1.8; color: var(--text); }
.ai-close {
  width: 100%; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-light); font-size: 15px; cursor: pointer; margin-top: 14px;
  font-family: 'SF Mono', 'Courier New', monospace;
}
.ai-close:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 选择弹窗 ===== */
.picker-modal {
  position: fixed; inset: 0; background: rgba(248,250,252,0.92);
  display: flex; align-items: flex-end; z-index: 5000;
}
.picker-modal.hidden { display: none; }
.picker-content {
  background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px; max-height: 70vh; overflow-y: auto; width: 100%;
  border-top: 1px solid var(--primary);
}
.picker-title {
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
  text-align: center; color: var(--text);
}
.picker-item {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 15px; transition: all 0.2s;
  color: var(--text);
}
.picker-item:hover {
  background: rgba(79,70,229,0.04);
  padding-left: 24px;
}
.picker-item .item-sub { font-size: 12px; color: var(--text-lighter); margin-top: 3px; }
.picker-close {
  width: 100%; padding: 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: transparent;
  color: var(--text-light); font-size: 15px; cursor: pointer; margin-top: 14px;
  font-family: 'SF Mono', 'Courier New', monospace;
}
.picker-close:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 结果页 ===== */
.result-container { text-align: center; padding: 50px 20px; }
.result-score {
  width: 130px; height: 130px; margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 700; color: white;
  font-family: 'SF Mono', 'Courier New', monospace;
  box-shadow: 0 8px 32px rgba(79,70,229,0.3);
}
.result-detail { display: flex; gap: 20px; justify-content: center; margin: 24px 0; }
.result-item { text-align: center; }
.result-item .num { font-size: 28px; font-weight: 700; font-family: 'SF Mono', 'Courier New', monospace; }
.result-item .num.correct { color: var(--success); }
.result-item .num.wrong { color: var(--error); }
.result-item .label { font-size: 12px; color: var(--text-light); }

.result-actions { display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
.result-actions button {
  padding: 15px; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: 'SF Mono', 'Courier New', monospace; letter-spacing: 1px;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79,70,229,0.35); }
.btn-outline {
  background: transparent; color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: rgba(79,70,229,0.04); }

/* ===== 错题本 ===== */
.wrong-filters {
  display: flex; gap: 8px; padding: 14px 16px; overflow-x: auto;
}
.filter-tag {
  padding: 7px 16px; border-radius: 16px; border: 1px solid var(--border);
  font-size: 13px; cursor: pointer; white-space: nowrap; transition: all 0.2s;
  color: var(--text-light); font-weight: 500;
}
.filter-tag.active {
  background: rgba(79,70,229,0.08); color: var(--primary);
  border-color: var(--primary);
}

.wrong-item {
  background: var(--bg-card); margin: 10px 16px; padding: 18px;
  border-radius: var(--radius); border: 1px solid var(--border);
  transition: all 0.3s;
  box-shadow: var(--shadow);
}
.wrong-item:hover { border-color: rgba(79,70,229,0.2); }
.wrong-question { font-size: 15px; font-weight: 500; margin-bottom: 10px; color: var(--text); }
.wrong-answer { font-size: 13px; color: var(--text-light); }
.wrong-answer .correct { color: var(--success); font-weight: 600; }

.wrong-options { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.wrong-opt {
  padding: 8px 12px; border-radius: 8px; font-size: 13px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  transition: all 0.2s;
}
.wrong-opt-label { font-weight: 700; color: var(--text-light); margin-right: 6px; }
.wrong-opt-correct {
  background: rgba(16,185,129,0.06); border-color: rgba(16,185,129,0.3);
}
.wrong-opt-correct .wrong-opt-label { color: var(--success); }

.wrong-actions { margin-top: 10px; display: flex; gap: 8px; }
.btn-master {
  padding: 8px 14px; border: none; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer;
  background: rgba(16,185,129,0.08); color: var(--success);
  border: 1px solid rgba(16,185,129,0.3);
  font-family: 'SF Mono', 'Courier New', monospace; font-weight: 500;
}
.btn-master:hover { background: rgba(16,185,129,0.15); }

/* ===== 排行榜 ===== */
.lb-tabs {
  display: flex; background: var(--bg-card); margin: 0;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.lb-tab {
  flex: 1; padding: 15px 8px; text-align: center; font-size: 14px;
  cursor: pointer; color: var(--text-lighter); border-bottom: 2px solid transparent;
  transition: all 0.2s; font-weight: 500;
  font-family: 'SF Mono', 'Courier New', monospace;
  letter-spacing: 1px;
}
.lb-tab.active {
  color: var(--primary); border-bottom-color: var(--primary);
}

/* 时间筛选Tab */
.lb-period-tabs {
  display: flex; gap: 6px; padding: 12px 16px;
  background: var(--bg);
}
.lb-period-tab {
  padding: 6px 14px; border-radius: 14px;
  font-size: 12px; cursor: pointer; transition: all 0.2s;
  color: var(--text-light); border: 1px solid var(--border);
  font-weight: 500;
}
.lb-period-tab.active {
  background: rgba(79,70,229,0.08); color: var(--primary);
  border-color: var(--primary);
}

/* 年级筛选Tab（班级排行用） */
.lb-grade-tabs {
  display: flex; gap: 8px; padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.lb-grade-tab {
  flex: 1; padding: 8px 12px; text-align: center;
  font-size: 13px; border-radius: 10px; cursor: pointer;
  color: var(--text-light); background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 500; transition: all 0.2s;
}
.lb-grade-tab.active {
  background: rgba(79,70,229,0.08); color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.lb-item {
  display: flex; align-items: center; padding: 14px 16px;
  background: var(--bg-card); margin: 6px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.3s; position: relative; overflow: hidden;
  animation: slideIn 0.3s ease-out;
  box-shadow: var(--shadow);
}
.lb-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent; transition: background 0.3s;
}
.lb-item:hover { border-color: rgba(79,70,229,0.3); }
.lb-item:hover::before { background: var(--primary); }
.lb-item.lb-me {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(79,70,229,0.12);
}
.lb-item.lb-me::before { background: var(--primary); }

.lb-rank {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-right: 14px;
  background: var(--border); color: var(--text-light);
  font-family: 'SF Mono', 'Courier New', monospace;
  flex-shrink: 0;
}
.lb-rank.top1 {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  box-shadow: 0 4px 12px rgba(251,191,36,0.4);
}
.lb-rank.top2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: white;
  box-shadow: 0 4px 12px rgba(148,163,184,0.4);
}
.lb-rank.top3 {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: white;
  box-shadow: 0 4px 12px rgba(217,119,6,0.4);
}

.lb-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; font-weight: 700;
  margin-right: 14px; flex-shrink: 0;
  font-family: 'SF Mono', 'Courier New', monospace;
}
.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 15px; font-weight: 500; color: var(--text); }
.lb-score { font-size: 13px; color: var(--text-light); margin-top: 3px; }
.lb-class { font-size: 11px; color: var(--text-lighter); margin-top: 2px; }

/* 班级榜特殊样式 */
.lb-item.class-item { padding: 16px; }
.lb-item.class-item .lb-rank { width: 36px; height: 36px; font-size: 15px; }
.lb-item.class-item .lb-info { display: flex; justify-content: space-between; align-items: center; }
.lb-class-name { font-size: 16px; font-weight: 600; color: var(--text); }
.lb-class-stats { font-size: 12px; color: var(--text-light); text-align: right; }

/* 个人排名卡片 */
.my-rank-card {
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  border: 2px solid var(--primary-light);
  border-radius: 16px; padding: 16px 20px; margin: 0 4px;
}
.my-rank-label {
  font-size: 13px; color: var(--text-light); margin-bottom: 10px; font-weight: 500;
}
.my-rank-row {
  display: flex; align-items: center; gap: 14px;
}
/* 排行榜区域标题 */
.lb-section-title {
  font-size: 14px; font-weight: 600; color: var(--text-light);
  padding: 8px 16px 6px; letter-spacing: 0.3px;
}

/* ===== 个人中心 ===== */
.mine-header {
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  color: var(--text); padding: 48px 20px 28px; text-align: center;
  border-bottom: 1px solid var(--border); position: relative; overflow: hidden;
}
.mine-avatar {
  width: 70px; height: 70px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(79,70,229,0.15), rgba(129,140,248,0.15));
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; margin: 0 auto 10px;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
}
.mine-name { font-size: 22px; font-weight: 600; }
.mine-level { font-size: 14px; color: var(--text-light); margin-top: 6px; }

.level-progress {
  margin: -14px 16px 0; background: var(--bg-card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative; z-index: 1;
}
.level-title {
  font-size: 14px; display: flex; justify-content: space-between;
  color: var(--text-light); font-weight: 500;
}
.level-bar {
  height: 10px; background: var(--border); border-radius: 5px;
  overflow: hidden; margin: 10px 0;
}

.achievement-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin: 12px 16px;
}
.achievement-card {
  text-align: center; padding: 14px 8px;
  background: var(--bg-card); border-radius: var(--radius-sm);
  border: 1px solid var(--border); transition: all 0.3s;
  box-shadow: var(--shadow);
}
.achievement-card:hover { border-color: rgba(79,70,229,0.2); }
.achievement-card .ach-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.achievement-card .ach-name { font-size: 11px; color: var(--text-light); font-weight: 500; }
.achievement-card.locked { opacity: 0.35; }
.achievement-card.unlocked .ach-icon { filter: none; }

/* ===== 滚动区域 ===== */
.scroll-content {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}

/* ===== 答题反馈 ===== */
.answer-feedback {
  margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm);
  font-size: 14px; line-height: 1.8; position: relative; overflow: hidden;
  animation: fadeInUp 0.3s ease-out;
}
.answer-feedback::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.answer-feedback.feedback-correct {
  background: #f0fdf4; border: 1px solid rgba(16,185,129,0.2);
}
.answer-feedback.feedback-correct::before { background: var(--success); }
.answer-feedback.feedback-wrong {
  background: #fef2f2; border: 1px solid rgba(239,68,68,0.2);
}
.answer-feedback.feedback-wrong::before { background: var(--error); }

.feedback-status { font-weight: 600; margin-bottom: 6px; }
.feedback-correct .feedback-status { color: var(--success); }
.feedback-wrong .feedback-status { color: var(--error); }
.feedback-answer { font-size: 13px; color: var(--success); margin-bottom: 6px; font-weight: 500; }
.feedback-explain {
  font-size: 13px; color: var(--text-light); line-height: 1.8;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-lighter);
}
.empty-state .empty-icon { font-size: 52px; margin-bottom: 14px; display: block; }
.empty-state p { font-size: 14px; }

/* ===== 编辑资料弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(248,250,252,0.92);
  display: flex; align-items: center; justify-content: center; z-index: 5000;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--bg-card); border-radius: var(--radius); padding: 26px;
  width: 340px; max-width: 90%; border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 18px; text-align: center; color: var(--text); }
.modal-input {
  width: 100%; padding: 14px; background: var(--bg);
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; color: var(--text); outline: none; transition: all 0.3s;
  font-family: 'SF Mono', 'Courier New', monospace;
}
.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.modal-actions { display: flex; gap: 12px; margin-top: 18px; }
.modal-actions button {
  flex: 1; padding: 13px; border: none; border-radius: var(--radius-sm);
  font-size: 15px; cursor: pointer; font-weight: 500;
  font-family: 'SF Mono', 'Courier New', monospace;
  letter-spacing: 1px; transition: all 0.2s;
}
.modal-actions .btn-cancel { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.modal-actions .btn-cancel:hover { border-color: var(--text-light); }
.modal-actions .btn-confirm { background: var(--primary); color: white; font-weight: 600; }
.modal-actions .btn-confirm:hover { box-shadow: 0 4px 12px rgba(79,70,229,0.3); }

/* ===== 响应式 ===== */
@media (min-width: 768px) {
  .page {
    max-width: 480px; margin: 0 auto; background: var(--bg);
    min-height: 100vh; box-shadow: 0 0 40px rgba(0,0,0,0.08);
  }
  .nav-bar { max-width: 480px; left: 50%; transform: translateX(-50%); }
}

/* ===== 关于弹窗 ===== */
.about-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.about-dialog {
  background: var(--bg-card); border-radius: 20px; padding: 32px 28px;
  text-align: center; width: 300px; box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: fadeInUp 0.3s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.about-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.about-version { font-size: 13px; color: var(--text-light); margin-bottom: 16px; }
.about-copyright { font-size: 14px; color: var(--primary); font-weight: 500; margin-bottom: 20px; }
.about-close {
  padding: 10px 48px; border: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: 'SF Mono', 'Courier New', monospace;
}

/* === AI 对话答疑 === */
.ai-chat-fab {
  position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px;
  border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 24px; cursor: pointer; z-index: 9999;
  box-shadow: 0 4px 16px rgba(79,70,229,0.35);
  transition: transform 0.2s;
}
.ai-chat-fab:hover { transform: scale(1.1); }
.ai-chat-fab:active { transform: scale(0.95); }
.ai-chat-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 10000; animation: fadeIn 0.2s ease;
}
.ai-chat-panel {
  width: 100%; max-width: 600px; max-height: 70vh;
  background: var(--bg-card); border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}
.ai-chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: 16px; font-weight: 600;
}
.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px; max-height: 50vh;
  display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.6; word-break: break-word;
}
.chat-bubble-user {
  align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; border-bottom-right-radius: 4px;
}
.chat-bubble-ai {
  align-self: flex-start; background: #f3f4f6; color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-chat-input-row {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}
.ai-chat-input {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 14px; outline: none;
  font-family: inherit;
}
.ai-chat-input:focus { border-color: var(--primary); }
.ai-chat-send {
  padding: 10px 18px; border: none; border-radius: 20px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.ai-chat-send:hover { opacity: 0.9; }
