/* docs-rtl.css — 文档站 RTL 镜像层（D-RTL 第 5 条）
 *
 * 只在 <html dir="rtl"> 的页面（ar / fa）由 base.html 加载；其它语言一个字节都不加载。
 * 写法照主站 /home/ubuntu/work/ar1112/wt-merge/app/static/css/rtl-extra.css：
 *   字体 → 连写脚本保护 → 行高 → 双向隔离 → 组件镜像。
 * 每条镜像都注明它对应的原文件与原行号（行号是 2026-11-13 本工作树里的位置）。
 * 方向属性只镜像「有左右之分」的那些：left ↔ right、margin/padding/border-*-left ↔ right、
 * text-align: left/right、float；text-align: center 与 left:0/right:0 成对出现的居中布局不动。
 */

/* ── 1. 字体 ─────────────────────────────────────────────────────────────────────────────────────
   Vazirmatn v33.003 的 “Non-Latin” 变量字体（SIL OFL 1.1，LICENSE 在
   /static/fonts/LICENSE-Vazirmatn-OFL.txt，文件未改动，47,972 B，
   sha256 cdef5578ea583313cbea060a14aa107955a99717a861971b860cb564dfe1bbf5）。
   一个文件覆盖 100–900 全部字重 + 阿拉伯/波斯字母（پ چ ژ گ ک ی、半空格）。
   unicode-range 只含阿拉伯字母区 + ZWNJ/ZWJ/LRM/RLM + «»：拉丁字母、0-9、ASCII 标点继续落到 Inter，
   价格、型号、命令与 LTR 站保持一模一样。
   font-display: swap —— 正文字体，不是装饰字体（可选字体首访会整页停在系统字体）。 */
@font-face {
  font-family: "Vazirmatn QC";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/static/fonts/vazirmatn-nl-wght.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB;
}
@font-face {
  font-family: "Vazirmatn QC Fallback";
  src: local("Noto Sans Arabic Regular"), local("NotoSansArabic-Regular"), local("Noto Sans Arabic");
  size-adjust: 99.7%;
  ascent-override: 102.85%;
  descent-override: 53.87%;
  line-gap-override: 0%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB;
}
@font-face {
  font-family: "Vazirmatn QC Fallback Tahoma";
  src: local("Tahoma");
  ascent-override: 102.54%;
  descent-override: 53.71%;
  line-gap-override: 0%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB;
}
@font-face {
  font-family: "Vazirmatn QC Fallback Segoe";
  src: local("Segoe UI"), local("SegoeUI");
  ascent-override: 102.54%;
  descent-override: 53.71%;
  line-gap-override: 0%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB;
}
@font-face {
  font-family: "Vazirmatn QC Fallback Geeza";
  src: local("Geeza Pro Regular"), local("GeezaPro"), local("Geeza Pro");
  ascent-override: 102.54%;
  descent-override: 53.71%;
  line-gap-override: 0%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+00AB, U+00BB;
}

/* base.html 内联 <style> 的 body 字体栈（base.html:120）、按钮（:124）、表单同样是这份，
   都换成正文字体在前。代码块仍用 JetBrains Mono（拉丁），阿拉伯词由浏览器沿字体栈回落。 */
[dir="rtl"] {
  --rtl-sans: "Vazirmatn QC", "Vazirmatn QC Fallback", "Vazirmatn QC Fallback Tahoma",
              "Vazirmatn QC Fallback Segoe", "Vazirmatn QC Fallback Geeza", "Inter",
              -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
              "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans Arabic", Tahoma, sans-serif;
}
[dir="rtl"] body,
[dir="rtl"] button,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea {
  font-family: var(--rtl-sans);
}

/* ── 2. 连写脚本保护 ───────────────────────────────────────────────────────────────────────────
   阿拉伯字母连写：字距会把它们拉开，大写化与伪斜体对它们没有意义。!important 是有意的——
   letter-spacing / uppercase 散落在 base.html（th、badge）与各页模板里。代码岛保持原样。 */
[dir="rtl"] *:not(pre *, code, code *, kbd, samp),
[dir="rtl"] *:not(pre *, code, code *, kbd, samp)::before,
[dir="rtl"] *:not(pre *, code, code *, kbd, samp)::after {
  letter-spacing: 0 !important;
  text-transform: none !important;
}
[dir="rtl"] :is(i, em, cite, dfn, var, address):not(pre *, code *) {
  font-style: normal !important;
}

/* ── 3. 行高 ───────────────────────────────────────────────────────────────────────────────────
   阿拉伯文的点与符在基线上下要更多余地：正文行高比 LTR 加约 12%
   （base.html:121 body 1.7 → 1.9；base.html:310 .prose 1.7 → 1.9）。标题不动。 */
[dir="rtl"] body { line-height: 1.9; }
[dir="rtl"] .prose { line-height: 1.9; }

/* ── 4. 双向隔离 ───────────────────────────────────────────────────────────────────────────────
   4a. 代码块、行内代码、kbd：永远 LTR、左对齐，与两侧的 RTL 段落隔离。 */
[dir="rtl"] :is(pre, code, kbd, samp) {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}
/* 4b. 输入框：默认 LTR（企业登录的 API key 这类值是 key / URL / 命令）。
   用户输入自然语言的几处——顶栏 / 首页 / 文档库 / 搜索页的搜索框、侧栏与分类筛选、问答输入框——跟随页面 RTL：
   占位符和输入从右侧排起，贴着已镜像到右侧的放大镜图标；plaintext 让纯拉丁查询（claude code）照常按 LTR 显示。 */
[dir="rtl"] :is(input, textarea, select) {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
}
[dir="rtl"] :is(input[name="q"], #home-search, #chatInput, .side-filter, .cat-filter, [data-nav-search]) {
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: right;
}
/* 4c. 价值/型号/数字这类行内拉丁片段：方向随内容（等价于 <bdi>），
   夹在阿拉伯句子里时 "$20/mo"、"claude-opus-5-5" 不会被拆反。 */
[dir="rtl"] :is(span, a, b, strong, small, em)[dir="ltr"],
[dir="rtl"] :is(.qs-num, .code-block, .hot-total, .cat-count) {
  unicode-bidi: isolate;
}
/* 4d. 代码块整块是 LTR 岛：复制按钮（docs-ux.css:118，右上）与语言标签（:139，左上）都不镜像——
   镜像后复制按钮压在每行代码的起点上（截图核对过），标签也会跑到代码行尾那一侧。 */

/* ── 5. base.html 内联 style 的镜像 ───────────────────────────────────────────────────────────── */
/* base.html:200 .lang-dropdown { right: 0 } → 下拉菜单贴左边 */
[dir="rtl"] .lang-dropdown { right: auto; left: 0; }
/* base.html:269 th, td { text-align: left } */
[dir="rtl"] th,
[dir="rtl"] td { text-align: right; }
/* base.html:293 .search-input input { padding: 14px 24px 14px 48px } → 图标换到右边 */
[dir="rtl"] .search-input input { padding: 14px 48px 14px 24px; }
/* base.html:297 .search-input .search-icon { left: 16px } */
[dir="rtl"] .search-input .search-icon { left: auto; right: 16px; }
/* base.html:307 .prose ul, .prose ol { padding-left: 24px } */
[dir="rtl"] .prose ul,
[dir="rtl"] .prose ol { padding-left: 0; padding-right: 24px; }
/* base.html:312 .prose blockquote { border-left; border-radius: 0 r r 0 } */
[dir="rtl"] .prose blockquote {
  border-left: none;
  border-right: 3px solid var(--primary);
  border-radius: var(--radius) 0 0 var(--radius);
}
/* base.html:320 .prose h2:hover .anchor-link { margin-left: 8px } */
[dir="rtl"] .prose h2:hover .anchor-link,
[dir="rtl"] .prose h3:hover .anchor-link { margin-left: 0; margin-right: 8px; }
/* base.html:326 (hover:none) .prose .anchor-link { padding: 14px 30px 14px 8px } */
@media (hover: none) {
  [dir="rtl"] .prose .anchor-link { padding: 14px 8px 14px 30px; }
}

/* ── 6. pages/docs/index.html 内联 style 的镜像 ─────────────────────────────────────────────── */
/* docs/index.html:38 .suggest-dropdown { left: 0; right: 0; text-align: left } */
[dir="rtl"] .suggest-dropdown { text-align: right; }
/* docs/index.html:72 .task-card--primary { border-left: 4px solid } */
[dir="rtl"] .task-card--primary {
  border-left: none;
  border-right: 4px solid var(--primary);
}
/* docs/index.html:74 .task-card__pill { right: 12px } */
[dir="rtl"] .task-card__pill { right: auto; left: 12px; }
/* docs/index.html:85 .task-card__title { padding-right: 48px } */
[dir="rtl"] .task-card__title { padding-right: 0; padding-left: 48px; }
/* docs/index.html:130 .cat-count { margin-left: 2px } */
[dir="rtl"] .cat-block > summary .cat-count { margin-left: 0; margin-right: 2px; }
/* docs/index.html:131 .cat-filter-wrap { margin-left: auto } */
[dir="rtl"] .cat-block > summary .cat-filter-wrap { margin-left: 0; margin-right: auto; }
/* docs/index.html:150 .doc-card__title { padding-right: 20px } */
[dir="rtl"] .doc-card__title { padding-right: 0; padding-left: 20px; }
/* docs/index.html:157 .doc-card__pin { right: 8px } */
[dir="rtl"] .doc-card__pin { right: auto; left: 8px; }
/* docs/index.html:176 .hot-card .hot-title { padding-right: 32px } */
[dir="rtl"] .hot-card .hot-title { padding-right: 0; padding-left: 32px; }
/* docs/index.html:181 .badge { right: 8px } */
[dir="rtl"] .badge { right: auto; left: 8px; }
/* docs/index.html:231 @media (max-width:720px) .cat-filter-wrap { margin-left: 0 } */
@media (max-width: 720px) {
  [dir="rtl"] .cat-block > summary .cat-filter-wrap { margin-left: 0; margin-right: 0; }
}

/* ── 6b. hard-coded direction arrows (D6) ──────────────────────────────────────────────────────
   The template arrows used as forward / see-more → and back ← point the wrong way on RTL pages.
   Text arrows are chosen by the template from text_direction (LTR output unchanged); these two are
   CSS pseudo-elements, mirrored here. The external-link ↗ is not a direction and stays as is. */
[dir="rtl"] .ref-link::after { content: "←"; }                         /* home.html:97 internal link */
[dir="rtl"] .ref-link[target="_blank"]::after { content: "↗"; }        /* external marker: never mirrored (wins over the line above) */
[dir="rtl"] .task-card__docs li a::before { content: '‹ '; }           /* docs/index.html:96 list marker */

/* ── 7. pages/ask.html 内联 style 的镜像 ────────────────────────────────────────────────────── */
/* ask.html:41 .content th { text-align: left } */
[dir="rtl"] .chat-msg .body .content th { text-align: right; }
/* ask.html:43 .content ul, ol { padding-left: 20px } */
[dir="rtl"] .chat-msg .body .content ul,
[dir="rtl"] .chat-msg .body .content ol { padding-left: 0; padding-right: 20px; }
/* ask.html:45 .content blockquote { border-left; border-radius: 0 6px 6px 0 } */
[dir="rtl"] .chat-msg .body .content blockquote {
  border-left: none;
  border-right: 3px solid var(--primary);
  border-radius: 6px 0 0 6px;
}
/* ask.html:94 .welcome-btn { text-align: left } */
[dir="rtl"] .welcome-btn { text-align: right; }
/* ask.html:26-29 气泡的直角落在说话人一侧：助理是左上、用户是右上 → RTL 下换成右上 / 左上 */
[dir="rtl"] .chat-msg .body .content { border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg); }
[dir="rtl"] .chat-msg.user .body .content { border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg); }
/* ask.html:245-246 限流提示里两个链接的内联 style="margin-right:12px"：
   用属性选择器 + !important 盖过内联 style（不改模板 ⇒ LTR 五语的 ask 页逐字节不变） */
[dir="rtl"] .chat-msg .content a[style*="margin-right:12px"] { margin-right: 0 !important; margin-left: 12px !important; }

/* ── 8. pages/home.html 内联 style 的镜像 ───────────────────────────────────────────────────── */
/* home.html:51 .recent-pop { text-align: left } */
[dir="rtl"] .recent-pop { text-align: right; }
/* home.html:87 .tools-all { text-align: right } */
[dir="rtl"] .tools-all { text-align: left; }
/* home.html:60 .sg-chip { padding: 3px 4px 3px 10px }（右侧留出「×」的位） */
[dir="rtl"] .sg-chip { padding: 3px 10px 3px 4px; }
/* home.html:48 .recent-pop { left: 0; right: 0 } 是成对居中定位，不镜像 */

/* ── 9. pages/search.html 内联 style 的镜像 ─────────────────────────────────────────────────── */
/* search.html:26 .sg-label { margin-right: 4px } */
[dir="rtl"] .sg-label { margin-right: 0; margin-left: 4px; }
/* search.html:30 .chip-x { margin-left: 2px } */
[dir="rtl"] .sg-chip .chip-x { margin-left: 0; margin-right: 2px; }
/* search.html:32 .sg-clear { margin-left: 6px } */
[dir="rtl"] .sg-clear { margin-left: 0; margin-right: 6px; }

/* ── 10. app/static/css/docs-ux.css 的镜像 ──────────────────────────────────────────────────── */
/* docs-ux.css:14 .skip-link { left: 8px } */
[dir="rtl"] .skip-link { left: auto; right: 8px; }
/* docs-ux.css:30 .nav-search input { padding: 0 34px 0 32px } → ⌘K 标签换到左边 */
[dir="rtl"] .nav-search input { padding: 0 32px 0 34px; }
/* docs-ux.css:41 .nav-search .nav-search-icon { left: 10px } */
[dir="rtl"] .nav-search .nav-search-icon { left: auto; right: 10px; }
/* docs-ux.css:45 .nav-search kbd { right: 8px } */
[dir="rtl"] .nav-search kbd { right: auto; left: 8px; }
/* docs-ux.css:77 @media 1280 .nav-search input { padding-right: 10px }（⌘K 收起后让出 kbd 那一侧）
   → RTL 下 kbd 在左：左侧收到 10px，右侧仍给放大镜留 32px（原先写成 padding-right: 0，窄屏占位符压在图标上） */
@media (max-width: 1280px) {
  [dir="rtl"] .nav-search input { padding-right: 32px; padding-left: 10px; }
}
/* docs-ux.css:51 .nav-suggest { left: 0; right: 0 }、:89 .nav-drawer { left: 0; right: 0 }
   都是成对的全宽定位，无需镜像。 */
/* docs-ux.css:118 .code-block > .code-copy { right: 8px }、:139 .code-block[data-lang]::before { left: 14px }：
   代码块是 LTR 岛，两处都不镜像（见 §4d）。 */
/* docs-ux.css:152 .doc-toc a.is-active { border-left: 2px; margin-left: -8px; padding-left: 6px } */
[dir="rtl"] .doc-toc a.is-active {
  border-left: none;
  border-right: 2px solid var(--primary);
  margin-left: 0;
  margin-right: -8px;
  padding-left: 0;
  padding-right: 6px;
}
/* docs-ux.css:175 .doc-sidebar { border-right: 1px solid } */
[dir="rtl"] .doc-sidebar { border-right: none; border-left: 1px solid var(--border); }
/* docs-ux.css:199-200 .side-section-title::after { margin-left: auto; border-right; border-bottom;
   transform: rotate(-45deg) } —— 折叠箭头镜像（-45deg ↔ 45deg 已在 [open] 里成对出现，跟着换） */
[dir="rtl"] .side-section-title::after {
  margin-left: 0;
  margin-right: auto;
  border-right: none;
  border-left: 1.5px solid currentColor;
  transform: rotate(45deg);
}
[dir="rtl"] .side-section[open] > .side-section-title::after { transform: rotate(-45deg); }
/* docs-ux.css:207 .side-link { padding: 7px 12px 7px 20px; border-left: 2px solid transparent } */
[dir="rtl"] .side-link {
  padding: 7px 20px 7px 12px;
  border-left: none;
  border-right: 2px solid transparent;
}
/* docs-ux.css:213 .side-link.active { border-left-color: var(--primary) } */
[dir="rtl"] .side-link.active {
  border-left-color: transparent;
  border-right-color: var(--primary);
}
/* docs-ux.css:257 .doc-toc ul { padding-left: 12px } */
[dir="rtl"] .doc-toc ul { padding-left: 0; padding-right: 12px; }
/* docs-ux.css:258 .doc-toc > ul { padding-left: 0 } */
[dir="rtl"] .doc-toc > ul { padding-left: 0; padding-right: 0; }
/* docs-ux.css:272 .doc-nav-next { text-align: right } */
[dir="rtl"] .doc-nav-next { text-align: left; }
/* docs-ux.css:283-286 .prose .table-wrap 的滚动阴影：四段渐变的 to right/to left 与 left/right 定位
   都要换边，否则提示会出现在没有内容的那一侧。 */
[dir="rtl"] .prose .table-wrap {
  background:
    linear-gradient(to left, var(--bg-white) 30%, rgba(255, 255, 255, 0)) right / 32px 100% no-repeat local,
    linear-gradient(to right, var(--bg-white) 30%, rgba(255, 255, 255, 0)) left / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) right / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0)) left / 14px 100% no-repeat scroll;
}
/* docs-ux.css:319 .doc-toc-inline ul { padding-left: 14px } */
[dir="rtl"] .doc-toc-inline ul { padding-left: 0; padding-right: 14px; }
/* docs-ux.css:320 .doc-toc-inline > details > ul, .toc > ul { padding-left: 0 } */
[dir="rtl"] .doc-toc-inline > details > ul,
[dir="rtl"] .doc-toc-inline .toc > ul { padding-left: 0; padding-right: 0; }
/* docs-ux.css:404 窄屏侧栏抽屉：position:fixed; left: 0; transform: translateX(-100%) → 从右边滑出 */
@media (max-width: 1024px) {
  [dir="rtl"] .doc-sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
  }
  [dir="rtl"] .doc-sidebar.is-open { transform: translateX(0); }
}
/* docs-ux.css:431 .qs-num { right: 16px } */
[dir="rtl"] .qs-num { right: auto; left: 16px; }
/* docs-ux.css:463 .cat-desc { margin-left: 10px } */
[dir="rtl"] .cat-desc { margin-left: 0; margin-right: 10px; }
/* docs-ux.css:495 .promo-banner { left: 0; right: 0 } 成对全宽，不镜像 */

/* ── 11. base.html 里离线客服挂件的注入样式（base.html:665、673、685、690、691）───────────────
   挂件把自己的 CSS 以字符串注入；[dir="rtl"] 前缀的优先级高于它自己的 #id 选择器。 */
[dir="rtl"] #qc-support-offline,
[dir="rtl"] #qc-support-offline-mini {
  right: auto;
  left: calc(20px + env(safe-area-inset-left, 0px));
}
/* base.html:673 #qc-support-offline .qc-min { margin-left: auto } */
[dir="rtl"] #qc-support-offline .qc-min { margin-left: 0; margin-right: auto; }
/* base.html:690 #qc-support-offline-mini .qc-mini-dot { right: 4px } */
[dir="rtl"] #qc-support-offline-mini .qc-mini-dot { right: auto; left: 4px; }
/* base.html:691 @media (max-width:480px) #qc-support-offline { right: 16px } */
@media (max-width: 480px) {
  [dir="rtl"] #qc-support-offline { right: auto; left: 16px; }
}

/* ── 12. 缺篇回退的英文正文 ─────────────────────────────────────────────────────────────────────
   ar / fa 缺某篇时显示英文原文（document.html 的 .doc-fallback 横幅在标题之前）。横幅之后的标题、摘要与正文是英文：
   按 LTR 排（否则句号、括号、斜杠会跑到行首），页面自己的 UI（上下篇、相关文档、CTA、行内 CTA、目录、更新日期）保持 RTL。
   上面 §5 / §10 给 RTL 正文做的镜像（列表缩进、引用边线、表格对齐、锚点间距）在这里换回 LTR 的值。 */
[dir="rtl"] .doc-fallback ~ :not(.doc-nav, .doc-related, .doc-cta, .doc-cta-ent, .doc-inline-cta, .doc-toc-inline, .doc-updated) {
  direction: ltr;
  text-align: left;
}
[dir="rtl"] .doc-fallback ~ :is(ul, ol),
[dir="rtl"] .doc-fallback ~ * :is(ul, ol) { padding-left: 24px; padding-right: 0; }
[dir="rtl"] .doc-fallback ~ blockquote {
  border-right: none;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
}
[dir="rtl"] .doc-fallback ~ * :is(th, td) { text-align: left; }
[dir="rtl"] .doc-fallback ~ :is(h2, h3):hover .anchor-link { margin-right: 0; margin-left: 8px; }

/* ── 13. LTR 短串隔离（app/i18n/bidi.py 服务端插入、app/static/js/rtl.js 给 JS 写入的文字补插的 <bdi dir="ltr">）──────────
   下面 7 / 7b / 7c 三段原文照抄 qcode-web rtl-extra.css 第 7 节（AR2 第 4 提交，ar2/final-bidi/rtl-extra.isolation.css，
   sha256 edd8ef4e…）：flex / grid 里的 <bdi> 不成独立 flex item、≤32 字符的短串（日期 / 版本 / 价格 / 型号）qc-nw 不折行、
   其余长串（URL / 路径 / KEY=值）可 break-word 折行。 */
/* rtl-extra.css — section 7 only (the rules for the <bdi dir="ltr"> wrappers inserted by app/i18n/bidi.py and rtl.js),
   copied verbatim from qcode-web app/static/css/rtl-extra.css for the docs site (ar1112 AR2, 4th commit). */
/* ── 7. <bdi dir="ltr"> inserted by RtlBidiMiddleware / rtl.js (app/i18n/bidi.py) ─────────────────────
   As a direct child of a flex / grid container a <bdi> would become a flex item of its own: the container's gap
   opens up inside "$5/day", and the spaces at the edges of the neighbouring text runs are dropped ("$5months").
   display:contents keeps the text in one anonymous item; the isolation still applies (measured in Chrome 147,
   scripts/rtl_bench/probe.mjs). Covers the usual flex classes here (no layout shift); rtl.js does the same for any
   other flex / grid parent at runtime. Everywhere else the <bdi> stays a normal inline box. */
:root[dir="rtl"] :is(.flex, .inline-flex, .grid, .inline-grid, .qc-badge, .qc-btn, .qc-chip, .qc-hero-kicker) > bdi[dir="ltr"] {
  display: contents;
}
/* 7b. Short runs (date, time, version, model ID, price, price unit, phone — ≤ 32 characters; bidi.open_tag / rtl.js
   nowrap) never break inside: in a 375 px model card "2026-09-29" wrapped after "2026-09-" and the line-end hyphen
   was drawn on the left of the digits. URLs, paths, commands and longer runs keep the plain <bdi> and wrap as before.
   A run grown into its Latin phrase ("GPT-6 Sol", "$5 / $25 per 1M tokens") gets qc-nw only when the whole phrase is
   ≤ 32 characters and every run in it is one of the kinds above (bidi.find_phrases / rtl.js phrases). (ar1112 AR2) */
:root[dir="rtl"] bdi.qc-nw {
  white-space: nowrap;
}
/* 7c. Everything else isolated (URL, path, KEY=value, flag, long model ID …) may break when it does not fit:
   fa /claude-code-ultracode-guide overflowed 13 px at 375 px on «ANTHROPIC_BASE_URL=https://api.qcode.cc/api»
   (41 characters, no break opportunity). break-word (not anywhere): it does not lower the min-content width, so table
   cells and flex items keep their natural size and a run is only broken when its line really overflows. */
:root[dir="rtl"] bdi[dir="ltr"]:not(.qc-nw) {
  overflow-wrap: break-word;
}
/* 文档站适配（不在 qcode.cc 那份里）：文档标题字号大，≤32 字符的 qc-nw 短语在 375 宽下也可能比屏宽——
   fa /docs/ide/deepseek-tui 的 h1「DeepSeek-TUI (CodeWhale 0.10.2)」436 px，把整页撑出 77 px 横向滚动（ar2_overflow 探针）。
   标题里的 qc-nw 允许折行；正文、表格、卡片里的照旧不折。 */
:root[dir="rtl"] :is(h1, h2, h3, h4) bdi.qc-nw { white-space: normal; }   /* :root 前缀：要压过上面照抄的 :root[dir="rtl"] bdi.qc-nw */
/* AI 问答（ask.html）的回答在浏览器里由 marked 渲染：每段的方向按自己的第一个强字符定（等于每段 dir="auto"）——
   阿拉伯 / 波斯语回答从右排，夹着的英文段（引用命令输出、英文原文）从左排；代码块已在 §4a 固定 LTR。
   段内的数字 / 价格 / URL 由 rtl.js 的 MutationObserver 在流式写入时加 <bdi dir="ltr">（与服务端同一份规则）。 */
[dir="rtl"] .chat-msg .content :is(p, li, h1, h2, h3, h4, blockquote, td, th) {
  unicode-bidi: plaintext;
  text-align: start;
}

