/* EchoLingo · 回声语言 — 英语/西语视频精读
   双主题（浅色 / 深色）+ 中英界面，桌面优先，窄屏可用。
   所有颜色都走变量：换主题只改下面的变量块。 */

/* ── 视觉令牌 ─────────────────────────────────────────────────────
   恢复重构前的原始配色（3.13.2 基线）：
   浅色冷白灰、深色深灰蓝。强调蓝只用于当前句 / 播放 / 选中，
   导入等普通操作保持面板中性色，不做蓝底或反色实心块。 */
:root {
  /* 浅色（默认） */
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fbfbfd;
  --line: #e3e6ec;
  --line-strong: #d2d7e0;
  --line-hover: #b9c1ce;
  --text: #1b1f27;
  --text-2: #5a6473;
  --text-3: #8b93a3;
  --brand: #1f6feb;
  --brand-hover: #1a60d0;
  --brand-soft: #eaf1fe;
  --brand-line: #c3d8fb;
  --warn: #b4741a;
  --warn-soft: #fdf3e3;
  --ok: #1a7f52;
  --ok-soft: #e8f6ef;
  --bad: #c0392b;
  --mark: #fff2a8;
  --mark-line: #f0d95c;
  --hover-bg: #e7eefc;
  --hover-2: #e6eaf1;
  --seg-bg: #eef1f6;
  --track: #e9ecf2;
  --cue-hover: #f7f9fc;
  --scroll: #d6dbe4;
  --scroll-hover: #c2c9d5;
  --hl-soft: #eef3fd;
  --toast-bg: #1e242e;
  --toast-text: #f2f5f9;
  --stage-bg: #10141b;
  --stage-2: #16202e;

  /* 逐词跟读：已说过的词浅绿，当前词再深一档 */
  --karaoke: #cdf3dd;
  --karaoke-now: #8fe0b0;
  --karaoke-text: #0d5c37;

  --radius: 9px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(20, 26, 38, .06), 0 1px 3px rgba(20, 26, 38, .04);
  --shadow-2: 0 8px 28px rgba(20, 26, 38, .12), 0 2px 6px rgba(20, 26, 38, .06);
  --sub-font: 18px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1116;
  --panel: #161a21;
  --panel-2: #1b2029;
  --line: #262c36;
  --line-strong: #333a46;
  --line-hover: #454e5d;
  --text: #e6e9ef;
  --text-2: #a7b0be;
  --text-3: #77808f;
  --brand: #4c8dff;
  --brand-hover: #6aa0ff;
  --brand-soft: #1b2740;
  --brand-line: #2c4372;
  --warn: #e0a44a;
  --warn-soft: #332a17;
  --ok: #3fbe83;
  --ok-soft: #142c22;
  --bad: #e06c5f;
  --mark: #5c4f16;
  --mark-line: #8a7620;
  --hover-bg: #222c3f;
  --hover-2: #242b36;
  --seg-bg: #1f242e;
  --track: #242a34;
  --cue-hover: #1c222b;
  --scroll: #39414e;
  --scroll-hover: #4a5361;
  --hl-soft: #1e2b40;
  --toast-bg: #2a323e;
  --toast-text: #eef2f7;
  --stage-bg: #080a0e;
  --stage-2: #131a26;

  --karaoke: rgba(64, 196, 124, .22);
  --karaoke-now: rgba(78, 219, 146, .48);
  --karaoke-text: #a6f2c8;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-2: 0 10px 32px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* 作者样式里的 display:flex 会盖掉 UA 的 [hidden]，这里统一兜底 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  /* 平板/手机上点任何东西都会闪一层灰，很难看，去掉 */
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* dvh 解决 iPad / 安卓浏览器地址栏收缩后 100vh 比可视区高一截的问题 */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 7px 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  flex: 0 0 auto; z-index: 20;
  flex-wrap: wrap; row-gap: 6px;
}
/* 左侧一组：品牌标识 + 学习语言模式。两者黏在一起，
   否则 space-between 会把模式按钮推到屏幕中间。 */
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  color: var(--text-2); font-weight: 700; font-size: 11.5px; letter-spacing: .4px;
  display: grid; place-items: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 14px; letter-spacing: .1px; }
.brand-text span { font-size: 11px; color: var(--text-3); white-space: nowrap; }

.topbar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  min-height: 34px;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--panel-2); border-color: var(--line-hover); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
/* 主操作：仍是中性底 + 深色字，只靠描边加重强调，避免「反色实心块」。 */
.btn-primary { background: var(--panel); border-color: var(--text-2); color: var(--text); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--hover-bg); border-color: var(--text); color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 12px; min-height: 28px; }
.btn-icon { padding: 7px; min-width: 34px; min-height: 34px; justify-content: center; }
.btn-lang span { font-size: 11.5px; font-weight: 700; letter-spacing: .4px; min-width: 22px; text-align: center; }

/* 顶栏里的次要操作：图标 + 短标签，比整排文字按钮安静得多 */
.topbar-actions .btn { padding: 6px 10px; }
.topbar-actions .btn-icon { padding: 6px; }
.topbar-sep { width: 1px; height: 20px; background: var(--line); flex: 0 0 auto; }
.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* 齿轮细节比别的图标密，15px 下 1.7 的描边会糊成一团，单独压细一点 */
.ico-gear { stroke-width: 1.45; }
.ico-lg { width: 20px; height: 20px; }
.pill {
  background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 600;
}

/* ---------- 布局 ---------- */
.workspace { display: flex; flex: 1 1 auto; min-height: 0; gap: 10px; padding: 10px; }

.stage { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px; }

.player-wrap {
  position: relative; flex: 1 1 auto; min-height: 0;
  background: var(--stage-bg); border-radius: var(--radius); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#player { width: 100%; height: 100%; object-fit: contain; background: var(--stage-bg); }
#player:not([src]) { display: none; }

/* 纯音频：把播放区压扁，避免一块没用的黑屏占满屏幕 */
.player-wrap.audio-only { flex: 0 0 auto; min-height: 0; height: 168px; }
.player-wrap.audio-only #player { position: absolute; inset: 0; height: 100%; opacity: .06; }
.audio-badge {
  position: relative; z-index: 2; text-align: center; color: #e8ecf3;
  padding: 0 24px; max-width: 90%;
}
.audio-badge .ab-title { font-size: 15px; font-weight: 600; word-break: break-all; }
.audio-badge .ab-sub { font-size: 12px; color: #8b96a7; margin-top: 6px; }

/* ---------- 拖放区 ---------- */
.dropzone {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--panel); padding: 24px; text-align: center; color: var(--text);
}
.dropzone.hide { display: none; }
.dropzone.drag { background: var(--hover-bg); }
.dropzone.drag .dz-inner { border-color: var(--brand); background: var(--brand-soft); }
.dz-inner {
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 30px 34px; max-width: 500px; width: 100%;
  transition: border-color .18s, background .18s;
}
.dz-ico { width: 32px; height: 32px; fill: none; stroke: var(--text-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.dz-inner h2 { font-size: 16.5px; margin-bottom: 6px; color: var(--text); }
.dz-inner p { margin: 0 0 14px; font-size: 12.5px; line-height: 1.7; color: var(--text-2); }
.dz-main { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 14px; }
.dz-btns { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.dz-btns .btn { background: var(--panel); border-color: var(--line-strong); color: var(--text); min-height: 40px; }
.dz-btns .btn:hover { background: var(--hover-2); }
.dz-btns .btn-primary { background: var(--panel); border-color: var(--text-2); color: var(--text); font-weight: 600; }
.dz-btns .btn-primary:hover { background: var(--hover-bg); border-color: var(--text); }
.dz-secondary { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dz-secondary .btn { border-color: transparent; background: transparent; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); font-size: 12px; padding: 6px 4px; }
.dz-secondary .btn:hover { color: var(--text); background: transparent; text-decoration-color: var(--text-2); }
.dz-hint { margin: 0 !important; font-size: 11.5px !important; color: var(--text-3) !important; }
.dz-private { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-3); }
.dz-private svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* 大字阅读区：纯音频时填补播放器下方的空白，同时给精读一个更舒服的视距 */
.bigscreen {
  flex: 1 1 auto; min-height: 120px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  padding: 22px 26px; display: flex; flex-direction: column;
  justify-content: center; gap: 10px;
}
.bigscreen::-webkit-scrollbar { width: 9px; }
.bigscreen::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 9px; }
.bs-tag {
  font-size: 11px; color: var(--text-3); letter-spacing: .6px;
  text-transform: uppercase; font-variant-numeric: tabular-nums;
}
.bs-en { font-family: Georgia, "Times New Roman", serif; font-size: 25px; line-height: 1.52; color: var(--text); }
.bs-mid { font-size: 18px; line-height: 1.6; color: var(--text-2); margin-top: 4px; }
.bs-zh { font-size: 16px; line-height: 1.65; color: var(--text-2); }
.bs-empty { color: var(--text-3); }
.bs-en .w { cursor: pointer; }
.bs-en .w:hover { background: var(--hover-bg); box-shadow: 0 0 0 1px var(--brand-line); }
.bs-en .w.saved { border-bottom: 2px solid var(--brand); }

/* ---------- 播放条 ---------- */
.player-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 6px 8px;
}
.pb-btn {
  padding: 6px 10px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; cursor: pointer; font-size: 12.5px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 36px; min-width: 36px; color: var(--text-2);
}
.pb-btn:hover { background: var(--hover-2); color: var(--text); }
/* 播放状态是强调色唯一该出现的地方之一 */
.pb-btn.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.pb-play { padding: 6px 14px; background: var(--panel-2); border-color: var(--line-strong); color: var(--text); }
.pb-play:hover { background: var(--hover-2); }
.pb-time { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-left: 2px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pb-seek { flex: 1 1 140px; min-width: 100px; accent-color: var(--brand); }
.pb-right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.pb-rate { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 5px; }
.pb-rate select { padding: 5px 6px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); min-height: 34px; }
.pb-adv { margin-left: auto; }
@media (max-width: 720px) {
  .pb-time { order: 5; flex: 0 0 auto; }
  .pb-seek { order: 6; flex: 1 1 100%; }
  .pb-right { margin-left: 0; flex: 1 1 100%; justify-content: flex-start; }
  .pb-adv { margin-left: 0; }
}

/* ---------- 状态与进度 ---------- */
.stage-foot {
  display: flex; flex-direction: column; gap: 6px;
  padding: 2px 2px 0;
}
.statusline { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-3); flex-wrap: wrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: 0 0 auto; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.dot.busy { background: var(--brand); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
.sep { width: 1px; height: 11px; background: var(--line-strong); margin: 0 3px; }
.progress { display: flex; align-items: center; gap: 9px; }
.progress-bar { flex: 1 1 auto; height: 5px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 999px; transition: width .18s ease; }
.progress span { font-size: 11.5px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 右侧字幕 ---------- */
.reader {
  flex: 0 0 clamp(340px, 36vw, 540px);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
}
.reader-head { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.reader-search {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel-2); outline: none;
  min-height: 34px;
}
.reader-search:focus { border-color: var(--text-3); }
.reader-search:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.reader-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; min-height: 24px; }
.reader-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 20px; scroll-behavior: smooth; }
.reader-body::-webkit-scrollbar { width: 9px; }
.reader-body::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 9px; border: 2px solid var(--panel); }
.reader-body::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }

.seg { display: inline-flex; background: var(--seg-bg); border-radius: 8px; padding: 2px; gap: 2px; align-self: flex-start; }
.seg button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  min-height: 28px;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }

/* 顶栏里的「学习语言」切换。.seg 默认 align-self: flex-start（为右侧面板设计的），
   放进顶栏要改成居中，并稍微收窄一点，免得把导入按钮挤走。 */
.seg-mode { align-self: center; flex: 0 0 auto; }
.seg-mode button { padding: 4px 10px; font-size: 12px; min-height: 26px; }

/* 字幕条目 */
/* 字幕层级：原文最强（serif、最大），译文次级，第三语言可折叠。
   当前句只用左侧细强调线和很浅的底色，不整块染重色。 */
.cue {
  padding: 8px 14px 9px; border-left: 2px solid transparent;
  cursor: pointer; transition: background .12s;
}
.cue:hover { background: var(--cue-hover); }
.cue.active { background: var(--brand-soft); border-left-color: var(--brand); }
.cue.active .cue-time { color: var(--brand); }
.cue.follow-paused { scroll-margin-top: 12px; }
.cue.noaudio { opacity: .55; }
.cue-time {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 7px; margin-bottom: 3px;
}
.cue-actions { margin-left: auto; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.cue:hover .cue-actions { opacity: 1; }
.cue-actions button {
  border: 0; background: transparent; cursor: pointer; padding: 1px 4px;
  border-radius: 4px; color: var(--text-3); font-size: 11px; line-height: 1.1;
}
.cue-actions button:hover { background: var(--hover-2); color: var(--text); }
.cue-actions button.on { color: var(--warn); }
.cue-en { font-size: var(--sub-font); line-height: 1.58; color: var(--text); font-family: Georgia, "Times New Roman", serif; letter-spacing: .1px; }
.cue-mid { font-size: calc(var(--sub-font) - 3px); line-height: 1.55; color: var(--text-2); margin-top: 3px; font-family: Georgia, "Times New Roman", serif; }
.cue-mid.pending { color: var(--text-3); font-style: italic; font-family: inherit; }
.cue-zh { font-size: calc(var(--sub-font) - 4px); line-height: 1.6; color: var(--text-2); margin-top: 4px; }
.cue-zh.pending { color: var(--text-3); font-style: italic; }
.cue-zh.none { display: none; }

/* 第三语言（西语模式里的英文）默认折叠，按需展开 */
.cue-mid { position: relative; }
.cue-mid[data-collapsed="1"] { display: none; }

/* ---------- 单词：悬停 / 选中 / 逐词跟读 ---------- */
.w {
  border-radius: 3px; padding: 0 .5px; margin: 0 -.5px;
  cursor: pointer; transition: background .1s, color .1s;
}
.w:hover { background: var(--hover-bg); box-shadow: 0 0 0 1px var(--brand-line); }

/* 已经说过的词 → 浅绿；正在说的那个词 → 再深一档并加下划提示 */
.w.said { background: var(--karaoke); color: var(--karaoke-text); }
.w.now {
  background: var(--karaoke-now); color: var(--karaoke-text);
  box-shadow: 0 0 0 1px var(--karaoke-now);
}

.w.sel { background: var(--mark); color: var(--text); box-shadow: 0 0 0 1px var(--mark-line); }
.w.saved { border-bottom: 2px solid var(--brand); }
.reader-body.nomark .w.saved { border-bottom-color: transparent; }
.cue.hit .w.hl, .cue-en .w.hl { background: var(--mark); color: var(--text); }

/* 精听模式 */
.reader.focus .cue:not(.active) { display: none; }
.reader.focus .cue.active { padding: 16px 14px; border-left-color: var(--brand); background: var(--brand-soft); }
.focus-bar {
  display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line);
  background: var(--panel-2); flex-wrap: wrap;
}
.fb-btn {
  flex: 1 1 auto; padding: 7px 8px; border: 1px solid var(--line-strong);
  border-radius: 7px; background: var(--panel); cursor: pointer; font-size: 12.5px;
}
.fb-btn:hover { background: var(--panel-2); border-color: var(--line-hover); }

/* ---------- 单词卡片 ---------- */
.wordcard {
  position: fixed; z-index: 60; width: 344px; max-width: calc(100vw - 24px);
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-2); overflow: hidden;
}
.wc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 12px 6px; }
.wc-word { font-size: 22px; font-weight: 600; font-family: Georgia, serif; letter-spacing: .1px; word-break: break-word; }
.wc-phon { font-family: var(--mono); font-size: 12px; color: var(--text-2); margin-top: 3px; }
.wc-head-btns { display: flex; gap: 2px; flex: 0 0 auto; }
.icon-btn {
  border: 1px solid transparent; background: transparent; cursor: pointer;
  padding: 5px; border-radius: 7px; color: var(--text-2); display: inline-flex;
  align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600;
  min-width: 34px; min-height: 34px;
}
.icon-btn:hover { background: var(--seg-bg); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* 收藏是选中态，用强调色；朗读按钮保持中性 */
.icon-btn.on { color: var(--brand); background: var(--brand-soft); }
.icon-btn.on .ico { fill: var(--brand); }
/* 词卡的上下文区块：只展示已有的当前句与已有译文，不编造词义 */
.wc-context { margin: 2px 12px 8px; padding: 8px 9px; background: var(--panel-2); border-radius: 7px; font-size: 12px; line-height: 1.55; color: var(--text-2); }
.wc-context b { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .3px; color: var(--text-3); margin-bottom: 3px; }
.wc-context em { font-style: normal; color: var(--text); background: var(--mark); border-radius: 2px; padding: 0 1px; }
.wc-context .wc-ctx-zh { display: block; margin-top: 3px; color: var(--text-3); }
.wc-actions { display: flex; gap: 6px; margin: 0 12px 10px; flex-wrap: wrap; }
.wc-actions .btn { font-size: 12px; padding: 5px 9px; }
.wc-body { padding: 0 12px 10px; max-height: 46vh; overflow-y: auto; }
.wc-body::-webkit-scrollbar { width: 8px; }
.wc-body::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; }
.sense { display: flex; gap: 7px; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 13.5px; line-height: 1.6; }
.sense:first-child { border-top: 0; }
.sense .pos {
  flex: 0 0 auto; font-size: 11px; color: var(--brand); background: var(--brand-soft);
  border-radius: 4px; padding: 1px 5px; height: fit-content; margin-top: 3px; font-weight: 600;
}
.sense .txt { flex: 1 1 auto; min-width: 0; }
.wc-def { font-size: 12.5px; color: var(--text-2); line-height: 1.6; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.wc-def b { color: var(--text-3); font-weight: 600; font-size: 11px; display: block; margin-bottom: 3px; letter-spacing: .3px; }
/* 西语模式：词卡脚注里说明「这个西语词是经哪个英文词查到的」 */
.via { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.via code { font-size: 11.5px; color: var(--text-2); }
/* 收藏夹分区提示：当前模式看的是哪一档收藏，另一档有多少条。
   没有这行的话，「英语模式里看不到刚存的西语单词」会被当成丢数据。 */
.fav-scope { padding: 7px 14px 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.wc-foot {
  padding: 8px 12px; background: var(--panel-2); border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3); line-height: 1.6;
}
.wc-foot .ex { color: var(--text-2); }
.wc-foot .ex em { color: var(--text); font-style: normal; background: var(--hl-soft); padding: 0 2px; border-radius: 3px; }

/* ---------- 抽屉 ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 94vw;
  background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-2); z-index: 50; display: flex; flex-direction: column;
  animation: slideIn .16s ease;
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .toast, .modal, .review, .brand-mark { animation: none !important; }
  .reader-body { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .4 } to { transform: none; opacity: 1 } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-size: 15px; }
.drawer-head-btns { display: flex; align-items: center; gap: 6px; }
.drawer > .seg { margin: 10px 14px 0; }
.drawer > .reader-search { width: auto; margin: 10px 14px 0; }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px 28px; }
.drawer-body::-webkit-scrollbar { width: 9px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 9px; }
.scrim { position: fixed; inset: 0; background: rgba(18,22,30,.34); z-index: 40; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* 收藏列表项 */
.fav-item {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 11px; margin-bottom: 7px; background: var(--panel); position: relative;
}
.fav-item:hover { border-color: var(--brand-line); }
.fav-item .t { font-weight: 600; font-size: 14px; }
.fav-item .p { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.fav-item .d { font-size: 13px; color: var(--text-2); margin-top: 5px; line-height: 1.55; }
.fav-item .en { font-family: Georgia, serif; font-size: 14.5px; line-height: 1.6; }
.fav-item .mid { font-family: Georgia, serif; font-size: 13.5px; line-height: 1.6; color: var(--text-2); margin-top: 2px; }
.fav-item .zh { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.6; }
.fav-item .meta { font-size: 11px; color: var(--text-3); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.fav-item .tools { position: absolute; right: 7px; top: 7px; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.fav-item:hover .tools, .fav-item:focus-within .tools { opacity: 1; }
/* 触屏没有 hover：工具按钮常显，且保持 34px 触控尺寸 */
@media (hover: none) {
  .fav-item .tools { opacity: 1; }
  .cue-actions { opacity: 1; }
}
/* 生词条目正文可点（弹词卡）。给个手型和悬停反馈，否则没人知道它能点。 */
.fav-item.clickable { cursor: pointer; }
.fav-item.clickable .t { transition: color .12s; }
.fav-item.clickable:hover .t { color: var(--brand); }

/* 设置 */
.set-sec { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.set-sec:last-child { border-bottom: 0; margin-bottom: 0; }
.set-sec h4 { font-size: 13px; color: var(--text-2); margin-bottom: 9px; letter-spacing: .3px; }
.set-sec p { margin: 0 0 10px; }
.muted { color: var(--text-3); font-size: 12.5px; line-height: 1.7; }
.kv { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.kv td { padding: 5px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.kv td:first-child { color: var(--text-3); width: 108px; }
.kv td[data-state]::before {
  content: "●"; font-size: 9px; margin-right: 6px; vertical-align: 1px; color: var(--text-3);
}
.kv td[data-state="ok"]::before { color: var(--ok); }
.kv td[data-state="warn"]::before { color: var(--warn); }
.kv td[data-state="bad"]::before { color: var(--bad); }
.kv tr:last-child td { border-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
.field select, .field input[type=range] { width: 100%; }
.field select { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); }
.field input[type=range] { accent-color: var(--brand); }
.set-btns { display: flex; gap: 7px; flex-wrap: wrap; }
/* 设置面板里「已经开着」的按钮（比如正在画面上调整遮罩位置） */
.set-btns .btn.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* 主题选择卡 */
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.theme-card {
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  padding: 8px 6px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--panel); cursor: pointer; font-size: 11.5px; color: var(--text-2);
  transition: border-color .14s, box-shadow .14s, color .14s;
}
.theme-card:hover { border-color: var(--line-hover); }
.theme-card.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand-line); color: var(--text); }
.tc-preview {
  display: grid; grid-template-columns: 34% 1fr; grid-template-rows: 1fr 1fr;
  gap: 3px; width: 100%; height: 36px; border-radius: 6px; padding: 4px;
  border: 1px solid var(--line); overflow: hidden;
}
.tc-preview i { display: block; border-radius: 2px; background: rgba(128, 136, 150, .28); }
.tc-preview i:first-child { grid-row: 1 / span 2; }
.tc-light { background: #f4f5f8; }
.tc-light i { background: #d9dee7; }
.tc-light i:first-child { background: #ffffff; box-shadow: 0 0 0 1px #e3e6ec inset; }
.tc-dark { background: #0e1116; }
.tc-dark i { background: #3a424f; }
.tc-dark i:first-child { background: #1b2029; box-shadow: 0 0 0 1px #2b323d inset; }
.tc-auto { background: linear-gradient(105deg, #f4f5f8 0 50%, #0e1116 50% 100%); }
.tc-auto i { background: linear-gradient(105deg, #d9dee7 0 50%, #3a424f 50% 100%); }

/* 空态 */
.empty { padding: 44px 26px; text-align: center; color: var(--text-2); }
.empty p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.75; }
.empty .muted { font-size: 12.5px; }
.empty-actions { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; margin-top: 4px; }

/* 识别进行态 */
.recog-spin {
  width: 26px; height: 26px; margin: 0 auto 14px;
  border: 2.5px solid var(--track); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.recog-hint {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 10px 12px 6px; padding: 8px 12px;
  font-size: 12px; color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px;
}
.recog-hint .recog-dot { background: var(--brand); }

/* 真实的阶段进度：识别 → 翻译 → 就绪，附取消 / 重试 */
.progress { flex-wrap: wrap; }
.progress .prog-label { flex: 1 1 100%; font-size: 11px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.progress .prog-stage { color: var(--text); font-weight: 600; }
.progress-actions { display: flex; gap: 4px; margin-left: auto; }
.progress-actions .btn { padding: 2px 8px; font-size: 11px; min-height: 24px; }
.fail-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--bad); }
.fail-note .btn { font-size: 11.5px; padding: 3px 9px; min-height: 28px; }
.recog-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--brand);
  animation: pulse 1s infinite; flex: 0 0 auto;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-text); padding: 9px 16px; border-radius: 9px;
  font-size: 13px; z-index: 90; box-shadow: var(--shadow-2); max-width: 78vw;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }

/* 窄屏 */
/* 竖握的平板和手机：上下叠放。原来给 .stage 留 62vh、给 .reader 留 74vh，
   两个百分比相加 136vh，竖握首屏必然装不下，画面和字幕各露一半。
   改成由 flex 分配：播放器按 16:9 取高度，字幕区拿走剩下的。
   横握（1024×768 / 1080×810）不叠 —— 那一点高度叠起来字幕只剩 95px，
   左右并排时右边一栏有 388px 宽，本来就是这套界面的正常形态。 */
@media (max-width: 1080px) and (orientation: portrait) {
  .workspace { flex-direction: column; overflow-y: auto; }
  .stage { flex: 0 0 auto; min-height: 0; }
  .player-wrap { aspect-ratio: 16 / 9; flex: 0 0 auto; max-height: 46vh; }
  .player-wrap.audio-only { aspect-ratio: auto; min-height: 150px; max-height: none; }
  .reader { flex: 1 1 auto; min-height: 34vh; max-height: none; }
  .brand-text span { display: none; }
  .topbar-left { gap: 10px; }
}
/* 手机横握（高度很浅）：仍然叠放，否则播放器会把整屏吃掉 */
@media (max-width: 1080px) and (orientation: landscape) and (max-height: 560px) {
  .workspace { flex-direction: column; overflow-y: auto; }
  .stage { flex: 0 0 auto; }
  .player-wrap { aspect-ratio: 16 / 9; max-height: 52vh; }
  .reader { flex: 1 1 auto; min-height: 0; max-height: none; }
}

/* 窄屏（不分握向）沿用原来的最小高度，避免老布局塌掉 */
@media (max-width: 1080px) {
  .brand-text span { display: none; }
  .topbar-left { gap: 10px; }
}

/* 触屏平板（641–1080px）：顶栏按钮在这一档还带着文字标签，
   竖握 810px 宽度装不下，被 flex-wrap 折成三行、占掉 113px 高度。
   只留图标 —— 和 ≤640px 手机一致；.btn-lang 的 EN/中 标签必须保留，
   它是这首屏上唯一能说明「界面在哪种语言」的东西。 */
@media (max-width: 1080px) and (min-width: 641px) {
  .topbar { padding: 6px 12px; row-gap: 4px; }
  .topbar .btn > span:not(.pill) { display: none; }
  .topbar .btn.btn-lang > span { display: inline; }
  /* 开始识别是主行动，文字收窄保留而不是整个隐藏 */
  .topbar #btnTranscribe > span { display: inline; font-size: 12px; }
  .topbar #btnTranscribe { padding-left: 9px; padding-right: 11px; }
  .topbar-sep { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 8px 10px; }
  .btn > span:not(.pill) { display: none; }
  .btn.btn-lang > span { display: inline; }
  /* 模式按钮是这首屏上唯一能说明「在学什么语言」的东西，绝不隐藏，只收窄 */
  .topbar-left { gap: 8px; }
  .seg-mode button { padding: 4px 8px; font-size: 11.5px; }
  .workspace { padding: 8px; gap: 8px; }
  .drawer { width: 100%; }
}

/* 手机竖握（≤430px）：390px 宽度上 7 个图标按钮一排塞不下，
   btnTheme 会被挤到第二行，顶栏从 61px 长到 165px。收窄内边距后一排刚好收起。 */
@media (max-width: 430px) {
  .topbar { padding: 6px 8px; gap: 4px; column-gap: 4px; }
  .topbar-actions { gap: 3px; }
  .topbar .btn { padding: 6px; min-height: 32px; gap: 3px; }
  .topbar .btn-icon { padding: 6px; }
  .topbar-sep { display: none; }
  .workspace { padding: 6px; }
}

/* 极窄机（≤360px，如 iPhone SE 一代）：操作区 10 个按钮用 6px 内边距仍差几像素，
   把「收藏」的文字收掉、只留计数药丸，一排刚好收起。 */
@media (max-width: 360px) {
  .topbar-actions { gap: 2px; }
  .topbar .btn { padding: 5px 4px; }
  .topbar .btn-icon { padding: 5px 4px; }
  .topbar #btnFavs > span:not(.pill) { display: none; }
  .topbar #btnFavs { padding: 5px 4px; }
}

body.dragover::after {
  content: attr(data-drop-hint); position: fixed; inset: 12px; z-index: 100;
  border: 3px dashed var(--brand); border-radius: 16px; background: rgba(31,111,235,.08);
  display: grid; place-items: center; font-size: 20px; font-weight: 600; color: var(--brand);
  pointer-events: none;
}

/* ============================ 画面烧录字幕遮罩 ============================
   盖在视频上的空层，靠 backdrop-filter 就地模糊背后的像素。
   位置由 js/subtitle-mask.js 按 object-fit: contain 的换算实时算出来，
   这里只负责长相：圆角、羽化由脚本写在行内，方便跟着设置走。
   遮罩本身不吃鼠标事件（pointer-events: none），否则会挡住播放器的双击全屏。
========================================================================= */

.submask,
.submask-canvas {
  position: absolute; z-index: 5; pointer-events: none;
  border-radius: 8px;
  /* 揭开原文时的过渡；平时不参与动画，避免拖动进度条时闪 */
  transition: opacity .16s ease, filter .16s ease;
}

.submask-canvas { image-rendering: pixelated; }

/* 按住 Alt 临时看原文：淡出而不是直接删掉，手感更连续 */
.submask.peek,
.submask-canvas.peek { opacity: 0; }

.submask-chip {
  position: absolute; z-index: 7; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: .2px; line-height: 1.5;
  color: #e8eefc; background: rgba(12,15,20,.72);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .16s ease;
}
.submask-chip.peek { opacity: .25; }
/* 触屏没有 Alt 键，揭开原文靠点 chip 本身 —— 它必须能被点到。
   其它情况下 chip 仍然不吃指针事件，不挡播放器的双击全屏。 */
.submask-chip.tappable { pointer-events: auto; cursor: pointer; }

/* 定位进行中的小转子 */
.submask-chip .spin {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.28); border-top-color: #e8eefc;
  animation: submask-spin .7s linear infinite;
}
@keyframes submask-spin { to { transform: rotate(360deg); } }

/* 「在画面上调整位置」：虚线框 + 上下两条抓手
   整层不吃事件（否则挡住双击全屏），只有框和抓手自己 pointer-events: auto */
.submask-edit { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.submask-edit[hidden] { display: none; }

.submask-edit-box {
  position: absolute; pointer-events: auto; cursor: grab; touch-action: none;
  border: 1.5px dashed rgba(255,255,255,.92); border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), inset 0 0 0 1px rgba(0,0,0,.22);
}
.submask-edit-box:active { cursor: grabbing; }

.submask-edit-grip {
  position: absolute; left: 50%; width: 86px; height: 10px; margin-left: -43px;
  pointer-events: auto; cursor: ns-resize; touch-action: none;
  border-radius: 999px; background: rgba(255,255,255,.95);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
/* 抓手中间那道小横杠，让人一眼看出是握把而不是装饰 */
.submask-edit-grip::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 34px; height: 2px; margin: -1px 0 0 -17px;
  border-radius: 2px; background: rgba(18,22,30,.55);
}
.submask-edit-grip.top { top: -5px; }
.submask-edit-grip.bottom { bottom: -5px; }

.submask-edit-hint {
  position: absolute; pointer-events: none; white-space: nowrap;
  padding: 3px 8px; border-radius: 6px; font-size: 12px;
  color: #e8eefc; background: rgba(12,15,20,.78);
  border: 1px solid rgba(255,255,255,.12);
}

/* 拖完的出口：钉在画面右上角，不用再开设置面板 */
.submask-edit-done {
  position: absolute; top: 10px; right: 10px; pointer-events: auto;
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; line-height: 1.4;
  color: #fff; background: var(--brand);
  border: 1px solid rgba(255,255,255,.28);
  box-shadow: 0 2px 8px rgba(0,0,0,.42);
}
.submask-edit-done:hover { filter: brightness(1.08); }

/* 设置面板里的一行两个滑块 */
.submask-range { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.submask-range label { font-size: 12px; color: var(--text-2); display: block; }
.submask-range input[type="range"] { width: 100%; accent-color: var(--brand); }

/* ============================ 右侧中英文独立开关 ============================
   练听力时最省事的办法不是把译文弄模糊，而是干脆收起来 —— 想看再点开。
   这里只用「容器上加个 class」来隐藏，不重建 DOM：
   识别过程中每 500ms 就要重排一次字幕，重建一次 DOM 太贵，切一下 class 是零成本。
========================================================================= */

.rh-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rh-row .seg { align-self: center; }

#subs.hide-en .cue-en { display: none; }
#subs.hide-mid .cue-mid { display: none; }
#subs.hide-zh .cue-zh { display: none; }
.bigscreen.hide-en .bs-en { display: none; }
.bigscreen.hide-mid .bs-mid { display: none; }
.bigscreen.hide-zh .bs-zh { display: none; }

/* 英语模式下没有「中间那行」，按钮整个藏掉。.seg button 有自己的 display，
   hidden 属性会被它盖过去，所以要显式写一条。 */
#langSeg button[hidden] { display: none; }

/* 两种都关掉时，右侧只剩时间码和按钮 —— 提醒一下这是有意为之，不是坏了 */
#subs.bare .cue { padding-top: 7px; padding-bottom: 7px; }
#subs.bare .cue-time { margin-bottom: 0; }
.reader-bare-hint {
  padding: 10px 14px; font-size: 12.5px; color: var(--text-3);
  border-bottom: 1px solid var(--line);
}

/* ============================ 收起 / 展开右侧面板 ============================
   纯听力练习时右侧那一块完全不需要，收起来视频就能占满整屏；想核对时再点开。
   把手做成面板左边缘的一条**竖排文字**：位置固定、不抢眼，需要时一眼能找到。
   收起后只留这 26px，stage 是 flex:1，会自动把腾出来的宽度吃掉。
========================================================================= */

.reader { position: relative; padding-left: 26px; }

.reader-rail {
  position: absolute; left: 0; top: 0; bottom: 0; width: 26px; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  padding: 12px 0; border: 0; border-right: 1px solid var(--line);
  background: var(--panel-2); color: var(--text-3);
  /* 竖排：中文用 upright 才不会躺倒 */
  writing-mode: vertical-rl; text-orientation: upright;
  letter-spacing: 3px; font-size: 12px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: background .12s, color .12s;
}
.reader-rail:hover { background: var(--hover-bg); color: var(--brand); }
.reader-rail:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

.reader.collapsed { flex: 0 0 26px; max-width: 26px; min-width: 26px; padding-left: 0; }
.reader.collapsed > *:not(.reader-rail) { display: none; }
.reader.collapsed .reader-rail { border-right: 0; }

/* ============================ 通用确认框 ============================
   目前只有一个用途：切换学习语言模式时问一句「要不要重新识别」。
   不能用 toast —— toast 会自己消失，而这个选择必须由用户明确拍板，
   否则「模式换了、字幕还是旧语言」会变成一个看不懂的状态。
========================================================================= */

.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(12, 14, 18, .46);
}
.modal-card {
  width: min(430px, 100%);
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 20px 20px 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .34);
}
.modal-card h3 { font-size: 15.5px; margin-bottom: 8px; }
.modal-card p { font-size: 13.5px; line-height: 1.65; color: var(--text-2); }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ============================ 复习 ============================
   设计取向：**屏幕上越干净越好**。
   复习练的是听力，所以默认只给一个播放键，原文和译文都先藏着。
   藏的时候用 blur 而不是 display:none —— 内容还在那儿占着位置，
   卡片不会因为展开答案而跳动，眼睛也不会被「新出现的一块」吸引过去。
================================================================ */

.pill-due { background: var(--bad); color: #fff; }

.review {
  position: fixed; inset: 0; z-index: 85;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(12, 14, 18, .62);
  animation: fade .16s ease;
}
.rv-card {
  width: min(620px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
  overflow: hidden;
}
.rv-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line);
}
.rv-progress { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rv-head-btns { display: flex; align-items: center; gap: 6px; }

.rv-body { padding: 30px 22px 22px; text-align: center; }

/* 「先听」的大按钮。整个卡片的视觉重心就落在这上面。 */
.rv-listen {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; width: 132px; height: 132px; margin: 0 auto 18px;
  border-radius: 50%; cursor: pointer;
  background: var(--brand-soft); color: var(--brand);
  border: 2px solid var(--brand-line);
  transition: transform .12s, background .12s, border-color .12s;
}
.rv-listen:hover { background: var(--hover-bg); border-color: var(--brand); }
.rv-listen:active { transform: scale(.96); }
.rv-listen.playing { border-color: var(--brand); }
.rv-listen svg { width: 46px; height: 46px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.rv-listen .rv-listen-label { font-size: 12px; color: var(--text-2); }

.rv-hint { font-size: 13px; color: var(--text-3); line-height: 1.7; }

/* 句子/单词的原文：先模糊。想看清楚得点「看答案」。 */
.rv-src {
  font-family: Georgia, serif; font-size: 19px; line-height: 1.72; color: var(--text);
  margin-top: 4px; transition: filter .18s;
}
.rv-src.blur { filter: blur(7px); user-select: none; }
.rv-mid { font-family: Georgia, serif; font-size: 15px; color: var(--text-2); margin-top: 8px; }
.rv-zh { font-size: 13.5px; color: var(--text-2); margin-top: 9px; line-height: 1.7; }
/* 译文也要模糊 —— 只看英文模糊等于没藏：中文一读就知道意思，耳朵就不用动了。
   这两条以前漏了，.blur 类挂上去但没样式，译文一直是清清楚楚的。 */
.rv-mid.blur, .rv-zh.blur { filter: blur(6px); user-select: none; }
.rv-meta { font-size: 11.5px; color: var(--text-3); margin-top: 14px; }
.rv-mid, .rv-zh { transition: filter .18s; }

/* 单词复习：正面是词本身，所以不模糊，只藏释义 */
.rv-word { font-size: 30px; font-weight: 600; letter-spacing: .2px; }
.rv-phon { font-family: var(--mono); font-size: 13px; color: var(--text-3); margin-top: 5px; }
.rv-def { font-size: 15px; color: var(--text); margin-top: 12px; line-height: 1.7; }
.rv-def.blur { filter: blur(7px); user-select: none; }
.rv-engdef { font-size: 12.5px; color: var(--text-3); margin-top: 10px; line-height: 1.65; }

.rv-foot { padding: 0 22px 6px; font-size: 11.5px; color: var(--text-3); text-align: center; }

.rv-actions {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 16px 20px 20px; border-top: 1px solid var(--line);
}
.rv-grade { display: flex; gap: 10px; }
.btn-lg { padding: 10px 22px; font-size: 14px; }
.btn-ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.btn-ok:hover { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-bad { border-color: var(--bad); color: var(--bad); }
.btn-bad:hover { background: var(--bad); color: #fff; border-color: var(--bad); }

/* 复习结束的总结页 */
.rv-done { padding: 40px 24px; text-align: center; }
.rv-done h3 { font-size: 17px; margin-bottom: 10px; }
.rv-done p { font-size: 13.5px; color: var(--text-2); line-height: 1.75; }
.rv-stats { display: flex; justify-content: center; gap: 26px; margin: 22px 0 6px; }
.rv-stat { text-align: center; }
.rv-stat b { display: block; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rv-stat span { font-size: 11.5px; color: var(--text-3); }
.rv-stat.ok b { color: var(--ok); }
.rv-stat.bad b { color: var(--bad); }

/* 仅供读屏的文本（图标按钮必须有可念出的名字） */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* 用户自己滚动后，唯一把视图拉回当前句的入口；不自动抢滚动 */
.follow-return {
  position: absolute; right: 16px; bottom: 58px; z-index: 6;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 11px; border-radius: 999px; cursor: pointer;
  font-size: 12px; font-weight: 500;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-2);
}
.follow-return .ico { width: 14px; height: 14px; }
.follow-return:hover { background: var(--hover-bg); }

/* 最近学习：真实存在的本地记录，没有就整块不出现 */
/* 旧的中央学习记录区块已移到顶栏弹层；保留空注释避免误以为样式丢失。 */

/* 恢复字幕但尚未重新选中媒体时的提示，明确说明浏览器无法保留本地路径 */
.media-notice {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--stage-bg);
}
.media-notice-card { max-width: 420px; text-align: center; color: var(--toast-text); }
.media-notice-card h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.media-notice-card p { margin: 0 0 14px; font-size: 12px; line-height: 1.7; color: #aab5c6; }
.media-notice-card .btn { background: var(--stage-2); border-color: #454e5d; color: var(--toast-text); min-height: 40px; }
.media-notice-card .btn:hover { background: #26303d; }

@media (max-width: 640px), (pointer: coarse) {
  .pb-btn, .btn, .seg button, .icon-btn { min-height: 44px; }
  .pb-play { min-width: 48px; }
  .dz-inner { padding: 22px 16px; }
  .dz-main { margin-bottom: 10px; }
  .follow-return { bottom: 10px; right: 10px; }
}

/* ============================ 继续学习顶栏入口 ============================
   与导入按钮同级的中性样式；不抢强调色。窄屏保持 ≥44px 触控高度。
========================================================================= */
.continue-btn { padding: 6px 10px; }
.continue-btn .pill { margin-left: 2px; }
.continue-btn[aria-expanded="true"] { background: var(--hover-bg); border-color: var(--line-hover); }

/* 历史弹层：锚在顶栏按钮下方，不铺满屏幕；窄屏变成底部 sheet */
.continue-pop {
  position: fixed; z-index: 70; width: 420px; max-width: calc(100vw - 20px);
  max-height: min(70vh, 560px); overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  animation: cpIn .14s ease;
}
@keyframes cpIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.cp-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.cp-note { margin: 0; padding: 8px 12px; font-size: 11.5px; line-height: 1.6; color: var(--text-3); border-bottom: 1px solid var(--line); }
.cp-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cp-empty { padding: 22px 14px; text-align: center; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.cp-empty .btn { margin-top: 10px; }
.cp-item { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid transparent; border-radius: 8px; }
.cp-item:hover, .cp-item:focus-within { background: var(--hover-bg); border-color: var(--line); }
.cp-open { flex: 1 1 auto; min-width: 0; text-align: left; background: transparent; border: 0; color: var(--text); cursor: pointer; padding: 2px 0; border-radius: 6px; }
.cp-open:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cp-name { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-meta { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text-3); }
.cp-state { flex: 0 0 auto; font-size: 10.5px; color: var(--text-2); padding: 2px 6px; border-radius: 999px; background: var(--panel-2); }
.cp-state.ready { color: var(--ok); }
.cp-state.partial, .cp-state.processing { color: var(--warn); }
.cp-state.failed { color: var(--bad); }
.cp-remove { flex: 0 0 auto; }
@media (max-width: 640px), (pointer: coarse) {
  .continue-btn { min-height: 44px; }
  .continue-pop {
    left: 8px !important; right: 8px; top: auto !important; bottom: 8px;
    width: auto; max-width: none; max-height: 68vh; border-radius: 12px;
  }
  .cp-open { min-height: 44px; }
  .cp-remove { min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .continue-pop { animation: none; } }

/* ============================ 链接导入 ============================
   粘 YouTube / 哔哩哔哩 链接直接取回。用独立遮罩，不复用 #scrim，
   免得和抽屉的开关状态互相干扰。 */
.url-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(18, 22, 30, .42);
  animation: fade .16s ease;
}
.url-overlay[hidden] { display: none; }
.url-pop {
  display: flex; flex-direction: column;
  width: 480px; max-width: 100%; max-height: min(86vh, 720px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
}
.url-pop.in { animation: urlIn .16s ease; }
@keyframes urlIn {
  from { opacity: 0; transform: translateY(6px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.url-row { display: flex; gap: 8px; padding: 12px 12px 0; }
.url-row input {
  flex: 1 1 auto; min-width: 0; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--panel-2); color: var(--text); font-size: 13px;
}
.url-row input::placeholder { color: var(--text-3); }
.url-row input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.url-row .btn { flex: 0 0 auto; }
.url-get {
  display: block;
  margin: -4px 0 12px;
  padding: 9px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--brand);
  font-size: 13px;
  text-align: center;
  text-decoration: none;
}
.url-get:hover { background: var(--panel-2, rgba(127,127,127,.08)); }
.url-get[hidden] { display: none; }

.url-note { margin: 8px 12px 0; font-size: 11.5px; line-height: 1.65; color: var(--text-3); }
.url-card {
  display: flex; gap: 10px; align-items: center; margin: 10px 12px 0; padding: 9px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2);
}
.url-card[hidden] { display: none; }
.url-thumb {
  flex: 0 0 auto; width: 96px; height: 54px; object-fit: cover;
  border-radius: 6px; background: var(--seg-bg);
}
.url-thumb[hidden] { display: none; }
.url-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.url-meta b {
  font-size: 13px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.url-meta > span { font-size: 11px; color: var(--text-3); }
.url-badge {
  align-self: flex-start; margin-top: 2px; padding: 2px 7px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--line-strong);
  font-size: 10.5px !important; color: var(--ok) !important;
}
.url-badge[hidden] { display: none; }
.url-modes { display: flex; flex-direction: column; gap: 6px; margin: 10px 12px 0; }
.url-modes[hidden] { display: none; }
.url-mode {
  display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px;
  border: 1px solid var(--line-strong); border-radius: 9px; cursor: pointer;
}
.url-mode:hover { background: var(--hover-bg); border-color: var(--line-hover); }
.url-mode[hidden] { display: none; }
.url-mode:has(input:checked) { border-color: var(--brand); background: var(--hover-bg); }
/* 被风控的视频没有音视频流，这两种方式点不了 */
.url-mode.is-off { opacity: .45; cursor: not-allowed; }
.url-mode.is-off:hover { background: transparent; border-color: var(--line); }
.url-mode input { flex: 0 0 auto; margin: 2px 0 0; accent-color: var(--brand); }
.um-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.um-body b { font-size: 13px; font-weight: 600; }
.um-body i { font-size: 11px; font-style: normal; line-height: 1.5; color: var(--text-3); }
.url-progress { display: flex; align-items: center; gap: 9px; margin: 10px 12px 0; }
.url-progress[hidden] { display: none; }
.url-bar { flex: 1 1 auto; height: 6px; border-radius: 999px; background: var(--seg-bg); overflow: hidden; }
.url-bar i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: var(--brand); transition: width .25s ease;
}
.url-stage { flex: 0 0 auto; max-width: 58%; font-size: 11px; line-height: 1.5; color: var(--text-2); text-align: right; }
.url-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px; margin-top: 10px; border-top: 1px solid var(--line);
}
/* 平板与手机：改成底部抽屉，触控目标放大到 44px 以上。
   iPad 横屏 1024px 也算 (pointer: coarse)，一样走这套。 */
@media (max-width: 640px), (pointer: coarse) {
  .url-overlay { align-items: flex-end; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .url-pop { max-height: 88vh; max-height: 88dvh; border-radius: 12px; }
  .url-row { flex-direction: column; }
  /* iOS 会在输入框字号小于 16px 时自动放大整页，且不会自己缩回来 */
  .url-row input { font-size: 16px; }
  .url-row .btn, .url-actions .btn { min-height: 44px; }
  .url-actions .btn { flex: 1 1 auto; }
  .cp-head .icon-btn { min-width: 40px; min-height: 40px; }
  .url-mode { padding: 11px 12px; }
  .url-stage { max-width: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .url-overlay, .url-pop.in, .url-bar i { animation: none; transition: none; }
}

/* ============================ 复习 · 三选一 ============================
   固定三个大按钮；正确/错误状态同时用颜色、图标和文字说明，不只靠颜色。
   窄屏保持 44px 以上；语言列开关不挤占题目。
========================================================================= */
.rv-toggle { display: inline-flex; gap: 2px; padding: 2px; border-radius: 7px; background: var(--seg-bg); }
.rv-tog {
  border: 0; background: transparent; color: var(--text-3); border-radius: 5px;
  min-width: 30px; min-height: 26px; font-size: 11px; font-weight: 600; cursor: pointer;
}
.rv-tog.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }
.rv-tog[aria-pressed="false"] { opacity: .6; text-decoration: line-through; }
.rv-quiz-kind { font-size: 10.5px; letter-spacing: .7px; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.rv-prompt { margin-bottom: 16px; }
.rv-context { font-size: 12px; line-height: 1.6; color: var(--text-3); margin-top: 8px; }
.rv-context.en { font-family: Georgia, serif; color: var(--text-2); }
.rv-all-hidden { font-size: 13px; line-height: 1.7; color: var(--text-3); padding: 18px 8px; }
.rv-choices { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.rv-choice {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--panel); color: var(--text); cursor: pointer;
  font-size: 14px; line-height: 1.55; text-align: left; min-height: 44px;
}
.rv-choice:hover:not(:disabled) { background: var(--hover-bg); border-color: var(--line-hover); }
.rv-choice:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.rv-choice:disabled { cursor: default; opacity: 1; }
.rv-choice-key {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 5px;
  background: var(--seg-bg); color: var(--text-2); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; margin-top: 1px;
}
.rv-choice-text { flex: 1 1 auto; min-width: 0; }
.rv-choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.rv-choice.correct .rv-choice-key { background: var(--ok); color: #fff; }
.rv-choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--panel)); }
.rv-choice.wrong .rv-choice-key { background: var(--bad); color: #fff; }
.rv-foot.ok { color: var(--ok); font-weight: 600; }
.rv-foot.bad { color: var(--bad); font-weight: 600; }
.rv-actions { flex-wrap: wrap; }
@media (max-width: 640px), (pointer: coarse) {
  .rv-tog { min-width: 44px; min-height: 44px; }
  .rv-choice { min-height: 48px; padding: 12px; }
  .rv-actions .btn { min-height: 44px; }
}

/* ───────── 激活闸门 ───────── */
.gate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(31,111,235,.10), transparent 60%), var(--bg);
  overflow: auto;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%; max-width: 720px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(12, 20, 36, .18);
  padding: 26px 26px 20px;
}
.gate-head { display: flex; gap: 14px; align-items: flex-start; }
.gate-head-main { min-width: 0; }
/* 付款弹窗右上角的语言切换：客户看不懂中文时能就地换，不必去找顶栏 */
.gate-langs { margin-left: auto; align-self: flex-start; flex: none; }
.gate-langs button { padding: 4px 9px; font-size: 12px; min-height: 26px; font-weight: 600; }
@media (max-width: 560px) {
  .gate-head { flex-wrap: wrap; }
  .gate-langs { order: 3; margin-left: 0; }
}
.gate-logo {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .5px;
}
.gate-head h2 { margin: 2px 0 4px; font-size: 19px; color: var(--text); }
.gate-head p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }

.gate-body { display: grid; grid-template-columns: 240px 1fr; gap: 26px; margin-top: 20px; }
.gate-pay { text-align: center; }
.gate-qr {
  width: 220px; height: auto; border-radius: 12px; display: block; margin: 0 auto;
  border: 1px solid var(--line); background: #fff;
}
.gate-price { margin: 12px 0 6px; font-size: 13px; color: var(--text-2); display: flex; gap: 8px; align-items: baseline; justify-content: center; }
.gate-price b { font-size: 22px; color: var(--text); }
.gate-tip { margin: 4px 0; font-size: 12.5px; color: var(--text-3); line-height: 1.55; }
.gate-contact { margin: 10px 0 0; font-size: 12.5px; color: var(--text-2); }

.gate-form { display: flex; flex-direction: column; }
.gate-label { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.gate-input {
  width: 100%; padding: 11px 14px; font-size: 15px; letter-spacing: 1.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line-strong); border-radius: 10px;
}
.gate-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.gate-input[aria-invalid="true"] { border-color: var(--bad); }
.gate-go {
  margin-top: 10px; align-self: flex-start; min-width: 132px;
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700;
}
.gate-go:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.gate-note { margin: 10px 0 0; font-size: 12.5px; color: var(--text-3); line-height: 1.6; min-height: 18px; }
.gate-note.bad { color: var(--bad); }
.gate-note.ok { color: var(--ok); }
.gate-faq { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); list-style: none; }
.gate-faq li { font-size: 12.5px; color: var(--text-3); line-height: 1.9; }
.gate-fine { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }

@media (max-width: 640px), (pointer: coarse) {
  .gate { padding: 14px 12px; align-items: flex-start; }
  .gate-card { padding: 20px 18px 16px; border-radius: 16px; }
  .gate-body { grid-template-columns: 1fr; gap: 18px; }
  .gate-qr { width: 190px; }
  .gate-go { align-self: stretch; }
}

/* ============================ 账号 / 每日配额 ============================ */

/* 顶栏的额度指示：免费用户显示倒计时，永久会员显示「永久」 */
.acct-pill { gap: 6px; }
.acct-pill #acctPillText { font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.acct-pill.pro { color: var(--accent); border-color: var(--accent); }

.acct-card { max-width: 460px; }
.acct-body { grid-template-columns: 1fr !important; gap: 0 !important; }
.acct-pane { display: flex; flex-direction: column; }
.acct-pane[hidden] { display: none; }
.acct-pane .gate-label { margin-top: 12px; }
.acct-pane .gate-label:first-child { margin-top: 0; }

.acct-lead { margin: 2px 0 14px; font-size: 13.5px; line-height: 1.65; color: var(--text-2); }
.acct-lead b { color: var(--text); font-weight: 600; }

.acct-buy { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.acct-buy .gate-qr { flex: none; }
.acct-buy-main { min-width: 0; text-align: left; }
.acct-buy-main .gate-price { justify-content: flex-start; margin-top: 0; }
.acct-buy-main .gate-tip { text-align: left; }

.acct-status {
  margin: 4px 0 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface-2, rgba(127, 127, 127, .08));
  font-size: 13px; line-height: 1.6; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.acct-link {
  margin-top: 12px; align-self: flex-start; padding: 4px 0;
  background: none; border: 0; cursor: pointer;
  font-size: 12.5px; color: var(--accent);
}
.acct-link:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .acct-buy { flex-direction: column; align-items: center; }
  .acct-buy-main { text-align: center; }
  .acct-buy-main .gate-price,
  .acct-buy-main .gate-tip { justify-content: center; text-align: center; }
}

#modeSelect { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 30px 8px 12px; min-height:44px; max-width:180px; }
#modeSelect:focus-visible { outline:2px solid var(--brand); outline-offset:2px; }

#modeSeg { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
#modeSeg label { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--text-2); }
#secondLang, #thirdLang { font:inherit; min-height:44px; padding:6px; color:var(--text); background:var(--panel); border:1px solid var(--line-strong); border-radius:8px; }

#uiLangSelect { min-height:44px; max-width:145px; color:var(--text); background:var(--panel); border:1px solid var(--line-strong); border-radius:8px; padding:6px 22px 6px 9px; }
.acct-langs { flex-wrap:wrap; }

#modeSelect[hidden] { display:none !important; }

/* Every secondary panel has a readable, reachable return action. */
.panel-back{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:max-content;width:auto;min-height:44px;flex-shrink:0;white-space:nowrap;padding:8px 12px;}
.gate-navigation{display:flex;margin-bottom:16px;}

.translation-editor{width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 40px);overflow:auto;}
.translation-editor h3{margin-top:16px;}.translation-field{display:block;margin:14px 0;}.translation-field span{display:block;margin-bottom:6px;}
.translation-field textarea{display:block;width:100%;box-sizing:border-box;resize:vertical;min-height:80px;max-height:260px;border:1px solid var(--line);border-radius:8px;padding:10px;background:var(--panel-2);color:var(--text);font:inherit;}
#askModal{z-index:95;}

.cue-actions{opacity:1;flex-wrap:wrap;justify-content:flex-end;}
.cue-actions button{min-height:32px;padding:5px 6px;}
.cue-time{flex-wrap:wrap;}
@media (any-pointer:coarse){.cue-actions button{min-height:44px;}}

.translation-editor .btn,#learningExport,#learningImport{min-height:44px;}

.cp-remove{min-width:52px;min-height:44px;flex-shrink:0;}

.continue-pop{left:clamp(8px,var(--history-anchor,8px),max(8px,calc(100vw - 428px)));}

.model-pack-card{width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 40px);overflow:auto;}.model-pack-card h3{margin-top:16px;}.model-pack-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:16px;}.model-pack-actions .btn{min-height:44px;}.model-pack-card progress{width:100%;height:16px;}

#modelPackOverlay{z-index:92;}

.model-pack-actions a.btn{text-decoration:none;}
