/* ====== 全局重置与基础变量 ====== */
:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --success: #22c55e;
  --success-light: #dcfce7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --text-main: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

* {
  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-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

/* ====== View 切换 ====== */
.view {
  display: none;
  min-height: 100vh;
}
.view.active {
  display: block;
}

/* ====== 登录/注册 ====== */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0ea5e9 0%, #0369a1 100%);
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
}

.auth-header {
  text-align: center;
  margin-bottom: 22px;
}

.auth-logo {
  font-size: 38px;
  margin-bottom: 8px;
}

.auth-header h1 {
  font-size: 19px;
  color: var(--text-main);
  margin-bottom: 4px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.auth-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
}

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

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.auth-hint {
  text-align: center;
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
  color: var(--danger);
}

/* ====== 按钮 ====== */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ====== 导航栏 ====== */
.navbar {
  background: white;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.nav-center {
  display: flex;
  gap: 4px;
}

.nav-item {
  padding: 7px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon-btn:hover {
  background: var(--bg-main);
}

.nav-user {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* ====== 内容区域 ====== */
.content-view {
  display: none;
  padding: 16px;
  max-width: 1000px;
  margin: 0 auto;
}
.content-view.active {
  display: block;
}

.page-header {
  margin-bottom: 16px;
}

.page-header h2 {
  font-size: 20px;
  color: var(--text-main);
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* ====== 仪表盘 ====== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.dashboard-card h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-bar-label {
  width: 100px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
}

.chart-bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-main);
  border-radius: 10px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 12px;
  color: white;
  font-weight: 600;
  min-width: 30px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.recent-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-item-title {
  font-weight: 600;
  color: var(--text-main);
}

.recent-item-meta {
  font-size: 12px;
  color: var(--text-light);
}

.recent-item-score {
  font-weight: 700;
  font-size: 16px;
}

.year-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.year-progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.year-progress-label {
  font-weight: 600;
  width: 60px;
  color: var(--text-main);
}

.year-progress-bar {
  flex: 1;
  height: 12px;
  background: var(--bg-main);
  border-radius: 6px;
  overflow: hidden;
}

.year-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 6px;
  transition: width 0.6s ease;
}

.year-progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  width: 80px;
  text-align: right;
}

.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-btn {
  padding: 14px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  color: var(--text-main);
  transition: var(--transition);
  text-align: center;
}

.quick-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

/* ====== VIP状态卡片 ====== */
.vip-status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f8faff 0%, #fff7ed 100%);
  border: 1px solid #e0e7ff;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 16px;
}
.vip-status-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.vip-badge {
  font-size: 14px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #e0e7ff;
}
.vip-status-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ====== 仪表盘联系博主卡片 ====== */
.contact-dashboard-card {
  margin-top: 16px;
  background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
  border: 1px solid #e0e7ff;
}

.contact-dashboard-card h3 {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.contact-item-dash {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid #e8edf5;
  transition: var(--transition);
}

.contact-item-dash:hover {
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.contact-label-dash {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.contact-value-dash {
  font-size: 15px;
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.contact-value-dash:hover {
  color: #667eea;
}

.copy-icon {
  font-size: 13px;
  opacity: 0.6;
}

@media (max-width: 640px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}
.filter-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  margin-bottom: 16px;
}

.filter-group label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  padding: 8px 20px;
  border: 2px solid var(--border);
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.filter-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

.filter-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.filter-summary span {
  font-size: 16px;
  color: var(--text-secondary);
}

.filter-summary strong {
  color: var(--primary);
  font-size: 20px;
}

/* ====== 答题页 ====== */
.exam-page {
  display: none;
}
.exam-page.active {
  display: block;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.quiz-progress {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.quiz-meta {
  display: flex;
  gap: 6px;
}

.badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
}

.badge-ai {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-single {
  background: #d1fae5;
  color: #059669;
}

.badge-multi {
  background: #fef3c7;
  color: #d97706;
  animation: badgeBlink 1.5s ease-in-out infinite;
}

@keyframes badgeBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.multi-select-hint {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #92400e;
}

.quiz-progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.quiz-progress-fill {
  height: 10px;
  background: var(--success);
  border-radius: 5px;
  transition: width 0.3s ease;
}
.quiz-progress-pct {
  margin-left: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}
.subj-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.subj-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.subj-progress-text {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  margin-top: 4px;
}

.quiz-body {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.question-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-main);
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.option-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.option-item.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.option-item.disabled {
  cursor: not-allowed;
}

.option-key {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
  flex-shrink: 0;
}

.option-item.selected .option-key {
  background: var(--primary);
  color: white;
}

.option-item.correct .option-key {
  background: var(--success);
  color: white;
}

.option-item.wrong .option-key {
  background: var(--danger);
  color: white;
}

.option-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  padding-top: 3px;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.answer-panel {
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 16px;
  border-left: 4px solid var(--primary);
}

.answer-result {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.answer-result.correct {
  color: var(--success);
}

.answer-result.wrong {
  color: var(--danger);
}

.answer-detail {
  margin-bottom: 16px;
}

.answer-line {
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text-main);
}

.explanation-box {
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
}

.explanation-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.explanation-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

/* ====== 结果页 ====== */
.result-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.result-emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.result-card h2 {
  font-size: 22px;
  color: var(--text-main);
  margin-bottom: 20px;
}

.result-score {
  margin-bottom: 32px;
}

.score-circle {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background: conic-gradient(var(--primary) 0deg, var(--bg-main) 0deg);
  position: relative;
}

.score-circle::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: white;
}

.score-circle span {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  z-index: 1;
}

.score-circle small {
  font-size: 14px;
  color: var(--text-secondary);
  z-index: 1;
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 32px;
}

.result-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
}

.result-stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-wrong-list {
  text-align: left;
  margin-bottom: 24px;
  max-height: 300px;
  overflow-y: auto;
}

.result-wrong-item {
  padding: 12px;
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

.result-wrong-item .wrong-q {
  color: var(--text-main);
  margin-bottom: 4px;
}

.result-wrong-item .wrong-a {
  font-size: 13px;
  color: var(--danger);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ====== AI训练 ====== */
.ai-page {
  display: none;
}
.ai-page.active {
  display: block;
}

.ai-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.ai-section h3 {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 10px;
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.ai-usage-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.ai-usage-bar .usage-text {
  color: var(--text-secondary);
}
.ai-usage-bar.warning .usage-text {
  color: var(--warning);
  font-weight: 600;
}
.ai-usage-bar.limit .usage-text {
  color: var(--danger);
  font-weight: 600;
}

.api-key-status {
  padding: 8px 0;
}

.usage-stats-box {
  background: var(--bg-accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}
.usage-stats-box .usage-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.usage-stats-box .usage-label {
  color: var(--text-secondary);
}
.usage-stats-box .usage-val {
  font-weight: 600;
}

.ai-wrong-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.ai-wrong-item {
  padding: 16px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--danger);
}

.ai-wrong-item .wrong-meta {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.ai-wrong-item .wrong-q {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.6;
}

.ai-wrong-item .wrong-ans {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.ai-wrong-item .wrong-ans .correct-text {
  color: var(--success);
  font-weight: 600;
}

.ai-wrong-item .wrong-ans .user-text {
  color: var(--danger);
  font-weight: 600;
}

.kp-area {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kp-card {
  padding: 16px;
  background: var(--warning-light);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--warning);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kp-card-info {
  flex: 1;
}

.kp-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.kp-card-count {
  font-size: 13px;
  color: var(--text-secondary);
}

.kp-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 17px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ====== 知识点选题 ====== */
.generate-controls {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.generate-control-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.generate-control-row label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.num-selector {
  display: flex;
  gap: 8px;
}

.num-btn {
  width: 48px;
  height: 40px;
  border: 2px solid var(--border);
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  font-weight: 600;
}

.num-btn:hover {
  border-color: var(--primary);
}

.num-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.generate-summary {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.generate-summary strong {
  color: var(--primary);
}

.kp-select-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kp-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.kp-select-item:hover {
  border-color: var(--primary);
}

.kp-select-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.kp-checkbox {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.kp-select-item.selected .kp-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.kp-select-info {
  flex: 1;
}

.kp-select-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.kp-select-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ====== AI答题 ====== */
.ai-quiz-footer {
  margin-top: 20px;
  text-align: center;
}

/* ====== AI分析 ====== */
.analysis-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.analysis-score-row {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.analysis-score-item {
  text-align: center;
}

.analysis-score-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.analysis-score-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.analysis-section {
  margin-bottom: 24px;
}

.analysis-section h3 {
  font-size: 16px;
  color: var(--text-main);
  margin-bottom: 12px;
}

.kp-strength-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kp-strength-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kp-strength-name {
  width: 140px;
  font-size: 13px;
  color: var(--text-main);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kp-strength-bar {
  flex: 1;
  height: 20px;
  background: var(--bg-main);
  border-radius: 10px;
  overflow: hidden;
}

.kp-strength-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s ease;
}

.kp-strength-text {
  width: 50px;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.ai-review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.ai-review-item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 12px;
}

.ai-review-item.correct {
  background: var(--success-light);
  border-left: 4px solid var(--success);
}

.ai-review-item.wrong {
  background: #fef2f2;
  border-left: 4px solid var(--danger);
}

.ai-review-item .review-q {
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.review-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--danger-light);
  color: var(--danger);
}

.review-badge.kp-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.review-question-text {
  margin-bottom: 10px;
  line-height: 1.6;
  color: var(--text-main);
}

.review-options {
  margin-bottom: 10px;
}

.review-option {
  padding: 6px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  font-size: 13px;
  background: #f5f5f5;
}

.review-option.review-opt-correct {
  background: #d4edda;
  color: #155724;
  font-weight: 500;
}

.review-option.review-opt-wrong {
  background: #f8d7da;
  color: #721c24;
  text-decoration: line-through;
}

.review-answer-line {
  display: flex;
  gap: 20px;
  margin-bottom: 8px;
  font-size: 13px;
}

.review-user-ans {
  color: var(--danger);
  font-weight: 500;
}

.review-correct-ans {
  color: var(--success);
  font-weight: 500;
}

.review-explanation {
  padding: 10px 12px;
  background: #fffbe6;
  border-radius: 6px;
  font-size: 13px;
  color: #666;
  line-height: 1.6;
  border: 1px solid #ffe58f;
}

.ai-review-item .review-a {
  font-size: 13px;
  color: var(--text-secondary);
}

.ai-suggestion {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-wrap;
}

/* ====== 弹窗 ====== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 16px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-main);
}

.modal-body {
  padding: 18px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.data-mgmt {
  display: flex;
  gap: 10px;
}

/* ====== Toast ====== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: white;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  max-width: 350px;
}

.toast.success {
  background: var(--success);
}
.toast.error {
  background: var(--danger);
}
.toast.info {
  background: var(--primary);
}
.toast.warning {
  background: var(--warning);
}

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

/* ====== Loading ====== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.8);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-content p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ====== 博主联系信息浮窗 ====== */
.contact-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

.contact-widget-toggle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: contactPulse 2.5s ease-in-out infinite;
}

.contact-widget-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.contact-widget.expanded .contact-widget-toggle {
  display: none;
}

.contact-icon {
  font-size: 24px;
}

@keyframes contactPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4); }
  50% { box-shadow: 0 4px 24px rgba(102, 126, 234, 0.6); }
}

.contact-widget-card {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 300px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.contact-widget.expanded .contact-widget-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.contact-card-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
}

.contact-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.contact-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.contact-card-body {
  padding: 12px 16px 16px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-label {
  font-size: 12px;
  color: #999;
  font-weight: 500;
}

.contact-value {
  font-size: 15px;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.contact-value:hover {
  color: #667eea;
}

/* 移动端适配 */
@media (max-width: 640px) {
  .contact-widget {
    bottom: 80px;
    right: 12px;
  }
  .contact-widget-card {
    width: 260px;
  }
}

/* ====== 响应式（平板） ====== */
@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

/* ====== 滚动条美化 ====== */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ====== 管理后台 ====== */
.admin-page {
  display: none;
}
.admin-page.active {
  display: block;
}

.nav-admin {
  color: var(--warning);
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.admin-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
  font-weight: 500;
}

.admin-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.admin-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.admin-toolbar input {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 200px;
  outline: none;
}

.admin-toolbar input:focus {
  border-color: var(--primary);
}

.admin-toolbar select {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.admin-user-info {
  flex: 1;
}

.admin-user-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.admin-user-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.badge-admin {
  background: var(--warning-light);
  color: var(--warning);
}

.admin-question-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-q-summary {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.admin-question-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  gap: 16px;
}

.admin-q-info {
  flex: 1;
}

.admin-q-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.admin-q-text {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.6;
}

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

.modal-lg {
  max-width: 700px;
}

.edit-options-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-option-key {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.edit-option-row input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  outline: none;
  resize: vertical;
}

.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.user-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
}

.detail-stat strong {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-stat span {
  font-size: 15px;
  color: var(--text-main);
  font-weight: 600;
}

.admin-history-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 6px;
}

.admin-wrong-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: var(--danger-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 6px;
}

@media (max-width: 900px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .admin-toolbar {
    flex-wrap: wrap;
  }
  .admin-user-item,
  .admin-question-item {
    flex-direction: column;
    gap: 12px;
  }
  .user-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ====== 手机端深度适配 ====== */
@media (max-width: 640px) {
  /* ===== 底部导航栏 ===== */
  .navbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    flex-direction: row;
    height: 54px;
    padding: 0;
    z-index: 1000;
    border-top: 1px solid var(--border);
    border-radius: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
  }
  .nav-logo { display: none; }
  .nav-center {
    order: 0;
    flex: 1;
    justify-content: space-around;
    margin-top: 0;
    gap: 0;
  }
  .nav-item {
    flex: 1;
    padding: 4px 2px;
    font-size: 10px;
    text-align: center;
    border-radius: 0;
    justify-content: center;
    gap: 1px;
    line-height: 1.2;
    flex-direction: column;
    align-items: center;
  }
  .nav-item .nav-icon {
    font-size: 18px;
    display: block;
    line-height: 1;
  }
  .nav-item .nav-label {
    font-size: 10px;
    display: block;
    line-height: 1.2;
  }
  .nav-right { display: none; }

  /* 内容区底部留出导航栏空间 */
  .content-view,
  .view.active {
    padding-bottom: 72px;
  }

  /* ===== 登录注册 ===== */
  .auth-card {
    padding: 20px 16px;
    margin: 0 8px;
    border-radius: 14px;
  }
  .auth-logo { font-size: 32px; }
  .auth-header h1 { font-size: 17px; }
  .auth-header p { font-size: 11px; }
  .auth-tab { font-size: 13px; padding: 7px; }
  .form-group { margin-bottom: 14px; }
  .form-group label { font-size: 12px; margin-bottom: 4px; }
  .form-group input,
  .form-group select { padding: 9px 12px; font-size: 14px; }
  .btn { font-size: 14px; padding: 9px 16px; }

  /* ===== 页面标题 ===== */
  .page-header { margin-bottom: 10px; }
  .page-header h2 { font-size: 16px; }
  .page-header p { font-size: 11px; }

  /* ===== 内容区域 ===== */
  .content-view { padding: 10px; }

  /* ===== VIP状态卡片 ===== */
  .vip-status-card {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }
  .vip-badge { font-size: 11px; padding: 2px 8px; }
  .vip-status-text { font-size: 11px; }

  /* ===== 仪表盘统计 ===== */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 10px;
  }
  .stat-card {
    padding: 8px 6px;
    gap: 6px;
  }
  .stat-icon {
    width: 34px; height: 34px;
    font-size: 18px;
    border-radius: 6px;
  }
  .stat-card .stat-value { font-size: 18px; }
  .stat-card .stat-label { font-size: 10px; }

  /* ===== 仪表盘卡片 ===== */
  .dashboard-card { padding: 10px; }
  .dashboard-card h3 { font-size: 13px; margin-bottom: 8px; }
  .dashboard-row { gap: 8px; margin-bottom: 10px; }

  /* 图表条 */
  .chart-bar-item { gap: 6px; }
  .chart-bar-label {
    width: 60px;
    font-size: 10px;
    text-align: right;
  }
  .chart-bar-track { height: 18px; }
  .chart-bar-fill { font-size: 10px; padding-right: 4px; }

  /* 最近练习记录 */
  .recent-item { padding: 8px 10px; font-size: 12px; }
  .recent-item-title { font-size: 12px; }
  .recent-item-meta { font-size: 10px; }
  .recent-item-score { font-size: 13px; }

  /* 年份进度 */
  .year-progress-label { width: 40px; font-size: 12px; }
  .year-progress-text { width: 50px; font-size: 11px; }

  /* 快速操作 */
  .quick-btn { padding: 10px; font-size: 13px; }

  /* ===== 联系博主卡片 ===== */
  .contact-dashboard-card { padding: 10px; margin-top: 10px; }
  .contact-grid { gap: 6px; }
  .contact-item-dash { padding: 8px 10px; }
  .contact-label-dash { font-size: 10px; }
  .contact-value-dash { font-size: 12px; word-break: break-all; }

  /* ===== 筛选页 ===== */
  .filter-card { padding: 12px; border-radius: 10px; }
  .filter-group { margin-bottom: 12px; }
  .filter-group label { font-size: 13px; margin-bottom: 6px; }
  .filter-options { gap: 5px; }
  .filter-chip {
    padding: 6px 10px;
    font-size: 11px;
    border-radius: 14px;
  }
  .filter-summary {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    margin-top: 12px;
    padding-top: 12px;
  }
  .filter-summary span { font-size: 13px; text-align: center; }
  .filter-summary .btn { width: 100%; }

  /* ===== 答题界面 ===== */
  .quiz-header {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
  }
  .quiz-progress { font-size: 14px; }
  .quiz-meta { flex-wrap: wrap; gap: 3px; }
  .badge { font-size: 9px; padding: 2px 6px; }

  .quiz-progress-bar { margin-bottom: 10px; }

  .quiz-body {
    padding: 12px;
    border-radius: 10px;
  }
  .question-text {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
  }

  .options-list { gap: 6px; margin-bottom: 12px; }
  .option-item {
    padding: 8px 10px;
    gap: 8px;
    border-radius: 8px;
  }
  .option-key {
    width: 26px; height: 26px; min-width: 26px;
    font-size: 12px;
  }
  .option-text { font-size: 13px; line-height: 1.5; padding-top: 2px; }

  .quiz-actions {
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }
  .quiz-actions .btn {
    flex: 1;
    min-width: 90px;
    font-size: 13px;
    padding: 8px 10px;
  }

  .answer-panel { padding: 10px; border-radius: 8px; }
  .answer-result { font-size: 15px; margin-bottom: 6px; }
  .answer-line { font-size: 12px; }
  .explanation-box { padding: 10px; border-radius: 8px; }
  .explanation-title { font-size: 12px; }
  .explanation-text { font-size: 12px; line-height: 1.6; }

  .multi-select-hint {
    padding: 6px 8px;
    font-size: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
  }

  /* ===== 结果页 ===== */
  .result-card {
    padding: 20px 14px;
    border-radius: 12px;
  }
  .result-emoji { font-size: 40px; }
  .result-card h2 { font-size: 18px; margin-bottom: 14px; }
  .score-circle { width: 100px; height: 100px; }
  .score-circle span { font-size: 30px; }
  .result-stats { gap: 16px; margin-bottom: 16px; }
  .result-stat-value { font-size: 20px; }
  .result-stat-label { font-size: 11px; }
  .result-wrong-item { padding: 8px; font-size: 12px; }
  .result-actions {
    flex-wrap: wrap;
    gap: 6px;
  }
  .result-actions .btn {
    flex: 1;
    min-width: 130px;
    font-size: 12px;
    padding: 8px 10px;
  }

  /* ===== AI训练 ===== */
  .ai-section {
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 10px;
  }
  .ai-section h3 { font-size: 14px; margin-bottom: 8px; }
  .section-desc { font-size: 12px; margin-bottom: 10px; }
  .btn-lg { padding: 10px 16px; font-size: 14px; }

  .ai-wrong-item { padding: 10px; border-radius: 8px; }
  .ai-wrong-item .wrong-q { font-size: 12px; line-height: 1.5; }
  .ai-wrong-item .wrong-ans { font-size: 11px; }
  .ai-wrong-item .wrong-meta { gap: 4px; }

  .kp-card { padding: 10px; gap: 6px; border-radius: 8px; }
  .kp-card-name { font-size: 13px; }
  .kp-card-count { font-size: 11px; }

  /* 知识点选题 */
  .generate-controls { padding: 10px; border-radius: 10px; }
  .generate-control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 10px;
  }
  .generate-control-row label { font-size: 13px; }
  .num-selector { gap: 5px; }
  .num-btn { width: 40px; height: 34px; font-size: 12px; }
  .generate-summary { font-size: 12px; margin-bottom: 10px; }

  .kp-select-item { padding: 10px; gap: 8px; border-radius: 8px; }
  .kp-select-name { font-size: 13px; }
  .kp-select-meta { font-size: 11px; }
  .kp-checkbox { width: 20px; height: 20px; min-width: 20px; }

  /* AI答题页 */
  .ai-quiz-footer { margin-top: 10px; }

  /* ===== AI分析报告 ===== */
  .analysis-card {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
  }
  .analysis-score-row {
    margin-bottom: 14px;
    padding-bottom: 12px;
    gap: 6px;
    justify-content: space-around;
  }
  .analysis-score-value { font-size: 22px; }
  .analysis-score-label { font-size: 11px; }
  .analysis-section { margin-bottom: 14px; }
  .analysis-section h3 { font-size: 13px; margin-bottom: 8px; }

  .kp-strength-item { gap: 6px; }
  .kp-strength-name {
    width: 70px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .kp-strength-bar { height: 14px; }
  .kp-strength-text { width: 32px; font-size: 11px; }

  .ai-review-item { padding: 10px; border-radius: 8px; margin-bottom: 8px; }
  .ai-review-item .review-q { font-size: 12px; gap: 4px; }
  .review-badge { font-size: 10px; padding: 2px 6px; }
  .review-question-text { font-size: 12px; line-height: 1.5; }
  .review-option { padding: 4px 8px; font-size: 11px; }
  .review-answer-line { gap: 10px; font-size: 11px; }
  .review-explanation { padding: 6px 8px; font-size: 11px; line-height: 1.5; }
  .ai-suggestion { padding: 10px; font-size: 12px; line-height: 1.6; border-radius: 8px; }

  /* ===== 弹窗 ===== */
  .modal-content {
    margin: 0 6px;
    max-width: calc(100vw - 12px);
    max-height: 86vh;
    overflow-y: auto;
    border-radius: 12px;
  }
  .modal-header { padding: 12px 14px; }
  .modal-header h3 { font-size: 15px; }
  .modal-body { padding: 14px; }
  .modal-footer { padding: 10px 14px; gap: 6px; }
  .modal-footer .btn { flex: 1; font-size: 13px; }

  /* 设置弹窗里的数据管理按钮 */
  .data-mgmt {
    flex-direction: column;
    gap: 6px;
  }
  .data-mgmt .btn {
    width: 100%;
    font-size: 12px;
    padding: 8px 10px;
  }

  /* ===== 管理后台（主站内嵌的） ===== */
  .admin-tabs { flex-wrap: wrap; gap: 4px; }
  .admin-tab { padding: 8px 12px; font-size: 13px; }
  .admin-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }
  .admin-toolbar input { width: 100%; }

  /* ===== 空状态 ===== */
  .empty-state { padding: 30px 12px; }
  .empty-icon { font-size: 40px; }
  .empty-state h3 { font-size: 15px; }
  .empty-state p { font-size: 12px; }

  /* ===== Toast ===== */
  .toast-container {
    top: 10px;
    right: 6px;
    left: 6px;
  }
  .toast {
    font-size: 12px;
    padding: 8px 12px;
    max-width: 100%;
  }

  /* ===== Loading ===== */
  .loading-spinner { width: 36px; height: 36px; }
  .loading-content p { font-size: 13px; }

  /* ===== 手机端更多按钮 ===== */
  .nav-mobile-more {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    padding: 4px 10px;
    min-width: 44px;
    border-left: 1px solid var(--border);
  }

  /* ===== 手机端快捷菜单 ===== */
  .mobile-quick-menu {
    position: fixed;
    bottom: 60px;
    right: 8px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 12px;
    z-index: 1001;
    min-width: 160px;
    overflow: hidden;
  }
  .mobile-menu-item {
    padding: 13px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .mobile-menu-item:active { background: var(--bg-main); }
  .mobile-menu-item:last-child { border-bottom: none; }
  .mobile-menu-danger { color: var(--danger); }
}

/* 超小屏幕（≤375px）额外优化 */
@media (max-width: 375px) {
  .nav-item { padding: 3px 1px; }
  .nav-item .nav-icon { font-size: 15px; }
  .nav-item .nav-label { font-size: 8px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { justify-content: center; }
  .num-btn { width: 36px; height: 32px; font-size: 11px; }
  .quiz-actions .btn { min-width: 70px; font-size: 12px; padding: 7px 8px; }
  .result-actions .btn { min-width: 110px; }
  .filter-chip { padding: 5px 8px; font-size: 10px; }
  .kp-strength-name { width: 56px; font-size: 10px; }
  .question-text { font-size: 13px; }
  .option-text { font-size: 12px; }
  .badge { font-size: 8px; padding: 1px 5px; }
}

/* PC端隐藏更多按钮 */
@media (min-width: 641px) {
  .nav-mobile-more {
    display: none;
  }
}

/* ====== 收藏按钮 ====== */
.badge-fav {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-main);
  font-size: 16px;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  user-select: none;
}
.badge-fav:active { transform: scale(0.9); }

/* ====== 智能推荐按钮 ====== */
.quick-btn-recommend {
  background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
  color: #fff !important;
  border: none !important;
  font-weight: 600;
}

/* ====== 知识地图 ====== */
.km-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.km-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
  transition: all 0.2s;
}
.km-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.km-section {
  margin-bottom: 20px;
}
.km-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.km-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.km-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.km-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.km-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}
.km-card-total {
  font-size: 13px;
  color: var(--text-light);
  background: var(--bg-main);
  padding: 2px 8px;
  border-radius: 6px;
}
.km-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-main);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.km-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 4px;
  transition: width 0.5s ease;
}
.km-card-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.km-stat-wrong { color: var(--danger); }
.km-stat-fav { color: var(--warning); }
.km-year-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.km-year-tag {
  font-size: 11px;
  color: var(--text-light);
  background: var(--bg-main);
  padding: 2px 6px;
  border-radius: 4px;
}

.km-card-score {
  text-align: center;
}
.km-score-display {
  margin: 12px 0;
  display: flex;
  justify-content: center;
}
.km-score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.km-year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.km-year-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.km-year-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.km-year-total {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.km-year-practiced {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.km-empty {
  text-align: center;
  padding: 40px 20px;
}
.km-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.km-empty p {
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.km-empty .btn {
  margin-top: 12px;
}

.km-trend-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.km-trend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.km-trend-date {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 140px;
}
.km-trend-bar {
  flex: 1;
  height: 20px;
  background: var(--bg-main);
  border-radius: 6px;
  overflow: hidden;
}
.km-trend-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
}

/* ====== 移动端知识地图适配 ====== */
@media (max-width: 640px) {
  .km-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .km-card {
    padding: 10px;
  }
  .km-card-title { font-size: 14px; }
  .km-score-circle {
    width: 64px;
    height: 64px;
  }
  .km-score-circle span { font-size: 22px !important; }
  .km-year-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .km-trend-date {
    min-width: 100px;
    font-size: 11px;
  }
  .km-tab {
    padding: 6px 10px;
    font-size: 12px;
  }
}

/* ============================================================
   机考做题 V2 样式
   ============================================================ */

/* 页面切换 */
.exam-v2-page { display: none; }
.exam-v2-page.active { display: block; }

/* 模式选择 */
.exam-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.exam-mode-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.exam-mode-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.exam-mode-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.exam-mode-card h3 {
  font-size: 20px;
  margin-bottom: 12px;
  color: var(--text);
}
.exam-mode-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 单元选择列表 */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.unit-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.unit-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.unit-card-icon {
  font-size: 36px;
  flex-shrink: 0;
}
.unit-card-body {
  flex: 1;
}
.unit-card-body h3 {
  font-size: 17px;
  margin-bottom: 4px;
  color: var(--text);
}
.unit-card-body p {
  font-size: 13px;
  color: var(--text-secondary);
}
.unit-card-arrow {
  font-size: 20px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* 年份选择 */
.year-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.year-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.year-card:hover {
  border-color: var(--primary);
  background: var(--bg);
}
.year-card-year {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}
.year-card-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* 全套题选择区域 */
.full-exam-section {
  margin-top: 24px;
}
.full-exam-section h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text);
}

/* 共享题干/选项区域 */
.shared-context {
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}
.shared-stem {
  background: #f0f7ff;
  border-left: 4px solid #3b82f6;
}
.shared-options {
  background: #fef9f0;
  border-left: 4px solid #f59e0b;
}
.shared-context-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 4px;
}
.shared-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.7);
  padding: 2px 10px;
  border-radius: 20px;
}
.shared-sub-count {
  font-size: 12px;
  color: var(--text-light);
}
.shared-context-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.shared-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shared-option-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255,255,255,0.6);
  padding: 8px 12px;
  border-radius: 8px;
}
.shared-option-item .option-key {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}
.shared-option-item .option-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  padding-top: 4px;
}

/* 当前题目区域 */
.current-question {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
}
.sub-q-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.question-text-v2 {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 题目图片 */
.question-images {
  margin: 12px 0 16px;
}
.question-image-wrapper {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.question-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: zoom;
}
.image-page-ref {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  margin-top: 4px;
}
.image-placeholder {
  width: 300px;
  height: 200px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 14px;
  text-align: center;
  padding: 16px;
}
.image-placeholder small {
  font-size: 11px;
  margin-top: 4px;
  word-break: break-all;
}

/* 选项列表 V2 */
.options-list-v2 {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-item-v2 {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--card-bg);
}
.option-item-v2:hover:not(.disabled) {
  border-color: var(--primary);
  background: var(--bg);
}
.option-item-v2.selected {
  border-color: var(--primary);
  background: #eff6ff;
}
.option-item-v2.disabled {
  cursor: default;
  opacity: 0.85;
}
.option-item-v2.correct {
  border-color: var(--success);
  background: #f0fdf4;
}
.option-item-v2.wrong {
  border-color: var(--danger);
  background: #fef2f2;
}
.option-item-v2 .option-key {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.option-item-v2.selected .option-key {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.option-item-v2.correct .option-key {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.option-item-v2.wrong .option-key {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.option-item-v2 .option-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  padding-top: 4px;
}

/* 题型标签 */
.badge-a1 { background: #dbeafe; color: #2563eb; }
.badge-a2 { background: #d1fae5; color: #059669; }
.badge-a3 { background: #fef3c7; color: #d97706; }
.badge-b { background: #ede9fe; color: #7c3aed; }
.badge-case { background: #fce7f3; color: #db2777; }
.badge-timer {
  background: #1f2937;
  color: #fff;
  font-family: monospace;
  font-size: 13px;
  letter-spacing: 1px;
}

/* 答案面板 V2 */
.exam-v2-page .answer-panel {
  margin-top: 16px;
  background: var(--bg);
  border-radius: 12px;
  padding: 16px;
}
.exam-v2-page .answer-result {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.exam-v2-page .answer-result.correct { color: var(--success); }
.exam-v2-page .answer-result.wrong { color: var(--danger); }
.exam-v2-page .answer-detail {
  font-size: 14px;
  line-height: 1.8;
}
.exam-v2-page .correct-answer-text {
  font-weight: 700;
  color: var(--success);
}

/* 题号导航器 */
.exam-navigator {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px;
  background: var(--bg);
  border-radius: 10px;
  margin-top: 16px;
  max-height: 120px;
  overflow-y: auto;
}
.nav-dot-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.nav-group-label {
  font-size: 9px;
  color: var(--text-light);
  line-height: 1;
}
.nav-dot {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.nav-dot.unanswered { background: #e5e7eb; }
.nav-dot.correct { background: var(--success); }
.nav-dot.wrong { background: var(--danger); }
.nav-dot.current {
  background: var(--primary);
  border: 2px solid var(--primary);
  transform: scale(1.15);
}
.nav-dot:hover { opacity: 0.8; }

/* 结果统计详情 */
.result-stats-detail {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.result-stat-label {
  flex-shrink: 0;
  min-width: 120px;
  text-align: right;
  color: var(--text-secondary);
}
.result-stat-bar {
  flex: 1;
  height: 20px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.result-stat-bar span {
  display: block;
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s;
}
.result-stat-num {
  flex-shrink: 0;
  min-width: 100px;
  font-weight: 600;
  color: var(--text);
}

/* 错题来源标签 */
.wrong-src {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* 响应式 */
@media (max-width: 768px) {
  .exam-mode-grid {
    grid-template-columns: 1fr;
  }
  .exam-mode-card {
    padding: 24px 16px;
  }
  .unit-card {
    padding: 14px;
    gap: 12px;
  }
  .unit-card-icon { font-size: 28px; }
  .unit-card-body h3 { font-size: 15px; }
  .unit-card-body p { font-size: 12px; }
  .year-list {
    grid-template-columns: repeat(2, 1fr);
  }
  .shared-context {
    padding: 12px;
  }
  .shared-context-text {
    font-size: 13px;
    line-height: 1.7;
  }
  .current-question {
    padding: 14px;
  }
  .question-text-v2 {
    font-size: 14px;
  }
  .option-item-v2 {
    padding: 10px 12px;
    gap: 10px;
  }
  .option-item-v2 .option-key {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
  .option-item-v2 .option-text {
    font-size: 13px;
  }
  .nav-dot {
    width: 20px;
    height: 20px;
  }
  .result-stat-label {
    min-width: 80px;
    font-size: 12px;
  }
  .result-stat-num {
    min-width: 80px;
    font-size: 12px;
  }
}
