/* ============================================================
   乐学堂 · 文学常识 —— 专属样式
   与 geo.css 同构：知识卡 / 想一想 / 速查 / 小诊所 / 打印
   配色换成书卷暖纸主题
   ============================================================ */

/* ---------- 文学苑横幅 ---------- */
.textbook-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 16px; padding: 12px 16px;
  background: linear-gradient(135deg, #f9f0e2, #fbf6ec);
  border: 1px solid #eeddc4; border-radius: 14px;
  color: #8a5a2b; font-size: 14px; font-weight: 700;
}
.textbook-banner strong { font-size: 16px; }

/* ---------- 文学苑导语 ---------- */
.goal-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.goal-tags span {
  background: color-mix(in srgb, var(--c) 12%, white);
  border: 1px solid color-mix(in srgb, var(--c) 30%, white);
  color: #4a4f63; border-radius: 999px; padding: 3px 10px;
  font-size: 12.5px; font-weight: 700;
}

/* ---------- 知识点卡 ---------- */
.kcard {
  --c: #b5893a;
  position: relative;
  background: var(--card); border-radius: 18px; padding: 18px 18px 16px;
  border: 1px solid var(--line); border-top: 4px solid var(--c);
  box-shadow: 0 4px 16px rgba(40, 54, 85, .035); overflow-wrap: anywhere;
  margin-bottom: 20px;
}
.kcard.learned { background: #f4fcf7; }
.khead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 40px; }
.ktitle { font-size: 21px; font-weight: 900; }
.khead-gap { flex: 1; }
.kcard .say { width: 32px; height: 32px; }
.learn-btn {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #e5decd; background: #faf7f0;
  font-size: 17px; font-weight: 900; color: #fff; line-height: 1;
}
.learn-btn.on { background: #2fbf71; border-color: #2fbf71; }
.k-overview { margin-top: 12px; font-size: 15.5px; line-height: 1.75; color: #4a4f63; }

/* ---------- 小节 ---------- */
.ksec { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; }
.ksec > :last-child { min-width: 0; flex: 1; }
.seclabel {
  flex: 0 0 26px; height: 26px; margin-top: 2px;
  background: #f3e9d7; color: #8a6a45; border-radius: 8px;
  font-size: 13px; font-weight: 900; display: grid; place-items: center;
}
.klist { list-style: none; display: grid; gap: 5px; }
.kli {
  display: block; width: 100%; text-align: left;
  border: none; background: none; padding: 2px 0;
  font-size: 14.5px; line-height: 1.7; color: #4a4f63; font-weight: 600;
}
.kli:hover { color: #9a6b3f; }
.klist.mis .kli { color: #7a5327; }

/* ---------- 想一想 ---------- */
.mex { display: grid; gap: 6px; }
.mex-q, .mex-steps, .mex-a {
  display: block; width: 100%; text-align: left; border: none;
  padding: 8px 12px; border-radius: 12px;
  font-size: 14.5px; line-height: 1.7; font-weight: 600;
}
.mex-q { background: #f8efe2; color: #8a5a2b; }
.mex-steps { background: #f8f9fc; color: #5a5570; }
.mex-a { background: #e9f9f0; color: #187749; font-weight: 800; }

.krecite {
  margin-top: 12px; background: #fdf6e9; border-radius: 12px;
  padding: 9px 12px; font-size: 14px; font-weight: 800; color: #7a5b18;
}

/* ---------- 文学速查 ---------- */
.formula-card {
  --c: #b5893a;
  background: var(--card); border-radius: 18px; padding: 16px 18px;
  border: 1px solid var(--line); border-left: 5px solid var(--c);
  margin-bottom: 16px; box-shadow: 0 4px 16px rgba(40, 54, 85, .035); overflow-wrap: anywhere;
}
.phead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phead h3 { font-size: 17px; font-weight: 900; }
.frows { display: grid; gap: 6px; margin-top: 10px; }
.frow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1.5px solid var(--line); background: #fafbfe;
  border-radius: 10px; padding: 7px 12px; text-align: left;
}
.frow:active { transform: scale(.98); }
.frow b { font-size: 15px; font-weight: 900; color: #7a5b18; }
.frow span { font-size: 15px; font-weight: 700; color: #4a4f63; font-variant-numeric: tabular-nums; }
.pnote {
  margin-top: 10px; background: #f7f3e8; border-radius: 12px;
  padding: 9px 12px; font-size: 13.5px; line-height: 1.7; color: #6d6350; font-weight: 600;
}

/* ---------- 文学小诊所 ---------- */
.mistake-card {
  --c: #c2557d;
  position: relative;
  display: grid; gap: 8px;
  background: var(--card); border-radius: 18px; padding: 20px 16px 14px;
  border: 1px solid var(--line); border-top: 4px solid var(--c);
  box-shadow: 0 4px 16px rgba(40, 54, 85, .035); overflow-wrap: anywhere;
}
.unit-tag {
  position: absolute; top: -12px; left: 14px;
  color: #fff; font-size: 12px; font-weight: 800;
  border-radius: 999px; padding: 3px 12px; box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.mist-row {
  display: flex; align-items: flex-start; gap: 8px;
  border: none; background: none; text-align: left;
  font-size: 14.5px; line-height: 1.7; font-weight: 600; padding: 2px 4px;
}
.mist-mark { flex-shrink: 0; }
.wrong-row-text { color: #a4453f; text-decoration: line-through; text-decoration-color: #e4b6b2; text-decoration-thickness: 2px; }
.right-row-text { color: #187749; font-weight: 700; }

/* ---------- 屏幕动画（打印不受影响） ---------- */
@media screen {
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
  }
  @keyframes pulseGlow {
    0%, 100% { box-shadow: 0 4px 16px rgba(40, 54, 85, .035); }
    50% { box-shadow: 0 8px 28px rgba(40, 54, 85, .12); }
  }

  /* 知识卡 / 速查 / 小诊所入场 */
  .kcard, .formula-card, .mistake-card {
    animation: fadeInUp .55s cubic-bezier(.2,.7,.2,1) both;
  }
  .kcard:nth-child(2) { animation-delay: .05s; }
  .kcard:nth-child(3) { animation-delay: .1s; }
  .kcard:nth-child(4) { animation-delay: .15s; }
  .kcard:nth-child(5) { animation-delay: .2s; }

  /* 卡片悬浮抬升 */
  .kcard, .formula-card, .mistake-card {
    transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
  }
  .kcard:hover, .formula-card:hover, .mistake-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(40, 54, 85, .12);
  }

  /* 单元 emoji 浮动 */
  .unit-emoji { animation: floatY 3.2s ease-in-out infinite; }

  /* 学习重点标签悬浮 */
  .goal-tags span { transition: transform .2s ease, background .2s ease; }
  .goal-tags span:hover { transform: translateY(-2px) scale(1.04); }

  /* 已复习按钮呼吸 */
  .learn-btn.on { animation: pulseGlow 2.4s ease-in-out infinite; }
  .learn-btn { transition: transform .15s ease, background .2s ease, border-color .2s ease; }
  .learn-btn:hover { transform: scale(1.1); }

  /* 图示悬浮微动 */
  .fig { transition: transform .3s ease, box-shadow .3s ease; }
  .fig:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(40, 54, 85, .06); }
  .fig-svg { transition: transform .4s ease; }
  .fig:hover .fig-svg { transform: scale(1.01); }

  /* 横幅装饰圆缓慢浮动 */
  .unit-banner svg circle { animation: floatY 4s ease-in-out infinite; }
  .unit-banner svg circle:nth-child(2) { animation-delay: .6s; }

  /* 单元封面图 */
  .unit-hero {
    display: block; width: 100%; max-height: 280px; object-fit: cover;
    border-radius: 16px; margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(40, 54, 85, .1);
    transition: transform .4s ease, box-shadow .4s ease;
  }
  .unit-hero:hover { transform: scale(1.01); box-shadow: 0 14px 34px rgba(40, 54, 85, .16); }

  /* 知识点卡片内的真实配图 */
  .point-photo img {
    display: block; width: 100%; max-height: 240px; object-fit: cover;
    border-radius: 12px;
    transition: transform .35s ease;
  }
  .point-photo:hover img { transform: scale(1.02); }

  /* 朗读按钮反馈 */
  .say { transition: transform .15s ease, background .2s ease; }
  .say:hover { transform: scale(1.08); }

  /* 减弱动画（尊重系统偏好） */
  @media (prefers-reduced-motion: reduce) {
    .kcard, .formula-card, .mistake-card,
    .unit-emoji, .learn-btn.on, .unit-banner svg circle {
      animation: none !important;
    }
    .kcard:hover, .formula-card:hover, .mistake-card:hover,
    .fig:hover, .learn-btn:hover, .say:hover {
      transform: none;
    }
  }
}

/* ---------- 打印 ---------- */
@media print {
  .study-course .study-page { background: #fff; font-size: 13px; }
  #app > header, .sidebar, .toolbar, .textbook-banner, .skip-link,
  .say, .learn-btn, .goal-tags { display: none !important; }
  .study-shell { display: block; padding: 0; }
  .study-content { padding: 0; }
  .unit-head { border: 1px solid #ccc; box-shadow: none; }
  .kcard, .formula-card, .mistake-card { box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .wgrid { grid-template-columns: 1fr; display: block; }
  .kcard, .mistake-card { margin-bottom: 12px; }
}
