:root {
  --primary: #4f6df5;
  --primary-light: #eef1ff;
  --secondary: #ff8c42;
  --success: #34c759;
  --warning: #ffcc00;
  --danger: #ff3b30;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-secondary: #6c6c70;
  --border: #e5e5ea;
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

[data-theme="dark"] {
  --primary: #5e7cf7;
  --primary-light: #1f294d;
  --secondary: #ff9f5a;
  --bg: #0f1117;
  --card: #1c1f28;
  --text: #f2f2f7;
  --text-secondary: #8e8e93;
  --border: #2c2c34;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
}

/* 顶部栏 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 20px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

#todayDate {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn.hidden {
  display: none;
}

/* 主内容 */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(90px + var(--safe-bottom));
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.main-content::-webkit-scrollbar {
  width: 0;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-around;
  padding: 10px 0 calc(10px + var(--safe-bottom));
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 100;
}

[data-theme="dark"] .bottom-nav {
  background: rgba(28,31,40,0.92);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 22px;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
}

/* 通用卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* 首页 */
.welcome-section {
  margin-bottom: 20px;
}

.welcome-section h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
}

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

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

.stat-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-number {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 12px;
}

.section-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.section-header a {
  font-size: 13px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* 科目网格 */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.subject-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.subject-card:active {
  transform: scale(0.97);
}

.subject-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--subject-color, var(--primary));
}

.subject-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
}

.subject-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

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

.subject-progress {
  margin-top: 12px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.subject-progress-bar {
  height: 100%;
  background: var(--subject-color, var(--primary));
  border-radius: 3px;
  transition: width 0.4s ease;
}

@media (min-width: 768px) {
  .subject-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 科目详情页 */
.subject-hero {
  background: linear-gradient(135deg, var(--subject-color, var(--primary)), var(--subject-color-dark, var(--primary)));
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.subject-hero h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.subject-hero p {
  opacity: 0.92;
  font-size: 14px;
}

.module-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.module-tabs::-webkit-scrollbar {
  height: 0;
}

.module-tab {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.module-tab.active {
  background: var(--subject-color, var(--primary));
  color: #fff;
  border-color: transparent;
}

/* 预习 & 复习 */
.content-block {
  margin-bottom: 18px;
}

.content-block h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--subject-color, var(--primary));
}

.content-block p, .content-block li {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
}

.content-block ul {
  padding-left: 18px;
}

.content-block li {
  margin-bottom: 6px;
}

.highlight-box {
  background: var(--subject-light, var(--primary-light));
  border-left: 4px solid var(--subject-color, var(--primary));
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 12px 0;
}

.highlight-box strong {
  color: var(--subject-color, var(--primary));
}

/* 思维导图 */
.mindmap-container {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.mindmap {
  min-width: 560px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.mindmap-root {
  flex-shrink: 0;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--subject-color, var(--primary));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.mindmap-branches {
  display: flex;
  gap: 16px;
}

.mindmap-branch {
  min-width: 140px;
}

.mindmap-branch-title {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
  text-align: center;
}

.mindmap-leaf {
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text);
}

.mindmap-leaf.fillable {
  background: var(--subject-light, var(--primary-light));
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mm-hint {
  font-size: 11px;
  color: var(--text-secondary);
}

.mindmap-fill {
  flex: 1;
  min-width: 60px;
  border: none;
  border-bottom: 1.5px dashed var(--subject-color, var(--primary));
  background: transparent;
  font-size: 12px;
  color: var(--text);
  padding: 2px 4px;
  outline: none;
  font-family: inherit;
}

.mindmap-fill:focus {
  border-bottom-style: solid;
  border-color: var(--subject-color, var(--primary));
}

.mindmap-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}

.btn-secondary:hover {
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
}

/* 预习新组件 */
.preview-questions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-q {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--subject-color, var(--primary));
}

.preview-q-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--subject-color, var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.preview-q-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
}

.kv-list {
  list-style: none;
  padding: 0;
}

.kv-list li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  line-height: 1.7;
}

.kv-list li:last-child {
  border-bottom: none;
}

.kp-tag.goal {
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
}

.preview-quiz {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-quiz-item {
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.7;
}

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

.preview-answer {
  margin-top: 8px;
}

.preview-answer summary {
  color: var(--subject-color, var(--primary));
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  padding: 4px 0;
}

.preview-answer[open] summary {
  font-weight: 600;
}

.answer-body {
  padding: 8px 12px;
  background: var(--card);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 4px;
}

/* 延伸拓展块 */
.extension-block {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  border-left: 3px solid var(--subject-color, var(--primary));
}

.ext-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--subject-color, var(--primary));
  margin-bottom: 10px;
}

.ext-passage {
  font-size: 14px;
  line-height: 1.8;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.ext-steps {
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
}

.ext-analysis,
.ext-answer {
  font-size: 14px;
  line-height: 1.7;
  padding: 8px 12px;
  background: var(--card);
  border-radius: 8px;
  margin-top: 8px;
}

.ext-question {
  padding: 10px 0;
  font-size: 14px;
  line-height: 1.7;
  border-top: 1px dashed var(--border);
}

.ext-question:first-of-type {
  border-top: none;
}

.ext-options {
  list-style: none;
  padding: 8px 0 0 8px;
  font-size: 13px;
  line-height: 1.7;
}

.grammar-table {
  font-size: 14px;
  line-height: 1.8;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
  margin-bottom: 10px;
}

.grammar-table table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
}

.grammar-table th,
.grammar-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  font-size: 13px;
}

.grammar-table th {
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
}

/* 练习题 */
.question-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.question-number {
  display: inline-block;
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 100px;
  margin-bottom: 10px;
}

.question-text {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 14px;
}

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

.option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
}

.option-item:active {
  background: var(--subject-light, var(--primary-light));
}

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

.option-item.correct {
  border-color: var(--success);
  background: rgba(52,199,89,0.1);
}

.option-item.wrong {
  border-color: var(--danger);
  background: rgba(255,59,48,0.08);
}

.option-label {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.option-item.selected .option-label {
  background: var(--subject-color, var(--primary));
  color: #fff;
  border-color: transparent;
}

.answer-feedback {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: none;
}

.answer-feedback.show {
  display: block;
}

.answer-feedback.correct {
  background: rgba(52,199,89,0.1);
  color: #1a7c36;
}

.answer-feedback.wrong {
  background: rgba(255,59,48,0.08);
  color: #c41e14;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: 100px;
  border: none;
  background: var(--subject-color, var(--primary));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-block {
  width: 100%;
  margin-top: 12px;
}

/* 错题本 */
.mistake-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--danger);
}

.mistake-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mistake-subject {
  font-size: 12px;
  font-weight: 700;
  color: var(--subject-color, var(--primary));
  background: var(--subject-light, var(--primary-light));
  padding: 3px 10px;
  border-radius: 100px;
}

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

.mistake-question {
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.mistake-answer {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 10px;
  border-radius: var(--radius-sm);
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 14px;
  opacity: 0.6;
}

/* 学习计划 */
.plan-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.plan-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.plan-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.plan-item.done .plan-checkbox {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.plan-item.done .plan-text {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.plan-text {
  flex: 1;
  font-size: 15px;
}

.plan-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--subject-light, var(--primary-light));
  color: var(--subject-color, var(--primary));
  font-weight: 600;
}

/* 周末练习 */
.weekend-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.weekend-banner h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.weekend-banner p {
  opacity: 0.92;
  font-size: 13px;
}

/* 进度与成就 */
.badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

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

/* 章节选择器 */
.chapter-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
}

/* 响应式增强 iPad */
@media (min-width: 768px) {
  .main-content {
    padding: 24px 28px calc(100px + var(--safe-bottom));
  }

  .app-header {
    padding: calc(16px + var(--safe-top)) 28px 16px;
  }

  .app-header h1 {
    font-size: 22px;
  }

  .welcome-section h2 {
    font-size: 32px;
  }

  .question-text, .content-block p, .content-block li {
    font-size: 16px;
  }
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-enter {
  animation: fadeIn 0.3s ease forwards;
}

/* 知识点考点标签 */
.kp-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  margin-right: 6px;
  margin-bottom: 6px;
  font-weight: 600;
}

.kp-tag.key {
  background: rgba(255,59,48,0.1);
  color: var(--danger);
}

.kp-tag.point {
  background: rgba(255,204,0,0.15);
  color: #b38600;
}

.kp-tag.extend {
  background: rgba(52,199,89,0.1);
  color: #1a7c36;
}

/* 公式 */
.formula {
  font-family: "Times New Roman", Georgia, serif;
  font-style: italic;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==================== 学习报告 ==================== */
.report-tabs {
  display: flex;
  gap: 8px;
  padding: 0 20px;
  margin-bottom: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.report-tab {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.report-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.report-subjects {
  display: flex;
  gap: 8px;
  padding: 0 20px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.report-subject-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.report-subject-chip.active {
  background: var(--c, var(--primary));
  border-color: var(--c, var(--primary));
  color: white;
}

.report-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px;
  margin-bottom: 16px;
}

.ov-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
  box-shadow: var(--shadow);
}

.ov-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.ov-unit {
  font-size: 14px;
  font-weight: 600;
  margin-left: 2px;
}

.ov-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* 错题变化 */
.mistake-delta {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
}

.delta-item {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
}

.delta-item.bad { background: rgba(255,59,48,0.08); }
.delta-item.good { background: rgba(52,199,89,0.08); }
.delta-item.total { background: var(--bg); }

.delta-num {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.delta-item.bad .delta-num { color: var(--danger); }
.delta-item.good .delta-num { color: var(--success); }
.delta-item.total .delta-num { color: var(--text); }

.delta-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.delta-arrow {
  font-size: 22px;
  color: var(--text-secondary);
}

.empty-line {
  color: var(--text-secondary);
  text-align: center;
  padding: 12px 0;
  font-size: 14px;
}

/* 热力图 */
.heatmap {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  margin: 8px 0;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--border);
  transition: transform 0.15s;
}

.heat-cell.level-1 { background: rgba(79,109,245,0.25); }
.heat-cell.level-2 { background: rgba(79,109,245,0.45); }
.heat-cell.level-3 { background: rgba(79,109,245,0.7); }
.heat-cell.level-4 { background: var(--primary); }

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.heatmap-legend .heat-cell {
  width: 14px;
  height: 14px;
  aspect-ratio: auto;
}

/* 趋势柱 */
.trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 180px;
  gap: 6px;
  padding: 8px 0;
}

.trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.trend-bar {
  width: 70%;
  max-width: 36px;
  background: rgba(79,109,245,0.25);
  border-radius: 6px 6px 0 0;
  position: relative;
  transition: height 0.3s ease;
  min-height: 2px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.trend-correct {
  width: 100%;
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  align-self: flex-end;
}

.trend-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.trend-day {
  font-size: 11px;
  color: var(--text-secondary);
}

.trend-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.trend-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

.trend-legend .dot.total { background: rgba(79,109,245,0.25); }
.trend-legend .dot.correct { background: var(--primary); }

/* 各科报告 */
.subject-report-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subject-report-card {
  --c: var(--primary);
  --cl: var(--primary-light);
  background: var(--cl);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border-left: 4px solid var(--c);
}

.sr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sr-icon { font-size: 18px; }
.sr-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--c);
  flex: 1;
}
.sr-acc {
  font-size: 13px;
  font-weight: 700;
  color: var(--c);
  background: var(--card);
  padding: 3px 10px;
  border-radius: 999px;
}

.sr-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  text-align: center;
}

.sr-stat {
  background: var(--card);
  border-radius: 8px;
  padding: 8px 4px;
}

.sr-stat span {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--c);
  line-height: 1.1;
}

.sr-stat em {
  display: block;
  font-style: normal;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* 待巩固 */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pending-item {
  --c: var(--primary);
  --cl: var(--primary-light);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--cl);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--c);
}

.pi-tag {
  background: var(--c);
  color: white;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pi-title {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.pi-count {
  font-size: 12px;
  color: var(--c);
  font-weight: 700;
  background: var(--card);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* 错题 Top */
.errtop-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.errtop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 10px;
}

.errtop-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.errtag {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.errtop-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.errtop-count {
  font-size: 12px;
  color: var(--danger);
  font-weight: 700;
}

/* 时间线 */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 50px;
}

.tl-item {
  display: flex;
  align-items: flex-start;
  position: relative;
  padding: 8px 0;
}

.tl-time {
  position: absolute;
  left: -50px;
  top: 8px;
  width: 42px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tl-dot {
  position: absolute;
  left: -10px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 24px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
}

.tl-body {
  flex: 1;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tl-icon { font-size: 16px; }

.tl-subject {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.tl-text {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

@media (min-width: 768px) {
  .report-overview { grid-template-columns: repeat(6, 1fr); }
  .sr-stats { grid-template-columns: repeat(5, 1fr); }
  .heatmap { grid-template-columns: repeat(30, 1fr); }
}

/* ==================== 练习难度分层 ==================== */
.difficulty-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.diff-tab {
  flex: 1;
  padding: 9px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.diff-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.q-tier {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--tier);
  background: color-mix(in srgb, var(--tier) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tier) 35%, transparent);
}

.q-ext-tag {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg);
}

/* ==================== 拓展题作答 ==================== */
.ext-note {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.ext-q-text {
  margin-bottom: 8px;
  line-height: 1.6;
}

.ext-q-pen {
  margin-right: 4px;
}

.ext-quiz {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ext-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
}

.ext-opt:active { transform: scale(0.985); }

.ext-opt.opt-selected { border-color: var(--primary); background: var(--primary-light); }
.ext-opt.opt-correct {
  border-color: var(--success);
  background: rgba(52,199,89,0.1);
  color: #1a7c36;
  font-weight: 700;
}
.ext-opt.opt-wrong {
  border-color: var(--danger);
  background: rgba(255,59,48,0.1);
  color: var(--danger);
}

.ext-q-result {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.res-right { color: #1a7c36; }
.res-wrong { color: var(--danger); }
.ext-exp { color: var(--text-secondary); margin-top: 4px; font-size: 12px; }

.ext-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  margin-bottom: 8px;
}

.ext-self-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ext-self {
  flex: 1;
  min-width: 150px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* ==================== 错题本增强 ==================== */
.mistake-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 20px 12px;
  flex-wrap: wrap;
}

.mistake-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.mistake-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.mistake-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.mistake-subj-select {
  margin-left: auto;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  max-width: 150px;
}

.mistake-src {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.mistake-src.platform { background: rgba(79,109,245,0.12); color: var(--primary); }
.mistake-src.hw { background: rgba(255,140,66,0.15); color: #c2570a; }

.mistake-chapter {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg);
  color: var(--text-secondary);
}

.mistake-wrong {
  margin: 8px 0;
  padding: 8px 12px;
  background: rgba(255,59,48,0.06);
  border-left: 3px solid var(--danger);
  border-radius: 6px;
  font-size: 13px;
  color: var(--danger);
}

.mistake-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.mistake-actions .btn-secondary {
  flex: 1;
  min-width: 150px;
  padding: 10px 14px;
  font-size: 13px;
}

.mistake-actions .btn-primary {
  flex: 1;
  min-width: 150px;
  padding: 10px 14px;
  font-size: 13px;
  border: none;
}

.con-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #1a7c36;
  background: rgba(52,199,89,0.1);
}

.con-area {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.con-head {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 4px;
}

.con-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

.con-empty {
  padding: 14px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.con-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
}

#conAgain:not(.btn-secondary) {}

/* ==================== 作业错题录入 ==================== */
.hw-form {
  margin: 0 20px 16px;
  border: 1px dashed var(--secondary);
}

.hw-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--text);
}

.hw-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

.hw-actions { margin-top: 16px; }
.hw-error {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(255,59,48,0.1);
  color: var(--danger);
  border-radius: 8px;
  font-size: 13px;
}

.welcome-section .btn-secondary {
  margin-top: 10px;
  padding: 9px 18px;
  font-size: 13px;
}

/* ==================== 作业错题拍照 ==================== */
.hw-img-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hw-img-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.hw-img-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.mm-thumb {
  position: relative;
  display: inline-block;
  width: 76px;
  height: 76px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}

.mm-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.mm-thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
}

.mistake-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

/* 图片全屏查看 */
.img-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  padding: 20px;
}

.img-overlay.show { display: flex; }

.img-overlay-bar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.img-overlay-close {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 14px;
  cursor: pointer;
}

.img-overlay-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
}

/* ==================== 单词默写 ==================== */
.vocab-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.vocab-stat {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.vocab-card { margin-bottom: 10px; }

.vocab-hint {
  font-size: 15px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.vocab-hint strong {
  color: var(--primary);
  font-size: 18px;
}

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

.vocab-input { flex: 1; }

.vocab-check {
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.vocab-feedback {
  margin-top: 8px;
  font-size: 14px;
  min-height: 20px;
}

.vocab-summary {
  margin-bottom: 12px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.vocab-summary .card-title { margin-bottom: 8px; }

.vocab-wrong-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.vocab-summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.vocab-summary-actions .btn-secondary { font-size: 13px; padding: 9px 16px; }
