/* ============================================================
   起源计划 · 文字对比工作台样式（finddif3.html / finddif-full.html）
   依赖站点基础样式：assets/is46/is46-ui.css（.i46-chip 等）
                   与 CodeMirror 基础/merge 样式
   ============================================================ */

.fd-root {
  clear: both;
}

/* ---------- 工具栏 ---------- */
.fd-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  margin: 0 0 14px;
  background: #f6f8fc;
  border: 1px solid #e3e6ec;
  border-radius: 12px;
}
.fd-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.fd-grp {
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: .02em;
  margin-right: 2px;
  white-space: nowrap;
}
.fd-grow { flex: 1 1 auto; }
.fd-sep { width: 100%; height: 0; }

.fd-select {
  height: 34px;
  max-width: 100%;
  padding: 0 10px;
  font-size: 13px;
  color: #1f2430;
  background: #fff;
  border: 1px solid #d7dce5;
  border-radius: 8px;
  cursor: pointer;
}
.fd-select:focus-visible {
  outline: 2px solid var(--brand, #2563eb);
  outline-offset: 1px;
}
.fd-select-wide { min-width: 168px; }
.i46-chip input[type=file], .fd-open input[type=file] { display: none; }
.fd-open { cursor: pointer; }
.fd-open:hover { background: #e6ebf3; }

/* ---------- 差异区 ---------- */
.fd-stage {
  position: relative;
  clear: both;
}
.fd-merge-host {
  clear: both;
  overflow: hidden;
  border-radius: 8px;
}
.fd-merge-host .CodeMirror-merge {
  margin: 0 0 12px;
  box-sizing: border-box;
}
.fd-merge-host .CodeMirror {
  font-size: 13px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}
.fd-merge-host .CodeMirror-linenumber { font-size: 12px; }

/* 词级高亮：绿=新增，红=删除（带删除线），叠加在整行底色之上 */
/* 词级标记必须用半透明底色：CodeMirror 的选区（.CodeMirror-selected）画在文字层之下，
   实底色会把鼠标框选的蓝色盖掉，看起来像「选不中」。半透明后选区能透出来。 */
.fd-w-ins {
  background-color: rgba(31, 168, 86, .30);
  box-shadow: inset 0 -2px 0 rgba(28, 156, 77, .85);
  border-radius: 2px;
}
.fd-w-del {
  background-color: rgba(225, 72, 58, .26);
  box-shadow: inset 0 -2px 0 rgba(211, 59, 48, .85);
  border-radius: 2px;
  text-decoration: line-through;
  text-decoration-color: rgba(180, 40, 30, .65);
}

/* 选区本身：整行底色（#eef / #ffffe0）上原来那个淡紫几乎看不见，改成偏蓝的半透明 */
.fd-root .CodeMirror-selected { background: rgba(150, 170, 205, .45); }
.fd-root .CodeMirror-focused .CodeMirror-selected { background: rgba(96, 140, 235, .34); }
/* 注：整行差异底色（.CodeMirror-merge-*-chunk）画在 linebackground 层（z-index:0），
   本来就在选区之下，不需要动它——只有词级标记是文字层里的实底，才需要半透明。
   这里用 background-color 而不是 background 简写：同一个 span 上还挂着插件的
   .CodeMirror-merge-l-inserted / -deleted 条纹底图，简写会把那张图清掉。 */
.Codeirror-merge-hint { display: none; }

/* ---------- 拖拽提示 ---------- */
.fd-drop {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #1d4ed8;
  background: rgba(219, 234, 254, .88);
  border: 2px dashed #60a5fa;
  border-radius: 10px;
  pointer-events: none;
}
.fd-drop.is-on { display: flex; }

/* ---------- 统计条 ---------- */
.fd-statswrap { margin-top: 2px; }
.fd-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 4px 4px;
  font-size: 13px;
  color: #4b5563;
  border-top: 1px dashed #e3e6ec;
}
.fd-stat b { color: #1f2430; font-weight: 700; }
.fd-stat.is-add b { color: #15803d; }
.fd-stat.is-del b { color: #b91c1c; }
.fd-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fd-pos {
  min-width: 58px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #374151;
}
.fd-filehint {
  flex: 1 1 100%;
  font-size: 12.5px;
  color: #6b7280;
}
.fd-status {
  flex: 1 1 100%;
  min-height: 18px;
  font-size: 12.5px;
  color: #6b7280;
}
.fd-status.is-flash { color: #1d4ed8; }
.fd-loading {
  padding: 18px 0;
  font-size: 13px;
  color: #6b7280;
}
.fd-error {
  padding: 14px;
  margin: 10px 0;
  font-size: 13px;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
}

/* ---------- 独立全屏页 ---------- */
body.fd-full-body {
  margin: 0;
  background: #f2f4f9;
  color: #1f2430;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
.fd-full-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 10px 14px 14px;
  box-sizing: border-box;
}
.fd-full-shell .fd-root-full { flex: 1 1 auto; }
.fd-full-shell .fd-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  margin-bottom: 10px;
  box-shadow: 0 1px 10px rgba(15, 23, 42, .07);
}
.fd-full-shell .fd-stats { border-top-color: #d7dce5; }
.fd-full-foot {
  padding: 8px 2px 0;
  font-size: 12px;
  color: #8b95a6;
}
.fd-full-foot a { color: #6b7280; }
.fd-full-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
}
.fd-full-title h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: .01em;
}
.fd-full-title .fd-tag {
  font-size: 12px;
  color: #6b7280;
}

/* 浏览器原生全屏：只把工作台铺满屏幕，页头页脚留在外面 */
.fd-root:fullscreen,
.fd-root:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: 100vw;
  height: 100vh;
  padding: 10px 16px 14px;
  background: #f2f4f9;
  overflow: auto;
}
.fd-root:fullscreen .fd-bar,
.fd-root:-webkit-full-screen .fd-bar { position: static; margin-bottom: 10px; }
.fd-root:fullscreen .fd-stage,
.fd-root:-webkit-full-screen .fd-stage { flex: 0 0 auto; }
.fd-root:fullscreen .fd-statswrap,
.fd-root:-webkit-full-screen .fd-statswrap { margin-top: auto; }

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .fd-bar { padding: 10px; gap: 10px; }
  .fd-row { gap: 6px; }
  .fd-grp { flex: 1 1 100%; margin-top: 2px; }
  .i46-chip { min-height: 38px; }
  .fd-select { flex: 1 1 45%; }
  .fd-full-shell { padding: 8px 8px 12px; }
}

/* 手机档：三栏改为上下堆叠，左右两栏都能完整落在屏幕里 */
@media (max-width: 700px) {
  .fd-merge-host .CodeMirror-merge {
    height: auto !important;
    white-space: normal;
  }
  .fd-merge-host .CodeMirror-merge-pane {
    display: block;
    width: 100% !important;
    border-bottom: 1px solid #e3e6ec;
  }
  .fd-merge-host .CodeMirror-merge-pane-rightmost { position: static; }
  .fd-merge-host .CodeMirror-merge-gap {
    display: block;
    width: 100% !important;
    height: 22px !important;
    border: 0;
    border-left: 4px solid #dbe3f0;
    background: #f6f8fc;
  }
  .fd-merge-host .CodeMirror-merge-gap svg { display: none; }
  .fd-merge-host .CodeMirror-merge-scrolllock-wrap { top: 0; left: auto; right: 4px; bottom: auto; }
  .fd-merge-host .CodeMirror-merge-copybuttons-left,
  .fd-merge-host .CodeMirror-merge-copybuttons-right { display: none; }
  .fd-stats { gap: 6px 10px; }
  .fd-nav { flex: 1 1 100%; }
}
