:root {
  --ink: #1a2f28;
  --ink-soft: #3d5349;
  --paper: #f7f1e6;
  --paper-edge: #e6dcc9;
  --sand: #d9cbb3;
  --accent: #b85c38;
  --accent-deep: #8f3f22;
  --bar: #243d34;
  --bar-2: #2f4d42;
  --line: rgba(26, 47, 40, 0.12);
  --shadow: 0 18px 50px rgba(26, 47, 40, 0.18);
  --font-ui: "UKIJ Tuz Tom", "Microsoft Uighur", "Segoe UI", sans-serif;
  --font-doc: "UKIJ Tuz Tom", "Microsoft Uighur", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(184, 92, 56, 0.18), transparent 55%),
    linear-gradient(160deg, #cbb89a 0%, #b7a588 45%, #a89372 100%);
  color: var(--ink);
  font-family: var(--font-ui);
}

body {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100%;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--bar) 0%, var(--bar-2) 100%);
  color: #f4eee4;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #f0d7b8, #b85c38 55%, #1a2f28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
  animation: mark-in 0.8s ease both;
}

.brand-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.78rem;
  opacity: 0.78;
  margin-top: 2px;
}

.file-actions {
  display: flex;
  gap: 6px;
  justify-self: center;
}

.file-actions button,
.toolbar button,
.toolbar select {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #f4eee4;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.file-actions button:hover,
.toolbar button:hover {
  background: rgba(255,255,255,0.14);
}

.file-actions button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff8f2;
}

.file-actions button.primary:hover {
  background: var(--accent-deep);
}

.doc-title {
  justify-self: end;
  font-size: 0.9rem;
  opacity: 0.85;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(36, 61, 52, 0.92);
  border-bottom: 1px solid rgba(0,0,0,0.15);
  backdrop-filter: blur(8px);
}

.toolbar select {
  background: #1a2f28;
  min-width: 140px;
}

.toolbar .sep {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.18);
  margin: 0 4px;
}

.toolbar button.active {
  background: var(--accent);
  border-color: #f0c9a8;
  color: #fff8f2;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.toolbar button[data-cmd="bold"].active,
.toolbar button[data-cmd="italic"].active,
.toolbar button[data-cmd="underline"].active {
  background: #c45f38;
  border-color: #f4d2b4;
}

.toolbar .icon-btn {
  width: 34px;
  height: 30px;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toolbar .align-group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  direction: ltr;
  unicode-bidi: isolate;
}

.toolbar .icon-btn svg {
  width: 18px;
  height: 14px;
  display: block;
  /* LTR 图标语义，不随界面 RTL 镜像 */
  direction: ltr;
  unicode-bidi: isolate;
}

.toolbar .icon-btn svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage {
  overflow: auto;
  padding: 28px 16px 40px;
  display: flex;
  justify-content: center;
  animation: stage-in 0.55s ease both;
  /* 页面为 RTL 时滚动条会在左边；滚动容器用 LTR，把滚动条固定在右边 */
  direction: ltr;
}

.pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 100%;
  direction: rtl;
}

.page-shadow {
  box-shadow: var(--shadow);
  border-radius: 2px;
}

.page,
.sheet {
  --type-size: 14pt;
  width: min(794px, 96vw);
  min-height: 1123px;
  height: auto;
  background:
    linear-gradient(180deg, #fffaf2 0%, var(--paper) 40%, #f3eadc 100%);
  color: var(--ink);
  padding: 72px 68px;
  outline: none;
  font-family: var(--font-doc);
  font-size: var(--type-size);
  line-height: 1.9;
  text-align: right; /* 维文默认靠右；两端对齐可再点工具栏 */
  direction: rtl;
  unicode-bidi: embed;
  border: 1px solid var(--paper-edge);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
  font-feature-settings: "liga" 1, "calt" 1, "ccmp" 1, "kern" 1;
  font-variant-ligatures: common-ligatures contextual;
  text-rendering: optimizeLegibility;
  letter-spacing: normal;
  word-spacing: normal;
  font-kerning: normal;
  overflow: visible;
}

.sheet img.doc-img,
.page img.doc-img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  border-radius: 2px;
  box-shadow: 0 2px 10px rgba(26, 47, 40, 0.12);
}

.sheet table.doc-table,
.page table.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0;
}

.doc-page-break {
  display: none;
}

.page-num {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  opacity: 0.7;
  pointer-events: none;
  direction: ltr;
}

.page-shadow {
  position: relative;
}

.page[dir="rtl"],
.page[dir="rtl"] p,
.page[dir="rtl"] h1,
.page[dir="rtl"] h2,
.page[dir="rtl"] h3 {
  direction: rtl !important;
  unicode-bidi: embed;
}

.page[dir="ltr"],
.page[dir="ltr"] p,
.page[dir="ltr"] h1,
.page[dir="ltr"] h2,
.page[dir="ltr"] h3 {
  direction: ltr !important;
  unicode-bidi: embed;
}

.toolbar .dir-group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  direction: ltr;
  unicode-bidi: isolate;
}

.toolbar .dir-btn {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  direction: ltr;
  unicode-bidi: isolate;
  min-width: 34px;
  padding: 4px 8px;
}

.toolbar .dir-btn:disabled,
.toolbar .dir-btn.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar .ime-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-inline: 10px 12px;
}

.toolbar .ime-swap-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: block;
  direction: ltr;
  unicode-bidi: isolate;
}

.toolbar .stt-group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  direction: ltr;
  unicode-bidi: isolate;
  max-width: 16rem;
  vertical-align: middle;
}

.toolbar .stt-group select {
  max-width: 7.2rem;
  font-size: 0.78rem;
}

.toolbar .stt-tip {
  font-size: 0.65rem;
  line-height: 1.15;
  color: #9a3412;
  font-weight: 500;
  white-space: nowrap;
  max-width: 5.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 1em;
}

.toolbar .stt-tip.is-ok {
  color: #166534;
}

.toolbar .stt-tip.is-warn {
  color: #9a3412;
}

.toolbar .mic-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}

.toolbar .mic-btn.listening {
  color: #fff;
  background: #c2410c;
  border-color: #9a3412;
  box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.45);
  animation: edit-mic-pulse 1.2s ease-out infinite;
}

@keyframes edit-mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(194, 65, 12, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(194, 65, 12, 0); }
  100% { box-shadow: 0 0 0 0 rgba(194, 65, 12, 0); }
}

.page p {
  margin: 0 0 0.65em;
}

/* 禁止浏览器遗留的 font size=1..7 把字撑到超大 */
.page font {
  font-size: inherit;
}

.page:focus {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.5),
    0 0 0 2px rgba(184, 92, 56, 0.25);
}

.page ::selection {
  background: rgba(184, 92, 56, 0.28);
  color: inherit;
}

/* Ctrl+A 跨页全选时的视觉反馈 */
.sheet.doc-all-selected {
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.5),
    0 0 0 2px rgba(184, 92, 56, 0.45);
  background:
    linear-gradient(180deg, rgba(184, 92, 56, 0.12), rgba(184, 92, 56, 0.08)),
    linear-gradient(180deg, #fffaf2 0%, var(--paper) 40%, #f3eadc 100%);
}

.sheet.doc-all-selected p,
.sheet.doc-all-selected h1,
.sheet.doc-all-selected h2,
.sheet.doc-all-selected h3,
.sheet.doc-all-selected td,
.sheet.doc-all-selected th,
.sheet.doc-all-selected li {
  background: rgba(184, 92, 56, 0.18);
}

.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  font-size: 0.82rem;
  background: rgba(26, 47, 40, 0.92);
  color: #e8dfd0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.status-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.status-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  color: #f0e6d6;
}

.status-stats .stat-sep {
  opacity: 0.35;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.page-jump input {
  width: 3.2rem;
  padding: 2px 4px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(0,0,0,0.25);
  color: #fff8f0;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  text-align: center;
  direction: ltr;
}

.page-jump input:focus {
  outline: 1px solid rgba(184, 92, 56, 0.7);
  border-color: transparent;
}

.status #statusPath {
  opacity: 0.7;
  direction: ltr;
  unicode-bidi: plaintext;
  max-width: 28%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: end;
}

#imeStatus.ime-on {
  color: #f0c9a8;
}
#imeStatus.ime-off {
  opacity: 0.55;
}

/* 打开中遮罩（超过约 1 秒才显示） */
.busy-overlay[hidden] {
  display: none !important;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 47, 40, 0.45);
  backdrop-filter: blur(3px);
  animation: busy-fade 0.2s ease both;
}

.busy-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 36px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fffaf2, #f3eadc);
  color: var(--ink);
  box-shadow: var(--shadow);
  min-width: 200px;
}

.busy-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(26, 47, 40, 0.15);
  border-top-color: var(--accent);
  animation: busy-spin 0.75s linear infinite;
}

.busy-text {
  font-family: var(--font-ui);
  font-size: 1.05rem;
}

@keyframes busy-spin {
  to { transform: rotate(360deg); }
}

@keyframes busy-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mark-in {
  from { transform: scale(0.7) rotate(-8deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@keyframes stage-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— 自定义确认框（ھەئە / ياق） —— */
.ug-dialog[hidden] {
  display: none !important;
}

.ug-dialog {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ug-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 47, 40, 0.45);
}

.ug-dialog-box {
  position: relative;
  width: min(440px, 92vw);
  background: #f7f1e6;
  color: #1a2f28;
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  padding: 18px 18px 14px;
  border: 1px solid #e6dcc9;
  animation: stage-in 0.2s ease both;
}

.ug-dialog-msg {
  margin: 0 0 16px;
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  direction: rtl;
  text-align: right;
}

.ug-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
}

.ug-btn-yes,
.ug-btn-no {
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", sans-serif;
  font-size: 1rem;
  min-width: 88px;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.ug-btn-yes {
  background: #b85c38;
  color: #fff8f2;
}

.ug-btn-yes:hover {
  background: #8f3f22;
}

.ug-btn-no {
  background: #fff;
  color: #1a2f28;
  border-color: #cbb89a;
}

.ug-btn-no:hover {
  background: #f0e8da;
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  .brand, .file-actions, .doc-title { justify-self: stretch; }
  .page { padding: 40px 28px; min-height: 80vh; }
}

/* —— 手写识别面板（قەلەم） —— */
.hw-dialog[hidden] {
  display: none !important;
}

.hw-dialog {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hw-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 47, 40, 0.45);
}

.hw-dialog-box {
  position: relative;
  width: min(680px, 94vw);
  background: #f7f1e6;
  color: #1a2f28;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  padding: 18px;
  border: 1px solid #e6dcc9;
  animation: stage-in 0.2s ease both;
}

.hw-dialog-title {
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", sans-serif;
  font-size: 1.05rem;
  margin: 0 0 12px;
  text-align: center;
}

.hw-lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", sans-serif;
  font-size: 0.95rem;
}

.hw-lang-row select {
  font-size: 0.95rem;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid #cbb89a;
  background: #fff;
  color: #1a2f28;
}

.hw-lang-hint {
  font-size: 0.8rem;
  color: #7a6a50;
}

.hw-canvas-wrap {
  background: #fff;
  border: 2px dashed #cbb89a;
  border-radius: 10px;
  overflow: hidden;
}

#hwCanvas {
  display: block;
  width: 100%;
  height: 220px;
  touch-action: none;
  /* 真实感铅笔光标:石墨尖+木颈+多层圆柱笔身+金属箍+粉橡皮(48px, 热点在笔尖 7,40) */
  cursor: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2748%27%20height%3D%2748%27%20viewBox%3D%270%200%2048%2048%27%3E%3Cg%20transform%3D%27translate%2823.97%2023.03%29%20rotate%2845%29%27%3E%3Cpolygon%20points%3D%270%2C24%204.6%2C19.5%204.6%2C28.5%27%20fill%3D%27%23232328%27%2F%3E%3Cpolygon%20points%3D%274.6%2C19.5%204.6%2C28.5%206.8%2C20.5%206.8%2C27.5%27%20fill%3D%27%23e8c078%27%2F%3E%3Crect%20x%3D%276.8%27%20y%3D%2719.5%27%20width%3D%2725.7%27%20height%3D%279%27%20fill%3D%27%23f2a93b%27%2F%3E%3Crect%20x%3D%276.8%27%20y%3D%2719.5%27%20width%3D%2725.7%27%20height%3D%272.0%27%20fill%3D%27%23ffd98a%27%2F%3E%3Crect%20x%3D%276.8%27%20y%3D%2721.5%27%20width%3D%2725.7%27%20height%3D%271.4%27%20fill%3D%27%23ffc65c%27%2F%3E%3Crect%20x%3D%276.8%27%20y%3D%2725.4%27%20width%3D%2725.7%27%20height%3D%272.0%27%20fill%3D%27%23d18a1d%27%2F%3E%3Crect%20x%3D%276.8%27%20y%3D%2727.4%27%20width%3D%2725.7%27%20height%3D%271.1%27%20fill%3D%27%23a86a12%27%2F%3E%3Crect%20x%3D%2732.5%27%20y%3D%2719.8%27%20width%3D%273%27%20height%3D%278.4%27%20fill%3D%27%23aab2ba%27%2F%3E%3Crect%20x%3D%2732.5%27%20y%3D%2719.8%27%20width%3D%273%27%20height%3D%271.8%27%20fill%3D%27%23e8edf2%27%2F%3E%3Crect%20x%3D%2732.5%27%20y%3D%2726.4%27%20width%3D%273%27%20height%3D%271.8%27%20fill%3D%27%237d8791%27%2F%3E%3Crect%20x%3D%2735.5%27%20y%3D%2720.6%27%20width%3D%276.4%27%20height%3D%276.8%27%20rx%3D%271.8%27%20fill%3D%27%23f08fa7%27%2F%3E%3Crect%20x%3D%2735.5%27%20y%3D%2720.6%27%20width%3D%276.4%27%20height%3D%272.0%27%20rx%3D%271.6%27%20fill%3D%27%23fbc8d2%27%2F%3E%3Crect%20x%3D%2735.5%27%20y%3D%2725.4%27%20width%3D%276.4%27%20height%3D%272.0%27%20rx%3D%271.4%27%20fill%3D%27%23d56c87%27%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 7 40, crosshair;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0 58px,
      rgba(200, 180, 150, 0.25) 58px 59px
    );
}

.hw-result {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #cbb89a;
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", sans-serif;
  font-size: 1.4rem;
  text-align: center;
  direction: rtl;
}

.hw-result.hw-result-err {
  color: #a33;
  font-size: 1rem;
}

.hw-cands {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
}

.hw-cands .hw-cand {
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", sans-serif;
  font-size: 1.05rem;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #cbb89a;
  background: #fff;
  color: #1a2f28;
  cursor: pointer;
  direction: rtl;
}

.hw-cands .hw-cand:hover {
  background: #f0e8da;
  border-color: #b85c38;
}

.hw-cands .hw-cand-rank {
  font-size: 0.7rem;
  color: #a8875f;
  margin-left: 6px;
  direction: ltr;
}

.hw-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.hw-dialog-actions .ug-btn-yes:disabled,
.hw-dialog-actions .ug-btn-no:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hw-btn.listening {
  color: #b85c38;
}


/* ===== 翻译审阅模式 ===== */
body.mode-translate {
  overflow: auto;
  height: auto;
  min-height: 100%;
}
body.mode-edit {
  overflow: hidden;
  height: 100%;
}

.mode-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(36, 61, 52, 0.96);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mode-btn {
  border: 1px solid rgba(244,238,228,0.28);
  background: transparent;
  color: #f4eee4;
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}
.mode-btn.active {
  background: rgba(184, 92, 56, 0.92);
  border-color: transparent;
}

.tr-panel {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  direction: ltr;
  text-align: left;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.tr-hero {
  margin: 0.5rem 0 1.25rem;
}
.tr-brand {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.tr-lead {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 42rem;
}
.tr-card {
  background: rgba(247, 241, 230, 0.92);
  border: 1px solid var(--paper-edge);
  border-radius: 14px;
  padding: 1rem 1.15rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.tr-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}
.tr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.tr-pick {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}
.tr-pick input { display: none; }
.tr-pick-btn,
.tr-primary,
.tr-ghost {
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font: inherit;
  cursor: pointer;
}
.tr-pick-btn,
.tr-primary {
  background: #2f4d42;
  color: #f4eee4;
}
.tr-ghost {
  background: transparent;
  border: 1px solid rgba(26,47,40,0.28);
  color: var(--ink);
}
.tr-pick-name,
.tr-hint {
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.tr-opts label { display: inline-flex; align-items: center; gap: 0.35rem; }
.tr-opts select {
  margin-inline-start: 0.35rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--paper-edge);
  background: #fff;
}
.tr-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(26,47,40,0.12);
  overflow: hidden;
}
.tr-progress-track > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2f4d42, #b85c38);
}
.tr-progress p { margin: 0.45rem 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.tr-review-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.tr-review-bar h2 { margin: 0; }
.tr-review-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tr-review-list { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 0.85rem; }
.tr-pair {
  border: 1px solid var(--paper-edge);
  border-radius: 12px;
  background: #fffdf8;
  overflow: hidden;
}
.tr-pair-head {
  padding: 0.4rem 0.75rem;
  background: rgba(36,61,52,0.08);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.tr-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
@media (max-width: 860px) {
  .tr-cols { grid-template-columns: 1fr; }
}
.tr-col { padding: 0.65rem 0.75rem 0.85rem; min-width: 0; }
.tr-src-col { border-inline-end: 1px solid var(--paper-edge); }
.tr-label {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.tr-src {
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--ink);
  font-size: 0.98rem;
}
.tr-ug {
  white-space: pre-wrap;
  line-height: 1.7;
  min-height: 3.2rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(184,92,56,0.35);
  background: #fff;
  font-family: "UKIJ Tuz Tom", "Microsoft Uighur", "Noto Sans Arabic", sans-serif;
  font-size: 1.05rem;
  outline: none;
}
.tr-ug:focus { border-color: #b85c38; box-shadow: 0 0 0 2px rgba(184,92,56,0.18); }
.tr-empty { color: var(--ink-soft); }
