/* 知识点学习模块：只作用于 #tab-learn，避免影响现有页面 */
#tab-learn {
  --learn-radius: 16px;
  color: var(--ink);
}

.learn-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: 8px;
}

.learn-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 2px 2px 10px;
}
.learn-head h2 {
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: .2px;
}
.learn-head p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--slate);
}
.learn-ai-btn {
  margin-left: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(108, 76, 241, .25);
}

.learn-seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.learn-seg-btn {
  min-height: 34px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
}
.learn-seg-btn.on {
  background: rgba(108, 76, 241, .10);
  color: var(--teal-700);
}

.learn-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--learn-radius);
  box-shadow: 0 1px 2px rgba(8, 27, 58, .05);
  padding: 15px;
  margin-top: 10px;
}
.learn-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 9px;
}
.learn-card-title span:last-child {
  font-size: 11px;
  font-weight: 400;
  color: var(--slate);
}

/* 今日 */
.learn-hero {
  position: relative;
  overflow: hidden;
  padding: 17px;
  border-radius: 20px;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 12px 28px rgba(59, 46, 143, .26);
}
.learn-hero::before,
.learn-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.learn-hero::before { width: 170px; height: 170px; right: -60px; top: -80px; }
.learn-hero::after { width: 120px; height: 120px; right: 30px; bottom: -80px; }
.learn-hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  opacity: .92;
}
.learn-hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
}
.learn-ring {
  position: relative;
  width: 90px;
  height: 90px;
  flex: 0 0 auto;
}
.learn-ring svg {
  width: 90px;
  height: 90px;
  transform: rotate(-90deg);
}
.learn-ring .bg { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 8; }
.learn-ring .fg { fill: none; stroke: #fff; stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.learn-ring .label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
}
.learn-hero-copy h2 { font-size: 20px; }
.learn-hero-copy p { margin-top: 2px; font-size: 12px; opacity: .9; }
.learn-hero-copy .btn {
  margin-top: 10px;
  min-height: 36px;
  padding: 6px 13px;
  background: #fff;
  color: #3B2E8F;
  font-size: 13px;
}

.learn-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.learn-stat {
  padding: 11px 6px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.learn-stat b {
  display: block;
  font-size: 19px;
  line-height: 1.2;
  color: var(--teal-700);
}
.learn-stat span { font-size: 10.5px; color: var(--slate); }

.learn-domain-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  cursor: pointer;
}
.learn-domain-id {
  width: 34px;
  height: 27px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 800;
  color: #fff;
  background: var(--teal-700);
}
.learn-domain-id.d2 { background: #2E8BF7; }
.learn-domain-id.d3 { background: #0EA5A4; }
.learn-domain-id.d4 { background: #7C3AED; }
.learn-domain-id.d5 { background: #F59E0B; }
.learn-domain-id.d6 { background: #64748B; }
.learn-domain-id.d7 { background: #DC2626; }
.learn-domain-main { flex: 1; min-width: 0; }
.learn-domain-main .line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.learn-domain-main .line b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learn-domain-main .line span { flex: 0 0 auto; color: var(--slate); }
.learn-bar {
  height: 6px;
  margin-top: 5px;
  border-radius: 999px;
  background: #EEF2F7;
  overflow: hidden;
}
.learn-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width .4s ease;
}

.learn-ai-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 14px 15px;
  margin-top: 10px;
  border: 1px solid rgba(108, 76, 241, .18);
  border-radius: var(--learn-radius);
  background: linear-gradient(135deg, #F5F3FF, #EEF6FF);
  cursor: pointer;
}
.learn-ai-orb {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(108, 76, 241, .26);
}
.learn-ai-card b { display: block; font-size: 14px; }
.learn-ai-card p { margin-top: 1px; font-size: 11.5px; color: var(--slate); }
.learn-ai-card .chev { margin-left: auto; color: var(--teal-700); font-size: 20px; }

/* 目录 */
.learn-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  outline: none;
  font-size: 15px;
}
.learn-search:focus { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(108, 76, 241, .13); }
.learn-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 9px 0 2px;
  scrollbar-width: none;
}
.learn-chips::-webkit-scrollbar { display: none; }
.learn-chip {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--slate);
  font-size: 11.5px;
  font-weight: 600;
}
.learn-chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.learn-domain-block { margin-top: 10px; }
.learn-domain-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  text-align: left;
}
.learn-domain-head .name {
  font-size: 13.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.learn-domain-head .count { margin-left: auto; font-size: 11px; color: var(--slate); }
.learn-domain-head .chev { font-size: 14px; color: var(--slate); transition: transform .2s ease; }
.learn-domain-head.open .chev { transform: rotate(90deg); }

.learn-point-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}
.learn-point-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  border-top: 1px solid var(--line);
}
.learn-point-row:first-child { border-top: 0; }
.learn-point-row:active { background: #FAFBFF; }
.learn-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #CBD5E1; }
.learn-dot.learning { background: var(--amber); }
.learn-dot.mastered { background: var(--ok); }
.learn-point-main { flex: 1; min-width: 0; }
.learn-point-main b { display: block; font-size: 13px; font-weight: 600; line-height: 1.45; }
.learn-point-main span { display: block; margin-top: 1px; font-size: 10.5px; color: var(--slate); }
.learn-point-row .chev { color: #CBD5E1; font-size: 16px; }

/* 详情 */
.learn-back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  margin-bottom: 5px;
  color: var(--slate);
  font-size: 13px;
}
.learn-detail-head h2 { margin-top: 7px; font-size: 22px; line-height: 1.35; }
.learn-detail-head .meta { margin-top: 4px; font-size: 11px; color: var(--slate); }

.learn-conclusion {
  margin-top: 10px;
  padding: 13px 14px;
  border-radius: 14px;
  border-left: 3px solid var(--teal-700);
  background: linear-gradient(135deg, rgba(108, 76, 241, .09), rgba(46, 139, 247, .06));
}
.learn-conclusion .label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--teal-700);
  letter-spacing: .4px;
}
.learn-conclusion p { margin-top: 4px; font-size: 14.5px; font-weight: 600; line-height: 1.65; }

.learn-points { counter-reset: item; }
.learn-points li {
  position: relative;
  padding: 6px 0 6px 22px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
  line-height: 1.65;
}
.learn-points li:first-child { border-top: 0; }
.learn-points li::before {
  counter-increment: item;
  content: counter(item);
  position: absolute;
  left: 0;
  top: 8px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(108, 76, 241, .10);
  color: var(--teal-700);
  font-size: 9.5px;
  font-weight: 800;
}

.learn-pitfall {
  margin-top: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, .22);
  background: #FFFBEB;
  color: #92400E;
  font-size: 12.5px;
}
.learn-pitfall b { display: block; margin-bottom: 2px; font-size: 10.5px; letter-spacing: .4px; }

.learn-rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }
.learn-rate {
  padding: 9px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--slate);
  font-size: 12px;
  font-weight: 700;
}
.learn-rate.good { color: var(--ok); border-color: rgba(14, 159, 110, .28); background: var(--ok-bg); }
.learn-rate.fuzzy { color: #B45309; border-color: rgba(245, 158, 11, .30); background: #FFFBEB; }
.learn-rate.bad { color: var(--danger); border-color: rgba(220, 38, 38, .22); background: var(--danger-bg); }
.learn-rate:active { transform: scale(.98); }

.learn-note {
  width: 100%;
  min-height: 72px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  resize: vertical;
  outline: none;
  font-size: 13px;
  line-height: 1.6;
  background: #fff;
}
.learn-note:focus { border-color: var(--teal-500); box-shadow: 0 0 0 3px rgba(108, 76, 241, .12); }

.learn-ai-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.learn-ai-actions .btn { flex: 1; min-width: 92px; }

/* 复习 */
.learn-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--slate);
}
.learn-flash {
  min-height: 320px;
  margin-top: 10px;
  padding: 19px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: var(--shadow-sm);
}
.learn-flash .tag { align-self: center; }
.learn-flash h2 { margin-top: 12px; font-size: 23px; line-height: 1.4; }
.learn-flash .hint { margin-top: 8px; color: var(--slate); font-size: 12.5px; }
.learn-flash .answer { text-align: left; margin-top: 5px; }
.learn-flash .answer .learn-conclusion { margin-top: 0; }
.learn-flash .answer .learn-pitfall { font-size: 12px; }
.learn-flash .btn { margin-top: 16px; }

/* 报告 */
.learn-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.learn-report-stat {
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
}
.learn-report-stat b { display: block; font-size: 21px; line-height: 1.2; color: var(--teal-700); }
.learn-report-stat span { font-size: 10.5px; color: var(--slate); }

.learn-heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin-top: 7px; }
.learn-heat i { display: block; aspect-ratio: 1 / 1; border-radius: 3px; background: #EDF1F7; }
.learn-heat i.l1 { background: #DDD6FE; }
.learn-heat i.l2 { background: #A78BFA; }
.learn-heat i.l3 { background: var(--teal-700); }
.learn-heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 5px; font-size: 10px; color: var(--slate); }
.learn-heat-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

.learn-weak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
}
.learn-weak-row:first-child { border-top: 0; }
.learn-weak-row b { color: var(--danger); }

.learn-empty { padding: 28px 14px; text-align: center; color: var(--slate); font-size: 13px; }
.learn-loading { padding: 32px 14px; text-align: center; color: var(--slate); font-size: 13px; }

/* AI 抽屉 */
.learn-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(11, 27, 58, .48);
  backdrop-filter: blur(3px);
}
.learn-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 81;
  width: 100%;
  max-width: 560px;
  height: 80vh;
  max-height: 720px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -18px 50px rgba(0, 0, 0, .25);
  overflow: hidden;
}
.learn-sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.learn-sheet-head .learn-ai-orb { width: 32px; height: 32px; border-radius: 10px; font-size: 10px; }
.learn-sheet-head b { display: block; font-size: 13.5px; line-height: 1.3; }
.learn-sheet-head span { display: block; font-size: 10.5px; color: var(--slate); }
.learn-sheet-close { margin-left: auto; padding: 2px 6px; color: var(--slate); font-size: 22px; }
.learn-quick { display: flex; gap: 6px; padding: 9px 14px 0; overflow-x: auto; }
.learn-quick::-webkit-scrollbar { display: none; }
.learn-msgs { flex: 1; overflow-y: auto; padding: 10px 14px 14px; }
.learn-msg { display: flex; margin-top: 8px; }
.learn-msg .bubble {
  max-width: 88%;
  padding: 8px 11px;
  border-radius: 13px;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.learn-msg.ai .bubble { background: #F5F3FF; border: 1px solid rgba(108, 76, 241, .12); border-top-left-radius: 4px; }
.learn-msg.me { justify-content: flex-end; }
.learn-msg.me .bubble { background: var(--grad); color: #fff; border-top-right-radius: 4px; }
.learn-sheet-note { padding: 0 14px 6px; font-size: 10px; color: var(--slate-light); }
.learn-sheet-foot {
  display: flex;
  gap: 7px;
  padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
}
.learn-sheet-input {
  flex: 1;
  min-height: 40px;
  max-height: 92px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  resize: none;
  outline: none;
  font-size: 14px;
}
.learn-sheet-input:focus { border-color: var(--teal-500); }
.learn-send { min-width: 58px; }

/* 自测 */
.learn-quiz {
  width: 100%;
  max-width: 440px;
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  background: #fff;
  border-radius: 19px;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .28);
}
.learn-quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.learn-quiz-head b { font-size: 13.5px; }
.learn-quiz-close { color: var(--slate); font-size: 22px; padding: 2px 6px; }
.learn-quiz-progress { margin-top: 4px; font-size: 10.5px; color: var(--slate); }
.learn-q-stem { margin-top: 10px; font-size: 14.5px; font-weight: 600; line-height: 1.6; }
.learn-q-key { margin-top: 3px; font-size: 10.5px; color: var(--slate); }
.learn-options { margin-top: 8px; }
.learn-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  margin-top: 7px;
  padding: 9px 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  line-height: 1.55;
}
.learn-option .key {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 5px;
  background: #F1F5F9;
  color: var(--slate);
  font-size: 10.5px;
  font-weight: 800;
}
.learn-option.selected { border-color: var(--teal-500); background: rgba(108, 76, 241, .06); }
.learn-option.selected .key { background: var(--teal-700); color: #fff; }
.learn-option.correct { border-color: var(--ok); background: var(--ok-bg); }
.learn-option.correct .key { background: var(--ok); color: #fff; }
.learn-option.wrong { border-color: var(--danger); background: var(--danger-bg); }
.learn-option.wrong .key { background: var(--danger); color: #fff; }
.learn-quiz-result {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  background: #F8FAFC;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.learn-quiz-result.ok { background: var(--ok-bg); color: #065F46; }
.learn-quiz-result.bad { background: var(--danger-bg); color: #991B1B; }
.learn-quiz-actions { display: flex; gap: 7px; margin-top: 12px; }
.learn-quiz-actions .btn { flex: 1; }
.learn-cloze-input {
  width: 100%;
  margin-top: 9px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
  font-size: 14px;
}
.learn-cloze-input:focus { border-color: var(--teal-500); }

@media (max-width: 380px) {
  .learn-head h2 { font-size: 20px; }
  .learn-hero { padding: 14px; }
  .learn-ring, .learn-ring svg { width: 78px; height: 78px; }
  .learn-hero-copy h2 { font-size: 18px; }
  .learn-stats { gap: 6px; }
  .learn-stat b { font-size: 17px; }
  .learn-rate { font-size: 11px; }
}
