/* ============================================================
   editor.css —— 题目录入 / 编辑页（统一编辑区）
   ------------------------------------------------------------
   视觉来自「题库试题编辑器-demo-合并编辑区.html」，但做了两件事：
     1) 所有类名统一 ue- 前缀 —— demo 直接用了 .btn/.card/.tabs/.star/.hint
        这类通用名，塞进本站会与 base.css / app.css 互相污染。
     2) 配色改用全站设计令牌（--brand/--surface/--border/--radius/--shadow），
        所以这个页面看起来是"本站的一个页面"，而不是一个外来 demo。

   浮层（公式工具条 / 插入面板 / 表格操作条）挂在 body 上，所以它们的选择器
   不能写在 .ue-page 作用域里，直接以 .ue-float / .ue-ins / .ue-tblbar 定位。
   ============================================================ */

/* hidden 必须真的隐藏：下面有几个容器是 flex，会盖掉浏览器默认的 [hidden] */
.ue-page [hidden],
.ue-float [hidden],
.ue-ins [hidden],
.ue-tblbar [hidden] { display: none !important; }

.ue-page { display: block; }

/* ---------------- 顶部动作条 ---------------- */

.ue-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-1);
}
.ue-bar-gap { flex: 1 1 auto; }
.ue-hist { min-width: 68px; }
.ue-draft {
  font-size: 12px;
  color: var(--text-3);
  padding-left: 4px;
  white-space: nowrap;
}

/* ---------------- 标签页 ---------------- */

.ue-tabs {  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.ue-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.ue-tab:hover { color: var(--brand); background: var(--brand-weak); }
.ue-tab.is-on {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 650;
}
.ue-tab:focus-visible { outline-offset: -2px; }

.ue-panel { display: block; }

/* ---------------- 卡片 ---------------- */

.ue-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  margin-bottom: 14px;
}
.ue-card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 10px;
}
.ue-card-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--brand);
  border-radius: 2px;
  flex: 0 0 auto;
}
.ue-req {
  font-size: 11px;
  font-weight: 500;
  color: var(--bad);
  background: var(--bad-weak);
  border: 1px solid #f3c3c5;
  border-radius: 4px;
  padding: 0 5px;
  line-height: 17px;
}
.ue-hint { color: var(--text-3); font-size: 12px; font-weight: 400; }
.ue-flabel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 7px;
}
.ue-tip {
  background: var(--brand-weak);
  color: var(--brand);
  border-radius: 4px;
  padding: 0 6px;
  font-size: 11px;
}

/* ---------------- 题型 / 难度 / 文理 单选行 ---------------- */

.ue-qtype,
.ue-radio-row,
.ue-chk-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.ue-qtype { margin-bottom: 16px; gap: 6px 18px; }
.ue-qtype label,
.ue-radio-row label,
.ue-chk-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 13.5px;
}
.ue-page input[type="radio"],
.ue-page input[type="checkbox"] { accent-color: var(--brand); }

/* ---------------- 统一编辑区 ---------------- */

.ue-input {
  min-height: 96px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 15px;
  line-height: 2.1;
  outline: none;
  overflow-wrap: break-word;
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.ue-input:hover { border-color: #b9c2cf; }
.ue-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.ue-input.is-sm { min-height: 56px; font-size: 14px; line-height: 1.95; }
.ue-input.ue-empty::before {
  content: attr(data-placeholder);
  color: #b5bdc9;
  pointer-events: none;
  font-size: 13px;
}
.ue-input.is-math-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .16);
}
.ue-input.is-drop { border-color: var(--brand); background: var(--brand-weak); }

/* 公式节点：渲染态 / 源码态 / 出错态 */
.ue-input .ue-fnode {
  display: inline-block;
  vertical-align: middle;
  padding: 1px 4px;
  margin: 0 1px;
  border-radius: 4px;
  background: #f4f8ff;
  box-shadow: 0 0 0 1px rgba(47, 111, 237, .16);
  cursor: pointer;
  user-select: none;
}
.ue-input .ue-fnode:hover {
  background: var(--brand-weak);
  box-shadow: 0 0 0 1px rgba(47, 111, 237, .5);
}
.ue-input .ue-fnode.is-error { color: var(--bad); }
.ue-input .ue-fnode.is-editing {
  background: #fff8e6;
  box-shadow: 0 0 0 1px #e0a13a;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  user-select: text;
  padding: 1px 5px;
}
.ue-input .ue-fnode.is-dirty {
  box-shadow: 0 0 0 1px #e0a13a, 0 0 0 4px rgba(224, 161, 58, .14);
}

/* 图片节点 */
.ue-input .ue-inode {
  display: block;
  width: 100%;
  padding: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  /* 拖拽手柄的定位锚点。手柄坐标是 JS 按图片真实渲染框算出来的绝对定位值 */
  position: relative;
}
.ue-input .ue-inode img {
  display: block;
  max-width: 100%;
  /* 与列表页 / 详情页（.content-img img）**引用同一个变量**：
     两处各写一个数，就是"同一张图两个大小"的老毛病。
     图片自身多大由 media.width（px，编辑器写）决定，这里只兜超高图。 */
  max-height: var(--img-max-h);
  border-radius: 4px;
  /* 拖动时别让浏览器把图片当成可拖拽对象（会触发原生 drag，拖出个幽灵图） */
  -webkit-user-drag: none;
  user-select: none;
}
/* 被「自由」模式拉过宽高比的图：宽高都已固定，max-height 只会截高度不截宽度
   ⇒ 压扁。所以把上限摘掉（阅读态 .content-img.is-sized 是同一条规则）。 */
.ue-input .ue-inode.is-sized img { max-height: none; }

/* ---- 拖拽手柄 ----
   只在选中时出现；锁定时只留右下角（右中 / 下中与它是同一件事）。
   半透明蓝方块，压在图片边线上 —— 与 Word / PPT 的手感一致。 */
.ue-input .ue-inode .ue-hdl { display: none; }
.ue-input .ue-inode.is-sel .ue-hdl {
  display: block;
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--brand);
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px var(--brand);
  z-index: 3;
}
.ue-input .ue-inode.is-sel .ue-hdl:hover { background: var(--brand-dark); }
.ue-page.is-lock .ue-input .ue-inode .ue-hdl[data-hdl="e"],
.ue-page.is-lock .ue-input .ue-inode .ue-hdl[data-hdl="s"] { display: none; }
/* 拖动期间整页换光标 —— pointermove 可能在 iframe / 图片上，光标不跟着走会很别扭 */
body.is-imgdrag,
body.is-imgdrag * { cursor: nwse-resize !important; }
.ue-input .ue-inode .ue-icap {
  display: block;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 5px;
  line-height: 1.6;
}
.ue-input .ue-inode:hover img { box-shadow: 0 0 0 2px rgba(47, 111, 237, .35); }
.ue-input .ue-inode.is-sel img { box-shadow: 0 0 0 2px var(--brand); }
.ue-input .ue-inode.is-loading {
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--brand);
  background: var(--brand-weak);
  border-radius: var(--radius-sm);
}
.ue-input .ue-inode.is-err { background: #fff5f5; box-shadow: 0 0 0 1px #f0c0c0; }
.ue-input .ue-inode.is-err img { display: none; }
.ue-input .ue-inode.is-err::after {
  content: "图片加载失败（文件可能已被清理）";
  display: block;
  font-size: 12px;
  color: var(--bad);
  text-align: center;
  padding: 12px 0;
}

/* 编辑区内的表格 */
.ue-input table.ue-table {
  border-collapse: collapse;
  margin: 6px 0;
  width: 100%;
  font-size: 14px;
  line-height: 1.9;
}
.ue-input table.ue-table th,
.ue-input table.ue-table td {
  border: 1px solid var(--border-strong);
  padding: 5px 10px;
  min-width: 44px;
  vertical-align: top;
  overflow-wrap: break-word;
}
.ue-input table.ue-table th {
  background: #f2f6fd;
  font-weight: 600;
  text-align: center;
}
.ue-input table.ue-table th:focus,
.ue-input table.ue-table td:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(47, 111, 237, .35);
}

/* ---------------- 选项行 ---------------- */

/* 排列方式：单选 / 多选共用同一设置，放在选项正上方单独一行，
   与选项行区分开，避免被当成"第 0 个选项" */
.ue-optlayout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.ue-optlayout-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.ue-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.ue-opt-key {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  margin-top: 13px;
}
.ue-opt .ue-input { flex: 1 1 auto; min-width: 0; }
.ue-opt-del {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--bad);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 8px 6px;
  margin-top: 7px;
  border-radius: var(--radius-sm);
}
.ue-opt-del:hover { background: var(--bad-weak); }
.ue-optfoot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

/* ---------------- 答案字母 ---------------- */

.ue-letters { display: flex; flex-wrap: wrap; gap: 8px; }
.ue-letter {
  appearance: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.ue-letter:hover { border-color: var(--brand); color: var(--brand); }
.ue-letter.is-on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---------------- 标签表 ---------------- */

.ue-tagtable {
  width: 100%;
  border-collapse: collapse;
}
.ue-tagtable th {
  width: 96px;
  text-align: left;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 10px 8px;
  border-bottom: 1px solid var(--surface-2);
  vertical-align: top;
  white-space: nowrap;
}
.ue-tagtable td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--surface-2);
}
.ue-tagtable tr:last-child th,
.ue-tagtable tr:last-child td { border-bottom: 0; }

.ue-stars { display: flex; gap: 2px; font-size: 20px; cursor: pointer; user-select: none; }
.ue-star { color: #d3d8e0; line-height: 1; }
.ue-star.is-on { color: #f0a020; }
.ue-star:hover { color: #f0a020; }

.ue-inline-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ue-inline {
  padding: 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  min-width: 0;
}
.ue-inline:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.ue-srcname { flex: 1 1 260px; }
.ue-srcyear { flex: 0 0 92px; }
.ue-grow { flex: 1 1 180px; }

/* ---------------- JSON 预览 ---------------- */

.ue-json {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 520px;
}

/* ---------------- 表单级提示 ---------------- */

.ue-notice:empty { display: none; }
.ue-notice { margin-top: 12px; }

/* ============================================================
   浮层 ①：公式工具条
   ============================================================ */

.ue-float {
  position: fixed;
  z-index: 900;
  width: 430px;
  max-width: calc(100vw - 16px);
  padding: 8px 10px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  visibility: hidden;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.ue-float.is-open { visibility: visible; opacity: 1; }
.ue-float .ue-fhead,
.ue-float .ue-mbtn,
.ue-float .ue-fbtn { pointer-events: auto; }

.ue-fhead {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 7px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--surface-2);
  cursor: move;
  user-select: none;
}
.ue-fdrag { color: #b9c2cf; font-size: 15px; line-height: 1; }
.ue-ftitle { font-size: 13px; font-weight: 650; color: var(--text); }
.ue-ftarget {
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-weak);
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.ue-facts { margin-left: auto; display: flex; gap: 4px; }
.ue-fbtn {
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 5px;
  color: var(--text-2);
}
.ue-fbtn:hover { border-color: var(--brand); color: var(--brand); }
.ue-fbtn.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

.ue-fbody { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.ue-mbtn {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: #fafbfc;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
}
.ue-mbtn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }

.ue-fpreview {
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  background: #fafbfc;
  border: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-3);
  display: none;
  min-height: 34px;
}
.ue-fpreview.is-on { display: block; }
.ue-fpbody { color: var(--text); font-size: 15px; margin-left: 6px; }
.ue-fhint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 9px;
  line-height: 1.6;
}
.ue-fhint b { color: var(--brand); }

/* ============================================================
   浮层 ②：插入内容（符号 / 图片 / 表格）
   ============================================================ */

.ue-ins {
  position: fixed;
  z-index: 920;
  width: 470px;
  max-width: calc(100vw - 16px);
  padding: 8px 10px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  visibility: hidden;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
/* 打开时才接管指针。**面板本体就要 pointer-events:auto** ——
   只靠下面那张"交互控件白名单"的话，新加一个类名忘了登记，
   控件就是"看得见、点不动"（点击直接穿透到底下的页面）。
   白名单保留作双保险，同时充当"哪些是交互件"的清单。 */
.ue-ins.is-open { visibility: visible; opacity: 1; pointer-events: auto; }
/* ⚠️ .ue-ins 基线是 pointer-events:none，靠下面这张白名单逐个子元素放开 ——
   新增任何可点/可拖的控件都必须登记进来，否则点击直接穿透到底下的页面
   （表现是"按钮看得见、点不动"，而且报错会指向别的元素）。
   .ue-lock（等比开关）就是踩过这一脚之后补上的。 */
.ue-ins .ue-fhead,
.ue-ins .ue-ins-tab,
.ue-ins .ue-ins-sym,
.ue-ins .ue-ins-cell,
.ue-ins .btn,
.ue-ins input,
.ue-ins select,
.ue-ins label,
.ue-ins .ue-ins-drop,
.ue-ins .ue-wbtn,
.ue-ins .ue-abtn,
.ue-ins .ue-lock { pointer-events: auto; }

.ue-ins-target {
  font-size: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 2px 4px;
  color: var(--brand);
  max-width: 150px;
  background: #f7faff;
}
.ue-ins-tabs {
  display: flex;
  gap: 4px;
  margin: 8px 0 2px;
  border-bottom: 1px solid var(--surface-2);
}
.ue-ins-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.ue-ins-tab.is-on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

.ue-ins-pages { display: block; }
.ue-ins-page { display: none; }
.ue-ins-page.is-on { display: block; }
.ue-ins-sectitle { font-size: 12px; color: var(--text-3); margin: 9px 0 5px; }
.ue-ins-syms { display: flex; flex-wrap: wrap; gap: 5px; }
.ue-ins-sym {
  width: 34px;
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: #fafbfc;
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  line-height: 1;
  padding: 0;
}
.ue-ins-sym:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }
.ue-ins-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 13px;
  flex-wrap: wrap;
}
.ue-ins-row > label { color: var(--text-2); white-space: nowrap; }
.ue-ins-sec { border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 4px; }
.ue-ins-drop {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  background: #fafbfc;
}
.ue-ins-drop.is-on { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }
.ue-ins-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; width: 224px; }
.ue-ins-cell {
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  cursor: pointer;
}
.ue-ins-cell.is-on { background: #cfe0ff; border-color: var(--brand); }
.ue-ins-dim { font-size: 12px; color: var(--brand); }
.ue-ins-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 9px;
  line-height: 1.65;
  border-top: 1px solid var(--surface-2);
  padding-top: 8px;
}
.ue-ins-hint b { color: var(--brand); }
.ue-wbtn,
.ue-abtn {
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
}
.ue-wbtn:hover,
.ue-abtn:hover { border-color: var(--brand); color: var(--brand); }
.ue-wbtn.is-on,
.ue-abtn.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- 尺寸数字框 + 等比开关 ----
   「宽 × 高 px」两个窄输入框；右边一个等比/自由开关。
   输入框宽度按 4 位数字给（4000px 够用了），太宽会把这一行挤到换行。 */
.ue-ins .ue-size {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ue-ins .ue-size-x,
.ue-ins .ue-size-u { color: var(--text-3); font-size: 12px; }
.ue-num {
  width: 52px;
  padding: 3px 5px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: var(--mono);
  text-align: center;
}
.ue-num:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-weak);
}
/* 数字框右侧的上下箭头（Chrome）会占掉半格宽度，去掉更紧凑 */
.ue-num::-webkit-outer-spin-button,
.ue-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ue-lock {
  margin-left: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
}
.ue-lock:hover { border-color: var(--brand); color: var(--brand); }
.ue-lock.is-on {
  background: var(--brand-weak);
  border-color: var(--brand);
  color: var(--brand-dark);
  font-weight: 600;
}

/* ============================================================
   浮层 ③：表格上下文操作条
   ============================================================ */

.ue-tblbar {
  position: fixed;
  z-index: 910;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-2);
  visibility: hidden;
  opacity: 0;
  transition: opacity .12s;
  pointer-events: none;
}
.ue-tblbar.is-open { visibility: visible; opacity: 1; }
.ue-tb-title { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.ue-tbbtn {
  padding: 3px 8px;
  font-size: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  pointer-events: auto;
}
.ue-tbbtn:hover { border-color: var(--brand); color: var(--brand); }
.ue-tbbtn.is-danger { color: var(--bad); border-color: #f0c0c0; }
.ue-tbbtn.is-danger:hover { background: #fff5f5; border-color: var(--bad); }
.ue-tb-sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; }

/* ============================================================
   窄屏 / 移动端
   ============================================================ */

@media (max-width: 860px) {
  .ue-bar {
    position: static;
    gap: 6px;
    padding: 9px 10px;
  }
  .ue-bar-gap { display: none; }
  .ue-draft { margin-left: auto; }
  .ue-tab { padding: 9px 13px; font-size: 13.5px; }
  .ue-card { padding: 14px; }
  .ue-input { font-size: 14.5px; line-height: 2; }
  .ue-tagtable th {
    display: block;
    width: auto;
    border-bottom: 0;
    padding: 12px 0 2px;
  }
  .ue-tagtable td { display: block; padding: 0 0 8px; }
  .ue-opt-key { display: none; }
  .ue-opt { gap: 6px; }
  .ue-letter { width: 34px; height: 34px; }
  .ue-float,
  .ue-ins { width: calc(100vw - 16px); }
  .ue-ins-grid { width: 100%; max-width: 224px; }
}

@media (max-width: 560px) {
  .ue-tabs { overflow-x: auto; }
  .ue-tab { white-space: nowrap; }
  .ue-srcname,
  .ue-srcyear { flex: 1 1 100%; }
  .ue-ins-sym { width: 31px; height: 28px; font-size: 14px; }
}

/* ---------------- 标签字典的行内维护 ----------------
   「试题标签」页顶部一条工具条（说明 + 两个入口），每个分类轴
   下面是勾选区 + "新增标签"小工具条。编辑模式下每个标签变成
   一个可点改名、可删的小胶囊。 */

.ue-taghead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.ue-taghead .ue-hint { flex: 1 1 220px; min-width: 0; }

.ue-tagtools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.ue-tagtools:empty { display: none; }

.ue-tagin {
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  min-width: 0;
  flex: 0 1 148px;
}
.ue-tagin:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.ue-tagin::placeholder { color: var(--text-3); }

.ue-tagmsg { font-size: 12px; color: var(--text-3); }
.ue-tagmsg.is-bad { color: var(--bad); }

/* 编辑模式下的单个标签：名字可点、右侧一个删除叉 */
.ue-tagchip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 4px 1px 7px;
}
.ue-tagname {
  border: 0;
  background: none;
  padding: 0 2px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: text;
}
.ue-tagname:hover { color: var(--brand-dark); text-decoration: underline; }

.ue-tagdel {
  border: 0;
  background: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 999px;
}
.ue-tagdel:hover { color: #fff; background: var(--bad); }

/* ---------------- 已停用的题型 / 难度 / 标签 ----------------
   这些项**只会在一种情况下出现**：编辑一道老题，而它挂的题型/难度/标签
   后来被停用了（见 qform.js 的 withCurrent 与 ue-editor 的 tagVisible）。
   所以这里要"看得见但别碍事"：降对比度 + 虚线，并明确写出「已停用」，
   让用户明白"这是历史值，不是新可选的值" —— 而不是以为界面漏了一项。 */
.ue-opt-off {
  opacity: .62;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1px 7px;
  margin: 0 -2px;
}

/* 整轴停用时，该行只显示"已选中的那些标签"，整行降饱和 */
.ue-row-off { background: var(--surface-2); }
.ue-row-off th { color: var(--text-3); }

@media (max-width: 640px) {
  .ue-tagin { flex: 1 1 100%; }
  .ue-tagtools .btn { flex: 0 0 auto; }
}

/* ---------------- 知识目录（录入表单里的多选） ----------------
   与标签行共用一套视觉语言：上面一排 chip 是"已选"，下面折叠面板是"可选"。
   差别只有一处：这里允许多选且**取并集**（勾父目录 = 连子目录的题一起算），
   所以面板里保留完整层级，不做"选中即收起"。 */

.ue-kn-picked {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin-bottom: 8px;
}
.ue-kn-picked:empty { display: none; }

/* 已选 chip：与 .ue-tagchip 同形，但内容不可编辑（节点改名在知识目录页做） */
.ue-kn-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 4px 1px 8px;
  font-size: 13px;
  color: var(--text);
  max-width: 100%;
}
.ue-kn-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.ue-kn-chip button {
  border: 0;
  background: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 999px;
  flex: 0 0 auto;
}
.ue-kn-chip button:hover { color: #fff; background: var(--bad); }

.ue-inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ue-inline-row .ue-hint { min-width: 0; }

/* 折叠面板：和标签行一样嵌在 <td> 里，宽度受限，所以自己带滚动 */
.ue-kn-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ue-kn-filter {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  margin-bottom: 8px;
}
.ue-kn-filter:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.ue-kn-filter::placeholder { color: var(--text-3); }
/* 去掉 type=search 在各家浏览器里自带的那个"×"，它和面板整体风格不搭 */
.ue-kn-filter::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.ue-kn-list {
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.ue-kn-ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* 子级缩进用 padding 而非 margin：整行可点，行宽要撑满 */
.ue-kn-ul .ue-kn-ul {
  padding-left: 18px;
  border-left: 1px dashed var(--border);
  margin-left: 7px;
}

.ue-kn-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.ue-kn-opt:hover { background: var(--surface); }
.ue-kn-opt input { flex: 0 0 auto; margin: 0; cursor: pointer; }
.ue-kn-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .ue-kn-list { max-height: 240px; }
  .ue-kn-chip > span { max-width: 140px; }
}

