:root {
  --bg: #f3f7f7;
  --card: #ffffff;
  --ink: #173334;
  --muted: #5c7475;
  --primary: #0d6e6e;
  --primary-dark: #0a5555;
  --accent: #e8a33d;
  --ok: #1d8a4e;
  --warn: #c2700d;
  --err: #c0392b;
  --line: #dde7e7;
  --radius: 14px;
}

/* ---------- 泰语手写阅读体 Itim（本地托管，不依赖外部CDN） ---------- */
@font-face {
  font-family: 'Itim';
  src: url('/fonts/itim-thai-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0E00-0E7F; /* 泰文 */
}
@font-face {
  font-family: 'Itim';
  src: url('/fonts/itim-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F; /* 拉丁（泰文句中的英文/数字） */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Itim', -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, textarea {
  font-family: inherit; font-size: 16px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; width: 100%;
  background: #fbfdfd; color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid #9fd4d4; border-color: var(--primary); }
textarea { resize: vertical; min-height: 84px; }
.th { font-size: 1.15em; }

/* ---------- 顶栏 ---------- */
#topbar { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 8px rgba(0,0,0,.15); transform: translateZ(0); will-change: transform; isolation: isolate; }
.topbar-inner { max-width: 860px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; }
.brand { background: none; border: none; color: #fff; font-size: 17px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 14px; opacity: .9; }
.link-btn { background: none; border: 1px solid transparent; color: #cfeaea; font-size: 14px; padding: 4px 8px; border-radius: 8px; }
#topbar .link-btn { color: #fff; opacity: .85; }
.link-btn:hover { opacity: 1; text-decoration: underline; }

/* ---------- 布局 ---------- */
.view { max-width: 860px; margin: 0 auto; padding: 18px 14px 60px; }
h2 { margin: 8px 0 4px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.back { margin-bottom: 8px; color: var(--primary); font-size: 15px; padding: 6px 0; }

/* ---------- 登录 ---------- */
#view-auth { max-width: 420px; padding-top: 6vh; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 26px 22px; box-shadow: 0 6px 24px rgba(13,110,110,.10); text-align: center; }
.auth-card h1 { margin: 0 0 4px; font-size: 24px; }
.auth-card .sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.tabs { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.tab { flex: 1; padding: 10px; background: #f2f7f7; border: none; font-size: 15px; color: var(--muted); }
.tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.panel { display: flex; flex-direction: column; gap: 12px; }
.panel input { text-align: left; }
.primary {
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 12px; font-size: 16px; font-weight: 600;
}
.primary:hover { background: var(--primary-dark); }
.primary:disabled { opacity: .55; cursor: not-allowed; }
.secondary { background: #eef3f3; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-size: 15px; }
.footnote { color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ---------- 首页课程卡片 ---------- */
.lesson-cards { display: flex; flex-direction: column; gap: 14px; }
.lesson-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.05); cursor: pointer; transition: transform .08s; border: 1px solid var(--line); }
.lesson-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.09); }
.lesson-card .lc-top { display: flex; align-items: baseline; gap: 10px; }
.lesson-card h3 { margin: 0; font-size: 18px; }
.lesson-card .th-title { color: var(--muted); font-size: 14px; }
.module-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { font-size: 13px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: #f4f8f8; color: var(--muted); }
.chip.submitted { background: #fff6e6; border-color: #ecd6a8; color: var(--warn); }
.chip.graded { background: #e9f7ef; border-color: #bfe3cd; color: var(--ok); }
.lesson-total { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ---------- 课程页 ---------- */
#lesson-head { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
#lesson-head h2 { margin: 0; }
#lesson-head .th-title { color: var(--muted); }
.goal-list { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--muted); }
.cu-box { background: #f0f7f7; border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 13px; color: #6b4b13; margin-top: 10px; }
.detail-toggle { color: var(--primary); background: none; border: none; font-size: 13px; padding: 4px 0; }
.detail-box { margin-top: 10px; font-size: 14px; }
.detail-box table { width: 100%; border-collapse: collapse; }
.detail-box td { padding: 6px 8px; border-bottom: 1px solid #edf3f3; vertical-align: top; }
.detail-box .g { margin: 8px 0; padding: 8px 10px; background: #f8fbfb; border-radius: 8px; }
.detail-box .g b { color: var(--primary); }
.detail-box .g .th { display: block; margin-top: 2px; }
.detail-box .g .zh { color: var(--muted); font-size: 13px; }

/* ---------- 模块tabs ---------- */
.module-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; position: sticky; top: 52px; background: var(--bg); padding: 6px 0; z-index: 20; }
.mtab { flex: 1 0 auto; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 14px; color: var(--muted); white-space: nowrap; }
.mtab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.mtab .badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; border-radius: 999px; font-size: 11px; margin-left: 4px; padding: 0 5px; background: #dff0f0; color: var(--primary); }
.mtab.active .badge { background: rgba(255,255,255,.25); color: #fff; }
.mtab.st-submitted .badge { background: #f5d9a2; color: #7a4d05; }
.mtab.st-graded .badge { background: #bfe3cd; color: #125c33; }

/* ---------- 题目卡片 ---------- */
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.item .q { margin: 0 0 10px; font-weight: 600; font-size: 15.5px; }
.item .pts { float: right; font-size: 12px; color: var(--muted); font-weight: 400; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.audio-box { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.audio-box audio { height: 36px; max-width: 100%; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: #fbfdfd; }
.opt:hover { border-color: #9fd4d4; }
.opt input { width: auto; margin-top: 4px; }
.opt .th { font-size: 1.05em; }
.passage { background: #fbfdfd; border: 1px dashed #cfe0e0; border-radius: 10px; padding: 14px; white-space: pre-wrap; font-size: 16px; }
.passage-zh { color: var(--muted); font-size: 14px; margin-top: 8px; white-space: pre-wrap; }
/* 阅读短文美化：段落 + 逐句编号（作业台内） */
#module-body .passage { counter-reset: psn; white-space: normal; }
#module-body .passage .pp { margin: 0 0 12px; }
#module-body .passage .pp:last-child { margin-bottom: 0; }
#module-body .passage .ps { display: block; position: relative; padding-left: 32px; line-height: 2; font-size: 17px; }
#module-body .passage .ps::before { counter-increment: psn; content: counter(psn); position: absolute; left: 0; top: 9px;
  width: 22px; height: 22px; line-height: 22px; border-radius: 50%; background: #e0f2ef; color: #0d6e6e;
  font-size: 11px; font-weight: 700; text-align: center; }
#module-body .passage .pp.zh { line-height: 1.9; font-size: 14px; }
#module-body .passage.plain { white-space: pre-wrap; }
.hint-box { background: #fff9ec; border: 1px solid #f0e2bd; border-radius: 8px; padding: 8px 10px; font-size: 13.5px; color: #7a5a1d; margin: 8px 0; }
.read-text { background: #f4f9f9; border-radius: 10px; padding: 14px; font-size: 17px; margin: 8px 0; }
.note { font-size: 13px; color: var(--muted); margin: 6px 0; }

/* ---------- 录音 ---------- */
.rec-area { margin: 10px 0; }
.rec-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rec-btn { padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; }
.rec-btn.recording { background: var(--err); color: #fff; border-color: var(--err); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .7; } }
.rec-item { display: flex; align-items: center; gap: 8px; background: #f4f8f8; border-radius: 8px; padding: 6px 10px; margin-top: 6px; flex-wrap: wrap; }
.rec-item audio { height: 32px; }
.rec-del { border: none; background: none; color: var(--err); font-size: 13px; }
.upload-file { font-size: 13px; color: var(--muted); margin-left: 8px; }

/* ---------- 提交/结果 ---------- */
.submit-bar { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; flex-wrap: wrap; }
.submit-note { font-size: 13px; color: var(--muted); }
.auto-result { border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-weight: 600; }
.auto-result.ok { background: #e9f7ef; color: var(--ok); border: 1px solid #bfe3cd; }
.auto-result.warn { background: #fff6e6; color: var(--warn); border: 1px solid #ecd6a8; }
.manual-note { font-size: 13.5px; color: var(--warn); background: #fff9ec; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }

/* 结果视图 */
.result-mod { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.result-mod h4 { margin: 0 0 8px; }
.score-line { font-size: 15px; margin: 4px 0; }
.score-line b { color: var(--primary); font-size: 18px; }
.overall { background: #f0f7f7; border-radius: 8px; padding: 10px 12px; font-size: 14.5px; margin: 8px 0; white-space: pre-wrap; }
.fb { font-size: 14px; margin: 6px 0; padding: 6px 10px; border-radius: 8px; background: #f8fbfb; }
.fb .got { color: var(--ok); font-weight: 600; }
.fb .miss { color: var(--err); font-weight: 600; }
.ref-box { background: #f2f8f8; border-left: 3px solid var(--primary); padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 14px; white-space: pre-wrap; margin: 6px 0; }
.ref-box .lbl { color: var(--muted); font-size: 12.5px; }
.answer-reveal { font-size: 14px; color: var(--muted); margin: 4px 0; }

/* ---------- 弹窗/提示 ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,40,40,.45); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-card { background: #fff; border-radius: var(--radius); padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.modal-card h3 { margin: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #173334; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 80; max-width: 90vw; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
#toast.err { background: var(--err); }

@media (min-width: 700px) {
  .lesson-cards { display: grid; grid-template-columns: 1fr 1fr; }
}

/* ---------- 学习模块 ---------- */
.study-line { border-left: 3px solid #cfe0e0; padding: 6px 10px; margin: 8px 0; background: #f8fbfb; border-radius: 0 8px 8px 0; }
.sl-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.who { font-weight: 700; color: var(--primary); font-size: 13px; background: #e6f2f2; border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.sl-zh { color: var(--muted); font-size: 14px; margin-top: 2px; }
.vocab-row { display: flex; gap: 10px; align-items: baseline; padding: 7px 4px; border-bottom: 1px solid #edf3f3; flex-wrap: wrap; }
.vocab-row .th { font-size: 17px; }
.vzh { color: var(--muted); font-size: 14px; }
.cls-badge { font-size: 12px; border-radius: 999px; padding: 1px 8px; color: #fff; white-space: nowrap; }
.cls-badge.mid { background: #2e7d32; }
.cls-badge.high { background: #c2700d; }
.cls-badge.low { background: #607d8b; }
.play-btn { border: none; background: var(--primary); color: #fff; border-radius: 50%; width: 28px; height: 28px; line-height: 28px; text-align: center; padding: 0; font-size: 12px; flex: 0 0 auto; cursor: pointer; }
.play-btn:hover { background: var(--primary-dark); }
.play-btn.mini { width: 22px; height: 22px; line-height: 22px; font-size: 10px; }
.play-btn.ghost { background: none; display: inline-block; width: 28px; }
/* 带泰语文案的播放按钮（手机友好胶囊形，替代原生播放器） */
.play-btn.labeled { border-radius: 999px; width: auto; height: 32px; line-height: 32px; padding: 0 14px; font-size: 13px; font-weight: 600; white-space: nowrap; }
#module-body .g { margin: 10px 0; padding: 10px 12px; background: #f8fbfb; border-radius: 8px; }
#module-body .g b { color: var(--primary); }
#module-body .g .th { display: block; margin-top: 4px; font-size: 16px; }
#module-body .g .zh { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- 成绩对照高亮 ---------- */
.opt-review { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 5px 0; background: #fbfdfd; }
.opt-review.opt-correct { border-color: #2e7d32; background: #e9f7ef; color: #14532d; font-weight: 600; }
.opt-review.opt-wrong { border-color: var(--err); background: #fdecea; color: var(--err); font-weight: 600; }
.mark { font-size: 12px; margin-left: 6px; font-weight: 600; }
.opt-wrong .mark { color: var(--err); }
.opt-correct .mark { color: #2e7d32; }
.explain-line { margin-top: 5px; color: var(--muted); font-size: 13.5px; }
.cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0; }
.cmp-box { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fbfdfd; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmp-box .lbl { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.cmp-box.wrong { border-color: var(--err); background: #fdecea; }
.cmp-box.ok { border-color: #2e7d32; background: #e9f7ef; }
.cmp-box.ref { border-color: #9fc4c4; background: #f2f8f8; }
.fb.row-ok { border-left: 4px solid #2e7d32; }
.fb.row-bad { border-left: 4px solid var(--err); }
.fb.row-part { border-left: 4px solid var(--accent); }
@media (max-width: 600px) {
  .cmp-grid { grid-template-columns: 1fr; }
  /* 作业台手机优化：模块标签与操作按钮收紧、提交按钮全宽 */
  .mtab { font-size: 13px; padding: 8px 8px; }
  .rec-btn { padding: 8px 12px; font-size: 13px; }
  .play-btn.labeled { height: 30px; line-height: 30px; padding: 0 10px; font-size: 12.5px; }
  .submit-bar .primary { width: 100%; }
  .rec-btns { gap: 6px; }
}

/* ---------- 专题卡片与视频精听 ---------- */
.topic-card { border: 1px solid var(--accent); background: linear-gradient(135deg, #fff9f0, #fff); }

/* 已做过的专题：卡片缩小显示，让没做的更醒目（点进去内容不变） */
.lesson-card.done {
  padding: 9px 12px; opacity: .82;
  background: #fbfbfa; border-color: var(--line);
  box-shadow: none;
}
.lesson-card.done:hover { opacity: 1; box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.lesson-card.done h3 { font-size: 14.5px; font-weight: 500; }
.lesson-card.done .th-title { display: none; }
.lesson-card.done .lc-top { gap: 8px; }
.lesson-card.done .module-chips { margin-top: 5px; gap: 6px; }
.lesson-card.done .module-chips .chip { font-size: 11.5px; padding: 1px 7px; }
.lesson-card.done .lesson-total { margin-top: 4px; font-size: 12px; }
.lesson-card.done .topic-badge { background: var(--muted); font-size: 10px; }
.done-mark {
  margin-left: 8px; font-size: 11.5px; color: var(--ok, #17795e);
  background: #eaf7f1; border: 1px solid #cfe9dd; border-radius: 8px; padding: 1px 7px;
  vertical-align: 1px; white-space: nowrap;
}
@media (max-width: 700px) {
  .lesson-card.done { padding: 8px 10px; }
  .lesson-card.done h3 { font-size: 13.5px; }
  .lesson-card.done .module-chips .chip { font-size: 11px; }
  .done-mark { font-size: 11px; padding: 0 6px; }
}
.topic-badge {
  display: inline-block; background: var(--accent); color: #fff; font-size: 11px;
  padding: 1px 6px; border-radius: 8px; margin-right: 6px; vertical-align: 2px;
}
/* 课号代码徽章（L5 / T1 / TW2）：方便口头沟通定位 */
.lc-code {
  display: inline-block; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700;
  padding: 1px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 2px;
  letter-spacing: .3px; font-family: Consolas, Menlo, monospace;
}
.video-box video { width: 100%; max-height: 320px; background: #000; border-radius: 8px; }
.speed-row { margin-top: 6px; display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted, #777); }
.speed-btn {
  border: 1px solid #ccc; background: #fff; border-radius: 10px; padding: 2px 10px;
  font-size: 12px; cursor: pointer;
}
.speed-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* 视频精听：滚动原文时视频悬浮在顶栏+模块tabs下方 */
.topic-video-float {
  position: sticky; top: 52px; z-index: 15;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(13, 110, 110, .10);
}
.topic-video-float .video-box video { max-height: 240px; }
.video-status {
  margin-top: 6px; padding: 6px 10px; border-radius: 8px; font-size: 13px;
}
.video-status.loading { background: #fff6e6; color: #9a6200; border: 1px solid #f0ddb0; }
.video-status.ready { background: #e9f7ef; color: #17693c; border: 1px solid #bfe3cd; }
.rom { color: #999; font-size: 12px; margin: 0 6px; }
/* 泰语字典式注音（泰文字母的实际读音，音节 - 分隔） */
.pron { color: #0d7a5f; font-size: 14px; margin: 0 8px; }
.ghost-btn {
  border: 1px solid #ccc; background: #fff; border-radius: 10px; padding: 3px 12px;
  font-size: 13px; cursor: pointer; margin-bottom: 8px;
}

/* ---------- 配套教学视频 ---------- */
.vid-item { border: 1px solid #e5e5e5; border-radius: 10px; padding: 8px 12px; margin: 8px 0; background: #fff; }
.vid-item summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.vid-item .video-box { margin-top: 8px; }

/* ---------- 生词本 ---------- */
.nb-btn {
  border: 1px solid #ccc; background: #fff; border-radius: 10px; padding: 1px 9px;
  margin-left: auto; cursor: pointer; font-size: 14px; color: #0d6e6e; line-height: 1.5;
}
.nb-btn.nb-added { background: #e0f2ef; border-color: #0d6e6e; font-weight: 700; }
.nb-toolbar { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.nb-toolbar .hint { margin: 0; }
.nb-row {
  display: flex; align-items: center; gap: 10px; border: 1px solid #e5e5e5;
  border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: #fff;
}
.nb-main { flex: 1; min-width: 0; }
.nb-zh { color: #555; font-size: 13px; margin-top: 2px; }
.nb-list-test .nb-zh { display: none; }
.nb-test .nb-zh { display: none; }
.nb-test .nb-ex-zh { display: none; }
.nb-del { border: none; background: none; color: #999; cursor: pointer; font-size: 15px; padding: 4px; }

/* 生词本：手动录入 */
.nb-add-box { margin: 10px 0; }
/* 口语机器发音评估卡 */
.speech-fb { background: #f6fbfa; border: 1px solid #cde8e4; border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: 14px; }
.sfb-miss { color: #b3541e; font-weight: 700; }
/* 生词本「返回专题」快捷按钮（白底可见的醒目样式，勿用浅色 link-btn） */
.nb-back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: 10px;
  padding: 8px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.nb-back-btn:active { background: #e0f2ef; }
.nb-add-card { background: var(--card); border: 1px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; }
.nb-add-card .q { margin: 0 0 4px; }
.nb-add-inputs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.nb-add-inputs input { flex: 1; min-width: 200px; }
.nb-add-inputs .primary { width: auto; padding: 10px 16px; white-space: nowrap; }
.nb-define-preview { border: 1px dashed #9fc4c4; border-radius: 10px; padding: 12px 14px; margin-top: 4px; background: #f8fbfb; }
.nb-define-preview .preview-head { display: flex; align-items: center; gap: 8px; font-size: 20px; margin-bottom: 4px; }
.nb-define-preview label { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
.nb-define-preview input { margin-top: 4px; }
/* 重复收录提示（常驻，避免用户以为又新增了一条） */
.dup-note { margin: 6px 0 10px; padding: 8px 10px; background: #fff6e6; border: 1px solid #f0ddb0; color: #8a5a00; border-radius: 8px; font-size: 13px; line-height: 1.6; }
.nb-preview-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.nb-preview-actions .primary { width: auto; padding: 10px 20px; }
/* 拼写检查建议卡 */
.spell-card { border: 1px solid #ecd6a8; background: #fff9ec; border-radius: 10px; padding: 12px 14px; margin-top: 4px; }
.spell-card .q { margin: 0 0 8px; color: #7a5a1d; }
.spell-row { margin: 6px 0; font-size: 15px; }
.spell-w { color: #c0392b; font-weight: 700; margin-right: 8px; }
.spell-sugs { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spell-sug { border: 1px solid #0d6e6e; background: #fff; color: #0d6e6e; border-radius: 8px; padding: 2px 10px; cursor: pointer; font-size: 14px; }
.spell-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.spell-actions .primary { width: auto; padding: 9px 16px; }
.spell-actions .secondary { width: auto; }

/* 生词本：熟悉度与例句 */
.nb-stars { color: var(--accent); font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.nb-stars-off { color: #c9d6d6; }
.due-badge { font-size: 11px; background: #fff3e0; color: #b26500; border: 1px solid #f0d9ae; border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.nb-meta { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.nb-ex { font-size: 15px; color: #0d6e6e; background: #f0f7f7; border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
.nb-ex-zh { color: var(--muted); font-size: 13px; margin-left: 8px; }

/* 生词本：复习检测 */
.quiz-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; }
.quiz-progress { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.quiz-word { display: flex; align-items: center; gap: 12px; font-size: 26px; margin: 6px 0 14px; flex-wrap: wrap; }
.quiz-opts { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.quiz-opt { text-align: left; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfd; font-size: 15px; }
.quiz-opt:hover:not(:disabled) { border-color: var(--primary); background: #f0f7f7; }
.quiz-opt:disabled { cursor: default; opacity: .8; }
.quiz-opt.correct { border-color: #2e7d32; background: #e9f7ef; color: #14532d; font-weight: 600; }
.quiz-opt.wrong { border-color: var(--err); background: #fdecea; color: var(--err); }
.quiz-fb { margin-top: 8px; font-weight: 700; }
.quiz-fb.ok { color: var(--ok); }
.quiz-fb.wrong { color: var(--err); }
.quiz-fam-up { margin-top: 8px; color: var(--ok); font-weight: 600; font-size: 14px; }
.quiz-fam-down { margin-top: 8px; color: var(--err); font-weight: 600; font-size: 14px; }
.quiz-cleared { margin: 6px 0 2px; font-size: 14px; }
.quiz-cleared b { color: var(--primary); font-size: 17px; }
.quiz-detail { margin-top: 8px; background: #f8fbfb; border-radius: 8px; padding: 10px 12px; font-weight: 400; }
.quiz-detail .nb-zh { color: var(--ink); font-size: 15px; }
.quiz-self-btns { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.quiz-self-btns .primary { width: auto; padding: 10px 22px; }
#quiz-next, #quiz-done { width: 100%; margin-top: 14px; }
.quiz-score { font-size: 18px; margin: 8px 0; }
.quiz-score b { color: var(--primary); font-size: 30px; }
.quiz-sum-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px dashed #e4eded; flex-wrap: wrap; }
.sum-ok { color: var(--ok); font-weight: 700; }
.sum-wrong { color: var(--err); font-weight: 700; }
.sum-fam { margin-left: auto; }
#quiz-cancel { margin-top: 10px; }

/* 生词本：拼写默写 */
.spell-zh-prompt { font-size: 20px; font-weight: 600; color: var(--ink); }
.spell-input { width: 100%; box-sizing: border-box; font-size: 20px; padding: 12px 14px; margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: inherit; }
.spell-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(13,110,110,.12); }
.spell-input:disabled { background: #f2f6f6; color: var(--muted); }
.spell-actions { display: flex; gap: 10px; margin: 10px 0 4px; flex-wrap: wrap; }
.spell-cmp { margin-top: 8px; background: #f8fbfb; border-radius: 8px; padding: 10px 12px; }
.spell-cmp.note-box { font-size: 13px; }
.spell-line { font-size: 19px; line-height: 1.9; word-break: break-all; }
.spell-ch.ok { color: var(--ok); font-weight: 700; }
.spell-ch.extra { color: var(--err); text-decoration: line-through; }
.spell-ch.miss { color: var(--err); text-decoration: underline wavy; font-weight: 700; }

/* ---------- 复习强化：难度阶梯 / 例句来源 / 例句挖空 / 纠错重写 ---------- */
.ladder-tag { font-size: 11px; background: #eef4fb; color: #1a5a9c; border: 1px solid #c7daf0; border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.ladder-mini { font-size: 11px; background: #f1f5f6; color: #4a6162; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.hard-badge { font-size: 11px; background: #fdecea; color: #b3261e; border: 1px solid #f3c2bd; border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.ex-badge { font-size: 11px; border-radius: 999px; padding: 0 7px; margin-left: 4px; white-space: nowrap; }
.ex-badge.ex-trust { background: #e9f7ef; color: #17693c; border: 1px solid #bfe3cd; }
.ex-badge.ex-ai { background: #fff6e6; color: #9a6200; border: 1px solid #f0ddb0; }
.quiz-opt.primary-opt { border-color: var(--primary); background: #eef7f7; font-weight: 600; }
.ex-edit-row { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini-btn { font-size: 12.5px; border: 1px solid var(--line); background: #fff; color: var(--primary); border-radius: 8px; padding: 3px 10px; }
.mini-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.ex-edit-box { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.ex-edit-box.hidden { display: none; }
.ex-edit-in { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.ex-edit-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.cloze-sent { font-size: 20px; line-height: 1.9; margin: 8px 0 4px; }
.cloze-blank { color: var(--primary); font-weight: 700; letter-spacing: 2px; border-bottom: 2px solid var(--primary); padding: 0 6px; }
.rewrite-box { margin-top: 10px; background: #f4f8f8; border: 1px dashed var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
/* 渐进复习：阶段标记 / 阶段小结 */
.stage-tag { font-size: 11px; background: #eaf2fb; color: #14508f; border: 1px solid #bfd5ee; border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.stage-tip { margin: 0 0 8px; }
.stage-next { margin: 12px 0; padding: 12px; background: #eef7f7; border: 1px solid #c7e2e2; border-radius: 10px; }
.stage-next .note { color: #17595a; font-size: 13.5px; line-height: 1.7; }
.stage-next button { margin-top: 8px; }
.stage-acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }

/* ---------- 同义词辨析 ---------- */
.syn-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; }
.syn-head { display: flex; align-items: flex-start; gap: 10px; }
.syn-words { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.syn-w { display: inline-flex; align-items: baseline; gap: 6px; }
.syn-w .th { font-size: 20px; }
.syn-zh { color: var(--muted); font-size: 13px; }
.syn-dist { margin-top: 10px; font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; }
.syn-confuse { margin-top: 10px; background: #eaf2fb; border: 1px solid #c7daf0; color: #1a5a9c; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.syn-tip { margin-top: 8px; background: #fff6e6; border: 1px solid #ecd6a8; color: #7a5200; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.syn-ex { margin-top: 8px; background: #f0f7f7; border-radius: 8px; padding: 8px 12px; }
.syn-ex-line { padding: 4px 0; border-bottom: 1px dashed #d5e7e7; }
.syn-ex-line:last-child { border-bottom: none; }
.syn-ex-line .th { font-size: 16px; color: #0d6e6e; }
.syn-word-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.syn-word-row input { flex: 1; min-width: 130px; }
.syn-word-row .syn-row-del { border: none; background: none; color: #999; font-size: 15px; padding: 0 6px; }
.syn-ai-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.syn-ai-row .primary { width: auto; padding: 10px 16px; }
.nb-define-preview .syn-words { margin: 8px 0; }

/* ---------- 时间戳原文 ---------- */
.ts-line {
  display: flex; gap: 10px; padding: 8px 10px; border-bottom: 1px dashed #eee;
  cursor: pointer; border-radius: 6px;
  touch-action: manipulation; /* 手机端消除双击缩放延迟，点击即时响应 */
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
.ts-line:hover { background: #f4faf9; }
.ts-line.active { background: #e0f2ef; }
.ts-badge { flex: none; color: #0d6e6e; font-weight: 700; font-size: 12px; margin-top: 3px; }
.ts-main { flex: 1; min-width: 0; }
.ts-zh { color: #555; font-size: 13px; margin-top: 2px; }
/* 逐词高亮跟读（karaoke）：播放时当前词高亮 */
.ts-w { border-radius: 4px; padding: 0 1px; transition: background .1s linear, color .1s linear; }
.ts-w.on { background: #0d6e6e; color: #fff; }
/* 单句循环按钮 */
.loop-btn { border: 1px solid var(--line); background: #fff; color: #0d6e6e; font-size: 12px;
  border-radius: 999px; padding: 2px 10px; margin-top: 6px; cursor: pointer; touch-action: manipulation; }
.loop-btn.on { background: #0d6e6e; color: #fff; border-color: #0d6e6e; font-weight: 600; }

/* ---------- 泰语盲打练习（⌨️） ---------- */
.typ-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.typ-card h3 { margin: 0 0 10px; }
.typ-card h4 { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.typ-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.typ-label { font-size: 13px; color: var(--muted); min-width: 62px; }
.typ-row select { width: auto; min-width: 140px; font-size: 14px; padding: 7px 10px; }
.typ-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.typ-chip {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #f4f8f8; color: var(--muted); font-size: 14px;
}
.typ-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.typ-opts { border-top: 1px dashed var(--line); padding-top: 6px; margin-top: 6px; }
.typ-check { font-size: 13.5px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.typ-check input { width: auto; }
.typ-start { width: auto; padding: 11px 26px; }
/* 材料清洗提示（生词本拼写异常 / 句子被跳过） */
.typ-warn {
  margin: 8px 0 4px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: #fff9ec; border: 1px solid #f0e2bd; color: #7a5a1d; line-height: 1.6;
}

/* ---------- 练习分组 / 键位标注与分组对比 ---------- */
.typ-scope-bar { font-size: 12.5px; color: var(--primary); margin: 0 0 8px; font-weight: 600; }
.typ-scope-line { font-size: 13.5px; margin: 2px 0 8px; }
.typ-scope-line b { color: var(--primary); font-size: 15px; }
.typ-scope-keys { color: var(--muted); margin-left: 8px; }
.typ-scope-cmp {
  margin: 8px 0 10px; padding: 8px 12px; border-radius: 8px; font-size: 13.5px;
  background: #f2f8f8; border-left: 3px solid var(--primary);
  display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline;
}
.typ-scope-cmp .typ-cmp-now { font-weight: 600; }
.typ-scope-cmp .typ-cmp-meta { color: var(--muted); font-size: 12.5px; }
.typ-delta { font-weight: 700; }
.typ-delta.up { color: var(--ok); }
.typ-delta.down { color: var(--err); }
.typ-delta.flat { color: var(--muted); font-weight: 400; }
.typ-groups { display: flex; flex-direction: column; gap: 8px; }
.typ-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fbfdfd; }
.typ-group-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.typ-group-head b { color: var(--primary); font-size: 14.5px; }
.typ-group-times { font-size: 12.5px; color: var(--muted); }
.typ-group-nums { font-size: 13px; margin-top: 3px; }
.typ-group-nums b { color: var(--ink); font-size: 15px; }
.typ-group-keys { font-size: 13px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.typ-group-keys .th { font-size: 15px; color: var(--ink); margin-right: 2px; }
.typ-group-trend { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.typ-miss-key { background: #fdecea; border-radius: 6px; padding: 0 5px; margin-right: 3px; display: inline-block; }
.typ-miss-key i { font-style: normal; font-size: 11px; color: var(--err); margin-left: 2px; }
.typ-hist-scope { color: var(--primary); font-weight: 600; }
.typ-hist-keys { font-size: 12px; color: var(--muted); padding: 2px 0 6px 6px; border-bottom: 1px dashed #eef3f3; word-break: break-all; }
.typ-hist-keys .th { font-size: 14px; color: var(--ink); margin-right: 2px; }

/* ---------- 键位速查表（特殊键标注） ---------- */
.typ-chart summary { cursor: pointer; font-size: 14px; color: var(--primary); font-weight: 600; }
.typ-chart .hint { margin: 8px 0 10px; }
.chart-kb { overflow-x: auto; padding: 4px 2px; }
.chart-kb .tk { min-width: 30px; min-height: 40px; }
.chart-kb .tk .tk-th, .chart-kb .tk .tk-th2 { transition: none; }
/* 特殊键着色 */
.chart-kb .tk-th.obsolete, .chart-kb .tk-th2.obsolete { color: #fff; background: var(--err); border-radius: 3px; padding: 0 2px; }
.chart-kb .tk-th.rare, .chart-kb .tk-th2.rare { color: #b0a58a; }
.chart-kb .tk-th.digit, .chart-kb .tk-th2.digit { color: #2f6fb8; }
.chart-kb .tk-th.symbol, .chart-kb .tk-th2.symbol { color: #c2700d; }
.chart-kb .tk-th.tone, .chart-kb .tk-th2.tone { color: #7a4d8f; }
.chart-kb .tk-th.diacritic, .chart-kb .tk-th2.diacritic { color: #5c7475; }
.chart-kb .tk.no-shift { background-image: linear-gradient(135deg, #f7fafa 25%, #fff 25%, #fff 50%, #f7fafa 50%, #f7fafa 75%, #fff 75%, #fff); background-size: 8px 8px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin: 10px 0; }
.chart-legend i.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.chart-legend i.lg.obsolete { background: var(--err); }
.chart-legend i.lg.rare { background: #b0a58a; }
.chart-legend i.lg.digit { background: #2f6fb8; }
.chart-legend i.lg.symbol { background: #c2700d; }
.chart-legend i.lg.tone { background: #7a4d8f; }
.chart-legend i.lg.diacritic { background: #5c7475; }
.chart-legend i.lg.no-shift { background: repeating-linear-gradient(135deg, #dde7e7 0 3px, #fff 3px 6px); border: 1px solid var(--line); }
.chart-note { margin: 10px 0; }
.chart-note h5 { margin: 0 0 4px; font-size: 13px; color: var(--ink); }
.chart-rows { display: flex; flex-wrap: wrap; gap: 6px; }
.chart-chip {
  display: inline-block; min-width: 26px; text-align: center; padding: 2px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: #fbfdfd; font-size: 15px;
}
.chart-chip.obsolete { background: #fdecea; border-color: var(--err); color: var(--err); }
.chart-chip.rare { color: #b0a58a; }
.chart-chip.digit { color: #2f6fb8; }
.chart-chip.symbol { color: #c2700d; }
.chart-chip.tone { color: #7a4d8f; }
.chart-chip.diacritic { color: #5c7475; }

/* 练习区 */
.typ-bar { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); align-items: baseline; }
.typ-bar #typ-cpm, .typ-bar #typ-acc { color: var(--primary); font-weight: 700; font-size: 16px; }
.typ-bar #typ-errs { color: var(--err); }
.typ-progress { height: 6px; background: #eef3f3; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.typ-lastkey { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; word-break: break-all; }
.typ-lastkey code { background: #eef3f3; border-radius: 4px; padding: 0 4px; }
.typ-progress > div { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .15s; }
.typ-meta { font-size: 13px; color: var(--muted); margin-bottom: 6px; min-height: 22px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.typ-meta .typ-src { background: #f0f7f7; border-radius: 999px; padding: 2px 10px; }
.typ-text {
  /* 泰文排版要点：① 不加 letter-spacing（会让声调符号与辅音脱开）；
     ② 行高留足（叠两个符号的字如 ญ์ / ปื้ 需要上下空间）；
     ③ 每个「字形簇」用 inline-block 整体渲染（见 typing.js splitClusters），
        否则声调/上元音会被排到辅音右边挤成一堆。 */
  font-size: 30px; line-height: 2; letter-spacing: 0; word-break: normal; overflow-wrap: normal;
  padding: 16px 10px; background: #fbfdfd; border: 1px solid var(--line); border-radius: 10px;
}
.typ-text .tcl {
  display: inline-block; padding: 0 1.5px; border-radius: 4px;
  color: #9fb1b1; transition: color .08s;
}
.typ-text .tcl.ok { color: var(--ok); }
.typ-text .tcl.bad { color: #fff; background: var(--err); }
.typ-text .tcl.cur { color: var(--ink); background: #ffeec9; box-shadow: inset 0 -3px 0 var(--accent); }
.typ-text.shake { animation: typ-shake .16s; }
.typ-text.flash-ok { animation: typ-flash .22s; }
@keyframes typ-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes typ-flash { 0% { background: #e9f7ef; } 100% { background: #fbfdfd; } }
.typ-zh { font-size: 15px; color: var(--muted); margin: 8px 0 0; min-height: 20px; }
.typ-finger { font-size: 13.5px; color: var(--muted); margin: 8px 0 4px; min-height: 20px; }
.typ-finger .typ-finger-t b { font-size: 17px; color: var(--primary); }
.typ-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.typ-actions .secondary, .typ-actions .primary, .typ-actions .ghost-btn { width: auto; margin: 0; }
.typ-input {
  display: block; width: 100%; height: 1px; min-height: 0; max-height: 1px;
  padding: 0; margin: 0; border: 0; outline: none; opacity: 0;
  background: transparent; font-size: 16px; /* ≥16px：防 iOS 聚焦时缩放页面 */
}
.typ-focus-hint {
  margin: 8px 0 0; padding: 8px 12px; border-radius: 8px;
  background: #fff6e6; border: 1px solid #ecd6a8; color: #7a5200; font-size: 14px;
}
.typ-selftest { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.typ-selftest summary { cursor: pointer; font-size: 13.5px; color: var(--primary); }
.typ-diag { margin-top: 8px; background: #f8fbfb; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; word-break: break-all; }
.typ-diag-line { padding: 3px 0; border-bottom: 1px dashed #e9f0f0; }
.typ-diag-line:last-child { border-bottom: none; }
.typ-diag code { background: #eef3f3; border-radius: 4px; padding: 0 4px; font-size: 12.5px; }

/* 屏幕键盘 */
.typ-keys { margin: 10px 0 4px; overflow-x: auto; padding-bottom: 4px; }
.tk-row { display: flex; gap: 4px; margin-bottom: 4px; min-width: 520px; }
.tk {
  flex: 1 1 0; min-width: 34px; min-height: 46px; border-radius: 8px; border: 1px solid var(--line);
  background: #f7fafa; padding: 5px 2px; text-align: center; line-height: 1.2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 16px; color: var(--ink); transition: background .08s, box-shadow .08s;
}
/* 上排的声调/上元音符号单独占一行，别和下面主字符挤在一起 */
.tk .tk-th { font-size: 16px; line-height: 1.3; }
.tk .tk-th2 { font-size: 12px; line-height: 1.25; min-height: 15px; color: #b9c7c7; }
.tk .tk-us { font-size: 9.5px; line-height: 1.1; color: #a9b8b8; letter-spacing: .3px; }
.tk-nothai { background: #f2f5f5; color: #c3cfcf; }
.tk-mod { background: #eef3f3; color: var(--muted); font-size: 11px; }
.tk-space .tk-us { display: none; }
.tk.next { background: #fff2d6; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(232,163,61,.45); }
.tk.next .tk-th { color: #8a5a00; font-weight: 700; }
.tk.next-shift { background: #ffe3b0; border-color: var(--accent); font-weight: 700; }
.f-l5 { box-shadow: inset 3px 0 0 #f0b8b8; }
.f-l4 { box-shadow: inset 3px 0 0 #f3d6a8; }
.f-l3 { box-shadow: inset 3px 0 0 #cfe3b0; }
.f-l2 { box-shadow: inset 3px 0 0 #b7dbe8; }
.f-r2 { box-shadow: inset -3px 0 0 #b7dbe8; }
.f-r3 { box-shadow: inset -3px 0 0 #cfe3b0; }
.f-r4 { box-shadow: inset -3px 0 0 #f3d6a8; }
.f-r5 { box-shadow: inset -3px 0 0 #f0b8b8; }
.tk.next.f-l5, .tk.next.f-l4, .tk.next.f-l3, .tk.next.f-l2,
.tk.next.f-r2, .tk.next.f-r3, .tk.next.f-r4, .tk.next.f-r5 { background: #fff2d6; }

/* ---------- 练习时的紧凑排版（平板/手机软键盘弹出后，目标文本 + 整块键盘要同时看全） ---------- */
#typ-area { scroll-margin-top: 58px; }        /* 程序滚动时避开 sticky 顶栏，别把卡片顶进顶栏下面 */
.typ-input { scroll-margin-top: 58px; scroll-margin-bottom: 6px; }
/* 进入练习后隐藏大标题与说明段，省下 ~110px */
#view-typing.typing-live > h2,
#view-typing.typing-live > .hint { display: none; }

body.typ-compact #topbar .topbar-inner { padding: 6px 14px; }
body.typ-compact .view { padding: 8px 10px 24px; }
body.typ-compact .typ-card { padding: 8px 10px; margin-bottom: 8px; }
body.typ-compact .typ-bar { gap: 10px; font-size: 13px; }
body.typ-compact .typ-bar #typ-cpm, body.typ-compact .typ-bar #typ-acc { font-size: 15px; }
body.typ-compact .typ-progress { margin: 4px 0; }
body.typ-compact .typ-lastkey { margin-bottom: 4px; font-size: 12px; }
body.typ-compact .typ-meta { font-size: 12px; margin-bottom: 2px; min-height: 0; }
body.typ-compact .typ-text { font-size: 22px; line-height: 1.85; padding: 6px 8px; }
body.typ-compact .typ-zh { font-size: 13.5px; margin-top: 4px; min-height: 0; }
body.typ-compact .typ-finger { font-size: 12.5px; margin: 4px 0 2px; min-height: 0; }
body.typ-compact .typ-finger .typ-finger-t b { font-size: 15px; }
body.typ-compact .typ-keys { margin: 6px 0 2px; }
body.typ-compact .tk-row { gap: 3px; margin-bottom: 3px; min-width: 430px; }
body.typ-compact .tk { min-width: 30px; min-height: 34px; padding: 2px 1px; gap: 0; border-radius: 6px; }
body.typ-compact .tk .tk-th { font-size: 14px; line-height: 1.15; }
body.typ-compact .tk .tk-th2 { font-size: 10px; line-height: 1; min-height: 11px; }
body.typ-compact .tk .tk-us { font-size: 8.5px; line-height: 1; }
body.typ-compact .typ-actions { margin-top: 6px; gap: 6px; }
body.typ-compact .typ-actions .secondary { padding: 6px 10px; font-size: 13px; }
body.typ-compact .typ-focus-hint { margin-top: 4px; padding: 6px 10px; font-size: 13px; }

/* 极紧凑：横屏 + 软键盘同时出现时（可视高度 < 560px） */
body.typ-nano .typ-text { font-size: 20px; line-height: 1.8; padding: 4px 6px; }
body.typ-nano .typ-zh, body.typ-nano .typ-lastkey { display: none; }
body.typ-nano .tk { min-height: 28px; }
body.typ-nano .tk .tk-th { font-size: 13px; }
body.typ-nano .tk .tk-th2 { font-size: 9px; min-height: 9px; }
body.typ-nano .tk .tk-us { display: none; }
body.typ-nano .typ-actions .secondary { padding: 5px 8px; font-size: 12.5px; }

/* 成绩卡 */
.typ-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 6px 0; }
.typ-stat { background: #f8fbfb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; text-align: center; }
.typ-stat b { display: block; font-size: 20px; color: var(--primary); }
.typ-stat span { font-size: 12px; color: var(--muted); }
.typ-sum-list { max-height: 340px; overflow-y: auto; border-top: 1px solid var(--line); }
.typ-sum-row { display: flex; gap: 10px; align-items: baseline; padding: 6px 4px; border-bottom: 1px dashed #e4eded; font-size: 14px; }
.typ-sum-row .typ-sum-idx { color: var(--muted); font-size: 12px; min-width: 18px; }
.typ-sum-row .typ-sum-th { font-size: 16px; flex: 1; min-width: 0; word-break: break-word; }
.typ-sum-row.sum-bad { background: #fdf6f5; }
.typ-sum-row.sum-bad .typ-sum-stat { color: var(--err); font-weight: 600; }
.typ-sum-row .typ-sum-zh { color: var(--muted); font-size: 13px; }
.typ-sum-row .typ-sum-stat { color: var(--ok); font-size: 13px; white-space: nowrap; }
.typ-weak-inline { margin-top: 10px; font-size: 13px; color: var(--muted); }
.typ-key-chip { display: inline-flex; align-items: baseline; gap: 3px; background: #fff2d6; border: 1px solid var(--accent); border-radius: 8px; padding: 1px 8px; margin: 3px 4px 0 0; }
.typ-key-chip i { font-size: 11px; color: #8a5a00; font-style: normal; }
.typ-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.typ-weak-row { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px dashed #e9f0f0; font-size: 14px; flex-wrap: wrap; }
.typ-weak-row .th { font-size: 17px; }
.typ-weak-row .typ-key-big { font-size: 20px; color: var(--primary); }
.typ-weak-row .typ-weak-zh { color: var(--muted); font-size: 12.5px; }
.typ-weak-row .typ-weak-note { margin-left: auto; color: var(--muted); font-size: 12.5px; text-align: right; }
.typ-hist { font-size: 13px; color: var(--muted); }
.typ-hist-row { display: flex; gap: 12px; padding: 4px 0; border-bottom: 1px dashed #eef3f3; }
.typ-hist-row span:first-child { min-width: 84px; }
.typ-hist-row b { color: var(--primary); }
@media (max-width: 700px) {
  .typ-text { font-size: 24px; }
  .typ-two-col { grid-template-columns: 1fr; }
  .tk { min-width: 28px; font-size: 14px; }
  .tk .tk-th { font-size: 14px; }
  .tk-row { min-width: 440px; }
}

/* ================= 🎬 生活口语语料库 ================= */
.corp-bar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  background: #fff; border: 1px solid var(--line, #e6ecec); border-radius: 12px;
  padding: 10px 14px; margin: 12px 0 16px;
}
.corp-field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted, #6b7c7c); }
.corp-field select, .corp-field input {
  font: inherit; font-size: 14px; padding: 5px 8px; border: 1px solid var(--line, #e6ecec);
  border-radius: 8px; background: #fff; min-width: 110px;
}
.corp-field.corp-search input { min-width: 160px; }
.corp-count { margin-left: auto; font-size: 13px; color: var(--muted, #6b7c7c); }

.corp-nav { margin: 8px 0 12px; }
.corp-list { display: grid; gap: 14px; }
.corp-card {
  background: #fff; border: 1px solid var(--line, #e6ecec); border-radius: 14px;
  padding: 12px 14px 14px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}
.corp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.corp-src { font-weight: 600; font-size: 13.5px; color: var(--primary, #0b7a72); }
.corp-time { font-size: 12.5px; color: var(--muted, #6b7c7c); font-variant-numeric: tabular-nums; }
.corp-badge {
  font-size: 12px; padding: 2px 7px; border-radius: 999px;
  background: #f1f5f5; color: #4a5b5b; white-space: nowrap;
}
.corp-badge.ok { background: #e6f7ec; color: #1c7a3e; }
.corp-badge.warn { background: #fff6e0; color: #9a6b00; }
.corp-badge.bad { background: #fdeaea; color: #a52a2a; }
.corp-badge.gray { background: #f2f2f2; color: #888; }
.corp-badge.fam { background: #fff2d9; color: #a06a00; }

.corp-video-wrap { margin: 6px 0 10px; }
.corp-video {
  width: 100%; max-width: 560px; aspect-ratio: 16 / 9; background: #000;
  border-radius: 10px; display: block; position: relative; z-index: 0;
}
.corp-video-saved {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #e9f7ef; border: 1px solid #bfe3cd; border-radius: 8px;
  padding: 8px 12px; margin: 6px 0 10px; font-size: 14px; color: #17693c;
}
.corp-video-saved button {
  border: 1px solid #bfe3cd; background: #fff; color: #0d6e6e;
  border-radius: 8px; padding: 3px 10px; font-size: 13px; white-space: nowrap;
}
.corp-th {
  font-size: 20px; line-height: 1.75; margin: 4px 0 2px; color: #16292b;
  font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif; word-break: break-word;
}
.corp-zh { font-size: 14.5px; line-height: 1.7; color: #3d5152; margin: 0 0 2px; }
.corp-zh-todo { color: #b0b8b8; font-style: italic; }
.corp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.corp-btn {
  font: inherit; font-size: 13.5px; padding: 6px 12px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line, #e6ecec); background: #fff; color: #2c4444; text-decoration: none;
  display: inline-flex; align-items: center;
}
.corp-btn:hover { background: #f6fafa; }
.corp-btn.primary { background: var(--primary, #0b7a72); border-color: var(--primary, #0b7a72); color: #fff; }
.corp-btn.primary:hover { filter: brightness(1.08); }
.corp-btn[disabled] { opacity: .6; cursor: default; }
.corp-empty {
  padding: 22px; border: 1px dashed var(--line, #e6ecec); border-radius: 12px;
  color: var(--muted, #6b7c7c); font-size: 14px; line-height: 1.8; background: #fbfdfd;
}
.corp-empty code { background: #f1f5f5; padding: 1px 5px; border-radius: 5px; font-size: 13px; }

@media (max-width: 700px) {
  .corp-th { font-size: 18px; }
  .corp-count { margin-left: 0; width: 100%; }
  .corp-field { flex: 1 1 46%; }
}

/* 语料库：学习说明 + 分词行 + 中文自测开关 */
.corp-howto {
  background: #f4fbfa; border: 1px solid #d8ece8; border-radius: 12px;
  padding: 10px 14px; margin: 10px 0 14px; font-size: 14px; line-height: 1.75;
}
.corp-howto > summary { cursor: pointer; font-weight: 600; color: var(--primary, #0b7a72); }
.corp-howto-list { margin: 8px 0 4px; padding-left: 22px; }
.corp-howto-list li { margin-bottom: 5px; }
.corp-howto-tip { margin: 6px 0 0; color: #4a5b5b; font-size: 13.5px; }

.corp-sp {
  font-size: 14.5px; line-height: 1.9; color: #5a7a7a; margin: 2px 0 6px;
  word-spacing: 2px; letter-spacing: .3px;
  font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif;
}
.corp-note {
  font-size: 13.5px; line-height: 1.75; color: #4a5b5b; margin: 6px 0 0;
  background: #fbfdfd; border-left: 3px solid #cfe8e4; padding: 6px 10px; border-radius: 6px;
}
.corp-note b { color: var(--primary, #0b7a72); margin-right: 6px; }
.corp-mini {
  font: inherit; font-size: 12.5px; padding: 2px 8px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line, #e6ecec); background: #fff; color: #2c4444;
}
.corp-mini:hover { background: #f6fafa; }
/* 隐藏中文时：中文与语法点一起遮住（自测用） */
.corp-card.hide-zh .corp-zh,
.corp-card.hide-zh .corp-note { filter: blur(7px); cursor: pointer; user-select: none; }
.corp-card.hide-zh .corp-zh:hover,
.corp-card.hide-zh .corp-note:hover { filter: none; }

/* 微信推送失败横幅（首页，2026-09-29）：日报/周报推送失败时明确提示，不再静默丢报 */
.push-alert {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid #ecd6a8;
  border-left: 4px solid var(--warn, #c2700d);
  background: #fff9ec;
  color: #7a4a08;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.55;
}
.push-alert .pa-sub { margin-top: 4px; font-size: 13px; }
.push-alert a { color: var(--warn, #c2700d); font-weight: 600; text-decoration: underline; }

/* ============ 🎬 语料库：手机端优化 ============ */
/* 设计目标（按 360/390/430 实测）：说明不占满首屏、筛选栏压成紧凑两行、
   按钮触摸高度 ≥44px、泰文 21px 保证可读、顶栏不横向溢出 */
@media (max-width: 700px) {
  /* 1) 学习说明：默认折叠（由 JS 在手机上置 open=false），标题行可点 */
  .corp-howto { padding: 9px 12px; font-size: 13.5px; margin: 8px 0 12px; }
  .corp-howto > summary { font-size: 14px; padding: 2px 0; }
  .corp-howto-list { padding-left: 18px; }
  .corp-howto-list li { margin-bottom: 4px; line-height: 1.7; }

  /* 2) 筛选栏：紧凑两行，控件撑满可用宽度，触摸高度加大 */
  .corp-bar {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px;
    padding: 10px 12px; margin: 10px 0 14px; border-radius: 10px;
  }
  .corp-field { flex: none; min-width: 0; }
  .corp-field.corp-search { grid-column: 1 / -1; }
  .corp-field select, .corp-field input {
    width: 100%; min-width: 0; height: 42px; font-size: 15px; padding: 6px 10px;
    box-sizing: border-box;
  }
  /* 覆盖桌面端的 min-width（110px / 160px），否则控件会顶出网格格子 */
  .corp-field select { min-width: 0 !important; }
  .corp-field.corp-search input { min-width: 0 !important; }
  .corp-count { grid-column: 1 / -1; margin: 2px 0 0; font-size: 13px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .corp-mini { min-height: 34px; padding: 5px 12px; font-size: 13px; }

  /* 3) 卡片：间距收紧、视频贴边铺满、按钮 ≥44px 触摸高度 */
  .corp-list { gap: 12px; }
  .corp-card { padding: 12px; border-radius: 12px; }
  .corp-head { gap: 6px; margin-bottom: 8px; }
  .corp-src { font-size: 13px; line-height: 1.4; }
  .corp-time { font-size: 12px; }
  .corp-badge { font-size: 11.5px; padding: 2px 6px; }
  .corp-video { max-width: none; width: 100%; border-radius: 8px; }
  .corp-video-wrap { margin: 6px 0 10px; }

  /* 泰文加大到 21px / 行高 1.8 —— 手机上远看也清楚 */
  .corp-th { font-size: 21px; line-height: 1.8; margin: 6px 0 4px; }
  .corp-sp { font-size: 15px; line-height: 1.85; margin: 2px 0 8px; word-spacing: 1px; }
  .corp-zh { font-size: 15.5px; line-height: 1.7; margin: 2px 0 0; }
  .corp-note { font-size: 13.5px; line-height: 1.7; padding: 8px 10px; margin-top: 8px; }

  /* 4) 按钮：两列网格，保证点击区域 */
  .corp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .corp-btn {
    min-height: 44px; justify-content: center; font-size: 14px; padding: 8px 10px;
    border-radius: 10px; text-align: center;
  }
  /* 「收入生词本」是主要动作，占满一行更好按 */
  .corp-btn.primary { grid-column: 1 / -1; }
  .corp-video-saved { min-height: 44px; padding: 10px 12px; font-size: 14px; }
}

@media (max-width: 380px) {
  .corp-bar { grid-template-columns: 1fr; }
  .corp-field.corp-search { grid-column: 1; }
  .corp-th { font-size: 20px; }
  .corp-actions { grid-template-columns: 1fr; }
  .corp-btn.primary { grid-column: 1; }
}

/* 5) 顶栏在窄屏允许换行，避免横向溢出（原为单行 nowrap） */
@media (max-width: 420px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 4px; }
  .topbar-right { flex-wrap: wrap; row-gap: 4px; }
  .topbar-right .link-btn { padding: 4px 6px; font-size: 13px; }
}

/* 6) 手机端：视频吸顶（向下读台词时画面不滑走）
   注意 top 用 JS 实测的顶栏高度写入 --corp-sticky-top，避免挡字 */
@media (max-width: 700px) {
  .corp-video-wrap {
    position: sticky; top: var(--corp-sticky-top, 54px); z-index: 5;
    background: #fff; padding-bottom: 6px; margin-bottom: 8px;
    box-shadow: 0 6px 10px -8px rgba(0, 0, 0, .25);
  }
}

/* ============ 语料库手机端：第二轮（首屏压缩） ============ */
/* 目标：390px 手机上第一张卡片从 y≈697 提到 y≈330 以内 */
.hint-short { display: none; }
.corp-filter-toggle { display: none; }   /* 桌面端不需要折叠按钮 */

@media (max-width: 700px) {
  /* 1) 顶部说明：手机上用短版（原 4 行 → 2 行） */
  .hint-full { display: none; }
  .hint-short { display: inline; }
  #view-corpus h2 { font-size: 20px; margin: 0 0 6px; }
  #view-corpus > .hint { margin: 0 0 10px; line-height: 1.65; }
  #view-corpus .corp-nav { margin: 0 0 10px; }
  .corp-nav .ghost-btn { min-height: 38px; padding: 6px 12px; font-size: 13.5px; }

  /* 2) 筛选栏：默认折叠，只留一行「🔍 筛选与搜索」 */
  .corp-filter-toggle {
    display: flex; align-items: center; justify-content: space-between;
    grid-column: 1 / -1; width: 100%; min-height: 44px; padding: 0 12px;
    font: inherit; font-size: 14.5px; color: #2c4444; cursor: pointer;
    background: #f6fafa; border: 1px solid var(--line, #e6ecec); border-radius: 9px;
  }
  .corp-filter-toggle .corp-chev { transition: transform .18s; opacity: .7; }
  .corp-bar.open .corp-filter-toggle .corp-chev { transform: rotate(180deg); }
  .corp-bar:not(.open) .corp-field { display: none; }
  .corp-bar { padding: 8px 10px; gap: 8px; }
  .corp-bar.open { padding-bottom: 10px; }

  /* 3) 控件更紧凑（原 65px/格 → 58px） */
  .corp-field { gap: 2px; font-size: 12px; }
  .corp-field select, .corp-field input { height: 40px; font-size: 14.5px; padding: 4px 9px; }
  .corp-count { margin-top: 0; font-size: 13px; gap: 6px; }
  .corp-mini { min-height: 32px; padding: 4px 10px; }

  /* 4) 卡片再紧一点，一屏能看到「视频 + 泰文 + 分词」 */
  .corp-card { padding: 10px 12px 12px; }
  .corp-th { margin: 4px 0 2px; }
  .corp-sp { margin: 0 0 6px; }
  .corp-actions { margin-top: 10px; gap: 7px; }
  .corp-btn { min-height: 42px; }
}

/* 5) 顶栏：手机上换行后高 84px，压到两行以内并缩短吸顶偏移 */
@media (max-width: 700px) {
  .topbar-inner { padding: 8px 10px; row-gap: 2px; }
  .brand { font-size: 15px; }
  .user-name { font-size: 12.5px; }
  .topbar-right { gap: 4px 8px; }
  .link-btn { font-size: 13px; padding: 4px 6px; }
}

/* ============ 语料专题（N 个独立片段） ============ */
.clip-now {
  font-size: 12.5px; color: var(--muted, #6b7c7c); margin: 6px 0 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.clip-chip {
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  padding: 8px 10px; border: 1px solid var(--line, #e6ecec); border-radius: 10px;
  background: #fff; font: inherit; color: inherit;
}
.clip-chip:hover { background: #f6fafa; border-color: #bfe0dc; }
.clip-chip.active { background: #e9f7f5; border-color: var(--primary, #0b7a72); }
.clip-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700;
  background: var(--primary, #0b7a72); color: #fff;
}
.clip-th {
  font-size: 15px; line-height: 1.5; color: #16292b;
  font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif;
  word-break: break-word;
}
.clip-zh { font-size: 12.5px; color: #5c7070; line-height: 1.4; }

.ts-line .ts-note { font-size: 12.5px; color: #7a6a3a; line-height: 1.6; margin-top: 3px; }
.ts-line .ts-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 5px; }
.ts-line .ts-src { font-size: 12px; color: var(--muted, #6b7c7c); }
.ghost-btn.mini { font-size: 12px; padding: 2px 8px; }
/* 隐藏译文时把中文与语法点一起遮住（自测） */
#script-lines.hide-zh .ts-zh,
#script-lines.hide-zh .ts-note { filter: blur(6px); }

@media (max-width: 700px) {
  .clip-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .clip-chip { padding: 7px 9px; }
  .clip-th { font-size: 14px; }
  .clip-zh { font-size: 12px; }
  .ts-line .ts-th { font-size: 17px; }
  .ghost-btn.mini { min-height: 32px; }
}

/* 顶栏「🎬 语料库」入口已取消（语料改为课程里的专题）；
   模块保留可用（有需时可从代码里恢复），此处只隐藏入口按钮。 */
#btn-corpus { display: none !important; }
/* 语料库页里那个「打开生词本」按钮与顶栏重复，一并隐藏 */
#view-corpus .corp-nav { display: none !important; }

/* 进入语料专题时的首次提示（点了片段就撤掉） */
.clip-hint { margin-left: 6px; color: var(--primary, #0b7a72); font-size: 12px; }

/* ==== 语料专题：背景资料（完整视频 + 章节目录） ==== */
.bg-card { border: 1px solid var(--line, #e6ecec); border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; background: #fbfdfd; }
.bg-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; margin-bottom: 8px; }
.bg-head b { font-size: 14.5px; }
.bg-head .note { font-size: 12.5px; color: var(--muted, #6b7c7c); }
.bg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.bg-chapters { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-ch {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font: inherit;
  padding: 5px 9px; border: 1px solid var(--line, #e6ecec); border-radius: 8px; background: #fff;
  font-size: 13px; color: #2c4444; max-width: 100%;
}
.bg-ch:hover { background: #f2fafa; border-color: #bfe0dc; }
.bg-ch-t { font-variant-numeric: tabular-nums; color: var(--primary, #0b7a72); font-weight: 600; }
.bg-ch-n { color: var(--muted, #6b7c7c); font-size: 12px; }
.bg-ch-th { color: #16292b; font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
/* 背景完整视频与分片段共用同一个播放器（#topic-video），故不再需要独立的 .bg-player */
@media (max-width: 700px) {
  .bg-ch-th { max-width: 130px; }
  .bg-chapters { gap: 5px; }
  .bg-ch { min-height: 36px; }
}

/* 打开背景完整视频时，取消分片段播放器的吸顶，避免两个播放窗口重叠 */
.topic-video-float.no-sticky { position: static; top: auto; z-index: auto; }

/* ================= 📖 阅读增量（分级阅读 / 阅读词量 / 新见词汇） ================= */
.rd-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.rd-card h3 { margin: 0 0 10px; }

/* 统计卡 */
.rd-stats-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 18px; }
.rd-today-num { font-size: 44px; line-height: 1; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.rd-today-num .rd-unit { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.rd-today-sub { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.rd-today-sub b { color: var(--ink); font-size: 15px; }
.rd-badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; white-space: nowrap; }
.rd-badge.ok { background: #e6f7ec; color: var(--ok); }
.rd-goal-field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rd-goal-field select { width: auto; min-width: 96px; font-size: 14px; padding: 6px 8px; }
.rd-progress { height: 10px; background: #eef3f3; border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
#rd-progress-fill { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .25s; }
#rd-progress-fill.done { background: var(--ok); }
.rd-remaining { font-size: 13px; color: var(--muted); }
#rd-home.rd-done .rd-remaining { color: var(--ok); font-weight: 600; }
.rd-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.rd-kpi { background: #f8fbfb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rd-kpi b { font-size: 16px; color: var(--primary); font-variant-numeric: tabular-nums; }
.rd-kpi-lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-kpi-ico { font-size: 13px; }
.rd-week-box { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.rd-week-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rd-week { display: flex; align-items: flex-end; gap: 6px; min-width: 0; }
.rd-day { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rd-day-num { font-size: 10.5px; color: var(--muted); font-weight: 400; min-height: 14px; font-variant-numeric: tabular-nums; }
.rd-day-track { width: 100%; height: 76px; display: flex; align-items: flex-end; justify-content: center; background: #f5f9f9; border-radius: 6px; }
.rd-day-track i { display: block; width: 72%; max-width: 34px; background: #9fd4d4; border-radius: 5px 5px 0 0; }
.rd-day.today .rd-day-track { background: #eaf6f4; }
.rd-day.today .rd-day-track i { background: var(--primary); }
.rd-day.today .rd-day-label { color: var(--primary); font-weight: 600; }
.rd-day-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* 今日建议 */
.rd-plan-title { font-size: 15.5px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.rd-plan-sub { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.rd-plan-sub.rd-warn { color: var(--warn); }
.rd-plan-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.rd-plan-item { display: flex; flex-direction: column; gap: 2px; text-align: left; background: #f8fbfb; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; color: var(--ink); }
.rd-plan-item:hover { background: #f2fafa; border-color: #bfe0dc; }
.rd-plan-item-t { font-size: 15px; line-height: 1.5; word-break: break-word; }
.rd-plan-item-m { font-size: 12px; color: var(--muted); }
.rd-plan-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-plan-actions .primary { width: auto; padding: 10px 26px; }
.rd-start[disabled] { opacity: .55; cursor: not-allowed; }

/* 材料库 */
.rd-lib-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.rd-lib-head h3 { margin: 0; }
.rd-lib-count { font-size: 13px; color: var(--muted); margin-left: auto; }
.rd-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.rd-field { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.rd-field select, .rd-field input { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-width: 0; }
.rd-field select { width: 108px; }
.rd-field.rd-field-q { flex: 1 1 180px; }
.rd-field.rd-field-q input { width: 100%; }
.rd-lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 12px; }
.rd-lib-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: transform .08s, box-shadow .08s; min-width: 0; }
.rd-lib-card:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(13,110,110,.10); border-color: #bfe0dc; }
.rd-lib-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.rd-src-badge { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: #eaf6f4; color: var(--primary); white-space: nowrap; }
.rd-level { font-size: 12px; color: var(--accent); white-space: nowrap; }
.rd-star-off { color: #d7dede; }
.rd-read-badge { font-size: 11.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.rd-read-badge.unread { color: var(--primary); background: #f0f7f7; border-radius: 999px; padding: 1px 8px; }
.rd-lib-th { font-size: 18px; line-height: 1.6; color: #16292b; word-break: break-word; }
.rd-lib-zh { font-size: 13px; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.rd-lib-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); margin-top: 7px; }
.rd-empty { grid-column: 1 / -1; padding: 22px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 14px; background: #fbfdfd; text-align: center; }

/* 阅读器 */
.rd-reader-head { border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.rd-reader-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rd-reader-title-row h3 { margin: 0; font-size: 18px; line-height: 1.5; word-break: break-word; }
.rd-title-th { font-size: 17px; color: var(--muted); margin-top: 3px; word-break: break-word; }
.rd-reader-note { font-size: 12.5px; color: #6b7c7c; background: #f7fbfa; border-left: 3px solid #cfe8e4; border-radius: 0 6px 6px 0; padding: 6px 10px; margin-top: 8px; line-height: 1.7; }
.rd-reader-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.rd-mini { font-size: 12.5px; color: var(--primary); text-decoration: none; border: 1px solid var(--line); border-radius: 7px; padding: 2px 8px; background: #fff; }
.rd-mini:hover { background: #f6fafa; }
.rd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 8px; }
.rd-tool { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: #f7fafa; color: var(--ink); white-space: nowrap; }
.rd-tool:hover { background: #eef6f6; }
.rd-tool.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.rd-timer { margin-left: auto; font-size: 13px; color: var(--primary); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rd-body { line-height: 2.25; padding: 2px 0; word-break: break-word; overflow-wrap: anywhere; }
.rd-line { margin: 0 0 12px; }
.rd-line-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 2px; }
.rd-who { font-size: 12px; color: var(--primary); background: #eaf6f4; border-radius: 999px; padding: 1px 8px; }
.rd-line-th { margin: 0; font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif; }
.rd-w { cursor: pointer; border-radius: 4px; padding: 0 1px; transition: background .08s; }
.rd-w:hover { background: #fff2d6; }
.rd-unknown { border-bottom: 1px dashed rgba(232,163,61,.65); }
.rd-body.sp .rd-w { margin-right: 3px; }
.rd-line-zh { display: none; margin: 2px 0 0; font-size: 14px; line-height: 1.7; color: #3d5152; }
.rd-body.show-zh .rd-line-zh { display: block; }
.rd-line-note { margin: 4px 0 0; font-size: 12.5px; line-height: 1.65; color: #7a6a3a; background: #fdfbf3; border-left: 3px solid #ecd9a8; padding: 4px 8px; border-radius: 0 6px 6px 0; }
.rd-reader-foot { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.rd-rate { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.rd-rate-label { font-size: 12.5px; color: var(--muted); }
.rd-rate-btn { font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.rd-rate-btn.on { background: #fff2d6; border-color: var(--accent); color: #8a5a00; font-weight: 600; }
.rd-foot-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rd-complete { width: auto; padding: 10px 18px; }

/* 完成总结 */
.rd-sum-title { font-size: 18px; font-weight: 700; }
.rd-sum-main { font-size: 17px; margin-top: 4px; color: var(--ink); }
.rd-sum-main b { color: var(--primary); font-size: 22px; }
.rd-sum-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.rd-new-title { font-size: 13.5px; color: var(--muted); margin-top: 12px; }
.rd-new-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rd-new-chip { display: inline-flex; align-items: center; gap: 3px; background: #f7fafa; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }
.rd-new-chip .th { font-size: 15px; }
.rd-chip-btn { border: none; background: none; padding: 1px 2px; font-size: 13px; cursor: pointer; border-radius: 5px; }
.rd-chip-btn:hover { background: #e8f4f4; }
.rd-sum-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.rd-sum-actions .primary, .rd-sum-actions .secondary { width: auto; padding: 9px 18px; }
.rd-sum-tip { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }

/* 底部词卡 */
#rd-word-sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.rd-sheet-mask { position: absolute; inset: 0; background: rgba(10, 30, 30, .38); }
.rd-sheet-card { position: relative; width: 100%; max-width: 860px; max-height: 78vh; overflow-y: auto; background: #fff; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2); }
.rd-sheet-close { position: absolute; top: 10px; right: 12px; border: none; background: #eef3f3; color: var(--muted); width: 32px; height: 32px; border-radius: 50%; font-size: 15px; cursor: pointer; }
.rd-sheet-word { font-size: 28px; line-height: 1.5; font-family: "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif; word-break: break-word; padding-right: 34px; }
.rd-sheet-pron { font-size: 14px; color: var(--primary); margin-top: 2px; word-break: break-word; }
.rd-sheet-zh { font-size: 16px; margin-top: 6px; color: var(--ink); }
.rd-sheet-zh.rd-muted { color: var(--muted); }
.rd-sheet-ex { margin: 10px 0 0; font-size: 16px; line-height: 1.8; color: #16292b; background: #f8fbfb; border-radius: 8px; padding: 8px 10px; word-break: break-word; }
.rd-sheet-exzh { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.rd-sheet-src { font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.rd-sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.rd-btn { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.rd-btn:hover { background: #f6fafa; }
.rd-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.rd-btn.primary:hover { filter: brightness(1.08); }
.rd-btn[disabled] { opacity: .6; cursor: default; }
.rd-sheet-ok { font-size: 13px; color: var(--ok); font-weight: 600; }

/* 手机端 */
@media (max-width: 700px) {
  .rd-today-num { font-size: 36px; }
  .rd-kpis { grid-template-columns: repeat(2, 1fr); }
  .rd-lib { grid-template-columns: 1fr; }
  .rd-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
  .rd-field select { width: 100%; }
  .rd-field.rd-field-q { grid-column: 1 / -1; }
  .rd-lib-count { margin-left: 0; width: 100%; }
  .rd-toolbar { gap: 5px; }
  .rd-tool { padding: 6px 9px; }
  .rd-timer { margin-left: 0; }
  .rd-reader-title-row h3 { font-size: 16.5px; }
  .rd-lib-th { font-size: 17px; }
  .rd-sheet-word { font-size: 25px; }
  .rd-reader-foot { flex-direction: column; align-items: stretch; }
  .rd-foot-actions { width: 100%; }
  .rd-foot-actions .secondary, .rd-foot-actions .primary { flex: 1 1 0; width: auto; }
  .rd-sum-actions .primary, .rd-sum-actions .secondary { flex: 1 1 0; }
}
@media (max-width: 380px) {
  .rd-filters { grid-template-columns: 1fr; }
  .rd-field.rd-field-q { grid-column: 1; }
}

/* ================= 📖 阅读增量 v2：🎙 朗读录音（whisper 识别） ================= */
.rd-rec {
  margin-top: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fbfdfd; padding: 12px 14px;
}
.rd-rec-head { font-size: 15px; font-weight: 600; color: var(--ink); }
.rd-rec-hint { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); line-height: 1.6; margin-top: 2px; }
.rd-rec-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.rd-rec-btn { flex: 0 0 auto; }
#rd-rec-start { background: #fdecea; border-color: #f0c4bd; color: #a33025; }
#rd-rec-start:hover { background: #fbe0dc; }
#rd-rec-start:disabled { opacity: .5; }
#rd-rec-stop { background: #fff6e6; border-color: #ecd6a8; color: #7a4d05; }
.rd-rec-time {
  font-size: 14px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
#rd-rec-audio { height: 36px; max-width: 100%; margin-left: 4px; }
.rd-rec-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
#rd-rec-upload { flex: 0 0 auto; }
.rd-rec-status { flex: 1 1 100%; font-size: 12.5px; line-height: 1.65; color: var(--muted); margin-top: 2px; }
.rd-rec-status.err { color: var(--err); }
.rd-rec-status.ok { color: var(--ok); }
.rd-rec-result {
  margin-top: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px;
}
.rd-rec-result-main { font-size: 14.5px; line-height: 1.7; }
.rd-rec-result-main b { color: var(--primary); font-size: 16px; }
.rd-rec-missed-title { font-size: 12px; color: var(--muted); margin-top: 7px; }
.rd-rec-missed { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.rd-rec-missed-w {
  font-size: 14px; line-height: 1.5; background: #fff2d6; border: 1px solid #ecd9a8;
  color: #7a5200; border-radius: 999px; padding: 1px 9px;
}
.rd-rec-fail { font-size: 13px; color: var(--err); line-height: 1.6; }

@media (max-width: 700px) {
  .rd-rec { padding: 10px 12px; border-radius: 10px; }
  .rd-rec-controls { gap: 6px; }
  .rd-rec-controls .rd-btn { flex: 1 1 auto; min-height: 42px; justify-content: center; }
  .rd-rec-upload-row { gap: 6px; }
  .rd-rec-upload-row .rd-btn { flex: 1 1 46%; min-height: 42px; justify-content: center; }
  #rd-rec-audio { width: 100%; margin-left: 0; }
  .rd-rec-time { flex: 0 0 auto; }
}

/* ===== 阅读增量：泰文字体切换（手写体 Itim / 印刷体） =====
   默认手写体（易认），点工具栏「🖋 手写体 / 🅰 印刷体」切换；只影响阅读增量视图，不动其它模块。 */
#view-reading.rd-hand .rd-line-th,
#view-reading.rd-hand .rd-title-th,
#view-reading.rd-hand .rd-lib-th,
#view-reading.rd-hand .rd-plan-item-t,
#view-reading.rd-hand .rd-sheet-word,
#view-reading.rd-hand .rd-sheet-pron,
#view-reading.rd-hand .rd-sheet-ex,
#view-reading.rd-hand .rd-rec-missed-w,
#view-reading.rd-hand .rd-new-chip .th,
#view-reading.rd-hand .rd-word-sheet .th {
  font-family: 'Itim', "Leelawadee UI", "Noto Sans Thai", "Tahoma", sans-serif;
}
#view-reading.rd-hand .rd-line-th { line-height: 1.95; }

