/* ============================================================
   365Lab Paper — styles
   ============================================================ */
:root {
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --brand-ink: #3730a3;
  --ink: #1a2030;
  --muted: #5f6b7a;
  --line: #e4e7f0;
  --bg: #f6f7fb;
  --card: #ffffff;
  --danger: #dc2626;
  --radius: 14px;
  --header-h: 61px;   /* sticky site header total height incl. its 1px border (55px at <=480px) */
  --shadow: 0 1px 2px rgba(23, 25, 35, .04), 0 8px 24px -12px rgba(23, 25, 35, .12);
  --shadow-lg: 0 2px 6px rgba(23, 25, 35, .06), 0 20px 44px -16px rgba(23, 25, 35, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 15.5px;
}
img, svg { vertical-align: middle; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::placeholder { color: #7a8696; opacity: 1; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
section { scroll-margin-top: 76px; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; color: var(--ink); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-badge {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff;
}
.logo-badge svg { width: 17px; height: 17px; }
.logo b { color: var(--brand); }
/* two-line brand lockup: "365Lab" on top, product name below */
.logo-text { display: flex; flex-direction: column; line-height: 1.06; }
.logo-suffix { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .01em; white-space: nowrap; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: 14.5px; font-weight: 500;
}
.site-nav a:hover { color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.lang-switch { display: flex; gap: 2px; margin-left: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; flex: none; }
.lang-switch a {
  font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 6px; color: var(--muted); white-space: nowrap;
}
.lang-switch a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(23, 25, 35, .1); }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(900px 380px at 15% -10%, rgba(79, 70, 229, .12), transparent 60%),
    radial-gradient(800px 380px at 90% -20%, rgba(124, 58, 237, .10), transparent 60%);
  border-bottom: 1px solid var(--line);
  padding: 54px 0 46px;
}
.hero h1 { font-size: clamp(26px, 4.2vw, 40px); font-weight: 800; letter-spacing: -.01em; margin-bottom: 14px; }
.hero h1 .hl {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { font-size: clamp(15px, 1.8vw, 17.5px); color: var(--muted); max-width: 46em; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.badge {
  font-size: 13px; font-weight: 600; color: var(--brand-ink);
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px;
  box-shadow: 0 1px 2px rgba(23, 25, 35, .04);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 11px; cursor: pointer;
  font-size: 15px; font-weight: 600; padding: 11px 20px; line-height: 1.2;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px -6px rgba(79, 70, 229, .55); }
.btn-primary:hover { box-shadow: 0 8px 22px -6px rgba(79, 70, 229, .65); text-decoration: none; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn-text { background: none; border: none; color: var(--muted); font-size: 13.5px; padding: 8px 4px; cursor: pointer; }
.btn-text:hover { color: var(--danger); }
.btn-sm { padding: 8px 14px; font-size: 14px; }

/* ---------- app layout ---------- */
.app-sec { padding: 26px 0 10px; }
.app-grid {
  display: grid; grid-template-columns: 272px minmax(0, 1fr) 304px;
  gap: 18px; align-items: start;
}
.tpl-panel, .preview-col, .settings-col { min-width: 0; }
@media (min-width: 1600px) {
  body.app-page .app-grid { grid-template-columns: 300px minmax(0, 1fr) 336px; }
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-title { font-size: 15px; font-weight: 700; padding: 15px 16px 10px; margin: 0; }

/* template picker: sticky panel, category tabs, list */
.tpl-panel { max-height: calc(100vh - 100px); position: sticky; top: 76px; overflow: auto; }
.tpl-cat { font-size: 12px; font-weight: 700; color: #5f6b7a; text-transform: uppercase; letter-spacing: .08em; padding: 10px 16px 4px; margin: 0; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 10px 10px; }
/* category tabs (wrap so every category stays visible in the narrow panel) */
/* the panel header (title + tabs) is pinned as ONE block: nothing shifts while scrolling */
.tpl-head, .set-head { position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--line); }
.tpl-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 2px 12px 10px; margin: 0;
}
.tpl-tab {
  border: 1px solid var(--line); background: #fff; cursor: pointer; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 12px; line-height: 1.2;
  font-family: inherit; transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.tpl-tab:hover { color: var(--brand); border-color: #d6d9ff; }
.tpl-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tpl-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tpl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 8px; border: 1px solid transparent; border-radius: 10px;
  background: none; cursor: pointer; color: var(--ink); font-size: 12.5px; font-weight: 500;
  line-height: 1.25; text-align: center; transition: background .12s ease;
}
.tpl-btn:hover { background: var(--bg); }
.tpl-btn.active { background: var(--brand-soft); border-color: #d6d9ff; color: var(--brand-ink); }
.tpl-btn.active .tpl-ic { color: var(--brand); }
.tpl-ic { width: 25px; height: 25px; color: #6b7286; }

/* preview */
.preview-card { padding: 14px 16px 16px; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pt-name-line { display: flex; align-items: center; gap: 4px; }
.pt-name { font-weight: 700; font-size: 16px; display: block; }
/* v117: 模板描述改单行省略（用户要求「不需要换行」）——toolbar 左块已带
   min-width:0 可收缩，nowrap 不会挤压右侧页码/下载工具组；完整文案经
   title 属性悬浮展示（app.js 设置 textContent 时同步写入）。 */
.pt-desc {
  font-size: 12.5px; color: var(--muted); display: block; max-width: 34em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.page-nav { display: flex; align-items: center; gap: 8px; flex: none; }
.pg-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 17px; color: var(--ink); line-height: 1;
}
.pg-btn:hover { border-color: var(--brand); color: var(--brand); }
.pg-btn:disabled { opacity: .35; cursor: default; }
#page-ind { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
/* toolbar right cluster: page nav + regenerate + download dropdown */
.pv-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.tb-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  cursor: pointer; font-size: 14px; color: var(--ink); line-height: 1; padding: 0;
}
.tb-btn:hover { border-color: var(--brand); }
/* v104: share / export / import left the settings panel footer for the preview
   toolbar; v111 folded them into the download dropdown (#dl-menu) as menu items,
   so the toolbar now carries just page-nav + regen + the download button.
   `.settings-foot` still only carries the reset link. */
.preview-toolbar { flex-wrap: wrap; row-gap: 8px; }
/* the left title/desc block must be shrinkable, otherwise its preferred 34em
   description width forces the toolbar onto a second row at common widths */
.preview-toolbar > div:first-child { flex: 1 1 200px; min-width: 0; }
.pv-tools { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
/* v111: the share/export/import cluster is gone from the toolbar — they are now
   role=menuitem entries inside #dl-menu, styled by the .dl-menu rules below. */
/* phones: let the whole tool cluster take its own full row and wrap inside it */
@media (max-width: 560px) { .pv-tools { flex: 1 1 100%; } }
.dl-wrap { position: relative; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--brand); border-radius: 8px; background: var(--brand); color: #fff;
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit; line-height: 1;
  transition: box-shadow .12s ease;
}
.dl-btn:hover { box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .55); }
.dl-btn svg { width: 14px; height: 14px; }
.dl-caret { font-style: normal; font-size: 10px; opacity: .85; }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 168px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px -10px rgba(23, 25, 35, .28); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.dl-menu[hidden] { display: none; }
.dl-menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: none; border-radius: 8px; background: none; cursor: pointer;
  font-size: 13.5px; font-family: inherit; color: var(--ink); text-align: left; white-space: nowrap;
}
.dl-menu button:hover { background: var(--brand-soft); color: var(--brand-ink); }
.dl-menu button:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.dl-ic { font-size: 14px; }
.dl-sep { height: 1px; margin: 4px 8px; background: var(--line); }
.preview-stage {
  display: grid; place-items: center;
  background: repeating-conic-gradient(#eceef4 0 25%, #f8f9fc 0 50%) 0 0 / 22px 22px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; min-height: 300px;
}
.preview-stage svg {
  background: #fff;
  max-width: 100%; max-height: min(72vh, 900px); width: auto; height: auto;
  box-shadow: 0 3px 8px rgba(23, 25, 35, .1), 0 18px 40px -14px rgba(23, 25, 35, .22);
}

/* settings */
.settings-col { position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto; }
.settings-card { padding-bottom: 10px; }
/* settings group tabs (one group visible at a time) */
.set-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 12px 10px;
}
.set-tab {
  border: 1px solid var(--line); background: #fff; cursor: pointer; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 6px 12px; line-height: 1.2;
  font-family: inherit; transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.set-tab:hover { color: var(--brand); border-color: #d6d9ff; }
.set-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.set-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.settings-foot { padding: 4px 16px 12px; }
#settings-form { padding: 12px 12px 0; }
/* boxed setting groups: related options live in one bordered box */
.set-box {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px 3px; margin-bottom: 10px; background: var(--bg);
}
.set-box-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  letter-spacing: .01em; margin: 0 0 10px;
}
/* brand-colored tick on the left makes each group's boundary obvious at a glance */
.set-box-title::before {
  content: ''; width: 3px; height: 12px; border-radius: 2px;
  background: var(--brand); flex: none;
}
/* keep the last control from sitting too far above the box's bottom edge */
.set-box > .ctl:last-child, .set-box > .ctl-rowgroup:last-child { margin-bottom: 8px; }
.ctl { margin-bottom: 13px; }
/* dependent controls are grayed-out and non-interactive until their master
   option is enabled / checked / filled — so users never hit a "set but no
   effect" dead end. The hint explains exactly what to turn on. */
.ctl-disabled { opacity: .5; cursor: not-allowed; }
/* 依赖项不满足时「整个控件消失」（非仅置灰）：该版式/取值下选项完全无效（v120） */
.ctl-hidden { display: none !important; }
.ctl-disabled input, .ctl-disabled select, .ctl-disabled textarea {
  pointer-events: none; filter: grayscale(1); cursor: not-allowed;
}
.ctl-disabled .ctl-check, .ctl-disabled .ctl-label { opacity: .9; }
.ctl-dep-hint {
  font-size: 11px; line-height: 1.35; color: var(--muted, #8a93a2);
  margin-top: 5px; display: flex; align-items: center; gap: 5px;
}
.ctl-dep-hint::before { content: '\26A0'; font-size: 11px; opacity: .85; }
.ctl-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); margin-bottom: 5px; }
.ctl-val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ctl input[type="range"] { width: 100%; accent-color: var(--brand); margin: 0; }
.ctl select, .ctl input[type="text"], .ctl textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
.ctl textarea { resize: vertical; min-height: 54px; }
.ctl select:focus, .ctl input:focus, .ctl textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .13); }
/* color row: label on its own line, then swatch + hex code share the next line */
.ctl-color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctl-color-row .ctl-color-label {
  flex: 1 1 100%; min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.ctl-color-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* an unset colour inherits an engine default: badge the row + preview the default
   code, so "left empty" never reads as a blank / broken (black) value. */
.ctl-color-def {
  flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--brand); background: rgba(79, 70, 229, .10);
  border-radius: 999px; padding: 1px 8px; line-height: 1.6;
}
.ctl-color-row.has-def .ctl-hex::placeholder { color: var(--muted); opacity: 1; }
.ctl input[type="color"], .ctl-color-row input[type="color"] {
  width: 38px; height: 30px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; flex: none;
}
/* NOTE: `.ctl input[type="text"] { width:100% }` outranks a plain `.ctl .ctl-hex`,
   which used to blow the hex field to full width and wrap it onto its own line.
   Keep this selector at 0,3,0 so the swatch + code stay on ONE row. */
.ctl.ctl-color-row .ctl-hex {
  flex: 1 1 96px; width: auto; min-width: 76px; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px;
  font-size: 13px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ink); background: #fff;
}
/* range/number row: label on its own line, slider + value below */
.ctl-range-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctl-range-row .ctl-range-label { flex: 1 1 100%; min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.ctl-range-row input[type="range"] { flex: 1 1 auto; min-width: 56px; width: auto; margin: 0; accent-color: var(--brand); }
/* controls sharing one line (op.row) — e.g. custom paper width + height side by side */
.ctl-rowgroup { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; margin-bottom: 13px; }
.ctl-rowgroup > .ctl { margin-bottom: 0; min-width: 0; }
.ctl-rowgroup .ctl-range-label { font-size: 12.5px; }
.ctl-rowgroup .ctl .ctl-num { width: 100%; text-align: left; }
.ctl .ctl-num {
  width: 62px; flex: none; border: 1px solid var(--line); border-radius: 9px; padding: 5px 6px;
  font-size: 13px; color: var(--ink); background: #fff; text-align: right; font-variant-numeric: tabular-nums;
  appearance: textfield; -moz-appearance: textfield;
}
.ctl .ctl-num::-webkit-outer-spin-button,
.ctl .ctl-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; opacity: 0; }
/* spin arrows appear only while the field is focused */
.ctl .ctl-num:focus::-webkit-outer-spin-button,
.ctl .ctl-num:focus::-webkit-inner-spin-button { -webkit-appearance: inner-spin-button; opacity: 1; }
.ctl .ctl-num:focus { -moz-appearance: number-input; }
.ctl-row .ctl-check { margin: 0; }
.ctl-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; margin-bottom: 6px; }
.ctl-check input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.ctl-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.preset-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: border-color .12s ease, color .12s ease;
}
.preset-chip:hover { border-color: var(--brand); color: var(--brand); }
/* v113: 风格预设 = 色块卡片（上方长方形色块 + 下方文字），取代原来的「圆点+文字」胶囊。
   圆点只能表达纸张底色，浅色主题(经典黑白/轻虚线)彼此几乎一样；色块里同时画出
   纸背景 + 表头色带 + 线色/线型，15 套主题一眼可辨。 */
.style-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; margin-bottom: 8px;
}
.style-card {
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); cursor: pointer; font-family: inherit;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.style-card:hover { border-color: var(--brand); box-shadow: 0 3px 10px rgba(23, 25, 35, .12); transform: translateY(-1px); }
.style-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* 当前纸面仍与该主题完全一致时高亮，让用户随时知道自己在用哪套色 */
.style-card.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.style-card.on .style-name { color: var(--brand); }
/* 微缩纸面：纸底色 + 表头色带 + 线色/线型 */
.style-sw { position: relative; display: block; width: 100%; height: 42px; border-bottom: 1px solid rgba(23, 25, 35, .09); }
.style-sw-band { position: absolute; left: 0; right: 0; top: 0; height: 15px; }
.style-sw-bar { position: absolute; left: 7px; top: 6px; width: 46%; height: 3px; border-radius: 2px; opacity: .85; }
.style-sw-line { position: absolute; left: 7px; right: 7px; height: 1px; }
.style-card.on .style-sw::after {
  content: '✓'; position: absolute; top: 3px; right: 3px; z-index: 1;
  width: 14px; height: 14px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 9px; font-weight: 700; line-height: 14px; text-align: center;
  box-shadow: 0 0 0 1.5px #fff;
}
.style-name {
  display: block; padding: 5px 5px 6px; font-size: 11px; font-weight: 600;
  color: var(--muted); line-height: 1.25; letter-spacing: .01em; word-break: break-word;
}
.up-item { display: inline-flex; align-items: center; }
.up-item .chip-x {
  border: none; background: none; color: #b6bdcc; cursor: pointer;
  font-size: 15px; line-height: 1; padding: 4px 3px; margin-left: -3px;
}
.up-item .chip-x:hover { color: var(--danger); }
.up-name {
  border: 1px solid var(--line); border-radius: 999px; background: #fff;
  padding: 5px 11px; font-size: 12px; width: 108px; font-family: inherit; color: var(--ink);
}
.up-name:focus { border-color: var(--brand); outline: none; }
.up-save { background: var(--brand-soft); border-color: #d6d9ff; color: var(--brand-ink); }

/* designer zone editor */
.dz-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.dz-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  background: var(--bg);
}
.dz-row1 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dz-type {
  flex: 1; border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px;
  font-size: 12.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.dz-remove {
  border: none; background: none; color: #b6bdcc; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 5px;
}
.dz-remove:hover { color: var(--danger); }
.dz-param { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dz-param-label { font-size: 11.5px; color: var(--muted); min-width: 34px; flex: none; }
.dz-param input[type="range"] { flex: 1; accent-color: var(--brand); margin: 0; min-width: 0; }
.dz-param .ctl-val { font-size: 11px; color: var(--muted); white-space: nowrap; flex: none; min-width: 38px; text-align: right; }
.dz-add {
  display: block; width: 100%; text-align: center; border: 1px dashed var(--line);
  border-radius: 9px; padding: 8px; background: none; color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.dz-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.dz-text-input {
  flex: 1; border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px;
  font-size: 12.5px; font-family: inherit; color: var(--ink); background: #fff;
}
.dz-text-input:focus { border-color: var(--brand); outline: none; }
.dz-btns { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.dz-move {
  border: none; background: none; color: #b6bdcc; cursor: pointer;
  font-size: 14px; line-height: 1; padding: 2px 3px;
}
.dz-move:hover { color: var(--brand); }

/* app pages run full width — header, content and footer aligned edge to edge */
body.app-page .app-sec .container,
body.app-page .site-header .header-in,
body.app-page .site-footer .footer-in { max-width: none; }
.fav-btn {
  border: none; background: none; cursor: pointer; flex: none;
  font-size: 19px; line-height: 1; color: #9aa3b2; padding: 2px 4px;
}
.fav-btn:hover { color: #f59e0b; }
.fav-btn.on { color: #f59e0b; }

#toast {
  position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 16px); z-index: 100;
  background: #23283a; color: #fff; font-size: 14px; font-weight: 500;
  padding: 11px 20px; border-radius: 11px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  max-width: min(90vw, 480px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 961px) { #toast { bottom: 34px; } }

/* ---------- content sections ---------- */
.sec { padding: 64px 0; }
.sec-alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sec-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.sec-head h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 800; }
.sec-head p { color: var(--muted); }

.sec-cta { margin-top: 28px; text-align: center; }
.sec-cta .btn { max-width: 100%; white-space: normal; }

.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.feat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 20px; box-shadow: var(--shadow);
  /* icon + title share one row; the description spans full width below */
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: center; column-gap: 13px; row-gap: 8px;
}
.feat .fi {
  width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
}
.feat .fi svg { width: 21px; height: 21px; }
.feat h3 { font-size: 16px; }
.feat p { font-size: 13.8px; color: var(--muted); margin: 0; grid-column: 1 / -1; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.cat-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 18px; box-shadow: var(--shadow); color: var(--ink);
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
a.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d6d9ff; text-decoration: none; }
.card-media {
  margin: -16px -18px 12px; padding: 12px 30px;
  background: linear-gradient(180deg, #eef0f8, #f6f7fb);
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
  display: grid; place-items: center;
}
.card-media svg { width: 100%; max-height: 150px; filter: drop-shadow(0 2px 5px rgba(23, 25, 35, .14)); }
.cat-card h3 { font-size: 15.5px; display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.cat-card h3 svg { width: 20px; height: 20px; color: var(--brand); flex: none; }
a.cat-card:hover h3 { color: var(--brand); }
.cat-card p { font-size: 13.2px; color: var(--muted); margin: 0; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; counter-reset: step; }
.step { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px 18px; box-shadow: var(--shadow); }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: -13px; left: 18px;
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-size: 14px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .5);
}
.step h3 { font-size: 15.5px; margin: 4px 0 6px; }
.step p { font-size: 13.5px; color: var(--muted); margin: 0; }

.faq-list { max-width: 780px; margin: 0 auto; }
.faq { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow); overflow: hidden; }
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 15px; padding: 15px 18px; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 19px; color: var(--brand); font-weight: 600; flex: none; transition: transform .15s ease; }
.faq[open] summary::after { transform: rotate(45deg); }
.faq .faq-a { padding: 0 18px 15px; font-size: 14px; color: var(--muted); }
.faq .faq-a p { margin: 0; }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; text-align: center; padding: 58px 0; }
.cta-band h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 800; margin-bottom: 6px; }
.cta-band p { color: rgba(255, 255, 255, .85); margin-bottom: 22px; }
.btn-invert { background: #fff; color: var(--brand-ink); }
.btn-invert:hover { text-decoration: none; box-shadow: 0 8px 22px -6px rgba(0, 0, 0, .3); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; padding: 20px 0 24px; margin-top: 16px; }
.footer-in { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; align-items: center; }
.footer-in p { font-size: 13px; color: var(--muted); margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 16px; font-size: 13.5px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--ink); }

/* ---------- mobile bar ---------- */
.mobile-bar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  gap: 10px;
}
.mobile-bar .btn { flex: 1; padding: 11px 8px; font-size: 14.5px; }

/* ---------- print ---------- */
#print-area { display: none; }
@media print {
  body { background: #fff; }
  #app-root, .site-header, .mobile-bar, #toast { display: none !important; }
  #print-area { display: block !important; }
  #print-area .p-page { page-break-after: always; break-after: page; }
  #print-area .p-page:last-child { page-break-after: auto; break-after: auto; }
  #print-area svg { display: block; }
}

/* ---------- responsive ---------- */
@media (max-width: 1120px) {
  .app-grid { grid-template-columns: 250px minmax(0, 1fr) 280px; }
}
@media (max-width: 960px) {
  body { padding-bottom: 62px; }
  .site-nav { display: none; }
  .hero { padding: 36px 0 32px; }
  .app-sec { padding-top: 16px; }
  .app-grid { grid-template-columns: minmax(0, 1fr); }
  .tpl-panel { position: static; max-height: none; overflow: visible; }
  .settings-col { position: static; max-height: none; overflow: visible; }
  /* page scrolls on phones: pin the panel heads just below the sticky site header */
  .tpl-head, .set-head { top: var(--header-h); }
  /* picker becomes a compact horizontal scroller on phones */
  .tpl-panel .tpl-cat { display: none; }
  .tpl-panel .tpl-sec { display: contents; }
  .tpl-panel #tpl-list { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; padding: 8px 12px 12px; scrollbar-width: thin; }
  .tpl-panel .tpl-grid { display: contents; }
  .tpl-panel .tpl-btn { flex: none; white-space: nowrap; padding: 7px 11px; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
  .tpl-panel .tpl-btn.active { border-color: var(--brand); }
  .tpl-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tpl-tabs::-webkit-scrollbar { display: none; }
  .mobile-bar { display: flex; }
  .sec { padding: 44px 0; }
}
@media (max-width: 480px) {
  :root { --header-h: 55px; }
  .container { padding: 0 13px; }
  .header-in { height: 54px; gap: 8px; }
  .logo { white-space: nowrap; }
  .logo-suffix { display: none; }
  .lang-switch a { padding: 4px 8px; }
  .preview-card { padding: 11px 11px 13px; }
  .preview-stage { padding: 10px; min-height: 200px; }
  .hero-cta .btn { flex: 1; }
  .sec-cta .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- documentation / content pages ---------- */
.doc-sec { padding: 36px 0 60px; }
.doc-sec .sec-head { text-align: left; max-width: 860px; margin: 0 auto 22px; }
.doc-sec .sec-head h1 { font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; letter-spacing: -.01em; margin-bottom: 10px; }
.doc-sec .sec-head p { font-size: 16px; margin: 0; }
.doc { max-width: 860px; margin: 0 auto; }
.doc > h2 { font-size: 22px; font-weight: 700; margin: 40px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.doc > h2:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.doc > h3 { font-size: 17px; font-weight: 700; margin: 24px 0 8px; color: var(--ink); }
.doc p, .doc li { font-size: 15.5px; line-height: 1.75; color: #2a3142; }
.doc ul, .doc ol { padding-left: 22px; margin: 0 0 1.1em; }
.doc li { margin-bottom: 8px; }
.doc a { font-weight: 600; }
.doc .lead { font-size: 17px; color: var(--muted); margin-bottom: 18px; }
.doc .updated { font-size: 13px; color: var(--muted); margin-top: 8px; }
.doc .callout { background: var(--brand-soft); border: 1px solid #d6d9ff; border-radius: 12px; padding: 14px 18px; margin: 18px 0; font-size: 14.5px; color: var(--brand-ink); }
.doc .callout strong { color: var(--brand-ink); }
.doc hr { border: none; border-top: 1px solid var(--line); margin: 32px 0; }
.doc .ext-link { display: inline-flex; align-items: center; gap: 6px; }

/* ---- 模板大全 gallery (templates.html) ---- */
.gal-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 2px 0 0; }
.gal-search { flex: 1 1 260px; min-width: 0; padding: 11px 16px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; font-family: inherit; color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.gal-search:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, .13); }
.gal-count { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; }
/* category tabs: sticky pill bar right under the site header */
.gal-tabs {
  position: sticky; top: 60px; z-index: 20;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 12px 2px; margin: 2px 0 4px;
  background: rgba(246, 247, 251, .92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.gal-tabs::-webkit-scrollbar { display: none; }
.gal-tab {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: color .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.gal-tab:hover { color: var(--brand); border-color: #d6d9ff; }
.gal-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .5); }
.gal-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.gal-tab-n { font-style: normal; font-size: 12px; line-height: 1; padding: 3px 7px; border-radius: 999px; background: rgba(95, 107, 122, .12); }
.gal-tab.on .gal-tab-n { background: rgba(255, 255, 255, .24); }
.gal-cat { scroll-margin-top: 124px; }
.gal-cat-title { font-size: 18px; font-weight: 800; color: var(--ink); margin: 22px 0 14px; padding-left: 11px; border-left: 4px solid var(--brand); display: flex; align-items: center; gap: 10px; }
.gal-cat-n { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.gal-none { margin: 26px 0 6px; padding: 30px 20px; text-align: center; color: var(--muted); font-size: 14.5px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
.gal-gallery:focus { outline: none; }
.site-nav a.on { color: var(--brand); font-weight: 700; }
.doc .ext-link::after { content: "\2197"; font-size: .85em; color: var(--muted); }
/* about page: copy-to-clipboard email card */
.contact-card { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 16px 0 6px; }
.copy-email {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--brand-soft); border: 1px solid #d6d9ff; color: var(--brand-ink);
  border-radius: 11px; padding: 11px 18px; font-weight: 700; font-size: 15.5px; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.copy-email:hover { background: #e3e7ff; text-decoration: none; }
.copy-email svg { width: 17px; height: 17px; flex: none; }
.about-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.about-links a.btn { text-decoration: none; }
@media (max-width: 560px) {
  .doc-sec .sec-head { text-align: center; }
}

/* ---- hero showcase image (v89) ---- */
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 44px;
  align-items: center;
}
.hero-copy { min-width: 0; }
.hero-media { margin: 0; min-width: 0; justify-self: end; max-width: 600px; width: 100%; }
.hero-media img { display: block; width: 100%; height: auto; }
/* with the hero now split in two columns the badge strip is narrower:
   lay it out as a deliberate 2-column block instead of leaving one orphan badge */
@media (min-width: 961px) {
  .hero .badges { display: grid; grid-template-columns: repeat(2, auto); justify-content: start; }
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero .sub { max-width: none; }
  .hero-media { justify-self: center; max-width: 500px; }
}
@media (max-width: 480px) {
  .hero-media { max-width: 360px; }
}

/* v114: CSP 去除 'unsafe-inline' —— 原行内样式改为类选择器 */
/* 404 页（原 body/h1/p/a 上的 style 属性） */
body.nf { display: grid; place-items: center; min-height: 100vh; text-align: center; padding: 24px; }
.nf-code { font-size: 64px; margin: 0; color: var(--brand); }
.nf-title { font-size: 18px; font-weight: 600; margin: 6px 0 2px; }
.nf-text { color: #5f6b7a; margin: 0 0 22px; }
.nf-home { display: inline-block; background: var(--brand); color: #fff; padding: 11px 22px; border-radius: 11px; text-decoration: none; font-weight: 600; }
.nf-home:hover { background: var(--brand-ink); }
/* 生成器 noscript 提示（原 <p style="padding:30px;text-align:center">） */
.noscript-note { padding: 30px; text-align: center; }
