:root{
  --bg:#0b0c10;
  --panel:#12131a;
  --card:#161824;
  --text:#e8e9ef;
  --muted:#a9abc0;
  --line:#2a2d40;
  --accent:#7aa2ff;
  --good:#7bffa7;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,
    "PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  background:linear-gradient(180deg,#0b0c10 0%, #0a0b0f 100%);
  color:var(--text);
}

/* ===== 顶部栏 ===== */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  position:sticky;
  top:0;
  background:rgba(11,12,16,.88);
  backdrop-filter: blur(12px);
  z-index:5;
}
.brand{display:flex;gap:12px;align-items:center}
.dot{
  width:12px;height:12px;border-radius:10px;
  background:var(--accent);
  box-shadow:0 0 22px rgba(122,162,255,.35)
}
.title{font-weight:700;letter-spacing:.3px}
.sub{font-size:12px;color:var(--muted);margin-top:2px}
.right{display:flex;align-items:center;gap:14px}
.ver{font-size:12px;color:var(--muted)}

/* ===== 主布局 ===== */
.layout{
  display:grid;
  grid-template-columns: 460px 1fr;
  gap:16px;
  padding:16px;
  align-items:start;
}
@media (max-width: 1050px){
  .layout{grid-template-columns:1fr;}
}

/* ===== 左侧控制面板 ===== */
.panel{
  background:rgba(18,19,26,.88);
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  box-shadow:0 12px 32px rgba(0,0,0,.28);
}

/* 分组块：增加呼吸感 */
.group{
  padding:14px 14px 16px;
  border-radius:16px;
  background:rgba(22,24,36,.55);
  border:1px solid rgba(42,45,64,.75);
  margin-bottom:16px;
}

/* 分组标题更“内容感” */
.gtitle{
  font-weight:700;
  margin-bottom:10px;
  letter-spacing:.2px;
}

/* ===== 输入区 ===== */
textarea{
  width:100%;
  height:240px;
  resize:vertical;
  padding:14px;
  border-radius:14px;
  border:1px solid rgba(42,45,64,.85);
  background:rgba(10,11,15,.6);
  color:var(--text);
  outline:none;
  font-size:14px;
  line-height:1.65;
}
textarea:focus{
  border-color:rgba(122,162,255,.6);
  box-shadow:0 0 0 4px rgba(122,162,255,.12)
}

input,select{
  width:100%;
  padding:9px 10px;
  border-radius:12px;
  border:1px solid rgba(42,45,64,.85);
  background:rgba(10,11,15,.55);
  color:var(--text);
  outline:none;
}
input:focus,select:focus{
  border-color:rgba(122,162,255,.6);
  box-shadow:0 0 0 4px rgba(122,162,255,.12)
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size:12px;
  color:var(--muted);
}

/* 图文设置区：弱化参数感 */
.chk{
  font-size:12px;
  color:var(--muted);
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.chk input{transform:scale(1.05)}

/* ===== 行与按钮 ===== */
.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  margin-top:12px;
}

.btn{
  border:1px solid rgba(42,45,64,.95);
  background:rgba(255,255,255,.04);
  color:var(--text);
  padding:9px 14px;
  border-radius:14px;
  cursor:pointer;
}
.btn:hover{background:rgba(255,255,255,.07)}
.btn.primary{
  background:rgba(122,162,255,.18);
  border-color:rgba(122,162,255,.35)
}
.btn.primary:hover{background:rgba(122,162,255,.26)}
.btn.ghost{background:transparent}

.hint{
  font-size:12px;
  color:var(--muted);
}

/* ===== 右侧预览区 ===== */
.preview{
  background:rgba(18,19,26,.6);
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  min-height:420px;
  box-shadow:0 12px 32px rgba(0,0,0,.28);
}

.phead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.canvasWrap{
  background:rgba(10,11,15,.6);
  border:1px solid rgba(42,45,64,.85);
  border-radius:16px;
  padding:14px;
  overflow:auto;
  max-height: calc(100vh - 200px);
}

canvas{
  display:block;
  margin:auto;
  border-radius:12px;
  box-shadow:0 14px 38px rgba(0,0,0,.38);
}

/* ============================================================
   图注（Caption）布局兜底
   - 如果未来你将图注改为 DOM 渲染（例如 HTML 预览模式），
     这套样式会保证：图注居中、与图片拉开、与正文拉开。
   ============================================================ */

/* 一个通用的图文块容器（可选） */
.img-block,
.figure,
figure{
  text-align:center;
}

/* 图片与图注之间留出“呼吸感” */
figure img,
.img-block img,
.figure img{
  display:block;
  margin:0 auto;
}

/* 图注：居中 + 上下间距 */
figcaption,
.caption,
.img-caption,
.img-block .caption{
  display:block;
  text-align:center;
  font-size:13px;
  line-height:1.55;
  color:rgba(255,255,255,.62);
  margin-top:10px;     /* 距离图片 */
  margin-bottom:18px;  /* 距离后续正文 */
  padding:0 18px;      /* 防止两端贴边 */
}

/* 若你在正文区用 <p class="caption"> 之类，也同样适用 */
p.caption,
p.img-caption{
  margin-top:10px;
  margin-bottom:18px;
}
