/* ==========================================================================
   语文小书院 · 二年级上
   纸墨基调：米纸底、墨色字、朱砂印、竹青点缀
   ========================================================================== */

:root {
  --paper: #faf5ea;
  --paper-deep: #f2e8d7;
  --card: #fffdf8;
  --ink: #2e2a26;
  --ink-soft: #6f6256;
  --ink-faint: #a39686;
  --line: rgba(46, 42, 38, 0.12);
  --line-strong: rgba(46, 42, 38, 0.2);

  --seal: #c0503f;
  --seal-deep: #a63f30;
  --bamboo: #5b8c6e;
  --gold: #c08a3e;
  --blue: #4f7fa8;
  --plum: #7d6bae;
  --pink: #d98a76;

  --shadow-sm: 0 4px 14px rgba(78, 58, 34, 0.07);
  --shadow-md: 0 14px 34px rgba(78, 58, 34, 0.12);

  --radius-lg: 24px;
  --radius: 18px;
  --radius-sm: 12px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --display: "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 8% -12%, #f4e6cd 0%, rgba(244, 230, 205, 0) 62%),
    radial-gradient(820px 520px at 106% 2%, #e6efe6 0%, rgba(230, 239, 230, 0) 58%),
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.022) 0, rgba(120, 90, 50, 0.022) 1px, transparent 1px, transparent 4px),
    var(--paper);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(160, 120, 70, 0.09) 1px, transparent 1.2px),
    radial-gradient(rgba(90, 120, 90, 0.07) 1px, transparent 1.2px);
  background-size: 34px 34px, 58px 58px;
  background-position: 4px 6px, 20px 22px;
  opacity: 0.7;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3, b, strong { font-weight: 700; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible {
  outline: 3px solid rgba(192, 80, 63, 0.45);
  outline-offset: 3px;
}

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 max(16px, var(--safe-l)) calc(30px + var(--safe-b)) max(16px, var(--safe-r));
  position: relative;
}

.muted { color: var(--ink-faint); font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -16px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(250, 245, 234, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar-titles { flex: 1; min-width: 0; }
.topbar-titles h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-titles p { font-size: 12px; color: var(--ink-soft); }

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  transition: transform 0.14s ease;
}

.icon-btn:active { transform: scale(0.92); }
.icon-btn--ghost { background: transparent; box-shadow: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.pill b { color: var(--ink); font-size: 16px; }
.pill--star { background: #fdf3da; color: #9a7420; }
.pill--streak { background: #f9ece6; color: var(--seal-deep); }

/* ---------- 首页头 ---------- */
.home-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(16px + var(--safe-t)) 2px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.brand-seal {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #cf5a46, #ab4030);
  color: #fff;
  font-family: var(--display);
  font-size: 27px;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25), 0 8px 18px rgba(192, 80, 63, 0.28);
}

.brand-text h1 { font-family: var(--display); font-size: 24px; line-height: 1.15; letter-spacing: 0.05em; }
.brand-text p { font-size: 11px; color: var(--ink-soft); letter-spacing: 0.18em; }
.header-pills { display: flex; gap: 8px; }

/* ---------- 吉祥物 / 首屏 ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 16px 8px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #fbf1da 0%, #f6e6d1 45%, #e9f0e5 100%);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid rgba(192, 138, 62, 0.16);
}

.hero-mascot { display: grid; place-items: center; }

.mascot {
  width: 100%;
  max-width: 122px;
  height: auto;
  animation: mascot-float 4.4s ease-in-out infinite;
  filter: drop-shadow(0 10px 16px rgba(70, 50, 30, 0.14));
}

.hero-bubble {
  position: relative;
  background: rgba(255, 253, 247, 0.94);
  border-radius: 18px 18px 18px 6px;
  padding: 13px 15px;
  box-shadow: 0 8px 20px rgba(78, 58, 34, 0.08);
}

.hero-bubble p { font-size: 14.5px; font-weight: 500; line-height: 1.7; color: #423a32; }

.hero-name {
  position: absolute;
  right: 12px;
  bottom: -10px;
  background: var(--seal);
  color: #fff;
  font-family: var(--display);
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  box-shadow: 0 4px 8px rgba(192, 80, 63, 0.3);
}

.hero-bamboo {
  position: absolute;
  right: -18px;
  top: -22px;
  width: 80px;
  height: 130px;
  border-radius: 50%;
  border: 6px solid rgba(91, 140, 110, 0.18);
  transform: rotate(28deg);
}
.hero-ink {
  position: absolute;
  left: 10px;
  bottom: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(46, 42, 38, 0.12);
}

/* ---------- 卡片 / 按钮 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card + .card, .card + section, section + .card { margin-top: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #cd5b47, #a94030);
  box-shadow: 0 8px 20px rgba(169, 64, 48, 0.28);
}

.btn-ghost { background: var(--card); border: 1.5px solid var(--line-strong); color: var(--ink); }
.btn-danger { background: linear-gradient(135deg, #c65b4b, #a63f30); color: #fff; }
.btn-danger-ghost { color: var(--seal-deep); background: #fbeeea; border: 1.5px solid rgba(192, 80, 63, 0.22); }
.btn-block { width: 100%; }

/* ---------- 今日目标 ---------- */
.plan {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "ring text" "cta cta";
  align-items: center;
  gap: 10px 14px;
  margin-top: 12px;
  background: linear-gradient(160deg, #fffdf8, #fdfaf2);
}

.plan-ring {
  grid-area: ring;
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: conic-gradient(var(--seal) calc(var(--p) * 1%), #efe6d7 0);
  display: grid;
  place-items: center;
}

.plan-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); }
.ring-inner { position: relative; text-align: center; line-height: 1; }
.ring-inner b { display: block; font-size: 24px; font-weight: 700; font-family: var(--display); }
.ring-inner span { font-size: 10px; color: var(--ink-faint); }

.plan-text { grid-area: text; }
.plan-text h2 { font-family: var(--display); font-size: 18px; margin-bottom: 2px; letter-spacing: 0.04em; }
.plan-text p { font-size: 12.5px; color: var(--ink-soft); }
.plan-sub { margin-top: 2px; font-size: 11.5px !important; color: var(--ink-faint) !important; }
.plan-cta { grid-area: cta; width: 100%; }

/* ---------- 安装提示 ---------- */
.install-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f4f7ef;
  border: 1px dashed rgba(91, 140, 110, 0.45);
  font-size: 12px;
  color: #4a6350;
  line-height: 1.5;
}

.install-tip p { flex: 1; }
.install-tip button { font-size: 11px; font-weight: 700; color: var(--bamboo); background: #fff; padding: 5px 8px; border-radius: 8px; }

/* ---------- 功能入口 ---------- */
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.mode-card:active { transform: scale(0.97); box-shadow: var(--shadow-md); }
.mode-body { display: flex; flex-direction: column; min-width: 0; }
.mode-title { display: flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 700; }
.mode-desc { font-size: 11px; color: var(--ink-soft); line-height: 1.45; margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.mode-badge {
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  line-height: 1.6;
  white-space: nowrap;
}
.mode-badge--seal { background: #f9e9e5; color: var(--seal-deep); }
.mode-badge--bamboo { background: #eaf3ec; color: #3f6b50; }
.mode-badge--blue { background: #e9f1f8; color: #3a6285; }
.mode-badge--gold { background: #fbf1dd; color: #8f641f; }
.mode-badge--plum { background: #f1eef9; color: #5f4f8c; }
.mode-badge--ink { background: #f1ede7; color: var(--ink-soft); }

/* 印章图标 */
.seal-tile {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.26), 0 5px 12px rgba(80, 60, 35, 0.16);
}

.seal-tile b {
  color: #fff;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}

.seal-tile--sm { width: 36px; height: 36px; border-radius: 10px; }
.seal-tile--sm b { font-size: 19px; }
.seal-tile--lg { width: 54px; height: 54px; border-radius: 14px; }
.seal-tile--lg b { font-size: 30px; }
.seal-tile--xl { width: 64px; height: 64px; border-radius: 16px; }
.seal-tile--xl b { font-size: 36px; }
.seal-tile--locked { background: #eee8dd; box-shadow: none; }
.seal-tile--locked b { color: #c3b8a7; }

/* ---------- 专项 ---------- */
.drills-card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { font-family: var(--display); font-size: 17px; letter-spacing: 0.04em; }

.drill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.drill-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #fbf7ef;
  border: 1px solid var(--line);
  text-align: left;
}
.drill-chip:active { background: #f6efe2; }
.drill-icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
}
.drill-name { font-size: 13px; font-weight: 700; }
.drill-desc { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.drill-sheet-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.drill-sheet-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 13px;
  background: #fbf7ef;
  border: 1px solid var(--line);
  text-align: left;
}
.drill-sheet-item b { display: block; font-size: 14px; }
.drill-sheet-item small { display: block; font-size: 11px; color: var(--ink-faint); }

/* ---------- 印章收藏 ---------- */
.seal-card { margin-top: 12px; }
.seal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seal-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.seal-item em { font-style: normal; font-size: 10px; color: var(--ink-soft); }
.seal-item--locked { opacity: 0.6; }
.seal-note { margin-top: 10px; font-size: 11px; color: var(--ink-faint); }

.home-footer { margin-top: 20px; text-align: center; }
.home-footer p { font-size: 10.5px; color: var(--ink-faint); line-height: 1.7; }
.footer-link { font-size: 11px; color: var(--seal); font-weight: 600; }

/* ---------- 页面通用 ---------- */
.page-lead { font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; margin: 2px 2px 14px; }
.page-lead b { color: var(--ink); }

.tip-card { background: #f7f8f1; border-color: rgba(91, 140, 110, 0.2); }
.tip-card h2 { font-family: var(--display); font-size: 16px; margin-bottom: 6px; }
.tip-card p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.65; }
.tip-card p + p { margin-top: 4px; }

.empty-card { text-align: center; }
.empty-card h2 { font-size: 18px; margin-bottom: 6px; }
.empty-card p { color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; }

/* ---------- 单元列表 ---------- */
.unit-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }

.unit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 12px 18px;
  border-radius: 16px;
  background: linear-gradient(150deg, #fffdf8 30%, var(--s));
  border: 1px solid color-mix(in srgb, var(--c) 24%, transparent);
  box-shadow: var(--shadow-sm);
  text-align: left;
  overflow: hidden;
}

.unit-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: var(--c);
}

.unit-card:active { transform: scale(0.985); }
.unit-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.unit-stars { font-size: 10.5px; color: var(--ink-faint); font-weight: 600; }
.unit-name { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: 0.04em; }
.unit-lessons { font-size: 11px; color: var(--ink-soft); line-height: 1.5; }
.unit-progress { display: block; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.8); overflow: hidden; margin-top: 5px; }
.unit-progress i { display: block; height: 100%; border-radius: 999px; background: var(--c); transition: width 0.4s ease; }
.unit-progress--wide { width: 100%; background: rgba(255, 255, 255, 0.75); }
.unit-card.is-done::after { content: "通关"; position: absolute; right: 10px; bottom: 10px; font-size: 10px; color: #fff; background: var(--c); padding: 2px 7px; border-radius: 999px; }

/* ---------- 单元详情 ---------- */
.unit-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fffdf8, var(--s));
  border: 1px solid color-mix(in srgb, var(--c) 22%, transparent);
  box-shadow: var(--shadow-sm);
}
.unit-hero-text { flex: 1; min-width: 0; }
.unit-hero-text h2 { font-family: var(--display); font-size: 21px; letter-spacing: 0.05em; }
.unit-hero-text p { font-size: 12px; color: var(--ink-soft); margin: 2px 0 6px; }

.unit-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.lesson-list li:first-child { border-top: 0; }
.lesson-no { flex: 0 0 auto; min-width: 42px; font-size: 10px; font-weight: 700; color: var(--ink-soft); background: var(--paper-deep); border-radius: 6px; padding: 2px 6px; text-align: center; }

.dot-list { margin: 0; padding-left: 20px; font-size: 13.5px; color: #4b433b; line-height: 1.7; }
.dot-list li { margin: 4px 0; }
.dot-list li::marker { color: var(--seal); }

.poem-mini { background: linear-gradient(150deg, #fffdf8, #fbf4e6); }
.poem-mini-lines { font-family: var(--display); font-size: 19px; line-height: 1.9; letter-spacing: 0.08em; text-align: center; }
.poem-mini-meta { text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.link-btn { font-size: 12px; font-weight: 600; color: var(--seal); padding: 4px 8px; border-radius: 8px; }

.tip-banner {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 8%, var(--card));
  border-left: 4px solid var(--c);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.tip-banner span { flex: 0 0 auto; font-weight: 700; color: var(--c); }

.sticky-cta {
  position: sticky;
  bottom: calc(10px + var(--safe-b));
  margin-top: 16px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(250, 245, 234, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- 练习 ---------- */
.quiz-wrap { max-width: 620px; margin: 0 auto; }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.bar { flex: 1; height: 10px; border-radius: 999px; background: #ece3d4; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--seal), var(--gold)); transition: width 0.35s ease; }
.q-count { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }

.quiz-stage { position: relative; }
.quiz-buddy { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; opacity: 0.8; }
.quiz-buddy .mascot { width: 54px; max-width: 54px; animation: mascot-float 4.6s ease-in-out infinite; filter: none; }
.quiz-buddy span { font-size: 11px; color: var(--ink-faint); }

.q-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: 18px 16px 16px;
  animation: card-in 0.24s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.q-card.is-retry { border-color: rgba(192, 138, 62, 0.5); }

.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.q-kicker { font-size: 11px; font-weight: 700; color: var(--seal); letter-spacing: 0.08em; }
.q-unit { font-size: 10px; font-weight: 600; color: var(--ink-faint); background: var(--paper-deep); padding: 2px 8px; border-radius: 999px; }
.q-retry { font-size: 10px; font-weight: 700; color: #8f641f; background: #fbf1dd; padding: 2px 8px; border-radius: 999px; }

.q-text {
  font-family: var(--display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.02em;
  margin: 8px 2px 16px;
}

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.choices--long { grid-template-columns: 1fr; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 64px;
  padding: 11px 12px;
  border-radius: 13px;
  background: #fbf8f1;
  border: 1.5px solid var(--line);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}
.choice:active { transform: scale(0.97); background: #f6efe2; }
.choice-key {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  margin-top: 1px;
}
.choice-text { flex: 1; }
.choice.correct { background: #e8f4ec; border-color: var(--bamboo); color: #2f5b41; }
.choice.correct .choice-key { background: var(--bamboo); color: #fff; }
.choice.wrong { background: #fbeae6; border-color: #d98a76; color: #8c3a2c; }
.choice.wrong .choice-key { background: #d98a76; color: #fff; }
.choice:disabled { opacity: 0.95; }

.choices--long .choice { min-height: 52px; font-size: 15px; }

.teach-panel {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: #fdf7e9;
  border: 1.5px dashed #e2c48c;
  animation: fade-up 0.24s ease both;
}
.teach-kicker { font-size: 10.5px; font-weight: 700; color: #8f641f; letter-spacing: 0.1em; text-align: center; }
.teach-why { font-size: 13.5px; line-height: 1.7; color: #4b433b; margin: 5px 0 12px; }
.teach-panel .btn { min-height: 46px; }

.star-burst {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 23px;
  font-weight: 700;
  color: var(--seal);
  pointer-events: none;
  animation: star-fly 0.85s ease-out forwards;
}

/* ---------- 古诗 ---------- */
.poem-grid { display: flex; flex-direction: column; gap: 10px; }

.poem-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(150deg, #fffdf8 55%, #faf2e3);
  border: 1px solid var(--line);
  border-left: 5px solid var(--c, var(--seal));
  box-shadow: var(--shadow-sm);
  text-align: left;
}
.poem-card:active { transform: scale(0.985); }
.poem-card-head { display: flex; align-items: baseline; justify-content: space-between; }
.poem-title { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: 0.06em; }
.poem-dynasty { font-size: 10px; color: var(--ink-faint); }
.poem-author { font-size: 11px; color: var(--ink-soft); margin-bottom: 3px; }
.poem-preview { font-family: var(--display); font-size: 14px; color: #5b5148; letter-spacing: 0.04em; }
.poem-meta { font-size: 10px; color: var(--ink-faint); margin-top: 3px; }

.poem-hero {
  padding: 20px 18px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #fffdf8 40%, #f7ecd9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.poem-hero-head { display: flex; align-items: flex-start; justify-content: space-between; text-align: left; }
.poem-hero-head h2 { font-family: var(--display); font-size: 26px; letter-spacing: 0.1em; }
.poem-hero-head p { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.poem-seal {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--seal);
  color: #fff;
  font-family: var(--display);
  font-size: 22px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.poem-lines { margin: 16px 0 18px; }
.poem-lines p {
  font-family: var(--display);
  font-size: 22px;
  line-height: 2;
  letter-spacing: 0.1em;
  color: #362f28;
}
.poem-hero .btn { max-width: 320px; margin: 0 auto; }

.meaning-text { font-size: 14px; line-height: 1.8; color: #4b433b; }

/* ---------- 结果 ---------- */
.result-wrap { max-width: 520px; margin: 4px auto 0; text-align: center; }
.result-mascot { width: 140px; margin: 0 auto -4px; }
.result-mascot .mascot { animation: mascot-cheer 1.5s ease-in-out infinite; }
.result-title { font-family: var(--display); font-size: 24px; letter-spacing: 0.04em; }
.result-sub { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.result-stars { font-size: 26px; color: #d8cbb4; letter-spacing: 2px; margin: 6px 0 12px; }
.result-stars span { color: #d8cbb4; }
.result-stars span.on { color: var(--gold); text-shadow: 0 2px 6px rgba(192, 138, 62, 0.28); }

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 14px 8px; }
.result-stat { display: flex; flex-direction: column; gap: 2px; }
.result-stat b { font-size: 21px; font-family: var(--display); }
.result-stat span { font-size: 10.5px; color: var(--ink-faint); }

.result-rewards { display: flex; flex-direction: column; align-items: center; gap: 9px; margin-top: 12px; }
.reward-pill { padding: 6px 16px; border-radius: 999px; background: #fdf3da; border: 1px solid rgba(192, 138, 62, 0.35); font-size: 15px; font-weight: 700; color: #8f641f; }
.reward-pill em { font-style: normal; font-size: 10px; color: #a17d45; }
.reward-seal { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 14px; background: #fbeeea; border: 1px solid rgba(192, 80, 63, 0.25); text-align: left; }
.reward-seal b { display: block; font-size: 12.5px; }
.reward-seal span { font-size: 10.5px; color: var(--ink-soft); }
.reward-streak { font-size: 12px; color: var(--ink-soft); }
.result-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.result-actions-row { display: flex; gap: 9px; }
.result-actions-row .btn { flex: 1; }

/* ---------- 家长看板 ---------- */
.parent-intro { background: linear-gradient(140deg, #f6f8f2, #fffdf8); margin-bottom: 10px; }
.parent-intro h2 { font-family: var(--display); font-size: 17px; margin-bottom: 6px; }
.parent-intro p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }
.parent-intro p + p { margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 12px; display: flex; flex-direction: column; gap: 1px; }
.stat-card b { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.stat-card b em { font-style: normal; font-size: 12px; color: var(--ink-faint); }
.stat-card span { font-size: 11px; color: var(--ink-soft); }

.unit-stat-list, .cat-stat-list { display: flex; flex-direction: column; gap: 9px; }
.unit-stat, .cat-stat { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 8px; }
.unit-stat-name, .cat-stat-name { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-soft); }
.unit-stat-name i { font-style: normal; width: 18px; height: 18px; border-radius: 5px; color: #fff; font-size: 10px; display: grid; place-items: center; }
.cat-stat-name i { font-style: normal; width: 18px; height: 18px; border-radius: 5px; background: var(--paper-deep); color: var(--ink-soft); font-size: 10px; display: grid; place-items: center; font-family: var(--display); }
.unit-stat-bar, .cat-stat-bar { height: 7px; border-radius: 999px; background: #efe7d9; overflow: hidden; }
.unit-stat-bar i, .cat-stat-bar i { display: block; height: 100%; border-radius: 999px; background: var(--seal); }
.cat-stat-bar i { background: var(--gold); }
.unit-stat-val, .cat-stat-val { font-size: 11px; font-weight: 700; color: var(--ink-soft); text-align: right; }

.day-bars { display: flex; align-items: flex-end; gap: 7px; height: 130px; }
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.day-val { font-size: 9px; font-weight: 700; color: var(--ink-soft); }
.day-bar { width: 100%; max-width: 28px; min-height: 4px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--bamboo), #7fae90); transition: height 0.4s ease; }
.day-label { font-size: 8.5px; color: var(--ink-faint); white-space: nowrap; }

.weak-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: #4b433b; line-height: 1.6; }
.weak-list li { margin: 5px 0; }
.weak-cat { display: inline-block; font-size: 9px; background: var(--paper-deep); color: var(--ink-soft); padding: 1px 5px; border-radius: 5px; margin-right: 5px; }

.settings-card .setting-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.settings-card .setting-row:first-of-type { border-top: 0; padding-top: 2px; }
.setting-text { flex: 1; }
.setting-text b { display: block; font-size: 13px; }
.setting-text span { display: block; font-size: 10.5px; color: var(--ink-faint); }
.switch { position: relative; width: 48px; height: 28px; border-radius: 999px; background: #e4dbcd; transition: background 0.2s ease; flex: 0 0 auto; }
.switch.is-on { background: var(--bamboo); }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(46, 42, 38, 0.2); transition: transform 0.2s ease; }
.switch.is-on .switch-thumb { transform: translateX(20px); }
.settings-card .btn-danger-ghost { margin-top: 12px; min-height: 44px; font-size: 13px; }

.method-card h2 { font-family: var(--display); font-size: 17px; margin-bottom: 8px; }
.method-card ol { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; }
.method-card li { margin: 4px 0; }
.method-card li b { color: var(--ink); }
.method-card .muted { margin-top: 8px; line-height: 1.6; }

/* ---------- 弹层 / toast / 彩纸 ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(40, 32, 24, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.22s ease; }
.sheet {
  position: relative;
  width: min(540px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(22px + var(--safe-b));
  box-shadow: var(--shadow-md);
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet-layer.open .sheet { transform: none; }
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 10px; background: var(--paper-deep); color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.sheet-kicker { font-size: 11px; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.1em; text-align: center; }
.sheet-title { font-family: var(--display); font-size: 21px; margin: 4px 0 12px; padding-right: 30px; }
.sheet-text { font-size: 12.5px; color: var(--ink-soft); line-height: 1.7; margin-bottom: 14px; }
.sheet-actions { display: flex; gap: 9px; }
.sheet-actions .btn { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-b));
  transform: translate(-50%, 12px);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(46, 42, 38, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-icon { font-size: 14px; }

.confetti-layer { position: fixed; inset: 0; z-index: 140; pointer-events: none; overflow: hidden; }
.confetti-layer i { position: absolute; top: -20px; display: block; animation: confetti-fall linear forwards; }

.error-card { margin-top: 30px; text-align: center; }
.error-card h2 { font-size: 18px; margin-bottom: 6px; }
.error-card p { font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }

/* ---------- 动画 ---------- */
@keyframes mascot-float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-6px) rotate(1.5deg); }
}
@keyframes mascot-cheer {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-8px) scale(1.04) rotate(2deg); }
  70% { transform: translateY(-2px) scale(1.01) rotate(-1deg); }
}
@keyframes card-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes fade-up {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes star-fly {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-50%, -70px) scale(1.2); opacity: 0; }
}
@keyframes confetti-fall {
  0% { transform: translate(0, -10px) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: 0.9; }
}

/* ---------- 响应式 ---------- */
@media (min-width: 640px) {
  .app { padding-left: max(24px, var(--safe-l)); padding-right: max(24px, var(--safe-r)); }
  .topbar { margin: 0 -24px; padding-left: 24px; padding-right: 24px; }
  .hero { grid-template-columns: 128px 1fr; padding: 20px 22px 20px 12px; }
  .hero-bubble p { font-size: 15.5px; }
  .mascot { max-width: 136px; }
  .modes { grid-template-columns: repeat(3, 1fr); }
  .unit-grid { grid-template-columns: 1fr 1fr; }
  .drill-grid { grid-template-columns: repeat(4, 1fr); }
  .seal-grid { grid-template-columns: repeat(6, 1fr); }
  .plan { grid-template-columns: auto 1fr auto; grid-template-areas: "ring text cta"; gap: 16px; padding: 16px 18px; }
  .plan-cta { width: auto; min-width: 170px; }
  .poem-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .q-card { padding: 22px 24px 20px; }
  .q-text { font-size: 23px; }
  .choice { min-height: 70px; font-size: 16px; }
  .unit-stat, .cat-stat { grid-template-columns: 110px 1fr 56px; }
  .sheet { border-radius: 24px; margin-bottom: 4vh; }
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet { max-height: 84dvh; }
  .drill-sheet-list { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (min-width: 980px) {
  .app { max-width: 960px; }
  .mode-card { padding: 14px; }
  .unit-name { font-size: 20px; }
}

@media (max-width: 370px) {
  .brand-text h1 { font-size: 21px; }
  .header-pills .pill { padding: 0 9px; font-size: 11px; }
  .mode-card { padding: 10px; gap: 8px; }
  .mode-title { font-size: 14px; }
  .mode-desc { font-size: 10px; }
  .q-text { font-size: 19px; }
  .choice { font-size: 14px; min-height: 58px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .topbar { position: static; }
  .quiz-buddy { display: none; }
  .q-text { font-size: 18px; margin-bottom: 10px; }
  .q-card { padding: 12px; }
  .choice { min-height: 46px; padding: 8px 10px; }
  .hero { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .mascot { animation: none; }
}
