/* =====================================================
   MoPai 墨排 V3 — 全局样式
   ===================================================== */

/* --- 基础重置 --- */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}

/* --- 设计系统 --- */
:root {
  --primary: #4f6ef7;
  --primary-hover: #3b5de7;
  --primary-light: #eef1fe;
  --bg: #f5f7fa;
  --bg-editor: #fafbfc;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f0f1f3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
}

/* --- 暗色模式 --- */
[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-editor: #16162a;
  --card: #1a1a2e;
  --text: #e0e0f0;
  --text-secondary: #9ca3bf;
  --text-muted: #6b7290;
  --border: #2a2a4a;
  --border-light: #222240;
  --primary-light: rgba(79, 110, 247, 0.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
}

[data-theme="dark"] .editor-textarea {
  background: var(--bg-editor) !important;
  color: var(--text) !important;
}

[data-theme="dark"] .preview-body {
  background: #16162a !important;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

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

/* --- 头部导航 --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
  transition: var(--transition);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #1a1a1a, #3a3a3a);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.logo-version {
  font-size: 10px;
  background: #2a2a2a;
  color: #e0e0e0;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  margin-left: -4px;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 2px;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 18px;
}

.header-btn.has-label {
  flex-direction: column;
  width: 44px;
  height: 42px;
  gap: 1px;
  font-size: 16px;
}

.btn-label {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1;
  font-weight: 500;
}

.header-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.header-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* --- 样式选择栏 --- */
.theme-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  transition: var(--transition);
}

.theme-bar::-webkit-scrollbar { height: 0; }

.theme-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  font-family: inherit;
}

.theme-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.theme-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(79, 110, 247, 0.3);
}

.theme-btn .emoji { font-size: 13px; }

/* --- 主体区域 --- */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- 编辑器面板 --- */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-width: 0;
  transition: var(--transition);
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--card);
  flex-shrink: 0;
  transition: var(--transition);
}

.editor-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.editor-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.editor-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.editor-action-btn.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #fef2f2;
}

.editor-action-btn svg { width: 13px; height: 13px; }

/* --- 格式化工具栏 --- */
.format-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  flex-wrap: wrap;
  transition: var(--transition);
}

.format-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-family: inherit;
  position: relative;
}

.format-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.format-btn svg { width: 15px; height: 15px; }

.format-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

/* --- 编辑区 --- */
.editor-textarea {
  flex: 1;
  width: 100%;
  padding: 16px 20px;
  border: none;
  outline: none;
  resize: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, "PingFang SC", monospace;
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg-editor);
  tab-size: 2;
  transition: var(--transition);
}

.editor-textarea::placeholder { color: var(--text-muted); }

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  border-top: 1px solid var(--border-light);
  background: var(--card);
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
  transition: var(--transition);
}

.file-hint span { color: var(--text-muted); }

.stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums;
}

.stats span { display: flex; align-items: center; gap: 3px; }

/* --- 预览面板 --- */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- 预览区图片样式 --- */
.preview-body img {
  display: block;
  margin: 16px auto;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.preview-body p img {
  display: block;
  margin: 16px auto;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--card);
  flex-shrink: 0;
  transition: var(--transition);
}

.preview-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-weight: 500;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: white; box-shadow: 0 2px 8px rgba(79, 110, 247, 0.3); }

.preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: white;
  transition: var(--transition);
}

.preview-body::-webkit-scrollbar { width: 5px; }
.preview-body::-webkit-scrollbar-track { background: transparent; }
.preview-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* --- 设置面板 --- */
.settings-panel {
  position: fixed;
  top: 52px;
  right: 0;
  width: 280px;
  height: calc(100vh - 52px);
  background: var(--card);
  border-left: 1px solid var(--border);
  z-index: 150;
  overflow-y: auto;
  box-shadow: -4px 0 24px rgba(0,0,0,0.1);
  animation: slideInRight 0.3s ease;
  transition: var(--transition);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.settings-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.settings-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 颜色网格 */
.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.color-swatch:hover { transform: scale(1.15); }

.color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--text);
}

.color-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.color-input-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  background: var(--card);
}

.color-input-row span {
  font-size: 12px;
  color: var(--text-secondary);
}

/* 字体选择 */
.font-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.font-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--card);
}

.font-option:hover { border-color: var(--primary); color: var(--primary); }

.font-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.font-option .font-preview {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* 字号选择 */
.size-options {
  display: flex;
  gap: 6px;
}

.size-btn {
  flex: 1;
  padding: 6px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  font-family: inherit;
}

.size-btn:hover { border-color: var(--primary); color: var(--primary); }

.size-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* --- 历史记录弹窗 --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 520px;
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 15px; font-weight: 600; }

.close-btn {
  width: 30px; height: 30px;
  border: none; background: none;
  cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 16px;
}

.close-btn:hover { background: var(--bg); color: var(--text); }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.history-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2px;
}

.history-item:hover { background: var(--bg); }

.history-item-content { flex: 1; min-width: 0; }
.history-item-time { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }
.history-item-preview { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.history-item-delete {
  width: 26px; height: 26px;
  border: none; background: none; cursor: pointer;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #d1d5db;
  transition: var(--transition);
  flex-shrink: 0; margin-left: 6px;
}

.history-item-delete:hover { background: #fef2f2; color: var(--danger); }

.history-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* --- Toast 提示 --- */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  animation: toastIn 0.3s ease;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
}

@keyframes toastIn {
  from { transform: translateX(-50%) translateY(-12px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* --- 手机预览模式 --- */
.preview-body.mobile-preview {
  display: flex;
  justify-content: center;
  background: var(--bg) !important;
  padding: 20px;
}

.preview-body.mobile-preview > div {
  width: 375px;
  min-height: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  padding: 20px !important;
  overflow: hidden;
}

[data-theme="dark"] .preview-body.mobile-preview > div {
  background: #1a1a2e;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* --- TOC 大纲面板 --- */
.toc-panel {
  position: fixed;
  top: 52px;
  left: 0;
  width: 240px;
  height: calc(100vh - 52px);
  background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 150;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
  animation: slideInLeft 0.3s ease;
  transition: var(--transition);
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toc-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-list { padding: 8px; }

.toc-item {
  display: block;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.toc-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.toc-item.level-1 { font-weight: 600; padding-left: 12px; font-size: 13px; }
.toc-item.level-2 { padding-left: 24px; }
.toc-item.level-3 { padding-left: 36px; font-size: 11px; color: var(--text-muted); }

/* --- 主题悬浮预览 --- */
.theme-btn-wrapper {
  position: relative;
  display: inline-flex;
}

.theme-preview-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-height: 180px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: fadeIn 0.2s ease;
  pointer-events: none;
}

.theme-preview-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.theme-preview-content {
  padding: 10px;
  font-size: 10px;
  overflow: hidden;
  transform: scale(0.75);
  transform-origin: top left;
  width: 133%;
}

/* --- 拖拽上传区 --- */
.editor-textarea.drag-over {
  background: var(--primary-light) !important;
  border: 2px dashed var(--primary) !important;
}

/* --- 设置面板开关 --- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.toggle-row-label {
  font-size: 13px;
  color: var(--text);
}

.toggle-row-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle-switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--border);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  flex-shrink: 0;
}

.toggle-switch.active {
  background: var(--primary);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch.active::after {
  left: 18px;
}

/* --- 快捷键提示 --- */
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.shortcut-key {
  font-family: -apple-system, sans-serif;
  font-size: 10px;
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* --- 编辑器语法提示 --- */
.editor-syntax-hint {
  position: absolute;
  bottom: 8px;
  left: 12px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.5;
  pointer-events: none;
}

/* --- 图片指南弹窗 --- */
.format-btn-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.image-guide-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  animation: fadeIn 0.2s ease;
}

.image-guide-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.image-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.image-guide-content {
  padding: 10px 14px;
}

.guide-item {
  margin-bottom: 8px;
}

.guide-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.guide-item-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-divider {
  height: 1px;
  background: var(--border-light);
  margin: 8px 0;
}

.guide-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.guide-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}

.guide-link:hover {
  text-decoration: underline;
}

.guide-link-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* --- 发布助手 --- */
.publish-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.publish-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg);
}

.publish-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.publish-card:active {
  transform: translateY(0);
}

.publish-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.publish-card-info {
  flex: 1;
  min-width: 0;
}

.publish-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.publish-card-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.publish-format-tag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}

.publish-format-tag.html {
  background: #fef3c7;
  color: #92400e;
}

.publish-format-tag.markdown {
  background: #dbeafe;
  color: #1e40af;
}

.publish-format-tag.excerpt {
  background: #fce7f3;
  color: #9d174d;
}

.publish-status {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  border: 1px solid var(--border-light);
  animation: fadeIn 0.3s ease;
}

/* --- 隐藏元素 --- */
.file-input-hidden { display: none; }

/* --- 响应式 --- */
/* --- 手机端 Tab 切换栏 --- */
.mobile-tab-bar {
  display: none; /* 桌面端隐藏 */
}

@media (max-width: 768px) {
  /* 手机端 Tab 切换栏 */
  .mobile-tab-bar {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .mobile-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
  }
  .mobile-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(79,110,247,0.05);
  }

  /* 主体布局：全屏切换 */
  .main-content {
    flex-direction: column;
  }
  .editor-panel {
    display: none;
    border-right: none;
    flex: 1;
    height: auto;
  }
  .preview-panel {
    display: none;
    flex: 1;
  }
  .editor-panel.mobile-active {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .preview-panel.mobile-active {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  /* Header：只显示图标，隐藏文字 */
  .header {
    padding: 0 8px;
    min-height: 40px;
  }
  .btn-label {
    display: none;
  }
  .header-btn {
    padding: 6px;
    min-width: 36px;
  }
  .logo-text { font-size: 14px; }
  .logo-version { font-size: 9px; padding: 1px 4px; }

  /* 主题栏：可横向滚动 */
  .theme-bar {
    padding: 6px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .theme-bar::-webkit-scrollbar { display: none; }
  .theme-chip {
    font-size: 11px;
    padding: 3px 8px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .theme-label { display: none; }
  .theme-preview-tooltip { display: none; }

  /* 格式工具栏：可滚动 */
  .format-toolbar {
    padding: 3px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }
  .format-toolbar::-webkit-scrollbar { display: none; }
  .format-btn {
    flex-shrink: 0;
    min-width: 32px;
    min-height: 32px;
  }

  /* 编辑器头部 */
  .editor-header { padding: 4px 8px; }
  .editor-title { font-size: 12px; }
  .editor-action-btn { font-size: 11px; padding: 3px 6px; }

  /* 预览头部 */
  .preview-header { padding: 4px 8px; }
  .preview-title { font-size: 12px; }

  /* 设置面板：全屏覆盖 */
  .settings-panel {
    width: 100%;
    max-height: 85vh;
  }

  /* 目录面板：全屏覆盖 */
  .toc-panel {
    width: 100%;
  }

  /* 弹窗适配 */
  .modal {
    width: 95vw !important;
    max-height: 80vh;
  }

  /* 导出下拉 */
  .export-dropdown {
    right: -60px;
  }

  /* 编辑器底栏 */
  .editor-footer {
    font-size: 10px;
    padding: 2px 8px;
    gap: 8px;
  }

  /* 查找替换栏 */
  .find-replace-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
  }
  .find-input {
    flex: 1;
    min-width: 80px;
  }
}

/* =====================================================
   Phase 2 — 编辑器体验提升
   ===================================================== */

/* --- 专注模式 --- */
.focus-mode .header,
.focus-mode .theme-bar,
.focus-mode .settings-panel,
.focus-mode .toc-panel {
  display: none !important;
}
.focus-mode .main-content {
  height: 100vh;
}

/* --- 查找替换栏 --- */
.find-replace-bar {
  display: flex;
  gap: 12px;
  padding: 6px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.find-input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.find-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79,110,247,0.15);
}

/* --- 行号 --- */
.editor-textarea-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
}
.line-numbers {
  width: 40px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border-light);
  padding: 12px 0;
  overflow: hidden;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: right;
  user-select: none;
}
.line-number {
  padding: 0 6px 0 0;
  height: 1.6em;
}
.editor-textarea.has-line-numbers {
  padding-left: 8px;
}

/* --- 字数目标进度条 --- */
.word-goal-bar {
  height: 3px;
  background: var(--border-light);
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.word-goal-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 3px;
}
.word-goal-fill.complete {
  background: var(--success);
}

/* --- 自定义 CSS 编辑器 --- */
.custom-css-editor {
  width: 100%;
  min-height: 80px;
  max-height: 200px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.custom-css-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79,110,247,0.15);
}

/* --- 导出下拉菜单 --- */
.export-dropdown-wrapper {
  position: relative;
  display: inline-block;
}
.export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  min-width: 160px;
  overflow: hidden;
}
.export-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}
.export-dropdown button:hover {
  background: var(--hover-bg, rgba(0,0,0,0.05));
}
