/*
 * 简约工具风：参考图片编辑器 / 文档预览类产品的常见做法
 * 白色顶栏和右栏 + 浅灰画布，区块只靠底色区分，不画框线；
 * 全站黑白，唯一的实心黑按钮就是“下一步”。窄屏时下载按钮固定在底部。
 */
:root {
  --canvas: #f0f0f0;
  --surface: #ffffff;
  --hover: #f3f3f3;
  --soft: #efefef;
  --line: #e7e7e7;
  --ink: #111111;
  --muted: #6e6e6e;
  --faint: #a3a3a3;
  --primary: #111111;
  --primary-hover: #333333;
  --primary-ink: #ffffff;
  --track: #e2e2e2;
  --paper-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --r: 8px;
  --r-lg: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --z-overlay: 2;
  --z-bar: 5;
  --z-toast: 10;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0d0d0d;
    --surface: #181818;
    --hover: #222222;
    --soft: #262626;
    --line: #2a2a2a;
    --ink: #f0f0f0;
    --muted: #9b9b9b;
    --faint: #6a6a6a;
    --primary: #f0f0f0;
    --primary-hover: #d6d6d6;
    --primary-ink: #111111;
    --track: #333333;
    --paper-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0d0d0d;
  --surface: #181818;
  --hover: #222222;
  --soft: #262626;
  --line: #2a2a2a;
  --ink: #f0f0f0;
  --muted: #9b9b9b;
  --faint: #6a6a6a;
  --primary: #f0f0f0;
  --primary-hover: #d6d6d6;
  --primary-ink: #111111;
  --track: #333333;
  --paper-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background-color .15s var(--ease), transform .1s var(--ease), opacity .15s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.97); }
.btn-soft { background: var(--soft); }
.btn-soft:hover { background: var(--line); }
.btn-primary { background: var(--primary); color: var(--primary-ink); padding: 0 16px; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-quiet { color: var(--muted); }
.btn-quiet:hover { color: var(--ink); }
.btn:disabled { opacity: .4; cursor: progress; transform: none; }
.link-btn {
  border: 0; background: none; padding: 0;
  color: var(--muted); cursor: pointer; font-size: 12px;
  transition: color .15s var(--ease);
}
.link-btn:hover { color: var(--ink); }

/* ---------- 全站顶栏：品牌 + 工具标签 + 教程菜单 ---------- */
.site-head {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 48px;
  padding: 0 20px;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}
.site-brand { display: flex; align-items: center; gap: 8px; flex: none; color: var(--ink); text-decoration: none; }
.site-name { font-size: 15px; font-weight: 600; }
.site-nav { display: flex; align-items: stretch; gap: 2px; height: 100%; min-width: 0; }
.nav-tab {
  display: flex; align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 transparent;
  transition: color .15s var(--ease), box-shadow .15s var(--ease);
}
.nav-tab:hover { color: var(--ink); }
.nav-tab[aria-current="page"], .nav-tab.is-current { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.nav-tab:focus-visible { outline-offset: -4px; }
.nav-menu { position: relative; display: flex; }
.nav-menu > summary { list-style: none; gap: 6px; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary::after {
  content: "";
  width: 5px; height: 5px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.nav-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  padding: 6px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(0, 0, 0, 0.12);
}
.nav-pop a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
  transition: background-color .15s var(--ease);
}
.nav-pop a:hover, .nav-pop a[aria-current="page"] { background: var(--hover); }
.nav-pop strong { font-size: 14px; font-weight: 500; }
.nav-pop span { font-size: 12px; color: var(--muted); }
.site-note { margin: 0 0 0 auto; font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---------- 工具栏：工具名（H1）+ 当前文件 + 操作 ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px 0 20px;
  background: var(--surface);
}
.tool-title { flex: none; }
.tool-name { display: flex; align-items: baseline; gap: 6px; margin: 0; font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap; }
.tool-sep { color: var(--faint); font-weight: 400; }
.tool-sub { color: var(--muted); font-weight: 500; }
.brand-mark {
  position: relative;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--ink);
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 5px; right: 5px; top: 9.5px;
  height: 3px;
  border-radius: 2px;
  background: var(--surface);
}
.doc-meta {
  flex: 1;
  min-width: 0;
  display: flex; align-items: baseline; gap: 10px;
  margin-left: 16px;
  padding-left: 16px;
  box-shadow: inset 1px 0 0 var(--line);
}
.doc-title {
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.doc-sub { flex: none; font-size: 13px; color: var(--muted); }
.bar-file, .bar-export { display: flex; align-items: center; gap: 4px; flex: none; }
.bar-export { padding-left: 8px; }

/* ---------- 主区域 ---------- */
/* 宽屏：工具占满第一屏，往下滚是说明文字（给搜索引擎和第一次来的人看） */
@media (min-width: 861px) {
  .app { height: 100dvh; display: flex; flex-direction: column; }
  .site-head, .bar { flex: none; }
  .work { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .stage { height: 100%; min-height: 0; }
  .panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
}
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
}
.stage {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 画布：浅灰底上放一张纸 */
.viewer {
  position: relative;
  flex: 1;
  min-height: 320px;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 40px 76px;
  overflow: hidden;
}
.paper-slot {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.paper-slot canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto; height: auto;
  border-radius: 2px;
  box-shadow: var(--paper-shadow);
  background: #fff;
}

.compare {
  position: absolute;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.compare.is-on { background: var(--primary); color: var(--primary-ink); }

.busy {
  position: absolute; top: 16px; right: 16px;
  z-index: var(--z-overlay);
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.drop-hint {
  position: absolute; inset: 16px;
  z-index: var(--z-overlay);
  border: 2px dashed var(--faint);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 500;
}

/* 页面缩略图（2 页以上才出现） */
.strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 40px 20px;
  justify-content: center;
}
.thumb { position: relative; flex: none; width: 52px; }
.thumb-main {
  width: 100%;
  border: 0; background: none; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.thumb canvas {
  display: block; width: 100%; height: auto;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: box-shadow .15s var(--ease);
}
.thumb .num { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.thumb.is-on canvas { box-shadow: 0 0 0 2px var(--ink); }
.thumb.is-on .num { color: var(--ink); font-weight: 600; }
.thumb .del {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px;
  border: 0; border-radius: 50%;
  background: var(--ink); color: var(--surface);
  font-size: 12px; line-height: 18px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.thumb:hover .del, .thumb:focus-within .del { opacity: 1; }
@media (hover: none) { .thumb .del { opacity: 1; } }

/* ---------- 右栏 ---------- */
.panel {
  background: var(--surface);
  padding: 20px 20px 32px;
  display: flex; flex-direction: column; gap: 16px;
}
.panel-title { margin: 0; font-size: 15px; font-weight: 600; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin: -6px 0 -6px; }
.btn-sm { min-height: 30px; padding: 0 10px; margin-right: -10px; gap: 5px; font-size: 13px; }
.icon { width: 14px; height: 14px; flex: none; }
.is-spinning .icon { animation: spin .5s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 效果列表：一行一个，左边是用当前页面生成的小样，右边是名字和说明 */
.presets { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.preset {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px;
  border: 0;
  border-radius: var(--r-lg);
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.preset:hover { background: var(--hover); }
.preset .swatch {
  display: block;
  width: 100%; height: auto;
  aspect-ratio: 400 / 243;
  border-radius: 6px;
  background: var(--canvas);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow .15s var(--ease);
}
.p-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.preset .p-name { font-size: 14px; font-weight: 500; }
.preset .p-note { font-size: 12px; line-height: 1.4; color: var(--muted); }
.preset.is-on { background: var(--soft); }
.preset.is-on .swatch { box-shadow: 0 0 0 2px var(--ink); }
.preset.is-on .p-name { font-weight: 600; }
.preset:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* 滑块 */
.sliders { display: flex; flex-direction: column; gap: 6px; }
.slider { display: grid; grid-template-columns: 64px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.slider label { font-size: 13px; }
.slider output {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slider[hidden] { display: none; }
/* 痕迹轻重：标签和数值一行，滑块单独一行 */
.amount { margin-top: 4px; }
.amount .slider { grid-template-columns: 1fr auto; row-gap: 2px; }
.amount .slider input { grid-column: 1 / -1; grid-row: 2; }
.amount .slider output { font-size: 13px; color: var(--ink); }

input[type="range"] {
  --p: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--ink) var(--p), var(--track) var(--p));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform .15s var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.2);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--ink); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--ink); }

.spec {
  margin: -6px 0 0;
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- 签名和印章：右栏入口 ---------- */
.marks-box { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.mark-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.assets { display: flex; flex-wrap: wrap; gap: 8px; }
.asset { position: relative; }
.asset-main {
  display: grid; place-items: center;
  width: 64px; height: 44px;
  padding: 4px;
  border: 0;
  border-radius: var(--r);
  background: var(--soft);
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.asset-main:hover { background: var(--line); }
.asset-main img { max-width: 100%; max-height: 100%; mix-blend-mode: multiply; }
.asset-del {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px;
  border: 0; border-radius: 50%;
  background: var(--ink); color: var(--surface);
  font-size: 11px; line-height: 16px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.asset:hover .asset-del, .asset:focus-within .asset-del { opacity: 1; }
@media (hover: none) { .asset-del { opacity: 1; } }
.legal { margin: 0; font-size: 12px; line-height: 1.6; color: var(--faint); text-wrap: pretty; }
.legal .link-btn { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 签名和印章：画布上的拖拽层 ---------- */
.mark-layer { position: absolute; z-index: 1; pointer-events: none; }
.mark-page { position: absolute; inset: 0; transform-origin: 50% 50%; }
.mark {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  border-radius: 2px;
  outline: 1px dashed transparent;
  outline-offset: 3px;
  transform-origin: 50% 50%;
  transition: outline-color .15s var(--ease);
}
.mark:hover { outline-color: rgba(0, 0, 0, 0.35); }
.mark:active { cursor: grabbing; }
.mark:focus-visible { outline: 1.5px solid #111; }
/* 成品里已经盖好了，这里只留一个看不见的把手；还没算完或正在拖动时才显示图片本身 */
.mark img { display: block; width: 100%; height: auto; opacity: 0; mix-blend-mode: multiply; pointer-events: none; user-select: none; }
.mark.is-live img { opacity: 1; }
.mark.is-sel { outline: 1.5px solid #111; }
.mark-del, .mark-handle { position: absolute; display: none; }
.mark.is-sel .mark-del, .mark.is-sel .mark-handle { display: block; }
.mark-del {
  top: -14px; right: -14px;
  width: 22px; height: 22px;
  border: 0; border-radius: 50%;
  background: #111; color: #fff;
  font-size: 14px; line-height: 22px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.mark-handle {
  right: -7px; bottom: -7px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1.5px #111;
  cursor: nwse-resize;
}

/* ---------- 弹窗 ---------- */
.sheet {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 20px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}
.sheet[open] { display: flex; flex-direction: column; gap: 16px; animation: sheet-in .2s var(--ease); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.35); }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-close {
  width: 32px; height: 32px;
  margin: -6px -6px -6px 0;
  border: 0; border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 20px; line-height: 1;
  cursor: pointer;
}
.sheet-close:hover { background: var(--hover); color: var(--ink); }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; }
.sheet-note { margin: 0; font-size: 12px; color: var(--muted); }

/* 签名板：白纸 + 一条签名线 */
.pad {
  position: relative;
  height: 200px;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}
.pad::after {
  content: "";
  position: absolute;
  left: 24px; right: 24px; bottom: 52px;
  height: 1px;
  background: #d8d8d8;
  pointer-events: none;
}
.pad canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.pad-hint {
  position: absolute; left: 0; right: 0; top: 64px;
  text-align: center;
  font-size: 13px;
  color: #a3a3a3;
  pointer-events: none;
}
.pad-tools { display: flex; align-items: center; justify-content: space-between; }
.pens { display: flex; gap: 10px; }
.pen {
  width: 22px; height: 22px;
  border: 0; border-radius: 50%;
  background: var(--pen, #1a1a1a);
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px transparent;
  transition: box-shadow .15s var(--ease);
}
.pen[data-color="#1a1a1a"] { --pen: #1a1a1a; }
.pen[data-color="#1d3b8f"] { --pen: #1d3b8f; }
.pen.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }

/* 打字签名：输入框 + 三种手写体，一行一个 */
.text-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r);
  background: var(--soft);
  font-size: 16px;
  color: var(--ink);
}
.text-input::placeholder { color: var(--faint); }
.text-input:focus { outline: 2px solid var(--ink); outline-offset: 0; }
.type-styles { --pen: #1a1a1a; display: flex; flex-direction: column; gap: 6px; }
.type-style {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 6px 14px;
  border: 0;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: left;
  cursor: pointer;
  transition: box-shadow .15s var(--ease);
}
.type-style:hover { box-shadow: inset 0 0 0 1px var(--faint); }
.type-style.is-on { box-shadow: inset 0 0 0 2px #111; }
.ts-label { font-size: 12px; color: #6e6e6e; }
.ts-sample {
  font-size: 34px;
  line-height: 1.2;
  color: var(--pen);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.type-style.is-loading .ts-sample { font-family: var(--font) !important; font-size: 13px; color: #a3a3a3; }
.type-warn { margin: 0; font-size: 12px; line-height: 1.6; color: #b42318; }

.upload {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 28px 16px;
  border-radius: var(--r-lg);
  background: var(--soft);
  text-align: center;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.upload:hover { background: var(--line); }
.upload strong { font-weight: 600; }
.upload span { font-size: 12px; color: var(--muted); }
/* 抠图结果放在棋盘格上，看得出背景已经去掉 */
.cutout {
  display: grid; place-items: center;
  height: 160px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: repeating-conic-gradient(#f2f2f2 0 25%, #ffffff 0 50%) 0 0 / 16px 16px;
}
.cutout canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 136px; }
.consent {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}
.consent input { margin: 3px 0 0; accent-color: var(--ink); width: 15px; height: 15px; flex: none; }
.legal-text p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); }
.legal-text p:first-child { color: var(--ink); }
.legal-text { overflow-y: auto; }

/* ---------- 更多调整（默认收起） ---------- */
.more { margin-top: 4px; }
.more > summary {
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  margin: 0 -8px;
  padding: 8px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after {
  content: "";
  order: -1;
  width: 6px; height: 6px;
  margin: 0 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s var(--ease);
}
.more[open] > summary::after { transform: rotate(45deg); }
.more > summary:hover { background: var(--hover); color: var(--ink); }
.more-note { margin-left: auto; font-size: 12px; color: var(--ink); }
.more .group { display: flex; flex-direction: column; gap: 8px; padding-top: 18px; }
.group-title { margin: 0; font-size: 12px; font-weight: 500; color: var(--faint); }

/* 分段开关 */
.seg {
  display: flex;
  padding: 3px;
  border-radius: var(--r);
  background: var(--soft);
}
.seg-btn {
  flex: 1;
  min-height: 28px;
  border: 0; background: none; cursor: pointer;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }

.field { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 10px; }
.field label { font-size: 13px; }
.field select {
  width: 100%;
  min-height: 32px;
  padding: 0 28px 0 10px;
  border: 0;
  border-radius: var(--r);
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 15px) 50% / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--muted) 50%) calc(100% - 10px) 50% / 5px 5px no-repeat,
    var(--soft);
  -webkit-appearance: none;
  appearance: none;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 说明文字（第一屏以下） ---------- */
.about { background: var(--surface); box-shadow: 0 -1px 0 var(--line); }
.about-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 72px 24px 56px;
}
.about h2 { margin: 0 0 14px; font-size: 26px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; text-wrap: balance; }
.about h3 { margin: 48px 0 14px; font-size: 18px; font-weight: 600; }
.about p { margin: 0 0 12px; max-width: 65ch; font-size: 15px; line-height: 1.8; color: var(--muted); text-wrap: pretty; }
.about-uses { margin: 0 0 14px; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.about-uses li { font-size: 15px; line-height: 1.8; color: var(--muted); }
.about-uses li::marker { color: var(--faint); }
.about-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.about-steps li {
  counter-increment: step;
  position: relative;
  padding: 52px 20px 20px;
  border-radius: var(--r-lg);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}
.about-steps li::before {
  content: counter(step);
  position: absolute; left: 20px; top: 20px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.about-steps strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 15px; font-weight: 600; }
.about-cards { display: grid; gap: 12px; margin-bottom: 16px; }
.about-card { padding: 16px 18px; border-radius: var(--r-lg); background: var(--canvas); }
.about-card h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.about .about-card p { margin: 0; font-size: 14px; line-height: 1.7; }
.faq { display: grid; gap: 22px 40px; }
.faq-item h3, .faq-item h4 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.about .faq-item p { margin: 0; }
@media (min-width: 861px) {
  .about-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .about-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .faq { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 481px) and (max-width: 860px) {
  .about-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.about a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.about a:hover { text-decoration-color: var(--ink); }
.about-links { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.about-links li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--canvas); }
.about-links a { font-size: 15px; font-weight: 600; text-decoration: none; }
.about-links a:hover { text-decoration: underline; }
.about-links span { font-size: 13px; color: var(--muted); }
.faq p { margin: 0; }
.site-foot {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 28px 24px 36px;
  background: var(--surface);
  box-shadow: 0 -1px 0 var(--line);
  font-size: 12px;
  color: var(--faint);
  text-align: center;
}
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; }
.foot-links a { color: var(--muted); font-size: 13px; text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; }
.foot-note { margin: 0; }

/* ---------- 教程页 ---------- */
.article-page .about { min-height: calc(100dvh - 48px); box-shadow: none; }
.article-page .about-inner { max-width: 720px; }
.article-page .faq { grid-template-columns: 1fr; }
.article-page .about h1 { margin: 8px 0 6px; font-size: 30px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; text-wrap: balance; }
.article-page .about h2 { margin: 44px 0 12px; font-size: 20px; }
.crumbs { display: flex; gap: 8px; font-size: 13px; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.article-meta { font-size: 13px !important; color: var(--faint) !important; margin-bottom: 28px !important; }
.cta { margin: 28px 0 !important; }
.about a.btn-cta { min-height: 46px; padding: 0 22px; font-size: 15px; text-decoration: none; color: var(--primary-ink); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--primary);
  color: var(--primary-ink);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: var(--z-toast);
  animation: toast-in .2s var(--ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 窄屏：下载按钮固定在底部 ---------- */
@media (max-width: 860px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .bar { position: sticky; top: 0; z-index: var(--z-bar); padding: 0 8px 0 16px; }
  .doc-sub { display: none; }
  .bar-export {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: var(--z-bar);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    background: var(--surface);
    box-shadow: 0 -1px 0 var(--line);
  }
  .bar-export .btn { flex: 1; min-height: 44px; }
  .bar-export .btn-quiet { background: var(--soft); color: var(--ink); }
  .work { grid-template-columns: minmax(0, 1fr); }
  .viewer { flex: none; min-height: 0; padding: 20px 20px 72px; }
  .paper-slot canvas { max-height: 64vh; }
  .strip { padding: 0 16px 16px; justify-content: flex-start; }
  .panel { padding: 20px 16px 24px; }
  .about-inner { padding: 48px 16px 40px; }
  .about h2 { font-size: 22px; }
  body.article-page { padding-bottom: 0; }
  .article-page .about h1 { font-size: 24px; }
  .site-head { gap: 8px; padding: 0 0 0 16px; }
  .site-note { display: none; }
  .site-nav { flex: 1; overflow-x: auto; scrollbar-width: none; padding-right: 8px; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav.has-more { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); }
  .nav-tab { padding: 0 10px; }
  /* 菜单相对整条顶栏定位，不会被横向滚动的导航裁掉 */
  .nav-menu { position: static; }
  .nav-pop { top: 100%; left: auto; right: 12px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 560px) {
  .site-name { display: none; }
  .tool-sep, .tool-sub { display: none; }
  .doc-meta { margin-left: 10px; padding-left: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
