/* ==========================================================================
   古诗学习 (/poetry) — 宣纸青墨国风
   配色取「宣纸暖白 + 青墨 + 朱印红」，与站点 page-shell.css 的
   --page-bg / --card-bg / --ink 令牌兼容，保证在大厅里视觉连贯。
   ========================================================================== */

:root {
  /* 宣纸与墨 */
  --paper: #faf6ec;
  --paper-2: #fffdf8;
  --paper-3: #f4ecdc;
  --ink: #2b2419;
  --ink-soft: #6b5f4d;
  --ink-faint: #a2988a;
  --line: rgba(90, 70, 40, 0.12);
  --line-strong: rgba(90, 70, 40, 0.22);

  /* 青墨（主色）与朱印（强调/错误） */
  --qing: #2f6b5e;
  --qing-d: #1f4c42;
  --qing-l: #e4efe9;
  --zhu: #b4442f;
  --zhu-l: #fbeae6;
  --gold: #a8823c;

  --shadow: 0 10px 30px rgba(80, 60, 30, 0.08);
  --shadow-lg: 0 18px 44px rgba(80, 60, 30, 0.14);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 9px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans, "PingFang SC", "Hiragino Sans GB", sans-serif);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -8%, rgba(47, 107, 94, 0.09), transparent 42%),
    radial-gradient(circle at 92% 4%, rgba(180, 68, 47, 0.06), transparent 38%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.65;
}

/* ── 页头 ───────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(250, 246, 236, 0.9);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-container {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 12px var(--page-pad, 20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 21px;
  background: var(--qing-l);
  border: 1px solid rgba(47, 107, 94, 0.18);
  border-radius: 12px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.brand-sub { font-size: 12px; color: var(--ink-faint); }

.header-nav { display: flex; align-items: center; gap: 6px; }
.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-family: inherit;
  padding: 8px 13px;
  border-radius: var(--r-pill, 999px);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.nav-btn:hover { background: rgba(47, 107, 94, 0.07); color: var(--qing-d); }
.nav-btn.is-active {
  background: var(--qing);
  border-color: var(--qing);
  color: #fff;
  font-weight: 600;
}
.nav-home {
  margin-left: 4px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--line);
  text-decoration: none;
  font-size: 16px;
}
.nav-home:hover { background: var(--qing-l); }

/* ── 布局 ───────────────────────────────────────────────────────── */
.page {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 22px var(--page-pad, 20px) 72px;
}
.view { display: none; }
.view.is-active { display: block; animation: fade 0.28s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 容器：内容由 JS 动态注入 */
.quiz-stage, .detail-body { display: block; }
.detail-body > *:first-child { margin-top: 0; }

/* ── 按钮 ───────────────────────────────────────────────────────── */
.btn-primary, .btn-ghost, .btn-soft {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--r-pill, 999px);
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, box-shadow 0.18s, background 0.18s;
}
.btn-primary {
  background: var(--qing);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(47, 107, 94, 0.24);
}
.btn-primary:hover { background: var(--qing-d); }
.btn-primary:active { transform: translateY(1px); }
.btn-soft {
  background: var(--qing-l);
  color: var(--qing-d);
  border-color: rgba(47, 107, 94, 0.2);
}
.btn-ghost {
  background: var(--paper-2);
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--paper-3); }
.btn-primary:disabled, .btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── 每日一诗 ───────────────────────────────────────────────────── */
.daily-card {
  background:
    linear-gradient(150deg, rgba(47, 107, 94, 0.07), rgba(180, 68, 47, 0.05)),
    var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.daily-card::after {
  /* 右下角朱印 */
  content: "诗";
  position: absolute;
  right: 16px; bottom: 10px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-size: 22px;
  color: var(--zhu);
  border: 2px solid rgba(180, 68, 47, 0.34);
  border-radius: 6px;
  transform: rotate(-7deg);
  opacity: 0.6;
}
.daily-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; letter-spacing: 0.08em;
  color: var(--qing-d);
  background: var(--qing-l);
  border-radius: var(--r-pill, 999px);
  padding: 3px 11px;
  font-weight: 600;
}
.daily-title {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  margin: 10px 0 2px;
  letter-spacing: 0.02em;
}
.daily-meta { font-size: 13px; color: var(--ink-faint); margin-bottom: 12px; }
.daily-lines {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 2.05;
  color: var(--ink);
  margin-bottom: 14px;
}
.daily-lines p { margin: 0; }
.daily-ops { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 搜索 ───────────────────────────────────────────────────────── */
.search-row { display: flex; gap: 9px; margin-bottom: 18px; }
.search-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 15px;
  padding: 12px 16px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink);
}
.search-input:focus {
  outline: none;
  border-color: var(--qing);
  box-shadow: 0 0 0 3px rgba(47, 107, 94, 0.12);
}
/* 防抖等待中：极轻的反馈，让用户知道已经听到了、正在查 */
.search-input.is-typing { border-color: var(--qing); }
.search-input.is-typing::after {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--qing);
  vertical-align: middle;
  animation: typing-dot 0.9s ease-in-out infinite;
}
@keyframes typing-dot {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}

/* ── 分层书架 ───────────────────────────────────────────────────── */
.shelf { display: grid; gap: 18px; margin-bottom: 22px; }
.shelf-group {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.shelf-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
}
.shelf-title {
  font-family: var(--serif);
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 7px;
}
.shelf-desc { font-size: 12.5px; color: var(--ink-faint); }

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 14px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover {
  background: var(--qing-l);
  border-color: rgba(47, 107, 94, 0.35);
  color: var(--qing-d);
  transform: translateY(-1px);
}
.chip.is-on {
  background: var(--qing);
  border-color: var(--qing);
  color: #fff;
  font-weight: 600;
}
.chip-count {
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}
.chip-hero {
  padding: 10px 18px;
  font-size: 14.5px;
  background: linear-gradient(135deg, var(--qing-l), rgba(47, 107, 94, 0.06));
  border-color: rgba(47, 107, 94, 0.3);
  font-weight: 600;
  color: var(--qing-d);
}

/* 教材组下方的「尚有 N 篇待收录」如实提示 */
.shelf-missing-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 11px; padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}
.shelf-missing {
  font-size: 12px;
  color: var(--ink-faint);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-pill, 999px);
  padding: 3px 11px;
}

/* ── 过滤条 ─────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--qing-l);
  border: 1px solid rgba(47, 107, 94, 0.22);
  border-radius: var(--r-pill, 999px);
  padding: 7px 8px 7px 16px;
  margin-bottom: 14px;
}
/* 同 .modal：display:flex 会盖掉 [hidden]，必须显式声明 */
.filter-bar[hidden] { display: none; }
.fb-label { font-size: 12px; color: var(--qing-d); opacity: 0.75; }
.fb-name { font-size: 14px; font-weight: 700; color: var(--qing-d); flex: 1; min-width: 0; }
.fb-clear {
  border: none;
  background: rgba(47, 107, 94, 0.12);
  color: var(--qing-d);
  font-family: inherit; font-size: 12.5px;
  padding: 5px 12px; border-radius: var(--r-pill, 999px);
  cursor: pointer;
}
.fb-clear:hover { background: rgba(47, 107, 94, 0.22); }

/* ── 列表头 ─────────────────────────────────────────────────────── */
.list-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.list-count { font-size: 13px; color: var(--ink-faint); }
.list-ops { display: flex; align-items: center; gap: 8px; }
.list-ops .btn-ghost { padding: 6px 13px; font-size: 13px; }
.page-info { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ── 作品列表 ───────────────────────────────────────────────────── */
.work-list { display: grid; gap: 10px; }
.work-item {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex; align-items: center; gap: 14px;
}
.work-item:hover {
  border-color: rgba(47, 107, 94, 0.32);
  box-shadow: var(--shadow);
  transform: translateX(3px);
}
.work-main { flex: 1; min-width: 0; }
.work-title {
  font-family: var(--serif);
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.work-author { font-size: 13px; color: var(--ink-faint); margin-top: 3px; }
.work-first {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--r-pill, 999px);
  background: var(--paper-3);
  color: var(--ink-soft);
  font-weight: 500;
}
.tag-dyn { background: var(--qing-l); color: var(--qing-d); }
.tag-cat { background: rgba(168, 130, 60, 0.13); color: var(--gold); }
.work-go { color: var(--ink-faint); font-size: 18px; flex-shrink: 0; }

.load-more {
  display: block;
  margin: 18px auto 0;
  font-family: inherit; font-size: 14px;
  padding: 11px 26px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink-soft);
  cursor: pointer;
}
.load-more:hover { background: var(--qing-l); color: var(--qing-d); }
/* 同上：display:block 会盖掉 [hidden] */
.load-more[hidden] { display: none; }

/* 骨架屏 */
.skeleton {
  height: 78px;
  border-radius: var(--r-md);
  background: linear-gradient(100deg, var(--paper-3) 30%, var(--paper-2) 50%, var(--paper-3) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { from { background-position: 140% 0; } to { background-position: -40% 0; } }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--ink-faint);
  font-size: 14px;
}
.empty-ico { font-size: 34px; display: block; margin-bottom: 10px; opacity: 0.65; }

/* ── 背诵闯关 ───────────────────────────────────────────────────── */
.recite-bar {
  display: flex; gap: 9px; margin-bottom: 16px; flex-wrap: wrap;
}
.pick-select {
  flex: 1; min-width: 180px;
  font-family: inherit; font-size: 14.5px;
  padding: 11px 15px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink);
}
.pick-select:focus { outline: none; border-color: var(--qing); }

.recite-stage { min-height: 300px; }
.recite-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}
.recite-head { text-align: center; margin-bottom: 18px; }
.recite-title { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.recite-author { font-size: 13.5px; color: var(--ink-faint); margin-top: 4px; }

.recite-progress {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; font-size: 13px; color: var(--ink-faint);
}
.progress-track {
  flex: 1; height: 6px; border-radius: 3px;
  background: var(--paper-3); overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--qing), #4a9c88);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.line-list { display: grid; gap: 10px; }
.line {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  background: var(--paper);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.line.is-current {
  background: var(--qing-l);
  border-color: rgba(47, 107, 94, 0.3);
}
.line.is-done { opacity: 0.5; }
.line-text {
  flex: 1;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.85;
}
.line.is-hide .line-text { color: transparent; text-shadow: 0 0 13px rgba(43, 36, 25, 0.34); }
.line-no {
  width: 22px; height: 22px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper-3);
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.line.is-done .line-no { background: var(--qing); color: #fff; }
.line-btn {
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink-soft);
  font-family: inherit; font-size: 12.5px;
  padding: 5px 11px; border-radius: var(--r-pill, 999px);
  cursor: pointer;
}
.line-btn:hover { background: var(--qing-l); color: var(--qing-d); }
.line-btn:disabled { opacity: 0.55; cursor: default; }

/* 每句小喇叭：默认很淡，hover 才明显，避免抢了诗句本身的注意力 */
.line-speak {
  border: none;
  background: transparent;
  font-size: 13px;
  line-height: 1;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  opacity: 0.32;
  transition: opacity 0.16s, background 0.16s, transform 0.16s;
  flex-shrink: 0;
}
.line-speak:hover { opacity: 1; background: var(--qing-l); transform: scale(1.12); }
.line.is-current .line-speak { opacity: 0.75; }

/* ── 学习档案条 ─────────────────────────────────────────────────── */
.stats-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: linear-gradient(135deg, rgba(47, 107, 94, 0.1), rgba(168, 130, 60, 0.07));
  border: 1px solid rgba(47, 107, 94, 0.18);
  border-radius: var(--r-pill, 999px);
  padding: 9px 18px;
  margin-bottom: 18px;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.stats-bar[hidden] { display: none; }
.sb-item b {
  color: var(--qing-d);
  font-size: 16px;
  font-family: var(--serif);
  margin-right: 2px;
  font-variant-numeric: tabular-nums;
}
.sb-streak { color: var(--zhu); margin-left: auto; font-weight: 600; }

/* ── 我的学习书架 ───────────────────────────────────────────────── */
.shelf-mine { border-color: rgba(47, 107, 94, 0.24); }
.chip-mine {
  background: linear-gradient(135deg, var(--qing-l), rgba(47, 107, 94, 0.06));
  border-color: rgba(47, 107, 94, 0.26);
  color: var(--qing-d);
  font-weight: 600;
}
.mine-stats {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 12px; padding-top: 11px;
  border-top: 1px dashed var(--line-strong);
  font-size: 12.5px; color: var(--ink-faint);
}
.mine-stats b { color: var(--qing-d); font-family: var(--serif); font-size: 15px; }
.mine-empty { font-size: 13px; color: var(--ink-faint); padding: 4px 0 2px; }

/* ── 列表项：进度徽标 + 收藏星标 ────────────────────────────────── */
.work-item { align-items: flex-start; }
.work-ops { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.w-badge {
  font-family: var(--font-sans, sans-serif);
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--r-pill, 999px);
  margin-left: 6px;
  font-weight: 600;
  vertical-align: 1px;
}
.w-badge.is-done { background: var(--qing-l); color: var(--qing-d); }
.w-badge.is-doing { background: rgba(168, 130, 60, 0.15); color: var(--gold); }
/* 列表项星标：刻意做成 32px 的舒适点击区（视觉上仍是小星，但命中范围够大）。
   早期只有 19px 且半透明，实测连自动化点击都常点空，真人拇指更难命中。 */
.fav-star {
  border: none; background: transparent;
  font-size: 20px; line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  /* 用 padding 把命中区撑到 32px 以上，视觉大小由 font-size 决定 */
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  transition: transform 0.14s, color 0.14s, background 0.14s;
}
.fav-star:hover { color: var(--gold); background: rgba(168, 130, 60, 0.1); transform: scale(1.1); }
.fav-star.is-fav { color: var(--gold); }

/* 详情弹层内的收藏按钮 */
.btn-fav {
  font-family: inherit; font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--r-pill, 999px);
  border: 1px solid var(--line-strong);
  background: var(--paper-2);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s;
}
.btn-fav:hover { border-color: var(--gold); color: var(--gold); }
.btn-fav.is-fav {
  background: rgba(168, 130, 60, 0.12);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* 详情弹层内的进度提示 */
.detail-progress {
  text-align: center;
  font-size: 13px;
  color: var(--gold);
  background: rgba(168, 130, 60, 0.1);
  border-radius: var(--r-pill, 999px);
  padding: 5px 14px;
  margin: 0 auto 16px;
  width: fit-content;
}
.detail-progress.is-done {
  color: var(--qing-d);
  background: var(--qing-l);
}

/* ── 解析区块：逐句卡片 + 字词 chip + 空态提示 ─────────────────── */
.vocab-list { display: flex; flex-wrap: wrap; gap: 8px; }
.vocab-chip {
  font-size: 12.5px;
  color: var(--qing-d);
  background: var(--qing-l);
  border: 1px solid rgba(47, 107, 94, 0.22);
  border-radius: var(--r-pill, 999px);
  padding: 4px 12px;
  line-height: 1.6;
}
.vocab-chip::before { content: "✦ "; opacity: 0.6; }
.ann-list { display: flex; flex-direction: column; gap: 10px; }
.ann {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--qing);
  border-radius: var(--r-sm);
  padding: 11px 14px;
}
.ann-src {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 5px;
}
.ann-tr {
  font-size: 13.5px;
  color: var(--qing-d);
  line-height: 1.65;
  margin-bottom: 4px;
}
.ann-note {
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.7;
  padding-top: 5px;
  border-top: 1px dashed var(--line-strong);
}
/* 一条解析都没有时：明确告知，而不是让用户以为页面漏渲染 */
.detail-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-faint);
  background: var(--paper-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  line-height: 1.7;
}

/* 朗读中：按钮高亮 + 脉冲光圈，让用户知道现在播的是哪一句/哪一首 */
.is-speaking {
  background: var(--qing) !important;
  color: #fff !important;
  border-color: var(--qing) !important;
  animation: speak-pulse 1.1s ease-in-out infinite;
}
.line-speak.is-speaking { opacity: 1; }
@keyframes speak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 107, 94, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(47, 107, 94, 0); }
}

.recite-ops {
  display: flex; gap: 9px; justify-content: center;
  margin-top: 20px; flex-wrap: wrap;
}

/* 结果面板 */
.result-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 30px 24px;
  text-align: center;
}
.result-ico { font-size: 46px; display: block; margin-bottom: 8px; }
.result-title { font-family: var(--serif); font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.result-sub { font-size: 14px; color: var(--ink-soft); margin-bottom: 20px; }
.result-stats {
  display: flex; justify-content: center; gap: 26px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.rs-item { text-align: center; }
.rs-num {
  font-family: var(--serif); font-size: 26px; font-weight: 700;
  color: var(--qing-d); font-variant-numeric: tabular-nums;
}
.rs-lab { font-size: 12px; color: var(--ink-faint); }

/* ── 名句测验 ───────────────────────────────────────────────────── */
.quiz-bar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.quiz-progress { font-size: 13.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.quiz-score { font-size: 13.5px; color: var(--qing-d); font-weight: 700; margin-right: auto; }
.quiz-bar .btn-ghost { padding: 7px 14px; font-size: 13px; }

.quiz-card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 26px 22px;
}
.quiz-from {
  font-size: 13px; color: var(--ink-faint);
  text-align: center; margin-bottom: 14px;
}
.quiz-prompt {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.9;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}
.quiz-prompt .blank {
  display: inline-block;
  min-width: 82px;
  border-bottom: 2px solid var(--zhu);
  margin: 0 5px;
  color: var(--zhu);
  font-weight: 700;
}
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  font-family: var(--serif);
  font-size: 17px;
  padding: 15px 12px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.16s;
  text-align: center;
}
.opt:hover:not(:disabled) {
  border-color: var(--qing);
  background: var(--qing-l);
  transform: translateY(-2px);
}
.opt:disabled { cursor: default; }
.opt.is-right {
  background: var(--qing-l);
  border-color: var(--qing);
  color: var(--qing-d);
  font-weight: 700;
}
.opt.is-wrong {
  background: var(--zhu-l);
  border-color: var(--zhu);
  color: var(--zhu);
}

.quiz-note {
  margin-top: 18px;
  padding: 12px 15px;
  background: var(--paper-3);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--ink-soft);
  text-align: center;
}
.quiz-note b { color: var(--qing-d); font-family: var(--serif); }

/* ── 详情弹层 ───────────────────────────────────────────────────── */
/* ⚠️ .modal 用了 display:grid，会盖掉 [hidden] 的默认 display:none，
   必须显式声明 [hidden] 变体，否则弹层在首屏就常驻显示。 */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(30, 24, 14, 0.5); backdrop-filter: blur(3px); }
/* ⚠️ 弹层面板的高度约束有两个坑，都踩过：
   1) 父级 .modal 用 place-items:center，内容超高时面板顶部会被顶出视口；
   2) 只写 max-height + overflow-y:auto 时，内容比视口高会把底部操作按钮
      「挤」到面板可视区外，用户看得见点不着（elementFromPoint 命中 null）。
   解法：面板 flex 纵向布局，只有 .detail-scroll 滚动，操作区固定不参与滚动。 */
.modal-panel {
  position: relative;
  width: min(100%, 640px);
  max-height: min(88vh, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;               /* 圆角生效 + 只有内部滚动区滚 */
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px 20px;
  animation: pop 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.modal-panel > .detail-title,
.modal-panel > .detail-meta { flex-shrink: 0; }

/* 唯一的滚动区：正文 + 译文 + 赏析 */
.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;                  /* flex 子项可收缩，否则不会出现滚动条 */
  overflow-y: auto;
  overscroll-behavior: contain;   /* 滚到底不带动页面 */
  -webkit-overflow-scrolling: touch;
}

/* #detail-body 是 .modal-panel 的唯一子节点，flex 链要通过它传下去，
   否则 .detail-ops 的 sticky/flex-shrink 都不生效。 */
.detail-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

/* 操作栏固定底部，永不因正文变长而被挤出可见区 */
.modal-panel > .detail-ops {
  flex-shrink: 0;
  position: sticky;
  bottom: -20px;          /* 抵消面板底部 padding，让按钮贴边 */
  margin-top: 14px;
  padding: 12px 0 4px;
  background: linear-gradient(to top, var(--paper) 62%, rgba(250, 246, 236, 0));
}
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  width: 32px; height: 32px;
  border: none; border-radius: 50%;
  background: var(--paper-3);
  color: var(--ink-soft);
  font-size: 21px; line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: var(--zhu-l); color: var(--zhu); }

.detail-title {
  font-family: var(--serif);
  font-size: 26px; font-weight: 700;
  text-align: center; margin-bottom: 6px;
  padding-right: 30px;
}
.detail-meta {
  text-align: center; font-size: 13.5px;
  color: var(--ink-faint); margin-bottom: 20px;
  display: flex; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.detail-text {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 2.2;
  text-align: center;
  color: var(--ink);
  margin-bottom: 20px;
  padding: 18px 10px;
  background: var(--paper-2);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.detail-text p { margin: 0; }
.detail-sec { margin-bottom: 18px; }
.detail-sec-title {
  font-family: var(--serif);
  font-size: 15.5px; font-weight: 700;
  color: var(--qing-d);
  margin-bottom: 9px;
  display: flex; align-items: center; gap: 7px;
}
.detail-sec-body { font-size: 14.5px; color: var(--ink-soft); line-height: 1.85; white-space: pre-wrap; }
.detail-ops { display: flex; gap: 9px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* ── 提示 ───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  background: rgba(43, 36, 25, 0.93);
  color: #fff;
  font-size: 14px;
  padding: 11px 22px;
  border-radius: var(--r-pill, 999px);
  z-index: 120;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  animation: fade 0.2s ease both;
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast[hidden] { display: none; }

/* ── 响应式 ─────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .header-nav .nav-btn { padding: 7px 10px; font-size: 13px; }
  .brand-sub { display: none; }
  .opt-grid { grid-template-columns: 1fr; }
  .quiz-prompt { font-size: 21px; }
  .line-text { font-size: 17.5px; }
  .detail-text { font-size: 18px; line-height: 2.05; }
  .daily-title { font-size: 20px; }
  .search-row { flex-direction: column; }
  .search-row .btn-primary { width: 100%; }
}

@media (max-width: 420px) {
  .brand-title { font-size: 15px; }
  .nav-btn { padding: 6px 9px; font-size: 12.5px; }
  .recite-card { padding: 17px 15px; }
  .quiz-card { padding: 20px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
