/* JSON 预览 / 校验 —— 树视图样式(复用 style.css 的 chrome) */

/* ---------- 搜索框 ---------- */

.jt-search {
  flex: 0 1 260px;
  min-width: 160px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--card);
  color: var(--fg);
  padding: 7px 12px;
  font: 13.5px/1.3 inherit;
  font-family: inherit;
  outline: none;
}

.jt-search:focus { border-color: var(--accent); }

.jt-match {
  font-size: 12.5px;
  color: var(--accent-strong);
  background: var(--accent-weak);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.jt-match.none { color: var(--err-fg); background: var(--err-bg); }

/* ---------- 树容器 ---------- */

#tree {
  flex: 1;
  min-height: 380px;
  margin: 0;
  padding: 12px 14px 16px;
  overflow: auto;
  font-size: 13.5px;
  line-height: 1.6;
  tab-size: 2;
}

#tree.hint { color: var(--muted); white-space: pre-wrap; }

/* ---------- 行与缩进 ---------- */

.jt-row {
  display: flex;
  align-items: baseline;
  gap: 0;
  padding: 0 4px;
  border-radius: 6px;
  max-width: 100%;
}

.jt-row:hover { background: var(--accent-weak); }

.jt-caret {
  flex: none;
  width: 18px;
  border: none;
  background: none;
  color: var(--muted);
  font: 600 10px/1.6 inherit;
  cursor: pointer;
  padding: 0;
  text-align: center;
}

.jt-caret:hover { color: var(--accent-strong); }

.jt-caret.blank { visibility: hidden; cursor: default; }

.jt-key {
  color: var(--tk-key);
  cursor: copy;
  word-break: break-all;
}

.jt-key:active { opacity: .6; }

.jt-idx { color: var(--muted); cursor: copy; }

.jt-colon { color: var(--muted); margin-right: 6px; }

.jt-caret, .jt-colon, .jt-count { flex: none; }

.jt-key, .jt-val { min-width: 0; }

.jt-val { word-break: break-all; }

.jt-val.str { color: var(--tk-str); }
.jt-val.num { color: var(--tk-num); }
.jt-val.lit { color: var(--tk-lit); }
.jt-val.sym { color: var(--muted); }

.jt-count {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.jt-more {
  margin: 2px 0 2px 18px;
  border: 1px dashed var(--border-strong);
  background: none;
  color: var(--muted);
  font: 500 12.5px/1.5 inherit;
  font-family: inherit;
  padding: 2px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.jt-more:hover { color: var(--accent-strong); border-color: var(--accent); }

.jt-kids {
  margin-left: 17px;
  padding-left: 6px;
  border-left: 1px dashed var(--border);
}

.jt-kids[hidden] { display: none; }

/* 搜索命中高亮 */
mark {
  background: var(--accent-weak);
  color: var(--accent-strong);
  border-radius: 3px;
  padding: 0 1px;
}

/* 超长字符串截断提示 */
.jt-full { cursor: zoom-in; color: var(--muted); font-size: 12px; margin-left: 6px; white-space: nowrap; }
.jt-val.full-open { cursor: zoom-out; }

/* ---------- 复制路径 toast ---------- */

.jt-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--fg);
  color: var(--bg);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  max-width: 70vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 4px 18px rgba(9, 9, 11, .25);
}

@media (max-width: 860px) {
  #tree { min-height: 260px; }
  .jt-search { flex: 1 1 100%; }
}
