/* ---- OneLine Markdown: minimal add-on ---- */
.editor {
  background: #0f1115;
  border: 1px solid #e6e8ef;
  border-radius: 10px;
}

.editor textarea#md {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: #eee;
  padding: 14px;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
}

.preview {
  background: var(--panel, #fff);
  border: 1px solid var(--border, #e6e8ef);
  border-radius: 10px;
  min-height: 60vh;
  overflow: auto;
}

.markdown-body {
  padding: 18px 22px;
  color: var(--text, #1c2333);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  border-bottom: 1px dashed var(--border, #e6e8ef);
  padding-bottom: 4px;
}

.markdown-body pre {
  background: var(--code-bg, #0b0e14);
  border: 1px solid var(--border, #232737);
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
}

.markdown-body code {
  background: var(--code-bg, #0b0e14);
  padding: 2px 5px;
  border-radius: 6px;
  border: 1px solid var(--border, #232737)
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent, #4f8cff);
  margin: 8px 0;
  padding: 6px 12px;
  color: var(--color-muted, #5b6270);
  background: var(--bg-soft, #f7f8fb);
  border-radius: 10px;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid var(--border, #e6e8ef);
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border, #e6e8ef);
  padding: 8px;
  text-align: left;
}

.markdown-body img {
  max-width: 100%;
}

.form-group .muted {
  display: inline-flex;
  align-items: center;
  color: var(--color-muted, #5b6270);

}

.form-group .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: transparent;
  border: none;
  outline: none;
  color: var(--color-primary);
  border-radius: 8px;
}

.form-group .btn:hover {
  background-color: #e6e8ef;
}

.form-group .btn i {
  font-size: 14px;
  line-height: 1;
}

/* 让取色器更紧凑贴合按钮 */
.form-group .btn input[type="color"] {
  width: 1.75rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  background: transparent;
  appearance: none;
  cursor: pointer;
}

.form-group .btn input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-group .btn input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border, #e6e8ef);
  border-radius: 4px;
}

.code-editor {
  position: relative;
  width: 100%;
  height: 60vh;
  background-color: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 6px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  tab-size: 2;
}

/* 底层：高亮渲染结果 */
.editor-highlight {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  /* 在下面 */
  margin: 0;
  padding: 12px 14px;
  width: 100%;
  height: 100%;
  overflow: auto;
  white-space: pre;
  color: #c9d1d9;
  pointer-events: none;
  /* 不要挡点击 */
  -webkit-user-select: none;
  /* 防止高亮层被选中文本 */
  user-select: none;
}

/* 顶层：真实输入 */
#json-input {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  /* 在上面，光标可见 */
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  border: 0;
  outline: none;
  resize: none;
  background-color: transparent;

  /* 关键：文字本身透明，但用阴影当作“占位字色” */
  color: transparent;
  text-shadow: 0 0 0 #c9d1d9;

  caret-color: #58a6ff;
  /* 光标蓝色，叠最上层，能看见 */

  line-height: 1.5;
  font-size: 14px;
  font-family: inherit;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  word-break: normal;
}

/* hover / focus 样式 */
.code-editor:hover {
  border-color: #3a414a;
}

.code-editor.is-focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

/* 右侧结果区样式保持，稍微整理 */
.preview {
  background-color: #0d1117;
  border: 1px solid #2d333b;
  border-radius: 6px;
  padding: 12px 14px;
  overflow: auto;
  max-height: 60vh;
}

.preview pre {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}