* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #e8e8e8;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-logo {
  color: #07c160;
}

.toolbar-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.toolbar-center {
  display: flex;
  align-items: center;
  gap: 4px;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f0f0f0;
  border-radius: 4px;
  padding: 2px;
}

.setting-label {
  font-size: 12px;
  color: #999;
  padding: 0 8px;
}

.setting-btn {
  padding: 4px 10px;
  font-size: 13px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.setting-btn:hover {
  color: #333;
}

.setting-btn.active {
  background: #fff;
  color: #07c160;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.setting-divider {
  width: 1px;
  height: 24px;
  background: #e0e0e0;
  margin: 0 8px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.copy-btn {
  padding: 6px 18px;
  font-size: 13px;
  border: none;
  border-radius: 4px;
  background: #07c160;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

.copy-btn:hover {
  background: #06ad56;
}

.copy-btn:disabled {
  background: #c0c0c0;
  cursor: not-allowed;
}

.toast {
  font-size: 12px;
  color: #07c160;
  animation: toastIn 0.3s ease;
  white-space: nowrap;
  position: absolute;
  right: 20px;
  top: 52px;
  background: #f0faf4;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #c6e6d4;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Main Layout ===== */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 2px;
  background: #d0d0d0;
}

.panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== Editor Panel ===== */
.editor-panel {
  flex: 1;
  background: #1e1e1e;
  position: relative;
}

.editor-panel::after {
  content: 'Markdown';
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 11px;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
}

.editor {
  flex: 1;
  padding: 32px 20px 20px;
  border: none;
  outline: none;
  resize: none;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #d4d4d4;
  background: transparent;
  tab-size: 2;
  position: relative;
  z-index: 2;
}

.editor::placeholder {
  color: #555;
}

/* ===== Preview Panel ===== */
.preview-panel {
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.preview-header {
  font-size: 12px;
  color: #bbb;
  padding: 10px 20px;
  flex-shrink: 0;
  text-align: center;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid #f0f0f0;
}

.preview-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  justify-content: center;
}

.preview-card {
  width: 100%;
  max-width: 640px;
  background: #fff;
  min-height: 100%;
}

.wechat-article-header {
  text-align: center;
  font-size: 13px;
  color: #aaa;
  padding: 20px 20px 0;
  letter-spacing: 1px;
}

.preview-content {
  padding: 12px 24px 24px;
  min-height: 300px;
}

.preview-content img {
  border-radius: 4px;
}

.wechat-article-footer {
  text-align: center;
  font-size: 12px;
  color: #bbb;
  padding: 16px 20px 24px;
  border-top: 1px solid #f5f5f5;
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.footer-divider {
  color: #ddd;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

.editor::-webkit-scrollbar-thumb {
  background: #444;
}

.editor::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .main {
    flex-direction: column;
  }

  .editor-panel,
  .preview-panel {
    min-height: 45vh;
  }

  .preview-card {
    max-width: 100%;
  }

  .preview-content {
    padding: 12px 16px 16px;
  }

  .toolbar {
    padding: 0 12px;
  }
}
