/* ============================================================
   一宁小古文 · 宣纸风格
   宣纸底 #F0E8D2 · 卡片米黄 #F7F1E0 · 暖墨 #2A2318 · 朱砂 #C53A2A
   ============================================================ */

:root {
  --paper: #F0E8D2;
  --card: #F7F1E0;
  --ink: #2A2318;
  --ink-soft: #6B5D45;
  --vermilion: #C53A2A;
  --vermilion-soft: #F5E0D5;
  --border: #DFCFA6;
  --num-muted: #AB9670;
  --gold: #BD8F3E;
  --card-shadow: 0 1px 2px rgba(122, 98, 56, 0.05), 0 2px 8px rgba(122, 98, 56, 0.045);
  --radius: 10px;
  --serif: 'Noto Serif SC', 'Source Han Serif CN', 'STSong', serif;
  --sans: 'Noto Sans SC', 'PingFang SC', sans-serif;
  --brush: 'Ma Shan Zheng', 'KaiTi', 'STKaiti', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  min-height: 100vh;
  /* 宣纸底纹 */
  background-image:
    radial-gradient(rgba(197, 58, 42, 0.015) 1px, transparent 1px),
    radial-gradient(rgba(26, 26, 26, 0.012) 1px, transparent 1px);
  background-size: 14px 14px, 22px 22px;
  background-position: 0 0, 7px 7px;
}

a { text-decoration: none; color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
}

.placeholder {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}

/* ============ 首页 ============ */

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 0;
}

.brand { display: flex; align-items: center; gap: 8px; }

.seal {
  width: 26px; height: 26px;
  background: var(--vermilion);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--paper);
  font-family: var(--brush);
  font-size: 15px;
  box-shadow: inset 0 0 0 1.5px rgba(247, 241, 224, 0.65), inset 0 0 0 3px var(--vermilion);
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: 18px;
  padding: 7px 14px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.home-body { padding: 10px 24px 32px; }

/* 题签（作者名 + 朗读人）：用墨色，不用红色。
   注：人名忌讳朱红，2026-09-28 新哥明确要求，别改回 --vermilion */
.kicker {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--ink);
  margin-top: 12px;
}

.hero-title {
  font-family: var(--brush);
  font-weight: 400;
  font-size: 47px;
  line-height: 1.25;
  margin: 6px 0 8px;
  letter-spacing: 0.02em;
}

.hero-sub {
  font-size: 14px;
  color: var(--ink-soft);
}

.hero-img {
  width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin-top: 16px;
  border: 1px solid var(--border);
}

/* 继续听 */
.resume-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 18px;
}

.play-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--vermilion);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.play-btn svg { display: block; }

.resume-info { flex: 1; min-width: 0; }

.resume-label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
}

.resume-title {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

.resume-arrow {
  font-size: 23px;
  color: var(--vermilion);
  font-family: var(--serif);
}

/* 选一册 */
.vol-section { margin-top: 22px; }

.block-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.vol-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.vol-badge {
  width: 34px; height: 44px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--brush);
  font-size: 21px;
  color: var(--paper);
  flex-shrink: 0;
}

.vol-badge.red { background: var(--vermilion); }
.vol-badge.black { background: var(--ink); }

.vol-info { flex: 1; min-width: 0; }

.vol-name { font-size: 17px; font-weight: 700; }

.vol-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.vol-count {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--vermilion);
  flex-shrink: 0;
}

.vol-count.muted { color: var(--ink-soft); }

.home-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}

/* ============ 页头（内页通用） ============ */

.page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 0;
  gap: 8px;
}

.back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.back-icon {
  font-size: 27px;
  line-height: 1;
  color: var(--ink);
  padding: 0 2px;
}

.back-label {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-num {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--vermilion);
  flex-shrink: 0;
}

/* ============ 目录页 ============ */

.vol-tabs {
  display: flex;
  background: #E1D3AE;
  border-radius: 16px;
  padding: 3px;
}

.vol-tab {
  font-family: var(--sans);
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 13px;
  color: var(--ink-soft);
}

.vol-tab.active {
  background: var(--vermilion);
  color: var(--paper);
  font-weight: 500;
}

.catalog { padding: 18px 24px 32px; }

.group { margin-bottom: 26px; }

/* 分组标题条:毛笔字大标题 + 朱砂竖章 + 通栏底线,归组感更强 */
.group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.group-bar {
  width: 5px;
  height: 42px;
  background: var(--vermilion);
  border-radius: 2px;
  flex-shrink: 0;
}

/* 两行式分组标题：第一组 / 乡村即景（宋体，新哥 2026-09-28 定的） */
.group-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* 字重只写 600 或 700：index.html 的 Noto Serif SC 只加载了 400/600/700，
   写 500 会按 CSS 字重匹配规则退回 400（等于没写、白白失效） */
.group-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

/* 副行是这一组的内容名(如「乡村即景」)，不是注脚：
   字号贴近主行、颜色用中间墨、字重与主行同为 600（比课文标题的 600 更大一号）。
   别用「小字 + 浅墨 + 宽字距」三重弱化，否则两行会读断(新哥 2026-09-28 反馈 22/15 搭配失衡) */
.group-sub {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: #4A3E2C;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.group-desc {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  margin-left: auto;
  text-align: right;
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.lesson-row-num {
  font-size: 17px;
  font-weight: 700;
  color: var(--num-muted);
  width: 26px;
  flex-shrink: 0;
}

.lesson-row-info { flex: 1; min-width: 0; }

.lesson-row-title {
  font-size: 16px;
  font-weight: 600;
}

.lesson-row-preview {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--vermilion-soft);
  border-radius: 9px;
  padding: 4px 8px;
  flex-shrink: 0;
}

.audio-chip-text {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--vermilion);
}

/* ============ 课文页 ============ */

.lesson-body { padding: 0 24px 28px; }

.lesson-kicker {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--vermilion);
  margin-top: 8px;
}

.lesson-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 4px;
}

/* 标题用宋体(衬线),庄重易认 */
.lesson-title-big {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 29px;
  letter-spacing: 0.08em;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.fs-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.fs-btn:active { background: var(--vermilion-soft); }

.lesson-source {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

/* 课文插图 */
.lesson-img {
  width: 100%;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* 原文卡 */
.classic-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 20px;
}

/* 原文卡头部:标题 + 手机朗读按钮 */
.classic-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.speak-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--vermilion);
  background: var(--vermilion-soft);
  border: 1px solid rgba(197, 58, 42, 0.22);
  border-radius: 10px;
  padding: 5px 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.speak-btn svg { display: block; }

.speak-btn:active { background: #EFD6C8; }

.speak-btn.speaking {
  background: var(--vermilion);
  border-color: var(--vermilion);
  color: var(--card);
}

.speak-btn.speaking .speak-text { color: var(--card); }

/* 正在念到的那个字:淡朱砂底 + 朱砂字 */
.cl-zi.cl-speaking {
  background: rgba(197, 58, 42, 0.1);
  border-radius: 6px;
}

.cl-zi.cl-speaking .cl-hz { color: var(--vermilion); }

/* 正文左对齐（每行自左端起排） */
.cl-line { text-align: left; line-height: 1; }

.cl-line + .cl-line { margin-top: 16px; }

/* 每个汉字一个固定宽度小格:拼音在上、汉字在下,保证字间一致
   --zi 由课文页字号按钮控制(20~32px),格宽随字号同步缩放 */
.cl-zi {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  width: calc(var(--zi, 24px) + 10px);
  vertical-align: bottom;
  margin: 0 1px 6px;
}

.cl-zi .cl-py {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--gold);
  height: 15px;
  line-height: 15px;
  white-space: nowrap;
}

.cl-zi .cl-hz {
  font-size: var(--zi, 24px);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}

/* 显示拼音开关:关闭时隐藏拼音层,格宽不变 */
.classic-card.no-pinyin .cl-py { display: none; }

.cl-zi-punct .cl-hz {
  font-weight: 400;
  line-height: 1;
  padding-bottom: 6px;
}

.cl-gap { display: inline-block; width: 12px; }

/* 朗读卡片(置于原文上方) */
.listen-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 14px;
}

.listen-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--vermilion);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.listen-btn svg { display: block; }

.listen-head {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--vermilion-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.listen-info { flex: 1; min-width: 0; }

.listen-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.listen-title {
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
}

.listen-sub {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listen-track {
  height: 4px;
  background: #E1D3AE;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
  cursor: pointer;
}

.listen-fill {
  height: 100%;
  width: 0%;
  background: var(--vermilion);
  border-radius: 2px;
}

.listen-speed {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--vermilion);
  background: var(--vermilion-soft);
  border: none;
  border-radius: 10px;
  padding: 4px 9px;
  cursor: pointer;
  flex-shrink: 0;
}

/* 配乐开关:亮 = 配乐版,灰 = 纯朗读 */
.listen-bgm {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: #8a7a63;
  background: transparent;
  border: 1px solid var(--border, #d8c9a5);
  border-radius: 10px;
  padding: 3px 8px;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.55;
}
.listen-bgm.on {
  color: var(--vermilion);
  background: var(--vermilion-soft);
  border-color: transparent;
  opacity: 1;
}

.listen-wait {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--vermilion);
  background: var(--vermilion-soft);
  border-radius: 10px;
  padding: 5px 10px;
  flex-shrink: 0;
}

/* 功能栏:显示拼音 / 字号 */
.ctrl-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 7px 10px;
  margin-top: 12px;
}

.ctrl-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.ctrl-toggle.active {
  color: var(--vermilion);
  background: var(--vermilion-soft);
  font-weight: 500;
}

.py-badge {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--vermilion);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.ctrl-size {
  display: flex;
  align-items: center;
  gap: 6px;
}

.size-btn {
  min-width: 32px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  padding: 0 7px;
}

.size-btn:active { background: var(--vermilion-soft); border-color: rgba(197, 58, 42, 0.4); }

.size-label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
}

/* 伪全屏降级(不支持 Fullscreen API 的 iOS 浏览器) */
body.fs-pseudo {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  z-index: 999;
  background: var(--paper);
}

/* ============================================================
   ⚠️ 全屏竖屏兜底（2026-09-28 记录，勿删）
   小米等国产安卓浏览器点「全屏」时，系统会强行把屏幕转成横屏，
   竖版页面躺倒、没法读。JS 先试 screen.orientation.lock('portrait')；
   锁不住（老内核会抛 NotAllowedError）时给 body 加 .fs-forced-portrait，
   这里把整屏容器 #screen（含底部连播条）反向旋转 -90° 掰回竖版。
   逻辑见 js/main.js 的 toggleFullscreen / syncFullscreenOrientation。
   做布局调整时注意：#screen 是旋转载体，别删；底部固定元素要挂在 #screen 里。
   ============================================================ */
body.fs-forced-portrait {
  overflow: hidden;
  background: var(--paper);
}

body.fs-forced-portrait .screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vh;    /* 横屏时取短边 */
  height: 100vw;   /* 横屏时取长边 */
  transform: rotate(-90deg) translateX(-100%);
  transform-origin: top left;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--paper);
}

/* 搜索 */
.search-body { padding: 14px 24px 32px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: 12px;
  padding: 10px 14px;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  min-width: 0;
}

.search-box input::placeholder { color: var(--num-muted); }

.search-results { margin-top: 14px; }

.search-hint {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  padding: 18px 4px;
  line-height: 1.9;
}

/* 译文 / 字词 */
.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.info-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.info-bar {
  width: 3px; height: 15px;
  background: var(--vermilion);
  border-radius: 2px;
}

.info-title { font-size: 16px; font-weight: 600; }

.info-text {
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-soft);
}

.info-text li {
  list-style: none;
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink-soft);
  padding-left: 14px;
  position: relative;
}

.info-text li::before {
  content: '';
  position: absolute;
  left: 2px; top: 12px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

/* 上一篇 / 首页 / 目录 / 下一篇 */
.lesson-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 64px minmax(0, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.lesson-nav-btn {
  min-height: 52px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 6px;
  min-width: 0;
  font-family: var(--sans);
  transition: transform 0.12s ease;
}

.lesson-nav-btn:active { transform: scale(0.97); }

.lesson-nav-btn .nav-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1;
}

.lesson-nav-btn .nav-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 首页 / 目录:次级按钮,窄一点、描边不填色 */
.lesson-nav-btn.slim {
  flex-direction: row;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0 6px;
}

/* 上一篇:素白描边 */
.lesson-nav-btn.ghost {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

.lesson-nav-btn.ghost .nav-label { color: var(--ink-soft); }
.lesson-nav-btn.ghost .nav-title { color: var(--ink); }

/* 下一篇:朱砂实心,主按钮 */
.lesson-nav-btn.solid {
  background: var(--vermilion);
  border: 1px solid var(--vermilion);
  color: var(--paper);
  box-shadow: 0 2px 8px rgba(197, 58, 42, 0.24);
}

.lesson-nav-btn.solid .nav-label { color: rgba(247, 241, 224, 0.9); }
.lesson-nav-btn.solid .nav-title { color: var(--paper); }

/* 首页 / 目录:朱砂描边次级按钮(带 solid 类,须写在 .solid 之后覆盖) */
.lesson-nav-btn.slim {
  background: var(--card);
  border: 1px solid rgba(197, 58, 42, 0.4);
  color: var(--vermilion);
  box-shadow: none;
}

.lesson-nav-btn.disabled { visibility: hidden; }

/* 空状态 */
.empty-tip {
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 2;
}

/* ============ 顶栏右侧组合（搜索 + 全屏等） ============ */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* 内页顶栏的全屏按钮：排到最右 */
.page-topbar .fs-top { margin-left: 4px; }

/* ============ 连播卡片（首页） ============ */
.chain-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 12px;
}

.chain-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.chain-tt {
  font-family: var(--brush);
  font-size: 20px;
  color: var(--vermilion);
}

.chain-desc {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
}

/* 点播第一行:起始课 至 结束课(两个下拉平分一行,2026-09-30 新哥定的两行布局) */
.chain-rows {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chain-rows .chain-sel {
  flex: 1 1 0;
  min-width: 0;
  text-overflow: ellipsis;
}

.chain-sel {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  max-width: 100%;
}

.chain-sep {
  font-size: 14px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* 点播第二行:每课遍数 · 循环播放 · 开始连播(播放中最后一个按钮变「停止播放」)
   窄屏(≤360px)要塞得下这一行,间隙和按钮内边距都收着给,别再放大 */
.chain-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chain-times { flex-shrink: 0; }

/* 把循环开关顶到左边、按钮推到最右,中间留白 */
.chain-actions .chain-loop { margin-right: auto; }

.chain-loop {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
}

.chain-loop input {
  accent-color: var(--vermilion);
  width: 16px;
  height: 16px;
}

.chain-start {
  border: none;
  background: var(--vermilion);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.chain-start:active { opacity: 0.85; }

/* ============ 连播悬浮条（全站底部，切页不断播） ============ */
.chain-bar {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(140%);
  width: min(440px, calc(100% - 24px));
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(42, 35, 24, 0.35);
  transition: transform 0.25s ease;
  z-index: 900;
}

.chain-bar.on { transform: translateX(-50%) translateY(0); }

body.chain-active .app { padding-bottom: 84px; }

.chain-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--vermilion);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.chain-meta { flex: 1; min-width: 0; }

.chain-now {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-sub {
  font-family: var(--sans);
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.chain-go {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--paper);
  border: 1px solid rgba(247, 241, 224, 0.4);
  border-radius: 14px;
  padding: 5px 10px;
  flex-shrink: 0;
}

.chain-close {
  border: none;
  background: transparent;
  color: var(--paper);
  opacity: 0.65;
  font-size: 16px;
  padding: 4px 6px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============ 首页播放卡（只留点播；播放中才显示暂停/停止行） ============ */
/* 删掉首页大标题后，让副标题紧跟小字题签 */
.kicker + .hero-sub { margin: 4px 0 0; }

.play-card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 22px;
}

/* 播放状态行：待播时整行隐藏，播放中才出现 */
.play-now {
  display: none;
  align-items: center;
  gap: 10px;
}

.play-card.playing .play-now { display: flex; }

.play-main {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--vermilion);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

.play-main:active { opacity: 0.85; }

.play-nowinfo { flex: 1; min-width: 0; }

.play-nowtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-nowsub {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-goto {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--vermilion);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 5px 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* 停止按钮：只在播放中出现 */
.play-stop {
  display: none;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1;
  padding: 4px 4px 4px 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.play-card.playing .play-stop { display: block; }

.play-setup {
  transition: opacity 0.2s ease;
}

/* 播放中:范围 / 遍数 / 循环 变灰且不可点,避免连播时误改；
   ⚠️ 不能整块 .play-setup 设 pointer-events:none —— 那个按钮此刻是「停止播放」,必须点得动
   (2026-09-30 新哥要求按钮就地变停止播放,改这里要先想清楚) */
.play-card.playing .chain-sel,
.play-card.playing .chain-loop {
  opacity: 0.45;
  pointer-events: none;
}

.play-card.playing .play-nowtitle { color: var(--vermilion); }
