/* ══════════════════════════════════════════════════════════════
   請看下回（to-be-continued）— 書架、書的首頁、目錄、章頁共用樣式
   外觀依 marku/products/novel-app/design/README.md（色彩代號、字級、版面斷點、閱讀工具）。
   頁面由 npm_scripts/FireFrame/zh-TW/apps/to-be-continued/gen-novel-pages.mjs 產生；class 一律 tbc- 前綴。
   主題：data-theme（reader.js 記在本機，light、sepia、green、dark）優先；沒設定過時跟系統的淺深色。
   章頁原樣複製、不經建置：不用 inset、:has()、color-mix() 這類 Chrome 74、Safari 12 不認得的寫法。
   ══════════════════════════════════════════════════════════════ */

:root {
  --tbc-paper: #fcfcfb;
  --tbc-surface: #f3f3f1;
  --tbc-raised: #ffffff;
  --tbc-ink: #1c1d21;
  --tbc-ink-2: #585b63;
  --tbc-ink-3: #6b6e76;
  --tbc-line: #e2e2de;
  --tbc-accent: #b3261e;
  --tbc-accent-ink: #ffffff;
  --tbc-accent-soft: #fbeceb;
  --tbc-gold: #8a6212;
  --tbc-gold-bg: #fbf3df;
  --tbc-gold-line: #dcb65c;
  --tbc-cover-bg: #17191e;
  --tbc-cover-ink: #f4f1ea;
  --tbc-shadow: 0 1px 2px rgb(20 20 25 / .06), 0 8px 24px -12px rgb(20 20 25 / .18);
  --tbc-float-shadow: 0 2px 6px rgba(20, 20, 25, .08), 0 14px 36px -12px rgba(20, 20, 25, .28);
  --tbc-count-fill: rgba(255, 255, 255, .24); /* 自動捲動與聽書讀完接下一回：倒數時下一回卡（朱紅底）上由左往右填的那一層 */

  /* 系統字，不載入網路字型：設計的 Noto Serif TC、Noto Sans TC 走 Google Fonts 時 Lighthouse 行動版效能只有 55 分
     （規格「已定的事」：未達 85 分改用系統字）。本機裝了 Noto 的照樣用它，其餘退回各平台的明體與黑體。 */
  --tbc-font-serif: "Noto Serif TC", "Noto Serif CJK TC", "Songti TC", "PMingLiU", serif;
  --tbc-font-ui: "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --tbc-font-read: var(--tbc-font-serif); /* 內文字體：讀者可改黑體（data-font="sans"）*/

  --tbc-s1: 4px; --tbc-s2: 8px; --tbc-s3: 12px; --tbc-s4: 16px; --tbc-s5: 24px; --tbc-s6: 32px; --tbc-s7: 48px; --tbc-s8: 64px;
  --tbc-radius: 10px;

  --tbc-fs-body: 18px;
  --tbc-lh-body: 1.85;
  --tbc-fs-ui: 15px;
  --tbc-fs-small: 13px;
  --tbc-fs-title: 24px;
  --tbc-measure: 40.8em; /* 約 40 個中文字（含 0.02em 字距），跟著字級放大 */
  color-scheme: light;
}

/* 夜間代號：寫兩次，一次給「讀者自己選了夜間」、一次給「沒選過、照系統」 */
:root[data-theme="dark"] {
  --tbc-paper: #121316; --tbc-surface: #1b1c20; --tbc-raised: #202126;
  --tbc-ink: #e4e2dd; --tbc-ink-2: #a4a6ad; --tbc-ink-3: #8a8c93; --tbc-line: #2d2e34;
  --tbc-accent: #f0766b; --tbc-accent-ink: #1a0b09; --tbc-accent-soft: #2e1a19;
  --tbc-gold: #e3b55a; --tbc-gold-bg: #231e13; --tbc-gold-line: #6b5423;
  --tbc-cover-bg: #0b0c0f; --tbc-cover-ink: #efece5;
  --tbc-shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -14px rgb(0 0 0 / .7);
  --tbc-float-shadow: 0 2px 8px rgba(0, 0, 0, .45), 0 16px 40px -12px rgba(0, 0, 0, .8);
  --tbc-count-fill: rgba(26, 11, 9, .2);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --tbc-paper: #121316; --tbc-surface: #1b1c20; --tbc-raised: #202126;
    --tbc-ink: #e4e2dd; --tbc-ink-2: #a4a6ad; --tbc-ink-3: #8a8c93; --tbc-line: #2d2e34;
    --tbc-accent: #f0766b; --tbc-accent-ink: #1a0b09; --tbc-accent-soft: #2e1a19;
    --tbc-gold: #e3b55a; --tbc-gold-bg: #231e13; --tbc-gold-line: #6b5423;
    --tbc-cover-bg: #0b0c0f; --tbc-cover-ink: #efece5;
    --tbc-shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -14px rgb(0 0 0 / .7);
    --tbc-float-shadow: 0 2px 8px rgba(0, 0, 0, .45), 0 16px 40px -12px rgba(0, 0, 0, .8);
    --tbc-count-fill: rgba(26, 11, 9, .2);
    color-scheme: dark;
  }
}
/* 護眼黃、護眼綠：讀者在閱讀設定選了才換，整頁一起換（頁首、卡片、抽屜都跟著）；沒列的代號跟淺色相同 */
:root[data-theme="sepia"] {
  --tbc-paper: #f4ecdb; --tbc-surface: #eae0c8; --tbc-raised: #faf5ea;
  --tbc-ink: #2e261c; --tbc-ink-2: #5a4d3b; --tbc-ink-3: #685a46; --tbc-line: #dccfb2;
  --tbc-accent: #a3281c; --tbc-accent-soft: #f0dccd;
  --tbc-gold: #765410; --tbc-gold-bg: #ede0bd; --tbc-gold-line: #c49d45;
}
:root[data-theme="green"] {
  --tbc-paper: #d9e9d2; --tbc-surface: #cbdec2; --tbc-raised: #e8f1e3;
  --tbc-ink: #1b2619; --tbc-ink-2: #3f503d; --tbc-ink-3: #4b5c49; --tbc-line: #b8cfae;
  --tbc-accent: #9c251b; --tbc-accent-soft: #e6d5c9;
  --tbc-gold: #664c0e; --tbc-gold-bg: #e0dcb8; --tbc-gold-line: #b89a44;
}

/* 字級四級：手機 17、18、20、22；桌機每級大一級。行距三級（緊湊、標準、寬鬆）：手機 1.7、1.85、2.05，桌機 1.75、1.9、2.1 */
:root[data-size="0"] { --tbc-fs-body: 17px; }
:root[data-size="2"] { --tbc-fs-body: 20px; }
:root[data-size="3"] { --tbc-fs-body: 22px; }
:root[data-lh="0"] { --tbc-lh-body: 1.7; }
:root[data-lh="2"] { --tbc-lh-body: 2.05; }
:root[data-font="sans"] { --tbc-font-read: var(--tbc-font-ui); }
@media (min-width: 1024px) {
  :root { --tbc-fs-title: 30px; --tbc-lh-body: 1.9; --tbc-fs-body: 20px; }
  :root[data-size="0"] { --tbc-fs-body: 18px; }
  :root[data-size="2"] { --tbc-fs-body: 22px; }
  :root[data-size="3"] { --tbc-fs-body: 24px; }
  :root[data-lh="0"] { --tbc-lh-body: 1.75; }
  :root[data-lh="2"] { --tbc-lh-body: 2.1; }
}

/* ── 基本 ── */
/* .tbc-page 掛在 <body> 上：整頁的重置只套在小說自己的元素（帶 tbc- 開頭的 class 的與它們裡面的），
   不碰同一頁掛在 body 底下的共用元件（網站前端約定「App 的樣式只管自己」；章頁與書頁在 R2 上，不必重產） */
.tbc-page, body [class*="tbc-"], body [class*="tbc-"] *, body [class*="tbc-"] *::before, body [class*="tbc-"] *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--tbc-paper); }
.tbc-page {
  margin: 0; background: var(--tbc-paper); color: var(--tbc-ink);
  font: 400 var(--tbc-fs-ui)/1.6 var(--tbc-font-ui);
  overflow-x: hidden;
}
body [class*="tbc-"][hidden], body [class*="tbc-"] [hidden] { display: none !important; }
/* 連結、按鈕、輸入框與焦點外框只套在小說自己的區塊：右下工具列、Cookie 同意條等火框共用件也掛在 body 底下，
   寫成 .tbc-page 會蓋掉它們的字色、字型與焦點外框。在這些區塊以外加連結或按鈕時，把那一塊補進來。
   不改用 :where() 降權重：小說自己的按鈕現在的樣子靠這個權重，瀏覽器地板（Chrome 74、Safari 12）也不支援。 */
.tbc-appbar a, .tbc-main a, .tbc-reader a, .tbc-sheet a, .tbc-drawer a { color: inherit; }
.tbc-appbar button, .tbc-main button, .tbc-reader button, .tbc-sheet button, .tbc-drawer button,
.tbc-dock button, .tbc-rail button, .tbc-modebar button, .tbc-toast button, button.tbc-follow,
.tbc-appbar input, .tbc-main input, .tbc-reader input, .tbc-sheet input, .tbc-drawer input { font: inherit; color: inherit; }
.tbc-appbar :focus-visible, .tbc-main :focus-visible, .tbc-reader :focus-visible, .tbc-sheet :focus-visible, .tbc-drawer :focus-visible,
.tbc-dock :focus-visible, .tbc-rail :focus-visible, .tbc-toast :focus-visible, .tbc-follow:focus-visible { outline: 2px solid var(--tbc-accent); outline-offset: 2px; border-radius: 6px; }
.tbc-modebar :focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.tbc-sheet:focus, .tbc-drawer:focus { outline: none; } /* 對話框打開時焦點在對話框本身，不畫外框 */
.tbc-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.tbc-wrap { max-width: 1080px; margin: 0 auto; padding: 0 var(--tbc-s4); }
@media (min-width: 720px) { .tbc-wrap { padding: 0 var(--tbc-s6); } }
.tbc-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tbc-note { color: var(--tbc-ink-2); font-size: 14px; margin-top: var(--tbc-s4); }

/* ── 按鈕 ── */
.tbc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--tbc-s2);
  min-height: 44px; padding: 0 var(--tbc-s5); border-radius: 999px;
  border: 1px solid var(--tbc-line); background: var(--tbc-raised);
  font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.tbc-btn:hover { border-color: var(--tbc-ink-3); }
.tbc-btn--primary { background: var(--tbc-accent); border-color: var(--tbc-accent); color: var(--tbc-accent-ink) !important; font-weight: 700; }
.tbc-btn--primary:hover { filter: brightness(1.06); border-color: var(--tbc-accent); }
.tbc-icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; background: none; border-radius: 999px; cursor: pointer; color: var(--tbc-ink-2); text-decoration: none;
}
.tbc-icon-btn:hover { background: var(--tbc-surface); color: var(--tbc-ink); }
.tbc-icon-btn[aria-pressed="true"] { color: var(--tbc-accent); background: var(--tbc-accent-soft); }
.tbc-when-dark { display: none; }
:root[data-theme="dark"] .tbc-when-dark { display: contents; }
:root[data-theme="dark"] .tbc-when-light { display: none; }

/* ── 頁首（不透明，內文不從底下透出）、頁尾 ── */
.tbc-appbar { position: sticky; top: 0; z-index: 20; background: var(--tbc-paper); border-bottom: 1px solid var(--tbc-line); }
.tbc-appbar__row { display: flex; align-items: center; gap: var(--tbc-s2); height: 56px; }
.tbc-brand { display: inline-flex; align-items: center; gap: var(--tbc-s2); min-height: 44px; text-decoration: none; font-weight: 700; letter-spacing: .08em; font-size: 17px; }
.tbc-brand__mark { width: 10px; height: 10px; background: var(--tbc-accent); border-radius: 2px; align-self: center; }
.tbc-spacer { flex: 1; }
/* 頁首的「寫小說」：reader.js 加上（什麼時候放寫在那裡）；觸控目標 44px，看得到的是裡面那顆膠囊 */
.tbc-studio-entry { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.tbc-studio-entry__pill { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--tbc-line); border-radius: 999px; background: var(--tbc-raised); color: var(--tbc-ink); font-size: 14px; font-weight: 600; white-space: nowrap; }
.tbc-studio-entry:hover .tbc-studio-entry__pill { border-color: var(--tbc-ink-3); }
.tbc-studio-entry .tbc-icon { width: 16px; height: 16px; }
.tbc-back { display: inline-flex; align-items: center; gap: var(--tbc-s1); text-decoration: none; font-weight: 500; min-height: 44px; padding-right: var(--tbc-s2); margin-left: -10px; min-width: 0; }
.tbc-back .tbc-icon { color: var(--tbc-ink-2); }
.tbc-back__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* 書名太長（英文頁）時一行收尾 */
.tbc-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--tbc-accent); }
.tbc-foot { border-top: 1px solid var(--tbc-line); margin-top: var(--tbc-s8); padding: var(--tbc-s6) 0 var(--tbc-s7); font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); }
.tbc-foot__row { display: flex; flex-wrap: wrap; gap: var(--tbc-s2) var(--tbc-s5); justify-content: space-between; }
.has-reader-tools .tbc-foot { padding-bottom: 120px; } /* 留出底部工具列與控制列的高度，頁尾不被蓋住 */

/* ── 封面：有書封圖時圖當底（圖裡沒有字）、書名與印章用 HTML 疊在左上的暗部；沒有就是純文字書名版 ── */
.tbc-cover {
  position: relative; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden;
  background: var(--tbc-cover-bg); color: var(--tbc-cover-ink); box-shadow: var(--tbc-shadow);
  display: grid; place-items: center;
}
.tbc-cover::before { content: ""; position: absolute; top: 7%; right: 7%; bottom: 7%; left: 7%; border: 1px solid rgb(244 241 234 / .22); z-index: 2; }
.tbc-cover__title { writing-mode: vertical-rl; white-space: nowrap; font-family: var(--tbc-font-serif); font-weight: 700; letter-spacing: .18em; font-size: var(--tbc-cover-size, 44px); line-height: 1; }
.tbc-cover__kicker { position: absolute; top: 11%; right: 13%; writing-mode: vertical-rl; font-size: calc(var(--tbc-cover-size, 44px) * .26); letter-spacing: .3em; opacity: .7; }
.tbc-cover__seal {
  position: absolute; left: 12%; bottom: 10%; width: calc(var(--tbc-cover-size, 44px) * .62); height: calc(var(--tbc-cover-size, 44px) * .62);
  background: #b3261e; color: #fff; display: grid; place-items: center; border-radius: 3px;
  font-family: var(--tbc-font-serif); font-weight: 700; font-size: calc(var(--tbc-cover-size, 44px) * .2); line-height: 1.05; writing-mode: vertical-rl; letter-spacing: .05em;
}
/* 封面是圖時只放圖：使用者自己的圖不知道哪裡空，不疊書名、那一行與印章，也不畫內框（圖上要有書名的，字畫在圖裡）。
   高度由圖的寬高比決定（img 的 width、height 先佔好位置，版面不跳）；圖還沒到時是封面的底色 */
.tbc-cover--art { display: block; aspect-ratio: auto; }
.tbc-cover--art::before { content: none; }
.tbc-cover__img { display: block; width: 100%; height: auto; }
/* 英文頁的文字書封：書名照原文直排；類型那一行與印章是英文，印章改橫寫、字放大到看得清楚 */
html[lang="en"] .tbc-cover__kicker { letter-spacing: .06em; }
html[lang="en"] .tbc-cover__seal {
  writing-mode: horizontal-tb; width: auto; height: auto; padding: .35em .5em; line-height: 1; letter-spacing: .04em;
  font-family: var(--tbc-font-ui); font-size: max(9px, calc(var(--tbc-cover-size, 44px) * .2));
}
/* 文字書封（會員的書還沒畫書封時）：書名長的照 coverFit 分成兩到四行直排（產頁時已經用換行分好、每行字數平均），字跟著縮小，
   整塊在封面中間偏上，不壓到印章；旁邊那一行（會員的書是筆名）太長的收在封面裡 */
.tbc-cover__kicker { max-height: 78%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } /* 太長的筆名收成刪節號，不切掉半個字 */
.tbc-cover--len2 .tbc-cover__title, .tbc-cover--len3 .tbc-cover__title, .tbc-cover--len4 .tbc-cover__title {
  white-space: pre-line; line-height: 1.32; letter-spacing: .1em; margin-bottom: 9%;
}
.tbc-cover--len2 .tbc-cover__title { font-size: calc(var(--tbc-cover-size, 44px) * .72); }
.tbc-cover--len3 .tbc-cover__title { font-size: calc(var(--tbc-cover-size, 44px) * .54); }
.tbc-cover--len4 .tbc-cover__title { font-size: calc(var(--tbc-cover-size, 44px) * .43); }
.tbc-cover--small .tbc-cover__kicker { font-size: 10px; letter-spacing: .12em; } /* 書架卡片的小書封：筆名照樣看得清楚 */
/* 英文書的文字書封：書名橫排、在字與字之間換行（直排會把英文字拆開），照字數縮字級；筆名橫排在上面 */
.tbc-cover--latin .tbc-cover__title {
  writing-mode: horizontal-tb; white-space: normal; text-align: center; letter-spacing: .01em; line-height: 1.15;
  padding: 0 13%; font-size: calc(var(--tbc-cover-size, 44px) * .5); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
.tbc-cover--latin.tbc-cover--len2 .tbc-cover__title { font-size: calc(var(--tbc-cover-size, 44px) * .4); }
.tbc-cover--latin.tbc-cover--len3 .tbc-cover__title { font-size: calc(var(--tbc-cover-size, 44px) * .32); }
.tbc-cover--latin .tbc-cover__kicker { writing-mode: horizontal-tb; left: 13%; right: 13%; text-align: center; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 書架、書的首頁 ── */
.tbc-main { padding-top: var(--tbc-s5); }
/* 作者取的書名、集名、章名與摘要可能有斷不開的長英文字或網址（會員的書）：書頁、目錄與章頁的字照需要在任何地方換行，不撐出橫向捲軸 */
.tbc-main, .tbc-reader { overflow-wrap: anywhere; }
.tbc-shelf-head { padding: var(--tbc-s5) 0; }
.tbc-shelf-head h1 { margin: 0; font-size: 28px; letter-spacing: .06em; }
.tbc-shelf-head p { margin: var(--tbc-s2) 0 0; color: var(--tbc-ink-2); }
.tbc-feature { display: grid; gap: var(--tbc-s5); align-items: center; grid-template-columns: 132px 1fr; }
.tbc-feature .tbc-cover { --tbc-cover-size: 34px; }
.tbc-feature__title { margin: 0; font-family: var(--tbc-font-serif); font-size: 28px; letter-spacing: .06em; line-height: 1.3; }
.tbc-feature__sub { margin: var(--tbc-s1) 0 0; color: var(--tbc-accent); font-weight: 500; }
.tbc-feature__blurb { grid-column: 1 / -1; margin: 0; font-size: 16px; line-height: 1.8; }
.tbc-feature__lang { grid-column: 1 / -1; margin: 0; font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); } /* 書的語言跟介面不同：內文是哪種語言 */
.tbc-feature__early { display: block; margin-top: var(--tbc-s2); font-size: var(--tbc-fs-small); font-weight: 500; color: var(--tbc-accent); } /* 開賣之後：新的一回先搶先讀 */
.tbc-feature .tbc-meta, .tbc-feature__actions { grid-column: 1 / -1; }
.tbc-meta { font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); display: flex; flex-wrap: wrap; gap: 0 var(--tbc-s3); }
.tbc-feature__actions { display: flex; flex-wrap: wrap; gap: var(--tbc-s3); }
.tbc-feature__actions .tbc-btn { flex: 1 1 auto; }
.tbc-feature--book { margin-top: var(--tbc-s4); }
@media (min-width: 720px) {
  .tbc-feature { grid-template-columns: 260px 1fr; gap: var(--tbc-s5) var(--tbc-s7); padding: var(--tbc-s5) 0; }
  .tbc-feature .tbc-cover { --tbc-cover-size: 64px; grid-row: span 4; }
  .tbc-feature__title { font-size: 44px; }
  .tbc-feature__sub { font-size: 17px; }
  .tbc-feature__blurb { grid-column: 2; font-size: 18px; max-width: 30em; }
  .tbc-feature__lang { grid-column: 2; }
  .tbc-feature--lang .tbc-cover { grid-row: span 5; } /* 書的語言跟介面不同時多一行「內文是哪種語言」 */
  .tbc-feature .tbc-meta, .tbc-feature__actions { grid-column: 2; }
  .tbc-feature__actions .tbc-btn { flex: 0 0 auto; }
}
.tbc-latest, .tbc-resume {
  display: flex; align-items: center; gap: var(--tbc-s3); margin-top: var(--tbc-s6);
  padding: var(--tbc-s4); border-radius: var(--tbc-radius); text-decoration: none;
}
.tbc-latest { border: 1px solid var(--tbc-line); background: var(--tbc-raised); }
.tbc-latest__t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbc-latest > .tbc-icon, .tbc-resume > .tbc-icon:last-child { color: var(--tbc-ink-3); }
.tbc-resume { margin-top: var(--tbc-s5); gap: var(--tbc-s4); background: var(--tbc-surface); }
.tbc-resume > div { flex: 1; min-width: 0; }
.tbc-resume__k { font-size: 12px; font-weight: 700; color: var(--tbc-ink-2); letter-spacing: .1em; }
.tbc-resume__t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbc-resume__pct { display: flex; align-items: center; margin-top: 6px; font-size: 12px; color: var(--tbc-ink-2); font-variant-numeric: tabular-nums; }
.tbc-resume__bar { flex: 1; max-width: 160px; height: 3px; margin-right: var(--tbc-s2); border-radius: 3px; background: var(--tbc-line); overflow: hidden; }
.tbc-resume__bar > span { display: block; width: 0; height: 100%; background: var(--tbc-accent); }
.tbc-tag { flex: none; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; line-height: 1.6; }
.tbc-tag--new { color: var(--tbc-accent); background: var(--tbc-accent-soft); }
.tbc-tag--here { color: var(--tbc-ink); background: var(--tbc-surface); }
.tbc-tag--now { color: var(--tbc-accent-ink); background: var(--tbc-accent); }
.tbc-tag--early { color: var(--tbc-gold); background: var(--tbc-gold-bg); } /* 搶先讀 */
.tbc-tag--plan { color: var(--tbc-gold); background: var(--tbc-gold-bg); } /* Plus 會員免費 */
.tbc-tag--unlocked { color: var(--tbc-ink-2); background: var(--tbc-surface); } /* 目錄：登入的讀者解鎖過的回 */
.tbc-tag--lang { color: var(--tbc-ink-2); background: var(--tbc-surface); box-shadow: inset 0 0 0 1px var(--tbc-line); } /* 書的語言跟介面不同：書名旁標語言 */
.tbc-feature__title .tbc-tag--lang, .tbc-card__title .tbc-tag--lang {
  display: inline-block; margin-left: var(--tbc-s2); vertical-align: .35em;
  font-family: var(--tbc-font-ui); letter-spacing: normal; white-space: nowrap;
}
.tbc-free-on { flex: none; font-size: 12px; color: var(--tbc-ink-3); } /* 搶先讀的回幾月幾日起免費 */
.tbc-ch-list__early { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--tbc-s2); margin-top: 4px; } /* 目錄：搶先讀的標記排在章名下面 */
.tbc-grid { display: grid; gap: var(--tbc-s5); grid-template-columns: 1fr; }
@media (min-width: 720px) { .tbc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tbc-grid { grid-template-columns: repeat(3, 1fr); } }
.tbc-card { display: grid; grid-template-columns: 104px 1fr; gap: var(--tbc-s4); text-decoration: none; padding: var(--tbc-s4); border-radius: var(--tbc-radius); border: 1px solid var(--tbc-line); background: var(--tbc-raised); }
.tbc-card:hover { border-color: var(--tbc-ink-3); }
.tbc-card .tbc-cover { --tbc-cover-size: 26px; box-shadow: none; align-self: start; } /* 書封照圖的比例、靠上，不被右邊較高的字撐高（撐高時圖底下會露出底色） */
.tbc-card__title { margin: 0; font-family: var(--tbc-font-serif); font-size: 21px; letter-spacing: .04em; }
.tbc-card__blurb { margin: var(--tbc-s1) 0 var(--tbc-s2); font-size: 14px; line-height: 1.7; color: var(--tbc-ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tbc-feature__by { margin: var(--tbc-s1) 0 0; font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); } /* 會員的書：筆名 */

/* ── 書架：語言篩選（reader.js 打開；讀者選過的語言頁首那段程式放到 html[data-shelf]，第一個畫面就照它藏起別的語言的書）── */
.tbc-langs { display: flex; flex-wrap: wrap; gap: var(--tbc-s2); margin-bottom: var(--tbc-s5); }
.tbc-langs[hidden] { display: none; }
html[data-shelf] .tbc-langs[hidden] { display: flex; } /* 選過語言的讀者：篩選列第一個畫面就在，不等程式（按下去才換的由程式接手）*/
.tbc-langs__opt {
  min-height: 36px; padding: 0 var(--tbc-s4); border-radius: 999px; border: 1px solid var(--tbc-line);
  background: var(--tbc-raised); font-size: 14px; font-weight: 500; cursor: pointer;
}
.tbc-langs__opt:hover { border-color: var(--tbc-ink-3); }
.tbc-langs__opt[aria-pressed="true"] { background: var(--tbc-ink); border-color: var(--tbc-ink); color: var(--tbc-paper); }
.tbc-langs__none { margin: 0 0 var(--tbc-s5); color: var(--tbc-ink-2); }
.tbc-langs__none[hidden] { display: none; }
html[data-shelf="zh-hant"] .tbc-page--shelf [data-lang]:not([data-lang="zh-hant"]),
html[data-shelf="en"] .tbc-page--shelf [data-lang]:not([data-lang="en"]) { display: none; }
/* 放在作者工作室的書那一格：回數與最新一回由 reader.js 照 R2 上的資料填，填好之前先占位置、看不到（版面不跳）*/
.tbc-page--shelf [data-pending] { visibility: hidden; }

/* 書架的分區（最近更新、新書、完結）與搜尋：reader.js 把書目檔的書跟作者工作室上架的書放在一起畫 */
.tbc-langs + .tbc-genres { margin-top: calc(var(--tbc-s2) - var(--tbc-s5)); }
.tbc-shelfx__search { max-width: 420px; margin: 0 0 var(--tbc-s5); }
.tbc-shelfsec { margin-bottom: var(--tbc-s7); }
.tbc-shelfsec__title { margin: 0 0 var(--tbc-s4); font-size: 22px; letter-spacing: .06em; }
.tbc-shelfsec__foot { display: flex; justify-content: center; margin-top: var(--tbc-s4); }
.tbc-shelfsec__foot .tbc-btn { padding: 0 var(--tbc-s5); }
.tbc-members__field { display: flex; align-items: center; gap: var(--tbc-s2); height: 44px; padding: 0 var(--tbc-s3); border: 1px solid var(--tbc-line); border-radius: 999px; background: var(--tbc-raised); }
.tbc-members__field .tbc-icon { flex: none; width: 18px; height: 18px; color: var(--tbc-ink-3); }
.tbc-members__field input { flex: 1; min-width: 0; height: 40px; border: 0; background: none; color: var(--tbc-ink); font: inherit; font-size: 16px; } /* 16px：iOS 點進去不放大 */
.tbc-members__field input::placeholder { color: var(--tbc-ink-3); opacity: 1; }
.tbc-members__field input:focus { outline: none; }
.tbc-members__field:focus-within { border-color: var(--tbc-accent); box-shadow: 0 0 0 1px var(--tbc-accent); }
.tbc-members__count { margin: 0 0 var(--tbc-s3); font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); }
.tbc-members__count[hidden] { display: none; }
[data-shelf-hits] { margin-bottom: var(--tbc-s7); }
.tbc-card--member .tbc-card__title { font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; }
.tbc-card__by { margin: 2px 0 0; font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); overflow-wrap: anywhere; }
.tbc-card--member .tbc-card__blurb { -webkit-line-clamp: 2; }

.tbc-crumbs { font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); display: flex; flex-wrap: wrap; gap: 0 var(--tbc-s2); }
.tbc-crumbs a { position: relative; text-decoration: none; }
.tbc-crumbs a::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: max(44px, calc(100% + 24px)); transform: translateY(-50%); } /* 觸控目標至少 44px 高：只撐點得到的範圍、不撐高這一列，書名長到換行時也不會疊到上一行 */
.tbc-crumbs a:hover { text-decoration: underline; }
.tbc-section-title { display: flex; align-items: baseline; justify-content: space-between; margin: var(--tbc-s7) 0 var(--tbc-s3); }
.tbc-section-title h2 { margin: 0; font-size: 20px; }
.tbc-section-title a { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; font-size: 14px; color: var(--tbc-ink-2); }
.tbc-vol-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--tbc-line); }
.tbc-vol-list a { display: flex; gap: var(--tbc-s3); align-items: center; min-height: 56px; padding: var(--tbc-s3) 0; border-bottom: 1px solid var(--tbc-line); text-decoration: none; }
.tbc-vol-list__n { flex: none; width: 4.5em; color: var(--tbc-ink-2); font-size: 14px; }
.tbc-vol-list__t { flex: 1; min-width: 0; }
.tbc-vol-list__c { flex: none; color: var(--tbc-ink-3); font-size: 13px; }

/* ── 目錄（目錄頁與章頁的目錄抽屜共用）── */
.tbc-toc-head { padding: var(--tbc-s5) 0 var(--tbc-s3); display: grid; gap: var(--tbc-s4); }
.tbc-toc-head h1 { margin: 0; font-size: 26px; }
.tbc-jump { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tbc-s2); margin: 0; }
.tbc-jump label { font-weight: 500; }
.tbc-jump__field { display: inline-flex; align-items: center; gap: var(--tbc-s2); height: 44px; padding: 0 var(--tbc-s3); border: 1px solid var(--tbc-ink-3); border-radius: 8px; background: var(--tbc-raised); }
.tbc-jump input { width: 4.5em; border: 0; background: none; font-size: 17px; text-align: center; }
.tbc-jump input:focus { outline: none; }
.tbc-jump__field:focus-within { border-color: var(--tbc-accent); box-shadow: 0 0 0 1px var(--tbc-accent); }
.tbc-jump__err { flex-basis: 100%; color: var(--tbc-accent); font-size: 14px; margin: 0; }
.tbc-jump.is-error .tbc-jump__field { border-color: var(--tbc-accent); }
.tbc-toc-tools { display: flex; gap: var(--tbc-s4); font-size: 14px; }
.tbc-linkish { background: none; border: 0; padding: 0; color: var(--tbc-ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }
.tbc-vol { border-top: 1px solid var(--tbc-line); }
.tbc-vol:last-of-type { border-bottom: 1px solid var(--tbc-line); }
.tbc-vol > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr auto 24px; gap: var(--tbc-s3); align-items: center; padding: var(--tbc-s4) 0; min-height: 64px; }
.tbc-vol > summary::-webkit-details-marker { display: none; }
.tbc-vol__n { display: block; font-size: 13px; font-weight: 700; color: var(--tbc-accent); letter-spacing: .1em; }
.tbc-vol__t { display: block; font-family: var(--tbc-font-serif); font-weight: 600; font-size: 18px; line-height: 1.45; }
.tbc-vol__c { color: var(--tbc-ink-3); font-size: 13px; }
.tbc-vol > summary .tbc-icon { transition: transform .2s ease; color: var(--tbc-ink-2); }
.tbc-vol[open] > summary .tbc-icon { transform: rotate(180deg); }
.tbc-ch-list { list-style: none; margin: 0 0 var(--tbc-s4); padding: 0; display: grid; grid-template-columns: 1fr; column-gap: var(--tbc-s6); }
@media (min-width: 1024px) { .tbc-main .tbc-ch-list { grid-template-columns: 1fr 1fr; } }
.tbc-ch-list a { display: flex; gap: var(--tbc-s3); align-items: baseline; padding: 10px 0; min-height: 44px; text-decoration: none; border-bottom: 1px dashed var(--tbc-line); }
.tbc-ch-list a:hover .tbc-ch-list__t { text-decoration: underline; text-underline-offset: 3px; }
.tbc-ch-list__n { flex: none; width: 4.2em; color: var(--tbc-ink-3); font-size: 14px; font-variant-numeric: tabular-nums; }
.tbc-ch-list__t { flex: 1; min-width: 0; line-height: 1.55; }
html[lang="en"] .tbc-ch-list__n { width: 6.4em; white-space: nowrap; } /* 英文頁：Chapter 499 比「第 499 回」長 */
html[lang="en"] .tbc-vol-list__n { width: 5.4em; white-space: nowrap; }
.tbc-ch-list a.is-hit { background: var(--tbc-accent-soft); border-radius: 6px; }
.tbc-ch-list a.is-current { margin: 0 calc(var(--tbc-s2) * -1); padding-left: var(--tbc-s2); padding-right: var(--tbc-s2); background: var(--tbc-accent-soft); border-radius: 6px; }

/* ── 章頁 ── */
.tbc-reader { max-width: calc(var(--tbc-measure) + 2 * var(--tbc-s4)); margin: 0 auto; padding: 0 var(--tbc-s4); font-size: var(--tbc-fs-body); }
@media (min-width: 720px) { .tbc-reader { padding: 0 var(--tbc-s6); max-width: calc(var(--tbc-measure) + 2 * var(--tbc-s6)); } }
.tbc-ch-head { padding: var(--tbc-s6) 0 var(--tbc-s4); font-size: var(--tbc-fs-ui); }
.tbc-ch-head__vol { margin: 0; color: var(--tbc-ink-2); font-size: var(--tbc-fs-small); }
.tbc-ch-head__num { margin: var(--tbc-s4) 0 var(--tbc-s1); color: var(--tbc-accent); font-weight: 700; letter-spacing: .12em; }
.tbc-ch-head__title { margin: 0; font-family: var(--tbc-font-serif); font-weight: 700; font-size: var(--tbc-fs-title); line-height: 1.4; letter-spacing: .02em; text-wrap: balance; }
.tbc-ch-head__lang { margin: var(--tbc-s2) 0 0; color: var(--tbc-ink-2); font-size: var(--tbc-fs-small); } /* 書的語言跟介面不同：內文是哪種語言 */
/* 兩側欄寬設上限（minmax(0, 1fr)）：最新一回的「下一回還在寫」不換行時比 320 寬的半欄長，會把整列撐出畫面；放不下就折成兩行 */
.tbc-pager { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: var(--tbc-s2); align-items: center; font-size: var(--tbc-fs-ui); padding-bottom: var(--tbc-s5); border-bottom: 1px solid var(--tbc-line); }
.tbc-pager__prev { justify-self: start; }
.tbc-pager__next { justify-self: end; }
.tbc-pager .tbc-btn { padding: 0 var(--tbc-s4); }
.tbc-pager .tbc-btn[aria-disabled="true"] { color: var(--tbc-ink-3); border-style: dashed; background: none; pointer-events: none; white-space: normal; text-align: center; line-height: 1.25; text-wrap: balance; } /* 排成兩行時兩行一樣長（「下一回／還在寫」），不剩一個字在第二行 */
html[lang="en"] .tbc-pager .tbc-btn[aria-disabled="true"] { justify-self: stretch; white-space: normal; text-align: center; font-size: 13px; line-height: 1.25; padding: 6px 10px; } /* 英文的「Next chapter coming soon」比欄寬長：字小一點、折成兩行，不撐出畫面 */
html[lang="en"] .tbc-pager .tbc-btn[aria-disabled="true"] .tbc-icon { display: none; }
/* 窄的畫面：要解鎖的回的鈕箭頭、積木加字（英文「Previous」）比半欄長，會蓋到中間的目錄鈕：留白少一點，有積木的拿掉箭頭（左右的位置與字已經說了方向） */
@media (max-width: 430px) {
  .tbc-pager .tbc-btn { padding: 0 var(--tbc-s3); }
  .tbc-pager .tbc-btn[data-locked] > .tbc-icon:not(.tbc-brick) { display: none; }
}
.tbc-kbd-hint { display: none; font-size: var(--tbc-fs-small); color: var(--tbc-ink-3); text-align: center; margin-top: var(--tbc-s3); }
@media (min-width: 1024px) and (hover: hover) { .tbc-kbd-hint { display: block; } }
.tbc-kbd-hint kbd { font-family: var(--tbc-font-ui); font-size: 12px; border: 1px solid var(--tbc-line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

.tbc-prose { padding-top: var(--tbc-s6); font-family: var(--tbc-font-read); line-height: var(--tbc-lh-body); letter-spacing: .02em; text-align: justify; overflow-wrap: anywhere; }
.tbc-prose > * { border-radius: 4px; transition: background-color .25s, box-shadow .25s; }
.tbc-prose p { margin: 0 0 1.05em; }
.tbc-prose h2, .tbc-prose h3 { font-size: 1.05em; margin: 1.8em 0 .8em; line-height: 1.5; }
.tbc-prose ul, .tbc-prose ol { margin: 0 0 1.05em; padding-left: 1.5em; }
.tbc-prose li { margin-bottom: .4em; }
.tbc-prose blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1em; border-left: 2px solid var(--tbc-line); color: var(--tbc-ink-2); }
.tbc-prose blockquote p { margin: 0 0 .6em; }
.tbc-prose blockquote p:last-child { margin: 0; }
.tbc-prose blockquote ul, .tbc-prose blockquote ol { margin: 0 0 .6em; }
.tbc-prose blockquote > :last-child { margin-bottom: 0; }
.tbc-prose hr.tbc-scene-break { border: 0; text-align: center; margin: 2em 0; }
.tbc-prose hr.tbc-scene-break::after { content: "◆　◆　◆"; font-size: 10px; letter-spacing: .4em; color: var(--tbc-ink-3); }
/* 毒舌旁白：黑體、金色淺底、左邊一道金線，上方小標「旁白」（::before，不進內文，聽書也不會唸）。
   旁白與內心話也算內文：字級是內文的 0.95 倍、至少 17px（規格「手機字級至少 17px」，最小一級的內文就是 17px） */
.tbc-prose .tbc-narrator {
  position: relative; margin: 1.6em 0; padding: 1.9em 1.1em .9em 1.1em;
  font-family: var(--tbc-font-ui); font-size: max(17px, .95em); line-height: 1.8; letter-spacing: .01em; text-align: left;
  color: var(--tbc-ink); background: var(--tbc-gold-bg); border-left: 3px solid var(--tbc-gold-line); border-radius: 0 8px 8px 0;
}
.tbc-prose .tbc-narrator::before { content: "旁白"; position: absolute; top: .7em; left: 1.2em; font-size: 12px; font-weight: 700; letter-spacing: .3em; color: var(--tbc-gold); }
html[lang="en"] .tbc-prose .tbc-narrator::before { content: "Narrator"; letter-spacing: .08em; } /* 英文頁：內文照原文，標籤照英文 */

/* ── 還鎖著的回（搶先讀、Plus 會員免費；規格「付費的回的頁」）：章頁頂的標記、內文的開頭與付費牆 ── */
.tbc-ch-head__early { margin: var(--tbc-s2) 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--tbc-s2); }
.tbc-prose--opening { position: relative; }
.tbc-prose--opening::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5em; background: linear-gradient(to bottom, rgba(0, 0, 0, 0), var(--tbc-paper)); pointer-events: none; } /* 開頭在這裡斷，淡出接付費牆 */
.tbc-paywall { margin: var(--tbc-s5) 0 var(--tbc-s6); padding: var(--tbc-s5); border: 1px solid var(--tbc-gold-line); border-radius: var(--tbc-radius); background: var(--tbc-gold-bg); text-align: center; }
.tbc-paywall > h2 { margin: 0; font-size: 18px; color: var(--tbc-gold); }
.tbc-paywall > p { margin: var(--tbc-s2) 0 0; }
.tbc-paywall__free { font-weight: 700; }
.tbc-paywall__note { font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); }
/* 有 JavaScript 時 paywall.js 換成作品庫的付費牆元件（MarkuUI）：外框交給元件，顏色只經 --marku-* 變數套小說的金色框；
   站內點進還鎖著的回時先問的視窗（paywall.js 畫在 .tbc-unlock-ask 裡）用同一組 */
.tbc-paywall, .tbc-ch-head__early, .tbc-unlock-ask {
  --marku-color-primary: var(--tbc-accent);
  --marku-color-font-primary: var(--tbc-accent-ink);
  --marku-color-info: var(--tbc-gold);
  --marku-color-default-surface: var(--tbc-gold-bg);
  --marku-color-default-border: var(--tbc-gold-line);
  --marku-color-default-block: var(--tbc-surface);
  --marku-color-font-default-title: var(--tbc-gold);
  --marku-color-font-default-main: var(--tbc-ink);
  --marku-color-font-default-support: var(--tbc-ink-2);
  --marku-border-radius-card: var(--tbc-radius);
  --marku-font-size-medium: var(--tbc-fs-ui);
}
.tbc-paywall--live { padding: 0; border: 0; background: none; display: grid; justify-items: center; text-align: left; }
.tbc-paywall__mount { width: 100%; display: grid; grid-template-columns: minmax(0, 36rem); justify-content: center; } /* 元件最寬 36rem，不到就撐滿 */
.tbc-paywall__state { margin: 0; padding: var(--tbc-s5); color: var(--tbc-ink-2); text-align: center; }
/* 連到還鎖著的回的鈕與連結：前面的積木（跟 MarkuUI 的積木同一個圖、同樣粗細）跟著字的大小與顏色；按了正在問作品庫時標忙碌 */
.tbc-icon.tbc-brick { width: 1em; height: 1em; stroke-width: 2; vertical-align: -.125em; }
.tbc-ch-list__t > .tbc-brick, .tbc-nav-card__t > .tbc-brick, .tbc-resume__t > .tbc-brick { margin-right: .3em; }
[data-locked][aria-busy="true"] { cursor: progress; opacity: .6; }
/* 莫凡內心話：括號裡是「」的那種 */
.tbc-prose .tbc-inner-voice { margin: 1.4em 0; padding-left: 1em; border-left: 2px dotted var(--tbc-accent); color: var(--tbc-ink-2); font-family: var(--tbc-font-ui); font-size: max(17px, .95em); text-align: left; }
/* 聽書正在唸的段落：淡朱紅底往外擴一點，不推動版面 */
.tbc-prose .is-speaking { background: var(--tbc-accent-soft); box-shadow: 0 0 0 .35em var(--tbc-accent-soft); }
.tbc-prose .tbc-narrator.is-speaking { background: var(--tbc-gold-bg); box-shadow: 0 0 0 2px var(--tbc-accent); }
.tbc-prose .tbc-inner-voice.is-speaking { box-shadow: 0 0 0 2px var(--tbc-accent); }
.tbc-ch-end { text-align: center; color: var(--tbc-ink-3); font-size: var(--tbc-fs-small); letter-spacing: .12em; margin: var(--tbc-s6) 0 var(--tbc-s5); }

.tbc-end-tools { display: grid; grid-gap: var(--tbc-s2); }
.tbc-next-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tbc-s3); font-size: var(--tbc-fs-ui); }
@media (min-width: 600px) { .tbc-next-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tbc-nav-card { display: flex; align-items: center; gap: var(--tbc-s3); min-height: 76px; padding: var(--tbc-s3) var(--tbc-s4); border: 1px solid var(--tbc-line); border-radius: var(--tbc-radius); background: var(--tbc-raised); text-decoration: none; }
.tbc-nav-card:hover { border-color: var(--tbc-ink-3); }
.tbc-nav-card > div { flex: 1; min-width: 0; }
.tbc-nav-card__k { display: block; font-size: 12px; font-weight: 700; color: var(--tbc-ink-2); letter-spacing: .1em; }
.tbc-nav-card__t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tbc-nav-card--next { position: relative; overflow: hidden; text-align: right; background: var(--tbc-accent); border-color: var(--tbc-accent); color: var(--tbc-accent-ink) !important; }
.tbc-nav-card--next .tbc-nav-card__k { color: inherit; opacity: .85; }
/* 自動捲動與聽書讀完接下一回：倒數時下一回卡由左往右填滿（每秒一格、1 秒線性補間），填滿就換頁 */
.tbc-nav-card--next::before { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: var(--tbc-count-fill); transform-origin: left center; transform: scaleX(var(--tbc-count, 0)); pointer-events: none; }
.tbc-nav-card--next.is-counting::before { transition: transform 1s linear; }
.tbc-nav-card--next > * { position: relative; }
.tbc-nav-card--empty { visibility: hidden; }
.tbc-wip { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 76px; padding: var(--tbc-s3) var(--tbc-s4); border: 1px dashed var(--tbc-ink-3); border-radius: var(--tbc-radius); text-align: right; }
.tbc-wip__k { font-size: 12px; font-weight: 700; color: var(--tbc-ink-2); letter-spacing: .1em; }
.tbc-wip__t { font-weight: 700; }
@media (max-width: 599px) {
  .tbc-nav-card--next, .tbc-wip { order: -1; }
  .tbc-wip { text-align: left; }
  .tbc-nav-card--empty { display: none; }
}
/* 章尾「回目錄頁・檢舉這一回」：檢舉是 reader.js 放的小而淡的文字連結（打開對話框，所以是 button），字級與顏色跟回目錄頁同一級；
   排不下一行時各自換行、置中。觸控目標 44px */
.tbc-toc-link { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: var(--tbc-s2); margin: var(--tbc-s3) 0 0; font-size: var(--tbc-fs-ui); }
.tbc-toc-link a, .tbc-toc-link .tbc-report__btn { display: inline-flex; align-items: center; gap: var(--tbc-s2); min-height: 44px; color: var(--tbc-ink-2); }
.tbc-toc-link__sep { color: var(--tbc-ink-3); }
.tbc-toc-link.is-wrapped .tbc-toc-link__sep { visibility: hidden; } /* 排成兩行時不留一個掛在行尾的點 */
.tbc-toc-link .tbc-report__btn { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; }
.tbc-toc-link .tbc-report__btn > span { text-decoration: underline; }
.tbc-toc-link .tbc-report__btn:hover { color: var(--tbc-ink); }
/* 檢舉的對話框（共用的 ff-report.js，畫在 Shadow DOM 裡）跟著讀者選的底色：白、護眼黃、護眼綠、夜間；變數設在頁面的根（.tbc-page），穿過 Shadow DOM 繼承 */
.tbc-page {
  --ff-report-paper: var(--tbc-raised); --ff-report-surface: var(--tbc-surface); --ff-report-ink: var(--tbc-ink); --ff-report-ink-2: var(--tbc-ink-2);
  --ff-report-line: var(--tbc-line); --ff-report-accent: var(--tbc-accent); --ff-report-accent-ink: var(--tbc-accent-ink); --ff-report-accent-soft: var(--tbc-accent-soft);
  --ff-report-font: var(--tbc-font-ui);
}

/* 支持條（章尾，一直顯示、不浮出） */
.tbc-support { margin-top: var(--tbc-s7); padding: var(--tbc-s5); border-radius: 14px; background: var(--tbc-surface); font-size: var(--tbc-fs-ui); display: grid; gap: var(--tbc-s4); align-items: center; }
.tbc-support h2 { margin: 0 0 var(--tbc-s1); font-size: 18px; }
.tbc-support p { margin: 0; line-height: 1.7; }
.tbc-support .tbc-btn { justify-self: start; }
@media (min-width: 720px) { .tbc-support { grid-template-columns: 1fr auto; gap: var(--tbc-s6); padding: var(--tbc-s5) var(--tbc-s6); } }

/* ── 閱讀工具：手機與平板是左下的浮動工具列（左右各空 12px，不替火框的浮動鈕留位置：蓋到就蓋到，讀者自己拖開），桌機是內文右側的直列 ──
   底部浮著的東西都疊上 --ff-admob-banner-height（原生 App 的廣告條）與 --tbc-lift（首訪 Cookie 同意條在時往上讓）。 */
.tbc-dock {
  position: fixed; z-index: 30; left: 12px; right: 12px; max-width: 420px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--ff-admob-banner-height, 0px) + var(--tbc-lift, 0px));
  padding: 2px 6px 6px; overflow: hidden;
  background: var(--tbc-raised); color: var(--tbc-ink); border: 1px solid var(--tbc-line); border-radius: 16px; box-shadow: var(--tbc-float-shadow);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .22s, visibility 0s;
}
.tbc-dock.is-hidden {
  transform: translateY(calc(100% + 24px)); opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .22s, visibility 0s .22s;
}
.tbc-dock__line { position: absolute; left: 0; top: 0; height: 3px; width: 0; background: var(--tbc-accent); }
.tbc-dock__progress { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 44px; }
.tbc-dock__progress .tbc-icon-btn { color: var(--tbc-ink-2); }
.tbc-dock__txt { text-align: center; font-size: 13px; color: var(--tbc-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbc-dock__txt b { color: var(--tbc-ink); font-weight: 700; }
/* 工具幾個就分幾格（開放會員的網址多一個按讚：5 格），每格一樣寬 */
.tbc-dock__tools { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-gap: 4px; }
/* 寫成 .tbc-dock .tbc-tool：上面「.tbc-dock button { font: inherit }」的權重比單一個 class 高，寫 .tbc-tool 字級會被蓋成內文的 15px，
   「自動捲動」在 320 寬撐出按鈕 */
.tbc-dock .tbc-tool {
  display: grid; justify-items: center; align-content: center; grid-gap: 2px; min-height: 52px; padding: 4px 2px;
  border: 0; border-radius: 10px; background: var(--tbc-surface); color: var(--tbc-ink); cursor: pointer; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.tbc-tool:hover { color: var(--tbc-accent); }
.tbc-tool[aria-pressed="true"] { background: var(--tbc-accent-soft); color: var(--tbc-accent); }
html[lang="en"] .tbc-tool { white-space: normal; font-size: 11px; line-height: 1.15; text-align: center; } /* 英文的工具名比中文長，折成兩行 */
/* 按讚（reader.js 放在分享旁邊，兩條工具列都有）：按過的愛心填滿；送出中淡一點 */
[data-like][aria-pressed="true"] .tbc-icon { fill: currentColor; }
[data-like][aria-busy="true"] { opacity: .6; }
.tbc-rail { display: none; }
@media (min-width: 1024px) {
  .tbc-dock { display: none; }
  .tbc-rail {
    display: grid; grid-gap: 2px; justify-items: center; position: fixed; z-index: 30; top: 50%; right: 16px; transform: translateY(-50%);
    padding: 6px; border: 1px solid var(--tbc-line); border-radius: 14px; background: var(--tbc-raised); box-shadow: var(--tbc-shadow);
    transition: opacity .22s, visibility 0s;
  }
  /* 內文欄右側 20px；畫面不夠寬時貼齊右邊 16px（不認得 min() 的瀏覽器就一直貼右邊） */
  @supports (left: min(1px, 2px)) {
    .tbc-rail { right: auto; left: min(calc(50% + (var(--tbc-fs-body) * 40.8 + 64px) / 2 + 20px), calc(100% - 74px)); }
  }
  .tbc-rail hr { width: 24px; border: 0; border-top: 1px solid var(--tbc-line); margin: 6px 0; }
  .tbc-rail__pct { font-size: 12px; font-weight: 700; color: var(--tbc-ink-2); font-variant-numeric: tabular-nums; padding: 2px 0; }
  .tbc-rail .tbc-icon-btn { position: relative; }
  .tbc-rail .tbc-icon-btn[data-tip]:hover::after, .tbc-rail .tbc-icon-btn[data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
    white-space: nowrap; font-size: 13px; line-height: 1.5; padding: 4px 10px; border-radius: 6px; background: var(--tbc-ink); color: var(--tbc-paper); pointer-events: none;
  }
}

/* 自動捲動與聽書的控制列：同一個位置、同一種長相（深底），一次只會出現一個；在夜間會變成淺底深字，跟內文有反差 */
.tbc-modebar {
  position: fixed; z-index: 31; left: 12px; right: 12px; max-width: 420px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px) + var(--ff-admob-banner-height, 0px) + var(--tbc-lift, 0px));
  display: grid; grid-gap: 2px; padding: 8px 6px 6px;
  background: var(--tbc-ink); color: var(--tbc-paper); border-radius: 16px; box-shadow: var(--tbc-float-shadow); font-size: 12px;
}
@media (min-width: 1024px) { .tbc-modebar { left: 50%; right: auto; width: 440px; max-width: none; transform: translateX(-50%); } }
/* 排不下一行就折，不超出底色：標題與狀態字放不下時狀態字折到下一行（英文的字長），按鈕那一列也一樣 */
.tbc-modebar__label { display: flex; flex-wrap: wrap; justify-content: space-between; padding: 0 6px 2px; line-height: 1.5; }
.tbc-modebar__k { margin-right: 8px; font-weight: 700; }
.tbc-modebar__v { opacity: .78; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbc-modebar__row { display: flex; flex-wrap: wrap; align-items: center; }
.tbc-modebar__row > * + * { margin-left: 4px; }
.tbc-mb-gap { flex: 1; }
.tbc-mb-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: none; color: inherit; cursor: pointer; flex: none; }
.tbc-mb-btn:hover { background: rgba(127, 127, 127, .22); }
.tbc-mb-main { border-radius: 999px; background: var(--tbc-accent); color: var(--tbc-accent-ink); }
.tbc-mb-main:hover { background: var(--tbc-accent); filter: brightness(1.08); }
.tbc-mb-main .tbc-icon { fill: currentColor; }
.tbc-mb-main .tbc-ic-play, .tbc-mb-main.is-paused .tbc-ic-pause { display: none; }
.tbc-mb-main.is-paused .tbc-ic-play { display: block; }
.tbc-mb-speed-k { opacity: .78; }
.tbc-mb-speed { display: inline-flex; align-items: center; flex: none; border-radius: 10px; background: rgba(127, 127, 127, .2); }
.tbc-mb-speed output { min-width: 18px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.tbc-mb-rate { flex: none; min-width: 56px; height: 44px; padding: 0 8px; border: 1px solid rgba(127, 127, 127, .45); border-radius: 999px; background: none; color: inherit; font-size: 13px; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums; }
/* 回到朗讀的位置：在聽書控制列上面 12px；控制列的狀態字折到下一行變高時，reader.js 把它的高度寫進 --tbc-mode-h */
.tbc-follow {
  position: fixed; z-index: 31; left: 12px;
  bottom: calc(24px + var(--tbc-mode-h, 80px) + env(safe-area-inset-bottom, 0px) + var(--ff-admob-banner-height, 0px) + var(--tbc-lift, 0px));
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px 0 10px; border-radius: 999px;
  border: 1px solid var(--tbc-line); background: var(--tbc-raised); color: var(--tbc-ink); box-shadow: var(--tbc-shadow); cursor: pointer; font-size: 14px; font-weight: 500;
}
.tbc-follow .tbc-icon { margin-right: 6px; }
@media (min-width: 1024px) { .tbc-follow { left: 50%; transform: translateX(-50%); } }

/* 提示（回到上次讀到的地方、已複製連結、沒有中文語音、全螢幕閱讀）：在頁首下方置中，不跟底部的工具列與火框浮動鈕搶位置 */
.tbc-toast {
  position: fixed; z-index: 45; left: 50%; top: calc(68px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -8px); opacity: 0;
  display: flex; align-items: center; width: max-content; max-width: calc(100% - 24px);
  padding: 8px 14px; border-radius: 12px; background: var(--tbc-ink); color: var(--tbc-paper); box-shadow: var(--tbc-float-shadow); font-size: 14px; line-height: 1.5;
  transition: opacity .2s, transform .2s;
}
.tbc-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.tbc-toast > * + * { margin-left: 10px; }
.tbc-toast .tbc-icon { opacity: .8; }
.tbc-toast button { flex: none; min-width: 44px; min-height: 44px; margin-right: -6px; padding: 0 12px; border: 0; border-radius: 8px; background: rgba(127, 127, 127, .28); color: inherit; font-weight: 700; cursor: pointer; }

/* 全螢幕閱讀：點一下內文收起頁首與工具列（直列），頂端留一條細進度線；再點一下叫回來 */
.tbc-page--chapter .tbc-appbar { transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.is-immersive .tbc-page--chapter .tbc-appbar { transform: translateY(-100%); visibility: hidden; transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s .22s; }
.is-immersive .tbc-rail { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .22s, visibility 0s .22s; }
.tbc-topline { position: fixed; z-index: 21; left: 0; top: env(safe-area-inset-top, 0px); height: 2px; width: 0; background: var(--tbc-accent); pointer-events: none; }
.is-instant body [class*="tbc-"], .is-instant body [class*="tbc-"] *, .is-instant body [class*="tbc-"] *::before, .is-instant body [class*="tbc-"] *::after { transition: none !important; }

/* ── 閱讀設定與目錄抽屜：共用一層遮罩 ── */
.tbc-sheet-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 40; background: rgb(0 0 0 / .32); opacity: 0; transition: opacity .2s; }
.is-sheet-open .tbc-sheet-backdrop, .is-drawer-open .tbc-sheet-backdrop { opacity: 1; }
/* 閱讀設定：手機底部滑出、桌機 Aa 鈕下方小面板 */
.tbc-sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  padding: var(--tbc-s4) var(--tbc-s4) calc(var(--tbc-s5) + env(safe-area-inset-bottom, 0px));
  background: var(--tbc-raised); color: var(--tbc-ink); border-radius: 16px 16px 0 0; box-shadow: var(--tbc-shadow);
  transform: translateY(105%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); font-size: var(--tbc-fs-ui);
}
.is-sheet-open .tbc-sheet { transform: none; }
@media (min-width: 720px) {
  .tbc-sheet { left: auto; right: max(16px, calc((100vw - 1080px) / 2 + 16px)); top: 64px; bottom: auto; width: 360px; max-height: calc(100vh - 80px); border-radius: 12px; border: 1px solid var(--tbc-line); transform: translateY(-8px); opacity: 0; transition: transform .18s, opacity .18s; }
  .is-sheet-open .tbc-sheet { opacity: 1; transform: none; }
  .is-sheet-open .tbc-sheet-backdrop { background: transparent; }
}
.tbc-sheet h2 { margin: 0 0 var(--tbc-s2); font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.tbc-sheet__row { display: flex; align-items: center; justify-content: space-between; gap: var(--tbc-s3); padding: 10px 0; border-top: 1px solid var(--tbc-line); }
.tbc-sheet__row > span:first-child { flex: 0 1 auto; min-width: 0; }
.tbc-sheet__row > :not(:first-child) { flex: none; }
.tbc-sheet__hint { display: block; font-size: 12px; color: var(--tbc-ink-2); }
.tbc-sheet__note { margin: 0 0 var(--tbc-s2); font-size: 13px; line-height: 1.5; color: var(--tbc-ink-2); } /* 自動解鎖的開關下面：打開與關掉之後會怎樣 */
.tbc-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--tbc-surface); border-radius: 10px; padding: 3px; }
.tbc-seg button { min-width: 48px; height: 44px; padding: 0 6px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-family: var(--tbc-font-serif); color: var(--tbc-ink-2); white-space: nowrap; }
.tbc-seg button[data-set="size"][data-v="0"] { font-size: 14px; }
.tbc-seg button[data-set="size"][data-v="1"] { font-size: 16px; }
.tbc-seg button[data-set="size"][data-v="2"] { font-size: 18px; }
.tbc-seg button[data-set="size"][data-v="3"] { font-size: 20px; }
.tbc-seg--ui button, .tbc-seg button.tbc-seg__sans { font-family: var(--tbc-font-ui); font-size: 14px; }
.tbc-seg button.tbc-seg__serif { font-family: var(--tbc-font-serif); font-size: 16px; }
.tbc-seg button.tbc-seg__sans { font-size: 15px; }
.tbc-seg button[aria-pressed="true"] { background: var(--tbc-raised); color: var(--tbc-ink); box-shadow: 0 1px 3px rgb(0 0 0 / .15); font-weight: 700; }
/* 英文頁：選項的字比中文長，選項換到標題下面一整行、照字寬排，不擠到標題上 */
html[lang="en"] .tbc-sheet__row { flex-wrap: wrap; }
html[lang="en"] .tbc-sheet__row > .tbc-seg { flex: 1 1 100%; grid-auto-columns: auto; }
.tbc-lh { display: inline-grid; width: 18px; margin-right: 4px; vertical-align: middle; }
.tbc-lh i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
.tbc-lh--0 { grid-gap: 2px; }
.tbc-lh--1 { grid-gap: 4px; }
.tbc-lh--2 { grid-gap: 6px; }
.tbc-swatches { display: grid; grid-template-columns: repeat(4, 1fr); grid-gap: 4px; width: 232px; }
.tbc-swatches button { display: grid; justify-items: center; grid-gap: 4px; min-height: 64px; padding: 4px 0; border: 0; border-radius: 8px; background: none; cursor: pointer; font-size: 12px; color: var(--tbc-ink-2); }
.tbc-swatches button[aria-checked="true"] { color: var(--tbc-ink); font-weight: 700; }
.tbc-sw { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(127, 127, 127, .35); font-family: var(--tbc-font-serif); font-size: 13px; }
.tbc-swatches button[aria-checked="true"] .tbc-sw { box-shadow: 0 0 0 2px var(--tbc-raised), 0 0 0 4px var(--tbc-accent); }
.tbc-sw--light { background: #fcfcfb; color: #1c1d21; }
.tbc-sw--sepia { background: #f4ecdb; color: #2e261c; }
.tbc-sw--green { background: #d9e9d2; color: #1b2619; }
.tbc-sw--dark { background: #121316; color: #e4e2dd; }
/* 開關：按鈕本身 56×44（觸控目標），軌道與圓鈕畫在 ::before、::after */
.tbc-switch { position: relative; width: 56px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; flex: none; }
.tbc-switch::before { content: ""; position: absolute; left: 2px; top: 6px; width: 52px; height: 32px; border-radius: 999px; background: var(--tbc-line); transition: background-color .18s; }
.tbc-switch::after { content: ""; position: absolute; left: 5px; top: 9px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .18s; }
.tbc-switch[aria-checked="true"]::before { background: var(--tbc-accent); }
.tbc-switch[aria-checked="true"]::after { transform: translateX(20px); }
.tbc-sheet__preview { margin: var(--tbc-s2) 0 0; padding: var(--tbc-s3); border-radius: 8px; background: var(--tbc-paper); font-family: var(--tbc-font-read); font-size: var(--tbc-fs-body); line-height: var(--tbc-lh-body); color: var(--tbc-ink); }

/* 章頁的目錄抽屜：手機從底部滑出、88% 高、圓角在上；桌機從右邊滑出、420px 寬、整個高度 */
.tbc-drawer {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; height: 88vh; display: flex; flex-direction: column;
  background: var(--tbc-raised); color: var(--tbc-ink); border-radius: 16px 16px 0 0; box-shadow: var(--tbc-shadow); font-size: var(--tbc-fs-ui);
  transform: translateY(105%); transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.is-drawer-open .tbc-drawer { transform: none; }
@media (min-width: 1024px) {
  .tbc-drawer { left: auto; top: 0; height: auto; width: 420px; border-radius: 0; border-left: 1px solid var(--tbc-line); transform: translateX(105%); }
}
.tbc-drawer__head { display: flex; align-items: center; gap: var(--tbc-s3); padding: var(--tbc-s4) var(--tbc-s3) var(--tbc-s3) var(--tbc-s4); border-bottom: 1px solid var(--tbc-line); }
.tbc-drawer__head > div { flex: 1; min-width: 0; }
.tbc-drawer__head h2 { margin: 0; font-size: 18px; }
.tbc-drawer__head p { margin: 2px 0 0; font-size: var(--tbc-fs-small); color: var(--tbc-ink-2); }
.tbc-drawer .tbc-jump { padding: var(--tbc-s3) var(--tbc-s4); border-bottom: 1px solid var(--tbc-line); }
.tbc-drawer__body { flex: 1; overflow-y: auto; padding: 0 var(--tbc-s4); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.tbc-drawer__body .tbc-vol:first-child { border-top: 0; }
.tbc-drawer__foot { padding: var(--tbc-s3) var(--tbc-s4) calc(var(--tbc-s3) + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--tbc-line); text-align: center; }
.tbc-drawer__foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--tbc-ink-2); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  body [class*="tbc-"], body [class*="tbc-"] *, body [class*="tbc-"] *::before, body [class*="tbc-"] *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
