/* ==========================================================================
   早教故事 · 样式
   ⚠️ 全部选择器限定在 .storywrap 命名空间内，配色复用站点 --tz-* 令牌，
      与 /blog/ 的 .blogwrap 保持同一套视觉语言
   ========================================================================== */

.storywrap {
  --st-ink: var(--tz-text, #1f2937);
  --st-ink-2: var(--tz-text-2, #4b5563);
  --st-ink-3: var(--tz-text-3, #9199a8);
  --st-line: var(--tz-border, #e8ebf1);
  --st-surface: #fff;
  --st-surface-2: var(--tz-surface-2, #f7f8fb);
  --st-brand: var(--tz-primary, #4f46e5);
  --st-warm: #f59e0b;
  --st-warm-soft: #fff7e6;
  --st-ok: var(--tz-success, #0f9960);
  --st-radius: 16px;
  color: var(--st-ink);
  font-size: 15px;
  line-height: 1.7;
  /* 打卡后要收起整段正文，浏览器默认的滚动锚定会把页面临时拉回旧位置，这里关掉 */
  overflow-anchor: none;
  /* 底部留出空间，避开站点固定的客服浮钮 */
  padding-bottom: 76px;
  max-width: 720px;
  margin: 0 auto;
}
.storywrap * { box-sizing: border-box; }

/* ---------- 测试期提示 ---------- */
.storywrap .st-beta {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--st-warm-soft);
  border: 1px solid #fde3b3;
  color: #92400e;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.storywrap .st-beta b { font-weight: 700; }
.storywrap .st-beta a { color: #92400e; text-decoration: underline; }

/* ---------- 顶部信息条 ---------- */
.storywrap .st-hero {
  background: linear-gradient(135deg, #4f46e5 0%, #6d5cf0 46%, #8b5cf6 100%);
  border-radius: 18px;
  padding: 20px;
  color: #fff;
  box-shadow: 0 10px 28px rgba(79, 70, 229, .2);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.storywrap .st-hero::after {
  content: ""; position: absolute; right: -46px; top: -66px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,.24), rgba(255,255,255,0) 68%);
  border-radius: 50%;
}
.storywrap .st-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.storywrap .st-hero h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: .3px; }
.storywrap .st-hero-sub { font-size: 12.5px; opacity: .9; margin-top: 3px; }
.storywrap .st-ring {
  flex: none; width: 62px; height: 62px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: conic-gradient(#fbbf24 var(--p, 0%), rgba(255,255,255,.22) 0);
}
.storywrap .st-ring::before {
  content: ""; position: absolute; inset: 5px; border-radius: 50%;
  background: #5b4fe0;
}
.storywrap .st-ring span {
  position: relative; z-index: 1; font-size: 14px; font-weight: 700; line-height: 1.1; text-align: center;
}
.storywrap .st-ring span small { display: block; font-size: 9px; font-weight: 400; opacity: .85; }
.storywrap .st-hero-stats { display: flex; gap: 16px; font-size: 12.5px; margin-top: 14px; position: relative; z-index: 1; }
.storywrap .st-hero-stats b { font-size: 16px; font-weight: 700; }

/* ---------- 区块标题 ---------- */
.storywrap .st-sec { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 10px; }
.storywrap .st-sec h2 { font-size: 16px; margin: 0; font-weight: 700; }
.storywrap .st-sec a { font-size: 12.5px; color: var(--st-brand); text-decoration: none; }

/* ---------- 故事卡 ---------- */
.storywrap .st-card {
  display: flex; gap: 13px; align-items: stretch;
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius);
  padding: 13px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
  transition: transform .16s ease, box-shadow .16s ease;
}
.storywrap .st-card:active { transform: scale(.985); }
.storywrap .st-card:hover { box-shadow: 0 6px 20px rgba(31, 41, 55, .07); }
.storywrap .st-card.is-done { opacity: .62; }
.storywrap .st-cover {
  flex: none; width: 84px; height: 84px; border-radius: 13px;
  display: grid; place-items: center; font-size: 34px;
  background: linear-gradient(150deg, #eef2ff, #faf5ff);
  border: 1px solid #ede9fe;
}
.storywrap .st-card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.storywrap .st-card-title {
  font-size: 15.5px; font-weight: 700; color: var(--st-ink);
  margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.storywrap .st-card-sub {
  font-size: 12.5px; color: var(--st-ink-3); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.storywrap .st-card-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.storywrap .st-tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--st-surface-2); color: var(--st-ink-2); border: 1px solid var(--st-line);
}
.storywrap .st-tag.warm { background: var(--st-warm-soft); color: #b45309; border-color: #fde3b3; }
.storywrap .st-tag.ok { background: #e8f7ee; color: #0b7a4b; border-color: #c7ebd6; }
.storywrap .st-go {
  flex: none; align-self: center; font-size: 13px; color: var(--st-brand); font-weight: 600;
  display: flex; align-items: center; gap: 2px;
}

/* ---------- 空态 / 提示 ---------- */
.storywrap .st-empty {
  text-align: center; padding: 34px 18px; color: var(--st-ink-3);
  background: var(--st-surface); border: 1px dashed var(--st-line); border-radius: var(--st-radius);
}
.storywrap .st-empty .ico { font-size: 34px; display: block; margin-bottom: 8px; }
.storywrap .st-note {
  font-size: 12.5px; color: var(--st-ink-3); background: var(--st-surface-2);
  border-radius: 10px; padding: 9px 12px; margin-top: 10px; line-height: 1.6;
}

/* ---------- 按钮（复用站点按钮语义，仅补故事页需要的尺寸） ---------- */
.storywrap .st-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px; cursor: pointer;
  padding: 13px 18px; font-size: 15px; font-weight: 600;
  text-decoration: none; line-height: 1.2;
}
.storywrap .st-btn-main { background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff; width: 100%; }
.storywrap .st-btn-main:disabled { background: #d7dae3; color: #8b91a1; cursor: not-allowed; }
.storywrap .st-btn-ghost { background: var(--st-surface-2); color: var(--st-ink-2); border: 1px solid #dbe0ea; }

/* ---------- 阅读器 ---------- */
.storywrap-read { padding-bottom: 76px; }
.storywrap .st-readbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px 12px;
}
.storywrap .st-readbar .back {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--st-surface); border: 1px solid var(--st-line);
  color: var(--st-ink-2); text-decoration: none; font-size: 16px;
}
.storywrap .st-readbar .ttl {
  flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.storywrap .st-readbar .prog { font-size: 11.5px; color: var(--st-ink-3); flex: none; }

.storywrap .st-progress { height: 4px; background: #eceef4; border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.storywrap .st-progress i { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #a855f7); border-radius: 99px; transition: width .25s ease; }

/* ---------- 阅读方式切换（分页 / 通读） ---------- */
.storywrap .st-modebar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.storywrap .st-mode {
  display: inline-flex; gap: 2px; padding: 3px; flex: none;
  background: var(--st-surface-2); border: 1px solid var(--st-line); border-radius: 999px;
}
.storywrap .st-mode button {
  border: none; background: transparent; cursor: pointer;
  padding: 5px 15px; border-radius: 999px; line-height: 1.4;
  font-size: 12.5px; color: var(--st-ink-2);
}
.storywrap .st-mode button.on {
  background: var(--st-surface); color: var(--st-brand); font-weight: 700;
  box-shadow: 0 1px 4px rgba(31, 41, 55, .1);
}
.storywrap .st-mode-meta {
  margin-left: auto; min-width: 0; font-size: 11.5px; color: var(--st-ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 通读模式收尾按钮：只在通读下出现 */
.storywrap .st-readend { display: none; margin-top: 14px; }
.storywrap .st-readend .st-note { text-align: center; margin-top: 8px; }
.storywrap.is-scroll .st-readend { display: block; }
.storywrap.is-scroll .st-nav { display: none; }
/* 打卡完成后只留成功卡片 */
.storywrap.is-done .st-modebar,
.storywrap.is-done .st-beta { display: none; }

.storywrap .st-stage {
  background: var(--st-surface);
  border: 1px solid var(--st-line);
  border-radius: 20px;
  padding: 22px 20px 18px;
  /* 38vh 而不是 46vh：再高一点，「下一页」就会被站点底部 tabbar 挡在屏幕外 */
  min-height: 38vh;
  display: flex; flex-direction: column;
}
.storywrap .st-art {
  font-size: 58px; text-align: center; line-height: 1.2;
  margin-bottom: 14px; user-select: none;
}
.storywrap .st-text {
  font-size: 22px; line-height: 2; letter-spacing: .6px;
  color: var(--st-ink); text-align: left;
  flex: 1;
}
.storywrap .st-text p { margin: 0 0 .55em; }
.storywrap .st-pinyin {
  display: block; font-size: 12px; line-height: 1.5; color: #8b93a6;
  letter-spacing: .3px; margin-bottom: 2px; font-family: "Times New Roman", serif;
}
.storywrap .st-tip {
  margin-top: 16px; padding: 9px 12px; border-radius: 11px;
  background: var(--st-warm-soft); color: #92400e; font-size: 12.5px; line-height: 1.6;
}
.storywrap .st-tip b { font-weight: 700; }

.storywrap .st-nav {
  display: flex; gap: 10px; margin-top: 14px;
  /* 吸附在视口底部：正文多长都不用往下找「下一页」；
     移动端再让开站点固定 tabbar（body.is-mobile 已留 70px 内边距） */
  position: sticky; bottom: 8px; z-index: 30;
  padding: 6px; border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 16px rgba(31, 41, 55, .08);
}
body.is-mobile .storywrap .st-nav { bottom: 76px; }
.storywrap .st-nav button {
  flex: 1; padding: 13px; border-radius: 12px; border: 1px solid var(--st-line);
  background: var(--st-surface); color: var(--st-ink-2); font-size: 14.5px; font-weight: 600; cursor: pointer;
}
.storywrap .st-nav button:disabled { color: #c2c6d2; background: #fafbfd; }

/* 通读模式：卡片不再占满一屏，正文连排，靠间距保留"一页一段"的呼吸感 */
.storywrap.is-scroll .st-stage { min-height: 0; padding: 18px 18px 15px; }
.storywrap.is-scroll .st-stage + .st-stage { margin-top: 12px; }
.storywrap.is-scroll .st-art { font-size: 42px; margin-bottom: 8px; }
.storywrap.is-scroll .st-text { font-size: 18.5px; line-height: 1.95; letter-spacing: .3px; }
.storywrap.is-scroll .st-text p { margin: 0 0 .5em; }
.storywrap.is-scroll .st-tip { margin-top: 12px; }
.storywrap.is-scroll .st-pinyin { font-size: 11.5px; }

/* ---------- 音乐条 ---------- */
.storywrap .st-music {
  margin: 0 0 12px; background: var(--st-surface); border: 1px solid var(--st-line);
  border-radius: 14px; overflow: hidden;
}
.storywrap .st-music-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px 10px 10px;
}
.storywrap .st-music-btn {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: none; cursor: pointer; background: var(--st-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; padding: 0;
  box-shadow: 0 4px 10px rgba(45, 108, 223, .26);
  transition: transform .15s ease;
}
.storywrap .st-music-btn:active { transform: scale(.94); }
/* 暂停时显示 ▶，播放中显示 ❚❚ */
.storywrap .st-music-btn .ic-pause { display: none; }
.storywrap .st-music.is-playing .st-music-btn .ic-play { display: none; }
.storywrap .st-music.is-playing .st-music-btn .ic-pause { display: inline; }
.storywrap .st-music-info { flex: 1; min-width: 0; }
.storywrap .st-music-name {
  font-size: 13.5px; font-weight: 600; color: var(--st-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.storywrap .st-music-sub {
  display: flex; align-items: center; gap: 5px;
  margin-top: 2px; font-size: 11.5px; color: var(--st-ink-2);
}
.storywrap .st-music-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #cbd2e0; flex: none;
}
.storywrap .st-music.is-playing .st-music-dot { background: #22c55e; }
.storywrap .st-music-tag {
  flex: none; display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 999px;
  font-size: 11px; line-height: 1.6; font-weight: 600;
  color: #6b4a1f; background: rgba(245, 197, 106, .22);
}
.storywrap .st-music-artist {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; color: var(--st-ink-3);
}
.storywrap .st-music-open {
  flex: none; margin-left: 2px; font-size: 11px; color: var(--st-ink-3);
  text-decoration: none; border-bottom: 1px dotted currentColor; line-height: 1.3;
}
.storywrap .st-music-bar { height: 2px; background: rgba(0, 0, 0, .05); }
.storywrap .st-music-bar i {
  display: block; height: 100%; width: 0;
  background: var(--st-brand); transition: width .3s linear;
}
.storywrap .st-music audio { display: none; }

/* ---------- 打卡成功层 ---------- */
.storywrap .st-done {
  text-align: center; padding: 26px 18px 20px;
  background: var(--st-surface); border: 1px solid var(--st-line);
  border-radius: 20px;
}
.storywrap .st-done .badge {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%;
  background: linear-gradient(140deg, #34d399, #10b981);
  display: grid; place-items: center; font-size: 34px; color: #fff;
  box-shadow: 0 10px 26px rgba(16, 185, 129, .3);
  animation: st-pop .45s cubic-bezier(.2, 1.4, .5, 1);
}
@keyframes st-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.storywrap .st-done h2 { font-size: 22px; margin: 0 0 6px; font-weight: 700; }
.storywrap .st-done .sub { font-size: 13.5px; color: var(--st-ink-3); margin-bottom: 18px; }
.storywrap .st-done-stats { display: flex; justify-content: center; gap: 10px; margin-bottom: 16px; }
.storywrap .st-done-stats div {
  flex: 1; max-width: 108px; background: var(--st-surface-2); border-radius: 13px; padding: 11px 6px;
}
.storywrap .st-done-stats b { display: block; font-size: 19px; font-weight: 700; color: var(--st-ink); }
.storywrap .st-done-stats span { font-size: 11.5px; color: var(--st-ink-3); }
.storywrap .st-moral {
  background: var(--st-warm-soft); border-radius: 12px; padding: 12px 14px;
  font-size: 13.5px; color: #92400e; line-height: 1.7; margin-bottom: 18px; text-align: left;
}

/* ---------- 互动问答 ---------- */
.storywrap .st-quiz { background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.storywrap .st-quiz .q { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.storywrap .st-opt {
  display: block; width: 100%; text-align: left;
  padding: 11px 13px; margin-bottom: 8px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--st-line); background: var(--st-surface); color: var(--st-ink-2);
  font-size: 14px; line-height: 1.5;
}
.storywrap .st-opt.sel { border-color: var(--st-brand); background: #eef2ff; color: #3730a3; font-weight: 600; }

/* ---------- 日历 ---------- */
.storywrap .st-cal { background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 16px; padding: 14px; }
.storywrap .st-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.storywrap .st-cal-head b { font-size: 15px; }
.storywrap .st-cal-head a { font-size: 13px; color: var(--st-brand); text-decoration: none; padding: 4px 8px; }
.storywrap .st-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; }
.storywrap .st-grid .wd { font-size: 11px; color: var(--st-ink-3); padding-bottom: 4px; }
.storywrap .st-day {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  font-size: 13px; color: var(--st-ink-2); background: var(--st-surface-2);
}
.storywrap .st-day.empty { background: transparent; }
.storywrap .st-day.hit { background: linear-gradient(140deg, #6366f1, #8b5cf6); color: #fff; font-weight: 700; }
.storywrap .st-day.today { outline: 2px solid #fbbf24; outline-offset: -2px; }
.storywrap .st-day small { font-size: 9px; opacity: .85; }
.storywrap .st-cal-foot { display: flex; gap: 10px; margin-top: 14px; }
.storywrap .st-cal-foot div { flex: 1; text-align: center; background: var(--st-surface-2); border-radius: 11px; padding: 9px 4px; }
.storywrap .st-cal-foot b { display: block; font-size: 17px; }
.storywrap .st-cal-foot span { font-size: 11px; color: var(--st-ink-3); }

/* ---------- 设置 ---------- */
.storywrap .st-panel { background: var(--st-surface); border: 1px solid var(--st-line); border-radius: 16px; padding: 15px; margin-bottom: 12px; }
.storywrap .st-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; }
.storywrap .st-row + .st-row { border-top: 1px dashed var(--st-line); }
.storywrap .st-row .lb { font-size: 14px; }
.storywrap .st-row .lb small { display: block; font-size: 11.5px; color: var(--st-ink-3); margin-top: 2px; }
.storywrap .st-seg { display: flex; gap: 5px; flex: none; }
.storywrap .st-seg button {
  min-width: 36px; padding: 7px 9px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--st-line); background: var(--st-surface); color: var(--st-ink-2); font-size: 13.5px;
}
.storywrap .st-seg button.on { background: var(--st-brand); border-color: var(--st-brand); color: #fff; font-weight: 700; }

/* ---------- 顶部子导航（与博客分类 chips 同一视觉语言） ---------- */
.storywrap .st-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px;
  -webkit-overflow-scrolling: touch;
}
.storywrap .st-tabs::-webkit-scrollbar { height: 0; }
.storywrap .st-tabs a {
  flex: none; padding: 7px 15px; border-radius: 999px; white-space: nowrap;
  background: var(--st-surface); border: 1px solid var(--st-line);
  font-size: 13px; color: var(--st-ink-2); text-decoration: none;
}
.storywrap .st-tabs a.on {
  background: var(--st-brand); border-color: var(--st-brand);
  color: #fff; font-weight: 600;
}

/* 内容内筛选条（年龄段等），与子导航区分开 */
.storywrap .st-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; }
.storywrap .st-chips a { flex: none; text-decoration: none; white-space: nowrap; }

/* ---------- toast ---------- */
.storywrap .st-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(10px);
  background: rgba(31, 41, 55, .92); color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 9999; max-width: 86vw; text-align: center;
}
.storywrap .st-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 420px) {
  .storywrap .st-text { font-size: 20px; }
  .storywrap .st-art { font-size: 48px; }
  .storywrap .st-cover { width: 72px; height: 72px; font-size: 30px; }
}

/* ---------- 轻内容页（儿歌 / 童谣 / 认知卡 / 亲子游戏 / 晚安语） ---------- */
.storywrap .st-lite { text-align: center; padding: 20px 2px 0; }
.storywrap .st-lite-emoji { font-size: 56px; line-height: 1.1; }
.storywrap .st-lite-kind { margin-top: 10px; font-size: 12.5px; color: var(--st-ink-2); }
.storywrap .st-lite-title {
  margin: 6px 0 18px; font-size: 22px; font-weight: 700; color: var(--st-ink); line-height: 1.35;
}
.storywrap .st-lite-text {
  text-align: left; background: var(--st-surface); border: 1px solid var(--st-line);
  border-radius: var(--st-radius); padding: 18px 18px 4px;
}
.storywrap .st-lite-text p {
  margin: 0 0 14px; font-size: 17px; line-height: 1.95; color: var(--st-ink);
}
.storywrap .st-lite .st-btn-main { margin-top: 18px; }
.storywrap .st-lite .st-tip { text-align: left; margin-top: 12px; }

/* ---------- 故事页隐藏站点客服浮钮 ----------
   它是 fixed 在右下角的（.kefu-trigger / .kefu-panel），会压住卡片的「读 →」
   和阅读页底部按钮。本样式表只被 /blog/story/ 引用，所以可以直接隐藏，
   不需要 :has() 之类的限定（实测部分浏览器版本对 :has 支持不好）。 */
.kefu-trigger, .kefu-panel { display: none !important; }
