/* ══════════════════════════════════════════
   Safe Near Me — 泰语逐句跟读
   ══════════════════════════════════════════ */

:root {
  --bg:        #f7f3ee;
  --bg-soft:   #fffdfa;
  --card:      #ffffff;
  --card-2:    #faf7f2;
  --line:      #e6ded3;
  --line-soft: #efe8de;
  --text:      #2b2622;
  --text-2:    #6b6055;
  --text-3:    #9b9086;
  --accent:    #c2643a;
  --accent-soft:#fdf0e8;
  --accent-2:  #2f7d6e;
  --accent-2-soft:#e6f2ef;
  --hl:        #fff3d6;
  --hl-edge:   #e8b93f;
  --danger:    #c2453a;
  --shadow:    0 1px 2px rgba(43,38,34,.06), 0 6px 20px rgba(43,38,34,.07);
  --shadow-lg: 0 8px 40px rgba(43,38,34,.18);
  --radius:    14px;
  --thai-font: "Noto Sans Thai", "Thonburi", "Leelawadee UI", "Tahoma", system-ui, sans-serif;
  --display-font: "Fraunces", Georgia, "Songti SC", serif;
  --mono-font: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --home-bg: #f7f3ee;
  --home-bg-2: #efe6d8;
  --home-card: #ffffff;
  --home-line: #e6ded3;
}

:root[data-theme="dark"] {
  --bg:        #17151a;
  --bg-soft:   #1e1b21;
  --card:      #232028;
  --card-2:    #2a262f;
  --line:      #383341;
  --line-soft: #2f2b37;
  --text:      #eee9f0;
  --text-2:    #b0a7b8;
  --text-3:    #7d7486;
  --accent:    #f0906a;
  --accent-soft:#3a2a24;
  --accent-2:  #6fc8b4;
  --accent-2-soft:#213330;
  --hl:        #3d3520;
  --hl-edge:   #d9a92f;
  --danger:    #ef7d72;
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.55);
  --home-bg: #15131a;
  --home-bg-2: #1c1922;
  --home-card: #211e28;
  --home-line: #34303e;
}

* { box-sizing: border-box; }
html[data-i18n-pending] body { visibility: hidden; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom);
}

.spacer { flex: 1; }
.hidden { display: none !important; }

/* ── 顶栏 ───────────────────────────── */
/* 顶栏默认不吸顶：唱歌时用不到，让它滚走把屏幕留给歌词。
   按了「📌 固定」（.pinned）才吸到最上面。 */
.topbar {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.topbar.pinned {
  position: sticky; top: 0; z-index: 35;
  box-shadow: 0 6px 16px -10px rgba(43,38,34,.35);
}
:root[data-theme="dark"] .topbar.pinned { box-shadow: 0 6px 16px -10px rgba(0,0,0,.7); }

/* 播放器 + KTV 合成一个整体，默认吸顶（.pinned），也能按「📌 固定」关掉滚走。
   之前两者各自 sticky 且 top 相同，会互相抢位置，KTV 面板被压到播放器底下切掉。
   top 用 --eff-topbar-h：顶栏没固定时是 0，固定了就顶开顶栏那么高，两层不重叠。 */
.stickydeck {
  background: var(--bg);
  /* KTV 背景视频那段（下面 body.mode-ktv.ktv-bg-video .video-box 的注释）靠这层
     自成一个层叠上下文才能稳定盖在 KTV 歌词下面；固定/不固定播放器都不能丢这个，
     所以放在没有 .pinned 也生效的基础规则里，不能只写在 .pinned 里。 */
  isolation: isolate;
}
.stickydeck.pinned {
  position: sticky; top: var(--eff-topbar-h, 0px); z-index: 30;
  box-shadow: 0 6px 16px -10px rgba(43,38,34,.35);
}
:root[data-theme="dark"] .stickydeck.pinned { box-shadow: 0 6px 16px -10px rgba(0,0,0,.7); }
.topbar-inner {
  max-width: 1020px; margin: 0 auto;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand h1 {
  margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em;
}
.brand .sub {
  margin: 2px 0 0; font-size: 13px; color: var(--text-2);
}
.brand .sub span:first-child { font-family: var(--thai-font); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.language-picker {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: 13px;
}
.language-picker select {
  appearance: none; border: 0; background: transparent; color: inherit;
  font: inherit; cursor: pointer; padding: 0 12px 0 0;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 5px) 55%, 100% 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.language-picker select:focus { outline: none; }
.page-hero-actions {
  position: absolute; top: 18px; right: 20px; display: flex; align-items: center; gap: 8px;
}
.page-hero-actions .icon-btn { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: inherit; }
.page-hero-actions .language-picker { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.22); color: inherit; }

/* 练习 / KTV 模式切换 */
.mode-toggle {
  display: flex; gap: 2px; background: var(--card-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; margin-right: 2px;
}
.mode-btn {
  background: transparent; border: none; border-radius: 999px; cursor: pointer;
  padding: 6px 13px; font-size: 12.5px; color: var(--text-2); font-family: inherit;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mode-btn.active { background: var(--accent); color: #fff; font-weight: 600; }

.icon-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s, border-color .15s, transform .08s;
  font-family: inherit;
}
.icon-btn:hover { background: var(--card-2); border-color: var(--text-3); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.toggle.active {
  background: var(--accent-2-soft); border-color: var(--accent-2); color: var(--accent-2);
  font-weight: 600;
}

/* ── 站内导航：汉堡图标 + 抽屉 ─────────── */
.nav-fab {
  position: fixed; top: 14px; left: 14px; z-index: 60;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  border-radius: 50%; font-size: 17px; cursor: pointer; box-shadow: var(--shadow);
  transition: background .15s, border-color .15s, transform .08s;
}
.nav-fab:hover { background: var(--card-2); border-color: var(--text-3); }
.nav-fab:active { transform: translateY(1px); }

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.38);
  z-index: 70; opacity: 0; transition: opacity .18s;
}
.drawer-overlay:not(.hidden) { opacity: 1; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 84vw);
  background: var(--card); border-right: 1px solid var(--line);
  box-shadow: var(--shadow-lg); z-index: 71;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .2s ease;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 14px; border-bottom: 1px solid var(--line);
}
.drawer-title { font-size: 15px; font-weight: 700; }
.drawer-close {
  background: transparent; border: none; color: var(--text-3);
  font-size: 15px; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.drawer-close:hover { background: var(--card-2); color: var(--text); }

.drawer-account { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-account-btn { width: 100%; text-align: center; }
.account-chip {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0;
  padding: 5px 10px 5px 5px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--text); font: inherit; font-size: 13px;
  cursor: pointer; box-shadow: 0 1px 2px rgba(43,38,34,.06);
}
.account-chip:hover { background: var(--card-2); border-color: var(--text-3); }
.account-avatar {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  overflow: hidden; border-radius: 50%; background: var(--accent-soft); font-size: 15px;
}
.account-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.account-chip.logged-in .account-avatar { box-shadow: 0 0 0 2px var(--accent-2); }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.drawer-account-btn { justify-content: flex-start; border-radius: 12px; padding: 7px; }

.drawer-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line-soft);
  transition: background .12s;
}
.drawer-item:hover { background: var(--card-2); }
.drawer-item-icon { font-size: 21px; flex: none; }
.drawer-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.drawer-item-text b { font-size: 14px; }
.drawer-item-text small { font-size: 12px; color: var(--text-3); }
/* 当前页对应的入口高亮出来，一眼看出自己在哪 */
body[data-page="home"] .drawer-item[data-page="home"],
body[data-page="song"] .drawer-item[data-page="home"],
body[data-page="freq"] .drawer-item[data-page="freq"],
body[data-page="science"] .drawer-item[data-page="science"] {
  background: var(--accent-soft);
}
body[data-page="home"] .drawer-item[data-page="home"] .drawer-item-text b,
body[data-page="song"] .drawer-item[data-page="home"] .drawer-item-text b,
body[data-page="freq"] .drawer-item[data-page="freq"] .drawer-item-text b,
body[data-page="science"] .drawer-item[data-page="science"] .drawer-item-text b {
  color: var(--accent);
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok   { background: #3ba55d; box-shadow: 0 0 0 3px rgba(59,165,93,.16); }
.dot.warn { background: #d9a92f; box-shadow: 0 0 0 3px rgba(217,169,47,.18); }
.dot.bad  { background: var(--danger); box-shadow: 0 0 0 3px rgba(194,69,58,.16); }

/* ── 提示条 ─────────────────────────── */
.banner {
  max-width: 1020px; margin: 14px auto 0; padding: 14px 16px;
  background: #fff6e6; border: 1px solid #e9d3a3; border-radius: var(--radius);
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 14px; color: #6a4f1c;
}
:root[data-theme="dark"] .banner { background: #33280f; border-color: #6b551f; color: #f0dfb4; }
.banner-body { flex: 1; }
.banner-body p { margin: 6px 0 0; line-height: 1.65; }
.banner-body ol { margin: 8px 0 0; padding-left: 20px; }
.banner-body ol li { margin: 3px 0; }
.banner-close {
  background: none; border: none; cursor: pointer; font-size: 15px;
  color: inherit; opacity: .5; padding: 2px 4px; line-height: 1;
}
.banner-close:hover { opacity: 1; }

/* ── 播放器 ─────────────────────────── */
.player-wrap {
  background: var(--bg); padding: 12px 18px 10px;
}
/* 不裁剪溢出：进度条的时间气泡要能浮到卡片外面。
   画面的圆角改由 .video-box 自己收边。 */
.player-card {
  max-width: 1020px; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.video-box {
  position: relative; width: 100%;
  aspect-ratio: 16/9; max-height: 190px;
  background: #000; overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: height .2s, max-height .2s;
}
.video-box iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* 画面三档。「只要声音」把外框压到 0 并裁掉，但 iframe 仍保持真实尺寸，
   否则 YouTube 会因为播放器不可见而拒绝播放。 */
.video-box[data-size="off"] {
  height: 0; max-height: 0; aspect-ratio: auto;
}
.video-box[data-size="off"] iframe { height: 200px; }
.video-box[data-size="small"] { max-height: 104px; }
.video-box[data-size="large"] { max-height: 260px; }

.transport {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-top: 1px solid var(--line-soft);
}
.tbtn {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: background .15s, border-color .15s, transform .08s;
  white-space: nowrap;
}
.tbtn:hover { background: var(--bg); border-color: var(--text-3); }
.tbtn:active { transform: translateY(1px); }
.tbtn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  min-width: 52px; font-size: 15px;
}
.tbtn.primary:hover { filter: brightness(1.06); }
.tbtn.toggle.active {
  background: var(--accent-2-soft); border-color: var(--accent-2); color: var(--accent-2);
  font-weight: 600;
}
/* ── 整首歌进度条 ─────────────────────
   点一下跳过去，按住拖着走。轨道上的竖线是每一句的起点，
   段落第一句的竖线更高一点，方便一眼找到主歌/副歌。 */
.seekrow {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 14px 3px;
}
.seek-time {
  font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; flex: none; min-width: 34px;
}
.seek-time:last-child { text-align: right; }

.seek {
  position: relative; flex: 1; min-width: 0;
  padding: 10px 0;                 /* 上下留出手指/鼠标的抓取范围 */
  cursor: pointer; touch-action: none;
  outline: none;
}
.seek.disabled { pointer-events: none; opacity: .5; }
.seek-track {
  position: relative; height: 7px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.seek-buffer {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: var(--line-soft); filter: brightness(.94);
}
:root[data-theme="dark"] .seek-buffer { background: #4a4454; filter: none; }
/* 单句循环时，被循环的那一段在轨道上标出来 */
.seek-loop {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  background: var(--accent-2); opacity: .32;
}
.seek-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: var(--accent); border-radius: 999px;
}

.seek-marks { position: absolute; inset: 10px 0; pointer-events: none; }
.seek-mark {
  position: absolute; top: 1px; width: 1.5px; height: 5px;
  margin-left: -.75px; border-radius: 1px;
  background: var(--text-3); opacity: .55;
}
.seek-mark.sec { top: -2px; height: 11px; opacity: .8; background: var(--text-2); }
.seek-mark.on  { background: var(--text); opacity: 1; }

.seek-thumb {
  position: absolute; top: 50%; left: 0;
  width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid var(--card); box-shadow: var(--shadow);
  pointer-events: none;
  transition: transform .12s;
}
.seek:hover .seek-thumb, .seek:focus-visible .seek-thumb { transform: scale(1.18); }
.seek.dragging .seek-thumb { transform: scale(1.35); }
.seek:focus-visible .seek-track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* 悬停/拖动时跟着走的小气泡：时间 + 那个位置是第几句 */
.seek-tip {
  position: absolute; bottom: calc(100% - 8px); left: 0;
  transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  border-radius: 8px; padding: 5px 10px; font-size: 12px; line-height: 1.45;
  white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; z-index: 5; box-shadow: var(--shadow);
}
.seek-tip b { font-variant-numeric: tabular-nums; }
.seek-tip span:not(:empty) { margin-left: 7px; opacity: .8; }

.time-readout {
  font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-2);
  padding: 0 4px; white-space: nowrap;
}
.ctl { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.ctl select {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 5px 8px; font-size: 13px; font-family: inherit; cursor: pointer;
}
.ctl input[type=range] { width: 108px; accent-color: var(--accent); }

/* ── 视图栏 ─────────────────────────── */
/* 紧跟在顶栏 + 播放器下面吸顶，往下滑歌词时「显示：」这排开关也留在最上面。
   top 用 --eff-topbar-h + --eff-deck-h（app.js 按两者是否固定、实际高度算出来）
   叠在当前实际吸顶的那些层正下方，谁固定就顶多少，不固定就是 0。 */
.viewbar {
  position: sticky; top: calc(var(--eff-topbar-h, 0px) + var(--eff-deck-h, 0px)); z-index: 25;
  background: var(--bg-soft); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.viewbar-inner {
  max-width: 1020px; margin: 0 auto; padding: 9px 18px;
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
}
.viewbar-label { font-size: 12.5px; color: var(--text-3); }
.chip { cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 12.5px; color: var(--text-2); transition: all .15s;
}
.chip input:checked + span {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600;
}

/* ── 尤克里里和弦 ─────────────────────
   默认关着，视图栏的 🎸 或 KTV 右上角的胶囊都能打开，两种模式共用一个开关。 */

/* 和弦说明条：调性 + 怎么读那张按法图 */
.uku-hint {
  max-width: 1020px; margin: 0 auto; padding: 9px 18px 0;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-3);
}
.uku-hint b { font-size: 13px; color: var(--accent-2); }
.uku-hint-note { color: var(--text-3); font-style: italic; }

/* 一句歌词上方那一排和弦：名字在上，按法图在下 */
.line-chords { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 8px; }
.chord-chip {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 8px 6px; border-radius: 9px;
  background: var(--accent-2-soft); border: 1px solid var(--line-soft);
  color: var(--accent-2);
}
.chord-name {
  font-size: 13px; font-weight: 700; line-height: 1;
  letter-spacing: .02em; font-variant-numeric: tabular-nums;
}
.piano-chord-chip { min-width: 276px; align-items: stretch; }
.piano-chord-chip .chord-name { text-align: center; }
.piano-voicing { display: grid; gap: 2px; font-size: 11px; line-height: 1.35; color: var(--text-2); }
.piano-voicing b { color: var(--accent-2); font-weight: 700; }
.piano-voicing small { color: var(--text-3); font-size: 10px; white-space: nowrap; }
.piano-keyboard { display: block; width: 252px; height: 72px; margin: 2px auto 3px; overflow: visible; }
.pk-white { fill: #fff; stroke: #8e8a84; stroke-width: .7; }
.pk-black { fill: #262422; stroke: #151412; stroke-width: .5; }
.pk-dot { stroke: #fff; stroke-width: 1.2; }
.pk-left { fill: #df7a3f; }
.pk-right { fill: #2d9b83; }
.piano-legend { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.piano-legend i { width: 8px; height: 8px; border-radius: 50%; margin-left: 5px; }
.piano-legend i:first-child { margin-left: 0; }
.pk-legend-left { background: #df7a3f; }
.pk-legend-right { background: #2d9b83; }

/* 按法图：四根弦 × 四品，○ 是空弦，● 是按在那一品。
   线和点都用 currentColor，放到深色的 KTV 背景上也不用另配一套颜色。 */
.chord-dia { display: block; width: 26px; height: 34px; overflow: visible; }
.chord-dia line { stroke: currentColor; stroke-width: 1; opacity: .42; }
.chord-dia .cd-fret.nut { stroke-width: 2.4; opacity: .8; }
.chord-dia .cd-dot { fill: currentColor; }
.chord-dia .cd-open { fill: none; stroke: currentColor; stroke-width: 1.1; opacity: .55; }
.chord-dia .cd-base { font-size: 9px; fill: currentColor; opacity: .65; }

/* ── 歌词区 ─────────────────────────── */
.lyrics { max-width: 1020px; margin: 0 auto; padding: 20px 18px 60px; }

.section { margin-bottom: 30px; }
.section-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px;
  padding-bottom: 7px; border-bottom: 1px solid var(--line);
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.section-head .en { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.section-head .note { font-size: 12px; color: var(--text-3); margin-left: auto; }

.line {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 12px;
  box-shadow: var(--shadow); overflow: hidden;
  transition: border-color .2s, box-shadow .2s, background .2s;
  /* 自动滚动时留出吸顶区的高度，别让当前句藏到播放器/KTV 底下。
     --sticky-total-h 由 app.js 按顶栏/播放器是否固定 + 视图栏高度算出来 */
  scroll-margin-top: calc(var(--sticky-total-h, 260px) + 18px);
}
.line.active {
  border-color: var(--hl-edge); background: var(--hl);
  box-shadow: 0 0 0 3px rgba(232,185,63,.18), var(--shadow);
}
.line.done { opacity: .72; }
.line.done .line-th { text-decoration-color: var(--text-3); }

.line-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 10px; }

.line-no {
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
  background: var(--card-2); border: 1px solid var(--line-soft);
  border-radius: 6px; padding: 3px 7px; flex: none; margin-top: 5px;
  cursor: pointer;
}
.line-no:hover { color: var(--accent); border-color: var(--accent); }

.line-main { flex: 1; min-width: 0; }
.line-th {
  font-family: var(--thai-font); font-size: 27px; line-height: 1.55;
  font-weight: 600; margin: 0 0 3px; word-break: break-word;
}
.line.en-line .line-th { font-family: inherit; font-size: 22px; font-style: italic; }
.line-ro { font-size: 14px; color: var(--accent-2); letter-spacing: .01em; margin: 2px 0; }
/* 中文谐音：唱的时候照着念的就是这行，比罗马音和意思都要大 */
.line-cnro {
  font-size: 19px; font-weight: 600; color: var(--text);
  letter-spacing: .02em; line-height: 1.5; margin: 3px 0 2px;
}
.line-cn { font-size: 14.5px; color: var(--text-2); margin: 2px 0; }

.line-tools { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; max-width: 190px; }
.lbtn {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 9px; padding: 6px 10px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; white-space: nowrap;
  transition: all .15s;
}
.lbtn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.lbtn.on { background: var(--accent-2-soft); border-color: var(--accent-2); color: var(--accent-2); font-weight: 600; }
.lbtn.rec { background: var(--danger); border-color: var(--danger); color: #fff; }
.lbtn.speaking { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 逐词卡片 */
.words {
  display: flex; flex-wrap: wrap; gap: 7px;
  padding: 4px 16px 14px;
}
.word {
  background: var(--card-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px 11px 7px;
  cursor: pointer; text-align: center; min-width: 60px;
  transition: all .15s;
}
.word:hover {
  background: var(--accent-soft); border-color: var(--accent);
  transform: translateY(-1px);
}
.word.speaking { background: var(--accent); border-color: var(--accent); }
.word.speaking .w-th, .word.speaking .w-ro,
.word.speaking .w-cn, .word.speaking .w-mean { color: #fff; }
.w-th { font-family: var(--thai-font); font-size: 19px; font-weight: 600; line-height: 1.4; }
.word.en-word .w-th { font-family: inherit; font-size: 16px; font-style: italic; }
/* 英文词的「谐音」位写的是（英语）这类说明，不用放大 */
.word.en-word .w-cn { font-size: 11px; font-weight: 400; color: var(--text-3); }
.w-ro { font-size: 11px; color: var(--accent-2); margin-top: 1px; }
/* 谐音在词卡里也放大：这是跟唱时真正在看的东西 */
.w-cn { font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.35; margin-top: 2px; }
.w-mean { font-size: 12px; color: var(--text-2); margin-top: 3px; font-weight: 500; }

/* 录音回放条 */
.take-row {
  padding: 0 16px 12px; display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-2);
}

/* ── 弹窗 ───────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,16,14,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px; max-height: 88vh; display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.modal-card.wide { max-width: 660px; }
.modal-head {
  display: flex; align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 16px; flex: 1; }
.modal-close {
  background: none; border: none; font-size: 17px; cursor: pointer;
  color: var(--text-3); padding: 2px 6px; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px 22px; overflow-y: auto; font-size: 14px; }
.modal-body p { margin: 0 0 12px; line-height: 1.65; }
.modal-body code {
  background: var(--card-2); padding: 1px 5px; border-radius: 4px;
  font-size: 12.5px; border: 1px solid var(--line-soft);
}
.modal-body textarea {
  width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  resize: vertical; line-height: 1.6;
}

.voice-status {
  padding: 12px 14px; border-radius: 10px; margin-bottom: 16px;
  font-size: 13.5px; line-height: 1.6;
}
.voice-status.ok  { background: var(--accent-2-soft); border: 1px solid var(--accent-2); }
.voice-status.bad { background: #fff6e6; border: 1px solid #e9d3a3; color: #6a4f1c; }
:root[data-theme="dark"] .voice-status.bad { background: #33280f; border-color: #6b551f; color: #f0dfb4; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 5px; }
.field select, .field input {
  width: 100%; padding: 9px 11px; border-radius: 9px; box-sizing: border-box;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  font-family: inherit; font-size: 13.5px;
}
.test-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.auth-error { min-height: 18px; margin: -4px 0 10px; font-size: 12.5px; color: var(--danger); }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--text-3); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-switch { width: 100%; text-align: center; margin-top: 10px; }
.auth-hint { margin-top: 14px; font-size: 12px; color: var(--text-3); line-height: 1.6; }
#authForm .btn.primary { width: 100%; }

.btn {
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 15px; font-size: 13.5px; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.btn:hover { background: var(--bg); border-color: var(--text-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 11px; font-size: 12px; }

.help { margin-top: 6px; font-size: 13px; }
.help summary { cursor: pointer; color: var(--accent); padding: 6px 0; }
.help ol { padding-left: 20px; line-height: 1.75; }
.help h4 { margin: 12px 0 4px; font-size: 13px; }

/* ── 校准 ───────────────────────────── */
.calib-intro { font-size: 13.5px; color: var(--text-2); }
.calib-stage {
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 16px; text-align: center; margin-bottom: 12px;
}
.calib-next-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.calib-next {
  font-family: var(--thai-font); font-size: 25px; font-weight: 600;
  line-height: 1.5; min-height: 38px; word-break: break-word;
}
.calib-next-ro {
  font-size: 14px; color: var(--accent-2); margin-top: 4px; line-height: 1.5;
}
.calib-next-cnro {
  font-size: 19px; font-weight: 600; color: var(--text);
  letter-spacing: .02em; margin-top: 4px; line-height: 1.45;
}
.calib-next-cnro:empty { display: none; }
.calib-next-cn {
  font-size: 14px; color: var(--text-2); margin-top: 3px; line-height: 1.5;
}
.calib-listen { margin-top: 11px; font-size: 12.5px; padding: 6px 13px; }
.calib-progress { font-size: 12.5px; color: var(--text-2); margin-top: 10px; font-variant-numeric: tabular-nums; }

/* 接下来一句的预告 */
.calib-upcoming {
  text-align: center; font-size: 12.5px; color: var(--text-3);
  margin-bottom: 12px; line-height: 1.6; min-height: 20px;
}
.calib-upcoming .u-label { color: var(--text-3); }
.calib-upcoming .u-th { font-family: var(--thai-font); font-size: 14px; color: var(--text-2); }
.calib-upcoming .u-cn { color: var(--text-3); }

.calib-tap {
  width: 100%; padding: 20px; font-size: 16px; font-weight: 600;
  background: var(--accent); color: #fff; border: none; border-radius: 12px;
  cursor: pointer; font-family: inherit; margin-bottom: 12px;
  transition: filter .12s, transform .08s;
}
.calib-tap:hover { filter: brightness(1.06); }
.calib-tap:active { transform: scale(.985); }
.calib-tap:disabled { background: var(--line); color: var(--text-3); cursor: default; }

.calib-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.calib-list {
  max-height: 190px; overflow-y: auto; border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px;
}
.calib-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 6px;
  font-size: 12.5px; border-radius: 6px;
}
.calib-row.marked { color: var(--text); }
.calib-row.pending { color: var(--text-3); }
.calib-row.next { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.calib-row .t {
  font-variant-numeric: tabular-nums; width: 46px; flex: none;
  padding-top: 1px; opacity: .85;
}
.calib-row .body { flex: 1; min-width: 0; display: block; }
.calib-row .x {
  display: block; font-family: var(--thai-font); font-size: 14px; line-height: 1.5;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.calib-row.en-row .x { font-family: inherit; font-style: italic; }
.calib-row .y {
  display: block; font-size: 11.5px; opacity: .72; margin-top: 1px; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── 页脚 ───────────────────────────── */
.foot {
  max-width: 1020px; margin: 0 auto; padding: 24px 18px 40px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3);
  text-align: center;
}
.foot p { margin: 4px 0; }
.foot kbd {
  background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: inherit;
  color: var(--text-2); margin: 0 1px;
}

/* ── 双人对战 ───────────────────────── */
/* 两个人各自一个颜色：玩家 1 用主色、玩家 2 用第二色，
   从摆阵势一直挂到揭晓，谁是谁一眼认得出来。
   只染 <b>（文字里嵌的名字），别的地方各自写各自的，免得把白字圆牌之类也一起染了 */
.battle { max-width: 720px; margin: 0 auto; }
.battle b.p1 { color: var(--accent); }
.battle b.p2 { color: var(--accent-2); }

/* ① 摆阵势 */
.battle-setup {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 22px 20px;
}
.bs-h { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.bs-lead { margin: 8px 0 0; font-size: 13.5px; line-height: 1.75; color: var(--text-2); }
.bs-lead b { color: var(--text); }

.bs-vs { display: flex; align-items: flex-end; gap: 12px; margin: 20px 0 4px; }
.bs-name { flex: 1; min-width: 0; display: block; }
.bs-name > span { display: block; font-size: 11.5px; margin-bottom: 5px; letter-spacing: .04em; }
.bs-name.p1 > span { color: var(--accent); }
.bs-name.p2 > span { color: var(--accent-2); }
.bs-name input {
  width: 100%; font: inherit; font-size: 15px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-2); color: var(--text);
}
.bs-name.p1 input:focus { outline: none; border-color: var(--accent); background: var(--accent-soft); }
.bs-name.p2 input:focus { outline: none; border-color: var(--accent-2); background: var(--accent-2-soft); }
.bs-vs-sep {
  font-size: 13px; font-weight: 700; color: var(--text-3);
  letter-spacing: .08em; padding-bottom: 11px;
}

.bs-opts {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.bs-pool { font-size: 12px; color: var(--text-3); margin-left: auto; }

/* 摄像头那一块：开了就能比手势，不开也不挡着打 */
.bs-cam {
  margin-top: 14px; padding: 12px 13px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
}
.bs-cam.live { border-color: var(--accent-2); }
.bs-cam-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.bs-cam-head b { font-size: 13.5px; }
.bs-cam-state { font-size: 11.5px; color: var(--text-3); }
.bs-cam-state.ok  { color: var(--accent-2); }
.bs-cam-state.bad { color: var(--danger); }
.bs-cam-head .btn { margin-left: auto; }
.bs-cam-note { margin: 7px 0 0; font-size: 12px; line-height: 1.7; color: var(--text-3); }
.bs-cam-note b { color: var(--text-2); }

/* 画面一律镜像显示：屏幕左边就是坐在左边的那个人，不用在脑子里翻一道 */
/* 画面按摄像头本来的比例整个显示，不裁边 ——
   拍照切的就是这里看见的左右两半，看到什么拍下来就是什么 */
.cam-view {
  position: relative; overflow: hidden; border-radius: 10px; background: #000;
}
.cam-view video { width: 100%; height: auto; display: block; transform: scaleX(-1); }
.cam-split {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 0;
  border-left: 2px dashed rgba(255,255,255,.55);
}
.cam-tag {
  position: absolute; top: 7px; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 20px; color: #fff;
  max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cam-tag.p1 { left: 7px;  background: var(--accent); }
.cam-tag.p2 { right: 7px; background: var(--accent-2); }
.cam-chip {
  position: absolute; bottom: 7px; font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px; color: #fff;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
}
.cam-chip.p1 { left: 7px;  box-shadow: inset 0 0 0 1.5px var(--accent); }
.cam-chip.p2 { right: 7px; box-shadow: inset 0 0 0 1.5px var(--accent-2); }
.cam-chip.off { opacity: .55; box-shadow: none; font-weight: 400; }

.bs-cam-prev { margin-top: 10px; }

.bs-rules { margin: 14px 0 0; padding: 0 0 0 18px; }
.bs-rules li { font-size: 12.5px; line-height: 1.9; color: var(--text-3); }
.bs-rules li b { color: var(--text-2); }
.bs-rules kbd, .bs-cam-note kbd, .bph-hint kbd, .bp-foot kbd, .brv-next kbd {
  background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: inherit;
  color: var(--text-2); margin: 0 1px;
}
.bs-actions { margin-top: 18px; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

/* ② 开场照 */
.battle-photo {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px 20px; text-align: center;
}
.bph-head { font-size: 20px; font-weight: 700; }
.bph-sub { margin: 8px 0 16px; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.bph-stage { border-radius: 12px; }
.bph-count {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 92px; font-weight: 700; color: #fff;
  text-shadow: 0 4px 24px rgba(0,0,0,.6); background: rgba(0,0,0,.25);
  animation: bphPop .35s ease-out;
}
@keyframes bphPop { from { transform: scale(1.4); opacity: .2; } to { transform: scale(1); opacity: 1; } }

.bph-shots { display: flex; gap: 14px; justify-content: center; margin-top: 16px; }
.bph-shot-img {
  width: 108px; height: 108px; border-radius: 14px; overflow: hidden;
  background: var(--card-2); display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--line); font-size: 30px; font-weight: 700; color: var(--text-3);
}
.bph-shot.p1 .bph-shot-img { border-color: var(--accent); }
.bph-shot.p2 .bph-shot-img { border-color: var(--accent-2); }
.bph-shot-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; }
.bph-shot-name { margin-top: 6px; font-size: 13px; font-weight: 600; }
.bph-shot.p1 .bph-shot-name { color: var(--accent); }
.bph-shot.p2 .bph-shot-name { color: var(--accent-2); }

.bph-actions { margin-top: 16px; display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }
.bph-hint { flex-basis: 100%; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ③ 抢答 —— 记分牌整局挂在最上面，谁领先抬头就看得见 */
.bhud {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; margin-bottom: 14px;
}
.bhud-p {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 12px;
  transition: background .18s, opacity .18s;
}
.bhud-p.p2 { flex-direction: row-reverse; text-align: right; }
.bhud-p.lead.p1 { background: var(--accent-soft); }
.bhud-p.lead.p2 { background: var(--accent-2-soft); }
.bhud-p.out { opacity: .42; }                       /* 这题抢错了，剩下的时间没他的份 */
.bhud-p.hit { animation: bhudHit .5s ease-out; }
@keyframes bhudHit {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.bhud-face {
  width: 54px; height: 54px; flex: none; border-radius: 13px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-2); border: 2.5px solid var(--line);
  font-size: 17px; font-weight: 700; color: #fff;
}
.bhud-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; }
.bhud-p.p1 .bhud-face { border-color: var(--accent); }
.bhud-p.p2 .bhud-face { border-color: var(--accent-2); }
.bhud-p.p1 .bhud-face.nophoto { background: var(--accent); }
.bhud-p.p2 .bhud-face.nophoto { background: var(--accent-2); }

.bhud-id { min-width: 0; flex: 1; }
.bhud-name {
  font-size: 14px; font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bhud-p.p1 .bhud-name { color: var(--accent); }
.bhud-p.p2 .bhud-name { color: var(--accent-2); }
.bhud-cue {
  font-size: 11.5px; color: var(--text-2); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bhud-cue.off { color: var(--text-3); }
.bhud-score {
  flex: none; font-size: 34px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; min-width: 34px; text-align: center;
}
.bhud-p.p1 .bhud-score { color: var(--accent); }
.bhud-p.p2 .bhud-score { color: var(--accent-2); }

/* 中间那一格：开了摄像头才占地方，没开就只留一个「VS」，位置全让给两个人 */
.bhud-mid { flex: none; width: auto; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.bhud.cam .bhud-mid { width: 132px; }
.bhud-cam { border-radius: 9px; }
.bhud-cam .cam-split { border-left-width: 1.5px; }
.bhud-vs {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-3); letter-spacing: .06em;
}

/* 准备：两个人同时看见题面，先看到的那个不该占便宜 */
.bready { text-align: center; padding: 46px 16px; }
.bready-no { font-size: 12px; color: var(--text-3); letter-spacing: .08em; }
.bready-go {
  font-size: 44px; font-weight: 700; letter-spacing: .08em; margin: 6px 0 4px;
  animation: breadyIn .45s ease-out;
}
.bready-sub { font-size: 13px; color: var(--text-2); }
@keyframes breadyIn { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 20 秒进度条：宽度过渡交给 CSS，比每帧用 JS 画省事也顺滑 */
.brace { position: relative; }
.brace-bar {
  height: 4px; border-radius: 4px; background: var(--line-soft);
  overflow: hidden; margin: -4px 0 14px;
}
.brace-bar i { display: block; height: 100%; width: 100%; background: var(--accent); }

/* 抢答阶段的选项中间留一道浅缝：点左半边算玩家 1、右半边算玩家 2 */
.brace .qopt:not(:disabled) { position: relative; }
.brace .qopt:not(:disabled)::after {
  content: ''; position: absolute; left: 50%; top: 22%; bottom: 22%;
  border-left: 1px dashed var(--line); pointer-events: none;
}

/* 抢答按错的那个选项染成抢错那个人的颜色 —— 谁抢的一眼看得出 */
.qopt.picked.p1 { border-color: var(--accent); }
.qopt.picked.p2 { border-color: var(--accent-2); }
.qopt.picked.wrong { text-decoration: line-through; opacity: .75; }
.qopt.picked.wrong b { background: var(--danger); color: #fff; }
.qopt.right { border-color: var(--lv5); background: var(--accent-2-soft); }
.qopt.picked.right b { background: var(--lv5); color: #fff; }

/* 揭晓这一题 */
.breveal {
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft);
  text-align: center; animation: breadyIn .25s ease-out;
}
.brv-head { font-size: 17px; }
.brv-head .plus {
  font-style: normal; font-weight: 700; font-size: 19px; margin-left: 2px;
  display: inline-block; animation: bhudHit .5s ease-out;
}
.brv-head .plus.p1 { color: var(--accent); }
.brv-head .plus.p2 { color: var(--accent-2); }
.brv-sub { margin-top: 5px; font-size: 12.5px; color: var(--text-3); }
.brv-sub b { color: var(--text); font-size: 14px; }
.brv-line { margin-top: 9px; font-size: 12px; color: var(--text-3); }
.brv-line b {
  font-family: var(--thai-font); font-size: 14px; font-weight: 500;
  color: var(--text-2); margin-right: 7px;
}
.brv-next {
  margin-top: 13px; font-size: 13px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  justify-content: center; padding: 7px 13px; border-radius: 20px;
  background: var(--card-2); border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.brv-next.armed { border-color: var(--lv5); background: var(--accent-2-soft); }   /* 两个拳头都举着了 */
.brv-next i { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.brv-taps { display: inline-flex; gap: 4px; }
.brv-taps i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line); border: 1px solid var(--line);
}
.brv-taps i.on { background: var(--accent); border-color: var(--accent); }

.bp-foot { text-align: center; font-size: 12px; color: var(--text-3); margin: 14px 0 0; }

/* ④ 揭晓一整轮 */
.brs-head { text-align: center; font-size: 13px; color: var(--text-3); letter-spacing: .1em; }
.brs {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 14px; margin-top: 8px;
}
.brs-side { text-align: center; border-radius: 12px; padding: 10px 6px; }
.brs-side.win { background: var(--accent-soft); }
.brs-side.p2.win { background: var(--accent-2-soft); }
.brs-face {
  position: relative; width: 76px; height: 76px; margin: 0 auto 8px;
  border-radius: 16px; overflow: visible;
  border: 3px solid var(--line); background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
}
.brs-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; border-radius: 13px; }
.brs-side.p1 .brs-face { border-color: var(--accent); }
.brs-side.p2 .brs-face { border-color: var(--accent-2); }
.brs-side.p1 .brs-face.nophoto { background: var(--accent); }
.brs-side.p2 .brs-face.nophoto { background: var(--accent-2); }
.brs-crown { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 22px; }
.brs-name { font-size: 14px; font-weight: 600; word-break: break-word; }
.brs-side.p1 .brs-name { color: var(--accent); }
.brs-side.p2 .brs-name { color: var(--accent-2); }
.brs-num { font-size: 46px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.brs-side.p1 .brs-num { color: var(--accent); }
.brs-side.p2 .brs-num { color: var(--accent-2); }
.brs-time { font-size: 11.5px; color: var(--text-3); }
.brs-mid { text-align: center; }
.brs-vs { font-size: 13px; font-weight: 700; color: var(--text-3); letter-spacing: .08em; }
.brs-of { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.brs-verdict { text-align: center; font-size: 16px; margin-top: 14px; }
.brs-missed { text-align: center; font-size: 12px; color: var(--text-3); margin-top: 5px; }
.brs-tally {
  text-align: center; font-size: 13px; color: var(--text-2); margin-top: 10px;
}
.brs-tally b { font-size: 15px; }
.brs-tally span { color: var(--text-3); }

.brs-listh {
  margin: 22px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2);
}
.brs-listh span { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.brs-list {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.brq { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.brq:last-child { border-bottom: none; }
.brq.won.p1  { box-shadow: inset 3px 0 0 var(--accent); }
.brq.won.p2  { box-shadow: inset 3px 0 0 var(--accent-2); }
.brq.nobody  { box-shadow: inset 3px 0 0 var(--danger); }
.brq-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.brq-no { font-size: 11px; color: var(--text-3); min-width: 14px; }
.brq-th {
  background: none; border: none; padding: 0; cursor: pointer; color: var(--text);
  font-family: var(--thai-font); font-size: 19px; line-height: 1.5;
}
.brq-th:hover, .brq-th.speaking { color: var(--accent); }
.brq-th.en { font-family: inherit; font-size: 16px; font-style: italic; }
.brq-ro { font-size: 11.5px; color: var(--accent-2); }
.brq-ans { margin-left: auto; font-size: 14px; color: var(--text); }
.brq-ans::before { content: '答案 '; font-size: 11px; color: var(--text-3); }

.brq-picks { display: flex; gap: 8px; flex-wrap: wrap; margin: 7px 0 0 22px; align-items: center; }
.brq-pick {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px;
  padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--card-2);
}
.brq-pick em { font-style: normal; font-size: 11px; color: var(--text-3); }
.brq-pick.p1 em { color: var(--accent); }
.brq-pick.p2 em { color: var(--accent-2); }
.brq-pick i { font-style: normal; font-weight: 700; }
.brq-pick u { text-decoration: none; font-size: 10.5px; color: var(--text-3); }
.brq-pick.ok  { border-color: var(--lv5); color: var(--text); }
.brq-pick.ok i { color: var(--lv5); }
.brq-pick.bad { border-color: var(--danger); }
.brq-pick.bad i { color: var(--danger); }
.brq-pick.miss { opacity: .5; }
.brq-none { font-size: 11.5px; color: var(--danger); }

.brq-line { margin: 7px 0 0 22px; font-size: 12px; color: var(--text-3); }
.brq-line b { font-family: var(--thai-font); font-size: 13.5px; font-weight: 500; color: var(--text-2); margin: 0 6px; }
.brq-lineno { color: var(--text-3); }

.brs-actions { margin-top: 20px; display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 720px) {
  .home-language { padding-inline: 8px; }
  .page-hero-actions { top: 12px; right: 12px; }
  .topbar-actions .account-name { display: none; }
  .topbar-actions .account-chip { padding-right: 5px; }
  .battle-setup { padding: 18px 15px 16px; }
  .bs-vs { flex-wrap: wrap; gap: 8px; }
  .bs-vs-sep { width: 100%; padding: 0; text-align: center; }
  .bs-pool { margin-left: 0; width: 100%; }
  .bs-actions .btn { flex: 1; text-align: center; white-space: nowrap; }
  /* 手机上记分牌横着排不下：两个人一行，中间那块摄像头缩到一角 */
  .bhud { flex-wrap: wrap; padding: 8px 9px; gap: 6px; }
  .bhud-p { flex: 1 1 40%; gap: 7px; padding: 4px; }
  .bhud-face { width: 42px; height: 42px; border-radius: 11px; font-size: 14px; }
  .bhud-score { font-size: 26px; min-width: 26px; }
  .bhud-cue { font-size: 10.5px; }
  .bhud-mid { order: 3; flex-basis: 100%; width: auto; flex-direction: row; align-items: center; gap: 8px; }
  .bhud-cam { width: 96px; flex: none; }
  .bhud-vs { flex: 1; text-align: left; }
  .bready { padding: 34px 12px; }
  .bready-go { font-size: 34px; }
  .bph-count { font-size: 66px; }
  .bph-shot-img { width: 88px; height: 88px; }
  .brs { padding: 16px 10px; gap: 4px; }
  .brs-face { width: 60px; height: 60px; }
  .brs-num { font-size: 34px; }
  .brs-actions .btn { flex: 1 1 45%; text-align: center; white-space: nowrap; }
  .brs-actions .btn.big { flex-basis: 100%; }
  .brq-picks, .brq-line { margin-left: 0; }
  .brq-ans { margin-left: 22px; }
}

/* ── 手机 ───────────────────────────── */
/* ── 选歌面板 ───────────────────────── */
.song-list { display: flex; flex-direction: column; gap: 10px; }

.song-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; color: var(--text);
  font: inherit; position: relative;
  transition: border-color .15s, background .15s, transform .1s;
}
.song-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.song-card:active { transform: scale(.995); }
.song-card.on { border-color: var(--accent); background: var(--accent-soft); }

.song-card-th {
  display: block; font-family: var(--thai-font);
  font-size: 20px; line-height: 1.45; margin-bottom: 2px;
}
.song-card-cn { display: block; font-size: 14.5px; font-weight: 600; }
.song-card-by { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

.song-card-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
  font-size: 11.5px; color: var(--text-2);
}
.song-card-meta > span {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 1px 8px;
}

.song-card-now {
  position: absolute; top: 10px; right: 12px;
  font-size: 11px; font-weight: 600; color: #fff;
  background: var(--accent); border-radius: 999px; padding: 2px 9px;
}

.song-add-hint {
  margin: 14px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--text-2);
  border-top: 1px solid var(--line-soft); padding-top: 12px;
}
.song-add-hint code {
  background: var(--card-2); border: 1px solid var(--line-soft);
  border-radius: 5px; padding: 0 5px; font-size: 12px;
}

/* ── 首页：landing page ───────────────────── */
.home {
  margin: 0; padding: 0;
  background:
    radial-gradient(1100px 520px at 50% -120px, var(--home-bg-2), transparent 70%),
    var(--home-bg);
  min-height: 100vh;
}

/* 顶部导航：品牌 + 三个独立页面入口 + 主题切换 + CTA */
.home-topnav-inner {
  max-width: 1160px; margin: 0 auto; padding: 18px 20px 18px 62px;
  display: flex; align-items: center; gap: 24px;
}
.home-brand {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  color: var(--text); font-family: var(--display-font); font-size: 19px; font-weight: 600;
  letter-spacing: -.01em;
}
.home-brand-mark { font-size: 20px; }
.home-brand em { font-style: italic; color: var(--hl-edge); }
.home-topnav-links { display: flex; gap: 22px; margin-left: 4px; }
.home-topnav-links a {
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color .12s;
}
.home-topnav-links a:hover { color: var(--text); }
.home-topnav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.home-topnav-cta { font-size: 13.5px; padding: 8px 16px; border-radius: 999px; }

/* 主视觉 */
.home-hero { position: relative; text-align: center; padding: 40px 20px 44px; max-width: 760px; margin: 0 auto; }
.home-eyebrow {
  margin: 0 0 14px; font-family: var(--mono-font); font-size: 12px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--hl-edge);
}
.home-title {
  margin: 0 0 16px; font-family: var(--display-font); font-weight: 600;
  font-size: clamp(30px, 5vw, 46px); line-height: 1.18; letter-spacing: -.01em; color: var(--text);
}
.home-title em { font-style: italic; font-weight: 600; color: var(--hl-edge); }
.home-sub {
  margin: 0 auto; max-width: 540px; font-size: 15.5px; line-height: 1.7; color: var(--text-2);
  font-family: var(--display-font); font-style: italic;
}

.home-hero-meta { margin: 16px 0 0; font-size: 13px; color: var(--text-3); }
.home-hero-meta b { color: var(--text-2); }

.home-request {
  max-width: 760px; margin: 14px auto 30px; padding: 18px;
  border: 1px solid var(--home-line); border-radius: 18px;
  background: var(--home-card); box-shadow: var(--shadow);
}
.home-request-label {
  display: block; margin: 0 0 12px; color: var(--text-2); font-size: 14px; line-height: 1.55;
}
.home-request-fields { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.home-request textarea, .home-request input[type="email"] {
  min-width: 0; border: 1px solid var(--home-line); border-radius: 12px;
  background: var(--card-2); color: var(--text); font: inherit; font-size: 14px;
}
.home-request textarea {
  grid-column: 1 / -1; width: 100%; padding: 12px 14px; resize: vertical; line-height: 1.55;
}
.home-request input[type="email"] { padding: 11px 14px; }
.home-request textarea:focus, .home-request input[type="email"]:focus {
  outline: none; border-color: var(--hl-edge); background: var(--home-card);
}
.home-request textarea::placeholder, .home-request input::placeholder { color: var(--text-3); }
.home-request-submit { align-self: stretch; border-radius: 12px; padding-inline: 20px; }
.home-request-submit:disabled { opacity: .62; cursor: wait; }
.home-request-note, .home-request-status { margin: 9px 2px 0; color: var(--text-3); font-size: 11.5px; }
.home-request-status { min-height: 1.4em; font-weight: 600; }
.home-request-status.success { color: #2f7a4d; }
.home-request-status.error { color: #b34838; }
.home-request-honey { position: absolute !important; left: -10000px !important; opacity: 0 !important; }

/* 首页学习足迹：GitHub contribution graph 风格，数据来自每日任务 */
.home-streak {
  max-width: 1000px; margin: 0 auto 34px; padding: 20px 22px 16px;
  background: var(--home-card); border: 1px solid var(--home-line);
  border-radius: 20px; box-shadow: var(--shadow);
}
.home-streak-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.home-streak-kicker {
  margin: 0 0 3px; font-family: var(--mono-font); color: var(--accent);
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
}
.home-streak h2 { margin: 0; font-family: var(--display-font); font-size: 21px; font-weight: 600; }
.home-streak-cta { flex: none; border-radius: 999px; }
.home-streak-stats { display: flex; align-items: stretch; gap: 10px; margin: 17px 0 15px; }
.streak-stat {
  min-width: 116px; padding: 10px 13px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--line-soft);
}
.streak-stat strong { display: block; font-size: 21px; line-height: 1.2; }
.streak-stat.flame strong { color: var(--accent); }
.streak-stat small { display: block; margin-top: 3px; color: var(--text-3); font-size: 11px; }
.streak-message { flex: 1; display: flex; align-items: center; padding: 10px 14px; color: var(--text-2); font-size: 13px; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.heatmap-months {
  width: 826px; margin-left: 27px; display: grid; grid-template-columns: repeat(53, 11px);
  gap: 5px; height: 18px; color: var(--text-3); font-size: 9px; white-space: nowrap;
}
.heatmap-body { display: flex; gap: 8px; width: 853px; }
.heatmap-weekdays {
  width: 19px; flex: none; display: grid; grid-template-rows: repeat(7, 11px); gap: 5px;
  color: var(--text-3); font-size: 9px; line-height: 11px;
}
.heatmap-weekdays span:nth-child(1) { grid-row: 2; }
.heatmap-weekdays span:nth-child(2) { grid-row: 4; }
.heatmap-weekdays span:nth-child(3) { grid-row: 6; }
.heatmap-grid {
  display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column;
  grid-auto-columns: 11px; gap: 5px;
}
.heatmap-grid i, .heatmap-legend i {
  width: 11px; height: 11px; display: grid; place-items: center; border-radius: 3px;
  background: var(--line-soft); border: 1px solid rgba(0,0,0,.025);
}
.heatmap-grid i[data-completed], .heatmap-legend i[data-completed] { background: #187456; }
.heatmap-grid i[data-future] { opacity: .3; }
.heatmap-legend { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 9px; color: var(--text-3); font-size: 10px; }

/* 功能卡：真实存在的六种学习方式 */
.home-features {
  max-width: 1000px; margin: 0 auto; padding: 0 20px 46px;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px;
}
.home-feature-card {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 18px 10px; border-radius: var(--radius);
  background: var(--home-card); border: 1px solid var(--home-line);
  text-decoration: none; color: var(--text);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
a.home-feature-card:hover { transform: translateY(-3px); border-color: var(--hl-edge); box-shadow: var(--shadow-lg); }
.hf-icon { font-size: 22px; margin-bottom: 2px; }
.home-feature-card b { font-size: 13px; }
.home-feature-card small { font-size: 11px; color: var(--text-3); line-height: 1.4; }

/* 曲库 */
.home-library { max-width: 1100px; margin: 0 auto; padding: 8px 20px 60px; }
.home-library-title {
  margin: 0 0 18px; font-family: var(--display-font); font-size: 20px; font-weight: 600; color: var(--text);
}
.home-empty { text-align: center; color: var(--text-3); font-size: 14px; padding: 30px 0; }

.home-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.home-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background: var(--home-card); border: 1px solid var(--home-line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.home-card:hover { transform: translateY(-3px); border-color: var(--hl-edge); box-shadow: var(--shadow-lg); }
.home-card:active { transform: translateY(-1px); }

.home-card-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 16/9;
  background: var(--card-2); overflow: hidden;
}
.home-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-card-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; background: rgba(0,0,0,.18);
  opacity: 0; transition: opacity .15s, background .15s;
}
.home-card:hover .home-card-play { opacity: 1; background: rgba(0,0,0,.32); }
.home-card-badge {
  position: absolute; top: 8px; left: 8px; font-size: 11px; font-weight: 600; color: #fff;
  background: var(--accent); border-radius: 999px; padding: 2px 9px;
}

.home-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.home-card-th { font-family: var(--thai-font); font-size: 18px; line-height: 1.4; }
.home-card-cn { font-size: 14.5px; font-weight: 600; }
.home-card-by { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }

@media (max-width: 900px) {
  .home-features { grid-template-columns: repeat(3, 1fr); }
  .home-topnav-links { display: none; }
}

@media (max-width: 720px) {
  .home-streak { margin: 0 14px 28px; padding: 17px 15px 14px; }
  .home-streak-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .home-streak-cta { width: 100%; }
  .home-streak-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
  .streak-stat { min-width: 0; padding: 9px 8px; text-align: center; }
  .streak-stat strong { font-size: 18px; }
  .streak-message { grid-column: 1 / -1; padding: 2px 3px; justify-content: center; text-align: center; }
  .home-topnav-inner { padding: 14px 16px 14px 62px; gap: 10px; }
  .home-topnav-cta { display: none; }
  .home-hero { padding: 28px 16px 32px; }
  .home-library { padding: 4px 14px 44px; }
  .home-request-fields { grid-template-columns: 1fr; }
  .home-request textarea { grid-column: auto; }
  .home-request-submit { min-height: 44px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}

/* ── 词频总表 / 覆盖率曲线：跟首页平级的独立页面，样式也仿首页的头部处理 ── */
.page { max-width: 1100px; margin: 0 auto; padding: 36px 20px 60px; }
.page-hero { position: relative; text-align: center; padding: 8px 0 30px; }
.page-hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.page-hero p { margin: 0 auto; max-width: 60ch; font-size: 14.5px; color: var(--text-2); }
.page-hero-theme { position: absolute; top: 0; right: 0; }
.page-body { max-width: 1020px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

@media (max-width: 720px) {
  .page { padding: 24px 14px 44px; }
  .page-hero { padding: 44px 0 22px; }
  .page-hero-theme { top: -36px; right: 0; }
}

/* ── 只做练习模式的歌（timeline: false）──
   KTV、时间轴校准、单句循环、自动跟随这些都得靠逐句时间点，
   这类歌没有时间轴，相关入口直接不出现，免得点了没反应。 */
body.no-timeline [data-needs="timeline"] { display: none !important; }

@media (max-width: 720px) {
  .topbar-inner { padding: 10px 13px 10px 58px; }
  .brand h1 { font-size: 17px; }
  .topbar-actions { width: 100%; margin-left: 0; }
  .icon-btn { flex: 1; justify-content: center; padding: 7px 8px; }
  .player-wrap { padding: 10px 13px 8px; }
  .viewbar-inner { padding: 9px 13px; }
  .uku-hint { padding: 9px 13px 0; gap: 6px; font-size: 11.5px; }
  .video-box { max-height: 168px; }
  .lyrics { padding: 16px 13px 50px; }
  .line-head { flex-direction: column; gap: 9px; padding: 13px 14px 8px; }
  .line-tools { max-width: none; width: 100%; justify-content: flex-start; }
  .line-no { margin-top: 0; align-self: flex-start; }
  .line-th { font-size: 24px; }
  .line-cnro { font-size: 17.5px; }
  .words { padding: 2px 14px 12px; }
  .transport .ctl { font-size: 12px; }
  /* 手机上手指粗，轨道和滑块都放大一点 */
  .seekrow { padding: 8px 12px 2px; gap: 9px; }
  .seek { padding: 12px 0; }
  .seek-track { height: 8px; }
  .seek-marks { inset: 12px 0; }
  .seek-mark { height: 6px; }
  .seek-mark.sec { top: -2px; height: 12px; }
  .seek-thumb { width: 16px; height: 16px; margin: -8px 0 0 -8px; }
  .seek-tip { max-width: 62vw; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-card { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .foot-tip { display: none; }
}

/* ── KTV 沉浸模式 ─────────────────────
   全屏盖在练习模式上面，练习模式的 DOM 不做 display:none，
   只是被这层盖住看不见 —— 这样 YouTube iframe 还在正常尺寸，音频不会被打断。
   背景先随便给个渐变色占位，以后换成用户自己选的照片。 */
.ktv-view {
  position: fixed; inset: 0; z-index: 500;
  overflow: hidden;
  --ktv-sung: #4dd8ff;   /* 已唱过的字的颜色 */
}
body.mode-ktv { overflow: hidden; }

/* KTV 全屏时，顶栏 / 视图栏「固定」与否本来只影响普通滚动模式的吸顶行为，
   但 .stickydeck 有 isolation:isolate（见上面注释），它的层叠顺序由自己的
   z-index 决定 —— 固定了是 30、没固定是「和普通内容一起按 DOM 顺序」。
   顶栏固定时 z-index 35 比 30 高，视图栏一直是 25，两边都可能比没固定的
   .stickydeck 排得靠前，于是各自在没被对方盖住的组合下漏到 KTV 背景视频上面。
   进了 KTV 就不该再看这两个开关：直接把 .stickydeck 提到顶栏/视图栏之上、
   .ktv-view 之下，固定与否都不影响。 */
body.mode-ktv .stickydeck {
  position: relative;
  z-index: 400;
}

.ktv-bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(120% 90% at 50% 15%, #3a3252 0%, #1c1826 55%, #100e16 100%);
  background-size: cover; background-position: center;
}

/* 开着 MV 画面时底色让位：这层透明了，后面那个撑满全屏的播放器才看得见 */
.ktv-view.bg-video .ktv-bg { background: none; }

/* 压暗一层，不然亮画面上的白歌词看不清；纯色背景时不需要 */
.ktv-bg-scrim {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity .5s ease;
  background: linear-gradient(to bottom, rgba(0,0,0,.55) 0%, rgba(0,0,0,.32) 38%, rgba(0,0,0,.5) 100%);
}
.ktv-view.bg-video .ktv-bg-scrim { opacity: 1; }

/* ── KTV 背景 = 原曲播放器本身 ──
   不把 iframe 搬进 KTV 层：DOM 一挪 iframe 就会重载，声音会断。
   改成原地把播放器定位成全屏。它在 .stickydeck（z-index:30）的层叠上下文里，
   永远画在 .ktv-view（z-index:500）下面，正好当背景，点击也照旧被 KTV 层接走。 */
body.mode-ktv.ktv-bg-video .video-box {
  position: fixed; inset: 0; z-index: 1;
  width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto;
  border-radius: 0; transition: none;
}
/* 铺满整屏（宽高比不够就往外裁，跟 object-fit:cover 一个意思），
   再往外放大一点：YouTube 自己的标题条、控制条、片尾「More videos」都贴在
   iframe 的上下边缘，放大之后就被挤出屏幕、被 overflow 裁掉了。 */
body.mode-ktv.ktv-bg-video .video-box iframe {
  inset: auto; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1.34);
  width: 100vw; height: 56.25vw;            /* 先按铺满宽算 */
  min-width: 177.78vh; min-height: 100vh;   /* 屏幕更窄时改成铺满高 */
}

/* 弹幕飞行区：只到歌词区上边缘为止，不飞到底下两句上面。
   歌词字号放大之后歌词区更高了，这里跟着让出更多空间。 */
.ktv-danmaku-layer {
  position: absolute; z-index: 1; left: 0; right: 0; top: 64px; bottom: 42%;
  overflow: hidden; pointer-events: none;
}
/* 开了和弦，两句歌词各多一行，歌词区更高，弹幕再往上让一截 */
.ktv-view.chords-on .ktv-danmaku-layer { bottom: 52%; }
/* 鼓掌/献花/拖鞋/臭鸡蛋：满屏冒泡，跟歌词区不冲突（z-index 比歌词层低） */
.ktv-effects-layer {
  position: absolute; z-index: 2; inset: 0;
  overflow: hidden; pointer-events: none;
}

.ktv-view-top {
  position: absolute; z-index: 4; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: max(14px, env(safe-area-inset-top)) 16px 0;
}
.ktv-pill {
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.22); color: #fff;
  border-radius: 999px; padding: 8px 16px; font-size: 13.5px; cursor: pointer;
  backdrop-filter: blur(4px); font-family: inherit; transition: background .15s;
}
.ktv-pill:hover { background: rgba(0,0,0,.58); }
.ktv-pill.on { background: var(--accent); border-color: var(--accent); }
.ktv-pill.on:hover { filter: brightness(1.1); }
.ktv-pill[disabled] { opacity: .4; cursor: default; }
.ktv-view-top-right { display: flex; align-items: center; gap: 8px; }

/* 互动工具条：发弹幕 + 四个反应特效，靠右竖排，避开中间的背景和底部歌词 */
.ktv-toolbar {
  position: absolute; z-index: 4; right: 14px; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px;
}
.ktv-tbtn {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.22); color: #fff;
  font-size: 19px; line-height: 1; cursor: pointer; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: background .15s, transform .1s;
}
.ktv-tbtn:hover { background: rgba(0,0,0,.58); }
.ktv-tbtn:active { transform: scale(.9); }
.ktv-tbtn.on { background: var(--accent); border-color: var(--accent); }

.ktv-view-lines {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 16px;
  padding: 34px 26px calc(38px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.55) 60%, transparent 100%);
  text-align: center;
}

/* 弹幕输入条：藏在歌词区顶端，点💬才展开 */
.ktv-danmaku-compose { display: flex; gap: 8px; }
.ktv-danmaku-compose input {
  flex: 1; min-width: 0;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.32); color: #fff;
  border-radius: 999px; padding: 9px 15px; font-size: 14px; font-family: inherit;
}
.ktv-danmaku-compose input::placeholder { color: rgba(255,255,255,.55); }
.ktv-danmaku-compose input:focus { outline: none; border-color: #fff; }
.ktv-danmaku-compose .ktv-pill {
  flex: none; background: var(--accent); border-color: var(--accent);
}
.ktv-danmaku-compose .ktv-pill:hover { filter: brightness(1.1); }

/* 飞行弹幕 */
.ktv-danmaku-item {
  position: absolute; left: 100%; top: 0; white-space: nowrap; will-change: transform;
  color: #fff; font-size: 19px; font-weight: 600;
  text-shadow: 0 1px 5px rgba(0,0,0,.65);
  animation-name: ktv-danmaku-fly; animation-timing-function: linear; animation-fill-mode: forwards;
}
@keyframes ktv-danmaku-fly {
  from { transform: translateX(0); }
  to   { transform: translateX(-130vw); }
}

/* 鼓掌 / 献花 / 拖鞋 / 臭鸡蛋：一次点击满屏交错冒出一串，从下往上飘着淡出，
   跟 Zoom 的表情雨效果类似。每个粒子的位置/摆动/时长/延迟都由内联变量随机决定 */
.ktv-effect {
  position: absolute; left: var(--x, 50%); bottom: -10%;
  font-size: var(--size, 46px); line-height: 1; pointer-events: none;
  opacity: 0;
  animation: ktv-effect-rise var(--dur, 3s) cubic-bezier(.22,.7,.4,1) forwards;
  animation-delay: var(--delay, 0s);
}
@keyframes ktv-effect-rise {
  0%   { transform: translate(-50%, 0) scale(.4) rotate(var(--r, 0deg)); opacity: 0; }
  12%  { transform: translate(-50%, -14vh) scale(1) rotate(var(--r, 0deg)); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx, 0px)), -108vh) scale(.85) rotate(var(--r, 0deg)); opacity: 0; }
}
/* 沉浸模式的和弦：压在歌词正上方，跟歌词区分开一个颜色。
   这里不做逐字着色 —— 和弦是提前看的，跟着唱到哪儿变色反而晚了。 */
.ktv-vline-chords {
  color: #7ff0d8; font-weight: 700; letter-spacing: .1em;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  font-size: 32px; line-height: 1.25; margin-bottom: 2px;
}
.ktv-vline-chords:empty { display: none; }

.ktv-vline-th {
  font-family: var(--thai-font); color: #fff; font-weight: 700;
  text-shadow: 0 2px 10px rgba(0,0,0,.55); word-break: break-word;
  overflow-wrap: anywhere;
}
.ktv-vline-ro {
  color: #bfe8ff; font-weight: 600;
  text-shadow: 0 2px 8px rgba(0,0,0,.55);
  overflow-wrap: anywhere;
}
.ktv-vline-cnro {
  color: #ffe9b8; font-weight: 600;
  text-shadow: 0 2px 8px rgba(0,0,0,.55);
  overflow-wrap: anywhere;
}

/* 逐字着色：唱过去的字换成高亮色，没唱到的还是原色。
   每个字素一个 span，唱到哪儿就给到哪儿加 .sung —— 换行照常，
   也避开了 background-clip:text 那条路（文字投影会盖在渐变上面）。
   overflow-wrap:anywhere 是配套的：拆成一堆 span 之后浏览器不一定
   还能在泰语词间找到断行点，兜个底免得横着溢出去。 */
.kchar { transition: color .12s linear; }
.ktv-vline.live .kchar.sung { color: var(--ktv-sung); }
.ktv-vline-ro:empty { display: none; }
.ktv-vline-cnro:empty { display: none; }

/* 位置固定不跳：槽位由句子序号的单双决定，谁在唱只切亮暗/大小，
   物理位置（上边槽 / 下边槽）从不改变，跟着 .live 类切换的是样式而不是位置 */
.ktv-vline {
  opacity: .45; transition: opacity .2s;
}
/* 字号两句一样大：当前句突然放大会让整块歌词重排、看花眼，
   所以「谁在唱」不靠字号区分，只靠亮度（后面再叠上逐字变色）。 */
.ktv-vline .ktv-vline-th { font-size: 80px; line-height: 1.4; }
.ktv-vline .ktv-vline-ro { font-size: 60px; margin-top: 6px; }
.ktv-vline .ktv-vline-cnro { font-size: 60px; margin-top: 6px; }

.ktv-vline.live { opacity: 1; }

.ktv-vline.en-slot .ktv-vline-th { font-family: inherit; font-style: italic; }

@media (max-width: 720px) {
  .ktv-view-top { padding: max(12px, env(safe-area-inset-top)) 12px 0; }
  .ktv-pill { padding: 7px 13px; font-size: 12.5px; }
  .ktv-view-lines { padding: 18px 14px calc(22px + env(safe-area-inset-bottom)); gap: 10px; }
  .ktv-vline .ktv-vline-th { font-size: 57px; }
  .ktv-vline .ktv-vline-ro { font-size: 44px; }
  .ktv-vline .ktv-vline-cnro { font-size: 44px; }
  .ktv-vline-chords { font-size: 22px; letter-spacing: .08em; }
  /* 手机竖屏本来就快装不下两句了，再加两行和弦会顶到上面的按钮上。
     开了和弦就把歌词收一号 —— 想要和弦就得让出这点地方。 */
  .ktv-view.chords-on .ktv-vline .ktv-vline-th { font-size: 48px; }
  .ktv-view.chords-on .ktv-vline .ktv-vline-ro { font-size: 36px; }
  .ktv-view.chords-on .ktv-vline .ktv-vline-cnro { font-size: 36px; }

  .ktv-toolbar { right: 10px; gap: 8px; }
  .ktv-tbtn { width: 38px; height: 38px; font-size: 17px; }
  .ktv-danmaku-item { font-size: 16px; }
  .ktv-effect { font-size: var(--size, 34px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ══════════════════════════════════════════
   单词模式：单词表 + 四选一测验
   ══════════════════════════════════════════ */

/* 掌握程度 0–5 级的颜色，从「生疏」的灰过到「已掌握」的绿 */
:root {
  --lv0: #cfc5b8;
  --lv1: #dda06a;
  --lv2: #d9b93f;
  --lv3: #9dbf5c;
  --lv4: #5fae7a;
  --lv5: #3ba55d;
}
:root[data-theme="dark"] {
  --lv0: #4a444f;
  --lv1: #b8794a;
  --lv2: #b39430;
  --lv3: #7d9b45;
  --lv4: #4c9268;
  --lv5: #43ac66;
}

/* 单词模式下把跟唱那一套收起来，屏幕全留给单词表 */
body.mode-study .stickydeck,
body.mode-study .viewbar,
body.mode-study .uku-hint,
body.mode-study #lyrics,
body.mode-study .foot { display: none; }

.study { max-width: 1020px; margin: 0 auto; padding: 20px 18px 70px; }

/* ── 总览 ───────────────────────────── */
.study-head {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px 16px; margin-bottom: 18px;
}
.study-head-row {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.study-stat-big { font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.study-stat-big b { color: var(--accent); }
.study-stat-label { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.study-stat-label b { color: var(--text); }
.study-stat-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.study-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn.big { padding: 11px 20px; font-size: 14.5px; font-weight: 600; }

/* 六段进度条：每段的宽度就是这个级别有多少个词 */
.study-bar {
  display: flex; gap: 2px; height: 12px; border-radius: 999px;
  overflow: hidden; background: var(--card-2);
}
.study-bar i { display: block; transition: flex .4s ease; }
.study-bar i[data-lv="0"] { background: var(--lv0); }
.study-bar i[data-lv="1"] { background: var(--lv1); }
.study-bar i[data-lv="2"] { background: var(--lv2); }
.study-bar i[data-lv="3"] { background: var(--lv3); }
.study-bar i[data-lv="4"] { background: var(--lv4); }
.study-bar i[data-lv="5"] { background: var(--lv5); }

.study-legend {
  display: flex; gap: 13px; flex-wrap: wrap; margin-top: 9px;
  font-size: 11.5px; color: var(--text-3);
}
.study-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.study-legend .lg.off { opacity: .38; }
.study-legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.study-legend i[data-lv="0"] { background: var(--lv0); }
.study-legend i[data-lv="1"] { background: var(--lv1); }
.study-legend i[data-lv="2"] { background: var(--lv2); }
.study-legend i[data-lv="3"] { background: var(--lv3); }
.study-legend i[data-lv="4"] { background: var(--lv4); }
.study-legend i[data-lv="5"] { background: var(--lv5); }

/* 歌词行闯关：节点可横向滚动，长歌也不会把页面撑宽。 */
.line-journey { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
.journey-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.journey-head > div { display: grid; gap: 2px; }
.journey-head b { font-size: 14px; }
.journey-head span { font-size: 11.5px; color: var(--text-3); }
.journey-head strong { color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; }
.journey-track { height: 7px; margin: 11px 2px 10px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.journey-track i { display: block; height: 100%; width: var(--journey); border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
.journey-nodes { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.journey-node { flex: 0 0 36px; width: 36px; height: 36px; border: 2px solid var(--line); border-radius: 50%; background: var(--card-2); color: var(--text-3); cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; }
.journey-node:hover { border-color: var(--accent); color: var(--accent); }
.journey-node.done { color: #fff; border-color: var(--accent-2); background: var(--accent-2); font-size: 16px; }
.journey-node.current { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ── 单词表 ─────────────────────────── */
.study-toolbar {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-bottom: 11px;
}
.study-count { font-size: 12.5px; color: var(--text-3); }

.wordlist {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.wrow {
  display: grid;
  grid-template-columns: 34px minmax(150px, 1.15fr) minmax(96px, .85fr) 168px auto;
  align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
}
.wrow:last-child { border-bottom: none; }
/* 整张卡片都能点（点空白处 = 念这个词），所以给整行手型 */
.wrow { cursor: pointer; }
.wrow:hover { background: var(--card-2); }
/* 正在放原句的那一行：左边色条换成主色 + 轻微底色，放完自己撤掉 */
.wrow.playing { background: var(--accent-soft); }
.wrow.playing { box-shadow: inset 3px 0 0 var(--accent) !important; }
/* 左边一道竖色条，一眼看出这个词学到哪一级了 */
.wrow { box-shadow: inset 3px 0 0 var(--lv0); }
.wrow[data-lv="1"] { box-shadow: inset 3px 0 0 var(--lv1); }
.wrow[data-lv="2"] { box-shadow: inset 3px 0 0 var(--lv2); }
.wrow[data-lv="3"] { box-shadow: inset 3px 0 0 var(--lv3); }
.wrow[data-lv="4"] { box-shadow: inset 3px 0 0 var(--lv4); }
.wrow[data-lv="5"] { box-shadow: inset 3px 0 0 var(--lv5); }

.wrow-no { font-size: 11.5px; color: var(--text-3); text-align: right; }
.wrow-word { min-width: 0; }
.wrow-th {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--thai-font); font-size: 21px; font-weight: 600;
  color: var(--text); line-height: 1.35; border-radius: 6px;
  transition: color .15s;
}
.wrow-th:hover { color: var(--accent); }
.wrow-th.speaking { color: var(--accent); text-shadow: 0 0 18px var(--accent-soft); }
.wrow-th.en { font-family: inherit; font-size: 17px; font-style: italic; }
.wrow-ro { display: block; font-size: 11.5px; color: var(--accent-2); }
.wrow-cn { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); }

.wrow-mean { font-size: 14.5px; color: var(--text); }
.wrow-mean.masked { cursor: pointer; }
.wrow-mean.masked span {
  background: var(--line); color: transparent; border-radius: 6px;
  user-select: none; padding: 0 6px;
}
.wrow-mean.masked:hover span { background: var(--line-soft); }

.wrow-lv { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.lvdots { display: inline-flex; gap: 3px; }
.lvdots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--line); transition: background .2s;
}
.lvdots[data-lv="1"] i.on { background: var(--lv1); }
.lvdots[data-lv="2"] i.on { background: var(--lv2); }
.lvdots[data-lv="3"] i.on { background: var(--lv3); }
.lvdots[data-lv="4"] i.on { background: var(--lv4); }
.lvdots[data-lv="5"] i.on { background: var(--lv5); }
.lvname { font-size: 12px; color: var(--text-2); }
.lvstat { font-size: 11px; color: var(--text-3); }

.wrow-tools { display: flex; gap: 4px; justify-content: flex-end; }
.wrow-hint {
  grid-column: 2 / -1; padding: 10px 12px; border-radius: 9px;
  background: var(--card-2); border-left: 3px solid var(--accent);
}
.wrow-hint-line + .wrow-hint-line { margin-top: 8px; }
.wrow-hint-source { font-size: 14px; line-height: 1.55; color: var(--text); }
.wrow-hint-ro { margin-top: 2px; font-size: 12.5px; line-height: 1.5; color: var(--accent-2); }
.wrow-hint-cn { margin-top: 3px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.wrow-hint-cn-toggle { margin-top: 8px; padding-left: 0; }
.wbtn {
  background: transparent; border: 1px solid transparent; color: var(--text-3);
  border-radius: 8px; padding: 4px 7px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; line-height: 1.3; transition: all .15s;
}
.wbtn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.study-empty { padding: 40px 16px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.study-hint { text-align: center; font-size: 12px; color: var(--text-3); margin: 16px 0 0; }
.study-hint kbd {
  background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: inherit;
  color: var(--text-2); margin: 0 1px;
}

/* ── 词频总表 ───────────────────────── */
.freq-search-wrap { flex: 1 1 220px; min-width: 160px; }
.freq-search-wrap input {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--card-2); color: var(--text);
}
.freq-search-wrap input:focus { outline: none; border-color: var(--accent); background: var(--card); }
.freq-search-wrap input::placeholder { color: var(--text-3); }

.frow {
  display: grid;
  grid-template-columns: 34px minmax(150px, 1.1fr) minmax(110px, .9fr) 100px auto;
  align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.frow:last-child { border-bottom: none; }
.frow:hover { background: var(--card-2); }
/* 标记「记住了」的词：左边一道绿条 + 淡淡的底色，一眼扫过去就知道学到哪了 */
.frow[data-learned="1"] { background: var(--accent-2-soft); box-shadow: inset 3px 0 0 var(--accent-2); }
.frow[data-learned="1"]:hover { background: var(--accent-2-soft); }

.frow-count { text-align: left; white-space: nowrap; }
.frow-count b { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.frow-count span { font-size: 11.5px; color: var(--text-3); }
.frow-bar { height: 4px; border-radius: 2px; background: var(--card-2); margin-top: 5px; overflow: hidden; }
.frow-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

.frow-actions { display: flex; align-items: center; gap: 6px; justify-self: end; justify-content: flex-end; }
.admin-badge { font-size: 12px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 999px; padding: 5px 10px; }
.frow-edit { font: inherit; font-size: 12px; border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.frow-edit:hover { filter: brightness(.96); }
.frow.admin-hidden-word { opacity: .62; background: repeating-linear-gradient(-45deg, var(--card), var(--card) 8px, var(--card-2) 8px, var(--card-2) 16px); }
.admin-word-form { display: grid; gap: 12px; }
.admin-word-form label { display: grid; gap: 5px; font-size: 12px; color: var(--text-2); }
.admin-word-form input:not([type="checkbox"]) { width: 100%; font: inherit; color: var(--text); background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }
.admin-word-form input:focus { outline: none; border-color: var(--accent); }
.admin-word-source { margin: 0; color: var(--text-3); font-size: 13px; }
.admin-word-source b { color: var(--text); font-family: var(--thai-font); font-size: 16px; }
.admin-word-form .admin-hide-check { display: flex; grid-template-columns: none; align-items: center; gap: 8px; color: var(--danger); }
.admin-word-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }

/* 「记住了」标记按钮：点一下切换，不用真的答对几次才算数——自己说了算 */
.frow-mark {
  font: inherit; font-size: 12px; white-space: nowrap;
  background: var(--card-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 999px; padding: 5px 10px; cursor: pointer; transition: all .15s;
}
.frow-mark:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.frow-mark.on { border-color: var(--accent-2); color: var(--accent-2); background: var(--accent-2-soft); font-weight: 600; }

/* 「N 句」展开按钮：点了才看这个词在歌里出现的原句，默认收着省地方 */
.frow-toggle {
  font: inherit; font-size: 12px; white-space: nowrap;
  background: var(--card-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 999px; padding: 5px 10px; cursor: pointer; transition: all .15s;
}
.frow-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.frow-toggle[aria-expanded="true"] { border-color: var(--accent-2); color: var(--accent-2); background: var(--accent-2-soft); }

/* 学习进度条：放在词频表最上头，实时看到学了百分之多少，图一激励 */
.freq-progress {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.freq-progress-bar {
  flex: 1 1 auto; height: 8px; border-radius: 4px;
  background: var(--card-2); overflow: hidden;
}
.freq-progress-bar > i {
  display: block; height: 100%; background: var(--accent-2);
  border-radius: 4px; transition: width .25s ease;
}
.freq-progress-label {
  flex: 0 0 auto; font-size: 12.5px; color: var(--text-2); white-space: nowrap;
}
.freq-progress-label b { color: var(--accent-2); font-variant-numeric: tabular-nums; }

/* 展开面板：这个词在库里出现过的每一句原文，带出自哪首歌 */
.frow-lines {
  background: var(--card-2); border-bottom: 1px solid var(--line-soft);
  padding: 4px 14px 10px 60px;
  display: flex; flex-direction: column; gap: 9px;
}
.frow-line { padding-top: 8px; border-top: 1px dashed var(--line); }
.frow-line:first-child { border-top: none; padding-top: 0; }
.frow-line-song {
  display: inline-block; font: inherit; font-size: 11px; margin-bottom: 3px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-3);
  border-radius: 999px; padding: 2px 8px; cursor: pointer; transition: all .15s;
}
.frow-line-song:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.frow-line-th { font-family: var(--thai-font); font-size: 15px; color: var(--text); line-height: 1.45; }
.frow-line-cn { font-size: 12.5px; color: var(--text-2); margin-top: 1px; }

/* ── 覆盖率曲线科普页 ───────────────────
   跟主色系走同一套 --accent/--card/--line，不单独引进一套配色，
   看着还是这个网站，不是外面贴过来的图。 */
.sci-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.sci-stat { background: var(--card); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.sci-stat b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sci-stat span { font-size: 11.5px; color: var(--text-3); }

.sci-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 10px;
}
.sci-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.sci-card-title { font-size: 14.5px; font-weight: 600; }
.sci-card-sub { font-size: 12px; color: var(--text-3); }

.sci-chart-pos { position: relative; }
#sciChart { display: block; width: 100%; height: auto; overflow: visible; }
.sci-gridline { stroke: var(--line); stroke-width: 1; }
.sci-baseline { stroke: var(--text-3); stroke-width: 1; }
.sci-axis-label { fill: var(--text-3); font-size: 11px; font-family: inherit; }
.sci-ref-line { stroke: var(--accent-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.sci-ref-label { fill: var(--accent-2); font-size: 10.5px; font-family: inherit; font-weight: 600; }

.sci-area-fill { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.sci-curve-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

.sci-mk-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.sci-mk-label-bg { fill: var(--card); opacity: .94; }
.sci-mk-label { fill: var(--text); font-size: 11px; font-family: inherit; font-weight: 600; }
.sci-mk-label-sub { fill: var(--text-3); font-size: 10px; font-family: inherit; }

.sci-crosshair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0; pointer-events: none; }
.sci-hover-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; opacity: 0; pointer-events: none; }
.sci-hit-rect { fill: transparent; cursor: crosshair; }

.sci-tooltip {
  position: absolute; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 12.5px; box-shadow: var(--shadow-lg);
  white-space: nowrap; z-index: 5;
}
.sci-tooltip b { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--accent); }
.sci-tt-word { font-family: var(--thai-font); color: var(--text); font-weight: 600; margin-top: 3px; }
.sci-tt-sub { color: var(--text-3); margin-top: 1px; }

.sci-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin: 10px 2px 4px; }
.sci-legend i { width: 14px; height: 2px; background: var(--accent); border-radius: 1px; display: inline-block; }

.sci-explain {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; font-size: 13.5px; line-height: 1.7; color: var(--text-2);
}
.sci-explain h2 { font-size: 14.5px; color: var(--text); margin: 0 0 8px; }
.sci-explain p { margin: 0 0 10px; }
.sci-explain p:last-child { margin-bottom: 0; }
.sci-explain b { color: var(--text); }

.sci-tablewrap {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.sci-tablewrap summary {
  cursor: pointer; padding: 14px 16px; font-size: 13.5px; font-weight: 600;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.sci-tablewrap summary::-webkit-details-marker { display: none; }
.sci-tablewrap summary::before { content: "▸"; color: var(--text-3); font-size: 11px; transition: transform .15s; }
.sci-tablewrap[open] summary::before { transform: rotate(90deg); }
.sci-tbl-scroll { overflow-x: auto; padding: 0 16px 14px; }
.sci-tbl-scroll table { border-collapse: collapse; width: 100%; min-width: 440px; }
.sci-tbl-scroll th, .sci-tbl-scroll td {
  text-align: left; padding: 7px 10px; font-size: 12.5px; border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
.sci-tbl-scroll th { color: var(--text-3); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.sci-tbl-scroll tr:last-child td { border-bottom: none; }
.sci-tbl-scroll .hl { color: var(--text); }

@media (max-width: 720px) {
  .sci-explain, .sci-card { padding: 14px 14px 8px; }
  .sci-tablewrap summary { padding: 12px 14px; }
}

/* ── 记忆课 ───────────────────────────── */

.lesson-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.lesson-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; cursor: pointer; font-family: inherit; color: var(--text);
  box-shadow: var(--shadow); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.lesson-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.lesson-card:active { transform: translateY(-1px); }
.lesson-card.done { border-color: var(--accent-2); }
.lesson-card-check {
  position: absolute; top: 10px; right: 12px; color: var(--accent-2); font-weight: 700; font-size: 14px;
}
.lesson-card-emoji { font-size: 24px; line-height: 1; margin-bottom: 2px; }
.lesson-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.lesson-card-sub { font-size: 12.5px; color: var(--text-2); }
.lesson-card-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.lesson-article {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px 24px; box-shadow: var(--shadow);
}
.lesson-article-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lesson-article-head #lessonDoneBtn.on { background: var(--accent-2-soft); border-color: var(--accent-2); color: var(--accent-2); font-weight: 600; }
#lessonArticleTitle { margin: 0 0 4px; font-size: 19px; }
.lesson-article-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-2); }

.lesson-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.lesson-rate-ctl { margin-left: auto; }
#lessonPlayBtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#lessonPlayBtn:disabled { opacity: .5; cursor: default; }
.lesson-play-progress { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lesson-status-summary { margin: 0 0 16px; font-size: 12px; color: var(--text-3); }

.lesson-blocks { display: flex; flex-direction: column; gap: 12px; max-width: 68ch; }

.lesson-p {
  font-size: 14.5px; line-height: 1.85; color: var(--text); cursor: pointer;
  border-radius: 8px; padding: 4px 8px; margin: 0 -8px; transition: background .15s;
}
.lesson-p:hover { background: var(--card-2); }
.lesson-p.playing { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

.lesson-word {
  background: var(--card-2); border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.lesson-word:hover { border-color: var(--accent); }
.lesson-word.playing { background: var(--accent-soft); border-color: var(--accent); }
.lesson-word.is-known { border-color: var(--accent-2); }
.lesson-word.is-unknown { border-color: var(--danger); }
.lesson-word.is-known.playing, .lesson-word.is-unknown.playing { background: var(--accent-soft); border-color: var(--accent); }
.lesson-word-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lesson-word-th {
  font-family: var(--thai-font); font-size: 18px; font-weight: 600; color: var(--text);
  background: none; border: none; padding: 0; cursor: pointer;
}
.lesson-word-th:hover { color: var(--accent); text-decoration: underline; }
.lesson-word-ro { font-size: 12.5px; color: var(--accent-2); }
.lesson-word-mean { font-size: 14px; font-weight: 600; margin-left: auto; }
.lesson-word-hook { margin-top: 5px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.lesson-word-tag { margin-top: 5px; font-size: 11.5px; color: var(--text-3); }

.lesson-word-status { display: flex; gap: 6px; margin-top: 9px; }
.lw-status-btn {
  font-size: 11.5px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text-3); cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.lw-status-btn:hover { border-color: var(--accent); color: var(--text); }
.lw-status-btn.lw-known.active { background: var(--accent-2-soft); border-color: var(--accent-2); color: var(--accent-2); font-weight: 600; }
.lw-status-btn.lw-unknown.active { background: rgba(194,69,58,.13); border-color: var(--danger); color: var(--danger); font-weight: 600; }

@media (max-width: 720px) {
  .lesson-article { padding: 16px 14px 18px; }
  .lesson-word-mean { margin-left: 0; }
}

/* 从单词表跳回歌词时，让那个词闪一下，好在句子里一眼找到 */
.word.flash {
  animation: word-flash 1.8s ease;
  border-color: var(--accent);
}
@keyframes word-flash {
  0%, 100% { background: var(--card-2); }
  15%, 55% { background: var(--accent-soft); transform: translateY(-2px); }
}

/* ── 测验 ───────────────────────────── */
.quiz { max-width: 640px; margin: 0 auto; }
.quiz-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.quiz-progress { font-size: 13px; color: var(--text-2); }
.quiz-progress b { font-size: 15px; color: var(--text); }
.quiz-score { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.quiz-score b { color: var(--text-2); font-size: 13.5px; }

.quiz-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 22px 16px;
}
.quiz-word { text-align: center; }
.quiz-th {
  font-family: var(--thai-font); font-size: 46px; font-weight: 700;
  line-height: 1.35; letter-spacing: .01em; word-break: break-word;
}
.quiz-th.en { font-family: inherit; font-size: 38px; font-style: italic; }
.quiz-ro { font-size: 16px; color: var(--accent-2); margin-top: 4px; }
.quiz-cn { font-size: 18px; font-weight: 600; color: var(--text-2); margin-top: 2px; }
.quiz-speak {
  margin-top: 12px; background: var(--card-2); border: 1px solid var(--line);
  color: var(--text-2); border-radius: 999px; padding: 7px 16px; font-size: 13px;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.quiz-speak:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.quiz-speak.speaking { background: var(--accent); border-color: var(--accent); color: #fff; }
.quiz-lv {
  margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 11.5px; color: var(--text-3);
}
.quiz-hint-toggle, .quiz-hint-cn-toggle {
  background: transparent; border: 1px solid var(--line); color: var(--text-2);
  border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 12.5px;
  cursor: pointer; transition: all .15s;
}
.quiz-hint-toggle { margin-top: 12px; }
.quiz-hint-toggle:hover, .quiz-hint-cn-toggle:hover {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.quiz-hint {
  margin: 12px auto 0; max-width: 520px; padding: 11px 13px;
  border-radius: 11px; background: var(--card-2); border-left: 3px solid var(--accent);
  text-align: left;
}
.quiz-hint-line + .quiz-hint-line { margin-top: 9px; }
.quiz-hint-source { font-family: var(--thai-font); font-size: 16px; line-height: 1.6; color: var(--text); }
.quiz-hint-ro { margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--accent-2); }
.quiz-hint-cn { margin-top: 2px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.quiz-hint-cn-toggle { margin-top: 9px; padding-left: 0; border-color: transparent; }

.quiz-ask {
  text-align: center; font-size: 12.5px; color: var(--text-3);
  margin: 20px 0 12px; letter-spacing: .04em;
}

.quiz-opts { display: grid; gap: 9px; }
.qopt {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: var(--card-2); border: 1.5px solid var(--line);
  border-radius: 12px; padding: 13px 15px; cursor: pointer;
  font-family: inherit; font-size: 16px; color: var(--text); text-align: left;
  transition: all .14s;
}
.qopt:hover:not(:disabled) {
  background: var(--accent-soft); border-color: var(--accent); transform: translateY(-1px);
}
.qopt:disabled { cursor: default; }
.qopt b {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  background: var(--line); color: var(--text-2);
  font-size: 11.5px; font-weight: 600;
  display: grid; place-items: center;
}
.qopt.right {
  background: rgba(59,165,93,.14); border-color: var(--lv5); color: var(--text);
}
.qopt.right b { background: var(--lv5); color: #fff; }
.qopt.wrong {
  background: rgba(194,69,58,.13); border-color: var(--danger);
}
.qopt.wrong b { background: var(--danger); color: #fff; }
/* 答完之后没选中的那两个淡下去，视线留给对错 */
.qopt:disabled:not(.right):not(.wrong) { opacity: .45; }

.quiz-feedback {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card-2);
}
.quiz-feedback.ok  { border-color: var(--lv5); background: rgba(59,165,93,.08); }
.quiz-feedback.bad { border-color: var(--danger); background: rgba(194,69,58,.07); }
.fb-head { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.fb-lv { font-size: 11.5px; font-weight: 400; color: var(--text-3); margin-left: auto; }
.fb-line { margin-top: 7px; font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.fb-no { font-size: 11px; color: var(--text-3); margin-right: 7px; }
.fb-line b { font-family: var(--thai-font); font-size: 16px; font-weight: 600; color: var(--text); }
.fb-cn { display: block; color: var(--text-3); }

.quiz-next-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.quiz-next-row .btn { padding: 10px 22px; font-weight: 600; }

.quiz-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft);
}

/* 句子模式：完成当前行的单词后，用同一批词组装原歌词。 */
.sentence-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 24px 22px; }
.sentence-eyebrow { color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .04em; }
.sentence-audio { margin-top: 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--card-2); color: var(--text-2); padding: 7px 12px; cursor: pointer; font: inherit; }
.sentence-audio:hover, .sentence-audio.speaking { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.sentence-meaning { margin: 15px 0 12px; color: var(--text-2); font-size: 16px; line-height: 1.6; }
.sentence-answer, .sentence-bank { min-height: 82px; display: flex; align-content: flex-start; align-items: flex-start; flex-wrap: wrap; gap: 9px; padding: 14px; border-radius: 13px; }
.sentence-answer { border: 2px dashed var(--line); background: var(--card-2); }
.sentence-answer > span { margin: auto; align-self: center; color: var(--text-3); font-size: 13px; }
.sentence-bank { margin-top: 13px; border: 1px solid var(--line-soft); }
.sentence-token { display: grid; gap: 1px; min-width: 68px; padding: 9px 12px; border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 11px; background: var(--card); color: var(--text); cursor: pointer; font: inherit; }
.sentence-token:hover { border-color: var(--accent); background: var(--accent-soft); }
.sentence-token b { font-family: var(--thai-font); font-size: 18px; font-weight: 650; }
.sentence-token small { color: var(--accent-2); font-size: 10.5px; }
.sentence-answer .sentence-token { position: relative; padding-top: 15px; cursor: grab; touch-action: none; transition: transform .12s, opacity .12s, border-color .12s; }
.sentence-answer .sentence-token::before { content: ''; position: absolute; top: 6px; left: 50%; width: 20px; height: 3px; transform: translateX(-50%); border-radius: 999px; background: var(--line); }
.sentence-answer.drag-active { border-color: var(--accent); background: var(--accent-soft); }
.sentence-answer .sentence-token.dragging { cursor: grabbing; opacity: .62; transform: scale(1.04); border-color: var(--accent); box-shadow: var(--shadow-lg); z-index: 2; }
.sentence-feedback { display: grid; gap: 4px; margin-top: 13px; padding: 12px 14px; border-radius: 11px; font-size: 13px; }
.sentence-feedback.ok { color: var(--lv5); background: rgba(59,165,93,.1); border: 1px solid var(--lv5); }
.sentence-feedback.bad { color: var(--danger); background: rgba(194,69,58,.08); border: 1px solid var(--danger); }
.sentence-feedback span { color: var(--text-2); font-family: var(--thai-font); font-size: 16px; }
.sentence-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 15px; }

/* ── 一轮结束 ───────────────────────── */
.daily-card {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
  padding: 15px 17px; border-radius: 16px; color: #fff;
  background: linear-gradient(120deg, #c85e35, #df8b3f);
  box-shadow: 0 8px 24px rgba(194,100,58,.2);
}
.daily-card.completed { background: linear-gradient(120deg, #287b6c, #43a783); }
.daily-flame { font-size: 32px; line-height: 1; }
.daily-copy { flex: 1; min-width: 0; }
.daily-eyebrow { font-size: 11px; font-weight: 700; opacity: .8; letter-spacing: .08em; }
.daily-title { font-size: 18px; font-weight: 750; line-height: 1.35; }
.daily-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; opacity: .92; }
.daily-start { flex: none; background: #fff; color: #994621; border-color: rgba(255,255,255,.7); }
.daily-card.completed .daily-start { color: #176151; }
.daily-start:hover { filter: brightness(.96); }
.qd-daily { margin-bottom: 10px; color: var(--accent); font-weight: 750; }
.quiz-done {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 22px 22px; text-align: center;
}
.qd-score { font-size: 44px; font-weight: 700; line-height: 1.1; }
.qd-score b { color: var(--accent); }
.qd-word { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.qd-clean { margin-top: 18px; font-size: 14px; color: var(--lv5); }
.qd-missed { margin-top: 20px; text-align: left; }
.qd-missed-h { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.qd-miss {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-radius: 10px; background: var(--card-2);
  border: 1px solid var(--line-soft); margin-bottom: 6px;
}
.qd-miss-th {
  background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--thai-font); font-size: 19px; font-weight: 600; color: var(--text);
}
.qd-miss-th:hover, .qd-miss-th.speaking { color: var(--accent); }
.qd-miss-ro { font-size: 11.5px; color: var(--accent-2); }
.qd-miss-mean { margin-left: auto; font-size: 14px; color: var(--text-2); }
.qd-actions { margin-top: 22px; display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; }

/* ── 复制不了时的兜底 ─────────────────── */
.study-export {
  margin-top: 16px; padding: 14px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
}
.study-export p { margin: 0 0 8px; font-size: 13px; color: var(--text-2); }
.study-export textarea {
  width: 100%; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
  resize: vertical; margin-bottom: 8px;
}

.study-note {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; z-index: 200; box-shadow: var(--shadow-lg);
  pointer-events: none; opacity: 0; transition: opacity .25s;
}
.study-note.show { opacity: 1; }

/* ── 手机 ───────────────────────────── */
@media (max-width: 720px) {
  .daily-card { align-items: flex-start; flex-wrap: wrap; }
  .daily-flame { font-size: 26px; }
  .daily-start { width: 100%; }
  .study, .freq { padding: 14px 12px 56px; }
  .study-head { padding: 15px 15px 13px; }
  /* 三个按钮：开始测验独占一行，另外两个平分下面一行，谁都不会被挤成两行字 */
  .study-actions {
    margin-left: 0; width: 100%;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  }
  .study-actions .btn { text-align: center; white-space: nowrap; }
  .study-actions .btn.big { grid-column: 1 / -1; }
  .study-stat-big { font-size: 26px; }

  /* 一行塞不下五列，改成上下两行：词 + 意思一行，程度 + 按钮一行 */
  .wrow {
    grid-template-columns: 26px 1fr auto;
    grid-template-areas:
      "no  word  tools"
      ".   mean  mean"
      ".   lv    lv"
      ".   hint  hint";
    gap: 4px 10px; padding: 11px 12px;
  }
  .wrow-no    { grid-area: no; align-self: start; padding-top: 5px; }
  .wrow-word  { grid-area: word; }
  /* 手机上意思跟谐音上下挨着，加一道细边把「答案」这一行分出来 */
  .wrow-mean  {
    grid-area: mean; font-size: 14px;
    border-left: 2px solid var(--line); padding-left: 8px; margin-top: 3px;
  }
  .wrow-lv    { grid-area: lv; margin-top: 3px; }
  .wrow-tools { grid-area: tools; align-self: start; }
  .wrow-hint  { grid-area: hint; margin-top: 5px; }

  /* 词频总表：同样挤不下五列，改成词 + 次数一行，意思 + 标记/展开按钮一行 */
  .frow {
    grid-template-columns: 26px 1fr auto;
    grid-template-areas:
      "no  word   count"
      ".   mean   actions";
    gap: 4px 10px; padding: 11px 12px;
  }
  .frow .wrow-no    { grid-area: no; align-self: start; padding-top: 5px; }
  .frow .wrow-word  { grid-area: word; }
  .frow .wrow-mean  {
    grid-area: mean; font-size: 14px;
    border-left: 2px solid var(--line); padding-left: 8px; margin-top: 3px;
  }
  .frow-count   { grid-area: count; text-align: right; align-self: start; }
  .frow-actions { grid-area: actions; align-self: end; margin-top: 6px; }
  .frow-lines   { padding-left: 12px; }

  .freq-progress { flex-wrap: wrap; }
  .freq-progress-label { flex-basis: 100%; }

  .quiz-next-row .btn { width: 100%; }
  .quiz-th { font-size: 36px; }
  .quiz-th.en { font-size: 30px; }
  .quiz-card { padding: 20px 15px 14px; }
  .sentence-card { padding: 20px 15px 16px; }
  .sentence-actions .btn { flex: 1; }
  .qopt { font-size: 15px; padding: 12px 13px; }
  .qd-score { font-size: 36px; }
}

/* ── 打印：把单词表打出来带在身上背 ────── */
@media print {
  .topbar, .banner, .stickydeck, .viewbar, .uku-hint, .foot,
  .study-actions, .study-toolbar, .study-hint, .study-export,
  .wrow-tools, .ktv-view, #lyrics, #studyQuiz, #studyBattle { display: none !important; }
  .study { max-width: none; padding: 0; }
  .study-head, .wordlist { border: none; box-shadow: none; }
  .wrow { break-inside: avoid; border-bottom: 1px solid #ddd; box-shadow: none; }
  .wrow-mean.masked span { background: none; color: inherit; }
}
