:root {
  --bg: #FAF8F2;
  --card: #FFFFFF;
  --ink: #2C2C2A;
  --ink-2: #5F5E5A;
  --ink-3: #888780;
  --brand: #5C3B6E;
  --brand-2: #7C5290;
  --brand-soft: #F3ECF5;
  --green: #3B6D11;
  --green-soft: #EAF3DE;
  --amber: #854F0B;
  --amber-soft: #FAEEDA;
  --red: #A32D2D;
  --red-soft: #FCEBEB;
  --line: #E4E0D6;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

button {
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: var(--brand-soft); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-2); }
button.on { background: var(--amber-soft); border-color: #BA7517; color: var(--amber); }
button.danger { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.app { max-width: 1060px; margin: 0 auto; padding: 18px 20px 60px; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.topbar .logo { font-size: 19px; font-weight: 700; color: var(--brand); }
.topbar .tag {
  font-size: 12px; color: var(--ink-3);
  background: var(--green-soft); border: 1px solid #C0DD97;
  padding: 2px 9px; border-radius: 999px;
}
.topbar .spacer { flex: 1; }
.topbar a { color: var(--brand); text-decoration: none; font-size: 13px; }
.topbar a:hover { text-decoration: underline; }

/* 圆形图标按钮（设置 ⚙️ / 目录 📑） */
.icon-btn {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 19px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform 0.1s, box-shadow var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--accent-soft); box-shadow: var(--shadow-1); }
.icon-btn:active { transform: scale(0.94); }

.shelf { display: flex; flex-wrap: wrap; gap: 14px; }
.shelf-item {
  width: 232px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); padding: 16px; cursor: pointer; transition: box-shadow 0.15s;
}
.shelf-item:hover { box-shadow: 0 2px 10px rgba(92,59,110,0.14); }
.shelf-item .b-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.shelf-item .b-meta { font-size: 12.5px; color: var(--ink-3); }
.shelf-item .b-pages { margin-top: 10px; font-size: 12.5px; color: var(--green); }

.reader { display: none; }
.reader.show { display: block; }

.crumb {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13.5px; color: var(--ink-3); margin-bottom: 12px;
}
.crumb-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb b { color: var(--ink); font-weight: 500; }
.crumb-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.crumb .backlink { color: var(--brand); cursor: pointer; }
.crumb .backlink:hover { text-decoration: underline; }

.stage {
  display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap;
}
/* 左列：页面图 + 紧贴其下的翻页条（翻页不必再滚到整页底部） */
.page-col {
  flex: 0 1 620px; min-width: 320px;
  display: flex; flex-direction: column; gap: 10px;
}
.page-wrap {
  position: relative;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: var(--card);
  user-select: none;
}
.page-wrap img { display: block; width: 100%; height: auto; }

/* 播报中的贴边胶囊：整页连读时「播放控制」收起，只留这一条贴在课本图右下角。
   z-index 需高于热区/互动辉光（5~8），否则会被它们盖住点不到。
   注意：它是 .page-wrap 内的绝对定位元素，仍受其 overflow:hidden 裁剪（贴边即为此设计）。 */
.play-pill {
  position: absolute; right: 8px; bottom: 8px; z-index: 20;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  cursor: default;
}
.play-pill[hidden] { display: none; }
.play-pill .pp-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); flex: none;
  animation: pp-blink 1.1s ease-in-out infinite;
}
@keyframes pp-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.play-pill .pp-txt { font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.play-pill .pp-btn { padding: 5px 10px; font-size: 12.5px; line-height: 1.2; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .play-pill .pp-dot { animation: none; } }

/* ============================================================
   滚屏字幕（2026-09-12）
   默认贴在课本图底部（.page-wrap 内绝对定位，z-index 9 > 互动层 6、
   < 媒体弹层 300）；按住左侧握把拖出后变 .floating 固定定位浮窗。
   层级：页面内容 < 字幕浮窗(240) < 抽屉遮罩(250) < 抽屉(260)
        < 媒体弹层(300) < 互动翻译卡(320)
   配色全部取自 tokens.css，不硬编码任何色值。
   ============================================================ */
/* 固定贴视口底部居中，而**不是**绝对定位在课本图底部：
   课本图常常比视口高（手机竖屏尤其明显），贴图片底部的字幕会整条沉到屏幕外，
   用户「勾了开关也看不见」。挂 <body> 下用 fixed 可同时躲开 .page-wrap 的 overflow:hidden。 */
/* 全屏 / 浮条共享的字幕自定义变量（默认值；运行时由 JS 写入 body 覆盖） */
:root {
  /* 基准字号：桌面默认 52px；窄屏（@media max-width:760px）改 34px；JS 在 body 上覆盖为用户值 */
  --lf-size: 52px;
  --lf-color: #3AA655;
  --lf-opacity: .55;
  --lf-stroke: 1.5px;
}

/* ⚠️ --lf-fs 必须声明在 body，而不是 :root（历史 Bug 根因）：
   自定义属性在「声明它的那个元素」上完成 var() 替换，替换后的计算值再向下继承。
   若把 --lf-fs: min(var(--lf-size),13vw) 放在 :root，它会用 :root 的 --lf-size（52px/34px）
   求值并被整棵子树继承；此后 JS 再往 document.body 覆盖 --lf-size，--lf-fs 也不会重算，
   于是 A+/A- 与设置滑杆改字号「看起来没反应」。
   放到 body 后，body 上的内联 --lf-size 才会参与 --lf-fs 的计算，浮条与全屏字幕同步生效。 */
body {
  --lf-fs: min(var(--lf-size, 52px), 13vw);
}

/* 滚屏字幕（方案 A：酷狗风格横向浮条，默认形态）
   固定在视口底部居中；可拖拽成浮窗；锁定后条体穿透点击不挡底层。 */
.lyric-bar {
  position: fixed; left: 50%; bottom: 12px; z-index: 240;
  transform: translateX(-50%);
  width: 92%;
  width: min(92%, 1000px);
  max-width: calc(100vw - 20px);
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px;
  /* 右侧留 14px 给宽度调整手柄 */
  padding: 8px 10px;
  padding-right: 14px;
  background: rgba(22, 26, 24, clamp(0.7, var(--lf-opacity, .55), 0.96));
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  pointer-events: auto; color: #fff;
  /* 淡入淡出：用 .on 切 opacity，避免 hidden 硬切导致闪一下 */
  opacity: 0;
  transition: opacity var(--dur, .3s) var(--ease, ease);
  font-size: 14px;
}
.lyric-bar[hidden] { display: none; }
/* 未显示（含淡出中）时不吃掉课本图上的点击 */
.lyric-bar:not(.on) { pointer-events: none; }
.lyric-bar.on { opacity: 1; }

/* 锁定后：条体穿透点击，只留工具栏可点（不挡底层点读 / 翻页） */
.lyric-bar.locked .lyric-grip,
.lyric-bar.locked .lyric-body { pointer-events: none; }
.lyric-bar.locked .lyric-tools { pointer-events: auto; }

.lyric-grip {
  flex: none; align-self: center;
  width: 14px;
  cursor: move; touch-action: none;
  color: rgba(255,255,255,.5); line-height: 1;
  user-select: none; -webkit-user-select: none;
  /* 用三条短横表示可拖动握把（避免 emoji） */
  background:
    repeating-linear-gradient(rgba(255,255,255,.55) 0 2px, transparent 2px 5px) center / 3px 14px no-repeat;
}
.lyric-body {
  flex: 1 1 auto; min-width: 0;
  /* 与左侧握把挤在同一行，22px = grip 14 + gap 8；工具栏另起一行 */
  flex-basis: calc(100% - 22px);
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}
.lyric-en-wrap { position: relative; max-width: 100%; line-height: 1.2; }
.lyric-en-base, .lyric-en-fill {
  margin: 0;
  font-size: var(--lf-fs, 22px);
  font-weight: 800; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  -webkit-text-stroke: var(--lf-stroke, 1.5px) rgba(0,0,0,.35);
}
.lyric-en-base { color: rgba(255,255,255,.34); }
.lyric-en-fill {
  position: absolute; left: 0; top: 0; width: 100%;
  color: var(--lf-color, #3AA655);
  clip-path: inset(0 100% 0 0);   /* 进度高亮：JS 用 clip-path 从左到右揭示 */
  pointer-events: none;
}
.lyric-sub { display: flex; gap: 10px; min-width: 0; align-items: baseline; }
.lyric-zh {
  flex: 1 1 auto; min-width: 0;
  font-size: calc(var(--lf-fs, 22px) * .5); font-weight: 600;
  color: rgba(255,255,255,.9);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lyric-zh:empty { display: none; }
.lyric-next {
  flex: 0 1 auto; min-width: 0;
  font-size: calc(var(--lf-fs, 22px) * .42);
  color: rgba(255,255,255,.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lyric-next:empty { display: none; }

/* 工具栏：桌面端另起一行靠右，不跟字幕抢宽度 */
.lyric-tools {
  flex-basis: 100%;
  margin-left: 22px; /* 与 body 左对齐（grip 14 + gap 8） */
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
}
.lt-btn {
  width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1; font-weight: 600;
  color: #fff; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px;
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.lt-btn:hover { background: rgba(255,255,255,.24); }
.lt-btn.active { background: var(--lf-color, #3AA655); color: #06210f; border-color: transparent; }
.lt-color .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--lf-color, #3AA655); box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.lyric-dock {
  display: none; flex: none;
  width: 26px; height: 26px; padding: 0;
  align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  color: #fff; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px; cursor: pointer;
}
.lyric-bar.floating .lyric-dock { display: inline-flex; }
.lyric-bar.floating .lyric-dock:hover { background: rgba(255,255,255,.24); }

/* 宽度调整手柄（贴 bar 右边缘，仅桌面 dock 态显示） */
.lyric-resize {
  position: absolute;
  right: 2px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 44px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .22);
  cursor: ew-resize; touch-action: none;
  user-select: none; -webkit-user-select: none;
  z-index: 4;
}
.lyric-resize:hover { background: rgba(255, 255, 255, .38); }
.lyric-resize:active { background: var(--lf-color, #3AA655); }
.lyric-bar.floating .lyric-resize { display: none; }

/* 设置面板：条体常驻视口底部，面板向上展开（避免掉出屏幕下沿） */
.lyric-set {
  position: absolute; right: 10px; bottom: calc(100% + 8px);
  width: 250px; max-height: 60vh; overflow: auto;
  background: rgba(20, 24, 22, .96);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  color: #fff; font-size: 13px; z-index: 3;
}
.lyric-set[hidden] { display: none; }
.ls-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.ls-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ls-row span { color: rgba(255,255,255,.7); font-weight: 600; }
.ls-row input[type="range"] { width: 100%; }
.ls-row input[type="color"] { width: 100%; height: 30px; border: none; background: none; padding: 0; cursor: pointer; }
.ls-check { flex-direction: row; align-items: center; gap: 8px; }
.ls-check input { width: 16px; height: 16px; }
.ls-reset {
  width: 100%; height: 32px; margin-top: 2px;
  color: #fff; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.24); border-radius: 8px; cursor: pointer; font-size: 13px;
}
.ls-reset:active { background: rgba(255,255,255,.24); }

/* 字幕贴底显示时，把播报胶囊 / 浮动翻页条抬到字幕上方（避免叠住） */
body.lyric-docked .play-pill { bottom: 140px; }
body.lyric-docked .page-nav-float { bottom: 140px; }

/* 浮窗态：拖出后固定定位，可停在屏幕任意处（left/top 由 JS 写入并夹在视口内） */
.lyric-bar.floating {
  position: fixed; z-index: 240;
  left: 50%; top: 12px;
  right: auto; bottom: auto;
  transform: none;              /* 浮窗由 JS 写 left/top，不能再做居中平移 */
  /* 兜底在前：Chrome 79 以下不认 min()，整条声明会被丢弃导致宽度塌成内容宽 */
  width: 420px;
  width: min(420px, calc(100vw - 24px));
  /* 老内核 + 窄屏（<420px）走 420px 兜底时会横向溢出，补一道硬上限 */
  max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-2);
}

@media (max-width: 760px) {
  /* 手机默认字号小一号，避免长句被一截就剩几个字母 */
  :root { --lf-size: 34px; }

  .lyric-bar {
    width: calc(100vw - 16px);
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
  }
  /* 握把在手机上变成顶部一整条拖动条，省出横向空间 */
  .lyric-bar .lyric-grip {
    flex-basis: 100%;
    width: auto;
    height: 12px;
    background-size: 18px 3px;
  }
  /* 字幕主体独占一整行 */
  .lyric-bar .lyric-body { flex-basis: 100%; min-width: 0; }
  /* 长句允许折到两行，不再硬截成省略号 */
  .lyric-bar .lyric-en-base,
  .lyric-bar .lyric-en-fill {
    white-space: normal;
    overflow: hidden;
    max-height: 2.8em;
  }
  .lyric-bar .lyric-zh {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.8em;
  }
  .lyric-sub .lyric-next { display: none; }   /* 小屏只留中文，预告不挤 */
  /* 工具栏另起一行靠右，不再跟字幕抢宽度 */
  .lyric-bar .lyric-tools {
    flex-basis: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
  /* 手机上不需要宽度调整手柄 */
  .lyric-bar .lyric-resize { display: none; }
  /* 设置面板宽度跟 bar 走，避免 250px 在窄屏溢出 */
  .lyric-set {
    right: 8px;
    width: calc(100% - 16px);
    max-height: 55vh;
  }
  /* 字幕贴底且高度变高后，把播报胶囊/浮动翻页条再抬高，避免叠住 */
  body.lyric-docked .play-pill { bottom: 140px; }
  body.lyric-docked .page-nav-float { bottom: 140px; }

  /* 手机：退出按钮再放大（触控目标 48px），提示字号收小 */
  .lf-exit { min-height: 48px; padding: 0 20px; font-size: 16px; }
  .lf-hint { font-size: 12px; }
}

/* ============================================================
   全屏沉浸字幕（方案 A）：酷狗风格巨幅歌词 + 进度高亮 + 中文翻译 + 下一句预告。
   层级最高（z-index 比媒体弹层 300 还高），盖住整页、挡住课本图，做「显眼包」效果。
   用户可在浮层内自定义：字号 / 高亮色 / 背景透明度 / 描边（设置写入 --lf-* 变量实时生效）。
   ============================================================ */
.lyric-fullscreen { position: fixed; inset: 0; z-index: 360; display: none; }
.lyric-fullscreen:not([hidden]) { display: block; }
/* 进入全屏后，底部小字幕条让位（避免两层叠显） */
body.lyric-full-on .lyric-bar { display: none !important; }

.lf-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 12, 10, var(--lf-opacity, .55));
}
.lf-content {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  padding: 6vh 5vw;
  text-align: center;
  /* 自定义项来自 body（JS 把 --lf-* 写到 document.body，浮条与全屏共用），
     这里只补全屏专属的描边色；--lf-fs 由 styles.css 的 body 规则声明（min(size,13vw)）并向下继承 */
  --lf-stroke-color: rgba(0, 0, 0, .45);
  font-size: var(--lf-fs);
}

.lf-line-wrap { position: relative; max-width: 92vw; }
.lf-base, .lf-fill {
  margin: 0;
  font-size: var(--lf-fs);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: .2px;
  word-break: break-word;
  -webkit-text-stroke: var(--lf-stroke) var(--lf-stroke-color);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.lf-base { color: rgba(255, 255, 255, .30); position: relative; }
.lf-fill {
  position: absolute; left: 0; top: 0; width: 100%;
  color: var(--lf-color);
  /* 进度高亮：JS 用 clip-path 从左到右揭示已播放部分 */
  clip-path: inset(0 100% 0 0);
  pointer-events: none;
}
.lf-zh {
  font-size: calc(var(--lf-fs) * .42);
  font-weight: 600;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .4);
  max-width: 92vw; line-height: 1.35;
}
.lf-zh:empty { display: none; }
.lf-next {
  font-size: calc(var(--lf-fs) * .34);
  color: rgba(255, 255, 255, .5);
  max-width: 80vw; line-height: 1.3;
}
.lf-next:empty { display: none; }

/* 全屏顶部工具层：只做定位，无背景，让下方「点空白退出」仍可命中 */
.lf-topbar {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; justify-content: flex-end;
  padding: max(10px, env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 10px calc(12px + env(safe-area-inset-left));
  z-index: 6;
  pointer-events: none;            /* 仅按钮可点，其余穿透给背景层（所以顶栏整条也是"点空白退出"的热区） */
}
/* 退出按钮：品牌强调色实底 + 近黑粗字 + 白描边。
   不再用半透明白（旧版 14% 白压在课本图上几乎看不见）。
   近黑 #000 字在 4 套主题的 --accent 上对比度：candy 7.15 / ocean 7.67 / forest 6.77 / star 4.83，均 ≥4.5:1；
   2px 白描边让胶囊在深/浅任意底图上都有清晰轮廓。 */
.lf-exit {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 0 18px;
  font-size: 16px; font-weight: 800; line-height: 1;
  color: #000; background: var(--accent);
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .38);
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.lf-exit-ic { font-size: 17px; font-weight: 800; }
.lf-exit:active { opacity: .88; }
/* 进入全屏时的操作提示：短暂出现后淡出，穿透点击 */
.lf-hint {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 5;
  padding: 6px 12px;
  font-size: 12.5px; letter-spacing: .3px;
  color: rgba(255, 255, 255, .78);
  background: rgba(0, 0, 0, .40);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0; transition: opacity .35s ease;
}
.lf-hint.on { opacity: 1; }

/* 设置面板 */
.lf-set-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.lf-set-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.lf-set-row span { color: rgba(255, 255, 255, .7); font-weight: 600; }
.lf-set-row input[type="range"] { width: 100%; }
.lf-set-row input[type="color"] { width: 100%; height: 30px; border: none; background: none; cursor: pointer; padding: 0; }
.lf-set-reset {
  width: 100%; height: 32px; margin-top: 2px;
  color: #fff; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.lf-set-reset:active { background: rgba(255, 255, 255, .24); }

.hotspot {
  position: absolute; border: 2px solid transparent; border-radius: 6px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.hotspot:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.hotspot.playing {
  background: color-mix(in srgb, var(--ok) 16%, transparent); border-color: var(--ok);
  animation: pulse 1.1s ease-in-out infinite;
}
.hotspot.reading .zh-pop {
  display: block;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 30%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 8%, transparent); }
}

.zh-pop {
  display: none; position: absolute; left: 50%; top: -34px; transform: translateX(-50%);
  background: #2C2C2A; color: #fff; font-size: 13px; padding: 3px 12px;
  border-radius: 999px; white-space: nowrap; z-index: 5; pointer-events: none;
}
.zh-pop::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: #2C2C2A;
}

.side { flex: 1 1 300px; min-width: 280px; display: flex; flex-direction: column; gap: 14px; }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.panel h3 { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }

/* ============================================================
   「本页句子」弹出为可移动浮窗（2026-09-12）
   播报时本页内容很长、要频繁滚动；弹出后可拖到课本旁边直观对照。
   常态仍在右侧栏（见 .panel）；加 .floating 后变固定定位 + 头部可拖。
   ============================================================ */
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px;
}
.panel-head h3 { margin-bottom: 0; }
.panel-float-btn {
  flex: none; padding: 4px 10px; font-size: 12.5px; line-height: 1.4;
  border-radius: 999px; color: var(--accent);
  background: var(--surface-2); border: 1px solid var(--line);
}
.panel-float-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.panel-float-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.panel.floating {
  /* 层级：页面内容 < 本浮窗(240) < 抽屉遮罩(250) < 抽屉(260) < 媒体弹层(300) < 互动翻译卡(320) */
  position: fixed; z-index: 240;
  width: 420px;                                   /* 老内核（Chrome 79 以下不认 min()）兜底 */
  width: min(420px, calc(100vw - 24px));
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 96px);
  min-width: 260px; min-height: 150px;
  padding: 0;
  overflow: auto;          /* 整块一个滚动条，长列表不再各自截断 */
  resize: both;            /* 桌面可拖右下角改大小（触屏内核忽略，无副作用） */
  border-color: var(--accent);
  box-shadow: var(--shadow-3);
}
/* 头部兼作拖拽条：粘顶常驻，按住可把浮窗拖到屏幕任意位置 */
.panel.floating .panel-head {
  position: sticky; top: 0; z-index: 2;
  margin: 0; padding: 10px 14px;
  cursor: move; user-select: none;
  touch-action: none;      /* 触屏拖拽时不要触发浮窗内滚动 */
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--line);
}
/* 浮窗内列表不再各自限高/滚动，交给整块面板滚动 */
.panel.floating .s-list { max-height: none; overflow: visible; }
.panel.floating .s-list li { padding: 8px 14px; }
.panel.floating .i-sub { padding: 0 14px; }

/* 口音分段开关（澳/美/英）—— 现在位于「播放控制 → 更多」里 */
.accent-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.accent-label { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.accent-hint { color: var(--ink-3); font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: none; background: var(--card); color: var(--ink); padding: 5px 13px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--brand); color: #fff; font-weight: 600; }
.seg button:hover:not(.on) { background: var(--brand-soft); }

/* ============================================================
   播放控制（移动端精简版）：常态一行迷你条，低频项收进「更多」
   旧版是「标题 + 4 个按钮折 2 行 + 口音行 + 语速行 + 提示 + 复选」
   = 281px（390px 宽手机上），把「本页句子」整体推到屏幕外。
   现在：迷你条 44px；播报中收成课本图右下的贴片（见 .play-pill）。
   ============================================================ */
.player-panel { padding: 10px 12px; }
/* 播报中：整块收起，把空间让给「本页句子」；播放状态改由图上的贴边胶囊承担 */
.player-panel.collapsed { display: none; }

.mini-bar { display: flex; align-items: center; gap: 7px; }
.mini-bar .mb-spacer { flex: 1; }
.mini-bar .mb-label { font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.mb-btn { padding: 8px 13px; font-size: 14px; line-height: 1.2; }
/* 「连读 / 全书」播报中互斥：只有一个显示，迷你条宽度恒定（窄屏不挤爆） */
.mb-btn[hidden] { display: none; }
.mb-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.mb-primary:hover { background: var(--brand-2); }
/* 连读进行中：主按钮转为「停止」语义色 */
.mb-primary.on { background: var(--red); border-color: var(--red); color: #fff; }
.mb-more { padding: 8px 11px; font-size: 13.5px; }
.mb-more.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }

/* 语速胶囊：点按切档（1x→1.25x→1.5x→0.5x→0.75x→1x），长按弹滑杆微调 */
.mb-chip {
  min-width: 56px; padding: 8px 12px;
  font-size: 14px; font-weight: 600; color: var(--brand);
  border-radius: 999px;
}
.mb-chip.on { background: var(--brand-soft); border-color: var(--brand); }

/* 语速滑杆：窄屏由「长按胶囊」弹出；宽屏常驻（见文件末尾媒体查询） */
.speed-pop {
  display: none;
  align-items: center; gap: 9px;
  margin-top: 9px; padding: 7px 10px;
  background: var(--surface-2); border-radius: var(--radius-s);
}
.speed-pop.open { display: flex; }
.speed-pop span { font-size: 12.5px; color: var(--ink-3); }
.speed-pop .sp-label { font-size: 13px; color: var(--ink-2); }
.speed-pop .sp-val { min-width: 46px; text-align: center; font-size: 14px; color: var(--brand); font-weight: 600; }
.speed-pop input[type=range] { flex: 1; min-width: 0; accent-color: var(--brand); }

/* 「更多」展开区 */
.more-panel { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.more-panel.open { display: block; }
.more-panel .accent-row { margin-top: 0; }
.more-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.more-check {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; margin-top: 10px; cursor: pointer; color: var(--ink-2);
}

.s-list { list-style: none; max-height: 300px; overflow-y: auto; }
.s-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 8px; border-radius: 10px; cursor: pointer;
}
.s-list li:hover { background: var(--brand-soft); }
.s-list li.now { background: var(--green-soft); }
.s-list .n { font-size: 12px; color: var(--ink-3); min-width: 20px; padding-top: 3px; }
.s-list .en { font-size: 14.5px; }
.s-list .zh { font-size: 12.5px; color: var(--ink-3); }
.s-list .zh.hidden-zh { color: transparent; user-select: none; }

.repeat-row { display: flex; align-items: center; gap: 10px; }
.repeat-row input[type=number] {
  width: 64px; font-size: 14px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px;
}

.gap-row { display: flex; align-items: center; gap: 10px; }
.gap-row input[type=number] {
  width: 64px; font-size: 14px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px;
}

/* 翻页条：紧贴页面图下方（旧 .footerbar 在整页最底，侧栏一长就要滚到底才能翻页） */
.page-nav-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.page-nav-bar button { padding: 7px 14px; white-space: nowrap; flex: none; }
.page-nav-bar .page-dots { flex: 1; justify-content: center; max-width: none; }
.page-hint { text-align: center; }

/* 浮动翻页条：主翻页条滚出视野时滑入，滚动中也能翻页。
   z-index 必须低于媒体弹层(300)与抽屉(260)，否则会压在它们上面。 */
.page-nav-float {
  position: fixed; left: 50%; bottom: 14px; z-index: 90;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.page-nav-float.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.page-nav-float button { padding: 6px 12px; font-size: 14px; line-height: 1.2; }
.page-nav-float .pnf-idx {
  min-width: 60px; text-align: center;
  font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) { .page-nav-float { transition: none; } }
.page-dots { display: flex; gap: 6px; align-items: center; max-width: 46vw; }
.page-dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--line); cursor: pointer; flex: none;
  transition: transform .15s;
}
.page-dots span.cur { background: var(--brand); transform: scale(1.27); }
/* 页数多时的省略号（…）：不是可点的页点 */
.page-dots span.ell {
  width: auto; height: auto; border-radius: 0; background: none; cursor: default;
  font-size: 12px; line-height: 1; color: var(--ink-3); padding: 0 1px;
}

.hint { font-size: 12.5px; color: var(--ink-3); }

.follow-panel .follow-btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.follow-state { font-size: 13px; color: var(--ink-2); min-height: 22px; }
.follow-state.err { color: var(--red); }

.record-pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--red); margin-right: 6px; animation: pulse 0.9s infinite; }

.media-row { display: flex; align-items: center; gap: 10px; }
.media-row audio { flex: 1; height: 34px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #2C2C2A; color: #fff; font-size: 13.5px;
  padding: 8px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s; z-index: 50;
}
.toast.show { opacity: 0.94; }

/* ============================================================
   句子气泡（点读时展开）
   ============================================================ */
.sentence-bubble {
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius-l);
  padding: 14px 16px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  min-width: 260px;
  max-width: 380px;
  position: fixed;
  z-index: 200;
  animation: sb-in .28s var(--ease, ease-out);
  touch-action: none;   /* 允许 Pointer Events 拖拽（手机/微信同样可拖） */
  cursor: move;         /* 提示可拖动；按钮区仍是 pointer */
}
.sentence-bubble button { cursor: pointer; }
.sentence-bubble.dragging {
  opacity: .96;
  box-shadow: 0 14px 40px rgba(0,0,0,0.28);
  transition: none;
}
.sentence-bubble.dragging::before,
.sentence-bubble.dragging::after { display: none; } /* 拖动时隐藏指向箭头 */
@keyframes sb-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.sentence-bubble.flip::after {
  bottom: auto; top: -10px;
  border-top-color: transparent;
  border-bottom-color: var(--accent);
}
.sentence-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--accent);
}
.sb-en {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
  line-height: 1.4;
}
.sb-zh {
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.4;
}
.sb-zh.hidden-zh { color: transparent; user-select: none; }
/* 中英/仅英/仅中 三档切换 */
.sb-seg {
  display: inline-flex;
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.sb-seg button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink3);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.sb-seg button.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
/* 工具行 */
.sb-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.sb-tools .grow { flex: 1; }
.sb-btn {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  transition: transform .12s, background .15s, border-color .15s;
  min-height: 30px;
}
.sb-btn:hover { background: var(--accent-soft); }
.sb-btn:active { transform: scale(.93); }
.sb-btn.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.sb-btn.nav { color: var(--ink2); }
.sb-btn.nav:disabled { opacity: .35; cursor: default; }
.sb-btn.close { border-color: transparent; color: var(--ink3); }
/* 播放中指示 */
.sb-playing-tip {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}
.sentence-bubble.playing .sb-playing-tip { display: flex; }
/* 中文跟读开关选中态 */
.sb-btn.toggle.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sentence-bubble.reading-zh { border-color: var(--accent-2); }
.sentence-bubble.reading-zh.arrow-zh::after { border-top-color: var(--accent-2); }
.sb-playing-tip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: sb-dot 1s infinite;
}
@keyframes sb-dot { 50% { opacity: .25; } }

/* ============================================================
   单词 chip（句子列表中可点击）
   ============================================================ */
.wordable .word-chip {
  display: inline-block;
  padding: 1px 4px;
  margin: 1px 1px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  user-select: none;
}
.wordable .word-chip:hover {
  background: var(--brand);
  color: #fff;
  transform: scale(1.04);
}
.wordable .word-chip:active { transform: scale(0.96); }

/* ============================================================
   单词弹窗
   ============================================================ */
.word-popup {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 16px 18px;
  min-width: 200px;
  max-width: 300px;
}
.wp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.wp-word {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand);
}
.wp-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--ink3);
  padding: 2px 6px;
  border-radius: 6px;
}
.wp-close:hover { background: var(--line); }
.wp-phonetic {
  font-size: 13px;
  color: var(--ink2);
  margin-bottom: 8px;
}
.wp-phonetic-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.wp-phonetic-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink2);
}
.wp-phonetic-item .label {
  font-weight: 600;
  color: var(--brand2);
  font-size: 11px;
}
.wp-phonetic-item .ipa {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}
.wp-phonetic-item .spk {
  cursor: pointer;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
  line-height: 1;
}
.wp-phonetic-item .spk:hover {
  background: var(--brand-soft);
}
.wp-meaning {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 12px;
}
.wp-noentry { color: var(--ink3); font-style: italic; }
.wp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wp-actions button {
  padding: 6px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.wp-actions button:hover { background: var(--brand-soft); }
.wp-fav.on { background: var(--amber-soft); border-color: #BA7517; color: var(--amber); }

/* ============================================================
   互动环节（听歌 / 认东西）—— 方案 C：图上辉光 + 页角互动球
   ============================================================ */
#interactives {
  position: absolute; inset: 0; z-index: 6;
  pointer-events: none;   /* 让辉光下方句子热区仍可点 */
}
#interactives .inter-halo, #interactives .inter-orbit { pointer-events: auto; }

/* —— 图上辉光：声浪渐变 + 涟漪光环，吸引小孩去点 —— */
.inter-halo {
  position: absolute;
  width: 52px; height: 52px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 38%, var(--halo-soft), var(--halo));
  box-shadow: 0 0 0 0 var(--halo-glow), 0 4px 14px var(--halo-glow);
  cursor: pointer;
  animation: halo-idle 2.4s ease-in-out infinite;
}
.inter-halo.video {
  background: radial-gradient(circle at 50% 38%, var(--halo-soft), var(--accent-2));
  box-shadow: 0 0 0 0 var(--halo-glow-2), 0 4px 14px var(--halo-glow-2);
}
.inter-halo::before, .inter-halo::after {
  content: ""; position: absolute; inset: -7px;
  border-radius: 50%; border: 2px solid var(--halo-glow);
  animation: halo-ripple 2.4s ease-out infinite;
}
.inter-halo::after { animation-delay: 1.2s; }
.inter-halo.video::before, .inter-halo.video::after { border-color: var(--halo-glow-2); }
.inter-halo.intro { animation: halo-pop 0.6s cubic-bezier(.2,1.5,.45,1) both; }
.inter-halo.tap { transform: translate(-50%, -50%) scale(0.9); }
.inter-halo.playing { animation: halo-pulse 0.9s ease-in-out infinite; }

@keyframes halo-idle {
  0%, 100% { box-shadow: 0 0 0 0 transparent, 0 4px 14px var(--halo-glow); }
  50% { box-shadow: 0 0 0 6px var(--halo-glow), 0 4px 14px var(--halo-glow); }
}
@keyframes halo-ripple {
  0% { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.7); opacity: 0; }
}
@keyframes halo-pop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes halo-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--halo-glow), 0 4px 14px var(--halo-glow); }
  50% { box-shadow: 0 0 0 12px transparent, 0 4px 14px var(--halo-glow); }
}

/* —— 辉光与互动球的连线（卫星环绕的视觉关联）—— */
.inter-links { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.inter-link {
  stroke: var(--halo-glow); stroke-width: 2; stroke-dasharray: 3 5; opacity: .6;
  animation: link-draw .5s ease-out both;
}
.inter-link.video { stroke: var(--halo-glow-2); }
@keyframes link-draw { from { opacity: 0; } to { opacity: .6; } }

/* —— 环绕辉光的互动球（取代原页角固定球，随机分布在辉光四周、避开句子热区）—— */
.inter-orbit {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px 7px 10px;
  border: 1.5px solid var(--halo-glow);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,.55), var(--halo));
  color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 14px var(--halo-glow);
  cursor: pointer; pointer-events: auto; z-index: 8;
  white-space: nowrap;
  animation: orbit-pop .55s cubic-bezier(.2,1.5,.45,1) both, orbit-float 3.2s ease-in-out .55s infinite;
}
.inter-orbit.video {
  border-color: var(--halo-glow-2);
  background: linear-gradient(135deg, rgba(255,255,255,.55), var(--accent-2));
  box-shadow: 0 4px 14px var(--halo-glow-2);
}
.inter-orbit .lbl { white-space: nowrap; }
.inter-orbit.tap { transform: translate(-50%, -50%) scale(.92); }
.inter-orbit.no-pop { animation: orbit-float 3.2s ease-in-out infinite; }
.inter-orbit.playing {
  animation: orbit-pop .55s cubic-bezier(.2,1.5,.45,1) both, orbit-pulse .9s ease-in-out infinite;
}
@keyframes orbit-pop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  70% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@keyframes orbit-float {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-4px); }
}
@keyframes orbit-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--halo-glow), 0 4px 14px var(--halo-glow); }
  50% { box-shadow: 0 0 0 9px transparent, 0 4px 14px var(--halo-glow); }
}

/* ============================================================
   互动呈现「方案 3：只留文字胶囊」（2026-09-12）
   旧版「图上辉光 + 环绕互动球 + 虚线连线」在播报时会盖住课本画面。
   现改为：每个互动区域上只贴一枚文字胶囊（听歌 / 认东西），
   无辉光、无连线、无待机动画；白底 + 细边 + 极轻投影，只为"提示这里可点"。
   开关在 reader.js 的 INTER_MODE（"label" 默认 / "halo" 回退旧版）。
   ============================================================ */
.inter-orbit.label,
.inter-btn.label {
  padding: 4px 11px 4px 8px;
  gap: 5px;
  font-size: 12.5px; font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  animation: none;              /* 待机零动效（最清爽）；点按 .tap 与播放 .playing 反馈保留 */
}
.inter-orbit.label.song, .inter-btn.label.song { border: 1px solid var(--halo-glow); }
.inter-orbit.label.video, .inter-btn.label.video { border: 1px solid var(--halo-glow-2); }
/* 胶囊内小图标改彩色：旧版是白条白三角，压在浅底上会看不见 */
.inter-orbit.label .eq, .inter-btn.label .eq { height: 13px; }
.inter-orbit.label .eq i, .inter-btn.label .eq i { background: var(--halo); }
.inter-orbit.label .play-tri, .inter-btn.label .play-tri {
  border-width: 5px 0 5px 9px;
  border-left-color: var(--accent-2);
}
/* 播放中的反馈：轻微放大 + 边框转实色 */
.inter-orbit.label.playing {
  border-color: var(--halo);
  animation: label-playing .9s ease-in-out infinite;
}
@keyframes label-playing {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.06); }
}
.inter-btn.label.playing { border-color: var(--halo); animation: btn-pulse .9s ease-in-out infinite; }

/* —— 互动翻译卡（点互动热区弹出：可拖动 · 播报 · 复制 · 查词）——
   设计方向：参考小程序「课本点读」排版，英文/中文整句展示，
   以「英 / 译」标签取代碎词药丸，阅读感更清爽。 */
.inter-trans {
  position: fixed; right: 14px; bottom: 84px; z-index: 320;
  width: min(380px, calc(100vw - 28px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-3);
  opacity: 0; pointer-events: none;
  transform: translateY(12px) scale(.96);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  overflow: hidden;
  font-family: var(--font-body);
}
.inter-trans.show { opacity: 1; pointer-events: auto; transform: none; }

/* 标题栏 */
.inter-trans .it-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; cursor: move;
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.inter-trans .it-icon {
  flex: none; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
  background: var(--surface); border-radius: 50%;
  box-shadow: var(--shadow-1);
}
.inter-trans .it-title { flex: 1; font-size: 14px; font-weight: 600; color: var(--ink); }
.inter-trans .it-close {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 15px; cursor: pointer;
  transition: background .15s, color .15s;
}
.inter-trans .it-close:hover { background: var(--accent-soft); color: var(--accent); }

/* 内容体 */
.inter-trans .it-body {
  padding: 14px 16px 6px;
  max-height: 46vh;
  overflow-y: auto;
}
.inter-trans .it-block {
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 12px;
}
.inter-trans .it-badge {
  flex: none;
  min-width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  border-radius: 6px;
  margin-top: 2px;
}
.inter-trans .it-badge-en { background: var(--accent); }
.inter-trans .it-badge-zh { background: var(--accent-2); color: #3A2A33; }
.inter-trans .it-en,
.inter-trans .it-zh {
  flex: 1;
  line-height: 1.7;
  word-break: break-word;
}
.inter-trans .it-en {
  font-size: 16px; font-weight: 500; color: var(--ink);
  letter-spacing: 0.01em;
  white-space: pre-wrap;   /* 保留用户输入的多行换行 */
}
.inter-trans .it-zh {
  font-size: 14.5px; color: var(--muted);
  margin-top: 1px;
  white-space: pre-wrap;   /* 保留用户输入的多行换行 */
}
.inter-trans .it-empty {
  color: var(--muted); font-size: 13px; font-style: italic;
}

/* 底部操作 */
.inter-trans .it-actions {
  display: flex; gap: 10px;
  padding: 10px 16px 14px;
}
.inter-trans .it-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); font-size: 13px; font-weight: 500;
  padding: 8px 6px; border-radius: 999px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.inter-trans .it-btn:hover {
  background: var(--accent-soft); border-color: var(--accent-soft);
}
.inter-trans .it-btn:active { transform: scale(.96); }
.inter-trans .it-btn .it-ico { font-size: 14px; }

/* 小屏适配 */
@media (max-width: 420px) {
  .inter-trans { right: 10px; bottom: 76px; width: calc(100vw - 20px); }
  .inter-trans .it-en { font-size: 15px; }
  .inter-trans .it-zh { font-size: 14px; }
}

/* —— 「本页句子」下方的互动内容小节 —— */
.i-sub {
  display: flex; align-items: center; gap: 6px;
  margin: 14px 0 4px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px; font-weight: 500; color: var(--muted);
}
.s-list .n.inter-n { background: var(--accent); font-size: 12px; }
.s-list .i-empty { color: var(--muted); font-size: 13px; }

/* 互动内容小节：参考弹窗风格，整句/换行展示，不再拆成单词药丸 */
.s-list li.inter-sent { align-items: flex-start; }
.s-list li.inter-sent:hover { background: var(--accent-soft); }
.inter-sent-body { flex: 1; min-width: 0; }
.inter-sent-en {
  font-size: 14.5px; line-height: 1.55;
  color: var(--ink); white-space: pre-wrap;
  word-break: break-word; margin-bottom: 3px;
}
.inter-sent-zh {
  font-size: 12.5px; line-height: 1.5;
  color: var(--ink-3); white-space: pre-wrap;
  word-break: break-word;
}
.inter-sent-zh.hidden-zh { color: transparent; user-select: none; }

/* —— 声浪条（song 图标）—— */
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
.eq i {
  display: block; width: 3px; height: 100%;
  background: #fff; border-radius: 2px; transform-origin: bottom;
  animation: eq-bounce 0.9s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 60%; }
.eq i:nth-child(2) { height: 100%; animation-delay: .18s; }
.eq i:nth-child(3) { height: 45%; animation-delay: .36s; }
.eq i:nth-child(4) { height: 80%; animation-delay: .10s; }
@keyframes eq-bounce {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}
/* —— 播放三角（video 图标）—— */
.play-tri {
  width: 0; height: 0; margin-left: 3px;
  border-style: solid; border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent #fff;
}

/* —— 页角常驻互动球（无坐标互动也会常驻可点）—— */
#inter-cluster {
  position: absolute; right: 10px; bottom: 10px; z-index: 7;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.inter-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px 8px 11px;
  border: 1px solid var(--halo-glow);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,255,255,.4), var(--halo));
  color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 14px var(--halo-glow);
  cursor: pointer;
  animation: btn-bob 2.6s ease-in-out infinite;
}
.inter-btn.video {
  border-color: var(--halo-glow-2);
  background: linear-gradient(135deg, rgba(255,255,255,.4), var(--accent-2));
  box-shadow: 0 4px 14px var(--halo-glow-2);
}
.inter-btn.tap { transform: scale(0.93); }
.inter-btn.playing { animation: btn-pulse 0.9s ease-in-out infinite; }
.inter-btn .lbl { white-space: nowrap; }
@keyframes btn-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--halo-glow), 0 4px 14px var(--halo-glow); }
  50% { box-shadow: 0 0 0 9px transparent, 0 4px 14px var(--halo-glow); }
}

/* —— 播报时互动层「让位」（2026-09-12）——
   连读 / 点句朗读时，互动辉光与互动球会盖住课本画面。播报一启动就淡出：
   · 桌面（≥761px）：淡到 12%，仍可点（想插播歌曲不必先停）；
   · 移动端（≤760px）：整层隐藏，小屏遮挡最明显，先让孩子看清课本。
   停止播报 / 翻页后自动恢复，不需要用户手动开关。
   状态类 body.broadcasting 由 reader.js 的 syncModeButton()（播放状态唯一汇聚点）切换。 */
#interactives, #inter-cluster { transition: opacity var(--dur, .3s) var(--ease, ease); }
body.broadcasting #interactives,
body.broadcasting #inter-cluster { opacity: 0.12; }
@media (max-width: 760px) {
  body.broadcasting #interactives,
  body.broadcasting #inter-cluster { opacity: 0; pointer-events: none; }
}
/* 方案 3（label 模式）：只有一枚很小的文字胶囊，播报时不必整层隐掉；
   压到 45% 既让课本更干净，又保证想插播时仍看得清、点得到。
   选择器权重(1,2,1)高于上面的规则，故各宽度下都生效。 */
body.broadcasting #interactives.label-mode,
body.broadcasting #inter-cluster.label-mode { opacity: .45; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) {
  #interactives, #inter-cluster { transition: none; }
  .inter-orbit.label.playing, .inter-btn.label.playing { animation: none; }
}

/* —— 互动媒体弹层（视频"认东西"全屏播放）—— */
.media-modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: center; justify-content: center;
  background: rgba(20,16,24,0.82); padding: 24px;
}
.media-modal.show { display: flex; }
.media-modal-inner {
  position: relative; max-width: 880px; width: 100%;
  background: #000; border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.media-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.5); color: #fff; font-size: 18px; cursor: pointer;
}
.media-close:hover { background: rgba(0,0,0,0.75); }
.media-cap {
  color: #fff; font-size: 13px; text-align: center;
  padding: 8px 14px; background: #000;
}

@media (max-width: 760px) {
  /* 手机/微信：依然锚定热区（不贴底），只做宽度与字号适配，箭头保留指向热区 */
  .sentence-bubble {
    max-width: calc(100vw - 24px);
    min-width: 240px;
    padding: 12px 14px 10px;
  }
  .sb-en { font-size: 16px; }
  .sb-zh { font-size: 13px; }
  .sb-btn { padding: 5px 10px; font-size: 11.5px; }
  .word-popup {
    left: 12px !important;
    right: 12px;
    max-width: none;
  }
}

/* ============================================================
   书架（参考「切换教材」小程序）：左侧分类 + 右侧网格
   旧 .shelf / .shelf-item 样式保留以兼容历史调用
   ============================================================ */
.shelf-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.shelf-head h2 { font-size: 18px; font-weight: 700; color: var(--ink); }
.shelf-search {
  flex: 0 1 240px; width: 100%;
  padding: 9px 16px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.shelf-search:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.shelf-layout { display: flex; gap: 18px; align-items: flex-start; }

.shelf-categories {
  flex: 0 0 152px; position: sticky; top: 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.cat-item {
  text-align: left; padding: 10px 14px;
  border-radius: var(--radius-m);
  border: 1px solid transparent;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.cat-item:hover { background: var(--surface-2); }
.cat-item.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.shelf-grid {
  flex: 1; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 16px;
}
.book-card {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2);
  border-color: var(--accent);
}
.b-cover {
  height: 92px; display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.b-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; }
.book-card .b-title { font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.book-card .b-meta { font-size: 12px; color: var(--muted); }
.book-card .b-pages { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--ok); font-weight: 600; }
.shelf-empty { color: var(--muted); font-size: 14px; padding: 24px 4px; }

/* ============================================================
   右侧滑出抽屉（设置 / 目录）
   ============================================================ */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(20, 16, 24, 0.42);
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.drawer-overlay.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 260;
  width: 360px; max-width: 88vw;
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.drawer-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--ink); }
.drawer-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink); font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur) var(--ease);
}
.drawer-close:hover { background: var(--accent-soft); }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-section { margin-bottom: 22px; }
.drawer-section:last-child { margin-bottom: 0; }
.drawer-label {
  margin: 0 0 10px; font-size: 13px; font-weight: 700;
  color: var(--muted); letter-spacing: .02em;
}

/* 主题色卡（卡片式：渐变预览 + 名称 + 选中态）
   注：色卡渐变是各主题的「预览」，属固定展示，故直接写各主题色值 */
.theme-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px; border-radius: var(--radius-m);
  border: 2px solid var(--line); background: var(--surface);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.theme-card .tc-swatch { width: 100%; height: 46px; border-radius: var(--radius-s); }
.theme-card .tc-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.theme-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: var(--shadow-1); }
.theme-card.candy .tc-swatch { background: linear-gradient(135deg, #FF5C8A, #FFB23E); }
.theme-card.ocean .tc-swatch { background: linear-gradient(135deg, #1FA2FF, #22D3C5); }
.theme-card.forest .tc-swatch { background: linear-gradient(135deg, #3AA655, #C9A227); }
.theme-card.star .tc-swatch { background: linear-gradient(135deg, #7C5CFF, #FF8FD6); }

/* 抽屉内链接（使用手册 / 整理课本） */
.drawer-link {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: background var(--dur) var(--ease), transform 0.1s;
}
.drawer-link:last-child { margin-bottom: 0; }
.drawer-link:hover { background: var(--accent-soft); transform: translateX(2px); }

/* 目录抽屉：按 unit / 解析标题 分组 */
.toc-group { margin-bottom: 14px; }
.toc-group-title {
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 0 0 8px; padding-left: 4px;
}
.toc-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  margin-bottom: 6px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink);
  font-size: 14px; cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform 0.1s;
}
.toc-item:hover { background: var(--surface-2); transform: translateX(2px); }
.toc-item.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.toc-item .toc-idx { flex: none; min-width: 20px; font-size: 12px; font-weight: 700; color: var(--muted); }
.toc-item.active .toc-idx { color: var(--accent); }
.toc-item .toc-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   移动端 / 微信端适配
   ============================================================ */
@media (max-width: 760px) {
  .shelf-layout { flex-direction: column; }
  .shelf-categories {
    flex-direction: row; flex-wrap: wrap; flex-basis: auto;
    position: static; gap: 8px;
  }
  .cat-item { flex: 0 0 auto; }
  .shelf-search { flex-basis: 160px; }
}
/* 宽屏（≥761px）：右栏是独立列，不挤压句子列表，所以「语速滑杆 / 更多」常驻展开，
   省掉一次点击；迷你条上重复的「语速胶囊 / 更多按钮」随之隐藏，避免两个入口。 */
@media (min-width: 761px) {
  .player-panel { padding: 14px 16px; }
  .player-panel .mb-label,
  .player-panel .mb-chip,
  .player-panel .mb-more { display: none; }
  .player-panel .speed-pop { display: flex; margin-top: 10px; }
  .player-panel .more-panel { display: block; }

  /* 双列并排时，左列（课本图 + 翻页条）随页面滚动「钉住」：
     右侧栏再长（句子列表 / 重复停顿 / 跟读录音），滚下去看书时课本图也不会被带走。
     （窄屏 ≤760px 两列是上下堆叠的，不能钉住 —— 见下方移动端规则。） */
  .page-col { position: sticky; top: 12px; }

  /* 矮视口（平板横屏）让整页图「等比缩到看得全」，而不是裁掉底部。
     做法：只收窄 .page-wrap 的宽度 = 可用高 × 图片宽高比；高度仍由 <img> 自身撑开，
     所以容器与图始终同比例 —— 以 .page-wrap 为基准的热区/互动球永远严格对齐，不会错位。
     --page-ar（图片宽高比）由 reader.js 按 data.js 的 iw/ih（或图片 onload 兜底）写入；
     未拿到比例时不加 .ar-known，退回原来的满宽显示，绝不误裁。 */
  .page-wrap { --page-max-h: calc(100vh - 120px); }
  @supports (height: 100dvh) { .page-wrap { --page-max-h: calc(100dvh - 120px); } }
  .page-wrap.ar-known {
    width: min(100%, calc(var(--page-max-h) * var(--page-ar)));
    margin-inline: auto;
  }
  .page-wrap.ar-known img { max-height: var(--page-max-h); }
}

@media (max-width: 560px) {
  /* 窄屏：左列允许收缩（原 min-width 320px 在 360px 屏上会顶破容器） */
  .page-col { min-width: 0; }
  .page-nav-bar { padding: 7px 9px; gap: 8px; }
  .page-nav-bar button { padding: 6px 9px; font-size: 13px; }
  .page-hint { display: none; }         /* 窄屏空间留给翻页条本身 */
}
@media (max-width: 480px) {
  .drawer { width: 100%; max-width: 100%; }
}

/* ===== 降级提示横幅（数据加载失败时显式告知；绝不静默降级）==========
   2026-09-13 加固：/api/data.js 失败时会回退到内置静态快照，而快照可能严重过期，
   之前没有任何提示。z-index 取 400（高于浮动句子面板 240 / 抽屉 260 / 媒体弹层 300
   / 互动翻译卡 320），保证任何视图下都能看见。 */
.stale-banner {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 400;
  display: flex; align-items: center; gap: 10px;
  max-width: min(680px, calc(100vw - 20px));
  padding: 10px 12px 10px 14px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid var(--danger);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
  font-size: 14px; line-height: 1.35;
}
.stale-banner[hidden] { display: none; }
.stale-banner .sb-ic { flex: 0 0 auto; }
.stale-banner .sb-tx { flex: 1 1 auto; min-width: 0; }
.stale-banner .sb-retry {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--danger); background: var(--danger); color: #fff;
  font: inherit; font-weight: 700;
}
.stale-banner .sb-retry:disabled { opacity: .6; cursor: default; }
.stale-banner .sb-close {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--danger);
  font: inherit; line-height: 1;
}
.stale-banner .sb-close:hover { background: rgba(0, 0, 0, .06); }
@media (max-width: 480px) {
  .stale-banner { top: 6px; font-size: 13px; padding: 8px 10px; gap: 8px; }
}

/* ==========================================================================
   体验码门禁层（2026-09-14）
   --------------------------------------------------------------------------
   只读体验站叠加体验码（Worker env TRIAL_KEY）后，未持码者拿不到课本数据 ——
   这里给出唯一入口。主题跟随站点森林绿 --accent；触摸目标 ≥44px（手机可用）；
   prefers-reduced-motion 下不做任何动画。整层默认 display:none，.show 才出现，
   避免未启用门禁的站点被它遮挡。
   ========================================================================== */
.trial-gate {
  position: fixed; inset: 0; z-index: 900;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(18, 32, 24, .62);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s ease;
}
.trial-gate.show { display: flex; opacity: 1; }
.trial-gate .tg-card {
  width: 100%; max-width: 360px;
  background: var(--surface, #fff); color: var(--text, #1c2b21);
  border-radius: 18px; padding: 26px 22px 20px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
  text-align: center;
  animation: tg-pop .2s ease;
}
@keyframes tg-pop {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.trial-gate .tg-ic {
  width: 56px; height: 56px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 26px; line-height: 1;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.trial-gate .tg-title { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.trial-gate .tg-sub { margin: 0 0 16px; font-size: 13px; line-height: 1.6; opacity: .72; }
.trial-gate .tg-input {
  width: 100%; box-sizing: border-box;
  min-height: 48px;                        /* 触摸目标 ≥44px */
  padding: 0 14px; margin-bottom: 10px;
  font: inherit; font-size: 17px; letter-spacing: .06em; text-align: center;
  text-transform: uppercase;
  color: inherit; background: var(--bg, #f6f8f6);
  border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 12px; outline: none;
}
.trial-gate .tg-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.trial-gate .tg-btn {
  width: 100%; min-height: 48px;             /* 触摸目标 ≥44px */
  font: inherit; font-size: 16px; font-weight: 600;
  color: #fff; background: var(--accent);
  border: 0; border-radius: 12px; cursor: pointer;
  transition: filter .15s ease;
}
.trial-gate .tg-btn:hover { filter: brightness(1.06); }
.trial-gate .tg-btn:disabled { opacity: .62; cursor: default; }
.trial-gate .tg-msg { min-height: 18px; margin: 10px 0 0; font-size: 13px; line-height: 1.5; }
.trial-gate .tg-msg.bad { color: var(--danger); }
@media (max-width: 480px) {
  .trial-gate { padding: 14px; }
  .trial-gate .tg-card { padding: 22px 16px 16px; border-radius: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .trial-gate { transition: none; }
  .trial-gate .tg-card { animation: none; }
  .trial-gate .tg-btn { transition: none; }
}
