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

:root {
  --wx-green: #07C160;
  --wx-green-dark: #06AD56;
  --text: #1a1a1a;
  --text-2: #888;
  --border: #e5e5e5;
  --bg: #f5f6f7;
  --danger: #e64340;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- 通用 ---------- */
.btn {
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  padding: 10px 18px;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--wx-green); color: #fff; }
.btn-primary:disabled { background: #b8e6cd; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-block { width: 100%; margin-top: 14px; }

.req { color: var(--danger); }

/* ---------- 登录 ---------- */
.login-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 28px;
  text-align: center;
}
.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  background: var(--wx-green);
  color: #fff;
  font-size: 26px;
  font-weight: 500;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 20px; font-weight: 500; }
.login-tip { color: var(--text-2); font-size: 13px; margin: 6px 0 22px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
}
.login-card input:focus { border-color: var(--wx-green); }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-size: 16px; font-weight: 500; }
.topbar-actions { display: flex; gap: 4px; }
.topbar-actions .btn { padding: 7px 12px; font-size: 14px; }

/* ---------- 主容器 ---------- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px 120px;
}
.banner {
  background: #fff7e6;
  border: 1px solid #ffd591;
  color: #ad6800;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.banner a { color: #ad6800; font-weight: 500; }

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

/* ---------- AI 生成区 ---------- */
.ai-card { border: 1px solid #d6f0e3; }
.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ai-title { font-size: 16px; font-weight: 500; }
.ai-badge {
  font-size: 12px;
  color: var(--wx-green-dark);
  background: #e6f7ee;
  border-radius: 20px;
  padding: 3px 10px;
}
.outline {
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.7;
  font-family: inherit;
  outline: none;
  resize: vertical;
  background: #fbfcfb;
}
.outline:focus { border-color: var(--wx-green); }
.ai-style-row {
  display: flex;
  gap: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.ai-style-item { display: flex; align-items: center; gap: 8px; }
.ai-style-item label { font-size: 13px; color: #666; }
.ai-style-item select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.ai-style-item select:focus { border-color: var(--wx-green); }
.ai-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.ai-status { font-size: 13px; color: var(--text-2); }
.ai-status.loading { color: var(--wx-green-dark); }
.ai-tip {
  font-size: 12px;
  color: #aaa;
  margin-top: 10px;
  line-height: 1.6;
}
.modal-section {
  font-size: 14px;
  font-weight: 500;
  color: #444;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin: 4px 0 12px;
}

/* ---------- 正文图片上传区 ---------- */
.img-hint { font-size: 12px; color: #aaa; font-weight: 400; margin-left: 6px; }
.img-zone { display: flex; flex-wrap: wrap; gap: 10px; }
.img-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.img-thumb {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fafafa;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .img-tag {
  position: absolute;
  left: 4px; top: 4px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 10px;
}
.img-thumb .img-del {
  position: absolute;
  right: 4px; top: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(230,67,64,.9);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  border: none;
}
.img-add {
  width: 96px;
  height: 96px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #aaa;
  text-align: center;
  transition: border-color .15s;
}
.img-add:hover { border-color: var(--wx-green); }
.img-add-icon { font-size: 24px; line-height: 1; }
.img-add-text { font-size: 12px; margin-top: 4px; line-height: 1.5; }
.img-add-text span { font-size: 10px; color: #ccc; }
.img-status { font-size: 12px; color: var(--text-2); margin-top: 8px; min-height: 16px; }

/* ---------- 文章信息 ---------- */
.meta-row { display: flex; gap: 24px; }
.meta-fields { flex: 1; min-width: 0; }
.field { position: relative; margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 14px; margin-bottom: 6px; color: #444; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  background: #fff;
}
.field input:focus { border-color: var(--wx-green); }
.field-count {
  position: absolute;
  right: 10px;
  bottom: 11px;
  font-size: 12px;
  color: #bbb;
  pointer-events: none;
}
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

/* ---------- 封面上传 ---------- */
.thumb-panel { width: 220px; flex-shrink: 0; }
.thumb-panel > label { display: block; font-size: 14px; margin-bottom: 6px; color: #444; }
.thumb-box {
  width: 220px;
  height: 150px;
  border: 2px dashed #ccc;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background: #fafafa;
  transition: border-color .15s;
}
.thumb-box:hover { border-color: var(--wx-green); }
.thumb-box img { width: 100%; height: 100%; object-fit: cover; }
.thumb-icon {
  font-size: 30px;
  color: #bbb;
  line-height: 1;
}
.thumb-text { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.thumb-hint { font-size: 12px; color: #bbb; margin-top: 2px; }
.thumb-reupload {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 6px 0;
}
.thumb-status { font-size: 12px; color: var(--wx-green-dark); margin-top: 6px; min-height: 18px; }

/* ---------- AI 封面 ---------- */
.ai-cover { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.ai-cover-divider { font-size: 12px; color: #aaa; margin-bottom: 10px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border: 1px solid var(--border); color: #555; }
.cover-prompt textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  background: #fafbfa;
  outline: none;
}
.cover-prompt textarea:focus { border-color: var(--wx-green); background: #fff; }
.cover-prompt-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.cover-prompt-actions .btn { margin: 0; }
.cover-step-hint { font-size: 12px; color: #aaa; margin-top: 8px; line-height: 1.5; }
.cover-base { margin-top: 12px; }
.cover-poster {
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}
.cover-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.cover-auto-hint { font-size: 12px; color: #aaa; margin-top: 6px; }
.cover-auto-result { margin-top: 10px; }
.cover-copy-edit { display: flex; gap: 8px; margin-top: 10px; flex-direction: column; }
.cover-copy-edit input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
.cover-copy-edit input:focus { border-color: var(--wx-green); }
.cover-prompt-detail { margin-top: 10px; font-size: 12px; color: #666; }
.cover-prompt-detail summary { cursor: pointer; color: var(--wx-green-dark); }
.cover-prompt-detail textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
  resize: vertical;
  background: #fafbfa;
  outline: none;
}

/* ---------- 图生主题 ---------- */
.modal-wide { max-width: 520px; }
.theme-upload {
  width: 100%;
  height: 120px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #aaa;
  text-align: center;
  transition: border-color .15s;
}
.theme-upload:hover { border-color: var(--wx-green); }
.theme-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  margin: 10px 0;
  max-height: 380px;
  overflow-y: auto;
  background: #fff;
  font-size: 13px;
}
.theme-preview section { max-width: 100%; }

/* ---------- 编辑器 ---------- */
.editor-label { font-size: 14px; margin-bottom: 8px; color: #444; }
.toolbar { border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; }
.editor { height: 320px; border: 1px solid var(--border); border-radius: 0 0 8px 8px; overflow-y: auto; background: #fff; }
.editor-tip { font-size: 12px; color: #aaa; margin-left: 6px; font-weight: 400; }
.wechat-preview-wrap {
  margin-top: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}
.wechat-preview-wrap summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--wx-green-dark);
  margin-bottom: 10px;
  user-select: none;
}
.wechat-preview {
  width: 100%;
  height: 480px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}
@media (max-width: 640px) {
  .editor { height: 60vh; }
  .wechat-preview { height: 60vh; }
}

/* ---------- 提交 ---------- */
.submit-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 60;
}
.btn-save { min-width: 200px; padding: 12px 24px; font-size: 16px; }
.save-status { font-size: 13px; color: var(--text-2); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 24px;
}
.modal h2 { font-size: 18px; font-weight: 500; margin-bottom: 6px; }
.modal-tip { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.78);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 200;
  max-width: 82vw;
  text-align: center;
  animation: fadeIn .2s;
}
.toast.success { background: rgba(7,193,96,.92); }
.toast.error { background: rgba(230,67,64,.92); }
@keyframes fadeIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }

/* ---------- 移动端适配 ---------- */
@media (max-width: 640px) {
  .meta-row { flex-direction: column; }
  .thumb-panel { width: 100%; }
  .thumb-box { width: 100%; height: 180px; }
  .field-row { flex-direction: column; gap: 0; }
  .container { padding: 12px 12px 110px; }
  .card { padding: 16px; }
  .btn-save { min-width: 0; width: 100%; }
  .topbar-actions .btn { font-size: 13px; padding: 6px 8px; }
}
