:root {
    --brand: #2f6fed;
    --brand-dark: #1f52c4;
    --brand-soft: #e8efff;
    --accent: #f59e0b;
    --ok: #10b981;
    --ink: #16203a;
    --ink-2: #5a6784;
    --ink-3: #8a94ab;
    --line: #e3e8f2;
    --bg: #f4f6fa;
    --card: #ffffff;
    --radius: 18px;
    --shadow: 0 2px 10px rgba(22, 32, 58, .06);
    --shadow-lg: 0 12px 32px rgba(22, 32, 58, .12);
    --tabbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; }

.app { min-height: 100vh; }

.app-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 16px calc(var(--tabbar-h) + 28px);
}

/* ---------- 页头 ---------- */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 18px;
}

.back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--ink-2);
    font-size: 18px;
    flex: none;
}

.page-title { font-size: 21px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-sub { color: var(--ink-3); font-size: 13px; margin: 2px 0 0; }
.header-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- 书架 ---------- */
.volume-block { margin-bottom: 26px; }

.volume-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 2px 12px;
}

.volume-code { font-size: 18px; font-weight: 700; letter-spacing: .02em; }
.volume-note { color: var(--ink-3); font-size: 12px; }

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

.book-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform .16s ease, box-shadow .16s ease;
}

.book-card:active { transform: scale(.985); }

.book-cover {
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, #dfe8ff, #eef2fb);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 封面用 contain：教材封面要露出书名，宁可留白也不要裁掉字 */
.book-cover img { width: 100%; height: 100%; object-fit: contain; }
.book-cover .fallback { color: var(--ink-3); font-size: 13px; letter-spacing: .08em; }

.book-meta { padding: 10px 12px 12px; }
.book-role { font-size: 12px; color: var(--brand); font-weight: 600; }
.book-name { font-size: 14px; font-weight: 600; margin-top: 2px; }
.book-count { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- 单元 ---------- */
.unit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.unit-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.unit-no {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 8px;
    padding: 2px 8px;
    align-self: flex-start;
}

.unit-name { font-size: 16px; font-weight: 600; }
.unit-meta { font-size: 12px; color: var(--ink-3); }

.wide-action {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--brand), #5b8cf7);
    color: #fff;
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-top: 18px;
    box-shadow: 0 8px 22px rgba(47, 111, 237, .28);
    font-weight: 600;
}

.wide-action .hint { font-size: 12px; opacity: .82; font-weight: 400; }

/* ---------- 单元详情 ---------- */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-2);
    margin: 26px 2px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .count {
    font-weight: 500;
    color: var(--ink-3);
    font-size: 12px;
}

/* ---------- 单元页：课本页按教学环节分组 ----------
   分组只在页图流里插入标题，不重排页、不换容器类型：
   没有小节数据的书（练习册等）仍然走上面的横滑/平铺。 */
.sec-note {
    font-size: 12px;
    color: var(--ink-3);
    margin: -4px 2px 14px;
}

/* 页图区的一次性说明：♫ 数字是本页可播音频条数，不是装饰 */
.page-hint {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.7;
    margin: -2px 2px 12px;
}
.ph-key {
    display: inline-block;
    padding: 0 6px;
    border-radius: 8px;
    background: rgba(22, 32, 58, .72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.page-groups { display: block; }

.sec-group { margin-bottom: 22px; }

/* ---------- 书页式环节流（有 sections 的课本册） ----------
   不再"一个环节一张卡片"地断开：整章是一卷书，页图连续往下翻，
   环节名作为书签钉在页间；顶部另有粘住的环节导航可直达。 */

.sec-nav {
    position: sticky;
    top: 0;                      /* PC 顶部有主导航，覆盖为 58px */
    z-index: 30;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px 2px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
    margin: 0 -2px 2px;
    /* 实底：页图从导航底下穿过时不透字，滚动才不脏 */
    background: var(--bg);
}

.sec-nav::-webkit-scrollbar { display: none; }

.sec-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.sec-chip b {
    font-size: 11px;
    font-weight: 800;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

.sec-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.sec-chip.is-active b { color: rgba(255, 255, 255, .85); }

.book-flow {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px 14px 14px;
}

/* 环节标：书本上的小节题头，不是表格行。
   左侧细竖线 + 序号，没有横贯全宽的底边线，页图紧接其后，读起来是连续的。 */
.book-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 0 0;
    padding: 2px 0 6px 11px;
    border-left: 3px solid var(--brand);
}

.book-sec:first-child .book-mark { margin-top: 8px; }

.book-mark .sec-no {
    background: none;
    color: var(--brand);
    font-size: 12.5px;
    font-weight: 800;
    min-width: 0;
    height: auto;
    padding: 0;
}

.book-mark .sec-name { font-size: 15.5px; letter-spacing: -.01em; }
.book-mark .sec-meta { font-size: 12px; }
.book-mark .sec-titles { flex: 1; }

/* 「教材标注」是给老师看的出处说明，不该和环节名抢注意力 */
.book-mark .sec-badge {
    margin-left: auto;
    background: none;
    border: none;
    padding: 0 2px;
    font-size: 11px;
    color: var(--ink-3);
    opacity: .8;
}

.book-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 8px 0 4px;
}

/* 覆盖横滑缩略图的默认宽：书页流里每页都是可读尺寸，纵向连续。
   圆角与阴影都收小，页与页之间像纸张叠放，不像一格格卡片。 */
.book-pages .page-item {
    flex: none;
    width: min(100%, 560px);
    scroll-snap-align: none;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(22, 32, 58, .07), 0 8px 20px rgba(22, 32, 58, .05);
}

.book-sec.is-other .book-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(45%, 260px), 1fr)); justify-items: center; }
.book-sec.is-other .book-pages .page-item { width: 100%; max-width: 260px; }

.sec-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 2px 10px;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
}

.sec-head.is-other { border-left-color: var(--line); }

.sec-no {
    flex: none;
    min-width: 30px;
    height: 28px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
}

.sec-head.is-other .sec-no { background: var(--bg); color: var(--ink-3); }

.sec-titles { min-width: 0; }

.sec-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.4;
}

.sec-meta {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.5;
}

.sec-badge {
    margin-left: 4px;
    flex: none;
    font-size: 11px;
    color: var(--ink-3);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 9px;
    cursor: help;
}

.sec-empty {
    font-size: 12px;
    color: var(--ink-3);
    padding: 6px 2px 12px;
}

/* 每组只有 1–2 页，横滑区底部不用留那么多余量 */
.pages.sec-pages { padding-bottom: 4px; }

/* 页图：横滑浏览缩略图，点任意一页进全屏阅读器 */
.pages {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 2px 2px 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.pages::-webkit-scrollbar { display: none; }

.page-item {
    position: relative;
    flex: 0 0 auto;
    width: min(68vw, 300px);
    padding: 0;
    border: none;
    background: var(--card);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
    scroll-snap-align: center;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
    transition: transform .14s ease;
}

.page-item:active { transform: scale(.985); }
.page-item img { width: 100%; height: auto; display: block; }

/* 课本页左上角的「听本页」：原来只是个 ♫ 装饰，点了什么也不播；
   现在是真按钮，直接连播这一页的音频，并把条数印在按钮上。 */
.page-play {
    position: absolute;
    left: 8px;
    top: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 26px;
    padding: 0 8px 0 7px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    background: rgba(22, 32, 58, .72);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
    transition: background .14s ease, transform .14s ease;
}

.page-play:hover { background: var(--brand); }
.page-play:active { transform: scale(.94); }
.page-play-icon { font-size: 13px; }
.page-play-n { font-size: 11px; font-weight: 700; opacity: .92; }

.page-play.is-active { background: var(--brand); border-color: transparent; }
.page-play.is-playing { background: #2b50c4; border-color: transparent; }

/* 缩略图由 button 改成 div，键盘焦点要看得见 */
.page-item:focus-visible,
.page-play:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
}

/* 课本页图右上角：这一页属于哪个教学环节，和音频卡片上的 S0x 标签同编号 */
.page-sec-chip {
    position: absolute;
    right: 8px;
    top: 8px;
    max-width: 62%;
    padding: 1px 7px;
    border-radius: 5px;
    background: rgba(22, 32, 58, .5);
    color: #fff;
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.page-label {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: rgba(22, 32, 58, .6);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    padding: 1px 9px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.read-all {
    margin-left: auto;
    flex: none;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    background: var(--brand-soft);
    border: none;
    border-radius: 999px;
    padding: 6px 13px;
    cursor: pointer;
}

.media-list {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.media-group + .media-group { border-top: 1px solid var(--line); }

.media-group-head {
    font-size: 12px;
    font-weight: 700;
    color: var(--ink-3);
    padding: 12px 16px 4px;
    letter-spacing: .04em;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background .15s ease;
}

.media-item + .media-item { border-top: 1px solid #f0f3f9; }

/* 折叠：第 4 条起收起来，整组都被收掉时组头一起隐藏 */
.media-item.is-extra,
.media-group-head.is-extra { display: none; }

.media-list.is-open .media-item.is-extra { display: flex; }
.media-list.is-open .media-group-head.is-extra { display: block; }

.media-item.is-current { background: #f3f7ff; }
.media-item.is-current .media-name { color: var(--brand-dark); font-weight: 600; }

.fold-toggle {
    width: 100%;
    margin-top: 10px;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--card);
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.fold-toggle:active { background: #f7f9fd; }
.fold-chevron { transition: transform .2s ease; display: inline-block; }
.fold-toggle.is-open .fold-chevron { transform: rotate(180deg); }

/* ---------- 配套音频：类别 tab 之内再按教学环节分组 ---------- */
/* 每组自带一个「播放本节」入口，组头不能进 .media-list —— 宽屏那个列表是
   两列 grid，组头混进去会被排成一张卡片。 */
.audio-note {
    font-size: 12px;
    color: var(--ink-3);
    margin: -4px 2px 12px;
}

.audio-groups { display: block; }

.audio-group + .audio-group { margin-top: 18px; }

.ag-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 2px 8px;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
}

.audio-group.is-noanchor > .ag-head { border-left-color: var(--line); }

.ag-no {
    flex: none;
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    font-variant-numeric: tabular-nums;
}

.audio-group.is-noanchor .ag-no { background: var(--bg); color: var(--ink-3); }

.ag-titles { min-width: 0; flex: 1; }

.ag-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.4;
}

.ag-meta {
    font-size: 12px;
    color: var(--ink-3);
    line-height: 1.5;
}

.ag-play {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 11px;
    border: 1px solid var(--brand);
    border-radius: 999px;
    background: var(--card);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.ag-play-icon { font-size: 10px; line-height: 1; }
.ag-play:active { transform: scale(.97); }

.ag-play.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* ---------- 配套内容的标签页 ---------- */
/* 吸顶：滑到第 20 条时还能直接换类别，不用滚回顶部。
   背景必须是实色——用半透明会让下一条的文字从标签条底部透出来。 */
.mtabs {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 8px;
    margin: 0 -2px 12px;
    padding: calc(8px + env(safe-area-inset-top)) 2px 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    background: var(--bg);
}

.mtabs::-webkit-scrollbar { display: none; }

.mtab {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.mtab:active { transform: scale(.97); }

/* 选中态用深墨色而不是品牌蓝：整页已经全是蓝色按钮，再堆一个蓝色 pill 会糊成一片 */
.mtab.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
    box-shadow: 0 6px 16px rgba(22, 32, 58, .2);
}

.mtab-n {
    font-size: 11px;
    font-weight: 600;
    opacity: .55;
    font-variant-numeric: tabular-nums;
}

.mtab.is-active .mtab-n { opacity: .8; }

/* 这个类别里有正在播的音频 */
.mtab.is-sounding .mtab-label::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--ok);
    vertical-align: 1px;
    animation: sounding 1.4s ease-in-out infinite;
}

@keyframes sounding {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .35; transform: scale(.72); }
}

.mpanel[hidden] { display: none; }
.mpanel.is-active { animation: panel-in .22s ease both; }

@keyframes panel-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

/* 播放中的那一行：左侧一道竖线 + 圆形按钮轻微呼吸，扫一眼就知道在放哪条 */
.media-item.is-current { box-shadow: inset 3px 0 0 var(--brand); }
/* 合并音轨被拆成分段播时，被点的那条也留一道浅色线（实际播的是它的第 N 段） */
.media-item.is-alias { box-shadow: inset 3px 0 0 rgba(47, 111, 237, .28); }
.media-item.is-playing .media-play { animation: play-beat 1.6s ease-in-out infinite; }

@keyframes play-beat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.07); }
}

.media-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 14px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.media-play.is-playing { background: var(--brand); color: #fff; }

.media-info { min-width: 0; flex: 1; }
/* 主行是白板里的英文句子（"Who do you meet on the first day of school?"），
   单行省略会把内容砍成半句；限两行，第三行以后才收。 */
.media-name {
    font-size: 14px; font-weight: 600; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; white-space: normal;
}
.media-tag { font-size: 12px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }

/* 课文音频的子分类标签：S03 课文 = 教材环节；灰底 = 白板原始分组 / 未归入环节 */
.media-chip {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 5px;
    background: var(--brand-soft, #eef2ff);
    color: var(--brand, #3f63d8);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
}
.media-chip.is-plain { background: var(--bg, #f1f3f7); color: var(--ink-3, #74809a); font-weight: 600; }

.video-list { display: grid; gap: 12px; }

.video-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.video-card video { width: 100%; display: block; background: #000; }
.video-card .video-name { padding: 10px 14px; font-size: 13px; color: var(--ink-2); }

/* ---------- 悬浮磨耳朵入口 ---------- */
.fab {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(var(--tabbar-h) + 14px);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #ff8a3d, #f97316);
    color: #fff;
    border-radius: 999px;
    padding: 13px 24px;
    font-weight: 700;
    box-shadow: 0 10px 26px rgba(249, 115, 22, .35);
}

.fab .small { font-size: 12px; font-weight: 500; opacity: .9; }

/* ---------- 磨耳朵播放器 ---------- */
.player {
    background: linear-gradient(165deg, #1b2a52, #101a35);
    color: #eef2ff;
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow-lg);
}

.player-eyebrow { font-size: 12px; color: #9fb0d9; letter-spacing: .08em; }
.player-title { font-size: 20px; font-weight: 700; margin: 6px 0 2px; }
.player-sub { font-size: 13px; color: #9fb0d9; }

.player-progress {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #9fb0d9;
    font-variant-numeric: tabular-nums;
}

.bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    overflow: hidden;
    cursor: pointer;
}

.bar-fill { height: 100%; width: 0; background: #6f9bff; border-radius: 999px; }

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 18px;
}

.ctrl {
    border: none;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 15px;
    cursor: pointer;
}

.ctrl-main {
    width: 64px;
    height: 64px;
    font-size: 20px;
    background: #fff;
    color: #16203a;
}

.player-options {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.opt {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, .1);
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 12px;
    color: #cfd9f2;
}

.opt select {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    outline: none;
}

.opt select option { color: #16203a; }

.playlist {
    margin-top: 20px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
}

.playlist-item + .playlist-item { border-top: 1px solid #f0f3f9; }
.playlist-item.is-active { background: var(--brand-soft); }
.playlist-item.is-active .pl-name { color: var(--brand-dark); font-weight: 600; }

.pl-index {
    width: 26px;
    font-size: 12px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    flex: none;
}

.pl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-tag { font-size: 11px; color: var(--ink-3); flex: none; }

/* ---------- 底部导航 ---------- */
.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--tabbar-h);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    display: flex;
    z-index: 40;
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    color: var(--ink-3);
}

.tab.is-active { color: var(--brand); }

/* 品牌字只在 PC 顶部导航里出现，手机上不占位 */
.nav-brand { display: none; }

.tab-dot {
    width: 20px;
    height: 20px;
    border-radius: 7px;
    border: 2px solid currentColor;
    opacity: .55;
}

.tab.is-active .tab-dot { opacity: 1; background: currentColor; }

.logout-form {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 50;
}

.logout-form button {
    border: none;
    background: rgba(255, 255, 255, .8);
    color: var(--ink-3);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
}

/* ---------- 登录 ---------- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, #dfe9ff, #f4f6fa 60%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border-radius: 22px;
    padding: 28px 24px;
    box-shadow: var(--shadow-lg);
}

.login-title { font-size: 24px; font-weight: 700; margin: 0; }
.login-sub { color: var(--ink-3); font-size: 13px; margin: 6px 0 22px; }

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 12px;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 600;
}

.field input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    background: #fbfcff;
}

.field input:focus { border-color: var(--brand); background: #fff; }

.btn-primary {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 14px;
    background: var(--brand);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
}

.btn-primary:active { background: var(--brand-dark); }

.form-error {
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

.empty {
    text-align: center;
    color: var(--ink-3);
    font-size: 14px;
    padding: 40px 12px;
}

/* ---------- 常驻播放条 ---------- */
.mini-player {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--tabbar-h);
    z-index: 40;
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 22px rgba(22, 32, 58, .08);
    animation: mini-in .22s ease;
}

@keyframes mini-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.mini-player[hidden] { display: none; }
.mini-progress { height: 2px; background: #e8edf7; }
.mini-progress i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s linear; }
.mini-body { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; }
.mini-info { min-width: 0; flex: 1; }
.mini-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 11px; color: var(--ink-3); }

.mini-ctl { display: flex; align-items: center; gap: 2px; }
.mini-ctl button,
.mini-close {
    border: none;
    background: transparent;
    color: var(--ink-2);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.mini-ctl .mini-toggle { background: var(--brand); color: #fff; width: 40px; height: 40px; font-size: 14px; }
.mini-close { color: var(--ink-3); font-size: 15px; }

/* 播放条 → 课本页：听着想看时一键打开阅读器并落到当前音频那页 */
.mini-read {
    flex: none;
    height: 28px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}
.mini-read:hover { background: #dbe5ff; }
@media (max-width: 380px) {
    .mini-read { padding: 0 6px; font-size: 10px; }
}

body.has-mini .app-main { padding-bottom: calc(var(--tabbar-h) + 104px); }

/* ---------- 全屏阅读器 ---------- */
.reader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* 手机上 inset:0 / 100vh 是"浏览器 UI 收起后"的高度：地址栏还在时，
       阅读器的底栏（字幕那句）会被浏览器自己的工具栏盖住半截，看起来像
       "句子掉下去了/位置偏了"。100dvh 跟着可见视口走，Safari/Chrome 都认。 */
    height: 100vh;
    height: 100dvh;
    z-index: 90;
    background: #0d1220;
    color: #eef2ff;
    display: flex;
    flex-direction: column;
}

.reader[hidden] { display: none; }
body.reader-open { overflow: hidden; }

.reader-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    flex: none;
}

.reader-btn {
    width: 34px;
    height: 34px;
    flex: none;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

.reader-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: #c3cfec;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-count { font-size: 12px; color: #93a4cd; font-variant-numeric: tabular-nums; }

/* 阅读器标题下第二行：当前页所属教学环节 */
.reader-headings { flex: 1; min-width: 0; }
.reader-headings .reader-title { flex: none; }
.reader-sec {
    font-size: 11px;
    color: #8fa6d8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.reader-sec[hidden] { display: none; }

.reader-stage { flex: 1; min-height: 0; position: relative; overflow: hidden; }

.reader-track {
    display: flex;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.reader-track::-webkit-scrollbar { display: none; }
.reader.is-zoomed .reader-track { overflow: hidden; }

.reader-slide {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    overflow: hidden;
    position: relative;
}

.reader-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    will-change: transform;
}

.reader.is-zoomed .reader-slide img { max-width: none; max-height: none; }

/* ---------- 点读热区 ---------- */
/* 平时完全透明，点到才读；播放中的那一句用暖黄描边，孩子一眼能对上"刚才读的是这句" */
.reader-zones {
    position: absolute;
    pointer-events: none;
    will-change: transform;
}

.rz {
    position: absolute;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    pointer-events: auto;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s ease, box-shadow .12s ease;
}

.rz:active { background: rgba(255, 214, 102, .35); }

/* 首次进入时的轮廓提示：只闪一次，随即淡出 */
.reader-zones.is-hinting .rz {
    background: rgba(255, 255, 255, .16);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .55);
    animation: rz-hint 1.2s ease forwards;
}

@keyframes rz-hint {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

.rz.is-playing {
    background: rgba(255, 205, 56, .26);
    box-shadow: 0 0 0 2px rgba(255, 205, 56, .9);
}

/* 课文播放逐句高亮（卡拉OK）：列表播放器播到哪句就点亮哪句。
   和点读的 is-playing 区分开：这里偏"跟随光标"，暖黄底 + 亮边，不压字。 */
.rz.is-following {
    background: rgba(255, 205, 56, .34);
    box-shadow: 0 0 0 3px rgba(255, 178, 20, .92), 0 4px 14px rgba(255, 170, 20, .28);
}

.rz { transition: background .14s ease, box-shadow .14s ease; }

.rz:focus-visible { outline: 2px solid #ffd666; outline-offset: 2px; }

/* 书页流上的只读高亮覆盖层：贴着页图，纯展示、不挡点击 */
.flow-zones {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.flow-zones .fz {
    position: absolute;
    border-radius: 4px;
    transition: background .12s ease, box-shadow .12s ease;
}

.flow-zones .fz.is-following {
    background: rgba(255, 205, 56, .40);
    box-shadow: 0 0 0 3px rgba(255, 178, 20, .95), 0 0 22px rgba(255, 185, 40, .40);
}

.reader-tip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 118px;
    font-size: 12px;
    color: #b9c6e6;
    background: rgba(13, 18, 32, .74);
    padding: 6px 14px;
    border-radius: 999px;
    pointer-events: none;
    transition: opacity .45s ease;
    z-index: 2;
}

.reader-tip.is-gone { opacity: 0; }

/* 字幕条：整轨播放 / 点读时显示正在读的那一句 */
/* 字幕条：贴在播放条里，整轨播放 / 点读时居中显示正在读的那一句。
   以前是浮在页图上的胶囊（bottom:118px），会压住页脚那几行字（署名、网址、
   活动说明）—— 那几行恰恰是孩子要跟着读的。挪进播放条后，图片区不再被子幕遮挡。 */
.reader-subtitle {
    /* 左右两段等宽撑着，字幕取内容宽度、再宽不超过 560px，于是它正好落在播放条的
       中点：音轨名长短、右边开关多少都不会把它推来推去。 */
    flex: 0 1 auto;
    min-width: 0;
    max-width: 560px;
    margin: 0 auto;
    padding: 6px 14px;
    font-size: 13px;
    line-height: 1.45;
    color: #f3f6ff;
    text-align: center;
    background: rgba(8, 13, 26, .62);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* 浮动层「有 hidden 但仍占位」踩过三次（见 .reader-text），这里显式兜底 */
.reader-subtitle[hidden] { display: none; }

/* 窄屏播放条放不下第三段：字幕掉到下面单独一行，仍然居中、仍然不压图 */
@media (max-width: 768px) {
    .reader-audio { flex-wrap: wrap; row-gap: 6px; }
    .ra-side.is-left { flex: 1 1 0; }      /* basis 0 才肯缩，课本三个开关才不会挤到第三行 */
    .ra-side.is-right { flex: 0 0 auto; }
    .reader-subtitle {
        order: 10;
        flex: 1 0 100%;
        max-width: none;
        margin: 0;
        font-size: 12px;
        padding: 5px 12px;
    }
    /* 手机端页面图靠上对齐：stage 通常比页图高，居中会让图悬在半空，
       上下都是黑边、离工具栏远。靠上贴住工具栏，宽图横向仍居中。 */
    .reader-slide { align-items: flex-start; padding-top: 0; }
}

/* 手机上「哪本书 / 第几页」顶栏已经写着了，底栏这块让给字幕和开关，
   否则课本那三个开关会把音轨名压成一列竖排的单字 */
@media (max-width: 560px) {
    .reader-audio-info { display: none; }
}

/* 原文面板：右侧抽屉，按当前页电子页渲染 */
.reader-text {
    position: absolute;
    top: 56px;
    right: 0;
    bottom: 104px;
    width: min(360px, 88vw);
    display: flex;
    flex-direction: column;
    background: rgba(13, 18, 32, .94);
    border-left: 1px solid rgba(255, 255, 255, .10);
    box-shadow: -12px 0 32px rgba(0, 0, 0, .35);
    z-index: 4;
}

/* display:flex 会盖掉浏览器对 hidden 的默认处理：不写这行，面板关着也是 360px 深色竖条贴在右侧 */
.reader-text[hidden] { display: none; }

.reader-text-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #cfe0ff;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.reader-text-close {
    border: 0;
    background: transparent;
    color: #9fb2d8;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
}

.reader-text-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 12px 14px 24px;
}

.reader-text-body p {
    margin: 0 0 7px;
    font-size: 14px;
    line-height: 1.55;
    color: #dde6f8;
}

.reader-text-empty {
    color: #8ea0c4 !important;
}

.reader-tool.is-active {
    background: rgba(255, 205, 56, .28);
    color: #ffe8a3;
}

/* ---------- 图文对照（阅读册） ---------- */
/* 同一块面板，阅读册比「原文」宽一点：右侧要放句子 + 逐词染色，360px 折行太碎 */
.reader-text.is-pairs {
    width: min(430px, 94vw);
    background: rgba(13, 18, 32, .96);
}

.reader-text-title { flex: 1 1 auto; min-width: 0; }

.reader-text-speak {
    flex: none;
    height: 26px;
    padding: 0 10px;
    border: 1px solid rgba(255, 205, 56, .5);
    border-radius: 999px;
    background: rgba(255, 205, 56, .14);
    color: #ffe8a3;
    font-size: 12px;
    cursor: pointer;
}
.reader-text-speak:hover { background: rgba(255, 205, 56, .24); }
.reader-text-speak:disabled { opacity: .55; cursor: default; }

.rp-body { padding: 10px 12px 22px; }

/* 一句一行：序号 / 句子 / 时长。整行是按钮——孩子不用先对准小字再点。 */
.rp-sent {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    margin: 0 0 6px;
    padding: 11px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    color: #e6eeff;
    font-size: 17px;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
}
.rp-sent:hover { background: rgba(255, 255, 255, .08); }
.rp-sent.is-playing {
    border-color: rgba(255, 205, 56, .55);
    background: rgba(255, 205, 56, .12);
}

.rp-no {
    flex: none;
    width: 16px;
    padding-top: 2px;
    color: #8ea0c4;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.rp-line { flex: 1 1 auto; }
.rp-time {
    flex: none;
    padding-top: 3px;
    color: #7d8db0;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* 逐词染色：绿=读对，红=读错，紫+删除线=漏读。颜色只用在这三态上，不做分数色阶。 */
.rp-w.is-scored { border-radius: 4px; padding: 0 2px; }
.rp-w.is-ok { color: #9be7b4; background: rgba(38, 161, 95, .16); }
.rp-w.is-bad {
    color: #ffb4a8;
    background: rgba(220, 70, 60, .18);
    text-decoration: underline wavy #ff8a7a;
    text-underline-offset: 3px;
}
.rp-w.is-missed {
    color: #c9a4ff;
    background: rgba(140, 90, 220, .18);
    text-decoration: line-through;
}

.rp-banner {
    margin: 0 0 10px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
}
.rp-banner-head { font-size: 14px; font-weight: 600; color: #eef2ff; }
.rp-banner-facts { margin-top: 3px; font-size: 11px; color: #93a4c6; }
.rp-banner-note { margin-top: 3px; font-size: 11px; color: #b9a97a; }
.rp-banner.is-pass { border-color: rgba(38, 161, 95, .45); background: rgba(38, 161, 95, .14); }
.rp-banner.is-retry { border-color: rgba(255, 205, 56, .45); background: rgba(255, 205, 56, .12); }

/* 「我读好了」：引擎不可用时唯一能往下走的按钮。
   放在判定横幅里（同一块深色面板），所以用亮底深字，和面板里其它文字不是一个层级。 */
.rp-selfok {
    margin-top: 8px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 9px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, .92);
    color: #1f2b45;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
}
.rp-selfok:disabled { opacity: .6; cursor: default; }
.rp-selfok:active { transform: scale(.98); }
.rp-banner.is-invalid,
.rp-banner.is-skip { border-color: rgba(255, 255, 255, .14); }

.rp-hint {
    margin: 0 0 8px;
    color: #8ea0c4;
    font-size: 12px;
    line-height: 1.6;
}

/* 触屏：缩放靠手势，顶栏只留「图文对照 / 跟读」两个真按钮 */
@media (hover: none), (pointer: coarse) {
    .reader-tools.has-speech { display: flex; }
    .reader-tools.has-speech .reader-tool:not(.reader-tool--speak):not([data-reader-text-toggle]):not([data-reader-fit]) {
        display: none;
    }
}

/* 手机上图文对照改成底部半屏：上半页图还在，才是「对照」而不是遮住 */
@media (max-width: 720px) {
    .reader-text.is-pairs {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        height: 46vh;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, .12);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -12px 32px rgba(0, 0, 0, .4);
    }
}


/* 答案册查看器 */
.answers-entry { margin-top: 12px; }

.answers-modal {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    background: rgba(8, 11, 20, .94);
    z-index: 80;
}

/* hidden 属性只是浏览器默认样式（display:none），上面这条 display:flex 会盖掉它 ——
   漏掉这一行，答案册遮罩会一直挂在课本页上，整页都点不动。 */
.answers-modal[hidden] { display: none; }

.answers-bar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: #e8efff;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.answers-title { font-weight: 600; }
.answers-count { color: #9fb2d8; font-size: 13px; }

.answers-close {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #cbd8f4;
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
}

.answers-stage {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 56px 20px;
    overflow: hidden;
}

.answers-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
}

.answers-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    color: #f0f5ff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.answers-nav.is-prev { left: 10px; }
.answers-nav.is-next { right: 10px; }
.answers-nav:disabled { opacity: .3; cursor: default; }

body.answers-open { overflow: hidden; }

.reader-audio {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .06);
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.reader-audio button {
    border: none;
    background: transparent;
    color: #eef2ff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    flex: none;
}

.reader-audio .reader-audio-toggle { background: var(--brand); width: 44px; height: 44px; }
.reader-audio-info { flex: 1; min-width: 0; }
.reader-audio-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-audio-sub { font-size: 11px; color: #93a4cd; }

/* 播放条左右两段等宽：中间的字幕才能压在中点 */
.ra-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 0;
    min-width: 0;
}

.ra-side.is-right { justify-content: flex-end; }

/* 「自动切换页面」：跟着播放进度自动翻页的开关，勾选状态记在 localStorage */
.reader-autoturn {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
    cursor: pointer;
    color: #93a4cd;
    font-size: 11px;
    white-space: nowrap;
    user-select: none;
}

/* 只剩勾选框（文字已去掉，说明在 title 里），加大到 17px 好点按 */
.reader-autoturn input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}

.reader-autoturn.is-on { color: #dfe8ff; }

/* 「播放本节」：翻到哪一页就连播那一页所属环节的音频，复用组头那套激活态 */
.reader-audio .reader-sec-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    width: auto;
    height: 32px;
    padding: 0 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .12);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.reader-sec-btn[hidden] { display: none; }
.reader-audio .reader-sec-btn.is-active { background: var(--brand); color: #fff; }
.reader-audio .reader-sec-btn.is-playing { background: #2b50c4; color: #fff; }

/* ---------- 阅读器：看得见的缩放 / 翻页 / 印刷页码 ---------- */
/* 触屏靠双击与双指，按钮默认藏起来；有鼠标的设备才显示，别挤窄手机顶栏 */
.reader-tools { display: none; align-items: center; gap: 3px; flex: none; }

.reader-tool {
    min-width: 30px;
    height: 28px;
    padding: 0 7px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .1);
    color: #eef2ff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}
.reader-tool:hover { background: rgba(255, 255, 255, .22); }
.reader-tool:active { transform: scale(.94); }

.reader-print { color: #8fa6d8; }

.reader-nav {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 64px;
    border: none;
    border-radius: 10px;
    background: rgba(13, 18, 32, .55);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    opacity: .55;
    transition: opacity .15s ease, background .15s ease;
}
.reader-nav:hover:not(:disabled) { opacity: 1; background: rgba(13, 18, 32, .8); }
.reader-nav:disabled { opacity: .16; cursor: default; }
.reader-nav.is-prev { left: 10px; }
.reader-nav.is-next { right: 10px; }

@media (hover: hover) and (pointer: fine) {
    .reader-tools { display: flex; }
    .reader-nav { display: block; }
}

/* 页图加载失败时的重试按钮：盖在空白页中央，别让孩子对着黑屏发呆 */
.reader-img-retry {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    color: #eef2ff;
    font-size: 13px;
    cursor: pointer;
    z-index: 2;
}
.reader-img-retry[hidden] { display: none; }

/* ---------- 阅读器：本页音频 ---------- */
.reader-audio .reader-page-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    width: auto;
    height: 32px;
    padding: 0 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .12);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.reader-page-btn[hidden] { display: none; }
.reader-audio .reader-page-btn span {
    min-width: 16px;
    padding: 1px 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    font-size: 10px;
}
.reader-audio .reader-page-btn.is-active { background: var(--brand); color: #fff; }

/* 抽屉从底栏上方展开，默认收起，不挡课本页 */
.reader-page-audios {
    flex: none;
    background: rgba(16, 23, 42, .96);
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: 10px 14px 8px;
    animation: rpa-in .16s ease-out;
}
.reader-page-audios[hidden] { display: none; }

@keyframes rpa-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.rpa-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rpa-title { flex: 1; min-width: 0; font-size: 12px; color: #c3cfec; }
.rpa-title b { color: #fff; font-size: 13px; }

.rpa-play {
    flex: none;
    padding: 5px 12px;
    border: none;
    border-radius: 14px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
.rpa-play[hidden] { display: none; }
.rpa-play.is-active { background: #2b50c4; }

.rpa-close {
    flex: none;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #c3cfec;
    font-size: 12px;
    cursor: pointer;
}

.rpa-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 168px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.rpa-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: #e7ecfb;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}
.rpa-item:hover { background: rgba(255, 255, 255, .14); }
.rpa-item.is-current { background: var(--brand-soft); color: var(--brand-dark); }
.rpa-n {
    flex: none;
    min-width: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    opacity: .7;
    font-size: 11px;
}
.rpa-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 420px) {
    .app-main { padding: 12px 12px calc(var(--tabbar-h) + 24px); }
    .book-grid { grid-template-columns: repeat(2, 1fr); }
    .unit-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 平板上把内容铺成两列：一行只放一个 "C401" 会把 900px 宽全浪费掉 */
@media (min-width: 820px) {
    .media-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1px;
        background: var(--line);
    }

    .media-item { background: var(--card); }
    .media-item + .media-item { border-top: none; }

    .video-list { grid-template-columns: 1fr 1fr; }

    /* 宽屏每组是两列卡片，组间留够呼吸，别把九个环节糊成一整片 */
    .audio-group + .audio-group { margin-top: 24px; }

    /* 分组后常有 1 / 3 / 5 条的小列表，最后一条占满整行 ——
       否则两列 grid 会漏出半行浅色底，看起来像一张没渲染完的卡片。 */
    .media-list > .media-item:nth-child(odd):last-child { grid-column: 1 / -1; }
}

/* ---------- 今日任务卡（学习内核） ---------- */

.enter-wrap {
    min-height: calc(100vh - var(--tabbar-h) - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.enter-card {
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 28px 22px;
    text-align: center;
}

.enter-title { font-size: 20px; font-weight: 700; margin: 0; }
.enter-sub { color: var(--ink-3); font-size: 13px; margin: 6px 0 18px; }
.enter-error {
    background: #fdecec;
    color: #c0392b;
    font-size: 13px;
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 12px;
}
.enter-form { display: flex; gap: 8px; }
.enter-input {
    flex: 1;
    font-size: 20px;
    letter-spacing: .3em;
    text-align: center;
    text-transform: uppercase;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 10px 8px;
    outline: none;
}
.enter-input:focus { border-color: var(--brand); }
.enter-btn {
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 0 22px;
    font-size: 16px;
    font-weight: 600;
}
.enter-demo { margin-top: 18px; }
.enter-demo-btn {
    background: none;
    border: 0;
    color: var(--brand);
    font-size: 13px;
    text-decoration: underline;
}

.plan-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 24px; }

.plan-item {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 14px;
    border-left: 5px solid var(--brand);
}
.plan-item.is-done { opacity: .55; border-left-color: var(--ok); }
/* 跳掉的条目（连对够了就不再耗时间）：压得比完成态更淡，但留在列表里——
   孩子看得见"它不用做了"，家长也看得见"今天为什么少了一项"。 */
.plan-item.is-skipped { opacity: .38; border-left-color: var(--ink-3); }
.pi-loop-1 { border-left-color: #8b5cf6; }
.pi-loop-2 { border-left-color: var(--ok); }
.pi-loop-3 { border-left-color: var(--brand); }
.pi-loop-4 { border-left-color: var(--accent); }
.pi-loop-5 { border-left-color: #ef4444; }

.pi-head { display: flex; align-items: center; gap: 8px; }
.pi-badge {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border-radius: 6px;
    padding: 2px 7px;
}
.pi-mins { font-size: 12px; color: var(--ink-3); }
.pi-status { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.pi-body { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pi-text { min-width: 0; }
.pi-summary { font-size: 16px; font-weight: 600; }
/* 理由行：自适应唯一的可见面。灰、小、不加粗——它是旁白，不是指标。 */
.pi-reason { margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.pi-start {
    margin-left: auto;
    background: var(--brand);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 7px 18px;
    font-size: 14px;
    font-weight: 600;
}
.pi-start:disabled { background: var(--ok); }

/* 作答区展开后这一格已经是"正在做"，右上角再挂个「开始」是重复动作 */
.plan-item:has(.pi-runtime:not([hidden])) .pi-start { display: none; }

.pi-runtime { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

.act-audio {
    display: block;
    margin: 0 auto 12px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    border: 0;
    border-radius: 999px;
    padding: 12px 26px;
    font-size: 17px;
    font-weight: 700;
}
.act-opts { display: grid; gap: 8px; }
.opt-btn {
    background: #fff;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .02em;
}
.opt-btn.is-right { border-color: var(--ok); background: #e7f8f1; color: #0b7a55; }
.opt-btn.is-wrong { border-color: #ef4444; background: #fdecec; color: #c0392b; }

.act-intro { text-align: center; }
.act-word {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: .02em;
    margin-bottom: 10px;
}
.act-done {
    margin-top: 12px;
    background: var(--ok);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
}

/* match（图词匹配）/ read（跟读）模式 */
.opt-audio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
}
.opt-audio .num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 家长周报 ---------- */

.report-cards {
    display: grid;
    /* 四张卡（时长/坚持/作答/听读）一行放得下就一行，窄屏自动折行 */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.rpt-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 12px;
    text-align: center;
}

.rpt-num { font-size: 24px; font-weight: 800; }
.rpt-unit { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 2px; }
.rpt-label { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.rpt-section {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
}

.rpt-title { font-size: 15px; font-weight: 700; margin: 0 0 10px; }
.rpt-count { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.rpt-empty { color: var(--ink-3); font-size: 13px; margin: 0; }
.rpt-note { font-size: 13px; color: var(--ink-2); margin: 0; line-height: 1.6; }

.rpt-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 90px;
    padding: 0 4px;
}

.rpt-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.rpt-bar {
    width: 60%;
    max-width: 28px;
    background: var(--brand);
    border-radius: 6px 6px 2px 2px;
}

.rpt-bar-label { font-size: 10px; color: var(--ink-3); margin-top: 6px; }

.rpt-words { display: flex; flex-wrap: wrap; gap: 6px; }
.rpt-word {
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 12px;
}

.rpt-m-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.rpt-m-label { width: 44px; font-size: 13px; font-weight: 600; }
.rpt-m-bar {
    flex: 1;
    height: 10px;
    background: var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.rpt-m-bar span {
    display: block;
    height: 100%;
    background: var(--ok);
    border-radius: 999px;
}
.rpt-m-num { width: 24px; text-align: right; font-size: 13px; color: var(--ink-3); }

.today-footer { text-align: center; padding: 4px 0 24px; }
.report-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-3);
    text-decoration: none;
    background: var(--card);
    border-radius: 999px;
    padding: 8px 20px;
    box-shadow: var(--shadow);
}

/* 老师的话：置顶横幅，孩子的今日任务里最醒目的一条 */
.teacher-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    border-radius: 14px;
}
.tn-badge {
    flex: none;
    font-size: 12px;
    font-weight: 700;
    color: #ad6800;
    background: #ffe7ba;
    border-radius: 999px;
    padding: 3px 10px;
}
.tn-text { font-size: 15px; line-height: 1.5; color: #613400; }

/* 平板竖屏（620–767）：还是手机版单列，但别把卡片拉到 900 宽——
   文字和按钮各据一端，读起来不像一张卡 */
@media (min-width: 620px) and (max-width: 767.98px) {
    .app-main { max-width: 620px; }
}

/* =========================================================
   PC 适配层（≥768px）
   触屏优先的设计全部保留；这里只解决三件事：
   1) 宽屏别把一大列清单抻到 960px——任务卡双列，磨耳朵双栏；
   2) 鼠标要有反馈——没有 :hover 的按钮在 PC 上看起来是坏的；
   3) 底部导航从"手机手势条"变成居中浮岛，不再贴满全宽。
   ========================================================= */

/* 键盘走查（Tab 键）在触屏上无感，在 PC 上是基本盘 */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tab:focus-visible,
.tabbar :focus-visible { outline-color: var(--brand-dark); border-radius: 10px; }

@media (min-width: 768px) {
    /* ---- 导航：底部手势条 → 顶部 sticky 主导航 ----
       挂底部会在宽屏上悬在内容正中央挡东西；PC 的视线动线本来就从顶部开始。
       DOM 顺序不动，用 order 提到 main 之前。 */
    .app { display: flex; flex-direction: column; min-height: 100vh; }

    .tabbar {
        order: -1;
        position: sticky;
        top: 0;
        left: auto;
        right: auto;
        bottom: auto;
        transform: none;
        width: 100%;
        height: 58px;
        gap: 4px;
        padding: 0 20px;
        justify-content: center;
        background: #fff;
        border-top: 0;
        border-bottom: 1px solid var(--line);
        z-index: 40;
    }

    /* 品牌字只在 PC 出现：顶部一条全宽导航没有标识会显得空 */
    .nav-brand {
        display: block;
        position: absolute;
        left: 28px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        font-weight: 800;
        letter-spacing: -.02em;
        color: var(--ink);
    }

    .tab {
        flex: none;                 /* 不伸缩，否则「磨耳朵」会被压成两行 */
        flex-direction: row;
        gap: 8px;
        padding: 8px 16px;
        border-radius: 999px;
        font-size: 14px;
        font-weight: 600;
        color: var(--ink-2);
        white-space: nowrap;
    }

    .tab.is-active { background: var(--brand-soft); color: var(--brand-dark); }

    .tab-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        border-width: 0;
    }

    .tab.is-active .tab-dot { background: var(--brand); }

    /* 导航回了顶部，内容底部不再需要给 tabbar 留 100px。
       width:100% 不能省：.app 变成 flex 后，交叉轴上的 auto margin 会让
       .app-main 不再 stretch，宽度塌成 fit-content（实测只剩 468px）。 */
    .app-main {
        width: 100%;
        padding: 22px 28px 56px;
    }
    body.has-mini .app-main { padding-bottom: 110px; }

    /* mini 播放条：全宽压底 → 居中浮岛 */
    .mini-player {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(560px, 88vw);
        bottom: 20px;
        border: 1px solid var(--line);
        border-radius: 16px;
        overflow: hidden;
        box-shadow: var(--shadow-lg);
    }

    /* 磨耳朵入口：PC 惯例放右下角，别悬在内容中央 */
    .fab {
        left: auto;
        right: 28px;
        bottom: 28px;
        transform: none;
    }

    /* ---- 今日任务：单列长清单 → 双列网格 ----
       展开作答的卡会被内容撑高，align-items:start 让各行互不牵连 */
    .plan-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        align-items: start;
    }

    /* 正在做的那张横跨整行：作答时视线只该有一个焦点，
       也不会把同行另两张卡压出大片空白 */
    .plan-item:has(.pi-runtime:not([hidden])) {
        grid-column: 1 / -1;
    }

    .plan-item .pi-runtime {
        max-width: 560px;
        margin-left: auto;
        margin-right: auto;
    }

    /* ---- 单元页：横滑缩略图 → 平铺网格 ----
       触屏上横滑是对的（拇指够得着）；PC 上一屏只露 3 张半是浪费，
       12 页平铺成一屏，点任意一张照样进阅读器。 */
    .pages {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 14px;
        overflow: visible;
        scroll-snap-type: none;
        padding-bottom: 4px;
    }

    .page-item {
        width: auto;
        scroll-snap-align: none;
        border-radius: 12px;
    }

    /* ---- 分组视图：每个环节一张卡片，宽屏两列 ----
       单列会让 9 个环节连滚九屏，把上一轮 PC 平铺的成果又退回去。
       卡片内 1–2 页固定宽横排；附录组跨整行并允许换行。 */
    .page-groups {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px 20px;
        align-items: start;
    }

    .sec-group {
        margin-bottom: 0;
        min-width: 0;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 12px 12px 10px;
    }

    /* 没有小节数据的书：单个透明组占满整行，页图仍按原来的 grid 平铺 */
    .sec-group.is-plain {
        grid-column: 1 / -1;
        background: none;
        border: none;
        padding: 0;
    }

    .sec-group.is-other { grid-column: 1 / -1; }

    .sec-name { font-size: 15px; }

    .pages.sec-pages {
        display: flex;
        gap: 12px;
        overflow: visible;
        scroll-snap-type: none;
    }

    .sec-pages .page-item {
        flex: 0 0 230px;
        width: 230px;
        scroll-snap-align: none;
    }

    /* Unit 6 的附录有 17 页，不能横着撑破一列 */
    .sec-group.is-other .pages.sec-pages { flex-wrap: wrap; }

    /* ---- 书页式环节流：PC 上导航粘在主导航之下，页图更大 ---- */
    .sec-nav { top: 58px; padding: 10px 2px 12px; }

    .book-flow { padding: 8px 26px 18px; }

    .book-mark { margin-top: 26px; }

    .book-pages { gap: 24px; }

    .book-pages .page-item { width: min(100%, 640px); }

    /* ---- 磨耳朵：播放器 + 播放列表双栏，播放器粘住 ---- */
    .ears-grid {
        display: grid;
        grid-template-columns: minmax(320px, 5fr) 7fr;
        gap: 22px;
        align-items: start;
    }

    .ears-grid .player {
        position: sticky;
        top: 76px;
    }

    /* ---- 周报：柱状图更高，数字更有分量 ---- */
    .rpt-card { padding: 18px 12px; }
    .rpt-num { font-size: 28px; }
    .rpt-bars { height: 120px; }

    /* ---- 家长周报两个卡片区块在宽屏并排 ---- */
    .rpt-pair {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* 宽于 1100 的显示器上任务卡可以三列，但上限 960 的容器装不下三列，
   所以容器同步放宽，页头/横幅跟着对齐——整页仍然是"一个阅读栏"的节奏 */
@media (min-width: 1100px) {
    .app-main { max-width: 1100px; }
    .plan-list { grid-template-columns: repeat(3, 1fr); }
}

/* ---- 鼠标反馈：只在真有指针的设备上生效，触屏不受影响 ---- */
@media (hover: hover) and (pointer: fine) {
    .book-card,
    .unit-card,
    .page-item {
        cursor: pointer;
    }

    .book-card:hover,
    .unit-card:hover,
    .page-item:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg);
    }

    .media-item:hover { background: #f7f9fe; }

    .playlist-item:hover,
    .playlist-item.is-active:hover { background: var(--brand-soft); }

    .media-item.is-current:hover { background: #f3f7ff; }

    .ag-play:hover { background: var(--brand-soft); }
    .ag-play.is-active:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

    .mtab:hover { border-color: var(--brand); color: var(--brand); }
    .mtab.is-active:hover { color: #fff; }
    .mtab.is-active:hover { background: var(--ink); }

    .tab:hover { color: var(--brand-dark); }
    .tab.is-active:hover { color: var(--brand-dark); }

    .pi-start:hover,
    .act-audio:hover,
    .act-done:hover,
    .enter-btn:hover,
    .btn-primary:hover {
        filter: brightness(1.07);
    }

    .opt-btn:hover {
        border-color: var(--brand);
        background: #f8faff;
    }

    .pi-start:disabled:hover { filter: none; cursor: default; }

    .wide-action:hover { filter: brightness(1.04); }
    .fab:hover { filter: brightness(1.05); }
    .fold-toggle:hover { background: #f7f9fd; border-color: var(--ink-3); }
    .read-all:hover { background: #dbe6ff; }
    .report-link:hover { color: var(--ink-2); }
    .rz:hover { background: rgba(255, 214, 102, .22); }
    .logout-form button:hover { color: var(--ink-2); background: #fff; }
    .enter-demo-btn:hover { color: var(--brand-dark); }

    /* 触屏横滑靠手势，滚动条藏掉是对的；PC 鼠标没有手势，
       横滑区必须给一条可见滚动条，否则滚轮推进不去 */
    .pages { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
    .pages::-webkit-scrollbar { display: block; height: 6px; }
    .pages::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
    .pages::-webkit-scrollbar-track { background: transparent; }
}

/* ---------- 听读记录（学习记录闭环） ---------- */
.today-footer .report-link { margin: 0 10px; }
.rpt-listens { list-style: none; margin: 8px 0 0; padding: 0; }
.rpt-listen {
    display: flex; align-items: baseline; gap: 10px;
    padding: 7px 4px; border-bottom: 1px dashed var(--line);
    font-size: 13px;
}
.rpt-listen:last-child { border-bottom: none; }
.rpt-listen-when { color: var(--ink-3); flex: 0 0 86px; font-variant-numeric: tabular-nums; }
.rpt-listen-what { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-listen-dur { flex: 0 0 auto; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- 生词表（每单元开篇 Vocabulary 栏，点词即听教材原声） ---------- */
.vocab-nav {
    position: sticky; top: 0; z-index: 6;
    display: flex; gap: 8px; overflow-x: auto;
    padding: 10px 2px 12px; margin: -4px -2px 6px;
    background: linear-gradient(var(--bg) 72%, rgba(244, 246, 250, 0));
    scrollbar-width: none;
}
.vocab-nav::-webkit-scrollbar { display: none; }

.vocab-nav-chip {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card);
    color: var(--ink-2); font-size: 13px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.vocab-nav-chip b {
    font-size: 11px; font-weight: 700; color: var(--brand);
    background: var(--brand-soft); border-radius: 999px; padding: 0 6px;
}
.vocab-nav-chip.is-empty { opacity: .5; }
.vocab-nav-chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.vocab-nav-chip.is-active b { background: rgba(255, 255, 255, .22); color: #fff; }

.vocab-tools { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; }
.vocab-tools-note { flex: 1; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.vocab-playall {
    flex: 0 0 auto; border: none; cursor: pointer;
    padding: 9px 15px; border-radius: 999px;
    background: var(--brand); color: #fff;
    font-size: 13px; font-weight: 600;
    box-shadow: 0 6px 16px rgba(47, 111, 237, .26);
}

.vocab-unit {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 14px;
    overflow: hidden; scroll-margin-top: 64px;
}

.vocab-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--line); background: #fbfcfe;
}
.vocab-head-main { min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.vocab-unit-no {
    flex: 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .04em;
    color: var(--brand); background: var(--brand-soft);
    border-radius: 8px; padding: 2px 7px;
}
.vocab-unit-topic {
    font-size: 15px; font-weight: 700; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vocab-head-meta {
    flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--ink-3);
}
.vocab-unit-play {
    border: 1px solid var(--brand-soft); background: var(--brand-soft);
    color: var(--brand-dark); font-size: 12px; font-weight: 600;
    border-radius: 999px; padding: 4px 10px; cursor: pointer;
}

.vocab-list { list-style: none; margin: 0; padding: 2px 0 4px; }

.vocab-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 14px; cursor: pointer;
    transition: background .15s ease;
}
.vocab-item + .vocab-item { border-top: 1px solid #f1f4fa; }
.vocab-item.is-current { background: var(--brand-soft); }

.vocab-no {
    flex: 0 0 20px; padding-top: 3px;
    font-size: 12px; font-weight: 700; color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
.vocab-item.is-current .vocab-no { color: var(--brand); }

.vocab-body { flex: 1 1 auto; min-width: 0; }
.vocab-word { font-size: 16px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.vocab-forms { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.vocab-ex { margin-top: 2px; font-size: 13px; color: var(--ink-2); word-break: break-word; }

.vocab-play {
    flex: 0 0 auto; width: 36px; height: 36px; cursor: pointer;
    display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 50%; background: var(--card);
    -webkit-tap-highlight-color: transparent;
}
.vocab-play-icon {
    font-size: 15px; line-height: 1;
    /* emoji 喇叭默认是彩色的，压成灰蓝才跟界面统一；播放时再翻白 */
    filter: grayscale(1) brightness(.55);
    opacity: .75;
}
.vocab-item.is-current .vocab-play { border-color: var(--brand); }
.vocab-item.is-playing .vocab-play { background: var(--brand); border-color: var(--brand); }
.vocab-item.is-playing .vocab-play-icon {
    filter: brightness(0) invert(1); opacity: 1;
    animation: vocab-pulse .9s ease-in-out infinite;
}
@keyframes vocab-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.16); } }

.vocab-noaudio { flex: 0 0 36px; text-align: center; color: var(--line); font-weight: 700; }
.vocab-missing { margin: 0; padding: 16px 14px; font-size: 13px; color: var(--ink-3); }
.vocab-foot { margin: 4px 4px 20px; font-size: 12px; color: var(--ink-3); line-height: 1.7; }

@media (min-width: 768px) {
    .vocab-unit-topic { font-size: 16px; }
    .vocab-word { font-size: 17px; }
    .vocab-list { padding: 4px 0 6px; }
}

/* 生词表入口：和「磨耳朵」并排时不能两个蓝块，用白底描边区分「查阅」与「播放」 */
.wide-action--vocab {
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--brand-soft);
    box-shadow: var(--shadow);
}
.wide-action--vocab > span:first-child { color: var(--brand-dark); }
.wide-action--vocab .hint { color: var(--ink-3); opacity: 1; }

/* 窄屏：页脚那串「印页 P8 · 8 词 · 听本单元」会把单元主题挤成省略号，
   印刷页对学员不是刚需，先让位给标题 */
@media (max-width: 560px) {
    .vocab-printpage { display: none; }
    .vocab-head-meta { gap: 6px; }
}

/* 宽屏：词条一列拉满 960px 太散，两列排（按行从左到右，阅读顺序不变） */
@media (min-width: 900px) {
    .vocab-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
    .vocab-item + .vocab-item { border-top: none; }
    .vocab-item { border-bottom: 1px solid #f1f4fa; }
}

/* ---------- 绘本模式（/b/{code}/u/{n}/picture） ----------
   一页一屏、一句一停。页图铺满暗色舞台，聚光跟着朗读走，
   句子显示在下方，点画面重读、横滑翻页。 */
body.no-tabbar .app-main {
    max-width: 100%;
    padding: 0;
}

.pb {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100dvh;
    max-width: 760px;
    margin: 0 auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

/* 这些元素用 hidden 控制显隐，而它们自己是 flex/grid，作者样式会盖掉浏览器默认的
   [hidden] { display: none }——answer-modal 踩过这个坑，这里先把底线写上 */
.pb [hidden] { display: none !important; }

.pb-top { flex: none; display: flex; align-items: center; gap: 10px; }

.pb-back {
    flex: 0 0 auto;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--card); box-shadow: var(--shadow);
    font-size: 17px; color: var(--ink-2);
}

.pb-head { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.pb-title { font-size: 15px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-sub { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pb-auto {
    flex: 0 0 auto; cursor: pointer;
    padding: 6px 11px; border-radius: 999px;
    border: 1px solid var(--line); background: var(--card);
    color: var(--ink-3); font-size: 12px; font-weight: 600;
}
.pb-auto.is-on { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-dark); }

.pb-stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    touch-action: none;
}

.pb-frame {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 30px rgba(22, 32, 58, .18);
}
.pb-img {
    width: 100%; height: 100%; object-fit: contain;
    opacity: 0; transition: opacity .2s ease;
}
.pb-img.is-ready { opacity: 1; }

/* 聚光：一个方框 + 超大外阴影当遮罩，比四块拼起来的遮罩稳得多 */
.pb-spot {
    position: absolute;
    border-radius: 7px;
    border: 2px solid rgba(255, 255, 255, .92);
    box-shadow: 0 0 0 9999px rgba(6, 10, 20, .34);
    pointer-events: none;
    transition: left .22s ease, top .22s ease, width .22s ease, height .22s ease;
}

.pb-start {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; border: none; cursor: pointer;
    background: rgba(12, 18, 32, .46);
    color: #fff;
}
.pb-start-icon {
    width: 62px; height: 62px; border-radius: 50%;
    display: grid; place-items: center;
    background: #fff; color: var(--brand); font-size: 21px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
}
.pb-start-main { font-size: 15px; font-weight: 600; }
.pb-start-sub { font-size: 12px; opacity: .72; }

.pb-turn {
    position: absolute; top: 50%; z-index: 3;
    width: 34px; height: 34px; margin-top: -17px; cursor: pointer;
    display: grid; place-items: center;
    border: none; border-radius: 50%;
    background: rgba(255, 255, 255, .82);
    color: var(--ink-2); font-size: 19px; line-height: 1;
    box-shadow: 0 2px 10px rgba(22, 32, 58, .14);
}
.pb-turn--prev { left: 6px; }
.pb-turn--next { right: 6px; }

/* 触屏设备用滑动翻页，箭头只会在页图上压出两块白斑；
   有指针（鼠标）的设备才需要它，而且悬停时才露出来 */
@media (hover: none) {
    .pb-turn { display: none !important; }
}
@media (hover: hover) {
    .pb-turn { opacity: 0; transition: opacity .18s ease; }
    .pb-stage:hover .pb-turn { opacity: 1; }
}

.pb-loading {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px; color: var(--ink-3);
}

.pb-caption { flex: none; padding: 0 4px; min-height: 52px; }
.pb-text {
    margin: 0;
    font-size: 19px; line-height: 1.5; font-weight: 600;
    color: var(--ink); text-align: center;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
.pb-w { transition: color .12s ease; }
.pb-text.is-single .pb-w.is-on { text-decoration: none; color: var(--ink); }
.pb-w.is-on {
    color: var(--brand);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.pb-hint { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-3); text-align: center; min-height: 17px; }

.pb-bar { flex: none; display: flex; align-items: center; gap: 8px; }
.pb-count {
    flex: 1 1 auto; display: flex; align-items: baseline; gap: 3px;
    font-size: 12px; color: var(--ink-3);
}
.pb-count b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pb-count em { margin-left: 8px; font-style: normal; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }

.pb-nav {
    flex: 0 0 auto; width: 40px; height: 40px; cursor: pointer;
    display: grid; place-items: center;
    border: 1px solid var(--line); border-radius: 50%; background: var(--card);
    font-size: 20px; color: var(--ink-2); line-height: 1;
}

.pb-play {
    flex: 0 0 auto; width: 54px; height: 54px; cursor: pointer;
    display: grid; place-items: center;
    border: none; border-radius: 50%;
    background: var(--brand); color: #fff; font-size: 17px;
    box-shadow: 0 8px 20px rgba(47, 111, 237, .3);
}

.pb-mic {
    flex: 0 0 auto; width: 44px; height: 44px; cursor: pointer;
    border: 1px dashed var(--line); border-radius: 50%; background: var(--card);
    color: var(--ink-3); font-size: 13px; font-weight: 600;
}
.pb.is-rec .pb-mic {
    background: #ffecec; border-color: #f3b4b4; border-style: solid; color: #c03535;
    animation: pb-rec 1.1s ease-in-out infinite;
}
@keyframes pb-rec { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

.pb-rail { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 0; scrollbar-width: none; }
.pb-rail::-webkit-scrollbar { display: none; }
.pb-dot {
    flex: 0 0 auto; min-width: 30px; height: 26px; padding: 0 6px; cursor: pointer;
    border: 1px solid var(--line); border-radius: 8px; background: var(--card);
    color: var(--ink-3); font-size: 11px; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.pb-dot.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

.pb-stage.is-empty { display: grid; place-items: center; }

@media (min-width: 768px) {
    .pb { padding: 16px 24px 18px; gap: 12px; }
    .pb-text { font-size: 22px; }
    .pb-stage { border-radius: 22px; }
}

/* 绘本模式入口：实心蓝，和阅读模式的浅色胶囊区分「引导读」与「自由读」 */
.read-all--pb {
    margin-left: 0;
    background: var(--brand);
    color: #fff;
}

/* ---------- 分级阅读（RAZ） ---------- */
/* 书库沿用 book-card；这里只补 RAZ 阅读器的样式。 */
.raz-top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 14px;
}

.raz-top-info { display: flex; flex-direction: column; min-width: 0; }

.raz-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.raz-page {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px 26px 30px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.raz-page-no {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-3);
    letter-spacing: .04em;
}

.raz-sentence {
    font-size: clamp(26px, 6vw, 40px);
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
    letter-spacing: .01em;
}

.raz-word {
    padding: 0 2px;
    border-radius: 6px;
    transition: background .12s, color .12s;
}

.raz-word.is-on { background: var(--brand-soft); color: var(--brand-dark); }
.raz-word.is-last { color: var(--ink-2); }

.raz-flags {
    min-height: 18px;
    font-size: 12px;
    color: var(--accent);
}

.raz-rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 14px 2px 6px;
    scrollbar-width: none;
}

.raz-rail::-webkit-scrollbar { display: none; }

.raz-chip {
    flex: 0 0 auto;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.raz-chip.has-warn { border-color: #f0c987; color: #a5651c; }
.raz-chip.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }

.raz-transport {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.raz-btn {
    flex: 1;
    height: 48px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.raz-btn:active { transform: scale(.98); }

.raz-btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    flex: 1.4;
}

.raz-btn-primary:disabled { opacity: .5; cursor: default; }

.raz-continuous {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 4px;
    font-size: 13.5px;
    color: var(--ink-2);
}

.raz-continuous input { accent-color: var(--brand); }

@media (min-width: 768px) {
    .raz-page { padding: 46px 40px 40px; min-height: 300px; }
    .raz-sentence { font-size: 44px; }
}

/* ===== O3 语音三层：跟读判定反馈 ===== */

.speech-feedback {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.5;
    max-width: 480px;
}

.speech-feedback.is-pass    { background: #e8f7ee; color: #1c7c46; }
.speech-feedback.is-retry   { background: #fff6e0; color: #9a6b00; }
.speech-feedback.is-invalid { background: #f1f2f4; color: #5c6470; }
.speech-feedback.is-skip    { background: #f1f2f4; color: #5c6470; }

/* RAZ 跟读结果面板 */
.raz-speech {
    margin: 12px auto 0;
    max-width: 640px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #f1f2f4;
    color: #3d434d;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.raz-speech.is-pass    { background: #e8f7ee; color: #1c7c46; }
.raz-speech.is-retry   { background: #fff6e0; color: #9a6b00; }
.raz-speech.is-invalid { background: #f1f2f4; color: #5c6470; }
.raz-speech.is-skip    { background: #f1f2f4; color: #5c6470; }

.raz-speech-head { font-size: 15.5px; font-weight: 600; }

.raz-speech-facts {
    margin-top: 4px;
    font-size: 12.5px;
    opacity: .85;
}

.raz-speech-hints {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.raz-speech-hints span {
    background: rgba(255, 255, 255, .75);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 13px;
}

.raz-btn-mic { flex: 1.2; }

/* ============================================================
   「仅课文」：书架课文图片视图 + 单元页净化 + 播放器开关
   偏好一份（leap.onlytext），三处生效，默认勾上。
   ============================================================ */

/* 书架课本页的开关行 */
.onlytext-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 2px 14px;
    flex-wrap: wrap;
}

/* 原生 checkbox 在浅底上太弱，做成滑块开关。
   结构：<label class="onlytext-switch"><input><span class="onlytext-track"></span><span>仅课文</span></label> */
.onlytext-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    user-select: none;
}

.onlytext-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.onlytext-track {
    width: 40px;
    height: 22px;
    flex: none;
    border-radius: 999px;
    background: #cfd7e6;
    position: relative;
    transition: background .18s;
}

.onlytext-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(16, 26, 48, .28);
    transition: transform .18s cubic-bezier(.22, .61, .36, 1);
}

.onlytext-switch input:checked + .onlytext-track { background: var(--brand); }

.onlytext-switch input:checked + .onlytext-track::after { transform: translateX(18px); }

.onlytext-switch input:focus-visible + .onlytext-track {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

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

/* 书架：每个单元一张卡片，卡内是该单元的课文页（点图直达阅读器那一页） */
.unit-text-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 4px;
}

@media (min-width: 900px) {
    .unit-text-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.utg-unit {
    min-width: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px 16px 16px;
    transition: border-color .18s, box-shadow .18s;
}

.utg-unit:hover {
    border-color: #c9d8ff;
    box-shadow: var(--shadow-lg);
}

.utg-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0 12px;
    color: var(--ink);
    text-decoration: none;
}

.utg-no {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border-radius: 7px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: .04em;
    flex: none;
}

.utg-topic {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.utg-more {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand);
    flex: none;
    transition: color .15s;
}

.utg-head:hover .utg-more { color: var(--brand-dark); }

.utg-pages {
    display: grid;
    /* auto-fit：一个单元通常只有 2 页课文，用 fill 会在卡片右侧留一大块空白 */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.utg-page {
    position: relative;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg);
    box-shadow: 0 2px 8px rgba(22, 32, 58, .10);
    aspect-ratio: 3 / 4;
    transition: transform .18s cubic-bezier(.22, .61, .36, 1), box-shadow .18s;
}

.utg-page:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(22, 32, 58, .18);
}

/* 悬停露出播放播放钮：图片本身就是入口，用图标把「点了会播」讲清楚 */
.utg-page::after {
    content: "▶";
    position: absolute;
    right: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(47, 111, 237, .94);
    color: #fff;
    font-size: 9px;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(.8);
    transition: opacity .16s, transform .16s;
    pointer-events: none;
}

.utg-page:hover::after { opacity: 1; transform: scale(1); }

.utg-page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
}

.utg-label {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(13, 18, 32, .72);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

/* 单元页「仅课文」：只留课文图片流 —— 环节导航、环节书签、页角标签、
   配套内容整体收起。DOM 保留（课文连播队列还要从里面取条目）。 */
body.only-text .sec-nav,
body.only-text .book-mark,
body.only-text .page-sec-chip,
body.only-text .section-title .count,
body.only-text [data-supplement] {
    display: none !important;
}

/* 阅读器里的「仅课文」开关复用 .reader-autoturn 的样式，只加一点区分色 */
.reader-onlytext input { accent-color: #e2531f; }

/* 跨单元接力被自动播放策略拦下时的续播入口 */
.reader-resume {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 18, 32, .82);
}

.reader-resume-btn {
    appearance: none;
    border: 0;
    cursor: pointer;
    padding: 14px 28px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 12px 32px rgba(47, 111, 237, .45);
}

/* ---------- 课程导航抽屉（单元页 / 绘本页左缘） ---------- */
/* 学生反映「切单元要先滑到页顶再回退再点」太费劲：给一个随处可开的抽屉，
   本册单元与同卷其他册一次给全。层级高于顶部导航（60），低于弹窗（80/90）。 */
.nav-fab {
    position: fixed;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 12;
    width: 36px;
    height: 44px;
    border: 0;
    border-radius: 0 12px 12px 0;
    background: var(--card);
    color: var(--ink-2);
    font-size: 17px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: color .15s, box-shadow .15s;
}

.nav-fab:hover { color: var(--brand); box-shadow: var(--shadow-lg); }

.nav-backdrop {
    position: fixed;
    inset: 0;
    /* 必须高于顶部导航（topnav 是 60）：否则抽屉头部的关闭按钮会被顶栏盖住，
       点击落到「书架」链接上——关不掉抽屉，还会莫名跳页。 */
    z-index: 70;
    background: rgba(13, 18, 32, .38);
    opacity: 0;
    transition: opacity .2s;
}

.nav-backdrop.is-open { opacity: 1; }

.book-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 71;
    width: 292px;
    max-width: 86vw;
    display: flex;
    flex-direction: column;
    background: var(--card);
    box-shadow: 12px 0 32px rgba(22, 32, 58, .18);
    transform: translateX(-100%);
    transition: transform .2s ease-out;
}

.book-nav.is-open { transform: translateX(0); }

.bn-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 16px;
}

.bn-close {
    border: 0;
    background: none;
    color: var(--ink-3);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
}

.bn-close:hover { color: var(--ink); }

.bn-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px 28px;
    overscroll-behavior: contain;
}

.bn-sec { margin-bottom: 18px; }

.bn-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-3);
    margin: 0 2px 8px;
}

.bn-unit {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    margin-bottom: 2px;
}

.bn-unit b { color: var(--ink-2); font-size: 13px; min-width: 26px; }
.bn-unit span { font-size: 14px; color: var(--ink); }

.bn-unit:hover { background: var(--brand-soft); }

.bn-unit.is-cur {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.bn-unit.is-cur b { color: var(--brand-dark); }

.bn-book { margin-bottom: 12px; }

.bn-book-name {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0 2px 6px;
}

.bn-book-name:hover { color: var(--brand); }

.bn-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.bn-chip {
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 9px;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink);
}

.bn-chip:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand-dark);
}

/* 抽屉里的「切换年级册」当前卷高亮 */
.bn-chip.is-cur {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 700;
}

.bn-chip.is-cur:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

/* 单元页面包屑：书架 / 1A 课本 / Unit 5 */
.crumb-trail {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    font-size: 12.5px;
    color: var(--ink-3);
    flex-wrap: wrap;
}

.crumb-trail a {
    color: var(--ink-2);
    text-decoration: none;
}

.crumb-trail a:hover { color: var(--brand); }

.crumb-trail b {
    color: var(--ink);
    font-weight: 600;
}

/* ---------- 全屏阅读（沉浸模式） ---------- */
/* 手机竖屏：顶栏 54px + 播放条 110~140px 全都在抢页图的高度。
   沉浸模式下这两条改成浮层（脱离文档流），stage 拿到整屏高度，
   图片按 contain 自然长到最大；播放键同时放大，手指不用瞄准。 */
.reader.is-immersive .reader-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    background: linear-gradient(180deg, rgba(8, 12, 22, .78) 0%, rgba(8, 12, 22, .38) 62%, rgba(8, 12, 22, 0) 100%);
    /* 空白处让位给页图：只有真正的按钮吃点击，点图片仍然可以点读 */
    pointer-events: none;
}

.reader.is-immersive .reader-top > * { pointer-events: auto; }

.reader.is-immersive .reader-slide { padding: 0; }

/* 手机沉浸：顶栏是浮层，页图靠上对齐后会钻到渐变条底下，页首那行字被压暗。
   这里把顶栏那一条高度让出来（54 = 34 按钮 + 上下各 10 内边距），页图紧贴工具栏下沿。 */
@media (max-width: 768px) {
    .reader.is-immersive .reader-slide { padding-top: calc(54px + env(safe-area-inset-top)); }
}

/* 浮层里字幕排在走带键上面：离页图更近，读哪句一眼就能对上 */
.reader.is-immersive .reader-subtitle { order: 0; }

.reader.is-immersive .reader-audio {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    z-index: 6;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 18px;
    background: rgba(11, 16, 28, .80);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .42);
}

/* 放大播放键：孩子在颠簸的车上也能一次点中 */
.reader.is-immersive .reader-audio .reader-audio-toggle { width: 52px; height: 52px; }

/* 浮层播放条压扁一点：它是盖在页图上的，越矮挡得越少 */
.reader.is-immersive .reader-audio { gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }

/* 沉浸模式：字幕从播放条里抽出来，变成贴在播放条正上方的胶囊浮层。
   播放条瘦成一行（省 ~34px），字幕离页图更近、离"读到哪句"也更近，
   手机上底部遮挡整体少一块。left/bottom 以浮层播放条为基准居中。 */
.reader.is-immersive .reader-subtitle {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    flex: 0 0 auto;
    max-width: min(92vw, 560px);
    font-size: 12.5px;
    padding: 5px 14px;
    background: rgba(11, 16, 28, .72);
    border: 1px solid rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .30);
}

.reader.is-immersive .reader-tip { display: none; }

/* 原文 / 图文对照面板原来给底栏留了 104px，浮层模式下不用留那么多 */
.reader.is-immersive .reader-text { bottom: calc(96px + env(safe-area-inset-bottom)); }

.reader.is-immersive .reader-nav { opacity: .32; }

/* 触屏：只留「全屏」这一个工具键（阅读册还有跟读 / 图文对照） */
@media (hover: none), (pointer: coarse) {
    .reader-tools.has-fit:not(.has-speech) { display: flex; }
    .reader-tools.has-fit:not(.has-speech) .reader-tool:not([data-reader-fit]) { display: none; }
    .reader-tools.has-fit .reader-tool--fit { font-size: 15px; }
}

/* ---------- 内容任务（轨道 B）：课文与绘本 ----------
   与单词五环（.plan-item）刻意不同：内容任务是一整段连续动作（听 5 分钟、读 6 分钟），
   单词卡是 1–2 分钟的碎片题。用更大的卡、左侧色条加宽、进度条可见，
   让「今天的主菜」和「饭后小菜」在视觉上就分得开。 */

.content-tasks { margin-bottom: 18px; }

.ct-head-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ct-title { font-size: 16px; font-weight: 700; margin: 0; color: var(--ink); }
.ct-sub { font-size: 12px; color: var(--ink-3); }

.ct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.ct-card {
    position: relative;
    display: block;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px 46px;
    border-left: 6px solid var(--brand);
    color: inherit;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease;
}
.ct-card:active { transform: scale(.99); }
.ct-card.ct-raz { border-left-color: var(--accent); }

.ct-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ct-badge {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border-radius: 6px;
    padding: 2px 8px;
    letter-spacing: .02em;
}
.ct-badge-raz { background: var(--accent); }
.ct-count { margin-left: auto; font-size: 12px; color: var(--ink-3); }

.ct-step { display: flex; align-items: flex-start; gap: 10px; }
.ct-step-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
}
.ct-step-icon svg { width: 19px; height: 19px; }
.ct-step-icon.is-read { background: #fdeaf3; color: #c0357c; }
.ct-step-icon.is-book { background: #fff2e2; color: #b3691a; }

.ct-step-text { min-width: 0; }
.ct-label { font-size: 16px; font-weight: 700; line-height: 1.3; }
.ct-hint { margin-top: 3px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

/* 五个圆点 = 单元的五步。已做=实心、当前=描边、未做=浅灰。
   比「第 2/5 步」更容易被 6 岁孩子一眼读懂。 */
.ct-dots { display: flex; gap: 6px; margin-top: 12px; }
.ct-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--line);
}
.ct-dot.is-done { background: var(--ok); }
.ct-dot.is-now { background: #fff; box-shadow: inset 0 0 0 2px var(--brand); }

.ct-meter { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.ct-meter-bar {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}
.ct-meter-bar > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), #5b8cf7);
    transition: width .3s ease;
}
.ct-meter-text { font-size: 12px; color: var(--ink-2); white-space: nowrap; }

.ct-foot { margin-top: 6px; font-size: 12px; color: var(--ink-3); }

.ct-go {
    position: absolute;
    right: 14px;
    bottom: 12px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--brand);
}
.ct-raz .ct-go { color: #b3691a; }

.ct-finished {
    margin: 10px 2px 0;
    font-size: 13px;
    color: var(--ink-2);
    background: var(--brand-soft);
    border-radius: 10px;
    padding: 10px 12px;
}

/* 手机：单卡时铺满，两张时上下排——并排会把「本单元 8/12 页已听完」挤成两行 */
@media (max-width: 640px) {
    .ct-grid { grid-template-columns: 1fr; gap: 10px; }
    .ct-card { padding: 13px 14px 44px; }
    .ct-label { font-size: 17px; }
    .ct-hint { font-size: 13px; }
}

/* ---------- 单元页「今天的目标」条 ----------
   只在从今日任务卡点进来时出现（?task=...）。
   它要回答一个问题：「我现在该干什么」，所以只放动作与程度，不放分数。 */
.task-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding: 11px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, #eaf1ff, #f4f8ff);
    border: 1px solid #d6e3ff;
}
.task-banner.is-read {
    background: linear-gradient(135deg, #fdeaf3, #fff5fa);
    border-color: #f6d3e6;
}

.tb-badge {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border-radius: 999px;
    padding: 3px 9px;
}
.task-banner.is-read .tb-badge { background: #c0357c; }

.tb-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tb-text b { font-size: 15px; color: var(--ink); }
.tb-text span { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }

.tb-goal {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--brand-dark);
}
.task-banner.is-read .tb-goal { color: #a02b68; }

/* 「开始读」：读任务与听任务的操作完全不同（听是按播放，读是开口），
   光给目标数字孩子不知道点哪，所以任务条上直接放一个动作按钮。 */
.tb-go {
    flex: 0 0 auto;
    margin-left: 2px;
    border: 0;
    border-radius: 999px;
    padding: 8px 15px;
    background: #c0357c;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.tb-go:active { transform: scale(.97); }

/* 本次读完：任务条转绿，孩子不用自己回今日页确认 */
.task-banner.is-done {
    background: linear-gradient(135deg, #e7f7ee, #f5fdf8);
    border-color: #c6e8d4;
}
.task-banner.is-done .tb-goal { color: #1f7a45; }

/* 跟读键的呼出：麦克风图标对 6 岁不是自明的入口 */
.reader-tool--speak.is-callout {
    background: #c0357c;
    color: #fff;
    border-color: #c0357c;
    animation: tb-pulse 1s ease-in-out 4;
}
@keyframes tb-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192, 53, 124, .45); }
    50% { box-shadow: 0 0 0 7px rgba(192, 53, 124, 0); }
}

@media (max-width: 640px) {
    /* 手机：目标文字 + 动作按钮放一行放不下，按钮换到第二行右侧，别挤掉提示语 */
    .task-banner { padding: 10px 12px; gap: 8px; border-radius: 12px; flex-wrap: wrap; }
    .tb-text b { font-size: 14.5px; }
    .tb-text span { font-size: 12px; }
    .tb-go { padding: 8px 16px; }
}

/* ===================== 场景词图（课标 505 词 · Word Atlas CC BY 4.0） ===================== */
.words-tools { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; }
.words-hide {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
}
.words-hide input { width: 15px; height: 15px; accent-color: var(--brand); }

.words-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.words-card {
    position: relative; display: flex; flex-direction: column; cursor: pointer;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; transition: transform .12s ease, box-shadow .12s ease;
}
.words-card:hover, .words-card:focus-visible {
    transform: translateY(-2px); box-shadow: var(--shadow); outline: none;
}
.words-thumb-wrap { background: #f7f9fd; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.words-thumb { width: 100%; height: 100%; object-fit: contain; }
.words-thumb--empty { font-size: 40px; font-weight: 700; color: var(--brand); opacity: .4; }
.words-card-text { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.words-w { font-size: 17px; font-weight: 700; color: var(--ink); }
.words-zh { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.words-quick {
    position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px;
    border-radius: 999px; border: none; background: var(--brand-soft); color: var(--brand);
    font-size: 15px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.words-quick:active { background: var(--brand); color: #fff; }

/* 遮字自测：盖住英文，只留图与释义，点卡片看答案 */
.words-grid.is-hidden-en .words-w { visibility: hidden; }
.words-grid.is-hidden-en .words-card.is-revealed .words-w { visibility: visible; }
.words-grid.is-hidden-en .words-zh { color: var(--ink-2); }

/* 详情抽屉 */
.words-sheet { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.words-sheet[hidden] { display: none; }
.words-sheet-mask { position: absolute; inset: 0; background: rgba(22, 32, 58, .45); }
.words-sheet-body {
    position: relative; width: min(680px, 100%); max-height: 86vh; overflow-y: auto;
    background: var(--card); border-radius: 22px 22px 0 0; padding: 22px 20px 28px;
    box-shadow: var(--shadow-lg);
}
.words-sheet-close {
    position: absolute; top: 10px; right: 12px; width: 34px; height: 34px;
    border-radius: 999px; border: 1px solid var(--line); background: var(--card);
    color: var(--ink-2); font-size: 18px; cursor: pointer;
}
.wd-top { display: flex; gap: 16px; align-items: flex-start; }
.wd-img { width: 168px; max-width: 42%; border-radius: 14px; border: 1px solid var(--line); background: #f7f9fd; }
.wd-head { flex: 1; min-width: 0; }
.wd-word { font-size: 30px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.wd-ipa { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.wd-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.words-btn {
    border: 1px solid var(--brand); background: var(--brand-soft); color: var(--brand);
    font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer;
}
.words-btn:active { background: var(--brand); color: #fff; }
.words-btn--ex { border-color: var(--line); background: var(--card); color: var(--ink-2); }
.wd-sense { margin-top: 14px; font-size: 15px; color: var(--ink); }
.wd-sense b { color: var(--brand); margin-right: 4px; }
.wd-sense i { display: block; font-style: normal; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.wd-ex {
    margin-top: 12px; padding: 10px 12px; background: var(--bg); border-radius: 12px;
    font-size: 14px; color: var(--ink); line-height: 1.5;
}
.wd-ex span { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.wd-block { margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.wd-block b { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.wd-block p { margin: 0; line-height: 1.6; }

@media (max-width: 640px) {
    .words-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; }
    .words-card-text { padding: 8px 10px 10px; }
    .words-w { font-size: 15px; }
    .words-quick { right: 6px; bottom: 6px; width: 30px; height: 30px; }
    .wd-word { font-size: 25px; }
    .wd-img { width: 132px; }
}
