@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

:root {
  font-family: "DM Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f4f6fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  height: 66px;
  padding: 0 clamp(20px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e8ebf2;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #172d55;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 5px 14px #172d5526;
}

.brand strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand span { display: block; font-size: 11px; color: #8790a2; margin-top: 3px; }
.privacy { font-size: 12px; color: #7c8799; }
.privacy i, .live-status i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #24b47e;
  margin-right: 6px;
}

/* ------------------------------ 布局 ------------------------------ */

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 56px) 28px;
}

.intro { text-align: center; margin: 4px 0 32px; }
.eyebrow { font-size: 10px; letter-spacing: 2.5px; font-weight: 700; color: #4974b8; }
.intro h1 {
  font-size: clamp(28px, 3.2vw, 42px);
  letter-spacing: -1.5px;
  margin: 11px 0 10px;
  font-weight: 800;
}
.intro h1 em { font-style: normal; color: #3267c8; }
.intro p { margin: 0 auto; color: #788296; font-size: 14px; max-width: 640px; line-height: 1.75; }

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, .88fr) minmax(440px, 1.12fr);
  gap: 20px;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid #e8ebf2;
  border-radius: 18px;
  box-shadow: 0 7px 28px #20365c08;
  overflow: hidden;
}

.editor-panel, .preview-panel { padding: 23px; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.panel-heading > div, .howto-title { display: flex; align-items: center; gap: 10px; }
.panel-heading h2, .howto-title h2 { font-size: 16px; margin: 0; font-weight: 700; }

.step {
  font-size: 10px;
  letter-spacing: 1px;
  font-weight: 800;
  color: #4774c5;
  background: #edf3ff;
  border-radius: 7px;
  padding: 6px 7px;
}

.text-button { border: 0; background: none; color: #376bc2; font: inherit; font-size: 12px; cursor: pointer; }
.text-button:hover { color: #1d55ae; }

/* ------------------------------ 表单 ------------------------------ */

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #495469;
  margin: 0 0 8px;
}

.text-input {
  display: block;
  width: 100%;
  border: 1px solid #e1e6ef;
  border-radius: 9px;
  padding: 10px 12px;
  font: 13px/1.6 "Noto Sans SC", sans-serif;
  color: #334155;
  outline: none;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.text-input::placeholder, textarea::placeholder { color: #b3bccb; }
.text-input:focus, textarea:focus { border-color: #8aaeea; box-shadow: 0 0 0 3px #eaf1ff; }

.field-tip { font-size: 10px; color: #9aa3b2; margin: 6px 0 0; line-height: 1.6; }
.field-tip code, .hint code {
  background: #f1f4f9;
  border-radius: 4px;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: #5b6b85;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.input-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
}
.input-label-row span { font-size: 11px; color: #9aa3b2; }

textarea {
  display: block;
  width: 100%;
  height: 330px;
  resize: vertical;
  border: 1px solid #e1e6ef;
  border-radius: 10px;
  padding: 13px 14px;
  font: 13px/1.9 "Noto Sans SC", sans-serif;
  color: #334155;
  outline: none;
  white-space: pre-wrap;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.hint { font-size: 11px; line-height: 1.75; color: #8a94a6; margin-top: 9px; }
.hint-icon { color: #4d7bd0; margin-right: 4px; }

.editor-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

.btn {
  border: 0;
  border-radius: 9px;
  padding: 11px 15px;
  font: 600 12px "Noto Sans SC", sans-serif;
  cursor: pointer;
  transition: transform .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: #2865c7; color: #fff; box-shadow: 0 5px 12px #2865c724; }
.btn-primary:hover { background: #1d55ae; }
.btn-primary span { margin-left: 10px; font-size: 15px; }
.btn-quiet { background: #f1f3f7; color: #667085; }
.btn-outline { border: 1px solid #e0e5ee; background: #fff; color: #566176; }
.btn-outline:hover { background: #f7f9fc; }

/* ------------------------------ 主题选择 ------------------------------ */

.preview-heading { margin-bottom: 16px; }
.live-status { font-size: 11px; color: #7c8799; }

.theme-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  min-width: 0;
  border: 1px solid #e7eaf1;
  background: #fff;
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.theme-option:hover { border-color: #cbd6e8; background: #fbfcff; }
.theme-option.active {
  border-color: #8eb0e9;
  background: #f6f9ff;
  box-shadow: 0 0 0 1px #8eb0e9 inset;
}

.swatch { width: 26px; height: 26px; border-radius: 8px; flex: none; }
.theme-text { min-width: 0; }
.theme-option b { display: block; font-size: 11px; color: #273247; }
.theme-option small {
  display: block;
  font-size: 9px;
  color: #8c95a5;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.check { display: none; margin-left: auto; color: #3972cc; font-size: 12px; flex: none; }
.theme-option.active .check { display: block; }

/* ------------------------------ 预览 ------------------------------ */

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #8a94a6;
  margin: 18px 2px 9px;
}
.preview-toolbar b { color: #4f6b96; font-weight: 700; }
.phone-icon { font-size: 19px; }

.phone-stage {
  background: #f7f8fb;
  border: 1px solid #e1e6ef;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: center;
  min-height: 400px;
  max-height: 740px;
  overflow: auto;
}

.wechat-article {
  width: 100%;
  max-width: 430px;
  min-height: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(24, 39, 75, .07);
  align-self: stretch;
  overflow-wrap: anywhere;
}

/* 仅预览：补回微信文章页的阅读留白，让预览更接近最终效果。
   复制 / 导出的 HTML 仍是 padding:0，不会重新叠加到公众号原生边距上。 */
.wechat-article > section {
  padding: 0 18px 20px !important;
}

.preview-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.option-note { margin-left: auto; font-size: 10px; color: #9aa3b2; }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 9px;
  background: #dbe1ea;
  transition: background .15s;
  flex: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0002;
  transition: transform .15s;
}
.switch input:checked + .switch-track { background: #2f6bce; }
.switch input:checked + .switch-track::after { transform: translateX(13px); }
.switch input:focus-visible + .switch-track { outline: 2px solid #8eb0e9; outline-offset: 2px; }
.switch-label { font-size: 11px; color: #5b6678; }
.switch.is-disabled { opacity: .45; cursor: not-allowed; }

.export-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.copy-rich { flex: 1; min-width: 145px; }
.copy-note { font-size: 10px; line-height: 1.7; color: #9aa3b2; margin: 10px 0 0; }

/* ------------------------------ 说明 ------------------------------ */

.howto {
  margin-top: 24px;
  background: #fff;
  border: 1px solid #e8ebf2;
  border-radius: 16px;
  padding: 21px 23px;
}
.howto-title { margin-bottom: 17px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.howto-card { padding: 14px; background: #f8f9fc; border-radius: 10px; position: relative; }
.howto-card > span {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: #e7efff;
  color: #3468bd;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 10px;
}
.howto-card b { font-size: 12px; }
.howto-card p { font-size: 11px; line-height: 1.7; color: #8992a2; margin: 6px 0 0; }

footer { text-align: center; font-size: 11px; color: #a1a9b7; padding: 24px 10px 0; line-height: 1.8; }
footer span { margin: 0 6px; }

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #172033;
  color: white;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 12px;
  box-shadow: 0 10px 30px #0002;
  transition: all .2s;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .editor-panel, .preview-panel { padding: 20px; }
  textarea { height: 300px; }
  .phone-stage { max-height: none; }
  .preview-panel { max-width: none; }
}

@media (max-width: 560px) {
  .topbar { height: 66px; padding: 0 16px; }
  .theme-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .privacy { display: none; }
  .app-shell { padding: 25px 12px; }
  .intro { margin-bottom: 22px; }
  .intro p { font-size: 12px; line-height: 1.7; }
  .workspace { gap: 13px; }
  .panel { border-radius: 14px; }
  .editor-panel, .preview-panel { padding: 15px; }
  .theme-picker { gap: 6px; }
  .theme-option { padding: 8px 7px; }
  .swatch { width: 22px; height: 22px; }
  .theme-option b { font-size: 10px; }
  .theme-option small { font-size: 8px; }
  .field-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .howto { padding: 17px; }
  .export-actions .btn { padding: 11px 10px; }
  .copy-rich { flex-basis: 100%; }
  .option-note { display: none; }
  .phone-stage { padding: 0px; }
}
