/* ==========================================================================
   投稿编辑器
   ========================================================================== */

.write-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.write-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 60px;
  padding-top: 10px;
  padding-bottom: 10px;
  flex-wrap: wrap;
}
.write-bar .back-link { margin-bottom: 0; }
.write-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quota-hint { font-size: 11.5px; letter-spacing: 0.04em; }

.write-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  gap: 32px;
  align-items: start;
  padding: 34px 0 70px;
}
.write-main { min-width: 0; }
.write-side { position: sticky; top: calc(var(--header-h) + 80px); }

/* 标题输入 */
.title-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.35;
  padding: 4px 2px 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.title-input:focus { outline: none; border-bottom-color: rgba(255, 182, 72, 0.55); }
.title-input::placeholder { color: #b3bac6; font-weight: 700; }

/* 编辑器外壳 */
.editor-shell {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.editor-shell:focus-within { border-color: rgba(255, 182, 72, 0.35); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--ink-2);
}
.toolbar button {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: var(--font-sans);
}
.toolbar button:hover { background: rgba(var(--ink-rgb), 0.06); color: var(--text); }
.toolbar button:active { background: rgba(180, 83, 9, 0.12); color: var(--amber); }
.toolbar button b, .toolbar button i, .toolbar button u { font-size: 14px; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }

.editor {
  min-height: 440px;
  padding: 22px 26px 40px;
  outline: none;
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--text-dim);
  overflow-wrap: break-word;
}
.editor:empty::before,
.editor:has(> br:only-child)::before {
  content: attr(data-placeholder);
  color: #aeb6c2;
  pointer-events: none;
}
.editor h2 { font-size: 24px; }
.editor h3 { font-size: 19px; }
.editor blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid rgba(255, 182, 72, 0.5);
  color: var(--text-dim);
}
.editor a { color: var(--amber); border-bottom: 1px solid rgba(255, 182, 72, 0.35); }

.editor-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  font-size: 12.5px;
}

/* 上传区 */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 124px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--glass);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  overflow: hidden;
  text-align: center;
}
.dropzone:hover, .dropzone:focus-visible { border-color: rgba(180, 83, 9, 0.45); background: rgba(180, 83, 9, 0.04); }
.dropzone.dragging { border-color: var(--amber); background: rgba(180, 83, 9, 0.08); }
.dropzone.has-file { border-style: solid; border-color: var(--line); }

.dz-empty { display: flex; flex-direction: column; gap: 5px; }
.dz-empty strong { font-size: 13.5px; color: var(--text-dim); font-weight: 600; }
.dz-empty span { font-size: 11.5px; color: var(--faint); font-family: var(--font-mono); }

.cover-zone img {
  width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: var(--r-sm);
}
.cover-zone.has-file { padding: 0; background: #f3ece0; }

.dz-progress {
  height: 5px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(var(--ink-rgb), 0.09);
  overflow: hidden;
}
.dz-progress i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--grad-warm);
  transition: width 0.2s ease;
}

.dz-meta {
  margin-top: 9px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  word-break: break-all;
}
.dz-meta strong { color: var(--text-dim); font-weight: 600; }

.audio-preview { width: 100%; margin-top: 10px; height: 34px; border-radius: 8px; }

/* 侧栏提示 */
.tips-card .tips {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--muted);
}
.tips-card .tips li + li { margin-top: 6px; }

@media (max-width: 1024px) {
  .write-grid { grid-template-columns: 1fr; }
  .write-side { position: static; }
  .write-side .card { margin-top: 16px; }
}

@media (max-width: 720px) {
  .write-bar-inner { justify-content: flex-start; }
  .write-bar .back-link { width: 100%; }
  .write-actions { width: 100%; }
  .write-actions .btn { flex: 1; }
  .editor { padding: 18px; min-height: 320px; }
  .title-input { font-size: 22px; }
}

/* ---------- 音频：上传 / 链接导入 ---------- */
.seg-sm { width: 100%; margin-bottom: 12px; }
.seg-sm button { flex: 1; padding: 7px 10px; font-size: 12.5px; }

#audioLinkPane .field { margin-bottom: 10px; }
#audioLinkPane .hint { line-height: 1.7; }

/* ---------- Markdown 模式 ---------- */
.editor-mode { width: fit-content; margin: 18px 0 12px; }
.md-input {
  width: 100%;
  min-height: 340px;
  padding: 18px 20px;
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Consolas, monospace);
  font-size: 14px;
  line-height: 1.75;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.md-input:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.12); }
.md-preview-wrap { margin-top: 16px; border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 14px 18px; }
.md-preview-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.md-preview { margin-top: 8px; line-height: 1.85; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin: 14px 0 8px; }
.md-preview p { margin: 8px 0; }
.md-preview ul, .md-preview ol { padding-left: 22px; margin: 8px 0; }
.md-preview blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--amber); color: var(--muted); }
.md-preview pre { background: rgba(0,0,0,.32); padding: 12px 14px; border-radius: 10px; overflow-x: auto; }
.md-preview code { font-family: var(--font-mono, ui-monospace, Consolas, monospace); font-size: 13px; }
.md-preview img { max-width: 100%; border-radius: 10px; }
.md-preview hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
