/* ---------- 题干里的答题框：纯文本编辑 ---------- */

.blank-edit {
  display: inline-block;
  min-width: 46px;
  min-height: 20px;
  padding: 0 5px;
  margin: 0 2px;
  border: 1px dashed #A9BCC7;
  border-radius: 5px;
  background: #F8FBFC;
  vertical-align: -4px;
  cursor: text;
  transition: border-color .12s, background .12s;
}
.blank-edit:hover { border-color: #1C6E85; background: #EDF6F9; }
.blank-edit:focus-within {
  border-style: solid;
  border-color: #1C6E85;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(28,110,133,0.10);
}
.blank-edit .tok-inner {
  display: inline-block;
  min-width: 36px;
  min-height: 16px;
  outline: none;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  vertical-align: middle;
}
.blank-edit .tok-inner sub { font-size: 0.72em; }
.blank-edit .tok-inner sup { font-size: 0.72em; }

/* ---------- 工具内的编辑区 ---------- */

.tok { position: relative; min-height: 38px; border: 1px solid #D5DFE6; border-radius: 7px; padding: 6px 8px; background: #fff; }
.tok:focus-within { border-color: #1C6E85; box-shadow: 0 0 0 3px rgba(28,110,133,0.10); }
.tok-inner { outline: none; min-height: 22px; font-size: 16px; line-height: 1.45; white-space: pre-wrap; word-break: break-all; padding-top: 0.5em; }
.tok-inner sub { font-size: 0.7em; }
.tok-inner sup { font-size: 0.7em; }
/* 化合价：排在元素符号正上方，不占正文宽度 */
.tok-cv { position: relative; display: inline-block; }
.tok-val {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 100%; margin-bottom: -0.1em;
  font-size: 0.68em; line-height: 1; color: #1C6E85; font-weight: 500;
  white-space: nowrap; pointer-events: none; user-select: none;
}
.tok.is-empty::after { content: attr(data-placeholder); position: absolute; left: 9px; top: 7px; color: #C3CFD8; font-size: 13px; pointer-events: none; }

/* ---------- 编辑区：普通输入框 + 只读预览（2026-10-30） ----------
 * 安卓上 contenteditable 跟输入法打架（打一个字母出来一串），
 * 改成普通 input 打字、下面一行只读预览显示上下标效果。
 */
.tok-input {
  display: block;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: inherit;
  padding: 2px 0;
  -webkit-appearance: none;
  appearance: none;
}
.tok-input::placeholder { color: #C3CFD8; font-size: 13px; }
.tok-preview {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed #E3ECF1;
  font-size: 15px;
  line-height: 1.7;
  color: #1C6E85;
  word-break: break-all;
}
.tok-preview:empty { display: none; }
.tok-preview sub { font-size: 0.7em; }
.tok-preview sup { font-size: 0.7em; }
.tok-preview .tok-cv { position: relative; display: inline-block; }
.tok-preview .tok-val {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100%;
  margin-bottom: -0.1em;
  font-size: 0.68em;
  line-height: 1;
  color: #1C6E85;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* ---------- 上下标小键盘 ---------- */
.ft-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px;
  border-top: 1px solid #EDF2F5;
  background: #F4F9FB;
}
.ft-pad[hidden] { display: none; }
.ft-pad-btn { min-width: 36px; font-size: 14px; }

/* ---------- 化学式工具：可拖动的小卡片 ---------- */

.ft-card {
  position: fixed;
  width: 320px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #DCE5EB;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(20,60,80,0.16);
  z-index: 60;
  overflow: hidden;
  touch-action: none;
}
.ft-card.is-collapsed { width: auto; }

.ft-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: #1C6E85;
  color: #fff;
  cursor: grab;
  user-select: none;
}
.ft-head:active { cursor: grabbing; }
.ft-card.is-collapsed .ft-head { border-radius: 11px; }
.ft-title { font-size: 13px; font-weight: 500; white-space: nowrap; }
.ft-target { font-size: 11px; color: rgba(255,255,255,0.72); margin-left: auto; white-space: nowrap; }
.ft-target.is-on { color: #fff; }
.ft-chevron {
  width: 7px;
  height: 7px;
  flex: none;
  margin-left: 4px;
  border-right: 1.6px solid #fff;
  border-bottom: 1.6px solid #fff;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s;
}
.ft-card:not(.is-collapsed) .ft-chevron { transform: rotate(-135deg) translateY(-2px); }

.ft-content[hidden] { display: none; }
.ft-content { display: flex; flex-direction: column; min-height: 0; }

.ft-tabs { display: flex; gap: 3px; padding: 8px 10px 0; }
.ft-tab { flex: 1; border: 1px solid #E3EAF0; background: #FBFDFE; color: #6b7a89; border-radius: 6px 6px 0 0; padding: 5px 0; font-size: 12px; cursor: pointer; font-family: inherit; }
.ft-tab.is-active { background: #fff; color: #1C6E85; border-color: #D5DFE6; border-bottom-color: #fff; font-weight: 500; }

.ft-body { padding: 10px; border-top: 1px solid #D5DFE6; margin-top: -1px; overflow-y: auto; }
.ft-pane[hidden] { display: none; }

.ft-eq { display: flex; align-items: center; gap: 4px; }
.ft-zone { flex: 1; min-width: 0; }
.ft-zone .tok { min-height: 46px; }
.ft-sign { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ft-bar { display: block; width: 34px; height: 6px; border-top: 1.6px solid #1d2733; border-bottom: 1.6px solid #1d2733; }
.ft-cond { width: 78px; height: 16px; border: 1px solid transparent; border-radius: 4px; background: transparent; text-align: center; font-family: inherit; font-size: 10.5px; color: #46586a; padding: 0; }
.ft-cond::placeholder { color: #C3CFD8; }
.ft-cond:hover { background: #F7FAFC; }
.ft-cond:focus { outline: none; background: #EAF4F8; border-color: #B9D4DE; }
.ft-tip { font-size: 11px; color: #8b98a5; margin: 6px 0 0; line-height: 1.5; }

.ft-tools { display: flex; align-items: center; gap: 5px; padding: 8px 10px; border-top: 1px solid #EDF2F5; background: #FAFCFD; flex-wrap: wrap; }
.ft-btn {
  border: 1px solid #D5DFE6;
  background: #fff;
  color: #46586a;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}
.ft-btn:hover { border-color: #1C6E85; color: #1C6E85; background: #F1F8FA; }
.ft-script.is-on { background: #1C6E85; border-color: #1C6E85; color: #fff; }
.ft-divider { width: 1px; height: 16px; background: #E3EAF0; margin: 0 1px; }
.ft-symbols { display: flex; gap: 4px; flex-wrap: wrap; }
.ft-symbol { width: 28px; padding: 4px 0; text-align: center; font-size: 13px; }

.ft-error { margin: 0 10px 8px; padding: 6px 8px; background: #FDF0EF; border: 1px solid #F0D4D1; border-radius: 5px; color: #A32D2D; font-size: 11.5px; }
.ft-error[hidden] { display: none; }

.ft-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 10px 10px; }
.ft-ok { border: 0; background: #1C6E85; color: #fff; padding: 6px 14px; border-radius: 6px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.ft-ok:hover { background: #175a6c; }
.ft-ghost { border: 1px solid #D5DFE6; background: #fff; color: #46586a; padding: 6px 12px; border-radius: 6px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.ft-ghost:hover { border-color: #B9D4DE; }
