.zhihu-editor-wrapper {
  display: block;
  clear: both;
  width: 100%;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin: 10px 0 0 0;
  overflow: hidden;
}

.zhihu-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #e8e8e8;
  background: #f6f6f6;
  border-radius: 4px 4px 0 0;
  gap: 1px;
}

.zhihu-editor-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 0 5px;
  border-right: 1px solid #ddd;
}

.zhihu-editor-toolbar .toolbar-group:last-child {
  border-right: none;
}

.zhihu-editor-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  color: #555;
  font-size: 13px;
  transition: all 0.15s ease;
  position: relative;
}

.zhihu-editor-toolbar button:hover {
  background: #e0e0e0;
  color: #222;
}

.zhihu-editor-toolbar button.active {
  background: #d6e4ff;
  color: var(--theme, #0066ff);
}

.zhihu-editor-toolbar button .tooltip {
  display: none;
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

.zhihu-editor-toolbar button:hover .tooltip {
  display: block;
}

.zhihu-editor-body {
  display: flex;
  min-height: 400px;
  position: relative;
}

.zhihu-editor-toc {
  width: 180px;
  min-width: 180px;
  border-right: 1px solid #f0f0f0;
  padding: 14px 10px;
  background: #fafbfc;
  overflow-y: auto;
  max-height: 520px;
  display: none;
  font-size: 13px;
}

.zhihu-editor-toc.visible {
  display: block;
}

.zhihu-editor-toc h4 {
  font-size: 12px;
  color: #999;
  margin: 0 0 10px 0;
  font-weight: 500;
  letter-spacing: 1px;
}

.zhihu-editor-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.zhihu-editor-toc ul li {
  padding: 4px 6px;
  margin: 1px 0;
  cursor: pointer;
  border-radius: 3px;
  color: #555;
  transition: background 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.zhihu-editor-toc ul li:hover {
  background: #e8f0fe;
  color: var(--theme, #0066ff);
}

.zhihu-editor-toc ul li.level-h2 {
  padding-left: 14px;
}

.zhihu-editor-toc ul li.level-h3 {
  padding-left: 22px;
}

.zhihu-editor-area {
  flex: 1;
  padding: 16px 20px;
  min-height: 400px;
  outline: none;
  font-size: 15px;
  line-height: 1.8;
  color: #333;
  word-break: break-word;
  overflow-y: auto;
  max-height: 520px;
}

.zhihu-editor-area:empty::before {
  content: attr(data-placeholder);
  color: #bbb;
  pointer-events: none;
}

.zhihu-editor-area h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  margin: 18px 0 10px;
  padding: 0;
}

.zhihu-editor-area h2 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  margin: 16px 0 8px;
  padding: 0;
}

.zhihu-editor-area h3 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  margin: 14px 0 6px;
  padding: 0;
}

.zhihu-editor-area p {
  margin: 0 0 12px;
}

.zhihu-editor-area blockquote {
  margin: 12px 0;
  padding: 6px 14px;
  border-left: 3px solid #ccc;
  background: #f6f8fa;
  color: #666;
}

.zhihu-editor-area pre {
  margin: 12px 0;
  padding: 12px 16px;
  background: #f4f4f4;
  border-radius: 4px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.zhihu-editor-area code {
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  background: #f0f0f0;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 13px;
}

.zhihu-editor-area pre code {
  background: none;
  padding: 0;
}

.zhihu-editor-area ul, .zhihu-editor-area ol {
  margin: 8px 0;
  padding-left: 24px;
}

.zhihu-editor-area ul li, .zhihu-editor-area ol li {
  margin: 3px 0;
}

.zhihu-editor-area img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  margin: 6px 0;
  display: block;
}

.zhihu-editor-area hr {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 16px 0;
}

.zhihu-editor-area a {
  color: var(--theme, #0066ff);
  text-decoration: none;
}

.zhihu-editor-area a:hover {
  text-decoration: underline;
}

.zhihu-editor-area table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}

.zhihu-editor-area table td, .zhihu-editor-area table th {
  border: 1px solid #e0e0e0;
  padding: 6px 10px;
}

.zhihu-editor-area table th {
  background: #f6f8fa;
  font-weight: 600;
}

.zhihu-editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 14px;
  border-top: 1px solid #eee;
  font-size: 12px;
  color: #999;
  border-radius: 0 0 4px 4px;
  background: #fafafa;
}

.zhihu-editor-statusbar .status-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zhihu-editor-statusbar .status-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.zhihu-editor-statusbar .toggle-toc {
  cursor: pointer;
  color: #888;
  transition: color 0.15s;
}

.zhihu-editor-statusbar .toggle-toc:hover {
  color: var(--theme, #0066ff);
}

.zhihu-editor-statusbar .toggle-toc.active {
  color: var(--theme, #0066ff);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media screen and (max-width: 767px) {
  .zhihu-editor-toolbar {
    padding: 4px 6px;
  }
  .zhihu-editor-toolbar button {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .zhihu-editor-body {
    flex-direction: column;
  }
  .zhihu-editor-toc {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
    max-height: 180px;
  }
  .zhihu-editor-area {
    padding: 12px 14px;
    min-height: 300px;
    max-height: 400px;
  }
}
