/* ==========================================================================
   字帖设计器 · 样式（独立插件，zd- 前缀，仅短代码页/分享页/会员中心加载）
   配色与站点一致：暖米底 #f5f5f2 / 白卡 / 墨绿 #155b43 / 金 #b88b42 / Songti 标题
   ========================================================================== */

.zd-app,
.zd-app * { box-sizing: border-box; }

/* 变量挂 :root：弹窗等 body 直挂节点也要能用 */
:root {
  --zd-bg: #f7f6f1;
  --zd-card: #ffffff;
  --zd-line: #e7e1d5;
  --zd-line-soft: #efe9dd;
  --zd-text: #24332c;
  --zd-muted: #788078;
  --zd-faint: #9a9a93;
  --zd-accent: #155b43;
  --zd-accent-2: #24785a;
  --zd-accent-soft: #eef5ed;
  --zd-gold: #b88b42;
  --zd-gold-soft: #f7f0e2;
  --zd-danger: #b4553f;
  --zd-danger-soft: #f8ece8;
  --zd-stage: #efece3;
  --zd-serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
}

.zd-app {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 16px 0 40px;
  color: var(--zd-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.zd-app [hidden] { display: none !important; }

/* ==================== 启动占位 ==================== */
.zd-app .zd-boot {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 120px 20px; color: var(--zd-muted);
  background: var(--zd-card); border: 1px solid var(--zd-line); border-radius: 14px;
}
.zd-boot-spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #dfe6df; border-top-color: var(--zd-accent);
  animation: zd-spin 0.8s linear infinite;
}
@keyframes zd-spin { to { transform: rotate(360deg); } }

/* ==================== 顶栏 ==================== */
.zd-top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--zd-card);
  border: 1px solid var(--zd-line);
  border-radius: 0;
  padding: 3.5px 14px;
  margin-bottom: 0;
}
/* 移动端三段吸顶栏（‹ 首页 | 标题 | 汉堡）：桌面隐藏 */
.zd-top-row { display: none; }
/* 工具栏内按钮随之紧凑 */
.zd-top .zd-btn { padding: 5px 11px; }
.zd-top .zd-btn svg { width: 16px; height: 16px; }
/* 沉浸模式：工具栏随一体面板贴合页眉底边，固定不滚 */
.zd-immersive .zd-top {
  position: relative; z-index: 500;
  margin-bottom: 0;
}
/* 设计器页：页眉与工具栏之间只留一条线（与工具栏底线同款），无投影——仅设计器页生效 */
body.zd-immersive #masthead.site-header {
  box-shadow: none !important;
  border-bottom: 1px solid var(--zd-line) !important;
}
body.zd-immersive #masthead .site-header-inner-wrap.kadence-sticky-header,
body.zd-immersive #masthead .site-header-inner-wrap.kadence-sticky-header.item-is-fixed,
body.zd-immersive #masthead.site-header.item-is-stuck {
  background: #fffdf8 !important;
  box-shadow: none !important;
  border-bottom: 0 !important;
}
/* 设计器页禁止页眉悬浮（Kadence sticky：滚动/吸附时变 fixed 盖住工具栏），强制回到文档流拼接在工具栏上方 */
body.zd-immersive #masthead.site-header .site-header-inner-wrap.kadence-sticky-header.item-is-fixed,
body.zd-immersive #masthead.site-header.item-is-stuck,
body.zd-immersive #masthead.site-header .kadence-sticky-header.item-is-fixed {
  position: static !important;
  transform: none !important;
  top: 0 !important;
}
/* 一体工作面板：工具栏 + 三栏同块白面板，栏间细线分隔（顶边无边框，与页眉相连只留页眉那条线） */
.zd-shell { background: #f7f6f1; border: 0; }
.zd-shell .zd-top {
  background: #fffdf8;
  border: 0; border-bottom: 1px solid var(--zd-line);
  border-radius: 0; margin-bottom: 0;
  box-shadow: none;
}
.zd-shell .zd-main { gap: 10px; }
.zd-shell .zd-lib, .zd-shell .zd-prop { background: transparent; border: 0; border-radius: 0; }
.zd-shell .zd-stage-wrap { border: 0; border-radius: 0; max-height: none; }
/* 细滚动条（与生成器一致：5px 胶囊形） */
.zd-lib, .zd-prop, .zd-viewer-body, .zd-modal-body, .zd-stage-wrap {
  scrollbar-width: thin;
  scrollbar-color: #ded7cd transparent;
}
.zd-lib::-webkit-scrollbar, .zd-prop::-webkit-scrollbar, .zd-viewer-body::-webkit-scrollbar,
.zd-modal-body::-webkit-scrollbar, .zd-stage-wrap::-webkit-scrollbar { width: 5px; height: 5px; }
.zd-lib::-webkit-scrollbar-thumb, .zd-prop::-webkit-scrollbar-thumb, .zd-viewer-body::-webkit-scrollbar-thumb,
.zd-modal-body::-webkit-scrollbar-thumb, .zd-stage-wrap::-webkit-scrollbar-thumb {
  background: #ded7cd; border-radius: 999px;
}
.zd-lib::-webkit-scrollbar-track, .zd-prop::-webkit-scrollbar-track, .zd-viewer-body::-webkit-scrollbar-track,
.zd-modal-body::-webkit-scrollbar-track, .zd-stage-wrap::-webkit-scrollbar-track { background: transparent; }
.zd-logo {
  display: flex; align-items: baseline; gap: 8px; margin-right: 4px; white-space: nowrap;
}
.zd-logo b {
  font-family: var(--zd-serif); font-size: 18px; font-weight: 700;
  color: var(--zd-text); letter-spacing: 1px;
}
.zd-logo i { font-style: normal; font-size: 11px; color: var(--zd-faint); letter-spacing: 2px; }

.zd-doc-title {
  flex: 1 1 150px; min-width: 120px; max-width: 240px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; padding: 7px 10px;
  font-size: 14px; font-weight: 600; color: var(--zd-text);
  transition: border-color .15s, background .15s;
}
.zd-doc-title:hover { background: #fbf9f3; }
.zd-doc-title:focus { outline: none; border-color: var(--zd-accent); background: #fff; }

.zd-top-group {
  display: flex; align-items: center; gap: 6px;
}
.zd-top-sep { width: 1px; height: 22px; background: var(--zd-line); margin: 0 2px; }
.zd-top-spacer { flex: 1 1 8px; }

.zd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--zd-line); border-radius: 9px;
  background: #fff; color: var(--zd-text);
  padding: 7px 13px; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: all .15s ease;
  text-decoration: none;
}
.zd-btn:hover { border-color: #ddd5c7; background: #fbf8f1; }
.zd-btn:active { transform: translateY(1px); }
.zd-btn svg { width: 15px; height: 15px; flex: none; }
.zd-btn-primary {
  background: var(--zd-accent); border-color: var(--zd-accent); color: #fff;
}
.zd-btn-primary:hover { background: var(--zd-accent-2); border-color: var(--zd-accent-2); }
.zd-btn-gold {
  background: var(--zd-gold-soft); border-color: #e8d9bd; color: #8a6a33;
}
.zd-btn-gold:hover { background: #f2e8d4; }
.zd-btn-danger { color: var(--zd-danger); }
.zd-btn-danger:hover { background: var(--zd-danger-soft); border-color: #e5c9c0; }
.zd-btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.zd-btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.zd-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: 8px;
  border: 1px solid var(--zd-line); background: #fff; color: var(--zd-text);
  cursor: pointer; transition: all .15s;
}
.zd-icon-btn:hover { color: var(--zd-accent); border-color: #ddd5c7; background: var(--zd-accent-soft); }
.zd-icon-btn svg { width: 16px; height: 16px; flex: none; stroke-width: 2; }
.zd-icon-btn[disabled] { opacity: .4; cursor: not-allowed; }

.zd-zoom-label { font-size: 12px; color: var(--zd-muted); min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

.zd-mobile-only { display: none; }
/* 移动端底部 Tab 栏 / 更多抽屉：桌面隐藏 */
.zd-tabbar, .zd-sheet, .zd-sheet-mask { display: none; }

/* ==================== 主体三栏 ==================== */
.zd-main {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 300px;
  gap: 10px;
  align-items: start;
}

/* ---------- 左：组件库 ---------- */
.zd-lib {
  background: var(--zd-card); border: 1px solid var(--zd-line); border-radius: 0;
  padding: 12px; position: sticky; top: 96px;
  max-height: calc(100vh - 116px); overflow-y: auto;
}
.zd-lib-title, .zd-prop-title {
  font-family: var(--zd-serif); font-size: 14.5px; font-weight: 700;
  color: var(--zd-text); letter-spacing: .5px;
  padding: 2px 4px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
/* 属性面板标题 = 组件名：左缘与下方字段小标题对齐（面板内边距 12px 处） */
.zd-prop-title {
  font-size: 15px;
  padding: 2px 4px 10px 0;
}
/* 信息行 · 填空项多选胶囊（选中=墨绿实底白字，未选=白底描边） */
.zd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.zd-chips button {
  border: 1px solid var(--zd-line); border-radius: 999px;
  background: #fff; color: #4a544e;
  padding: 6px 15px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .13s ease;
  -webkit-user-select: none; user-select: none;
}
.zd-chips button:hover { border-color: var(--zd-accent); color: var(--zd-accent); }
.zd-chips button.on { background: var(--zd-accent); border-color: var(--zd-accent); color: #fff; }
/* 自定义页眉输入框：胶囊状，提示“自定义” */
.zd-chips input.zd-chip-input {
  border: 1px solid var(--zd-accent); border-radius: 999px;
  background: #fff; color: #4a544e; outline: none;
  padding: 6px 14px; font-size: 13px; font-weight: 600; font-family: inherit;
  width: 116px; min-width: 92px; box-sizing: border-box;
  transition: all .13s ease;
}
.zd-chips input.zd-chip-input::placeholder { color: #a8b0ab; font-weight: 500; }
.zd-chips input.zd-chip-input.on { background: var(--zd-accent); border-color: var(--zd-accent); color: #fff; }
.zd-chips input.zd-chip-input.on::placeholder { color: rgba(255,255,255,.75); }
/* 属性面板底部操作提示（布局/边距/字号/颜色对齐未选中状态 .zd-prop-none） */
.zd-prop-tip {
  display: flex; flex-direction: column; align-items: center;
  padding: 24px 10px 30px;
  border-top: 1px solid var(--zd-line-soft);
  text-align: center;
}
.zd-tip-ico {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--zd-accent-soft); color: var(--zd-accent);
  margin-bottom: 10px; flex: none;
}
.zd-tip-ico svg { width: 17px; height: 17px; }
.zd-prop-tip p { margin: 0; font-size: 12.5px; line-height: 1.9; color: var(--zd-faint); }
/* 开关字段单行排版：标题左、开关右（修复标题重复显示两次） */
.zd-field.zd-field-switch { display: flex; align-items: center; justify-content: space-between; }
.zd-field.zd-field-switch > label { margin: 0; }
/* 抽屉收起按钮：桌面隐藏，移动端底部抽屉专用 */
.zd-fold { display: none; }
/* 颜色字段单行：标题左、右侧胶囊（圆角色块 + 色号），样式对齐参考稿 */
.zd-field.zd-field-color { display: flex; align-items: center; justify-content: space-between; }
.zd-field.zd-field-color > label { margin: 0; }
.zd-color-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--zd-line); border-radius: 10px;
  background: #fff; padding: 4px 10px 4px 4px; cursor: pointer;
}
.zd-color-pill .zd-color {
  width: 26px; height: 26px; padding: 0; border: 0;
  border-radius: 8px; background: none; cursor: pointer;
}
.zd-color-pill .zd-color::-webkit-color-swatch-wrapper { padding: 0; }
.zd-color-pill .zd-color::-webkit-color-swatch { border: 0; border-radius: 8px; }
.zd-color-pill .zd-color-hex { font-size: 13px; color: var(--zd-muted); font-variant-numeric: tabular-nums; }
/* 色块字段：预设色块一行，最后一个是调色板（自定义颜色） */
.zd-swatches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.zd-sw {
  width: 26px; height: 26px; border-radius: 8px; padding: 0;
  border: 1px solid rgba(0,0,0,.08); cursor: pointer; position: relative;
}
.zd-sw.on { box-shadow: 0 0 0 2px var(--zd-stage, #fff), 0 0 0 3.5px var(--zd-green, #2f6f4f); }
.zd-sw-custom { background: conic-gradient(#f87171,#fbbf24,#34d399,#60a5fa,#a78bfa,#f87171); overflow: hidden; }
.zd-sw-custom input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: 0; padding: 0;
}
/* 输入框提示词：小一号浅色，不抢正文 */
.zd-input::placeholder, .zd-textarea::placeholder { font-size: 12px; color: var(--zd-faint); }
.zd-lib-group { margin-bottom: 12px; }
.zd-lib-group:last-child { margin-bottom: 2px; }
.zd-lib .zd-lib-group h4 {
  margin: 12px 0; font-size: 11px; font-weight: 600; letter-spacing: 2px;
  color: var(--zd-faint); text-transform: uppercase; padding-left: 4px;
}
.zd-lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.zd-lib-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 7px 4px 7px;
  border: 1px solid var(--zd-line); border-radius: 9px;
  background: #fff; cursor: pointer;
  font-size: 12.5px; color: #4a544e; text-align: center; line-height: 1.2;
  transition: all .13s ease;
  -webkit-user-select: none; user-select: none;
}
.zd-lib-item svg { width: 27px; height: 27px; color: #8ba398; stroke-width: 1.5; transition: color .13s; }
.zd-lib-item:hover { border-color: var(--zd-accent); color: var(--zd-accent); background: var(--zd-accent-soft); }
.zd-lib-item:hover svg { color: var(--zd-accent); }
.zd-lib-item:active { transform: scale(.96); }

/* ---------- 中：画布区 ---------- */
.zd-center { min-width: 0; }
.zd-stage-wrap {
  background: var(--zd-stage);
  border: 1px solid var(--zd-line);
  border-radius: 0;
  overflow: auto;
  max-height: calc(100vh - 190px);
  position: relative;
}
.zd-stage {
  padding: 14px 20px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  transform-origin: top center;
}
.zd-page-wrap { position: relative; }
/* 画布选中浮条：整条墨绿操作条（样式对齐悬停灰条），标签左、按钮右，整条可点击防误触 */
.zd-sel-float {
  position: absolute; display: flex; align-items: center; justify-content: space-between;
  height: 24px; z-index: 8; pointer-events: auto;
  background: var(--zd-accent); color: #fff;
  border: 0; border-radius: 6px 6px 0 0;
  padding: 0 4px 0 0; min-width: fit-content; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(21, 91, 67, .3);
}
.zd-sel-tag {
  pointer-events: auto; background: none; color: #fff;
  font-size: 11px; line-height: 1; padding: 0 8px;
  box-shadow: none; white-space: nowrap;
}
.zd-sel-ops { pointer-events: auto; display: flex; gap: 1px; }
.zd-sel-ops button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0;
  border: 0; border-radius: 5px;
  background: none; color: #fff; cursor: pointer;
  box-shadow: none; transition: background .12s;
}
.zd-sel-ops button:hover { background: rgba(255, 255, 255, .25); color: #fff; }
.zd-sel-ops button.zd-op-del:hover { border-color: transparent; background: rgba(255, 255, 255, .25); color: #fff; }
.zd-sel-ops button svg { width: 12px; height: 12px; }
.zd-sel-float.zd-float-below { border-radius: 0 0 6px 6px; }
/* 数学口算「换一批」胶囊按钮：悬浮在组件底边中央（半嵌组件内），墨绿主色 */
.zd-batch-btn {
  position: absolute; z-index: 9;
  transform: translateX(-50%);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 30px; padding: 0 14px;
  border: 0; border-radius: 15px;
  background: var(--zd-accent); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(21, 91, 67, .35);
  transition: filter .12s;
}
.zd-batch-btn:hover { filter: brightness(1.12); }
.zd-batch-btn svg { width: 13px; height: 13px; }
/* 拖拽插入指示线 */
.zd-drop-line {
  position: absolute; left: 0; right: 0; height: 0; z-index: 5;
  border-top: 2px dashed var(--zd-accent); pointer-events: none;
}
.zd-drop-line::before {
  content: ""; position: absolute; left: -2px; top: -5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--zd-accent);
}
/* 拖拽扫过/鼠标划过模块的灰色高亮：灰边框 + 灰操作条（组件名 + 复制/上移/下移/删除），参考站效果 × 本站灰调 */
.zd-hover-box {
  position: absolute; z-index: 6; pointer-events: none;
  border: 2px solid #9aa39b; border-radius: 2px;
  display: none;
}
.zd-hover-bar {
  position: absolute; top: -26px; left: -2px; right: -2px; height: 24px;
  display: flex; align-items: center; justify-content: space-between;
  background: #9aa39b; color: #fff;
  pointer-events: auto; cursor: default;
  border-radius: 6px 6px 0 0;
}
.zd-hover-tag {
  font-size: 11px; line-height: 1; padding: 0 8px; white-space: nowrap;
}
.zd-hover-ops { display: flex; gap: 1px; padding-right: 3px; }
.zd-hover-ops button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px;
  background: none; color: #fff; cursor: pointer;
}
.zd-hover-ops button:hover { background: rgba(255, 255, 255, .25); }
.zd-hover-ops button svg { width: 12px; height: 12px; }
.zd-hover-box.zd-hover-below .zd-hover-bar {
  top: auto; bottom: -26px; border-radius: 0 0 6px 6px;
}
body.zd-dragging, body.zd-dragging * { cursor: grabbing !important; }
.zd-lib .zd-lib-item:active { opacity: .55; }
.zd-page {
  display: block;
  background: #fff;
  box-shadow: 0 2px 6px rgba(36,51,44,.08), 0 12px 28px -12px rgba(36,51,44,.16);
  border-radius: 2px;
}
.zd-page-wrap.zd-selected .zd-page {
  outline: 2px solid var(--zd-accent); outline-offset: 2px;
}
.zd-page-num {
  position: absolute; left: 50%; bottom: -21px; transform: translateX(-50%);
  font-size: 11px; color: var(--zd-faint); background: transparent;
}
.zd-page-mark {
  position: absolute; right: -34px; top: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.zd-page-mark button {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--zd-line); background: #fff;
  color: var(--zd-muted); font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(36,51,44,.08);
}
.zd-page-mark button:hover { color: var(--zd-accent); border-color: var(--zd-accent); }
.zd-page-mark button.zd-del:hover { color: var(--zd-danger); border-color: var(--zd-danger); }

.zd-empty-stage {
  padding: 80px 30px; text-align: center; color: var(--zd-faint);
}
.zd-empty-stage p { margin: 6px 0 18px; font-size: 13px; }
.zd-empty-stage .zd-serif { font-family: var(--zd-serif); font-size: 20px; color: var(--zd-muted); letter-spacing: 1px; }

/* 溢出警告条 */
.zd-flow-warn {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 9px 14px;
  background: #fdf6ec; border: 1px solid #f0e2c8; border-radius: 10px;
  color: #8a6a33; font-size: 12.5px;
}
.zd-flow-warn svg { width: 15px; height: 15px; flex: none; }

/* ---------- 右：属性面板 ---------- */
.zd-prop {
  background: var(--zd-card); border: 1px solid var(--zd-line); border-radius: 0;
  padding: 12px; position: sticky; top: 96px;
  max-height: calc(100vh - 116px); overflow-y: auto;
}
.zd-prop-none { padding: 30px 10px; text-align: center; color: var(--zd-faint); font-size: 12.5px; line-height: 1.9; }
.zd-prop-none .ico { display: block; margin: 0 auto 10px; width: 34px; height: 34px; border-radius: 10px; background: var(--zd-accent-soft); color: var(--zd-accent); display: flex; align-items: center; justify-content: center; }
.zd-prop-none .ico svg { width: 17px; height: 17px; }

/* 属性面板标题行：组件名即标题，右侧内联操作按钮 + 关闭 */
.zd-title-ops { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.zd-title-ops button,
.zd-prop-title button[data-act="deselect"] {
  border: 0; background: none; color: var(--zd-faint); cursor: pointer;
  padding: 2px; display: inline-flex; align-items: center; justify-content: center;
}
.zd-title-ops button svg { width: 14px; height: 14px; }
.zd-prop-title button[data-act="deselect"] svg { width: 15px; height: 15px; display: block; }
.zd-title-ops button:hover { color: var(--zd-accent); }
.zd-title-ops button[data-act="del"]:hover { color: var(--zd-danger); }
.zd-prop-title button[data-act="deselect"]:hover { color: var(--zd-text); }

.zd-field { margin-bottom: 12px; }
.zd-field > label {
  display: block; font-size: 12px; color: var(--zd-muted); margin-bottom: 5px; font-weight: 500;
}
.zd-field > label em { font-style: normal; color: var(--zd-faint); font-weight: 400; }
.zd-field-row { display: flex; gap: 8px; align-items: center; }
.zd-field-row > * { flex: 1 1 0; min-width: 0; }

.zd-input, .zd-select, .zd-textarea {
  width: 100%; border: 1px solid var(--zd-line); border-radius: 8px;
  background: #fff; color: var(--zd-text);
  padding: 7px 9px; font-size: 13px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.zd-input:focus, .zd-select:focus, .zd-textarea:focus {
  outline: none; border-color: var(--zd-accent); box-shadow: 0 0 0 3px rgba(21,91,67,.08);
}
.zd-textarea { resize: vertical; min-height: 64px; line-height: 1.6; }
.zd-select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23788078' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 26px; }

.zd-range-row { display: flex; align-items: center; gap: 9px; }
/* 滑块与生成器同款：4px 胶囊轨道 + 已选墨绿渐变 + 白底绿边圆点 */
.zd-range {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 18px; margin: 0;
  background: transparent !important; border: 0 !important;
  padding: 0 !important; box-shadow: none !important;
  outline: none; cursor: pointer;
}
.zd-range::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px;
  background: linear-gradient(to right,
    var(--zd-accent) 0%, var(--zd-accent) var(--zd-pct, 50%),
    #eae5de var(--zd-pct, 50%), #eae5de 100%);
}
.zd-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: #fff; border: 2px solid var(--zd-accent);
  box-shadow: 0 1px 3px rgba(36, 51, 44, 0.18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.zd-range:active::-webkit-slider-thumb {
  transform: scale(1.12);
  box-shadow: 0 2px 6px rgba(36, 51, 44, 0.22);
}
.zd-range::-moz-range-track { height: 4px; border-radius: 999px; background: #eae5de; }
.zd-range::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--zd-accent); }
.zd-range::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--zd-accent);
  box-shadow: 0 1px 3px rgba(36, 51, 44, 0.18);
}
.zd-range-val { font-size: 12px; color: var(--zd-text); min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

.zd-color-row { display: flex; align-items: center; gap: 8px; }
.zd-color { width: 34px; height: 28px; padding: 2px; border: 1px solid var(--zd-line); border-radius: 7px; background: #fff; cursor: pointer; flex: none; }
.zd-color::-webkit-color-swatch-wrapper { padding: 0; }
.zd-color::-webkit-color-swatch { border: none; border-radius: 4px; }
.zd-color-hex { font-size: 12px; color: var(--zd-faint); font-family: ui-monospace, Menlo, monospace; }

.zd-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.zd-switch-row > label { font-size: 12.5px; color: var(--zd-text); font-weight: 500; }
.zd-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; cursor: pointer; }
.zd-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.zd-switch .track {
  position: absolute; inset: 0; border-radius: 20px; background: #d9d9d3;
  transition: background .18s; cursor: pointer;
}
.zd-switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .18s;
}
.zd-switch input:checked + .track { background: var(--zd-accent); }
.zd-switch input:checked + .track::after { transform: translateX(16px); }

/* 背景图片上传（对齐生成器：选择图片按钮 + 文件名） */
.zd-bgfile-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.zd-upload-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 12px; border: 1px solid var(--zd-line); border-radius: 8px;
  background: #fff; font-size: 12.5px; font-weight: 500; color: var(--zd-text);
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.zd-upload-btn:hover { border-color: var(--zd-accent); color: var(--zd-accent); background: var(--zd-accent-soft); }
.zd-upload-btn input { display: none; }
.zd-file-name {
  flex: 1; min-width: 0; font-size: 12px; color: var(--zd-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 状态 1 分组：模板信息 / 纸张设置 / 页面设置 */
.zd-pgroup {
  font-family: var(--zd-serif); font-size: 13.5px; font-weight: 700;
  color: var(--zd-text); letter-spacing: 1px;
  margin: 4px 0 10px; padding: 10px 0 8px;
  border-top: 1px solid var(--zd-line-soft);
}
.zd-pgroup:first-child, .zd-prop-title + .zd-pgroup { border-top: 0; margin-top: 12px; padding-top: 0; }
.zd-sub { border: 1px solid var(--zd-line-soft); border-radius: 10px; padding: 10px 10px 11px; margin-bottom: 10px; background: #fffdf9; }
.zd-sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.zd-sub-head > span:first-child { font-size: 12px; font-weight: 500; color: var(--zd-muted); }
.zd-sub-body { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.zd-sub-body[hidden] { display: none; }
.zd-sub-body .zd-field { margin-bottom: 0; }
.zd-sub-body .zd-input { width: 100%; }
#zdDocTitle { font-size: 12px; }
#zdDocTitle:focus::placeholder, #zdDocTitle.zd-ph-hide::placeholder { color: transparent; }

.zd-seg { display: flex; border: 1px solid var(--zd-line); border-radius: 8px; overflow: hidden; }
.zd-seg button {
  flex: 1; border: 0; background: #fff; padding: 6px 4px; font-size: 12px; color: var(--zd-muted);
  cursor: pointer; border-right: 1px solid var(--zd-line); transition: all .13s; white-space: nowrap;
}
.zd-seg button:last-child { border-right: 0; }
.zd-seg button.on { background: var(--zd-accent-soft); color: var(--zd-accent); font-weight: 600; }

/* 字体单选：两列网格，按钮用字体自身预览 */
.zd-font-seg { display: flex; flex-wrap: wrap; border: 0; gap: 6px; overflow: visible; }
.zd-font-seg button,
.zd-font-seg button:last-child {
  flex: 0 0 calc(50% - 3px); border: 1px solid var(--zd-line); border-right: 1px solid var(--zd-line);
  border-radius: 8px; padding: 9px 4px; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis;
}
.zd-font-seg button.on { border-color: var(--zd-accent); background: var(--zd-accent-soft); }

.zd-grid-style-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.zd-grid-style-pick button {
  border: 1px solid var(--zd-line); border-radius: 8px; background: #fff;
  padding: 5px 2px 4px; cursor: pointer; text-align: center;
  font-size: 10.5px; color: var(--zd-muted); transition: all .13s; line-height: 1.3;
}
.zd-grid-style-pick button svg { display: block; width: 26px; height: 26px; margin: 0 auto 3px; }
.zd-grid-style-pick button:hover { border-color: #b9c6bd; }
.zd-grid-style-pick button.on { border-color: var(--zd-accent); color: var(--zd-accent); background: var(--zd-accent-soft); }
/* 图案选择器（控笔笔画等）：笔画/偏旁用字符图标 */
.zd-grid-style-pick button .zd-pt-char {
  display: block; width: 26px; height: 26px; margin: 0 auto 3px;
  font-size: 21px; line-height: 26px; color: var(--zd-text); font-family: "Kaiti SC","KaiTi","STKaiti",serif;
}
.zd-grid-style-pick button.on .zd-pt-char { color: var(--zd-accent); }

.zd-tip { font-size: 11px; color: var(--zd-faint); line-height: 1.6; margin: 4px 0 10px; }
.zd-divider { height: 1px; background: var(--zd-line); margin: 14px 0; }
.zd-prop-actions { display: flex; gap: 8px; margin-top: 6px; }
.zd-prop-actions .zd-btn { flex: 1; justify-content: center; }

/* 会员锁角标 */
.zd-lock-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; color: #8a6a33; background: var(--zd-gold-soft);
  border: 1px solid #e8d9bd; border-radius: 4px; padding: 1px 5px;
  margin-left: 5px; vertical-align: 1px;
}
.zd-lib-item.zd-locked { opacity: .62; position: relative; }
.zd-lib-item.zd-locked::after {
  content: "会员"; position: absolute; top: 3px; right: 3px;
  font-size: 9px; color: #8a6a33; background: var(--zd-gold-soft);
  border-radius: 3px; padding: 0 3px;
}

/* ==================== 弹窗 ==================== */
.zd-mask {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(36, 51, 44, .38);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: zd-fade .18s ease;
}
@keyframes zd-fade { from { opacity: 0; } }
.zd-modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: min(80vh, 640px); display: flex; flex-direction: column;
  box-shadow: 0 24px 60px -12px rgba(36,51,44,.35);
  animation: zd-pop .2s ease;
}
@keyframes zd-pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.zd-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--zd-line);
}
.zd-modal-head h3 { margin: 0; font-family: var(--zd-serif); font-size: 17px; letter-spacing: 1px; }
.zd-modal-close {
  border: 0; background: none; font-size: 20px; color: var(--zd-faint);
  cursor: pointer; width: 30px; height: 30px; border-radius: 8px; line-height: 1;
}
/* 放大预览弹窗（对齐生成器预览） */
.zd-viewer-mask { background: rgba(26, 32, 28, .45); padding: 0; }
.zd-viewer {
  width: min(1160px, 92vw); height: min(86vh, 900px);
  background: #fff; border: 1px solid #ebebe8; border-radius: 18px;
  box-shadow: 0 32px 80px rgba(18, 26, 22, .38);
  display: flex; flex-direction: column; overflow: hidden;
  animation: zd-pop .2s ease;
}
.zd-viewer-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px 20px; border-bottom: 1px solid var(--zd-line);
}
.zd-viewer-head { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.zd-viewer-head h3 { margin: 0; font-family: var(--zd-serif); font-size: 17px; letter-spacing: 1px; color: var(--zd-text); }
.zd-viewer-meta { font-size: 12.5px; color: var(--zd-muted); white-space: nowrap; }
.zd-viewer-meta b { color: var(--zd-accent); font-weight: 600; }
.zd-viewer-tools { display: flex; align-items: center; gap: 8px; }
.zd-vbtn {
  height: 32px; padding: 0 12px;
  border: 1px solid var(--zd-line); border-radius: 8px;
  background: #fff; color: var(--zd-text); font-size: 13px; cursor: pointer;
  transition: all .12s; white-space: nowrap;
}
.zd-vbtn:hover { border-color: var(--zd-accent); color: var(--zd-accent); background: var(--zd-accent-soft); }
.zd-vbtn-primary { background: var(--zd-accent); border-color: var(--zd-accent); color: #fff; }
.zd-vbtn-primary:hover { background: var(--zd-accent-2); border-color: var(--zd-accent-2); color: #fff; }
.zd-viewer-body { flex: 1; min-height: 0; overflow: auto; background: #f7f7f5; padding: 24px; }
.zd-viewer-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.zd-viewer-pages .zd-page { box-shadow: 0 6px 24px rgba(36, 51, 44, .14); border-radius: 2px; flex: none; }
.zd-modal-close {
  border: 0; background: none; padding: 0; flex: none;
  color: var(--zd-faint); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.zd-modal-close svg { width: 16px; height: 16px; display: block; }
/* 兜底：弹窗内未显式设定尺寸的内联图标 */
.zd-mask svg { max-width: 20px; max-height: 20px; }
.zd-modal-close:hover { background: #f5f1e8; color: var(--zd-text); }
/* 纸张颜色色块 */
.zd-paper-colors { display: flex; gap: 8px; }
.zd-paper-colors button {
  width: 26px; height: 26px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1px solid rgba(36, 51, 44, .14);
  box-shadow: inset 0 0 0 2px #fff;
  transition: transform .12s, box-shadow .12s;
}
/* 自定义色块：纸张=淡青浅色，水印=深墨绿；透明取色 input 由 JS 覆盖其上，真实点击直接弹系统调色板 */
.zd-paper-colors { position: relative; }
.zd-paper-colors button.zd-pgp-custom {
  background: #e8f5f1;
}
.zd-paper-colors[data-pgc] button.zd-pgp-custom {
  background: #2f4a3e;
}
.zd-paper-colors .zd-pgp-picker {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  border: 0; padding: 0; margin: 0; cursor: pointer;
}
.zd-paper-colors button:hover { transform: scale(1.12); }
.zd-paper-colors button.on {
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--zd-accent);
  transform: scale(1.08);
}
.zd-modal-body { padding: 16px 20px 20px; overflow-y: auto; }
.zd-modal-foot { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-end; }

.zd-share-link-row { display: flex; gap: 8px; }
.zd-share-link-row .zd-input { flex: 1; font-size: 12.5px; color: var(--zd-muted); }

.zd-doc-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.zd-doc-card {
  border: 1px solid var(--zd-line); border-radius: 11px; padding: 11px 12px;
  display: flex; flex-direction: column; gap: 3px; transition: border-color .15s;
}
.zd-doc-card:hover { border-color: #c9d4cc; }
.zd-doc-card b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zd-doc-card time { font-size: 11px; color: var(--zd-faint); }
.zd-doc-card .ops { display: flex; gap: 10px; margin-top: 6px; font-size: 12px; }
.zd-doc-card .ops a, .zd-doc-card .ops button {
  color: var(--zd-accent); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: 12px;
}
.zd-doc-card .ops .del { color: var(--zd-faint); }
.zd-doc-card .ops .del:hover { color: var(--zd-danger); }
.zd-doc-empty { text-align: center; color: var(--zd-faint); padding: 34px 0; font-size: 13px; }

.zd-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
.zd-tpl-card {
  border: 1px solid var(--zd-line); border-radius: 11px; padding: 10px;
  cursor: pointer; text-align: center; transition: all .15s; position: relative;
}
.zd-tpl-card:hover { border-color: var(--zd-accent); box-shadow: 0 4px 14px -6px rgba(21,91,67,.25); transform: translateY(-1px); }
.zd-tpl-card canvas { width: 100%; border-radius: 6px; background: #fff; border: 1px solid var(--zd-line-soft); display: block; }
.zd-tpl-ph {
  aspect-ratio: 290 / 410; border: 1px dashed #e0d3bd; border-radius: 6px;
  background: #fdfaf4; color: #a98f63; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; font-size: 12px;
}
.zd-tpl-ph svg { width: 22px; height: 22px; }
.zd-tpl-ph b { font-size: 13px; color: #8a6a33; }
.zd-tpl-ph span { font-size: 11px; color: #b8a382; }
.zd-tpl-card b { display: block; font-size: 12.5px; margin-top: 7px; font-weight: 600; }
.zd-tpl-card .zd-lock-tag { position: absolute; top: 14px; right: 14px; margin: 0; }
.zd-lock-tag.open { color: #155b43; background: var(--zd-accent-soft); border-color: #cfe2d2; }
.zd-tpl-card.zd-locked { opacity: .66; }
.zd-tpl-card.zd-locked canvas { filter: grayscale(.5) blur(.4px); }
.zd-tpl-card.zd-locked:hover { border-color: var(--zd-gold); }
.zd-tpl-name { font-size: 12.5px; font-weight: 600; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zd-tpl-sub { font-size: 11px; color: var(--zd-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 模板库筛选（参考目标站：搜索 / 年级 / 场景标签 / 精选） */
.zd-tpl-filters { display: flex; gap: 8px; margin-bottom: 10px; }
.zd-tpl-search {
  flex: 1; height: 34px; border: 1px solid var(--zd-line); border-radius: 8px;
  padding: 0 12px; font-size: 13px; color: #2b2f2c; background: #fff; outline: none;
}
.zd-tpl-search:focus { border-color: var(--zd-accent); }
.zd-tpl-grade {
  height: 34px; border: 1px solid var(--zd-line); border-radius: 8px;
  padding: 0 10px; font-size: 13px; color: #2b2f2c; background: #fff;
}
.zd-tpl-tagsrow { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.zd-tpl-tag {
  border: 1px solid var(--zd-line-soft); background: #fff; color: var(--zd-muted);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.zd-tpl-tag:hover { border-color: var(--zd-accent); color: var(--zd-accent); }
.zd-tpl-tag.on { background: var(--zd-accent-soft); border-color: var(--zd-accent); color: var(--zd-accent); }

/* 精选角标（左上） */
.zd-feat-tag {
  position: absolute; top: 14px; left: 14px;
  font-size: 10px; color: #8a6a33; background: #fbf1dd;
  border: 1px solid #e8d9bd; border-radius: 4px; padding: 1px 6px;
}

/* 公共模板编辑提示 */
.zd-pub-tip {
  margin: 0 0 12px; padding: 8px 10px; border-radius: 8px;
  background: #fbf1dd; border: 1px solid #e8d9bd; color: #8a6a33;
  font-size: 12px; line-height: 1.5;
}
.zd-vip-sw { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #2b2f2c; }

/* 模板分类 */
.zd-tpl-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.zd-tpl-cat {
  border: 1px solid var(--zd-line); background: #fff; border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--zd-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; transition: all .15s;
}
.zd-tpl-cat i { font-style: normal; font-size: 10.5px; color: var(--zd-faint); }
.zd-tpl-cat:hover { border-color: var(--zd-accent); color: var(--zd-accent); }
.zd-tpl-cat.on { background: var(--zd-accent); border-color: var(--zd-accent); color: #fff; }
.zd-tpl-cat.on i { color: rgba(255,255,255,.75); }

/* 宽弹窗（模板库） */
.zd-modal-wide { max-width: 860px; }
@media (max-width: 720px) { .zd-modal-wide { max-width: 100%; } }

.zd-login-tip {
  text-align: center; padding: 30px 10px;
}
.zd-login-tip p { color: var(--zd-muted); margin: 0 0 16px; }

/* ==================== Toast ==================== */
.zd-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(20px);
  background: rgba(36,51,44,.92); color: #fff; border-radius: 10px;
  padding: 10px 18px; font-size: 13px; z-index: 100000;
  opacity: 0; transition: all .22s ease; pointer-events: none;
  max-width: 86vw; text-align: center;
}
.zd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.zd-toast.err { background: rgba(150, 60, 40, .95); }
.zd-toast.ok { background: rgba(21,91,67,.95); }

/* ==================== 查看模式 / 分享页 ==================== */
.zd-app-viewer { padding: 0; }
.zd-app-viewer .zd-stage-wrap { max-height: none; border: 0; border-radius: 0; background: var(--zd-stage); }
.zd-app-viewer .zd-stage { padding: 26px 16px 46px; }
.zd-share-body { margin: 0; background: #efece3; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.zd-share-wrap { max-width: 900px; margin: 0 auto; padding: 26px 16px 60px; }
.zd-share-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.zd-share-title { font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 22px; font-weight: 700; color: #24332c; letter-spacing: 1px; }
.zd-share-meta { font-size: 12.5px; color: #788078; }
.zd-share-meta a { color: #155b43; text-decoration: none; font-weight: 600; }
.zd-share-meta a:hover { text-decoration: underline; }
.zd-share-404 { text-align: center; padding: 110px 20px; color: #788078; }
.zd-share-404 h1 { font-family: "Songti SC", serif; color: #24332c; }

/* ==================== 会员中心 · 我的字帖 ==================== */
.zd-acc-block {
  margin-top: 26px; padding: 20px;
  background: #fffdf9; border: 1px solid #e7e1d4; border-radius: 14px;
}
.zd-acc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.zd-acc-title { font-family: "Songti SC", "STSong", "SimSun", serif; font-size: 17px; font-weight: 700; color: #24332c; letter-spacing: 1px; }
.zd-acc-more {
  font-size: 12.5px; color: #fff; background: #155b43; text-decoration: none;
  padding: 6px 13px; border-radius: 8px; transition: background .15s;
}
.zd-acc-more:hover { background: #24785a; }
.zd-acc-empty { margin: 0; color: #9a9a93; font-size: 13px; }
.zd-acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.zd-acc-item {
  border: 1px solid #e7e1d5; border-radius: 11px; padding: 12px 13px; background: #fff;
  transition: border-color .15s;
}
.zd-acc-item:hover { border-color: #cfd8c9; }
.zd-acc-item-title { font-weight: 600; font-size: 13.5px; color: #24332c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zd-acc-item-date { font-size: 11px; color: #9a9a93; margin: 3px 0 8px; }
.zd-acc-item-ops { display: flex; gap: 12px; font-size: 12px; }
.zd-acc-item-ops a { color: #155b43; text-decoration: none; }
.zd-acc-item-ops a:hover { text-decoration: underline; }
.zd-acc-item-ops .zd-acc-del { color: #9a9a93; background: none; border: 0; padding: 0; cursor: pointer; font-size: 12px; }
.zd-acc-item-ops .zd-acc-del:hover { color: #b4553f; }
.zd-acc-note { margin: 12px 0 0; font-size: 12px; color: #9a9a93; }

/* ==================== 沉浸模式（设计器页 / 分享页） ====================
   应用式布局：页眉+工具栏固定不动、浏览器滑块不滚，
   三列内容各自内滚，滚动内容从工具栏下方穿过（被不透明工具栏遮挡） */
html body.zd-immersive { overflow: hidden; height: 100vh; }
body.zd-immersive #colophon.site-footer { display: none !important; }
/* 桌面沉浸模式侧栏内滚（≤1024 由响应式底部抽屉接管） */
@media (min-width: 1025px) {
  .zd-immersive .zd-main { align-items: stretch; overflow: hidden; }
  .zd-immersive .zd-lib,
  .zd-immersive .zd-prop {
    position: static; top: auto; max-height: none;
    height: 100%; overflow-y: auto;
  }
  .zd-immersive .zd-center { display: flex; flex-direction: column; min-height: 0; }
  .zd-immersive .zd-stage-wrap { flex: 1 1 auto; min-height: 0; max-height: none; }
}

/* ==================== 响应式 ==================== */
@media (max-width: 1200px) {
  .zd-main { grid-template-columns: 200px minmax(0,1fr) 272px; }
}
@media (max-width: 1024px) {
  .zd-main { display: block; padding-bottom: 74px; }
  /* 画布解除桌面内滚锁：纸张完整、页面流滚动（同生成器手机端） */
  .zd-center .zd-stage-wrap { max-height: none; overflow: visible; }
  .zd-stage { padding-bottom: 30px; }
  /* 侧栏改底部上滑抽屉：局部高度、悬于底部 Tab 栏之上（对齐生成器手机端） */
  .zd-lib, .zd-prop {
    position: fixed; top: auto; bottom: calc(56px + env(safe-area-inset-bottom)); left: 0; right: 0; width: auto;
    max-width: none; max-height: 68vh; z-index: 9999;
    border-radius: 16px 16px 0 0; border: 0; border-top: 1px solid var(--zd-line);
    overflow-y: auto; transform: translateY(120%); transition: transform .24s ease;
    box-shadow: 0 -8px 30px rgba(0,0,0,.14);   /* 中性黑投影：墨绿投影会随抽屉下滑在底部闪绿 */
    padding: 0 12px 16px;   /* 顶部不留 padding：标题吸顶时才能盖住穿过内容（否则从上方缝隙穿出） */
    background: var(--zd-card);
  }
  /* 折叠态：只留把手 + 标题行（点标题行右侧 ⌄ 收起/展开）；高度=标题行实际高度（圆钮撑行），多留会露出下一段内容 */
  .zd-lib.zd-folded, .zd-prop.zd-folded { max-height: 49px; overflow: hidden; }
  /* 收起按钮（移动端显示）：白底圆形描边小钮（对齐生成器 panel-toggle），折叠时翻转 */
  .zd-fold {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0;
    color: var(--zd-muted); background: #fff;
    border: 1px solid var(--zd-line); border-radius: 999px;
    cursor: pointer; flex: none;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s ease;
  }
  .zd-fold:active { transform: scale(.92); }   /* 不变色：抽屉随即滑走，变色会在右下角闪绿 */
  .zd-fold svg { width: 16px; height: 16px; transition: transform .2s ease; }
  .zd-folded .zd-fold svg { transform: rotate(180deg); }
  .zd-app.zd-lib-open .zd-lib, .zd-app.zd-prop-open .zd-prop { transform: translateY(0); }
  /* 盖过桌面 .zd-shell .zd-lib 透明背景，抽屉需白底 */
  .zd-shell .zd-lib, .zd-shell .zd-prop { background: var(--zd-card); }
  .zd-lib-mask, .zd-prop-mask {
    position: fixed; inset: 0; background: rgba(36,51,44,.3); z-index: 9998;
    opacity: 0; pointer-events: none;
  }
  /* 渐显只在打开时；关闭立即消失——遮罩是墨绿色，随抽屉下滑渐隐会在腾出区域闪绿 */
  .zd-app.zd-lib-open .zd-lib-mask, .zd-app.zd-prop-open .zd-prop-mask {
    opacity: 1; pointer-events: auto; transition: opacity .2s;
  }
  /* 抽屉标题吸顶（标题自带顶部内边距容纳把手） */
  .zd-lib-title, .zd-prop-title {
    position: sticky; top: 0; z-index: 2;
    background: var(--zd-card);
    margin: 0 -12px; padding: 9px 20px 9px;   /* 负外边距左右贯穿：分隔线铺满抽屉全宽，内边距补偿保持文字原位 */
    border-bottom: 1px solid var(--zd-line-soft);
  }
  .zd-mobile-only { display: inline-flex; }
  .zd-stage-wrap { max-height: none; }
  /* 移动端退出应用式布局：恢复页面滚动与卡片圆角 */
  html body.zd-immersive { overflow: auto; height: auto; }
  /* 隐藏站点页眉：设计器标题栏直接在最顶上（同生成器手机端） */
  body.zd-immersive #masthead.site-header { display: none !important; }
  /* 手机端通栏：清掉主题内容容器四周 24px 内边距，顶栏贴边 + 贴顶吸顶（同生成器） */
  body.zd-immersive .entry-content-wrap { padding: 0 !important; }
  /* 解除主题容器 overflow:clip 对吸顶栏的裁剪 */
  body.zd-immersive .wp-site-blocks { overflow: visible !important; }
  .zd-immersive .zd-top { margin-top: 0 !important; border-radius: 14px 14px 0 0; }
  /* 顶栏对齐生成器：三段式吸顶栏（‹ 首页 | 标题 | 汉堡）+ 工具行整体 sticky 吸顶，
     随内容滚动吸在顶上（生成器 m-header 同款机制），杜绝 fixed 与文档流预留的错位 */
  .zd-app { padding-top: 0; }
  .zd-app .zd-top {
    flex-wrap: wrap; padding: 0 14px 4px;
    border-radius: 0 !important;
    position: sticky; top: 0; z-index: 700;
  }
  .zd-top-row {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex: 1 1 100%;
    /* 负 margin 抵消顶栏左右内边距：分隔线左右贯穿到屏幕边；行高与工具行约 3:2；线下留 7px（与画布上边距一致） */
    margin: 0 -14px 7px; padding: 7px 14px 7px;
    border-bottom: 1px solid var(--zd-line);   /* 标题行与工具行之间的分隔线 */
    position: relative;
  }
  /* 移动端工具行紧凑：上下间距一致（线下 7px = 行底 7px） */
  .zd-top { padding-bottom: 7px; row-gap: 0; column-gap: 10px; }
  .zd-top .zd-btn-primary { padding: 5px 11px; }
  .zd-top .zd-btn-primary svg { width: 14px; height: 14px; }
  /* 顶栏下拉菜单（对齐生成器 m-menu：右上角三条杠展开站点导航） */
  .zd-mmenu-pop {
    position: absolute; top: 52px; right: 6px; min-width: 132px;
    padding: 6px; background: #fff;
    border: 1px solid var(--zd-line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(36,51,44,.14); z-index: 710;
  }
  .zd-mmenu-pop a {
    display: block; padding: 10px 12px;
    font-size: 14px; color: var(--zd-text); text-decoration: none;
    border-radius: 8px;
  }
  .zd-mmenu-pop a:hover, .zd-mmenu-pop a:active { background: var(--zd-accent-soft); }
  .zd-mhome {
    color: var(--zd-accent); font-size: 15px; font-weight: 500;
    text-decoration: none; white-space: nowrap;
  }
  .zd-mhome:active { opacity: .7; }
  .zd-mtitle {
    flex: 1 1 auto; text-align: center;
    font-family: var(--zd-serif); font-size: 16px; font-weight: 700;
    color: var(--zd-text); letter-spacing: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .zd-mmenu {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border: 0; background: transparent;
    color: var(--zd-text); cursor: pointer; padding: 0;
  }
  .zd-mmenu svg { width: 20px; height: 20px; }
  .zd-logo { display: none; }
  /* 工具按钮风格对齐生成器：裸图标 + 米色胶囊组 + 胶囊主按钮（尺寸在原基础上减约 1/4） */
  .zd-top .zd-icon-btn {
    width: 24px; height: 24px; border: 0; background: transparent;
  }
  .zd-top .zd-icon-btn:hover { border: 0; background: transparent; }
  .zd-top .zd-icon-btn svg { width: 16px; height: 16px; }
  .zd-top .zd-btn-primary { border-radius: 999px; }
  .zd-top-sep { display: none; }
  .zd-top-group { background: #f5f2ea; border-radius: 999px; padding: 1px 6px; }
  .zd-zoom-label { min-width: 34px; font-size: 12.5px; color: var(--zd-text); }
  /* 模板标题只在「属性 → 模板信息」里编辑，顶栏收起 */
  .zd-doc-title { display: none; }
  .zd-hide-mobile { display: none !important; }
  /* 底部 Tab 栏：组件 / 属性 / 更多（风格对齐生成器底部栏）；置顶保证抽屉打开时仍可直接切换 */
  .zd-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10002;
    background: var(--zd-card); border-top: 1px solid var(--zd-line);
    padding: 7px 24px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-between;
  }
  .zd-tab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    flex: 1 1 0; border: 0; background: transparent; cursor: pointer;
    font-size: 12px; font-weight: 500; color: var(--zd-muted);
    padding: 4px 0; transition: color .15s;
  }
  .zd-tab svg { width: 21px; height: 21px; }
  .zd-tab:active { transform: scale(.94); }
  .zd-app.zd-lib-open .zd-tab[data-tab="lib"],
  .zd-app.zd-prop-open .zd-tab[data-tab="prop"] { color: var(--zd-accent); }
  /* 更多操作抽屉（对齐生成器底部 sheet：圆角 16px、距底 66px 风格） */
  .zd-sheet-mask {
    display: block;
    position: fixed; inset: 0; background: rgba(36,51,44,.3); z-index: 10000;
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .zd-sheet-mask.on { opacity: 1; pointer-events: auto; }
  .zd-sheet {
    display: block;
    /* 全宽贴底，与组件库/属性面板抽屉一致（不再是悬浮小卡片）；底边贴齐标签栏顶边（57px = 7+21+3+18+7 + 1px 边线） */
    position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); z-index: 10001;
    background: var(--zd-card); border: 0; border-radius: 0;
    padding: 14px 12px;
    transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .2s ease;
    box-shadow: 0 -8px 30px rgba(0,0,0,.12);
  }
  .zd-sheet.on { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .zd-sheet-title {
    font-family: var(--zd-serif); font-size: 14.5px; font-weight: 700;
    color: var(--zd-text);
    display: flex; align-items: center; justify-content: space-between;
    /* 与组件库/属性面板标题同款：负外边距贯穿全宽 + 上下 9px 内边距 + 底部分隔线，内容距线 12px */
    margin: -14px -12px 12px; padding: 9px 12px 9px 20px;
    border-bottom: 1px solid var(--zd-line-soft);
  }
  .zd-sheet-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    border: 0; background: transparent; cursor: pointer;
    padding: 12px 10px; font-size: 14px; color: var(--zd-text);
    border-radius: 10px; transition: background .12s;
  }
  .zd-sheet-item:hover, .zd-sheet-item:active { background: var(--zd-accent-soft); }
  .zd-sheet-item svg { width: 19px; height: 19px; color: var(--zd-accent); flex: none; }
}
@media (max-width: 560px) {
  .zd-app { padding-top: 10px; }
  body.zd-immersive .zd-app { padding-top: 0; }   /* 沉浸页顶栏吸顶，不留上方缝隙 */
  .zd-stage { padding: 20px 10px 20px; gap: 14px; }   /* 画布上下 20 / 左右 10 */
  /* 沉浸页：清掉纸张下方多余空白（app 底 padding + main 多余占位），纸张底到 Tab 栏只留 stage 的 14px */
  body.zd-immersive .zd-app { padding-bottom: 0; }
  body.zd-immersive .zd-main { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  /* main 拉伸填满视口（fitImmersive 设 min-height）：画布灰区延伸到 Tab 栏上沿 */
  body.zd-immersive .zd-main { display: flex; flex-direction: column; }
  body.zd-immersive .zd-main .zd-center { flex: 1 1 auto; display: flex; flex-direction: column; }
  body.zd-immersive .zd-main .zd-stage-wrap { flex: 1 1 auto; }
  .zd-doc-list { grid-template-columns: 1fr; }
  .zd-tpl-grid { grid-template-columns: repeat(2, 1fr); }
  .zd-top { padding-left: 10px; padding-right: 10px; }
  .zd-btn { padding: 6px 10px; font-size: 12.5px; }
  .zd-page-mark { right: -32px; }
}

/* ==================== 打印 ==================== */
@media print {
  body { background: #fff !important; }
  body * { visibility: hidden; }
  .zd-share-body #zd-app, .zd-share-body #zd-app * { visibility: visible; }
  .zd-share-body #zd-app { position: absolute; inset: 0; padding: 0; margin: 0; }
  .zd-share-wrap { padding: 0; max-width: none; }
  .zd-share-head { display: none; }
  .zd-app-viewer .zd-stage-wrap { max-height: none; overflow: visible; background: #fff; border: 0; }
  .zd-app-viewer .zd-stage { padding: 0; gap: 0; }
  .zd-app-viewer .zd-page { box-shadow: none; border-radius: 0; page-break-after: always; }
  .zd-page-num, .zd-page-mark { display: none !important; }
}
