/* ==========================================================================
   SUNUM 自媒体助手 · 统一设计系统
   --------------------------------------------------------------------------
   全站唯一的基础样式来源。14 个页面此前各自内联了一份几乎相同的样式，
   导致顶栏间距、卡片留白、按钮尺寸等逐渐漂移；现统一收敛到本文件。

   引入顺序：本文件必须在页面自身的 <style> 之前引入，
   这样各页面的专有样式仍可覆盖此处的默认值。
   ========================================================================== */

/* ★ DS-UX 2026：全站统一设计系统规范层（static/css/ds.css）。
   为什么必须排在最前：ds.css 里的色值写在 `:root:root`（特异性 0,2,0）上，
   高于本文件与各页面自带的 `:root`（0,1,0）/ `html[data-theme="dark"]`（0,1,1），
   因此**各页自带的色板会被自动统一**——改造前 canvas_list 用 #0c0c0f+蓝、
   about 又一套、canvas 又一套，同一站点三种深色，正是本条要根治的漂移。
   放在最前还因为它是「基础令牌」，后面的 rtl.css / promptlib.css 都引用这些令牌。 */
@import url("ds.css?v=20261012c");

/* ★ RTL-LAYOUT：全局 LTR/RTL 布局样式（static/css/rtl.css）。
   为什么用 @import 而不是让 11 个模板各加一行 <link>：
   @import 必须位于所有规则之前，位置天然就是「基础样式」的语义；
   一处改动即覆盖全部 sunum.css 使用者（index/tools/chat/result/about/
   buy/admin/404/500…），不会因为新增页面忘记引入而静默失去 RTL 能力。
   canvas.html 不加载本文件，已单独 <link> 引入。 */
@import url("rtl.css?v=20261012a");

/* ★ TPL-LIB：新疆本地化双语提示词模板库面板样式（static/css/promptlib.css）。
   同样用 @import 一次覆盖全部内容页：将来在 /tools、/chat 等页面复用一个
   模板面板入口时，不必再补 <link>。样式全部走本文件的设计令牌，主题自动一致。
   canvas.html 不加载本文件，若要复用节点面板需单独 <link>。 */
@import url("promptlib.css?v=20261012a");

/* ---------- 字体 ---------- */
@font-face {
  font-family: "Alkatip Kitab Tom";
  src: url("/static/fonts/ALKATIP%20Kitab%20Tom.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Alkatip Tor Tom";
  src: url("/static/fonts/ALKATIP%20Tor%20Tom.ttf") format("truetype");
  font-weight: normal; font-style: normal; font-display: swap;
}

/* ==========================================================================
   1. 设计令牌
   ========================================================================== */
:root {
  /* 颜色 · 浅色 */
  --bg: #ffffff; --panel: #ffffff; --panel2: #f7f7f5; --panel3: #f1f1ee;
  --line: #e8e8e4; --line2: #d8d8d2;
  --txt: #151517; --mut: #6f6f77; --mut2: #9c9ca3;
  --acc: #151517; --acc-txt: #ffffff; --hover: #f2f2ef; --sel: #eceeec;
  --ok-bg: #eaf6ee; --ok-txt: #18794e;
  --err-bg: #fcecec; --err-txt: #c3423f;
  --warn-bg: #fdf5e4; --warn-txt: #8a6100;
  --ring: rgba(21, 21, 23, .16);

  /* 圆角 */
  --r-xs: 8px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px; --r-pill: 999px;

  /* 间距节奏（4 的倍数） */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* 字阶 */
  --f-xs: 12px; --f-sm: 13px; --f-md: 14px; --f-lg: 16px;
  --f-xl: 20px; --f-2xl: 26px; --f-3xl: 34px;

  /* 阴影 */
  --shadow: 0 1px 2px rgba(16,16,20,.04), 0 20px 48px rgba(16,16,20,.06);
  --shadow-sm: 0 1px 2px rgba(16,16,20,.05);
  --shadow-lg: 0 2px 4px rgba(16,16,20,.04), 0 32px 64px rgba(16,16,20,.10);

  /* 布局 */
  --page: 1120px;
  --gutter: 24px;
  --topbar-h: 64px;

  /* z-index 层级规范（全站唯一来源，禁止再写裸数字）
     ------------------------------------------------------------------
     页面内容 < 顶栏 < 侧栏 < 遮罩 < 弹窗 < 全屏 loading < Toast
     新组件请一律引用这里的变量；ui.js 在变量缺失时使用同名兜底值。 */
  --z-base: 1;      /* 普通内容抬升 */
  --z-topbar: 100;  /* 顶栏 / 底部操作条 */
  --z-side: 800;    /* 侧边栏 / 抽屉 */
  --z-mask: 900;    /* 弹窗遮罩（与弹窗同层，见 --z-modal 说明） */
  --z-modal: 1000;  /* 弹窗主体 */
  --z-loading: 1050;/* 全屏阻塞 loading */
  --z-toast: 1100;  /* Toast 提示，永远在最上 */

  --ease: cubic-bezier(.2, .7, .3, 1);
}

html[data-theme="dark"] {
  --bg: #0e0e10; --panel: #17171a; --panel2: #1e1e22; --panel3: #24242a;
  --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.16);
  --txt: #f4f4f0; --mut: #9b9ba1; --mut2: #6e6e75;
  --acc: #f4f4f0; --acc-txt: #101012; --hover: #232327; --sel: rgba(255,255,255,.09);
  --ok-bg: #14281c; --ok-txt: #79d2a5;
  --err-bg: #2c1515; --err-txt: #f0a3a3;
  --warn-bg: #2b2413; --warn-txt: #e8c37a;
  --ring: rgba(255, 255, 255, .22);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 22px 46px rgba(0,0,0,.45);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.4), 0 36px 70px rgba(0,0,0,.55);
}

/* ==========================================================================
   2. 基础重置与排版
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: "Alkatip Kitab Tom", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: var(--f-md);
  line-height: 1.6;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}

::selection { background: var(--acc); color: var(--acc-txt); }

a { color: inherit; text-decoration: none; }

img, svg, video, canvas { max-width: 100%; height: auto; }

h1, h2, h3, h4 { line-height: 1.3; font-weight: 750; letter-spacing: -.01em; }
h1 { font-size: var(--f-2xl); }
h2 { font-size: var(--f-xl); }
h3 { font-size: var(--f-lg); }
p { line-height: 1.75; }

code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* 键盘可达性：统一焦点圈 */
:focus-visible {
  outline: 2px solid var(--line2);
  outline-offset: 2px;
}

/* ==========================================================================
   3. 顶栏
   ========================================================================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  min-height: var(--topbar-h);
  padding: 10px var(--s6);
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex; align-items: center; gap: var(--s3);
  font-size: var(--f-lg); font-weight: 750; letter-spacing: .2px;
  white-space: nowrap;
}
.brand .brand-logo { height: 36px; width: auto; display: block; }
.brand .brand-word {
  display: inline-block; height: 19px; width: 66px;
  background: var(--txt);
  -webkit-mask: url("/static/uploads/sunum-word.png") center / contain no-repeat;
          mask: url("/static/uploads/sunum-word.png") center / contain no-repeat;
}

.top-right { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.top-right a {
  font-size: 13.5px; padding: 7px 14px; border-radius: var(--r-pill);
  color: var(--mut); font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.top-right a:hover { background: var(--hover); color: var(--txt); }
.top-right a.solid { background: var(--acc); color: var(--acc-txt); }
.top-right a.solid:hover { opacity: .88; }

.cred-pill {
  font-size: var(--f-sm); background: var(--sel); color: var(--txt);
  border-radius: var(--r-pill); padding: 5px 14px; margin-right: 6px;
  font-weight: 700; white-space: nowrap;
}
/* r26b：积分胶囊改为 <a> 后保持原观感（.top-right a 的颜色/内边距会被它赢回），
   并补 hover 反馈提示可点击 */
a.cred-pill { text-decoration: none; color: var(--txt); transition: background .15s var(--ease); }
a.cred-pill:hover { background: var(--hover); color: var(--txt); }

.lang-switch, .theme-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill);
  overflow: hidden; background: var(--panel); margin-left: 6px;
}
.lang-switch button, .theme-switch button {
  border: none; background: transparent; padding: 6px 13px; font-size: 12.5px;
  cursor: pointer; color: var(--mut); font-weight: 600; font-family: inherit;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.lang-switch button:hover, .theme-switch button:hover { background: var(--hover); color: var(--txt); }
.lang-switch button.on, .theme-switch button.on { background: var(--acc); color: var(--acc-txt); }

/* ==========================================================================
   4. 页面容器
   ========================================================================== */
.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
  flex: 1;
  min-width: 0;
}
/* 表单/详情类窄容器：给 body 加 class 即可 */
.wrap-narrow { max-width: 460px; }

/* ==========================================================================
   5. 卡片
   ========================================================================== */
.card, .work {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: var(--s6) 36px;
  margin-bottom: var(--s5);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-flat { box-shadow: none; }

/* ==========================================================================
   6. 按钮
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px;
  padding: 9px 24px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: var(--f-md); font-weight: 700; font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  background: var(--sel); color: var(--txt);
  transition: background .15s var(--ease), border-color .15s var(--ease),
              color .15s var(--ease), transform .1s var(--ease), opacity .15s var(--ease);
}
.btn:hover { border-color: var(--line2); }
.btn:active { transform: scale(.985); }

.btn-pri, .big-btn { background: var(--acc); color: var(--acc-txt); border: none; }
.btn-pri:hover, .big-btn:hover { opacity: .88; border-color: transparent; }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--txt); }
.btn-ghost:hover { border-color: var(--line2); background: var(--hover); }

.btn-danger { background: var(--err-bg); color: var(--err-txt); border-color: transparent; }

.btn-sm { min-height: 32px; padding: 6px 14px; font-size: 13px; }
.btn-lg { min-height: 48px; padding: 13px 32px; font-size: var(--f-lg); }
.btn-block { display: flex; width: 100%; }

.btn:disabled, .btn-dis { opacity: .5; cursor: not-allowed; transform: none; }

/* ==========================================================================
   7. 表单
   ========================================================================== */
input, textarea, select {
  background: var(--panel2); color: var(--txt);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 9px 14px; font-size: var(--f-md); font-family: inherit;
  line-height: 1.5; outline: none; max-width: 100%;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--line2);
  box-shadow: 0 0 0 3px var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--mut2); }
input:disabled, textarea:disabled, select:disabled { opacity: .6; cursor: not-allowed; }

input[type=file] { font-family: inherit; color: var(--mut); padding: 7px 12px; }
input[type=file]::file-selector-button {
  background: var(--sel); color: var(--txt); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 14px; margin-right: 10px;
  cursor: pointer; font-family: inherit;
}
input[type=file]::file-selector-button:hover { border-color: var(--line2); }

label { font-size: var(--f-sm); color: var(--mut); font-weight: 600; }

/* ==========================================================================
   8. 提示条
   ========================================================================== */
.flash {
  position: relative;
  padding: 12px 18px 12px 20px;
  border-radius: var(--r-md);
  margin-bottom: var(--s4);
  font-size: var(--f-md);
  border: 1px solid transparent;
  overflow: hidden;
}
.flash::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px;
  background: currentColor; opacity: .5;
}
.flash-ok  { background: var(--ok-bg);  color: var(--ok-txt); }
.flash-err { background: var(--err-bg); color: var(--err-txt); }
.flash-warn { background: var(--warn-bg); color: var(--warn-txt); }

/* ==========================================================================
   9. 表格
   ========================================================================== */
table { width: 100%; border-collapse: collapse; }
table th {
  font-size: 12.5px; color: var(--mut); text-align: left;
  padding: 10px 12px; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--line2);
}
table td { border-top: 1px solid var(--line); padding: 11px 12px; font-size: 13.5px; vertical-align: middle; }
table tbody tr:hover td { background: var(--hover); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ==========================================================================
   10. 页脚
   ========================================================================== */
footer {
  text-align: center;
  padding: var(--s5) var(--gutter) var(--s6);
  font-size: 12.5px;
  color: var(--mut2);
  border-top: 1px solid var(--line);
  margin-top: var(--s6);
}
footer a { color: var(--mut); margin: 0 10px; transition: color .15s var(--ease); }
footer a:hover { color: var(--txt); }

/* ==========================================================================
   11. 通用小组件
   ========================================================================== */
.sub { font-size: var(--f-sm); color: var(--mut); line-height: 1.7; }
.hint { font-size: 12.5px; color: var(--mut2); line-height: 1.8; }
.section-t { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.note {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--s5) 28px;
  font-size: 13px; color: var(--mut); line-height: 2;
}
.note b { color: var(--txt); }
.msg { margin-top: var(--s3); font-size: 13.5px; min-height: 20px; }
.msg.ok  { color: var(--ok-txt); }
.msg.err { color: var(--err-txt); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; padding: 3px 10px;
  border-radius: var(--r-pill); background: var(--sel); color: var(--txt);
}

.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row   { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--mut); }
.tiny  { font-size: 12.5px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ==========================================================================
   12. 响应式
   ========================================================================== */
@media (max-width: 900px) {
  :root { --gutter: 20px; }
  .topbar { padding: 10px var(--s4); }
  .card, .work { padding: var(--s5) 24px; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; --topbar-h: auto; }
  body { font-size: 14px; }

  .topbar {
    padding: 10px var(--s4);
    gap: var(--s3);
    align-items: flex-start;
  }
  .top-right {
    width: 100%;
    gap: var(--s1);
    row-gap: 2px;
  }
  .top-right a { padding: 6px 11px; font-size: 13px; }
  .cred-pill { padding: 4px 12px; }
  .lang-switch, .theme-switch { margin-left: 0; }

  .wrap { padding: 0 var(--s4); }
  .wrap-narrow, .wrap[style*="max-width"] { max-width: 100%; }

  .card, .work {
    padding: 22px 18px;
    border-radius: var(--r-md);
    margin-bottom: var(--s4);
  }

  .btn { padding: 9px 20px; }
  .btn-lg { width: 100%; }
  .section-t { font-size: var(--f-lg); }
  h1 { font-size: var(--f-xl); }
}

@media (max-width: 420px) {
  .brand .brand-logo { height: 30px; }
  .btn { width: 100%; }
  .btn-sm { width: auto; }
}

/* 尊重系统的「减弱动效」偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   13. 图标系统对接（static/js/icons.js）
   --------------------------------------------------------------------------
   图标本体由 icons.js 提供（24×24 网格 / 1.5px 线宽 / stroke=currentColor）。
   本节只负责：① 在既有组件里给图标正确的盒模型；② 补齐 hover / active /
   disabled 三态。原先这些位置用的是 Emoji，Emoji 由字体渲染、无法被 CSS
   着色，因此三态在结构上无法实现 —— 这是本次图标重构的根本动因。
   ========================================================================== */
.tic, .ic, .ck, .badge > .ico, .qual .badge > .ico {
  display: inline-flex; align-items: center; justify-content: center;
}

/* 尺寸统一：全站只允许 16 / 20 / 24 三档（★ DS-UX 2026 规格约束）。
   改造前这里是 22px / 15px —— 22 与 15 都不在允许档位内，且同类图标在不同
   页面会出现 17/22/26 混排的观感。现收敛为：容器大图标 20，行内小图标 16，
   需要更强的视觉锚点时用 24（由 .ico-24 类显式声明）。 */
.tic > svg, .ic > svg { width: 20px; height: 20px; }
.badge > svg, .badge > .ico > svg, .ck > svg, .ck > .ico > svg { width: 16px; height: 16px; }

/* 三态之一：hover 悬浮高亮 */
.tpl .tic, .tool-entry .tic, .ic { transition: color .16s var(--ease), transform .16s var(--ease); }
.tpl:hover .tic, .tool-entry:hover .tic { color: var(--acc); transform: translateY(-1px); }

/* 三态之二：active 选中（aria-current / .on 由各页现有逻辑驱动） */
.tpl.on .tic, .tpl[aria-current] .tic, .tool-entry.on .tic { color: var(--acc); }

/* 三态之三：disabled 禁用置灰（不可点 + 降透明） */
.tpl:disabled .tic, .tool-entry[aria-disabled="true"] .tic,
[aria-disabled="true"] .tic, .tpl:disabled .ic { opacity: .42; filter: grayscale(1); }
.tpl:disabled, .tool-entry[aria-disabled="true"] { cursor: not-allowed; }

/* ==========================================================================
   14. 统一空状态 / 骨架屏
   --------------------------------------------------------------------------
   审查发现：空状态此前只有 orders / tools / canvas 三处，且各写各的
   .empty 类；其余 9 页数据为空时是「一片空白」。这里统一收敛。
   逻辑层建议改用 UI.empty()（js/ui.js），样式与此处一致。
   ========================================================================== */
.empty, .sui-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 44px 20px; text-align: center; color: var(--mut);
}
.empty .ec, .sui-empty .sui-eico { width: 42px; height: 42px; opacity: .5; }
.empty .et, .sui-empty .sui-et { font-size: var(--f-lg); font-weight: 600; color: var(--txt); }
.empty .ed, .sui-empty .sui-ed { font-size: var(--f-md); line-height: 1.65; max-width: 46ch; }
.empty a { color: var(--txt); text-decoration: underline; text-underline-offset: 3px; }

/* 骨架屏：异步加载占位，替代「空白 + 转圈」 */
.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--panel2) 25%, var(--panel3) 37%, var(--panel2) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.3s ease-in-out infinite;
  min-height: 14px;
}
.skeleton.tall { min-height: 96px; border-radius: var(--r-md); }
.skeleton.pill { border-radius: var(--r-pill); min-height: 30px; }
@keyframes skel-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ==========================================================================
   15. RTL 适配（维吾尔语）
   --------------------------------------------------------------------------
   现状问题：i18n.js 的 applyLang() 对全站设置 documentElement.dir="rtl"，
   但 sunum.css 此前 0 条 RTL 规则 → 切到维语后文字方向翻转、间距与对齐
   仍是 LTR，界面错位。
   处理原则（与画布模块既有裁决一致）：
     · 文本容器镜像（text-align / 行内间距翻转）
     · 空间容器不镜像（表格数字列、代码块、图表坐标保持 LTR）
   ========================================================================== */
html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] table th { text-align: right; }

/* 物理方向属性在 RTL 下需逐条翻转（本项目仅 5 处，成本可控） */
html[dir="rtl"] .cred-pill { margin-right: 0; margin-left: 6px; }
html[dir="rtl"] .lang-switch,
html[dir="rtl"] .theme-switch { margin-left: 0; margin-right: 6px; }
html[dir="rtl"] input[type=file]::file-selector-button { margin-right: 0; margin-left: 10px; }

/* 方向性图标在 RTL 下水平翻转（避免「返回」箭头指错方向）。
   ★ DS-UX 2026：原先这里硬编码了一份图标名单，与 icons.js 的 MIRROR 表
   构成「两个真源」，新增图标时必然漏改其中一份。现在**名单唯一来源是
   icons.js 的 MIRROR 白名单**：渲染时给方向类图标打 .mir 类，
   由 ds.css 的 `html[dir="rtl"] .ico.mir > svg{transform:scaleX(-1)}` 统一执行。
   好处：`play / lock / gear / sliders`（播放、锁、设置）天然不在白名单里，
   因此「功能性图标不翻转」这条要求是**结构上成立**的，而不是靠人记得排除。 */
/* 保留一条对既有 Emoji/内联 svg 写法的兼容兜底（未走 icons.js 的旧标记） */
html[dir="rtl"] .ico[data-ico="arrow-left"] > svg,
html[dir="rtl"] .ico[data-ico="chevron-left"] > svg,
html[dir="rtl"] .ico[data-ico="logout"] > svg { transform: scaleX(-1); }

/* 保持 LTR 的内容：数字 / 代码 / 时间码 / 订单号，避免「123」被读反 */
html[dir="rtl"] code, html[dir="rtl"] pre, html[dir="rtl"] .num,
html[dir="rtl"] input[type="number"], html[dir="rtl"] .txn {
  direction: ltr; unicode-bidi: isolate; text-align: left;
}

/* ==========================================================================
   16. 多语言长文本防挤压（维吾尔语长度约为中文 1.6~2.2 倍）
   --------------------------------------------------------------------------
   审查结论：顶栏、按钮、卡片标题等在维语下最容易溢出跑版。
   两条纪律：① 可伸缩容器一律 min-width:0（否则 flex 子项不肯收缩）；
             ② 文本可换行，不靠单行省略掩盖。
   ========================================================================== */
.topbar, .top-right, .brand, .row, .card, .work, .tpl, .tool-entry, .btn, .badge {
  min-width: 0;
}
.topbar { flex-wrap: wrap; row-gap: var(--s2); }
.top-right { flex-wrap: wrap; row-gap: var(--s2); }
.top-right a, .btn, .badge, .cred-pill, .msg, .flash { overflow-wrap: anywhere; }
.tpl .t, .tool-entry .t, .card h3, .card > p { overflow-wrap: anywhere; }

/* 语言/主题切换按钮是短标签，保持单行更整齐 */
.lang-switch button, .theme-switch button { white-space: nowrap; }

/* 维语字体栈 + 更大行距（阿拉伯字母变音符号需要垂直空间，否则上下吃字） */
html[lang="ug"] body, html[dir="rtl"] body {
  font-family: "Alkatip Kitab Tom", "Alkatip Tor Tom", system-ui, -apple-system,
               "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
}
html[lang="ug"] h1, html[lang="ug"] h2, html[lang="ug"] h3,
html[lang="ug"] .btn, html[lang="ug"] td, html[lang="ug"] th { line-height: 1.6; }

/* ==========================================================================
   17. 窄屏安全网（2026-10-10 二轮补齐）
   --------------------------------------------------------------------------
   审查结论：部分页面（chat / result / admin）自身没有媒体查询，且出现三类
   典型横向溢出源：
     ① 无 flex-wrap 的工具条（.bar / .tabs / .statusbar / .acts）——
        子项在手机上被压成一条细缝或直接顶破容器；
     ② 固定像素宽的下拉/面板（chat 的 .skill-panel 是 360px）；
     ③ 写死宽度的表单控件与不设滚动容器的表格（admin 后台）。
   这里用「全站通用」的方式兜住 ①（一次规则覆盖所有页面），②③ 由各页
   自己的媒体查询处理，避免用 !important 到处打补丁。
   ========================================================================== */
@media (max-width: 720px) {
  /* ① 工具条允许折行：折行总比溢出好，且不影响宽屏观感 */
  .bar, .tabs, .statusbar, .acts, .top-right, .row { flex-wrap: wrap; }
  /* 工具条内的「撑满」占位在折行后不应再抢一行 */
  .bar .flex, .statusbar .flex { flex: 1 1 100%; }
  /* 提示类文本在窄屏放开单行限制，否则会撑破父容器 */
  .bar .hint, .cost, .tiny { white-space: normal; }
  /* 固定 footer 类状态条的内边距跟随全局 gutter，避免 36px 在手机上浪费宽度 */
  .statusbar { padding: 10px var(--gutter); }
  /* 无滚动容器的表格也兜一层：保留列宽、允许横向滑动 */
  table { max-width: 100%; }
  .card > table:only-child, .editable table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
