: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-wrap {
  position: relative; flex: 0 1 620px; min-width: 320px;
  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; }

.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; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls .grow { flex: 1; }

.speed-row { display: flex; align-items: center; gap: 10px; }
.speed-row input[type=range] { flex: 1; accent-color: var(--brand); }
.speed-row .speed-val { min-width: 52px; text-align: center; font-size: 14px; color: var(--brand); font-weight: 600; }

.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 {
  display: flex; align-items: center; gap: 12px; margin-top: 18px;
  padding-top: 14px; border-top: 1px solid var(--line);
}
.page-nav { display: flex; gap: 8px; align-items: center; }
.page-dots { display: flex; gap: 6px; }
.page-dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--line); cursor: pointer;
}
.page-dots span.cur { background: var(--brand); }

.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-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); }
}

/* —— 互动翻译卡（点互动热区弹出：可拖动 · 播报 · 复制 · 查词）——
   设计方向：参考小程序「课本点读」排版，英文/中文整句展示，
   以「英 / 译」标签取代碎词药丸，阅读感更清爽。 */
.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); }
}

/* —— 互动媒体弹层（视频"认东西"全屏播放）—— */
.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; }
}
@media (max-width: 480px) {
  .drawer { width: 100%; max-width: 100%; }
}
