/* ============================================================
   公众号排版助手 v3 — UI 样式
   浅色、克制、信息密度高；所有颜色走 CSS 变量
   ============================================================ */
:root {
  --bg: #f5f5f6;
  --panel: #ffffff;
  --ink: #18181b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --muted-2: #a1a1aa;
  --line: #e7e7ea;
  --line-soft: #f1f1f3;
  --accent: #0aa85c;
  --accent-dark: #078a4b;
  --accent-soft: #e9f9f0;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 8px 24px -12px rgba(24, 24, 27, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; flex: none;
  box-shadow: 0 2px 6px rgba(10, 168, 92, .28);
}
.brand-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: .2px; }
.brand-sub {
  font-size: 11px; color: var(--muted);
  padding: 2px 7px; border-radius: 999px;
  background: var(--line-soft); white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.divider-v { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }

/* 窄屏收起按钮文字，只留图标（hover 的 title 仍有提示） */
@media (max-width: 1180px) {
  .topbar-actions .btn-ghost .btn-label { display: none; }
  .topbar-actions .btn { padding: 0 10px; }
  .brand-sub { display: none; }
}
@media (max-width: 860px) {
  .topbar-actions .btn-primary .btn-label { display: none; }
}
@media (max-width: 640px) {
  .topbar { height: auto; min-height: 56px; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px;
  border-radius: 9px; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .16s, border-color .16s, color .16s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(10, 168, 92, .22); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-soft); }
.btn-soft { background: var(--accent-soft); color: var(--accent-dark); }
.btn-soft:hover { background: #dcf5e7; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------- 布局 ---------------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(400px, 1.18fr) 338px;
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 56px);
  align-items: stretch;
}
.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
}
.pane-head {
  height: 44px; flex: none;
  padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.pane-title { font-size: 13px; font-weight: 600; letter-spacing: .2px; }
.pane-hint { font-size: 11.5px; color: var(--muted-2); }

/* ---------------- 编辑器 ---------------- */
.md-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: #fcfcfd;
  scrollbar-width: none;
  flex: none;
}
.md-toolbar::-webkit-scrollbar { height: 0; }
.md-toolbar button {
  min-width: 28px; height: 28px; padding: 0 7px; flex: none;
  border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--ink-2);
  font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.md-toolbar button:hover { background: #fff; border-color: var(--line); color: var(--ink); }
.md-toolbar button:active { background: var(--accent-soft); border-color: #c8ecd9; }
.tb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.tb-spacer { flex: 1; }

.editor-wrap { flex: 1; min-height: 0; display: flex; }
#editor {
  flex: 1; width: 100%; border: 0; outline: 0; resize: none;
  padding: 18px 20px 28px;
  font-family: var(--mono);
  font-size: 13.5px; line-height: 1.85;
  color: var(--ink-2); background: var(--panel);
  tab-size: 2;
}
#editor::placeholder { color: var(--muted-2); }
#editor::-webkit-scrollbar { width: 10px; }
#editor::-webkit-scrollbar-thumb { background: #e2e2e6; border-radius: 6px; border: 3px solid #fff; }
#editor::-webkit-scrollbar-track { background: transparent; }

.editor-foot {
  flex: none; height: 36px; padding: 0 14px;
  display: flex; align-items: center; gap: 6px;
  border-top: 1px solid var(--line-soft);
  background: #fcfcfd;
  font-size: 11.5px; color: var(--muted);
}
.dot-sep { color: var(--line); }
.foot-grow { flex: 1; }
.link-btn {
  border: 0; background: none; color: var(--muted);
  font-size: 11.5px; padding: 4px 6px; border-radius: 6px;
}
.link-btn:hover { color: var(--err); background: var(--err-soft); }

/* ---------------- 预览 ---------------- */
.preview-tools { display: flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; background: var(--line-soft); border-radius: 8px; padding: 2px; }
.seg-btn {
  border: 0; background: transparent; color: var(--muted);
  font-size: 11.5px; font-weight: 500; padding: 4px 9px; border-radius: 6px;
}
.seg-btn.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pill-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 9px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 11.5px;
}
.pill-btn.is-on { border-color: #c8ecd9; background: var(--accent-soft); color: var(--accent-dark); }

.preview-stage {
  flex: 1; min-height: 0; overflow: auto;
  padding: 18px 16px 28px;
  background:
    radial-gradient(circle at 20% 0%, #ffffff 0%, rgba(255,255,255,0) 55%),
    linear-gradient(180deg, #f7f7f8 0%, #eeeef1 100%);
}
.device {
  width: 375px; flex: none; margin: 0 auto;
  background: #fff; border-radius: 34px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 4px rgba(24,24,27,.05), 0 24px 48px -24px rgba(24,24,27,.28);
  overflow: hidden;
  transition: width .22s ease;
}
.preview-stage::-webkit-scrollbar { width: 8px; height: 8px; }
.preview-stage::-webkit-scrollbar-thumb { background: #dcdce1; border-radius: 5px; }
.preview-stage::-webkit-scrollbar-thumb:hover { background: #c8c8cf; }
.preview-stage::-webkit-scrollbar-track { background: transparent; }
.preview-stage { scrollbar-width: thin; }
.device.wide { width: 677px; border-radius: 18px; }
.device-bar {
  height: 28px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; font-size: 10.5px; font-weight: 600; color: var(--ink); background: #fff;
  position: relative;
}
.device-island {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%);
  width: 76px; height: 15px; background: #111; border-radius: 0 0 10px 10px;
}
.device.wide .device-island { display: none; }
.device-icons { display: flex; gap: 3px; align-items: center; }
.device-icons i { width: 10px; height: 6px; border-radius: 1.5px; background: #d9d9de; }
.device-icons i:first-child { width: 12px; }
.device-head {
  padding: 8px 16px 10px; text-align: center;
  font-size: 13px; font-weight: 600; color: var(--ink);
  background: #fff; border-bottom: 1px solid var(--line-soft);
}
.device-screen {
  max-height: calc(100vh - 250px);
  overflow-y: auto; overflow-x: hidden;
  padding: 0 12px 32px;
  scrollbar-width: thin;
}
.device-screen::-webkit-scrollbar { width: 6px; }
.device-screen::-webkit-scrollbar-thumb { background: #e0e0e4; border-radius: 3px; }
.device-screen::-webkit-scrollbar-track { background: transparent; }

/* 暗色预览时设备外框同步 */
.device.is-dark { border-color: #2c2c30; }
.device.is-dark .device-bar { background: #191919; color: #d4d4d8; }
.device.is-dark .device-icons i { background: #3f3f46; }
.device.is-dark .device-head { background: #191919; color: #ececec; border-bottom-color: #2a2a2e; }
.device.is-dark .device-screen { background: #191919; }
.device.is-dark .article-wrap.num > section > *::before { color: #52525b; }

.article-wrap { position: relative; }
.article-wrap.num { padding-left: 26px; }
.article-wrap.num > section { counter-reset: para; }
.article-wrap.num > section > * { counter-increment: para; }
.article-wrap.num > section > *::before {
  content: counter(para);
  position: absolute; left: -24px; top: 3px;
  width: 20px; text-align: right;
  font-family: var(--font); font-size: 10px; font-weight: 500;
  color: #c9c9cf; letter-spacing: 0;
  pointer-events: none;
}
.article-wrap.num > section > * { position: relative; }
.preview-empty {
  padding: 60px 20px; text-align: center;
  color: var(--muted-2); font-size: 12.5px; line-height: 1.8;
}

/* 违规高亮 */
.wx-hit { outline: 2px solid rgba(220, 38, 38, .55); outline-offset: 2px; border-radius: 3px; }
.wx-hit-flash { animation: hitFlash 1.4s ease; }
@keyframes hitFlash {
  0%, 100% { background-color: transparent; }
  25% { background-color: #fff1f2; }
  60% { background-color: #ffe4e6; }
}

.preview-foot {
  flex: none; height: 38px; padding: 0 14px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--line-soft); background: #fcfcfd;
  font-size: 11.5px; color: var(--muted);
}
.compliance-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.compliance-chip.ok { color: var(--accent-dark); }
.compliance-chip.ok .chip-dot { background: var(--accent); }
.compliance-chip.err { color: var(--err); }
.compliance-chip.err .chip-dot { background: var(--err); }
.compliance-chip.warn { color: var(--warn); }
.compliance-chip.warn .chip-dot { background: var(--warn); }
.preview-note { margin-left: auto; color: var(--muted-2); }

/* ---------------- 侧栏 ---------------- */
.tabs { display: flex; flex: none; padding: 6px 8px 0; gap: 2px; border-bottom: 1px solid var(--line-soft); }
.tab {
  flex: 1; height: 34px; border: 0; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--muted);
  border-radius: 8px 8px 0 0; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.tab:hover { color: var(--ink-2); }
.tab.is-active { color: var(--ink); background: #fbfbfc; }
.tab.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.tab-badge {
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--line-soft); color: var(--muted);
  font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.tab-badge.has { background: var(--err); color: #fff; }

.tab-panel { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 12px; }
.tab-panel.is-active { display: flex; flex-direction: column; }
.tab-panel::-webkit-scrollbar { width: 6px; }
.tab-panel::-webkit-scrollbar-thumb { background: #e4e4e8; border-radius: 3px; }

.cat-row { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; flex: none; }
.cat-chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
}
.cat-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; flex: none; }
.theme-card {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 9px 10px; text-align: left; position: relative;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.theme-card:hover { border-color: #d4d4d8; box-shadow: 0 4px 12px -6px rgba(24,24,27,.18); }
.theme-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-swatch { display: flex; gap: 3px; align-items: center; height: 14px; }
.theme-swatch i { width: 14px; height: 6px; border-radius: 2px; display: block; }
.theme-swatch i:nth-child(1) { width: 26px; }
.theme-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.theme-meta { font-size: 10.5px; color: var(--muted-2); }

/* 样式维度（小标题 / 重点提示） */
.style-block { flex: none; margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line-soft); }
.style-head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.style-head span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.style-head small { font-size: 10px; color: var(--muted-2); }
.style-row { display: flex; gap: 5px; flex-wrap: wrap; }
.style-chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 11.5px; padding: 4px 9px; border-radius: 7px;
  line-height: 1.5;
  transition: border-color .15s, color .15s, background .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.style-chip:hover { border-color: #d4d4d8; color: var(--ink-2); }
.style-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 提示样式的缩略示意：点之前就能看出结构差别 */
.chip-demo {
  width: 14px; height: 11px; flex: none; border-radius: 2px;
  background: #edf0f2; box-shadow: inset 0 0 0 1px #e0e4e8;
  position: relative;
}
.style-chip[data-co="follow"] .chip-demo { background: #f0f2f4; box-shadow: inset 2px 0 0 #5f6873; border-radius: 0 2px 2px 0; }
.style-chip[data-co="card"] .chip-demo { background: #e4e8ec; box-shadow: none; border-radius: 4px; }
.style-chip[data-co="bar"] .chip-demo { background: transparent; box-shadow: inset 3px 0 0 #3f4750; }
.style-chip[data-co="pill"] .chip-demo { background: #e4e8ec; box-shadow: none; }
.style-chip[data-co="pill"] .chip-demo::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 7px; height: 3px; border-radius: 999px; background: #3f4750;
}
.style-chip[data-co="dashed"] .chip-demo { background: #fff; box-shadow: none; border: 1px dashed #7f8791; border-radius: 0; }
.style-chip[data-co="outline"] .chip-demo { background: #fff; box-shadow: none; border: 1px solid #c8ced5; border-top: 2px solid #3f4750; border-radius: 0 0 2px 2px; }
.style-chip[data-co="stripe"] .chip-demo { background: #fff; box-shadow: none; border-top: 2px solid #3f4750; border-bottom: 2px solid #3f4750; border-radius: 0; }
.style-chip[data-co="key"] .chip-demo { background: #e4e8ec; box-shadow: inset 0 -2px 0 #3f4750; border-radius: 3px; }
.style-chip.is-active .chip-demo { box-shadow: inset 0 0 0 1px rgba(255,255,255,.55); }
.style-chip.is-active[data-co="follow"] .chip-demo { background: transparent; box-shadow: inset 2px 0 0 #fff; }
.style-chip.is-active[data-co="bar"] .chip-demo { box-shadow: inset 3px 0 0 rgba(255,255,255,.85); }
.style-chip.is-active[data-co="key"] .chip-demo { box-shadow: inset 0 -2px 0 rgba(255,255,255,.85); }
.style-chip.is-active[data-co="dashed"] .chip-demo { box-shadow: none; border-color: rgba(255,255,255,.8); background: transparent; }
.style-chip.is-active[data-co="outline"] .chip-demo,
.style-chip.is-active[data-co="stripe"] .chip-demo { background: transparent; border-color: rgba(255,255,255,.8); }
.style-chip.is-active[data-co="stripe"] .chip-demo { border-top-color: #fff; border-bottom-color: #fff; }
.style-chip.is-active[data-co="outline"] .chip-demo { border-top-color: #fff; }
.style-chip.is-active[data-co="pill"] .chip-demo { background: rgba(255,255,255,.25); }
.style-chip.is-active[data-co="pill"] .chip-demo::after { background: #fff; }

/* 小标题样式的缩略示意 */
.chip-demo-h, .style-chip.is-active .chip-demo-h { background: #fff; border-radius: 2px; box-shadow: none; }
.chip-demo-h::before, .chip-demo-h::after {
  content: ''; position: absolute; background: #3f4750; border-radius: 1px;
}
.style-chip[data-head="follow"] .chip-demo-h::before { left: 2px; top: 5px; width: 10px; height: 2px; }
.style-chip[data-head="rule"] .chip-demo-h::before { left: 2px; top: 1px; width: 2px; height: 9px; }
.style-chip[data-head="rule"] .chip-demo-h::after { left: 6px; top: 5px; width: 6px; height: 2px; }
.style-chip[data-head="block"] .chip-demo-h { background: #3f4750; }
.style-chip[data-head="block"] .chip-demo-h::before { display: none; }
.style-chip[data-head="band"] .chip-demo-h { background: #3f4750; }
.style-chip[data-head="band"] .chip-demo-h::before { left: 3px; top: 5px; width: 8px; height: 2px; background: #fff; }
.style-chip[data-head="pill"] .chip-demo-h { background: transparent; }
.style-chip[data-head="pill"] .chip-demo-h::before { left: 1px; top: 2px; width: 12px; height: 7px; border-radius: 999px; }
.style-chip[data-head="outline"] .chip-demo-h { background: transparent; border: 1px solid #3f4750; border-radius: 2px; }
.style-chip[data-head="outline"] .chip-demo-h::before { display: none; }
.style-chip[data-head="double"] .chip-demo-h { background: transparent; }
.style-chip[data-head="double"] .chip-demo-h::before { left: 2px; top: 2px; width: 10px; height: 2px; }
.style-chip[data-head="double"] .chip-demo-h::after { left: 2px; bottom: 2px; width: 10px; height: 2px; }
.style-chip[data-head="centerline"] .chip-demo-h { background: transparent; }
.style-chip[data-head="centerline"] .chip-demo-h::before { left: 1px; top: 4px; width: 12px; height: 1px; background: #6f7883; }
.style-chip[data-head="centerline"] .chip-demo-h::after { left: 3px; top: 7px; width: 8px; height: 1px; background: #6f7883; }
.style-chip[data-head="num"] .chip-demo-h { background: transparent; }
.style-chip[data-head="num"] .chip-demo-h::before { left: 1px; top: 3px; width: 4px; height: 5px; }
.style-chip[data-head="num"] .chip-demo-h::after { left: 7px; top: 5px; width: 6px; height: 2px; }

/* 选中态：图标反色，保证在绿色底上看得见 */
.style-chip.is-active .chip-demo-h { background: transparent; border-color: rgba(255,255,255,.9); }
.style-chip.is-active .chip-demo-h::before,
.style-chip.is-active .chip-demo-h::after { background: #fff; }
.style-chip.is-active[data-head="block"] .chip-demo-h { background: rgba(255,255,255,.92); border: 0; }
.style-chip.is-active[data-head="band"] .chip-demo-h { background: rgba(255,255,255,.92); }
.style-chip.is-active[data-head="band"] .chip-demo-h::before { background: #17a05a; }
.style-chip.is-active[data-head="outline"] .chip-demo-h { background: transparent; border-color: rgba(255,255,255,.9); }
.style-chip.is-active[data-head="centerline"] .chip-demo-h::before,
.style-chip.is-active[data-head="centerline"] .chip-demo-h::after { background: rgba(255,255,255,.75); }

/* 体检 */
.check-summary { display: flex; gap: 8px; margin-bottom: 10px; flex: none; }
.sum-item {
  flex: 1; border-radius: 10px; padding: 8px 10px;
  background: var(--line-soft); display: flex; flex-direction: column; gap: 1px;
}
.sum-item b { font-size: 17px; line-height: 1.2; }
.sum-item span { font-size: 10.5px; color: var(--muted); }
.sum-item.err { background: var(--err-soft); }
.sum-item.err b { color: var(--err); }
.sum-item.warn { background: var(--warn-soft); }
.sum-item.warn b { color: var(--warn); }
.sum-item.info { background: var(--info-soft); }
.sum-item.info b { color: var(--info); }

.check-actions { display: flex; gap: 6px; margin-bottom: 10px; flex: none; }
.issue-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 7px; }
.issue {
  border: 1px solid var(--line); border-left: 3px solid var(--muted-2);
  border-radius: 9px; padding: 9px 10px; background: #fff;
  cursor: pointer; transition: background .14s, border-color .14s;
}
.issue:hover { background: #fcfcfd; border-color: #dcdce1; }
.issue:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.issue.error { border-left-color: var(--err); }
.issue.warn { border-left-color: var(--warn); }
.issue.info { border-left-color: var(--info); }
.issue-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.issue-para {
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  background: var(--line-soft); padding: 1px 6px; border-radius: 4px;
}
.issue-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.issue-doc { font-size: 10px; color: var(--muted-2); margin-left: auto; }
.issue-msg { font-size: 11.5px; color: var(--ink-2); line-height: 1.65; }
.issue-detail { font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 4px; }
.issue-snip {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  background: #fafafa; border-radius: 5px; padding: 3px 6px; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.check-empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.9; }
.check-empty b { color: var(--accent-dark); }
.check-foot { flex: none; padding-top: 10px; font-size: 10.5px; color: var(--muted-2); line-height: 1.6; }
.check-foot a { color: var(--info); text-decoration: none; }
.check-foot a:hover { text-decoration: underline; }

/* 微调 */
.tune-group {
  border: 1px solid var(--line); border-radius: 11px; padding: 12px;
  margin-bottom: 10px; background: #fff; flex: none;
}
.tune-group label {
  display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 12px;
}
.tune-group label:last-child { margin-bottom: 0; }
.tune-group output { float: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; margin-top: 9px; border-radius: 999px;
  background: var(--line); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.16);
}
input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: #fff;
  border: 2px solid var(--accent); cursor: pointer;
}
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px !important; cursor: pointer;
}
.switch-row small { display: block; color: var(--muted-2); font-size: 10.5px; margin-top: 2px; }
.switch-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.switch-row span { flex: 1; min-width: 0; }
.switch-row select {
  flex: none;
  border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px;
  font-size: 11.5px; color: var(--ink-2); background: #fff; max-width: 132px;
}
.tune-note {
  border-radius: 11px; background: var(--accent-soft); padding: 11px 12px;
  font-size: 11.5px; color: #14603c; line-height: 1.75; flex: none;
}
.tune-note b { display: block; margin-bottom: 3px; font-size: 12px; }
.tune-note code { background: rgba(255,255,255,.7); padding: 1px 4px; border-radius: 4px; font-size: 11px; }
.tune-note p { margin: 0; }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(24,24,27,.42); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: min(940px, calc(100vw - 40px)); max-height: calc(100vh - 60px);
  background: #fff; border-radius: 16px; box-shadow: 0 32px 64px -24px rgba(0,0,0,.4);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn .18s ease;
}
.modal-sm { width: min(420px, calc(100vw - 40px)); }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line-soft); position: relative; }
.modal-head h3 { margin: 0 0 4px; font-size: 15px; }
.modal-head p { margin: 0; font-size: 11.5px; color: var(--muted); }
.modal-close {
  position: absolute; right: 14px; top: 14px;
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: var(--line-soft); color: var(--muted); font-size: 12px;
}
.modal-close:hover { background: #e4e4e8; }
.modal-body { padding: 16px 20px 20px; overflow: auto; }

/* ---------------- AI 写作提示词 ---------------- */
.btn-prompt { color: var(--accent); border-color: rgba(10,168,92,.28); background: rgba(10,168,92,.06); }
.btn-prompt:hover { background: rgba(10,168,92,.11); border-color: rgba(10,168,92,.4); }
.modal-prompt { width: min(860px, calc(100vw - 40px)); }
.prompt-body { display: flex; flex-direction: column; gap: 12px; }
.prompt-flow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted);
  background: #f8f9fa; border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 8px 12px;
}
.prompt-flow span { display: inline-flex; align-items: center; gap: 5px; }
.prompt-flow b {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.prompt-flow i { color: #c7c7cc; font-style: normal; }
.prompt-tabs { display: flex; align-items: center; gap: 8px; }
.prompt-tab {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 7px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  text-align: left; transition: border-color .16s, background .16s, color .16s;
}
.prompt-tab small { font-size: 10.5px; font-weight: 400; color: var(--muted-2); }
.prompt-tab:hover { border-color: #d6d6db; }
.prompt-tab.is-active { border-color: var(--accent); color: var(--accent); background: rgba(10,168,92,.06); }
.prompt-tab.is-active small { color: rgba(10,168,92,.72); }
.prompt-len { margin-left: auto; font-size: 11px; color: var(--muted-2); }
#promptText {
  width: 100%; height: 34vh; min-height: 240px; max-height: 460px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; background: #fcfcfd;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.85; color: var(--ink-2);
  outline: none;
}
#promptText:focus { border-color: var(--accent); background: #fff; }
.prompt-actions { display: flex; align-items: center; gap: 8px; }
.prompt-tip { margin-left: auto; font-size: 11px; color: var(--muted-2); }
@media (max-width: 720px) {
  .prompt-tabs { flex-wrap: wrap; }
  .prompt-len { width: 100%; margin-left: 0; text-align: right; }
  .prompt-actions { flex-wrap: wrap; }
  .prompt-tip { width: 100%; margin-left: 0; }
  .prompt-tab { flex: 1 1 auto; }
  .prompt-flow i { display: none; }
}
.purify-in { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.purify-in textarea, .purify-out textarea {
  width: 100%; min-height: 120px; max-height: 220px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.7; color: var(--ink-2);
  outline: none;
}
.purify-in textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,168,92,.12); }
.purify-out { display: flex; flex-direction: column; gap: 8px; }
.purify-report { font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.purify-report .muted { color: var(--muted); }
.purify-report ul { margin: 6px 0 0; padding-left: 18px; }
.purify-report li { margin-bottom: 3px; }
.purify-report .ok { color: var(--accent-dark); font-weight: 600; }
.purify-actions { display: flex; gap: 8px; margin-top: 4px; }
.export-body { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.export-item {
  text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 11px 13px; display: flex; flex-direction: column; gap: 2px;
}
.export-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.export-item b { font-size: 13px; }
.export-item span { font-size: 11px; color: var(--muted); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(8px);
  background: #18181b; color: #fff; font-size: 12.5px; line-height: 1.55;
  padding: 9px 16px; border-radius: 14px; z-index: 200;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 赞助入口（顶栏，复制按钮右侧） ---------------- */
.sponsor {
  position: relative; z-index: 2;
  width: 34px; height: 34px; flex: none;
  margin-left: 2px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); color: #c3c8cf;
  transition: color .18s, border-color .18s, transform .18s, background .18s;
}
.sponsor svg { fill: currentColor; display: block; transition: transform .18s; }
.sponsor:hover, .sponsor:focus-visible {
  color: #e0455a; border-color: #f3c9d0; background: #fff5f6;
}
.sponsor:hover svg, .sponsor:focus-visible svg { transform: scale(1.12); }
/* 悬停时盖住图标与气泡之间的空隙，鼠标移过去不会闪断 */
.sponsor::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%); width: 40px; height: 10px;
}
.sponsor-tip {
  position: absolute; right: -4px; top: calc(100% + 8px);
  transform: translateY(-4px); z-index: 3;
  background: #18181b; color: #fff;
  font-size: 11.5px; line-height: 1.5; font-weight: 400;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .16s, transform .16s;
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .55);
}
.sponsor-tip b { color: #7fe0a8; font-weight: 600; }
.sponsor-tip::after {
  content: ''; position: absolute; bottom: 100%; right: 12px;
  border: 4px solid transparent; border-bottom-color: #18181b;
}
.sponsor:hover .sponsor-tip,
.sponsor:focus-visible .sponsor-tip {
  opacity: 1; transform: translateY(0);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1280px) {
  .workspace { grid-template-columns: minmax(300px, 1fr) minmax(340px, 1fr) 300px; }
}
@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }
  .pane-editor { min-height: 460px; }
  .pane-preview { min-height: 640px; }
  .pane-side { max-height: 560px; }
  .device-screen { max-height: none; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 8px; }
}
