:root {
  color-scheme: light;
  --bg: #f7f7f4; --panel: #fbfbf9; --paper: #fff; --ink: #111; --muted: #6a6a66; --faint: #a3a39e;
  --line: #d9d9d4; --line-soft: #e8e8e3; --subtle: #f2f2ef;
  --accent: #b97824; --accent-soft: #f3e6d3; --accent-ink: #7a4a12;
  --ok: #2f6f4f; --bad: #a8321f;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --bar-h: 76px; --vvh: 100vh;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--bg); font: 14px/1.5 var(--sans); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, label[tabindex]:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}
a { color: inherit; text-decoration: none; }
h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; min-height: 52px; display: flex; align-items: center; gap: 10px;
  padding: 0 max(20px, calc((100vw - 1680px) / 2 + 24px)); background: var(--panel); border-bottom: 1px solid var(--line-soft);
}
.brand { font-weight: 800; font-size: 15px; letter-spacing: -.8px; color: #171717; display: inline-flex; align-items: center; min-height: 44px; }
.brand span { color: var(--accent); }
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; }
.crumb-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px; font-size: 14.5px; font-weight: 600; color: var(--muted); border-radius: var(--r-sm); }
.crumb-link:hover { color: var(--ink); background: var(--subtle); }
.slash { color: var(--faint); }
.crumb-current { font-size: 14.5px; font-weight: 650; white-space: nowrap; }
.tag { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- 页面骨架 ---------- */
.app { max-width: 1680px; margin: 0 auto; padding: 14px 24px 32px; }
.intro { display: flex; align-items: baseline; gap: 14px; margin: 0 0 14px; flex-wrap: wrap; }
.intro h1 { font-size: 20px; line-height: 1.3; font-weight: 650; letter-spacing: -.02em; }
.intro p { color: var(--muted); font-size: 13px; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr) 344px; gap: 16px; align-items: start; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
h2 { font-size: 13px; font-weight: 650; letter-spacing: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head.sub { margin-top: 16px; }
.count, .frame-dim { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 8px; }
.privacy { color: var(--muted); font-size: 12px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 30px; padding: 1px 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.chip.warm { background: var(--accent-soft); border-color: #e6d3b3; color: var(--accent-ink); font-weight: 600; }

/* ---------- 按钮 ---------- */
.btn-solid, .btn-line, .act {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border-radius: var(--r-md); border: 1px solid var(--ink); background: var(--ink); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
}
.btn-solid:hover:not(:disabled) { background: #2b2b2b; }
.btn-line, .act { background: #fff; color: var(--ink); border-color: #bdbdb8; }
.btn-line:hover:not(:disabled), .act:hover:not(:disabled) { border-color: var(--ink); background: var(--subtle); }
.link-btn { background: none; border: 0; padding: 0; min-height: 32px; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; color: var(--ink); }
.act { font-size: 13px; font-weight: 500; padding: 0 8px; min-height: 38px; }
.act.danger { color: var(--bad); }
.act[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
#cutout, #clearText, #resetDefaults { width: 100%; margin-top: 10px; }

/* ---------- 照片 ---------- */
.photos-card { position: sticky; top: 64px; max-height: calc(100vh - 120px); overflow: auto; }
.dropzone {
  min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 1.5px dashed #bdbdb8; border-radius: var(--r-md); background: var(--panel); padding: 14px 12px; cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.dropzone:hover, .dropzone.drag-over { background: var(--subtle); border-color: var(--ink); }
.dz-title { font-size: 16px; font-weight: 650; }
.dropzone small { font-size: 12px; color: var(--muted); }
[data-state="few"] .dropzone, [data-state="ready"] .dropzone { min-height: 44px; flex-direction: row; gap: 8px; padding: 8px 12px; }
[data-state="few"] .dropzone small, [data-state="ready"] .dropzone small { display: none; }
[data-state="few"] .dz-title::before, [data-state="ready"] .dz-title::before { content: "＋ "; }
[data-state="few"] .dz-title, [data-state="ready"] .dz-title { font-size: 14px; }
.few-note { margin-top: 10px; padding: 9px 12px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
.photo-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ph { position: relative; min-width: 0; }
.ph.is-dragging { opacity: .45; }
.ph-btn { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--subtle); }
.ph-btn img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph.is-active .ph-btn { outline: 3px solid var(--ink); outline-offset: 1px; border-color: transparent; }
.ph-no { position: absolute; left: 4px; bottom: 4px; min-width: 20px; height: 20px; padding: 0 5px; display: grid; place-items: center; border-radius: 10px; background: rgba(17, 17, 17, .78); color: #fff; font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ph-badge { position: absolute; right: 4px; top: 4px; padding: 1px 6px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 650; }
.photo-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 12px; }
.photo-pos { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.adjust { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; margin-top: 10px; }

/* ---------- 预览 ---------- */
.stage-col { min-width: 0; position: sticky; top: 64px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
.canvas-header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.canvas-stage {
  position: relative; display: flex; justify-content: center; align-items: center; padding: 18px;
  min-height: 320px; height: calc(100vh - 204px); background: #ebebe7; border-radius: var(--r-md); overflow: hidden;
}
#collage { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; background: #f5f1e9; box-shadow: 0 8px 28px rgba(28, 20, 8, .14); cursor: grab; touch-action: pan-y pinch-zoom; }
#collage:active { cursor: grabbing; }
@media (pointer: fine) { #collage { touch-action: none; } }
#collage.adjusting { touch-action: none; outline: 2px solid var(--ink); }
.empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; text-align: center; background: var(--panel); padding: 24px; }
.empty-state strong { font-size: 18px; font-weight: 650; max-width: 280px; }
.empty-state span { color: var(--muted); font-size: 13px; }
.empty-action { display: inline-flex; align-items: center; min-height: 44px; padding: 0 26px; border-radius: var(--r-md); background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; margin-top: 4px; }
.canvas-footer { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; min-height: 18px; }

/* ---------- 右侧设置 ---------- */
.col-right { position: sticky; top: 64px; max-height: calc(100vh - 120px); overflow: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); scrollbar-gutter: stable; }
.col-right .card { border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; }
.col-right .card:first-child { border-top: 0; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl-grid button { position: relative; min-width: 0; padding: 6px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 12px; color: var(--muted); }
.tpl-grid button:hover { border-color: #888; }
.tpl-grid button[aria-pressed="true"] { border: 2px solid var(--ink); padding: 5px 5px 7px; color: var(--ink); font-weight: 700; background: var(--panel); }
.tpl-grid button[aria-pressed="true"]::after { content: "✓"; position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; }
.thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; background: #ebebe7; border-radius: 4px; overflow: hidden; }
.thumb canvas { display: block; width: 100%; height: 100%; }
.tpl-name { line-height: 1.25; text-align: center; }
.glyph { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 2px; width: 70%; height: 62%; }
.glyph::before, .glyph::after { content: ""; background: #90938d; border-radius: 1px; }
.glyph.magazine::before { grid-area: 1/1/3/3; } .glyph.magazine::after { grid-area: 1/3/4/4; }
.glyph.food::before { grid-area: 1/1/2/4; } .glyph.food::after { grid-area: 2/1/4/4; background: repeating-linear-gradient(90deg, #90938d 0 9px, transparent 9px 11px); }
.glyph.story::before { grid-area: 1/2/4/3; } .glyph.story::after { grid-area: 1/1/4/2; }
.glyph.feature::before { grid-area: 1/1/4/3; } .glyph.feature::after { grid-area: 1/3/4/4; }
.glyph.grid::before { grid-area: 1/1/2/4; } .glyph.grid::after { grid-area: 2/1/4/4; background: repeating-linear-gradient(90deg, #90938d 0 10px, transparent 10px 12px); }
.restore-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: -2px 0 10px; padding: 8px 10px; border-radius: var(--r-md); background: var(--subtle); font-size: 12px; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid #bdbdb8; border-radius: var(--r-md); overflow: hidden; background: #fff; }
.seg button { min-height: 40px; padding: 0 8px; border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 650; }
.rs { display: inline-block; height: 14px; width: calc(14px * var(--w) / var(--h)); border: 1.5px solid currentColor; border-radius: 2px; flex: none; }
.fold { padding: 0; }
.fold summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 0 16px; cursor: pointer; font-size: 13px; font-weight: 650; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "›"; font-size: 18px; color: var(--muted); transition: transform 150ms ease; }
.fold[open] summary::after { transform: rotate(90deg); }
.fold summary span:first-child { flex: 1; }
.fold-body { padding: 0 16px 16px; }
.fold-body label, .fold-body .label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 6px; }
.fold-body label.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; margin-top: 8px; }
.fold-body input[type="text"] { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #bdbdb8; border-radius: var(--r-md); background: #fff; font-size: 14px; }
.fold-body input::placeholder { color: #a3a39e; }
.fold-body input[type="range"] { width: 100%; min-height: 32px; accent-color: var(--ink); }
.fold-body input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--ink); }
.sample-note { margin: 0 0 4px; padding: 8px 10px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.swatches button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; padding: 6px 2px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; font-size: 11px; color: var(--muted); }
.swatches button::before { content: ""; width: 24px; height: 24px; border-radius: 50%; background: var(--c); border: 1px solid #bdbdb8; }
.swatches button[aria-pressed="true"] { border: 2px solid var(--ink); padding: 5px 1px; color: var(--ink); font-weight: 650; }
.cutout-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.consent { margin-top: 10px; padding: 12px; border: 1px solid #e6d3b3; border-radius: var(--r-md); background: var(--accent-soft); }
.consent p { font-size: 12.5px; line-height: 1.6; color: var(--accent-ink); }
.consent-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.consent-actions button { flex: 1 1 120px; }
#clearCutout { margin-top: 8px; }
.savebar { position: sticky; bottom: 0; z-index: 5; padding: 12px 16px 16px; background: var(--paper); border-top: 1px solid var(--line); }
.save-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.save-info { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.seg.fmt { min-width: 112px; }
.save-btn { width: 100%; min-height: 48px; font-size: 15px; }

/* ---------- 浮层 ---------- */
.notice { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; padding: 6px 6px 6px 14px; border: 1px solid #e6d3b3; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.notice button { flex: none; width: 44px; height: 44px; border: 0; background: transparent; font-size: 20px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); padding: 11px 18px; border-radius: var(--r-md); box-shadow: 0 9px 40px rgba(0, 0, 0, .2); color: #fff; background: #252525; font-size: 13px; z-index: 100; max-width: calc(100vw - 30px); }
dialog.sheet { width: min(560px, calc(100vw - 24px)); max-height: 92vh; max-height: 92dvh; padding: 0; border: 0; border-radius: var(--r-lg); background: var(--paper); color: var(--ink); overflow: auto; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet-body { padding: 18px; }
.sheet-body h2 { font-size: 16px; margin-bottom: 10px; }
#resultImg { display: block; width: 100%; max-height: 52vh; object-fit: contain; border-radius: var(--r-md); background: var(--subtle); -webkit-touch-callout: default; }
.sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.sheet-actions .btn-solid, .sheet-actions .btn-line { flex: 1 1 140px; min-height: 48px; }
.pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.pick-item { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: var(--r-md); overflow: hidden; background: var(--subtle); opacity: .6; }
.pick-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pick-mark { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; display: none; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }
.pick-item[aria-pressed="true"] { opacity: 1; border-color: var(--ink); }
.pick-item[aria-pressed="true"] .pick-mark { display: grid; }
.pick-item:disabled { opacity: .3; }
html[dir="rtl"] .tag { margin-right: auto; margin-left: 0; }

/* ---------- 触屏：触控区域至少 44 × 44 ---------- */
@media (pointer: coarse) {
  .btn-solid, .btn-line, .act, .seg button { min-height: 44px; }
  .link-btn { min-height: 44px; padding: 0 4px; }
  .fold-body input[type="text"] { min-height: 44px; }
  .fold-body input[type="range"] { min-height: 44px; }
}
@media (pointer: fine) { .adjust { display: none; } }

/* ---------- 平板与小桌面 ---------- */
@media (max-width: 1180px) and (min-width: 901px) {
  .workspace { grid-template-columns: 236px minmax(0, 1fr) 300px; gap: 12px; }
  .app { padding: 12px 14px 24px; }
}

/* ---------- 手机与窄屏：单列，预览紧贴常用设置 ---------- */
@media (max-width: 900px) {
  :root { --bar-h: 76px; }
  .topbar { padding: 0 8px 0 14px; gap: 4px; }
  .tag { display: none; }
  .app { padding: 10px 12px calc(var(--bar-h) + 16px + env(safe-area-inset-bottom)); }
  .app[data-state="empty"], .app[data-state="few"] { padding-bottom: 28px; }
  .intro { display: block; margin: 6px 4px 12px; }
  .intro h1 { font-size: 22px; }
  .intro p { margin-top: 4px; }
  [data-state="few"] .intro, [data-state="ready"] .intro { display: none; }
  .workspace { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
  .col-right { display: contents; }
  .photos-card, .stage-col { position: static; max-height: none; }
  .col-right .card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; }
  .col-right .card.fold { padding: 0; }
  .photos-card { order: 1; padding: 14px; }
  .stage-col { order: 0; padding: 10px; }
  [data-state="ready"] .stage-col { order: 0; }
  .tpl-card { order: 2; } .fmt-card { order: 3; }
  [data-state="ready"] .photos-card { order: 4; }
  #textFold { order: 5; } #styleFold { order: 6; } .cutout-block { order: 7; }
  [data-state="empty"] .stage-col, [data-state="few"] .stage-col,
  [data-state="empty"] .col-right > *, [data-state="few"] .col-right > * { display: none; }
  [data-state="empty"] .dropzone { min-height: 132px; }
  [data-state="empty"] .dz-title { font-size: 18px; }
  [data-state="empty"] #photoWrap { display: none; }
  .canvas-stage { min-height: 0; height: auto; padding: 10px; }
  #collage { max-height: min(38vh, 400px); max-height: min(38svh, 400px); }
  .empty-state { display: none; }
  .canvas-footer { font-size: 12px; }
  .photo-list { display: flex; overflow-x: auto; gap: 8px; padding: 4px 2px 6px; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .ph { flex: 0 0 64px; scroll-snap-align: start; }
  .ph-btn { min-width: 64px; min-height: 64px; }
  .photo-actions { grid-template-columns: repeat(6, 1fr); }
  .photo-actions .act { grid-column: span 2; }
  .photo-actions #btnRemove, .photo-actions #btnAdjust { grid-column: span 3; }
  .adjust { display: inline-flex; }
  .tpl-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .tpl-grid button { padding: 4px 2px 6px; font-size: 11px; }
  .tpl-grid button[aria-pressed="true"] { padding: 3px 1px 5px; }
  .fold-body input[type="text"] { font-size: 16px; }
  .savebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(28, 20, 8, .07);
  }
  [data-state="empty"] .savebar, [data-state="few"] .savebar { display: none; }
  .save-meta { margin: 0; flex: none; }
  .save-info { display: none; }
  .seg.fmt { min-width: 0; }
  .seg.fmt button { min-width: 52px; }
  .save-btn { flex: 1; width: auto; }
  .toast { bottom: calc(var(--bar-h) + 14px + env(safe-area-inset-bottom)); }
  dialog.sheet { margin: auto auto 0; width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .pick-grid { grid-template-columns: repeat(3, 1fr); }
  /* 输入文字时：软键盘弹出后预览贴顶，底栏收起，输入框不被遮挡 */
  .is-typing .savebar { display: none; }
  .is-typing .topbar { position: static; }
  .is-typing .stage-col { position: sticky; top: 0; z-index: 20; padding: 6px; }
  .is-typing .canvas-header, .is-typing .canvas-footer { display: none; }
  .is-typing .canvas-stage { padding: 6px; }
  .is-typing #collage { max-height: calc(var(--vvh) * .3); }
  .fold-body input[type="text"] { scroll-margin-top: calc(var(--vvh) * .4); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ---------- 智能推荐：标识、配色、文案 ---------- */
.glyph.smart::before { grid-area: 1/1/3/2; } .glyph.smart::after { grid-area: 1/2/4/4; }
.tpl-grid button[data-badge]::before, .seg button[data-badge]::after {
  content: attr(data-badge); position: absolute; z-index: 1; padding: 0 5px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 10px; font-weight: 650; line-height: 16px;
}
.tpl-grid button[data-badge]::before { left: 6px; top: 6px; }
.seg button[data-badge] { position: relative; }
.seg button[data-badge]::after { right: 3px; top: 2px; }
.rec-note { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin: -2px 0 10px; padding: 8px 10px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.rec-note .link-btn { color: var(--accent-ink); }
.swatches { grid-template-columns: repeat(5, 1fr); }
.swatches button::before { content: "Aa"; display: grid; place-items: center; width: 34px; height: 34px; color: var(--ink); font-size: 12px; font-weight: 700; }
.swatches button { min-width: 0; }
.copy-list { display: grid; gap: 8px; }
.copy-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 48px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; text-align: start; }
.copy-item strong { font-size: 14px; font-weight: 650; }
.copy-item span { font-size: 12px; color: var(--muted); }
.copy-item:hover { border-color: #888; }
.copy-item[aria-pressed="true"] { border: 2px solid var(--ink); padding: 8px 11px; background: var(--panel); }
.more-btn { font-weight: 600; }
@media (max-width: 900px) {
  .tpl-card { order: 2; } .color-card { order: 3; } .fmt-card { order: 4; }
  [data-state="ready"] .photos-card { order: 5; }
  .copy-card { order: 6; } #textFold { order: 7; } #styleFold { order: 8; } .cutout-block { order: 9; }
  .tpl-grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 60px; overflow-x: auto; gap: 6px; padding: 8px 8px 4px 2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .tpl-grid button { scroll-snap-align: start; }
}
.ratio-seg button { padding-top: 10px; }
.rec-note { flex-wrap: nowrap; align-items: center; justify-content: space-between; }
.rec-note .link-btn { flex: none; white-space: nowrap; }
.card-head .rec-note { flex: 1; min-width: 0; margin: 0; padding: 0; background: none; justify-content: flex-end; gap: 8px; color: var(--muted); }
.card-head .rec-note .link-btn { color: var(--ink); }
@media (max-width: 900px) { #collage { max-height: min(36vh, 380px); max-height: min(36svh, 380px); } .card-head .rec-note { font-size: 11px; } }
