/* 精听语库 · 全站样式（手写 CSS，支持浅色 / 深色两套主题） */

/* ---------- 深色主题（默认） ---------- */
:root {
  --bg: #0f1115;
  --bg-soft: #161922;
  --bg-card: #1b1f2a;
  --bg-input: #12141b;
  --bg-input-focus: #141823;
  --bg-hover: #1a1e29;
  --bg-topbar: rgba(15, 17, 21, .88);
  --line: #262b38;
  --line-strong: #3a4560;
  --text: #e8eaf0;
  --text-dim: #9aa1b1;
  --text-mute: #6b7385;
  --primary: #4f7cff;
  --primary-soft: rgba(79, 124, 255, .14);
  --primary-text: #b9caff;
  --link: #8ba6ff;
  --warm: #ffd76a;
  --ok: #6ee7b7;
  --ok-bg: rgba(52, 211, 153, .12);
  --danger: #fca5a5;
  --danger-bg: rgba(248, 113, 113, .12);
  --word-bg: rgba(255, 215, 106, .14);
  --word-line: rgba(255, 215, 106, .5);
  --word-hidden-bg: rgba(255, 215, 106, .18);
  --lv1-bg: rgba(34, 197, 94, .20); --lv1-line: rgba(34, 197, 94, .65);
  --lv2-bg: rgba(245, 158, 11, .22); --lv2-line: rgba(245, 158, 11, .70);
  --lv3-bg: rgba(59, 130, 246, .22); --lv3-line: rgba(59, 130, 246, .70);
  --lv4-bg: rgba(255, 255, 255, .06); --lv4-line: rgba(200, 200, 200, .85);
  --word-ok-bg: rgba(52, 211, 153, .16);
  --word-ok-line: rgba(52, 211, 153, .5);
  --shadow: 0 14px 34px rgba(0, 0, 0, .5);
  --video-bg: #000;
  --tag-bg: #232833;
  --tabs-bg: #161922;
}

/* ---------- 浅色主题 ---------- */
html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-hover: #f2f4f7;
  --bg-topbar: rgba(255, 255, 255, .9);
  --line: #e3e6ec;
  --line-strong: #c9cfda;
  --text: #1a1d24;
  --text-dim: #5b6472;
  --text-mute: #8b93a1;
  --primary: #3b6bf5;
  --primary-soft: rgba(59, 107, 245, .1);
  --primary-text: #2b57d6;
  --link: #2b57d6;
  --warm: #b47800;
  --ok: #047857;
  --ok-bg: rgba(5, 150, 105, .12);
  --danger: #b91c1c;
  --danger-bg: rgba(220, 38, 38, .1);
  --word-bg: rgba(255, 196, 0, .22);
  --word-line: rgba(217, 154, 0, .65);
  --word-hidden-bg: rgba(255, 196, 0, .3);
  --lv1-bg: rgba(22, 163, 74, .16); --lv1-line: rgba(22, 163, 74, .70);
  --lv2-bg: rgba(217, 119, 6, .18); --lv2-line: rgba(217, 119, 6, .75);
  --lv3-bg: rgba(37, 99, 235, .14); --lv3-line: rgba(37, 99, 235, .70);
  --lv4-bg: rgba(0, 0, 0, .05); --lv4-line: rgba(60, 60, 60, .85);
  --word-ok-bg: rgba(5, 150, 105, .18);
  --word-ok-line: rgba(5, 150, 105, .55);
  --shadow: 0 14px 34px rgba(15, 23, 42, .12);
  --video-bg: #111;
  --tag-bg: #eef1f6;
  --tabs-bg: #eaedf3;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: var(--bg-topbar);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .3px; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: grid; place-items: center; font-size: 15px; color: #fff;
}
.nav { display: flex; gap: 6px; margin-left: 6px; }
.nav a { padding: 7px 14px; border-radius: 999px; color: var(--text-dim); font-size: 14px; transition: .15s; }
.nav a:hover { background: var(--bg-card); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-text); }
.spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  background: var(--bg-card); border: 1px solid var(--line); font-size: 15px;
}
.icon-btn:hover { border-color: var(--line-strong); }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer;
  background: var(--bg-soft);
}
.user-chip:hover { border-color: var(--line-strong); }
.tag {
  font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-text);
}
.tag.gold { background: rgba(255, 215, 106, .16); color: var(--warm); }
.tag.grey { background: var(--tag-bg); color: var(--text-mute); }

/* 布局 */
.wrap { max-width: 1240px; margin: 0 auto; padding: 26px 22px 80px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); }

/* 卡片 */
.card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius, 14px);
  padding: 16px; transition: .16s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.video-card { display: flex; flex-direction: column; gap: 10px; }
.video-card h3 { font-size: 16px; line-height: 1.45; margin: 0; font-weight: 600; }
.video-cover { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); }
.video-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--text-mute); }
.lock { color: var(--text-mute); font-size: 12px; }

/* 按钮 */
.btn {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; transition: .15s; font-size: 14px;
}
.btn:hover { border-color: var(--line-strong); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }

/* 表单 */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 11px 13px; background: var(--bg-input); border: 1px solid var(--line);
  border-radius: 10px; outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: var(--bg-input-focus); }
textarea { min-height: 140px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.msg { font-size: 13px; padding: 10px 12px; border-radius: 10px; margin: 12px 0; display: none; }
.msg.show { display: block; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--danger-bg); color: var(--danger); }

/* 登录页 */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; }
.auth-card { width: 100%; max-width: 420px; }
.tabs { display: flex; gap: 4px; background: var(--tabs-bg); padding: 4px; border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--line); }
.tabs button { flex: 1; padding: 9px; border: 0; background: transparent; border-radius: 9px; color: var(--text-dim); cursor: pointer; font-size: 14px; }
.tabs button.active { background: var(--bg-card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.table tr:hover td { background: var(--bg-hover); }
.mono { font-family: ui-monospace, Consolas, monospace; }
.scroll-x { overflow-x: auto; }

/* 播放页 */
.study { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .study { grid-template-columns: 1fr; } }
.player-box { position: sticky; top: 74px; }
@media (max-width: 1080px) { .player-box { position: static; } }
video { width: 100%; display: block; background: var(--video-bg); border-radius: var(--radius, 14px); }
.player-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.timecode { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--text-dim); }
.mode-tabs { display: inline-flex; gap: 3px; background: var(--tabs-bg); padding: 3px; border-radius: 999px; border: 1px solid var(--line); }
.mode-tabs button { border: 0; background: transparent; color: var(--text-dim); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13.5px; }
.mode-tabs button.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }

.cues { margin-top: 16px; max-height: calc(100vh - 190px); overflow-y: auto; padding-right: 6px; }
@media (max-width: 1080px) { .cues { max-height: none; } }
.cue {
  padding: 12px 14px; border: 1.5px solid transparent; border-radius: var(--radius, 14px);
  cursor: pointer; transition: .15s; margin-bottom: 8px; background: var(--bg-soft);
}
.cue:hover { border-color: var(--line-strong); }
.cue.active { background: var(--primary-soft); border-color: var(--primary); }
.cue-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-mute); font-family: ui-monospace, Consolas, monospace; margin-bottom: 5px; }
.cue-en { font-size: 15.5px; line-height: 1.75; }
.cue-cn { font-size: 13.5px; color: var(--text-dim); margin-top: 5px; }
/* 重点词按学段分三色：绿=初中 橙=高中 蓝=大学及以上 */
.word {
  border-radius: 5px; padding: 1px 3px; cursor: pointer;
  background: var(--word-bg); box-shadow: inset 0 -2px 0 var(--word-line);
}
.word:hover { filter: brightness(1.08); }
.word.lv1 { background: var(--lv1-bg); box-shadow: inset 0 -2px 0 var(--lv1-line); }
.word.lv2 { background: var(--lv2-bg); box-shadow: inset 0 -2px 0 var(--lv2-line); }
.word.lv3 { background: var(--lv3-bg); box-shadow: inset 0 -2px 0 var(--lv3-line); }
/* 地名：深灰 + 下划线 */

/* 挖空：文字藏起来，但保留该等级的底色，一眼能看出难易 */
.word.hidden-word { color: transparent; user-select: none; }
.word.revealed { color: inherit; background: var(--word-ok-bg); box-shadow: inset 0 -2px 0 var(--word-ok-line); }

/* 颜色图例 */
.word-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-mute); margin-top: 6px; }
.word-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.word-legend .l1 i { background: var(--lv1-line); }
.word-legend .l2 i { background: var(--lv2-line); }
.word-legend .l3 i { background: var(--lv3-line); }
.word-legend .l4 i { background: var(--lv4-line); }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: none; place-items: center; z-index: 100; padding: 20px; }
.modal-mask.show { display: grid; }
.modal { background: var(--bg-card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; max-width: 520px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }

.hint { color: var(--text-mute); font-size: 12.5px; }
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: var(--radius, 14px); margin-bottom: 20px;
  background: linear-gradient(90deg, var(--word-bg), var(--primary-soft));
  border: 1px solid var(--word-line);
}
.empty { text-align: center; color: var(--text-mute); padding: 50px 0; }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat .card { text-align: center; }
.stat b { display: block; font-size: 24px; margin-bottom: 2px; }
.stat span { color: var(--text-dim); font-size: 12.5px; }

/* 账号下拉菜单 */
.user-wrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 170px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; display: none; z-index: 60; box-shadow: var(--shadow);
}
.user-menu.show { display: block; }
.user-menu a, .user-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0;
  background: transparent; color: var(--text); border-radius: 9px; cursor: pointer; font-size: 14px;
}
.user-menu a:hover, .user-menu button:hover { background: var(--bg-hover); }
.user-menu .sep { height: 1px; background: var(--line); margin: 5px 2px; }

/* 主题切换按钮（浮在右上角，用于没有顶栏的页面） */
.theme-float { position: fixed; top: 14px; right: 16px; z-index: 80; }
/* ---------- 手机端适配 ---------- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .logo { font-size: 16px; }
  .nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .nav a { padding: 6px 12px; white-space: nowrap; }
  .wrap { padding: 18px 14px 60px; }
  .page-title { font-size: 19px; }
  .page-sub { font-size: 13px; margin-bottom: 16px; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  .btn { padding: 10px 14px; }
  .btn-sm { padding: 7px 12px; }
  .mode-tabs { flex-wrap: wrap; justify-content: center; width: 100%; border-radius: 14px; }
  .mode-tabs button { flex: 1 0 auto; padding: 8px 12px; }
  .player-bar { gap: 6px; }
  .player-bar .btn { flex: 1 1 auto; }
  .modal { padding: 18px; max-height: 92vh; }
  .stat { grid-template-columns: repeat(2, 1fr); }
  .auth-card { max-width: 100%; }
  .cue { padding: 11px 12px; }
  .cue-en { font-size: 16px; line-height: 1.7; }
  .cue-cn { font-size: 14px; }
  .table th, .table td { padding: 9px 8px; }
  .banner { padding: 12px 14px; }
  video { border-radius: 12px; }
}

/* ---------- 词汇收藏卡片 ---------- */
.word-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));   /* 大屏：一排 5 个 */
}
@media (max-width: 1100px) {
  .word-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* 平板 / 手机：一排 3 个 */
}
.word-card {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; transition: .15s; min-width: 0;
}
.word-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.wc-head { display: flex; align-items: baseline; gap: 6px; }
.wc-word { font-size: 16px; font-weight: 600; word-break: break-word; line-height: 1.3; }
.wc-speak {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  font-size: 14px; padding: 0 2px; line-height: 1; flex: none;
}
.wc-speak:hover { transform: scale(1.15); }
.wc-ipa { font-size: 11.5px; color: var(--text-dim); font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.wc-zh { font-size: 12.5px; line-height: 1.5; }
.wc-zh .tag { font-size: 10.5px; padding: 1px 6px; margin-right: 4px; }
.wc-tip { font-size: 11px; color: var(--text-mute); line-height: 1.5; }
.wc-src {
  font-size: 11px; color: var(--text-mute); line-height: 1.5; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  border-left: 2px solid var(--line); padding-left: 6px;
}
.wc-video {
  font-size: 11px; color: var(--link); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-top: 2px;
}
.wc-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.wc-actions .btn { flex: 1; padding: 5px 0; font-size: 12px; text-align: center; }

/* 手机：卡片更紧凑，仍然一排 3 个 */
@media (max-width: 720px) {
  .word-grid { gap: 8px; }
  .word-card { padding: 9px; border-radius: 10px; gap: 3px; }
  .wc-word { font-size: 14px; }
  .wc-ipa { font-size: 10px; }
  .wc-zh { font-size: 11.5px; }
  .wc-tip, .wc-video { font-size: 10px; }
  .wc-src { font-size: 10px; -webkit-line-clamp: 2; }
  .wc-actions { gap: 4px; padding-top: 6px; }
  .wc-actions .btn { font-size: 11px; padding: 4px 0; }
  .wc-speak { font-size: 13px; }
}
/* ---------- 手机端补充适配（覆盖最近新增的后台/收藏/音标页）---------- */
@media (max-width: 720px) {
  /* 后台表单里那些固定宽度的字段，手机上改成整行 */
  .field { width: 100% !important; min-width: 0 !important; margin-bottom: 10px !important; }
  .row .field { margin-bottom: 10px !important; }
  .row > .btn, .row > label.btn { flex: 1 1 auto; }
  /* 后台表格：手机上横向滚动，不要挤压变形 */
  .scroll-x { -webkit-overflow-scrolling: touch; }
  .table { font-size: 12.5px; min-width: 520px; }
  .table th, .table td { padding: 8px 7px; white-space: nowrap; }
  .table td .btn { padding: 4px 8px; font-size: 11.5px; }
  /* 收藏卡片：手机上保持 3 列，但字号再小一点 */
  .word-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .word-card { padding: 8px; }
  .wc-word { font-size: 13px; }
  .wc-zh { font-size: 11px; }
  .wc-src { display: none; }          /* 手机上出处句太挤，隐藏 */
  .wc-actions .btn { font-size: 10.5px; padding: 4px 0; }
  /* 音标页：一行 2 个，卡片更紧凑 */
  .ipa-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ipa-card { padding: 10px; }
  .ipa-symbol { font-size: 22px; }
  .ipa-word { font-size: 14px; }
  .ipa-sub { font-size: 10.5px; }
  .group-title { flex-wrap: wrap; margin: 18px 0 8px; }
  .group-title h2 { font-size: 15px; }
  .group-title .hint { font-size: 11px; }
  /* 弹窗和输入框 */
  .modal { padding: 16px; border-radius: 14px; }
  input[type=text], input[type=password], input[type=number], select, textarea { padding: 10px 11px; font-size: 15px; }
}


/* 桌面端隐藏「更多」按钮（控件一直显示） */
@media (min-width: 1081px) { #moreBtn { display: none; } }


.desktop-left { display: flex; flex-direction: column; width: 100%; }
.player-box { grid-area: video; }
.cues-wrap { grid-area: cues; }
.controls-box { grid-area: controls; }

/* 手机端专用元素；桌面端保持隐藏，不影响现有电脑版 */
.mobile-mode-tabs-wrap,
.mobile-player { display: none; }

@media (max-width: 1080px) {
  .study { grid-template-columns: 1fr; grid-template-areas: "video" "cues" "controls"; }
  body.page-watch .cues-wrap { margin-top: 2px; }
  body.page-watch #cues { padding-top: 0; padding-bottom: 8px; }
  body.page-watch #title { font-size: 14px; margin: 8px 0 2px; }
  body.page-watch #meta { font-size: 10.5px; }
  body.page-watch .word-legend { font-size: 11px; gap: 8px; margin-top: 4px; }
  
  body.page-watch .player-bar { margin-top: 8px; }
}










/* ============================================================
   播放页 · 手机端（唯一一份，其它重复规则已清理）
   顺序：标题 → 分类 → 视频 → 字幕 → 控件
   ============================================================ */
@media (max-width: 1080px) {
  /* 锁屏：整页不动，字幕区自己滚 */
  html.is-watch, body.page-watch { height: 100%; overflow: hidden; }
  body.page-watch { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  body.page-watch .topbar { position: static; padding: 6px 12px; }
  body.page-watch .nav { display: none; }
  body.page-watch #userName { display: none; }

  body.page-watch .wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 8px 12px 0; margin: 0; max-width: 100%; overflow-x: hidden; }
  body.page-watch .study { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: stretch; width: 100%; min-width: 0; max-width: 100%; }

  /* 标题、难度、分类 放在视频上面 */
  body.page-watch .player-box { flex: 0 0 auto; display: flex; flex-direction: column; position: static; margin: 0; padding: 0; width: 100%; min-width: 0; max-width: 100%; }
  body.page-watch #title { order: 1; font-size: 13px; margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.page-watch #meta { order: 2; font-size: 10px; margin: 0 0 4px; white-space: nowrap; overflow: hidden; }
  body.page-watch video { order: 3; display: block; width: 100%; max-width: 100%; max-height: 30vh; height: auto; margin-left: auto; margin-right: auto; }
  body.page-watch .word-legend { display: none; }

  body.page-watch .cues-wrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 6px 0 0; }
  body.page-watch #cues { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 2px 4px; }
  body.page-watch .cue { padding: 7px 10px 8px; margin-bottom: 5px; }
  body.page-watch .cue-head { font-size: 10.5px; margin-bottom: 4px; }
  body.page-watch .cue-en { font-size: 15px; line-height: 1.55; }
  body.page-watch .cue-cn { font-size: 12.5px; line-height: 1.5; margin-top: 3px; }

  /* 底部留白：固定 60px + 安全区，确保控件不被返回键/手势条/浏览器底栏挡住 */
  body.page-watch .controls-box {
    flex: 0 0 auto; display: block; margin: 4px 0 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  body.page-watch .player-bar { margin-top: 4px; gap: 4px; }
  body.page-watch .mode-tabs button { padding: 4px 7px; font-size: 11.5px; }
  body.page-watch .btn-sm { padding: 4px 7px; font-size: 11px; }
  body.page-watch #rate { width: 82px; font-size: 11px; }
}


/* ---------- 手机端：功能收进「更多」 ---------- */
@media (max-width: 1080px) {
  body.page-watch #moreBtn { display: inline-block; }
  body.page-watch .more-tools { display: none; width: 100%; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
  body.page-watch .more-tools.open { display: flex; }
  body.page-watch .more-tools .btn { flex: 1 1 auto; padding: 5px 8px; font-size: 11.5px; }
}
/* 桌面端：不显示「更多」按钮，功能一直可见 */
@media (min-width: 1081px) {
  body.page-watch #moreBtn { display: none; }
  body.page-watch .more-tools { display: flex; gap: 8px; flex-wrap: wrap; }
}





/* ============================================================
   播放页 · 电脑端（≥1081px）：左栏视频+控件，右栏字幕
   ============================================================ */
@media (min-width: 1081px) {
  body .study {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-rows: auto !important;
    gap: 0 20px !important;
    align-items: start !important;
    align-content: start !important;
    max-width: none !important;
  }
  body .desktop-left { grid-column: 1 !important; grid-row: 1 !important; align-self: start !important; min-width: 0; }
  body .desktop-left .player-box { grid-column: auto !important; grid-row: auto !important; align-self: stretch !important; position: static !important; display: flex !important; flex-direction: column !important; }
  body.page-watch #title { order: 1; font-size: 19px !important; margin: 0 0 4px !important; white-space: normal !important; }
  body.page-watch #meta { order: 2; font-size: 12px !important; margin: 0 0 8px !important; }
  body.page-watch video { order: 3; width: 100% !important; max-height: 68vh !important; height: auto !important; }

  body .cues-wrap { grid-column: 2 !important; grid-row: 1 !important; display: block !important; min-width: 0; min-height: 0; }
  body.page-watch #cues { max-height: calc(100vh - 190px) !important; min-height: 0; overflow-y: auto !important; }

  body .controls-box { grid-column: 1 !important; grid-row: 2 !important; align-self: start !important; display: block !important; margin-top: 6px !important; }
  body .desktop-left .controls-box { grid-column: auto !important; grid-row: auto !important; margin-top: 0 !important; }
  body .desktop-left .controls-box > .player-bar:first-child { margin-top: 0 !important; }
  body.page-watch #moreBtn { display: none !important; }
  body.page-watch .more-tools { display: flex !important; gap: 8px; flex-wrap: wrap; }
  body.page-watch .word-legend { display: flex !important; position: static; margin-top: 8px; background: transparent; border: 0; padding: 0; }
}

/* 电脑端大屏展开：视频和字幕铺满浏览器 */
@media (min-width: 1081px) {
  body.theater-mode { overflow: hidden; }
  body.theater-mode .topbar { display: none !important; }
  body.theater-mode .wrap { width: 100vw; max-width: none; height: 100vh; margin: 0; padding: 0; overflow: hidden; }
  body.theater-mode .study {
    width: 100vw; height: 100vh;
    grid-template-columns: minmax(0, 1.9fr) minmax(320px, 1fr) !important;
    grid-template-rows: 1fr !important;
    gap: 0 !important;
  }

  /* 大屏模式跟白天/夜间主题保持一致，不再强制黑底 */
  body.theater-mode .desktop-left { height: 100vh; min-height: 0; display: flex; background: var(--bg); }
  body.theater-mode .desktop-left .player-box {
    flex: 1 1 auto; min-height: 0; display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr);
    align-content: stretch; align-items: stretch;
    position: static !important; padding: 0; background: var(--bg);
    overflow: hidden;
  }
  body.theater-mode .player-box #title {
    display: block !important;
    order: 0; margin: 10px 16px 4px !important;
    font-size: 19px !important; line-height: 1.35 !important;
    color: var(--text); white-space: normal !important;
    overflow: hidden; text-overflow: ellipsis;
  }
  body.theater-mode .player-box #meta {
    display: flex !important;
    order: 1; align-items: center; gap: 8px;
    margin: 0 16px 10px !important; color: var(--text-dim);
    border-bottom: 1px solid var(--line); padding-bottom: 8px;
  }
  body.theater-mode video {
    order: 2; width: 100% !important; height: 100% !important;
    min-height: 0; max-width: none !important; max-height: none !important;
    object-fit: contain; border-radius: 0; background: var(--bg);
  }

  /* 底部功能条平铺；空的模式栏隐藏，模式栏已经移到右侧字幕上方 */
  body.theater-mode .desktop-left .controls-box {
    flex: 0 0 auto; width: 100%; margin: 0 !important; padding: 6px 12px;
    background: var(--bg-card); color: var(--text);
    border-top: 1px solid var(--line);
  }
  body.theater-mode .desktop-left .controls-box > .player-bar:first-child { display: none !important; }
  body.theater-mode .desktop-left .controls-box > .player-bar { width: 100%; margin-top: 0 !important; justify-content: space-around; gap: 10px; }
  body.theater-mode .desktop-left .controls-box > .player-bar > * { flex: 0 1 auto; }

  /* 右侧：模式栏固定在字幕上方，字幕铺满剩余高度 */
  body.theater-mode .cues-wrap {
    display: flex !important; flex-direction: column;
    grid-column: 2 !important; grid-row: 1 !important;
    height: 100vh; min-height: 0; background: var(--bg);
  }
  body.theater-mode .cues-wrap > .mode-tabs {
    flex: 0 0 auto; width: calc(100% - 20px); margin: 8px 10px 0;
    justify-content: space-between;
  }
  body.theater-mode .cues-wrap > .mode-tabs button { flex: 1 1 0; }
  body.theater-mode #cues {
    flex: 1 1 auto; height: auto; min-height: 0; max-height: none !important;
    margin-top: 0 !important; padding: 4px 12px 100px;
  }
}


/* ---------- 手机端：控制条压成一行（含时长），时长排在「更多」后面 ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar:last-of-type {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 3px !important;
  }
  /* 左右缩一点，保证 上句/下句/倍速/更多/时长 能挤进一行 */
  body.page-watch .controls-box .player-bar:last-of-type .btn-sm {
    padding: 4px 5px !important;
    font-size: 10.5px !important;
    flex: 0 1 auto !important;
    white-space: nowrap;
  }
  body.page-watch #rate { width: 70px !important; font-size: 10.5px !important; flex: 0 0 auto !important; }
  body.page-watch .timecode {
    font-size: 10px !important; white-space: nowrap;
    margin-left: auto;                 /* 时长靠右 */
    flex: 0 0 auto;
  }
  body.page-watch #moreBtn { flex: 0 0 auto !important; }
}


/* ---------- 手机端：控制条居中；四色图例收进「更多」 ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar:last-of-type { justify-content: center !important; }
  body.page-watch .timecode { margin-left: 6px !important; }     /* 不再靠右，跟着一起居中 */
  body.page-watch .word-legend { display: none !important; }      /* 默认不显示 */
  body.page-watch .word-legend.show {
    display: flex !important; position: static !important;
    margin: 4px 0 0 !important; padding: 0 !important;
    background: transparent !important; border: 0 !important;
    font-size: 10.5px !important; gap: 8px !important;
    justify-content: center; width: 100%;
  }
  body.page-watch .word-legend.show i { width: 8px; height: 8px; margin-right: 3px; }
}





.word.revealed { color: inherit !important; background: var(--word-ok-bg) !important; box-shadow: inset 0 -2px 0 var(--word-ok-line) !important; }


html[data-theme="light"] .word-legend .l4 i { background: #111 !important; border: 0; }



html[data-theme="light"] .word-legend span.l4 i,
html[data-theme="light"] body.page-watch .word-legend span.l4 i {
  background-color: #000 !important;
  border: 0 !important;
}

/* ---------- 修正：功能区居中（用相邻兄弟选择器，之前 :last-of-type 选错了） ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar + .player-bar {
    justify-content: center !important;
    text-align: center;
  }
  body.page-watch .controls-box .player-bar + .player-bar > * { flex: 0 0 auto !important; }
}


/* ---------- 字幕里的地名：灰色下划线（无底色） ---------- */
.word.lv4 {
  background: transparent !important;
  color: inherit !important;
  box-shadow: inset 0 -2px 0 rgba(150, 150, 150, .95) !important;
  font-weight: 600;
}
html[data-theme="light"] .word.lv4 {
  box-shadow: inset 0 -2px 0 rgba(90, 90, 90, .95) !important;
}
/* 挖空 / 显示答案 仍按原来的行为 */
.word.hidden-word { color: transparent !important; }
.word.revealed { color: inherit !important; background: var(--word-ok-bg) !important; box-shadow: inset 0 -2px 0 var(--word-ok-line) !important; }

/* ---------- 「更多」图例里的地名色块：黑色（你真正要的那个） ---------- */
.word-legend span.l4 i {
  background-color: #000 !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, .6) !important;
}
html[data-theme="light"] .word-legend span.l4 i {
  background-color: #000 !important;
  border: 0 !important;
}


/* ---------- 手机端：控制条进一步收窄，确保一行放得下且能居中 ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar + .player-bar {
    justify-content: center !important;
    flex-wrap: nowrap !important;
    gap: 2px !important;
    overflow: visible;
  }
  body.page-watch .controls-box .player-bar + .player-bar .btn-sm {
    padding: 4px 4px !important;
    font-size: 10px !important;
    flex: 0 1 auto !important;
    min-width: 0;
  }
  body.page-watch #rate { width: 62px !important; font-size: 10px !important; padding: 3px 3px !important; }
  body.page-watch .timecode { font-size: 9.5px !important; margin-left: 4px !important; white-space: nowrap; }
  /* 图例显示时也居中 */
  body.page-watch .word-legend.show { justify-content: center !important; gap: 7px !important; }
}


/* ---------- 手机端：控制条最终版（允许换行 + 始终居中，绝不重叠） ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar + .player-bar {
    display: flex !important;
    flex-wrap: wrap !important;          /* 放不下就换行，而不是互相挤 */
    justify-content: center !important;  /* 每行都居中 */
    align-items: center;
    gap: 4px !important;
  }
  body.page-watch .controls-box .player-bar + .player-bar .btn-sm {
    padding: 5px 7px !important;
    font-size: 11px !important;
    flex: 0 0 auto !important;
  }
  body.page-watch #rate { width: 72px !important; font-size: 11px !important; flex: 0 0 auto !important; }
  body.page-watch .timecode { font-size: 10px !important; margin-left: 4px !important; white-space: nowrap; flex: 0 0 auto !important; }
  body.page-watch .word-legend.show { justify-content: center !important; gap: 8px !important; }
}


/* ---------- 手机端：「更多」里三个功能排齐（各占 1/3，居中） ---------- */
@media (max-width: 1080px) {
  body.page-watch .more-tools,
  body.page-watch .more-tools.open {
    width: 100% !important;
    display: none;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    gap: 6px !important;
    margin: 2px 0 0 !important;
  }
  body.page-watch .more-tools.open { display: flex !important; }
  body.page-watch .more-tools .btn {
    flex: 1 1 0 !important;          /* 三个按钮等宽 */
    min-width: 0;
    padding: 5px 4px !important;
    font-size: 11px !important;
    text-align: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


/* ---------- 手机端：功能排再收一点，留出居中余量（收起/展开位置一致） ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar + .player-bar .btn-sm {
    padding: 4px 6px !important;
    font-size: 10.5px !important;
  }
  body.page-watch #rate { width: 68px !important; font-size: 10.5px !important; }
  body.page-watch .timecode { font-size: 10px !important; margin-left: 2px !important; }
  /* 功能排固定居中，收起和展开时都保持同一位置 */
  body.page-watch .controls-box .player-bar + .player-bar {
    justify-content: center !important;
    gap: 4px !important;
  }
}


/* ---------- 手机端：功能排加入「收藏」后仍然一行居中 ---------- */
@media (max-width: 1080px) {
  body.page-watch .controls-box .player-bar + .player-bar .btn-sm {
    padding: 4px 5px !important;
    font-size: 10px !important;
  }
  body.page-watch #rate { width: 64px !important; font-size: 10px !important; }
  body.page-watch .timecode { font-size: 9.5px !important; margin-left: 2px !important; }
  body.page-watch #favVideo { flex: 0 0 auto !important; }
}

/* ---------- 手机端：模式栏紧贴视频；底部改成播放器控制栏 ---------- */
@media (max-width: 1080px) {
  body.page-watch .mobile-mode-tabs-wrap {
    display: block !important;
    width: 100%;
    margin: 2px 0 0;
  }
  body.page-watch .mobile-mode-tabs-wrap .mode-tabs {
    display: flex !important;
    width: 100%;
    margin: 0;
  }
  body.page-watch .mobile-mode-tabs-wrap .mode-tabs button {
    flex: 1 1 0;
    padding: 5px 4px;
    font-size: 11.5px;
  }
  body.page-watch .cues-wrap { width: 100%; margin-top: 0 !important; }
  body.page-watch #cues { margin-top: 0 !important; padding-top: 0 !important; padding-bottom: 108px !important; }

  /* 原来的文字功能排在手机端隐藏，改用下面的播放器控制栏 */
  body.page-watch .controls-box { display: none !important; }

  /* 底部控制栏覆盖在字幕上；半透明浅蓝可以看到后面的字幕 */
  body.page-watch .mobile-player {
    display: block !important;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 0;
    z-index: 70;
    width: auto;
    box-sizing: border-box;
    margin: 0;
    padding: 3px 10px calc(7px + env(safe-area-inset-bottom, 0px));
    background: rgba(180, 214, 248, .52);
    color: #153a56;
    border: 1px solid rgba(255,255,255,.62);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    backdrop-filter: blur(2px) saturate(1.08);
    -webkit-backdrop-filter: blur(2px) saturate(1.08);
    box-shadow: 0 -8px 24px rgba(44, 111, 159, .18);
  }
  body.page-watch .mobile-progress-row {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 20px;
  }
  body.page-watch #mobileProgress {
    flex: 1 1 auto;
    min-width: 0;
    height: 20px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    accent-color: #e88952;
    cursor: pointer;
    touch-action: pan-x;
  }
  body.page-watch #mobileProgress::-webkit-slider-runnable-track {
    height: 2px;
    border-radius: 999px;
    background: rgba(21,58,86,.24);
  }
  body.page-watch #mobileProgress::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -5px;
    -webkit-appearance: none;
    border: 0;
    border-radius: 50%;
    background: #f5f6f8;
  }
  body.page-watch #mobileProgress::-moz-range-track {
    height: 2px;
    border-radius: 999px;
    background: rgba(21,58,86,.24);
  }
  body.page-watch #mobileProgress::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 0;
    border-radius: 50%;
    background: #f5f6f8;
  }
  body.page-watch .mobile-timecode {
    flex: 0 0 auto;
    font: 9px/1 ui-monospace, Consolas, monospace;
    color: rgba(21,58,86,.72);
    white-space: nowrap;
  }
  body.page-watch .mobile-control-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    min-height: 43px;
  }
  body.page-watch .mobile-control-side,
  body.page-watch .mobile-control-center {
    display: flex;
    align-items: center;
    gap: 7px;
  }
  body.page-watch .mobile-control-center { justify-content: center; gap: 13px; }
  body.page-watch .mobile-control-right { justify-content: flex-end; }
  body.page-watch .mobile-icon-btn,
  body.page-watch .mobile-rate-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #153a56;
    cursor: pointer;
    padding: 0;
  }
  body.page-watch .mobile-icon-btn {
    width: 31px;
    height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    line-height: 1;
  }
  body.page-watch .mobile-icon-btn.is-active { color: #b26a33; }
  body.page-watch .mobile-rate-btn {
    min-width: 38px;
    height: 24px;
    padding: 0 5px;
    border: 1px solid rgba(21,58,86,.26);
    border-radius: 999px;
    font-size: 10px;
    color: rgba(21,58,86,.82);
  }
  body.page-watch .mobile-play-btn {
    width: 39px;
    height: 39px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #2d6f9d;
    color: #f5f6f8;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
  }
  body.page-watch .mobile-more-panel {
    display: none;
    flex-wrap: wrap;
    gap: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(21,58,86,.16);
  }
  body.page-watch .mobile-more-panel.open { display: flex; }
  body.page-watch .mobile-tool-btn {
    flex: 1 1 auto;
    min-width: 72px;
    padding: 5px 7px;
    border: 1px solid rgba(21,58,86,.20);
    border-radius: 9px;
    background: rgba(255,255,255,.42);
    color: #153a56;
    font-size: 11px;
    text-align: center;
  }
  body.page-watch .mobile-more-panel .mobile-legend {
    display: none !important;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-top: 3px;
    font-size: 10.5px;
    color: rgba(21,58,86,.76);
  }
  body.page-watch .mobile-more-panel.open .mobile-legend { display: flex !important; }
}
