/* ============================================================================
   css/v2-dictation.css — 默書房 V2 全屏 Bento 視圖（PR-V2-04）
   #view-dictation 由 ViewRouter 以 .open 切換（同 #view-learn 模式）；
   入面嘅默書引擎 DOM（#modal-dictation 內部 id 沿用）以白卡 Bento 重新呈現，
   唔再用 .modal-backdrop 彈窗外殼。
   ============================================================================ */
#view-dictation {
  display: none;
  position: absolute; inset: 0; z-index: 30;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg-canvas);
}
#view-dictation.open { display: block; }
body[data-route="dictation"] #today-deck { display: none; }

.dict-view-inner {
  display: flex; flex-direction: column;
  max-width: 880px; margin: 0 auto; min-height: 100%;
  padding: 118px 14px 250px;
}
@media (min-width: 1024px) {
  .dict-view-inner { padding: 84px 24px 32px; }
}
@media (max-width: 1023px) {
  /* 同 learn／leaderboard 路由一致：舊 V1 HUD 退場，唔好夾住新視圖 */
  body[data-route="dictation"] #hud-top,
  body[data-route="dictation"] #hud-bottom { display: none; }
  /* PR-UI-Polish 三.2：底部統一預留俾底部導覽列（84px＋安全區） */
  body[data-route="dictation"] .dict-view-inner { padding: 20px 14px calc(84px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- PR-UI-Polish 二.3：視圖內按鈕統一 V2 扁平膠囊 ----------
   舊版暖米黃立體掣（.btn-warm 暖黃漸變／.btn-kraft 牛皮紙影）喺默書房入面
   一律改行 Bento 扁平風：主掣品牌綠、次掣白卡；返回掣（練習／詞卡畫面）同款白膠囊 */
.dict-view-root .btn-warm {
  background: var(--brand-emerald);
  border: 1px solid var(--brand-emerald-dark);
  border-radius: 9999px;
  box-shadow: 0 3px 0 var(--brand-emerald-dark);
  color: #fff;
}
.dict-view-root .btn-warm:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-emerald-dark); }
.dict-view-root .btn-kraft,
.dict-view-root .btn-back-paper,
.dict-view-root .btn-mini-paper {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: 9999px;
  box-shadow: var(--shadow-bento);
  color: var(--text-primary);
}
.dict-view-root .btn-kraft:active,
.dict-view-root .btn-back-paper:active,
.dict-view-root .btn-mini-paper:active { background: var(--brand-mint-soft); }
/* PR-FIX-DictSync 根源補底：.btn-mini-paper 過往冇任何尺寸定義（零 padding、
   預設字體），所有用佢嘅掣都縮成 21–22px 細片；補返基本掣形 */
.dict-view-root .btn-mini-paper {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 800;
  cursor: pointer; white-space: nowrap; line-height: 1.2;
}

/* ---------- 視圖根與卡片骨架 ---------- */
.dict-view-root { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dict-view-card { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 12px; }
.dict-view-root .modal-brass-pins { display: none; }
.dict-view-root .modal-header {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 14px 18px;
}
.dict-view-root .modal-header h2 { color: var(--text-primary); }
.dict-view-root .modal-subtitle { color: var(--text-secondary); }

/* 全屏練習模式（沿用引擎嘅 dict-fs-* 切換，喺視圖入面貼滿可用高度） */
.dict-view-root.dict-fs-backdrop .dict-view-card { min-height: 0; }
.dict-view-root .dict-fs-shell { min-height: 0; }

/* ---------- 設定區（書架／匯入／聲線）白卡化 ---------- */
.dict-view-root .workshop-balance {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 14px 18px;
}
.dict-view-root .parent-panel-box {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 18px;
}
.dict-view-root .hub-tabs { gap: 8px; }
.dict-view-root .hub-tab {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: 9999px;
  color: var(--text-secondary);
  box-shadow: var(--shadow-bento);
}
.dict-view-root .hub-tab.active {
  background: var(--brand-emerald);
  border-color: var(--brand-emerald);
  color: #fff;
}

/* 書架篩選掣：啟用態改用品牌綠 */
.dict-view-root .dict-filter-btn.active {
  background: var(--brand-emerald);
  border-color: var(--brand-emerald-dark);
  color: #fff;
}

/* 書架卡片 */
.dict-view-root .voucher-shop-card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-bento);
  padding: 14px 16px;
}
.dict-view-root .dict-book-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- 練習區面板白卡化（保留功能色作細節） ---------- */
.dict-view-root .dict-stroke-panel,
.dict-view-root .pass-stage-card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
}
.dict-view-root .dict-notebook-box {
  background: var(--surface-subtle);
  border: 2px dashed var(--border-soft);
  border-radius: var(--radius-card);
}
.dict-view-root .dict-strip-bar {
  background: var(--surface-subtle);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
}

/* ---------- 詞卡瀏覽（考前字典溫習） ---------- */
/* PR-FIX-DictSync 複審（IVAN 2026-12-06）：書頭改分層排版——頂列輕量扁平
   返回掣、中列全寬書名＋副標、底列全寬立體翡翠主掣，主次分明，唔再三欄硬夾 */
.dict-book-head {
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 14px 18px;
}
.dict-book-head-top { display: flex; align-items: center; }
/* 頂列返回掣：輕量扁平（白底＋1px 細邊＋高 34px），刻意去掉 3D 厚底唇，唔同書名搶位 */
.dict-book-back-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 34px; padding: 0 14px;
  font: inherit; font-size: 13.5px; font-weight: 800; line-height: 1;
  color: var(--text-secondary); background: #FFFFFF;
  border: 1px solid var(--border-soft); border-radius: 9999px;
  box-shadow: none; cursor: pointer; white-space: nowrap;
  transition: background 0.13s ease;
}
.dict-book-back-btn:active { background: var(--brand-mint-soft); }
.dict-book-head h3 { font-size: 20px; font-weight: 900; color: var(--text-primary); line-height: 1.35; margin: 0; }
.dict-book-head-actions { display: flex; }
.dict-book-head-actions .v2-btn-primary { width: 100%; }
@media (min-width: 820px) {
  .dict-book-head-actions { justify-content: flex-end; }
  .dict-book-head-actions .v2-btn-primary { width: auto; min-width: 240px; }
}
.dict-book-meta { font-size: 13px; color: var(--text-secondary); line-height: 1.55; padding: 0; margin: 0; }
.dict-book-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.dict-word-card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-bento);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.dict-word-card .dict-entry-box { margin: 0; }
/* PR-FIX-DictSync：目前詞高亮（與詞卡單一真相）＋「目前詞卡」徽章 */
.dict-book-cards .dict-word-card { cursor: pointer; }
.dict-word-card.is-current {
  border-color: var(--brand-emerald);
  box-shadow: 0 0 0 2px rgba(11, 138, 106, 0.35), var(--shadow-bento);
  background: #F4FBF8;
}
.dict-word-current-badge {
  flex-shrink: 0;
  font-size: 11.5px; font-weight: 900; color: #FFFFFF;
  background: var(--brand-emerald); border-radius: 9999px; padding: 3px 10px;
  white-space: nowrap;
}
/* 詞頭右側工具組：「目前詞卡」徽章與「筆順」掣並排，唔再佔卡底一行 */
.dict-word-card-tools {
  margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
/* PR-FIX-DictSync 複審（IVAN 2026-12-06）：「筆順」掣改輕巧扁平膠囊並移上
   詞頭右側——薄荷軟底＋1px 翡翠邊、高 32px、去 3D 厚底唇，條目卡更緊湊 */
.dict-stroke-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 32px; padding: 5px 12px;
  font: inherit; font-size: 13px; font-weight: 800; line-height: 1;
  color: var(--brand-emerald-dark); background: #E8F7F2;
  border: 1px solid rgba(11, 138, 106, 0.38); border-radius: 9999px;
  box-shadow: none;
  cursor: pointer; white-space: nowrap;
  transition: background 0.13s ease, transform 0.13s ease;
}
.dict-stroke-chip:active { transform: translateY(1px); background: #D8F0E6; }
.dict-stroke-chip .v2-ico { flex-shrink: 0; }
.dict-word-nodata { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.dict-book-passage {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 20px;
  font-size: 17px; line-height: 1.9; color: var(--text-primary);
  white-space: pre-wrap;
}
.dict-book-stroke-wrap {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-bento);
  padding: 14px;
}
.dict-credit-note {
  font-size: 11.5px; color: var(--text-secondary); line-height: 1.6; text-align: center;
  padding: 0 8px;
}
.dict-credit-note a { color: var(--brand-emerald-dark); }

/* ---------- 詞卡內容排版（PR-V2-04） ---------- */
.dict-word-card-head { display: flex; align-items: center; gap: 8px; }
.dict-word-card-word { font-size: 22px; font-weight: 900; color: var(--text-primary); letter-spacing: 1px; }
.dict-word-readings { font-size: 13px; font-weight: 700; color: var(--brand-emerald-dark); }
.dict-word-pos {
  display: inline-block; align-self: flex-start;
  font-size: 11.5px; font-weight: 800; color: var(--text-secondary);
  background: var(--surface-subtle); border: 1px solid var(--border-soft);
  border-radius: 9999px; padding: 2px 9px;
}
.dict-word-sense { font-size: 14px; line-height: 1.6; color: var(--text-primary); }
.dict-word-example { font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.dict-word-example-tr { display: block; font-size: 12.5px; }
.dict-book-stroke-wrap .dict-stroke-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dict-stroke-title { font-weight: 900; color: var(--text-primary); font-size: 14.5px; }
.dict-book-stroke-wrap .dict-stroke-box { display: flex; justify-content: center; }
.dict-book-stroke-wrap .dict-stroke-chars { margin-bottom: 10px; }
.dict-stroke-btns { display: flex; justify-content: center; margin-top: 10px; }

/* ============================================================================
   PR-UI-V2-Finish：默書房收官——書卡雙掣、工具列膠囊、田字格／選字／詞義去米黃、
   表單 V2 化、語速翡翠滑桿＋預設高亮、判題列安全間距
   ============================================================================ */
/* 書卡：上資料／下雙掣（白膠囊睇詞卡＋翡翠開始默書） */
.dict-view-root .dict-book-card { flex-direction: column; align-items: stretch; gap: 10px; }
.dict-view-root .dict-book-btns { display: flex; gap: 8px; }
.dict-view-root .dict-book-btns > button { flex: 1; white-space: nowrap; }

/* 白膠囊迷你掣（揭曉／偷睇／睇詞卡共用）＋工具列迷你掣全面去牛皮紙 */
.dict-view-root .dict-ghost-btn,
.dict-view-root .hw-mini-btn {
  background: #FFFFFF; border: 1.5px solid var(--border-soft); color: var(--text-primary);
  border-radius: 9999px; box-shadow: none;
}
/* 重聽：翡翠膠囊＋反白圖示 */
.dict-view-root .dict-repeat-btn {
  background: var(--brand-emerald); border: 1px solid var(--brand-emerald); color: #FFFFFF;
  border-radius: 9999px; box-shadow: none; padding: 7px 13px;
}
.dict-view-root .dict-repeat-btn .v2-ico { filter: brightness(0) invert(1); }
/* 正確答案丸：薄荷柔框 */
.dict-view-root .dict-answer-pill {
  background: var(--brand-mint-soft); border: 1.5px solid var(--border-soft); color: var(--brand-emerald-dark);
}
/* 田字格／選字方格：純白＋冷灰框，選中翡翠 */
.dict-view-root .dict-stroke-grid-box {
  border-color: var(--border-soft); background:
    linear-gradient(to right, transparent calc(50% - 1px), #E2E8F0 calc(50% - 1px), #E2E8F0 calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), #E2E8F0 calc(50% - 1px), #E2E8F0 calc(50% + 1px), transparent calc(50% + 1px)),
    #FFFFFF;
}
.dict-view-root .dict-stroke-tile { background: #FFFFFF; border-color: var(--border-soft); color: var(--text-primary); }
.dict-view-root .dict-stroke-tile.active {
  border-color: var(--brand-emerald); background: var(--brand-mint-soft);
  box-shadow: 0 0 0 2px rgba(11, 138, 106, 0.25);
}
/* 詞義解釋卡（實際 DOM 係 .dict-entry-box）：冷白底＋冷灰框＋深石板字（W3 定案；
   舊 .dict-word-info-box 死規則已刪除——渲染器由頭到尾都冇出過呢個 class） */
.dict-view-root .dict-entry-box {
  background: #FFFFFF; border: 1.5px solid var(--border-soft); color: var(--text-primary);
}
/* 判題列同底部導覽拉開安全距離 */
.dict-view-root .dict-fs-judge-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); margin-top: 8px; }
/* 表單 V2 化：白底、12px 圓角、翡翠 focus；引擎選中卡翡翠描邊薄荷底 */
.dict-view-root .paper-select,
.dict-view-root .paper-field input,
.dict-view-root .exam-textarea {
  border: 1.5px solid var(--border-soft); border-radius: 12px; background: #FFFFFF;
}
.dict-view-root .paper-select:focus,
.dict-view-root .paper-field input:focus,
.dict-view-root .exam-textarea:focus { outline: 2px solid var(--brand-emerald); outline-offset: 1px; }
.dict-view-root .engine-pick-btn {
  background: #FFFFFF; border: 1.5px solid var(--border-soft); box-shadow: none; border-radius: 14px;
}
.dict-view-root .engine-pick-btn.active {
  background: var(--brand-mint-soft); border-color: var(--brand-emerald); box-shadow: none;
}
/* 語速滑桿翡翠＋預設掣高亮目前值 */
.dict-view-root #dict-rate-slider { accent-color: var(--brand-emerald); }
.dict-view-root .dict-rate-preset.is-active {
  background: var(--brand-emerald); border-color: var(--brand-emerald); color: #FFFFFF; box-shadow: none;
}
/* 默書房內 btn-kraft 一律白膠囊（匯入／示範／重默等） */
.dict-view-root .btn-kraft {
  background: #FFFFFF; border: 1px solid var(--border-soft); color: var(--text-primary);
  border-radius: 9999px; box-shadow: none;
}

/* ============================================================================
   PR-V2-W3-Dictation：默書房整頁封板
   §15/§16 4 分頁丸＋iPad 雙欄 Bento＋教材級詞語卡（可點字粒＋原地筆順條）
   §17 默書進行全高佈局（主角卡＋錨底判題列）＋ §18 冷白詞義卡
   ============================================================================ */

/* ---------- 分頁列 ---------- */
.dict-tab-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.dict-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.dict-pill {
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: 9999px; color: var(--text-secondary);
  box-shadow: var(--shadow-bento);
  font-size: 14px; font-weight: 900; padding: 8px 16px; cursor: pointer;
}
.dict-pill.active {
  background: var(--brand-emerald); border-color: var(--brand-emerald); color: #fff;
}
.dict-import-jump { white-space: nowrap; padding: 10px 18px; font-size: 14px; }

/* ---------- 雙欄網格 ---------- */
.dict-w3-grid { display: block; }
.dict-w3-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (min-width: 820px) {
  .dict-w3-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
    gap: 20px; align-items: stretch;
  }
}

/* ---------- 右欄：三合一匯入卡 ---------- */
.dict-rail-card {
  position: relative;
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-card); box-shadow: var(--shadow-bento);
  padding: 18px; margin-top: 12px;
}
@media (min-width: 820px) { .dict-rail-card { margin-top: 0; } }
@media (max-width: 819px) {
  .dict-rail-card { display: none; }
  .dict-rail-card.expanded { display: block; }
}
.dict-rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dict-rail-head h3 { font-size: 16.5px; font-weight: 900; color: var(--text-primary); margin: 0; padding-right: 56px; }
.dict-rail-cat {
  position: absolute; top: -14px; right: 10px; width: 74px; height: 74px;
  object-fit: contain; pointer-events: none;
}
.dict-rail-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.dict-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 118px; padding: 14px 6px; border-radius: 18px; cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 16px rgba(15, 28, 38, 0.10), inset 0 1px 0 rgba(255,255,255,0.7);
  font-size: 15px; font-weight: 900; color: #22303E;
  transition: transform 0.12s ease;
}
.dict-tile:active { transform: scale(0.97); }
.dict-tile-camera { background: linear-gradient(160deg, #FDE8D7 0%, #F9C6C0 55%, #EFB9D8 100%); }
.dict-tile-gallery { background: linear-gradient(160deg, #DFF7EC 0%, #BDEEDD 55%, #A8DFF0 100%); }
.dict-tile-pdf { background: linear-gradient(160deg, #E8F1FC 0%, #C9DDF5 55%, #D8DEE9 100%); }
.dict-rail-offline {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 14px;
  font-size: 13px; font-weight: 700; color: var(--text-primary); line-height: 1.5; cursor: pointer;
}
.dict-rail-offline input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--brand-emerald); flex-shrink: 0; }
.dict-rail-note { font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-top: 8px; }

/* ---------- 詞語卡（教材級大卡） ---------- */
.dict-w3-card {
  flex-direction: column; gap: 10px;
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-card); box-shadow: var(--shadow-bento);
  padding: 18px; margin-bottom: 12px;
}
.dict-w3-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.dict-w3-card-kicker { font-size: 15px; font-weight: 900; color: var(--text-primary); }
.dict-w3-card-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dict-card-book-sel { max-width: 210px; padding: 6px 10px; font-size: 13px; }
.dict-card-pos { font-size: 12.5px; font-weight: 800; color: var(--text-secondary); white-space: nowrap; }
.dict-w3-word { display: flex; gap: 4px; flex-wrap: wrap; align-items: flex-end; margin-top: 2px; }
.dict-char-chip {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 40px; font-weight: 900; line-height: 1.15; color: var(--text-primary);
  background: transparent; border: none; border-bottom: 3px solid transparent;
  padding: 0 3px; cursor: pointer; border-radius: 8px;
}
.dict-char-chip.active { color: var(--brand-emerald-dark); border-bottom-color: var(--brand-emerald); background: var(--brand-mint-soft); }
.dict-char-chip.dict-char-word { cursor: default; letter-spacing: 1px; }
@media (min-width: 820px) { .dict-char-chip { font-size: 56px; } }
.dict-w3-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dict-w3-jyut { font-size: 16px; font-weight: 800; color: var(--brand-emerald-dark); letter-spacing: 0.4px; }
.dict-pos-pill {
  display: inline-block; font-size: 12px; font-weight: 900; color: var(--text-secondary);
  background: var(--surface-subtle); border: 1px solid var(--border-soft);
  border-radius: 9999px; padding: 3px 11px;
}
.dict-speak-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; font-size: 14px; }
.dict-speak-btn .v2-ico { filter: brightness(0) invert(1); }
.dict-w3-def { font-size: 15.5px; line-height: 1.7; color: var(--text-primary); margin: 0; }
.dict-w3-ex { font-size: 14px; line-height: 1.7; color: var(--text-secondary); margin: 0; }
.dict-w3-strip-zone { border-top: 1px solid var(--border-soft); padding-top: 10px; }
.dict-w3-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.dict-w3-strip-label { font-size: 13px; font-weight: 900; color: var(--text-primary); }
.dict-w3-strip-tools { display: inline-flex; align-items: center; gap: 10px; }
.dict-edb-link { font-size: 12.5px; font-weight: 800; color: var(--brand-emerald-dark); text-decoration: none; white-space: nowrap; }
.dict-w3-strip { overflow-x: auto; padding-bottom: 4px; }
.dict-strip-loading { font-size: 13px; color: var(--text-secondary); font-weight: 700; }
.dict-w3-strip-stage { justify-content: center; }
.dict-w3-strip-stage > div, .dict-w3-strip-stage svg { margin: 0 auto; }
.dict-w3-card-foot { display: flex; justify-content: flex-end; }
.dict-start-btn { display: inline-flex; align-items: center; gap: 7px; padding: 13px 24px; font-size: 16px; }
.dict-start-btn .v2-ico { filter: brightness(0) invert(1); }

/* StrokeKit 漸進筆順條（格仔） */
.sk-strip { display: flex; gap: 6px; flex-wrap: nowrap; }
.sk-strip-cell {
  flex-shrink: 0; border: 1.5px solid #D8DEE7; border-radius: 8px; overflow: hidden;
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    #FFFFFF;
}
.sk-strip-cell svg { display: block; }

/* ---------- 錯字庫 ---------- */
.dict-mistakes-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; color: var(--text-primary); }
.dict-mistake-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: 14px; box-shadow: var(--shadow-bento); padding: 11px 15px; margin-bottom: 8px;
}
.dict-mistake-word { font-size: 17px; font-weight: 900; color: var(--text-primary); letter-spacing: 1px; }
.dict-mistake-meta { font-size: 12.5px; font-weight: 800; color: var(--text-secondary); white-space: nowrap; }

/* ---------- §17 默書進行：全高佈局 ---------- */
.dict-view-root .dict-fs-shell { overflow: visible; }
.dict-view-root #dict-play-view {
  min-height: min(680px, calc(100dvh - 140px));
  flex-direction: column; justify-content: space-between; gap: 10px;
  width: 100%;
}
@media (min-width: 820px) {
  .dict-view-root #dict-play-view { max-width: 760px; margin: 0 auto; }
}
.dict-view-root .dict-fs-topbar {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap;
}
.dict-prog-wrap { flex: 1; min-width: 130px; }
.dict-prog-label { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 900; color: var(--text-secondary); margin-bottom: 4px; }
.dict-prog-track { height: 12px; border-radius: 999px; background: #E6EBEF; overflow: hidden; }
.dict-prog-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #10B981, #0B8A6A);
  border-radius: 999px; transition: width 0.35s ease;
}
.dict-top-capsules { display: flex; gap: 6px; align-items: center; }
.dict-cap {
  font-size: 12px; font-weight: 900; color: var(--brand-emerald-dark);
  background: var(--brand-mint-soft); border: 1px solid var(--border-soft);
  border-radius: 9999px; padding: 5px 11px; white-space: nowrap;
}
.dict-hero {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  background: var(--surface-card); border: 1px solid var(--border-soft);
  border-radius: var(--radius-card); box-shadow: var(--shadow-bento);
  padding: 20px 18px; min-height: 0;
}
.dict-hero-pre { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.dict-hero-cat img { width: 104px; height: 104px; object-fit: contain; }
.dict-hero-status { font-size: 19px; font-weight: 900; color: var(--text-primary); line-height: 1.5; }
.dict-replay-big {
  display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, #12A97F, #0B8A6A); color: #fff;
  border: 1px solid var(--brand-emerald-dark); border-radius: 9999px;
  box-shadow: 0 4px 0 var(--brand-emerald-dark);
  font-size: 17px; font-weight: 900; padding: 14px 30px; cursor: pointer;
}
.dict-replay-big:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--brand-emerald-dark); }
.dict-replay-big .v2-ico { filter: brightness(0) invert(1); }
.dict-pause-zone { width: min(340px, 86%); display: flex; align-items: center; gap: 9px; }
.dict-pause-track { flex: 1; height: 9px; border-radius: 999px; background: #E6EBEF; overflow: hidden; }
.dict-pause-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #7ED3B2, #0B8A6A); border-radius: 999px; }
.dict-pause-label { font-size: 12.5px; font-weight: 900; color: var(--text-secondary); white-space: nowrap; }
.dict-hero-rev { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px; }
.dict-rev-word { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.dict-rev-char {
  font-family: "Noto Serif TC", "Songti TC", serif;
  font-size: 54px; font-weight: 900; line-height: 1.15; color: var(--text-primary);
  background: transparent; border: none; border-bottom: 3px solid transparent;
  padding: 0 3px; cursor: pointer; border-radius: 8px;
}
.dict-rev-char.active { color: var(--brand-emerald-dark); border-bottom-color: var(--brand-emerald); background: var(--brand-mint-soft); }
.dict-rev-char.dict-char-word { cursor: default; }
@media (min-width: 820px) { .dict-rev-char { font-size: 60px; } }
.dict-rev-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: center; }
.dict-rev-jyut { font-size: 15.5px; font-weight: 800; color: var(--brand-emerald-dark); }
.dict-rev-def { font-size: 14.5px; line-height: 1.65; color: var(--text-primary); margin: 0; max-width: 560px; }
.dict-rev-strip { overflow-x: auto; max-width: 100%; padding-bottom: 2px; }
.dict-rev-strip-note { font-size: 12px; color: var(--text-secondary); font-weight: 700; margin: 0; }
.dict-legacy-zone { display: none !important; }
.dict-view-root .dict-fs-judge-bar { display: flex; gap: 10px; flex-shrink: 0; margin-top: 0; }
.dict-reveal-main {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px; font-size: 17px;
}
.dict-reveal-main .v2-ico { filter: brightness(0) invert(1); }
.dict-mark-wrong {
  flex: 1; padding: 14px 10px; font-size: 15.5px; font-weight: 900; cursor: pointer;
  background: #FFF5F2; color: #B3402A; border: 1.5px solid #F0B8A6; border-radius: 9999px;
  box-shadow: 0 3px 0 #E3A08C;
}
.dict-mark-wrong:active { transform: translateY(2px); box-shadow: 0 1px 0 #E3A08C; }
.dict-mark-right {
  flex: 1.35; display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 10px; font-size: 15.5px;
}

/* ---------- 結算／匯入提示（去行內啡色後嘅 class 版） ---------- */
.dict-sum-heading { font-size: 19px; font-weight: 900; color: var(--text-primary); }
.dict-sum-detail { font-size: 13.5px; color: var(--text-secondary); margin: 6px 0 12px; font-weight: 700; }
.dict-import-hint { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.45; }

/* ============================================================================
   PR-V2-W5：Wave 3 遺留 P2 ×2 ＋ 筆順大字田字格框（IVAN 真機加單）
   ============================================================================ */

/* P2 #1：iPad 右欄紳士貓向下移 6px＋右欄卡頂加 12px 間距，同上方
   「+ 影相 / 圖片 / PDF」綠掣留乾淨距離（實測貓頂與掣底零重疊） */
@media (min-width: 820px) {
  .dict-rail-cat { top: -8px; }
  .dict-rail-card { margin-top: 12px; }
}

/* P2 #2：手機詞語卡頭兩行制——詞庫 <select> 獨佔第一行（全寬），
   ‹ 上一詞  1 / 10  下一詞 › 齊整排第二行，唔再孤獨折行 */
@media (max-width: 819px) {
  .dict-w3-card-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .dict-w3-card-nav { width: 100%; }
  .dict-card-book-sel { flex: 1 1 100%; max-width: none; order: -1; }
  .dict-w3-card-nav .hw-mini-btn { flex: 1; }
  .dict-card-pos { flex: 0 0 auto; text-align: center; min-width: 44px; }
}

/* 大字筆順播放舞台：圓角田字格框（十字中線＋圓角冷灰框），
   大字唔再赤裸浮喺白底——詞卡「播一次」舞台＋書本筆順盒共用同一框語言 */
.dict-w3-strip-stage {
  width: fit-content; max-width: 100%; margin: 6px auto 2px;
  padding: 10px; border: 1.5px solid #D8DEE7; border-radius: 14px;
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px -6px rgba(15, 23, 42, 0.12);
}
.dict-book-stroke-wrap .dict-stroke-box {
  width: fit-content; max-width: 100%; margin: 0 auto;
  padding: 10px; border: 1.5px solid #D8DEE7; border-radius: 14px;
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px -6px rgba(15, 23, 42, 0.12);
}

/* ---------- W5 加單 #2：揭曉區直接筆順播放＋場內膠囊可調 ---------- */
.dict-rev-demo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dict-rev-stage {
  width: fit-content; max-width: 100%;
  padding: 10px; border: 1.5px solid #D8DEE7; border-radius: 14px;
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), #E2E8F0 calc(50% - 0.5px), #E2E8F0 calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 10px -6px rgba(15, 23, 42, 0.12);
}
.dict-rev-stage svg { display: block; margin: 0 auto; }
.dict-cap-btn {
  font: inherit; font-size: 12px; font-weight: 900; cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.dict-cap-btn:active { transform: scale(0.94); background: #CFEFE3; }

/* ---------- V2 自訂選單（PR-FIX-VoicePicker） ----------
   原生 <select> 彈出清單由 OS 渲染（Android 深色彈窗），同 V2 淺色界面撞色；
   改用白卡自訂選單：白底、深字、翡翠選中態，同全 App 選取元件一致。 */
.dict-view-root .v2-select { position: relative; }
.dict-view-root .v2-select-native {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0;
}
.dict-view-root .v2-select-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 44px; padding: 10px 14px;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--text-primary); text-align: left;
  background: #FFFFFF; border: 1.5px solid var(--border-soft); border-radius: 12px;
  cursor: pointer;
}
.dict-view-root .v2-select-btn:focus-visible { outline: 2px solid var(--brand-emerald); outline-offset: 1px; }
.dict-view-root .v2-select-chevron { color: var(--text-secondary); font-size: 13px; flex-shrink: 0; transition: transform 0.15s ease; }
.dict-view-root .v2-select.is-open .v2-select-chevron { transform: rotate(180deg); }
.dict-view-root .v2-select-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 90;
  background: #FFFFFF; border: 1.5px solid var(--border-soft); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 40, 32, 0.18); padding: 6px;
  max-height: 264px; overflow-y: auto;
}
.dict-view-root .v2-select.is-open .v2-select-menu { display: block; }
.dict-view-root .v2-select.open-up .v2-select-menu { top: auto; bottom: calc(100% + 6px); }
.dict-view-root .v2-select-opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; font: inherit; font-size: 14.5px; font-weight: 600;
  color: var(--text-primary); text-align: left; background: transparent; border: 0; border-radius: 10px; cursor: pointer;
}
.dict-view-root .v2-select-opt::before {
  content: ''; flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #CBD5E1; background: #FFFFFF; box-sizing: border-box;
}
.dict-view-root .v2-select-opt.is-selected { background: var(--brand-mint-soft); font-weight: 800; }
.dict-view-root .v2-select-opt.is-selected::before {
  border-color: var(--brand-emerald);
  background: radial-gradient(circle, var(--brand-emerald) 0 5px, #FFFFFF 6px);
}

/* ============================================================================
   PR-A（pr-v2-responsive-bento-polish）— A-3 默書房主從分欄 + A-4 語音 2 欄
   分頁顯示改用 .dict-pane-off class（取代 inline display），令 ≥1024 的
   display:contents 主從佈局可行；<1024 行為與舊版完全一致。
   ============================================================================ */
.dict-pane-off { display: none !important; }

/* 課文舞台（≥1024 課文分頁右欄；<1024 保持隱藏，沿用書卡掣流程） */
.dict-passage-title { font-size: 20px; font-weight: 900; color: var(--text-primary); margin: 2px 0 6px; }
.dict-passage-meta { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin: 0 0 10px; }
.dict-passage-body { font-size: 15px; line-height: 1.9; color: var(--text-primary); white-space: pre-wrap; margin-bottom: 14px; }

@media (min-width: 1024px) {
  /* 高度鎖定：默書房不再整頁捲動，各子畫面／區域各自內部捲動 */
  #view-dictation { overflow-y: hidden; }
  #view-dictation .dict-view-inner { height: 100%; min-height: 0; }
  #dict-setup-view { flex: 1 1 auto; min-height: 0; flex-direction: column; }
  #dict-book-view, #dict-passage-view, #dict-review-view, #dict-summary-view { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  #dict-play-view { flex: 1 1 auto; min-height: 0; }

  /* 主從分欄：左 37% 書單（獨立捲動）／右 63% 舞台（上）＋匯入列（下） */
  .dict-w3-grid {
    grid-template-columns: minmax(0, 37fr) minmax(0, 63fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px 20px; flex: 1 1 auto; min-height: 0;
  }
  .dict-w3-main { display: contents; }
  #dict-tab-books { display: contents; }
  #dict-books-list { grid-column: 1; grid-row: 1 / -1; overflow-y: auto; min-height: 0; padding-right: 6px; }
  .dict-filter-bar { position: sticky; top: 0; z-index: 3; background: var(--bg-canvas); padding: 2px 0 8px; }
  #dict-w3-cardpanel { grid-column: 2; grid-row: 1; overflow-y: auto; min-height: 0; margin-bottom: 0; }
  #dict-w3-passage-stage { grid-column: 2; grid-row: 1; overflow-y: auto; min-height: 0; margin-bottom: 0; }
  #dict-import-rail { grid-column: 2; grid-row: 2; margin-top: 0; }
  #dict-tab-import { grid-column: 2; grid-row: 1 / -1; overflow-y: auto; min-height: 0; }
  .dict-w3-grid[data-tab="custom"] #dict-import-rail,
  .dict-w3-grid[data-tab="voice"] #dict-import-rail { display: none; }

  /* A-4：聲線與節奏 — 全幅 2 欄 Bento，三格齊底（第三格跨欄） */
  #dict-tab-voice { grid-column: 1 / -1; grid-row: 1 / -1; overflow-y: auto; min-height: 0; }
  .dict-w3-grid[data-tab="voice"] #dict-tab-voice {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch;
  }
  .dict-w3-grid[data-tab="voice"] #dict-tab-voice > .parent-panel-box { margin-bottom: 0; }
  .dict-w3-grid[data-tab="voice"] #dict-tab-voice > .parent-panel-box:last-child { grid-column: 1 / -1; }

  /* 舞台詞卡收緊（≥1024）：大字 56→44、間距收窄，令詞卡＋筆順條＋開始掣一屏全見 */
  #dict-w3-cardpanel { gap: 4px; padding: 12px 16px; }
  #dict-w3-cardpanel .dict-char-chip { font-size: 40px; }
  #dict-w3-cardpanel .dict-speak-btn { padding: 6px 14px; }
  #dict-w3-cardpanel .dict-w3-def { font-size: 14.5px; line-height: 1.5; }
  #dict-w3-cardpanel .dict-w3-ex { line-height: 1.5; }
  #dict-w3-cardpanel .dict-w3-strip-zone { padding-top: 6px; }
  #dict-w3-cardpanel .dict-w3-strip-head { margin-bottom: 4px; }
  #dict-w3-cardpanel .dict-w3-strip .sk-strip-cell svg { width: 36px; height: 36px; }
  #dict-w3-cardpanel .dict-start-btn { padding: 8px 22px; }
  .dict-view-root .workshop-balance { margin-bottom: 8px; padding: 10px 16px; }
  .dict-tab-row { margin-bottom: 8px; }

  /* 左欄精簡書卡：小標籤＋書名＋詞數行；選中薄荷高亮；成卡可撳（JS 接線） */
  .dict-view-root .dict-book-card { padding: 10px 12px; gap: 6px; cursor: pointer; }
  .dict-view-root .dict-book-card .voucher-shop-title { font-size: 15px; }
  .dict-view-root .dict-book-card .voucher-shop-desc { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dict-view-root .dict-book-btns > button { padding-top: 5px; padding-bottom: 5px; font-size: 12.5px; min-height: 32px; }
  .dict-view-root .dict-book-card.is-selected {
    border-color: var(--brand-emerald); background: var(--brand-mint-soft);
    box-shadow: 0 0 0 1.5px var(--brand-emerald) inset, var(--shadow-bento);
  }

  /* 匯入列：壓成單行 — 左小標題＋中三入口橫排＋右離線標籤（長條全幅掣取消） */
  #dict-import-rail { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 16px; }
  .dict-rail-head { flex-direction: row; gap: 10px; }
  .dict-rail-head > div { display: flex; flex-direction: column; }
  .dict-rail-head span { display: none; }
  .dict-rail-cat { width: 30px; height: 30px; }
  .dict-rail-head strong { font-size: 13.5px; }
  #dict-import-rail .dict-tile { min-height: 46px; }
  #dict-import-rail .dict-tile img, #dict-import-rail .dict-tile svg { width: 26px; height: 26px; }
  #dict-import-rail .dict-rail-tiles { order: 3; flex: 1 1 100%; }
  #dict-import-rail .dict-rail-offline { order: 2; margin-left: auto; }
  .dict-rail-head { flex: none; align-items: center; }
  .dict-rail-cat { width: 44px; height: 44px; }
  .dict-rail-tiles { flex: 1 1 auto; min-width: 0; margin-top: 0; }
  .dict-rail-head { flex: 0 0 auto; }
  #dict-import-rail .dict-rail-offline { flex: 0 1 auto; min-width: 0; max-width: 235px; margin-top: 0; padding-right: 36px; }
  #dict-import-rail .dict-rail-offline label { font-size: 11px; line-height: 1.3; white-space: normal; }
  .dict-tile { flex-direction: row; align-items: center; justify-content: flex-start; min-height: 58px; padding: 8px 10px; gap: 4px; text-align: left; }
  .dict-tile strong { font-size: 13.5px; }
  .dict-tile small { display: none; }
  .dict-rail-offline { flex: none; margin-top: 0; }
  .dict-rail-note { display: none; }
}
