/* Editor (edit mode) + read-only article (view mode) share typography. */

#editor {
  min-height: 50vh;
  outline: none;
}
#editor:empty:before {
  content: attr(data-placeholder);
  color: #9ca3af;
}

#editor, #pageView { line-height: 1.6; }
#editor h1, #pageView h1 { font-size: 1.875rem; font-weight: 700; margin: 1rem 0 0.5rem; }
#editor h2, #pageView h2 { font-size: 1.5rem;  font-weight: 700; margin: 0.9rem 0 0.4rem; }
#editor h3, #pageView h3 { font-size: 1.25rem; font-weight: 700; margin: 0.8rem 0 0.4rem; }
#editor p,  #pageView p  { margin: 0.4rem 0; }
#editor ul, #pageView ul { list-style: disc; padding-left: 1.5rem; margin: 0.4rem 0; }
#editor ol, #pageView ol { list-style: decimal; padding-left: 1.5rem; margin: 0.4rem 0; }
#editor blockquote, #pageView blockquote {
  border-left: 4px solid #c7d2fe;
  background: #eef2ff;
  padding: 0.5rem 1rem;
  margin: 0.6rem 0;
  border-radius: 0 0.5rem 0.5rem 0;
}
#editor pre, #pageView pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 0.6rem 0;
}
#editor code, #pageView code {
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}
#editor table, #pageView table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6rem 0;
}
#editor th, #editor td, #pageView th, #pageView td {
  border: 1px solid #cbd5e1;
  padding: 0.4rem 0.6rem;
  text-align: left;
}
#editor th, #pageView th { background: #f1f5f9; font-weight: 600; }
#editor img, #pageView img { max-width: 100%; border-radius: 0.5rem; margin: 0.4rem 0; }
#editor a, #pageView a { color: #4f46e5; text-decoration: underline; }

.diff-line {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-add    { background: #dcfce7; }
.diff-remove { background: #fee2e2; }
.diff-equal  { color: #475569; }

.kw {
  display: inline-block;
  background: #e0e7ff;
  color: #3730a3;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  margin: 0.1rem;
}

.tree-item { cursor: pointer; padding: 0.25rem 0.5rem; border-radius: 0.375rem; display: flex; align-items: center; gap: 0.25rem; }
.tree-item:hover { background: #f1f5f9; }
.tree-item.active { background: #e0e7ff; color: #3730a3; font-weight: 600; }
.tree-children { padding-left: 1rem; }
