/* ─────────────────────────────────────────────────────────────────────────
 * 手機轉換層（mobile.css）
 *
 * 這一支不是「另一套手機站」，而是套在桌面版頁面外面的轉換規則：
 *   桌面版＝一份 DOM／一份資料；手機版＝同一份 DOM，用這裡的規則重新排版。
 *   只有一個開關：<html data-mobile="1">（由 js/mobile.js 在載入前決定）。
 *
 * 三件事在這裡做完：
 *   1. 文・圖・讀：上半部是裁過的圖（裁剪區座標見 data/scene-crop.js），
 *      下半部是句子＋按鈕，兩者相鄰（間隙 20px），不再是一大片黑。
 *   2. 單篇／聽全文：整頁變成一張會自己長高的紙，文字不被截掉；
 *      文字框與下面的按鈕固定 20px，語言／注音開關怎麼切都不會拉開。
 *   3. 觸控尺寸、安全區、橫向溢出：手機該有的基本盤。
 *
 * ── 字級與尺寸：只准用下面的 token ──────────────────────────────────────
 * 2026-11-30 改寫。改寫前後的量測（_qa/mobile-type-audit.mjs，390×844）：
 *   單篇   13 種字級／3 種控制項高度 → 11 種／3 種（文字級數由 7 種收成 3 種）
 *   文圖讀  7 種字級／4 種控制項高度 → 5 種／3 種
 *
 * 「突兀」不是因為字太大或太小，是因為用了太多「差一兩 px、看起來一樣但又不一樣」的字級：
 * 改寫前單篇周邊小字同時存在 11.2／12／12.2／12.5／13.1／14.4／15 七種，
 * 而篇名（24.8px）又和課文（24.8px）一模一樣 —— 沒有層級，只剩雜訊。
 *
 * 規則如下，新增任何一條樣式都必須落在這裡面：
 *   字級  --m-fs-2xs 11px 極小（句序號、單位）
 *         --m-fs-xs  13px 註記（kicker／meta／句序、說明）
 *         --m-fs-sm  15px 控制項文字（所有按鈕、晶片、select，只有這一種）
 *         --m-fs-md  18px 小標題（橫式文圖讀的句子）
 *         --m-fs-read 24.8px 課文，單篇篇名也用這一級（見下方 token 說明）
 *         --m-fs-line 22–26px 文・圖・讀的句子（主角，比課文大一級）
 *      相鄰級距一律 ≥ 1.15×；小到看不出差別的兩個字級就是雜訊，不准新增。
 *      級數由 7 種收成 6 種（11／13／15／18／24.8／22–26）。
 *   行高  --m-lh-tight 1.25 標題／--m-lh-ui 1.5 註記／--m-lh-read 1.9 課文／
 *         --m-lh-ann 2.25 課文（有注音／拼音那一列）／--m-lh-hero 1.6 文圖讀的句子
 *   間距  --m-sp-1..6 ＝ 4／8／12／16／20／24px（4px 為基數，不用 5、6、7、9、10）
 *   可點  --m-ctl 44px（唯一的下限：Apple HIG 44pt／WCAG 2.5.5）
 *         --m-dot 36px（唯一例外：圓點是橫向滑動的分頁條，28 顆要擠在一條裡）
 *
 * ⚠ 驗收敏感值（量測腳本會量，改了一定要重跑，見 docs/手機版-轉換層-20261128.md §4）：
 *   --m-gap 20px           句子／文字區與按鈕列的固定間隙
 *   .text-detail-actions   的 margin-top 10px（_qa/mobile-detail-check.mjs 量 10±2px）
 *   .text-detail-layout    的高度：少 10px 就足以讓跟讀控制器（mobile.js R6）的
 *                          「提前一段」推送失準 → _qa/mobile-follow-scroll.mjs FAIL。
 *                          所以要動頭部（篇名、進度列）就要把高度補回去。
 *   .detail-line           的 gap 5px／padding 9px、以及 .detail-line.reading 的左右 6px：
 *                          這三個一起決定文字欄寬（358 − 20 − 5 − 12 = 321px），
 *                          少 1px 就可能讓某一句多折一行，段落突然長高 54px。
 * ───────────────────────────────────────────────────────────────────────── */

html[data-mobile="1"] {
  /* ── 間距：4px 為基數，全站手機只用這六格 ─────────────────────────── */
  --m-sp-1: 4px;
  --m-sp-2: 8px;
  --m-sp-3: 12px;
  --m-sp-4: 16px;
  --m-sp-5: 20px;
  --m-sp-6: 24px;

  --m-gap: var(--m-sp-5);   /* 使用者指定 20px，驗收會量 → 不要改 */
  --m-pad: var(--m-sp-4);

  /* ── 字級：級距 ≥1.15×，只准用這六格 ─────────────────────────────── */
  --m-fs-2xs: 0.6875rem;                              /* 11px */
  --m-fs-xs: 0.8125rem;                               /* 13px */
  --m-fs-sm: 0.9375rem;                               /* 15px */
  --m-fs-md: 1.125rem;                                /* 18px */
  /* 課文維持原本的 24.8px（1.55rem）。兩個原因，都實測過：
     ① 注音大小是 views.js 依字寬算的（ann-zy-col 的 perEm，直書注音要塞進一個字寬），
        課文一縮，注音就從 7.7px 掉到 6.9px —— 注音本來就很小，不能再縮。
     ② 折行：朗讀高亮列左右各 6px 內距，文字欄寬會從 333 變 321。
        字級動 0.8px 就足以讓某一句「平常 1 行、一變成正在唸就變 2 行」，
        段落瞬間長高 54px，跟讀控制器得用 1.5 秒追，那 1.5 秒正在唸的字被切在框外
        （_qa/mobile-follow-scroll.mjs 會 FAIL）。
     ⇒ 課文字級屬驗收敏感值，這次不動；要動請連 views.js 的 perEm 與跟讀控制器一起量。 */
  --m-fs-read: 1.55rem;                               /* 24.8px */
  --m-fs-line: clamp(1.375rem, 6.4vw, 1.625rem);      /* 22→26px */

  /* ── 行高 ─────────────────────────────────────────────────────────── */
  --m-lh-tight: 1.25;
  --m-lh-ui: 1.5;
  --m-lh-read: 1.9;
  --m-lh-ann: 2.25;
  --m-lh-hero: 1.6;         /* 文・圖・讀的句子是「一句話」，不跟課文用同一個行高 */

  /* ── 可點區域 ─────────────────────────────────────────────────────── */
  --m-ctl: 44px;
  --m-dot: 36px;

  --m-safe-b: env(safe-area-inset-bottom, 0px);
  --m-safe-t: env(safe-area-inset-top, 0px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 手機不要有橫向捲動：任何超寬的元素都會讓頁面左右搖。 */
html[data-mobile="1"] body { overflow-x: hidden; }

/* ── 一、文・圖・讀 ───────────────────────────────────────────────────── */

/* 直的：圖（吃掉剩下的高度）→ 標題 → 句子 → 20px → 按鈕 → 圓點。
   .reader-stage 目前是「圖＋標題＋句子」，按鈕與圓點是它的兄弟； */
html[data-mobile="1"] .reader {
  padding-top: var(--m-safe-t);
  --m-img-min: 36vh;      /* 句子再長，圖也留 36%；短句時約佔上半部 54% */
}

html[data-mobile="1"] .reader-stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-height: 0;
}

html[data-mobile="1"] .reader-scene {
  position: relative;
  inset: auto;
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: var(--m-img-min);
  max-height: none;
  background: #04100f;
  border-bottom: 1px solid rgba(232, 196, 122, 0.18);
  overflow: hidden;
}

html[data-mobile="1"] .reader-scene-layer { inset: 0; animation: none; }

/* 截剪區：JS 把 --m-x/--m-y/--m-w/--m-h（原圖比例座標）掛在 img 上，
   這裡就照那組座標把圖放大、往左往上是負位移，只露出矩形那一塊。 */
html[data-mobile="1"] .reader-scene-layer .scene-img {
  position: absolute;
  left: calc(-100% * var(--m-x, 0) / var(--m-w, 1));
  top: calc(-100% * var(--m-y, 0) / var(--m-h, 1));
  width: calc(100% / var(--m-w, 1));
  height: calc(100% / var(--m-h, 1));
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: 50% 50%;
  transform: none;
  animation: none;
}

html[data-mobile="1"] .reader-scene-veil { display: none; }

/* 圖下面那一條：篇名／第幾句。置中、窄一點，不要搶句子的位置。
   兩者同一級（--m-fs-xs）：它們是同一種「這裡是哪一句」的註記，
   用顏色深淺分主次，不用字級分 —— 差 2px 的兩個字級看起來只是沒對齊。 */
html[data-mobile="1"] .reader-top {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--m-sp-2);
  padding: var(--m-sp-3) var(--m-pad) 0;
  text-align: center;
  z-index: 60;
}
html[data-mobile="1"] .reader-kicker { font-size: var(--m-fs-xs); line-height: var(--m-lh-ui); letter-spacing: 0.06em; }
html[data-mobile="1"] .reader-pos { font-size: var(--m-fs-xs); line-height: var(--m-lh-ui); margin-top: 0; }
html[data-mobile="1"] .reader-meta { flex: 0 1 auto; min-width: 0; }
html[data-mobile="1"] .reader-version select { max-width: 38vw; height: var(--m-ctl); font-size: var(--m-fs-sm); }

/* 句子：不固定高度、不裁切。真的還是太寬就由 JS 縮字級（fit），不靠 overflow 硬切。
   margin-top:auto 讓「句子＋按鈕」黏在圖下面那一側，按鈕永遠跟在句子後 20px。 */
html[data-mobile="1"] .reader-body {
  flex: 0 1 auto;
  margin-top: auto;
  padding: var(--m-sp-2) var(--m-pad) var(--m-gap);
  justify-content: flex-end;   /* 句子貼著下面那 20px，間隙永遠剛好 */
  gap: var(--m-sp-2);
  min-height: 0;
  max-height: 44vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
html[data-mobile="1"] .reader-line {
  font-size: var(--m-fs-line);
  line-height: var(--m-lh-hero);
  padding: 0 0.05em;
  max-width: 100%;
  text-wrap: balance;          /* 兩行時不要只剩一個字掉到第二行 */
  overflow-wrap: anywhere;
}

/* 按鈕：緊貼句子（句子那格的 padding-bottom 就是 20px），不再釘在螢幕底。
   控制項只有一種高度（44px）與一種字級（--m-fs-sm）；上一句／下一句／聽這句
   三顆並排時同高同級，不再是一顆 12.5px 一顆 14.4px。 */
html[data-mobile="1"] .reader-foot {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 var(--m-sp-3) var(--m-sp-2);
  background: #071a1b;
  border-top: 0;
  gap: var(--m-sp-2);
}
html[data-mobile="1"] .reader-foot .mini-btn {
  padding: 0 var(--m-sp-3);
  font-size: var(--m-fs-sm);
  line-height: var(--m-lh-ui);
  min-height: var(--m-ctl);
}
html[data-mobile="1"] .reader-play {
  min-height: var(--m-ctl);
  font-size: var(--m-fs-sm);
  line-height: var(--m-lh-ui);
  max-width: none;
}

/* 圓點：最下面一條，可橫向滑，永遠不換行、不把按鈕往上頂。
   36px 是 --m-ctl 的唯一例外：28 顆要擠在一條裡（見檔頭 token 說明）。 */
html[data-mobile="1"] .reader-dots {
  flex: 0 0 auto;
  margin-top: 0;
  padding: var(--m-sp-1) var(--m-sp-3) calc(var(--m-sp-2) + var(--m-safe-b));
  gap: var(--m-sp-2);
  overflow-x: auto;
  overflow-y: hidden;
  justify-content: flex-start;
}
html[data-mobile="1"] .reader-dot {
  width: var(--m-dot);
  height: var(--m-dot);
  flex: 0 0 auto;
  font-size: var(--m-fs-2xs);
}

/* 關閉鈕：固定在右上角、壓在圖上（圖上本來就有一層暗角，白鈕讀得到）。
   與其他控制項同一個 44px，不再自己 42px。 */
html[data-mobile="1"] .reader-close.icon-btn {
  position: fixed;
  right: max(var(--m-sp-3), env(safe-area-inset-right, 0px));
  top: calc(var(--m-safe-t) + var(--m-sp-3));
  left: auto;
  width: var(--m-ctl);
  height: var(--m-ctl);
  z-index: 70;
  background: rgba(252, 247, 236, 0.94);
  color: #101614;
  border-color: rgba(16, 22, 20, 0.42);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.34);
}
html[data-mobile="1"] .reader[data-tone="bright"] .reader-close.icon-btn {
  background: rgba(252, 247, 236, 0.94);
  color: #101614;
}

/* 橫式（手機打橫）：圖在左、字與控制在右，跟原本的橫式規則一致，
   但右欄改成「字在上、按鈕緊貼在字下面」。 */
@media (orientation: landscape) and (max-height: 520px) {
  html[data-mobile="1"] .reader-stage {
    display: grid;
    grid-template-columns: minmax(0, 52%) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  html[data-mobile="1"] .reader-scene {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-height: 0;
    height: 100%;
    border-right: 1px solid rgba(232, 196, 122, 0.18);
    border-bottom: 0;
  }
  html[data-mobile="1"] .reader-top {
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-start;
    text-align: left;
    padding: var(--m-sp-2) 56px 0 var(--m-sp-3);
  }
  html[data-mobile="1"] .reader-body {
    grid-column: 2;
    grid-row: 2;
    align-items: flex-start;
    justify-content: center;     /* 橫式：字在右欄中間，不要貼在最下面 */
    margin-top: 0;
    padding: var(--m-sp-1) var(--m-sp-3) var(--m-gap);
    text-align: left;
    max-height: none;
  }
  /* 橫式高度只有 390，主句用 --m-fs-md（18px）：比課文小一級，字才不會被高度追著縮。 */
  html[data-mobile="1"] .reader-line { font-size: var(--m-fs-md); text-align: left; }
}

/* ── 二、單篇／聽全文：文字在上、按鈕固定在下面（同一頁） ────────────── */

/* 使用者要的是「文字 listbox 與底部按鈕在同一個畫面」。所以手機上：
   ① 整張紙不捲（overflow: hidden），按鈕列留在紙的下緣，永遠看得到；
   ② 捲的是文字區那一層（.text-detail-layout），不是文字框本身；
   ③ 文字框仍然不設高度、不內捲 → 有幾行就多高，字一個都不會被截掉，
      內捲的是外面那一層，所以看得到最後一句，也隨時按得到按鈕。 */
html[data-mobile="1"] .modal-backdrop:has(.text-detail) { padding: 0; align-items: stretch; }

html[data-mobile="1"] .modal.text-detail-modal {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 0;
  border: 0;
  padding: 0;
}

html[data-mobile="1"] .text-detail {
  height: 100%;
  max-height: none;
  overflow: hidden;                     /* 紙不捲：捲動交給文字區，按鈕才留得住 */
  display: flex;
  flex-direction: column;
  padding: calc(var(--m-safe-t) + var(--m-sp-3)) var(--m-pad) 0;
}

html[data-mobile="1"] .text-detail-head { gap: var(--m-sp-2); align-items: flex-start; flex: 0 0 auto; }
/* 篇名：維持與課文同級。試過改大一級（30px，讓層級更清楚），但頭部一高、文字區就矮，
   實測會讓跟讀控制器的「提前一段」推送失準 —— _qa/mobile-follow-scroll.mjs 由 all PASS
   變成 FAIL，而且每次失敗的段落都不同（seg 4／9／4），屬臨界行為，不是單純高度加減
   （把進度列的留白讓 8px 補回去也一樣 FAIL）。
   ⇒ 所以「篇名 vs 課文」的層級留給下一片，要跟 js/mobile.js 的 R6 一起量、一起改。 */
html[data-mobile="1"] .text-detail-head h2 {
  font-size: var(--m-fs-read);
  line-height: var(--m-lh-tight);
}
html[data-mobile="1"] .detail-head-right { flex-wrap: wrap; justify-content: flex-end; gap: var(--m-sp-2); }
/* 進度條那一列是註記，不是控制項：固定 --m-fs-xs，不要跟按鈕搶字級。
   margin 沿用原本的 10／8：這一列撐在文字區上方，留白一動就會牽動跟讀的臨界值。 */
html[data-mobile="1"] .text-detail-meta {
  flex: 0 0 auto;
  margin: 10px 0 8px;
  font-size: var(--m-fs-xs);
}

/* 篇名上面那一行（第幾篇 · 朝代）與作者那一行（作者 · 字數 · 句數）：
   同一級的註記，都用 --m-fs-xs；改寫前一個 11.5px、一個 16px（作者行反而比說明大）。
   不指定行高：這兩行撐在文字區上方，多 1px 就少 1px 文字區（跟讀對它敏感）。 */
html[data-mobile="1"] .text-detail-head .kicker,
html[data-mobile="1"] .text-detail-head .muted {
  font-size: var(--m-fs-xs);
}

/* 說明文字：styles.css 的 ≤760px 區塊把這些縮到 0.62–0.86rem（10–13.8px）——
   那是為了把整個對話框塞進 90vh；手機上整張紙本來就會自己捲，沒有理由再縮。
   課文簡介（第一段）是「要讀的字」，給 --m-fs-sm；其餘是註記，給 --m-fs-xs。 */
html[data-mobile="1"] .text-detail-intro p {
  font-size: var(--m-fs-sm);
  line-height: var(--m-lh-read);
}
html[data-mobile="1"] .detail-read-tip,
html[data-mobile="1"] .side-offer-kicker,
html[data-mobile="1"] .side-offer-copy,
html[data-mobile="1"] .side-offer-list li,
html[data-mobile="1"] .trial-copy span,
html[data-mobile="1"] .detail-trial-note,
html[data-mobile="1"] .text-detail .detail-lang-pick > span,
html[data-mobile="1"] .plan-link {
  font-size: var(--m-fs-xs);
  line-height: var(--m-lh-ui);
}
html[data-mobile="1"] .trial-copy b { font-size: var(--m-fs-sm); }

/* 文字區才是捲軸：紙不捲，這一層捲。裡面照原文順序排（簡介 → 句子 → 插圖／版本）。
   停在整句：每一句的「底」對齊文字區的「底」，所以停下來時最下面那一句
   （連同拼音／注音）是完整的，不會只露半行。 */
html[data-mobile="1"] .text-detail-layout {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overflow-anchor: none;                 /* 位置由 JS 錨點決定，瀏覽器不要再自己「穩定」一次 */
  padding-bottom: 0;                     /* 20px 的間隙改由按鈕列的 margin-top 提供（snap 對齊才準） */
  scrollbar-width: none;
  /* 停點一律由 JS 的 snapBottomOffset 決定（捲動停止 220ms 後對一次整句）。
     不用 CSS scroll-snap：它會在每次程式設定 scrollTop 後自己再吸一次，
     把「切注音要釘住同一顆字」與「跟讀只前進一點」抵銷掉（實測差 19px）。
     使用者手滑時一樣會對齊，只是換 JS 做。 */
  scroll-snap-type: none;
}
html[data-mobile="1"] .text-detail-layout::-webkit-scrollbar { display: none; }
/* 「停在最上面」時，底邊那半行不要硬切：JS 會給 .m-fade 的狀態算一個 clip-path，
   把露出來的那半行整段切掉（切在整句的邊界上），看起來就是文字自然停在那裡。
   捲動／切換後 snap 到整句，clip 會歸零。 */
html[data-mobile="1"] .text-detail-body .detail-line { scroll-snap-align: end; scroll-snap-stop: normal; scroll-margin-block: 0; }
/* 跟讀是程式逐幀改 scrollTop，這段時間不要讓瀏覽器插進來對齊（會抖）。 */
html[data-mobile="1"] .text-detail-layout.m-following { scroll-snap-type: none; }
/* 切注音／拼音的錨點校正也一樣：先關掉 snap，釘好位置再交還。 */
html[data-mobile="1"] .text-detail-layout.m-anchoring { scroll-snap-type: none; }
html[data-mobile="1"] .text-detail-layout.m-pin { scroll-snap-type: none; }
/* 整段播放都不要讓 CSS proximity snap 介入：停點由 JS 的 snapBottomOffset 算，
   不然動畫結束那一刻瀏覽器會自己再跳一段（實測被讀成 1000px/s 的瞬移）。 */
html[data-mobile="1"] .text-detail.is-listening .text-detail-layout { scroll-snap-type: none; }

/* 文字框：不設高度、不內捲 → 有幾行就多高，字一個都不會被截掉。
   注意：桌面版 app.js 會「配合可視高度」把 .text-detail-body 寫成固定 px 高（fitted），
   手機上那個高度正是文字被截掉、最後一句壓到按鈕底下的原因，所以用 !important 蓋掉。 */
html[data-mobile="1"] .text-detail-main { display: block; }
html[data-mobile="1"] .text-detail-body {
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  flex: 0 0 auto;
  padding-right: 0;
  scrollbar-width: none;
}
html[data-mobile="1"] .text-detail-body::-webkit-scrollbar { display: none; }

/* 右側的插圖／版本設定：手機排到下面去，不擋閱讀。 */
html[data-mobile="1"] .text-detail-side { display: block; margin-top: var(--m-sp-4); overflow: visible; padding-right: 0; }

/* 按鈕列：留在紙的下緣，跟文字同一個畫面；不 sticky、不絕對定位，就不會壓到字。
   margin-top 10px 放在「按鈕列的外面」：文字區停在整句的底（貼著文字區下緣），
   所以「最後一句 ↔ 按鈕列」永遠剛好 10px——不會像 padding 那樣把半行留在間隙裡。
   ⚠ 這個 10px 是驗收契約（_qa/mobile-detail-check.mjs 量 10±2px），不要換成 --m-sp-*。 */
html[data-mobile="1"] .text-detail-actions {
  position: static;
  flex: 0 0 auto;
  margin: 10px 0 0;
  padding: 10px 0 calc(var(--m-sp-3) + var(--m-safe-b));
  gap: var(--m-sp-2);
  border-top: 1px solid rgba(70, 52, 30, 0.12);
}
/* 動作列所有控制項：同一個 44px 高、同一個 15px 字。 */
html[data-mobile="1"] .text-detail-actions .btn,
html[data-mobile="1"] .text-detail-actions .mini-btn,
html[data-mobile="1"] .text-detail-actions .icon-btn,
html[data-mobile="1"] .text-detail-actions .detail-lang-pick select { min-height: var(--m-ctl); }
html[data-mobile="1"] .text-detail-actions .btn {
  padding: 0 var(--m-sp-4);
  font-size: var(--m-fs-sm);
  line-height: var(--m-lh-ui);
}

/* 播放中：動作列只留「■ 停止」。用 data-mobile 當條件（不只 760px 媒體查詢），
   橫式手機（844×390）也一樣；關閉／返回仍在標題列（左上返回）。 */
html[data-mobile="1"] .text-detail-actions.is-listening > *:not(.listening) { display: none; }
html[data-mobile="1"] .text-detail-actions.is-listening .btn.listening { flex: 1 1 auto; justify-content: center; }

/* 句子：行距放寬一點，注音／拼音不撞到上一行。
   padding 9px、gap 5px、以及下面 .detail-line.reading 的左右 6px 都是**折行敏感值**：
   它們一起決定每一句的文字欄寬（358 − 20 − 5 − 12 = 321px）。少 1px 就可能讓某一句
   多折一行 → 段落突然長高 54px → 跟讀控制器得用 1.5 秒追那 54px，這 1.5 秒內
   「正在唸的那一句」是切在框外的（_qa/mobile-follow-scroll.mjs 會 FAIL）。
   所以這幾個數字一律維持已驗證值，不改成 --m-sp-*。 */
html[data-mobile="1"] .detail-line {
  grid-template-columns: 20px 1fr;
  gap: 5px;
  padding: 9px 0;
}
html[data-mobile="1"] .detail-line p { font-size: var(--m-fs-read); line-height: var(--m-lh-read); }
html[data-mobile="1"] .text-detail-body .detail-line p:has(.ann) { line-height: var(--m-lh-ann); }
/* 句序號那一欄（01／02…）：只統一級數（11px），位置沿用 styles.css 的 padding-top，
   不動它的行高——它是格線的第一欄，行高一旦超過段落就會把整列撐高。 */
html[data-mobile="1"] .detail-line > span { font-size: var(--m-fs-2xs); }

/* 聽全文正在唸的那一句：留白不要忽大忽小。
   左右 6px 是折行敏感值（見上面 .detail-line 的說明），維持原值。 */
html[data-mobile="1"] .detail-line.reading { padding-left: 6px; padding-right: 6px; }

/* 語系／注音／版次：手指好按，且換字級時不把旁邊的鈕擠掉。
   改寫前是 40px，與其他 44px 的控制項差 4px —— 並排就看得出高低差。 */
html[data-mobile="1"] .annotation-btn {
  min-height: var(--m-ctl);
  padding: 0 var(--m-sp-3);
  font-size: var(--m-fs-sm);
  line-height: var(--m-lh-ui);
}
/* select 用內容寬度：固定 104px 會把「普通話／閩南語」這種長選項截掉，
   而截字看起來就是「沒排好」。上限 46vw 免得把旁邊的鈕擠出畫面。 */
html[data-mobile="1"] .detail-lang-pick select {
  height: var(--m-ctl);
  min-width: 0;
  width: auto;
  max-width: 46vw;
  font-size: var(--m-fs-sm);
}

/* ── 三、其他手機基本盤 ─────────────────────────────────────────────── */

html[data-mobile="1"] .modal:not(.text-detail-modal) {
  width: calc(100% - 16px);
  max-width: calc(100% - 16px);
  max-height: calc(100% - 24px);
  margin: 0;
}

html[data-mobile="1"] button,
html[data-mobile="1"] .btn,
html[data-mobile="1"] .mini-btn,
html[data-mobile="1"] select { touch-action: manipulation; }

/* 手機不該出現「滑到一半卡住」的雙捲軸：內層有滾動時，外層不要跟著跑。 */
html[data-mobile="1"] .text-detail,
html[data-mobile="1"] .reader { overscroll-behavior: contain; }

/* 減少動態：手機上的轉場縮短，避免每次換句都像卡一下。 */
@media (prefers-reduced-motion: reduce) {
  html[data-mobile="1"] .reader-scene-layer,
  html[data-mobile="1"] .reader-line { animation: none !important; transition: none !important; }
}
