/* ===========================================================================
   Beadful Studio — 拼豆图案生成器
   设计基调：温暖手工感 (warm / craft / paper)，刻意避开 AI 蓝紫渐变审美
   =========================================================================== */

:root {
  /* 色彩 token —— 暖色纸张 + 陶土橙强调色 */
  --bg:          #F6F1E7;   /* 温暖纸感背景 */
  --bg-2:        #EFE7D8;   /* 次级背景 */
  --surface:     #FFFFFF;   /* 卡片表面 */
  --ink:         #2A2620;   /* 主文字（暖近黑） */
  --ink-soft:    #5C554A;   /* 次级文字 */
  --muted:       #8C8475;   /* 弱文字 */
  --line:        #E7DECF;   /* 描边/分隔线 */
  --line-soft:   #F0E9DC;

  --accent:      #D9622B;   /* 陶土橙 —— 主操作 */
  --accent-press:#BF511E;
  --accent-soft: #FBE9DE;   /* 强调色淡底 */
  --teal:        #2F7D6E;   /* 辅助绿（次操作/链接） */
  --teal-soft:   #E2EFEB;
  --warn:        #C9912B;
  --success:     #4F8A4F;

  /* 字体 */
  --font-display: 'Fraunces', 'Georgia', serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;

  /* 圆角 / 阴影 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(42,38,32,.06), 0 2px 6px rgba(42,38,32,.05);
  --shadow-md: 0 6px 18px rgba(42,38,32,.10);
  --shadow-lg: 0 14px 40px rgba(42,38,32,.14);

  --space: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  /* 极淡的颗粒/纸质肌理，避免大面积纯色 */
  background-image:
    radial-gradient(circle at 1px 1px, rgba(42,38,32,.035) 1px, transparent 0);
  background-size: 22px 22px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* 工具页(studio)：一屏工作台，body 视口锁定、各栏内部滚动，画布按框宽高双向约束一屏完整显示 */
body.app {
  --wb-bg: #E8E4DC;
  --wb-rail: #F4F1EA;
  --wb-surface: #FBFAF7;
  --wb-ink: #1F1C18;
  --wb-ink-soft: #5A544A;
  --wb-muted: #8A8378;
  --wb-line: #D9D2C6;
  --wb-line-soft: #EAE4D8;
  --wb-accent: #C45A2C;
  --wb-accent-press: #A84820;
  --wb-accent-soft: #F6E6DC;
  --wb-teal: #2A6B5E;
  --wb-teal-soft: #DCEBE6;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;

  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--wb-ink);
  background-color: var(--wb-bg);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.35), transparent 120px),
    radial-gradient(circle at 1px 1px, rgba(31,28,24,.04) 1px, transparent 0);
  background-size: auto, 20px 20px;
}

/* ---------- 顶栏 ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(246,241,231,.85);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
body.app .site-header--app {
  flex: 0 0 auto;
  position: relative;
  padding: 0 16px;
  height: 44px;
  gap: 16px;
  background: rgba(244,241,234,.92);
  border-bottom: 1px solid var(--wb-line);
  backdrop-filter: blur(8px);
}
body.app .site-header--app .brand { font-size: 18px; gap: 8px; text-decoration: none; }
body.app .site-header--app .brand .mark { width: 18px; height: 18px; }
body.app .site-header--app .brand span { font-size: 10px; margin-bottom: 2px; letter-spacing: .16em; }
.app-status {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--wb-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}
.brand .mark {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: block;
  border-radius: 6px;
}
.brand span {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  align-self: flex-end;
  margin-bottom: 3px;
}
.site-nav { display: flex; gap: 18px; font-size: 13.5px; }
body.app .site-nav { gap: 14px; font-size: 12.5px; flex: 0 0 auto; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--accent); }
body.app .site-nav a { color: var(--wb-ink-soft); }
body.app .site-nav a:hover { color: var(--wb-accent); }

/* ---------- 主体布局 ---------- */
.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}
body.app .workspace {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  grid-template-columns: 248px minmax(0, 1fr) 268px;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  max-width: none;
  margin: 0;
  overflow: hidden;
  background: var(--wb-bg);
}

/* 一屏工作台：左右栏默认一屏装下不滚动；内容超高时允许内部滚动（滑杆/控件不被裁切） */
body.app .panel {
  min-height: 0;
  overflow: hidden;
  scrollbar-color: var(--wb-line) transparent;
  scrollbar-width: thin;
}
body.app .panel::-webkit-scrollbar { width: 6px; }
body.app .panel::-webkit-scrollbar-thumb { background: var(--wb-line); border-radius: 8px; }
body.app .rail {
  display: flex;
  flex-direction: column;
  background: var(--wb-rail);
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}
body.app .rail--source { border-right: 1px solid var(--wb-line); }
body.app .rail--results { border-left: 1px solid var(--wb-line); }
body.app .rail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--wb-line) transparent;
}
body.app .rail-block + .rail-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--wb-line-soft);
}
body.app .panel.right {
  display: flex;
  flex-direction: column;
  padding: 14px;
}

/* tab 条固定在右栏顶部，不参与滚动 */
.rtabs {
  display: flex; gap: 4px; flex: 0 0 auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 3px; margin: 0 0 12px;
}
body.app .rtabs {
  background: rgba(31,28,24,.05);
  border-color: var(--wb-line);
  border-radius: 8px;
}
.rtab {
  flex: 1 1 0; border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  padding: 6px 4px; border-radius: 6px; transition: all .15s ease;
}
.rtab:hover { color: var(--ink); }
.rtab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
body.app .rtab { color: var(--wb-ink-soft); }
body.app .rtab.active { background: var(--wb-surface); color: var(--wb-ink); box-shadow: 0 1px 2px rgba(31,28,24,.08); }
/* 面板区：占满剩余高度、内容完整显示；色号多时在面板内部滚动，Export 永不被顶出 */
.rtab-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-color: var(--line) var(--surface); scrollbar-width: thin; }
.rtab-pane::-webkit-scrollbar { width: 7px; }
.rtab-pane::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid var(--surface); }
.rtab-pane[hidden] { display: none; }

/* 中栏（画布区）填满剩余高度，不滚动（画布双向约束一屏完整） */
body.app .stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--wb-bg);
  padding: 10px 12px 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 10px;
  font-weight: 600;
}
body.app .panel h2 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wb-muted);
}
/* 标题行：左侧标题，右侧 ⓘ 提示图标（hover 出 tooltip） */
.panel .head { display: flex; align-items: baseline; gap: 6px; margin: 0 0 10px; }
.panel .head h2 { margin: 0; }
body.app .panel .head { margin: 0 0 10px; align-items: center; }
/* 说明收进 tooltip：小 ⓘ 图标，悬停展开气泡，避免正文堆说明 */
.info {
  position: relative;
  width: 16px; height: 16px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg-2);
  font-size: 10px; color: var(--muted); cursor: help;
}
body.app .info { background: rgba(31,28,24,.06); color: var(--wb-muted); }
.info::before { content: "i"; font-weight: 700; font-family: var(--font-mono); }
/* 默认 ::after 气泡（落地页等无 overflow 裁剪的场景仍可用） */
.info::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: 140%;
  transform: translateX(-50%) scale(.98);
  width: 196px; padding: 9px 11px;
  background: var(--ink); color: #FBF7EF;
  font-size: 11.5px; line-height: 1.5; font-weight: 400;
  text-align: left; border-radius: 9px;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease; z-index: 60;
}
.info:hover::after, .info:focus::after, .info:focus-within::after {
  opacity: 1; visibility: visible; transform: translateX(-50%) scale(1);
}
/* 工作台侧栏有 overflow，改用 body 上的 fixed #floatTip，关掉伪元素避免双重提示 */
body.app .info::after { content: none; display: none; }
.float-tip {
  position: fixed;
  z-index: 9999;
  max-width: min(240px, calc(100vw - 20px));
  padding: 9px 11px;
  background: #1F1C18;
  color: #FBF7EF;
  font-family: var(--font-body);
  font-size: 11.5px;
  line-height: 1.5;
  font-weight: 400;
  text-align: left;
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(31,28,24,.22);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.float-tip.show {
  opacity: 1;
  transform: translateY(0);
}
.section { margin-bottom: 18px; }
.section:last-child { margin-bottom: 0; }

/* 上传区 */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .18s ease;
  background: var(--bg-2);
}
body.app .dropzone {
  border: 1.5px dashed var(--wb-line);
  border-radius: 10px;
  padding: 12px 10px;
  background: rgba(255,255,255,.45);
}
/* 已有源图：上传区收成一行“更换图片”，把垂直空间留给 Setup */
body.app .rail--source.has-source .dropzone {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px 10px; margin-bottom: 8px;
}
body.app .rail--source.has-source .dropzone .dz-mark {
  width: 16px; height: 16px; margin: 0; flex: 0 0 auto;
}
body.app .rail--source.has-source .dropzone .dz-mark::before { width: 8px; }
body.app .rail--source.has-source .dropzone .dz-mark::after { height: 8px; }
body.app .rail--source.has-source .dropzone p { margin: 0; font-size: 12px; }
body.app .rail--source.has-source .dropzone p b { font-weight: 600; }
body.app .rail--source.has-source .dropzone .small { display: none; }
body.app .rail--source.has-source .dropzone p:first-of-type { font-size: 0; line-height: 0; }
body.app .rail--source.has-source .dropzone p:first-of-type b { font-size: 0; }
body.app .rail--source.has-source .dropzone p:first-of-type b::after {
  content: "Replace image";
  font-size: 12px; line-height: 1.3; font-weight: 600; color: var(--wb-ink-soft);
}
body.app .rail--source.has-source #sampleBtn { display: none; }
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
body.app .dropzone:hover,
body.app .dropzone.drag {
  border-color: var(--wb-accent);
  background: var(--wb-accent-soft);
}
.dropzone .ico { font-size: 22px; line-height: 1; margin-bottom: 5px; }
.dz-mark {
  width: 28px; height: 28px; margin: 0 auto 8px;
  border: 1.5px dashed var(--wb-muted); border-radius: 6px;
  position: relative;
}
.dz-mark::before, .dz-mark::after {
  content: ""; position: absolute; background: var(--wb-muted);
  left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.dz-mark::before { width: 12px; height: 1.5px; }
.dz-mark::after { width: 1.5px; height: 12px; }
.dropzone p { margin: 3px 0; font-size: 13px; color: var(--ink-soft); }
body.app .dropzone p { color: var(--wb-ink-soft); font-size: 12.5px; }
.dropzone .small { font-size: 11px; color: var(--muted); }
body.app .dropzone .small { color: var(--wb-muted); }
.thumb-wrap {
  margin-top: 10px; display: none;
  border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line);
  position: relative;
  touch-action: none;
}
body.app .thumb-wrap { border-color: var(--wb-line); border-radius: 8px; background: #fff; }
/* 固定紧凑预览高度 + object-fit 不变形，杜绝预览图把左栏顶爆、引发内部滚动 */
.thumb-wrap img {
  display: block; width: 100%; height: 96px; object-fit: cover; object-position: center;
  -webkit-user-drag: none; user-select: none; pointer-events: none;
}
.thumb-wrap.bg-picking {
  cursor: crosshair;
  border-color: var(--wb-accent);
  box-shadow: 0 0 0 2px var(--wb-accent-soft);
}
.thumb-wrap.bg-picking img {
  pointer-events: auto;
  cursor: crosshair;
}
/* 裁切态：完整显示原图 + 十字光标，提示可框选 */
.thumb-wrap.cropping {
  cursor: crosshair;
  border-color: var(--wb-accent);
  box-shadow: 0 0 0 2px var(--wb-accent-soft);
}
.thumb-wrap.cropping img {
  object-fit: contain; height: 168px; background: rgba(31,28,24,.04);
}
.crop-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  font-size: 12px; color: var(--ink-soft);
}
.crop-row .crop-toggle { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
/* Crop 紧贴预览图下方，不再沉在 Setup 底部 */
.crop-bar {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--wb-line);
  border-radius: 8px;
  background: rgba(255,255,255,.55);
}
.crop-bar.is-on {
  border-color: rgba(196,90,44,.35);
  background: var(--wb-accent-soft);
}
.crop-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--wb-ink-soft); cursor: pointer; margin: 0;
  font-weight: 600;
}
.crop-toggle input[type="checkbox"],
.crop-row input[type="checkbox"] { accent-color: var(--wb-accent); }
.crop-hint {
  display: block; font-size: 11.5px; color: var(--wb-accent-press);
  margin: 0; line-height: 1.35;
}
.crop-hint[hidden] { display: none !important; }
/* 无预览时 crop 条仍占位，避免开关跑远；有图后贴在缩略图下 */
body.app .rail--source:not(.has-source) .crop-bar { margin-top: 8px; }
body.app .rail--source.has-source .thumb-wrap { margin-bottom: 0; }
body.app .rail--source.has-source .crop-bar { margin-top: 8px; }
.crop-overlay {
  position: absolute; inset: 0; z-index: 2;
  /* 接管拖选：图片 pointer-events:none，由 overlay/wrap 接收手势 */
  pointer-events: auto;
  touch-action: none;
}
.crop-overlay[hidden] { display: none !important; }
.crop-overlay .crop-box {
  position: absolute; border: 2px solid var(--wb-accent);
  background: rgba(196, 90, 44, .18); box-shadow: 0 0 0 2000px rgba(0,0,0,.28);
  display: none; pointer-events: none;
}
.btn--block { width: 100%; margin-top: 8px; }

/* 控件（收紧） */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 4px;
  background: var(--line); outline: none;
}
body.app input[type="range"] { background: var(--wb-line); height: 3px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 3px solid #fff; box-shadow: var(--shadow-sm);
}
body.app input[type="range"]::-webkit-slider-thumb {
  width: 14px; height: 14px; background: var(--wb-accent); border-width: 2px;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 3px solid #fff;
}
body.app input[type="range"]::-moz-range-thumb { background: var(--wb-accent); }
select {
  width: 100%; padding: 7px 9px; font: inherit;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--ink); cursor: pointer;
}
body.app select {
  border-color: var(--wb-line);
  border-radius: 8px;
  background: var(--wb-surface);
  color: var(--wb-ink);
  padding: 8px 10px;
  font-size: 13px;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
body.app .field-label { color: var(--wb-ink-soft); font-size: 12px; margin-bottom: 6px; }
/* 紧凑 label：并入同一 section 的次级滑杆（如 Merge similar 紧跟 Max colors） */
.field-label.compact { margin-top: 8px; margin-bottom: 6px; font-size: 12px; }
/* 次级滑杆间距收紧 */
.section input[type="range"] + .field-label.compact { margin-top: 6px; }
.field-label .val {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
}
body.app .field-label .val { color: var(--wb-accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%; padding: 10px 14px;
  font: inherit; font-weight: 600; font-size: 14px;
  border: none; border-radius: var(--r-sm); cursor: pointer;
  transition: transform .12s ease, background .18s ease, box-shadow .18s ease;
}
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--accent-press); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }
body.app .btn--primary {
  background: var(--wb-accent);
  border-radius: 9px;
  padding: 11px 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 1px 2px rgba(31,28,24,.12);
}
body.app .btn--primary:hover { background: var(--wb-accent-press); }
.btn--ghost { background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--line-soft); }
body.app .btn--ghost {
  background: rgba(255,255,255,.55);
  color: var(--wb-ink);
  border-color: var(--wb-line);
  border-radius: 8px;
}
body.app .btn--ghost:hover { background: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--sm { width: auto; padding: 7px 14px; font-size: 13px; }
body.app .btn--sm.btn--block { width: 100%; padding: 7px 12px; font-size: 12.5px; }
.btn--lg { width: auto; padding: 13px 28px; font-size: 15px; }

/* 工具区（收紧） */
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; cursor: pointer; font-size: 11px; color: var(--ink-soft);
  transition: all .15s ease;
}
.tool:hover { border-color: var(--accent); }
.tool.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-press); }
body.app .tool {
  border-color: transparent;
  background: transparent;
  color: var(--wb-ink-soft);
  border-radius: 8px;
}
body.app .tool:hover { background: rgba(31,28,24,.05); border-color: transparent; color: var(--wb-ink); }
body.app .tool.active {
  background: var(--wb-accent-soft);
  border-color: transparent;
  color: var(--wb-accent-press);
  box-shadow: inset 0 0 0 1px rgba(196,90,44,.28);
}
.tool .ti { font-size: 16px; line-height: 1; }
body.app .tool .ti { font-size: 13px; font-family: var(--font-mono); font-weight: 600; }

/* 调色盘（绘画用，收紧） */
.swatches {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2);
  padding: 5px;
}
/* 紧凑横排调色条：随编辑工具条内联，小色块可换行，完整展示全色板 */
.swatches-inline {
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: center;
  flex: 1 1 auto; min-width: 0;
  /* 给 .swatch.active 外圈留边，避免被裁切 */
  padding: 4px 2px;
  overflow: visible;
}
body.app .swatches-inline {
  gap: 5px;
  padding: 4px 2px 4px 10px;
  border-left: 1px solid var(--wb-line-soft);
}
.swatches-inline .swatch {
  width: 16px; height: 16px; flex: 0 0 auto;
  aspect-ratio: auto; border-radius: 4px;
}
body.app .swatches-inline .swatch { width: 18px; height: 18px; border-radius: 5px; }
.swatch {
  aspect-ratio: 1; border-radius: 4px; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.swatch.active { border-color: var(--ink); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
body.app .swatch.active { border-color: var(--wb-ink); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--wb-accent); }

/* ---------- 舞台（画布） ---------- */
.stage {
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}
.stage-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 12px; flex-wrap: wrap;
}
body.app .stage-bar {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin-bottom: 8px;
  min-height: 32px;
}
.stage-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.view-toggle {
  display: inline-flex; flex: 0 0 auto; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; max-width: 100%;
}
body.app .view-toggle {
  background: rgba(31,28,24,.05);
  border-color: var(--wb-line);
  border-radius: 8px;
  padding: 2px;
}
.view-toggle button {
  border: none; background: transparent; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--ink-soft); padding: 5px 13px; border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}
body.app .view-toggle button {
  border-radius: 6px; padding: 5px 8px; font-size: 11.5px; color: var(--wb-ink-soft);
}
.view-toggle button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
body.app .view-toggle button.active {
  background: var(--wb-surface); color: var(--wb-ink);
  box-shadow: 0 1px 2px rgba(31,28,24,.08);
}
.stage-stats {
  flex: 1 1 auto; min-width: 0; text-align: right;
  font-size: 12px; color: var(--muted); font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* 左栏 Setup：纵向堆叠，贴工作流 */
.settings { flex: 0 0 auto; min-height: 0; }
body.app .settings {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
}
.set-stack { display: flex; flex-direction: column; gap: 10px; }
.settings .set-item { min-width: 0; }

/* Source actions: sample + blank */
.source-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.source-actions .btn { width: 100%; padding: 7px 8px; font-size: 12px; }

/* Setup folds: Image / Stash */
.set-fold {
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  background: rgba(255,255,255,.55);
  padding: 0;
  overflow: hidden;
}
.set-fold > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--wb-ink);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.set-fold > summary::-webkit-details-marker { display: none; }
.set-fold > summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--wb-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
.set-fold[open] > summary::before { transform: rotate(90deg); }
.set-fold-body {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stash-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--wb-muted);
}
.stash-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.stash-actions .btn { padding: 5px 6px; font-size: 11px; }
.stash-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
  padding: 2px;
}
.stash-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.12);
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.stash-swatch.off {
  opacity: .28;
  filter: grayscale(.35);
  box-shadow: none;
}
.stash-swatch.on {
  outline: 2px solid var(--wb-accent);
  outline-offset: 0;
}
.bg-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bg-row .btn { flex: 1 1 auto; padding: 5px 8px; font-size: 11.5px; }
.bg-row .btn.active {
  background: var(--wb-accent-soft);
  border-color: rgba(196,90,44,.4);
  color: var(--wb-accent-press);
}
.bg-swatch {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  border-radius: 5px;
  border: 1px dashed var(--wb-line);
  background:
    linear-gradient(45deg, #ddd 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(-45deg, #ddd 25%, transparent 25%) -4px 0 / 8px 8px,
    linear-gradient(45deg, transparent 75%, #ddd 75%) -4px 0 / 8px 8px,
    linear-gradient(-45deg, transparent 75%, #ddd 75%) -4px 0 / 8px 8px,
    #fff;
}
.bg-swatch.has {
  border-style: solid;
  background-image: none;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 16px;
  margin-bottom: 10px;
}
.settings-actions {
  display: flex; align-items: center; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--line-soft);
}
.settings-actions .btn { width: auto; padding: 8px 18px; font-size: 13px; }

.edit-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 8px 10px;
}
body.app .edit-bar {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  padding: 4px 6px 4px 4px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(31,28,24,.04);
  overflow: visible;
}
body.app .edit-bar .edit-bar-info {
  align-self: center;
}
.edit-bar .tools { display: inline-grid; grid-template-columns: repeat(5, minmax(48px, 1fr)); gap: 6px; flex: 0 0 auto; }
body.app .edit-bar .tools {
  align-self: center;
  grid-template-columns: repeat(5, minmax(44px, auto));
  gap: 2px;
}
.edit-bar .tool { padding: 6px 8px; font-size: 11px; }
body.app .edit-bar .tool { padding: 6px 8px; font-size: 10.5px; gap: 2px; }
.edit-bar .edit-tip { display: none; } /* 说明收进工具条旁 ⓘ tooltip */

.canvas-frame {
  flex: 1 1 auto;
  min-height: 0;
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 14px;
  position: relative;
  /* 可缩放平移：内部 viewport 负责放大/平移，外层 frame 保留网格纸背景 */
  overflow: hidden;
  display: flex;
}
body.app .canvas-frame {
  background:
    linear-gradient(rgba(31,28,24,.045) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, rgba(31,28,24,.045) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 8px 24px rgba(31,28,24,.06);
  padding: 10px;
}

/* 画布视口：装画布，支持滚动（平移）+ 内部放大 */
.canvas-viewport {
  flex: 1 1 auto;
  min-width: 0; min-height: 0;
  overflow: auto;
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
}
#beadCanvas {
  flex: 0 0 auto;
  display: block;
  touch-action: none; cursor: crosshair; border-radius: 6px;
  image-rendering: -webkit-optimize-contrast;
  /* 禁止画布另存/拖出/长按呼出保存（只能走 Export） */
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
/* 放大时优先锐利边缘，避免浏览器二次插值把珠边抹虚 */
#beadCanvas.zoom-sharp {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.canvas-frame,
.canvas-viewport {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
/* 浮动缩放控件（右下角） */
.canvas-zoom {
  position: absolute;
  right: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  padding: 3px 8px;
  font-size: 12px; font-family: var(--font-mono);
  z-index: 6;
}
body.app .canvas-zoom {
  border-color: var(--wb-line);
  border-radius: 8px;
  background: rgba(251,250,247,.94);
  backdrop-filter: blur(6px);
}
.canvas-zoom button {
  border: none; background: transparent; cursor: pointer;
  width: 22px; height: 22px; line-height: 1; border-radius: 50%;
  font-size: 14px; color: var(--ink-soft);
  display: grid; place-items: center;
}
body.app .canvas-zoom button { border-radius: 6px; color: var(--wb-ink-soft); }
.canvas-zoom button:hover { background: var(--bg-2); color: var(--ink); }
body.app .canvas-zoom button:hover { background: rgba(31,28,24,.06); color: var(--wb-ink); }
.canvas-zoom button:active { background: var(--accent-soft); }
.canvas-zoom #zoomVal { min-width: 38px; text-align: center; color: var(--ink-soft); }
body.app .canvas-zoom #zoomVal { color: var(--wb-ink-soft); }
.canvas-zoom #zoomFit { width: auto; min-width: 34px; padding: 0 6px; font-size: 11px; font-weight: 600; }

/* 变换操作组：撤销/重做 + 水平镜像/垂直镜像/90°旋转（竞品标配） */
.transform-actions {
  display: flex; align-items: center; gap: 3px;
  padding: 0 8px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
body.app .transform-actions {
  border: 1px solid var(--wb-line);
  border-radius: 8px;
  padding: 2px;
  background: var(--wb-surface);
  gap: 1px;
}
body.app .transform-actions .act-sep {
  width: 1px; height: 16px; background: var(--wb-line); margin: 0 3px;
}
.transform-actions .act {
  border: none; background: transparent; cursor: pointer;
  width: 26px; height: 26px; line-height: 1; border-radius: 6px;
  font-size: 15px; color: var(--ink-soft);
  display: grid; place-items: center;
}
body.app .transform-actions .act { color: var(--wb-ink-soft); width: 28px; height: 28px; }
.transform-actions .act:hover { background: var(--bg-2); color: var(--ink); }
body.app .transform-actions .act:hover { background: rgba(31,28,24,.06); color: var(--wb-ink); }
.transform-actions .act:active { background: var(--accent-soft); }
.transform-actions .act:disabled { opacity: .35; cursor: not-allowed; }
.transform-actions .act:disabled:hover { background: transparent; color: var(--ink-soft); }

.edit-bar .info { margin-left: auto; }
.empty-state {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--muted);
  text-align: center; padding: 20px; pointer-events: none; z-index: 4;
}
body.app .empty-state { color: var(--wb-muted); gap: 8px; }
.empty-state .big { font-size: 40px; }
.empty-grid {
  display: block; width: 42px; height: 42px; margin: 0 auto;
  border-radius: 8px;
  background:
    linear-gradient(var(--wb-line) 1px, transparent 1px) 0 0 / 10px 10px,
    linear-gradient(90deg, var(--wb-line) 1px, transparent 1px) 0 0 / 10px 10px,
    rgba(31,28,24,.03);
  border: 1px solid var(--wb-line);
  box-shadow: 0 6px 16px rgba(31,28,24,.06);
}
.empty-state .t { font-family: var(--font-display); font-size: 18px; color: var(--ink-soft); }
body.app .empty-state .t {
  font-family: var(--font-body); font-weight: 650; font-size: 16px; color: var(--wb-ink-soft);
}
.empty-state .s { font-size: 12.5px; max-width: 260px; }
body.app .empty-state .s { max-width: 280px; color: var(--wb-muted); }

/* 未生成图案时点工具/色块的温和提示，浮在编辑工具条上方 */
.hint-toast {
  position: relative;
  margin: 8px 0 0;
  padding: 8px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--accent-press);
  text-align: center;
  opacity: 0; transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
body.app .hint-toast {
  position: absolute;
  left: 50%; bottom: 18px;
  transform: translate(-50%, 6px);
  margin: 0;
  z-index: 8;
  width: max-content;
  max-width: min(420px, calc(100% - 48px));
  background: var(--wb-ink);
  color: #F7F3EA;
  border: none;
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(31,28,24,.22);
}
body.app .hint-toast.show { opacity: 1; transform: translate(-50%, 0); }
.hint-toast.show { opacity: 1; transform: translateY(0); }
.hint-toast.err { background: #FBEAE6; border-color: #C0573A; color: #9C3A1E; }
body.app .hint-toast.err { background: #7A2E1C; color: #FFE8E0; border: none; }

/* ---------- 结果侧栏（收紧） ---------- */
.legend { display: flex; flex-direction: column; gap: 5px; }
.legend-row {
  display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center;
  padding: 5px 7px; border-radius: var(--r-sm); background: var(--bg-2);
  font-size: 12.5px;
}
body.app .legend-row {
  background: rgba(255,255,255,.55);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
}
body.app .legend-row:hover { border-color: var(--wb-line); background: #fff; }
.legend-row .sw { width: 18px; height: 18px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.legend-row .meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.legend-row .code { font-family: var(--font-mono); font-weight: 600; font-size: 11.5px; }
.legend-row .nm { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.app .legend-row .nm { color: var(--wb-muted); }
.legend-row .cnt { font-family: var(--font-mono); font-weight: 600; font-size: 11.5px; color: var(--accent-press); }
body.app .legend-row .cnt { color: var(--wb-accent-press); }
.legend-empty { font-size: 12.5px; color: var(--muted); padding: 6px 4px; }
body.app .legend-empty { color: var(--wb-muted); }
.legend-empty.craft-progress {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--wb-accent-press);
  padding: 4px 2px 8px;
}

.export-btns { display: flex; flex-direction: column; gap: 8px; }
.export-btns .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.export-btns .row.row--4 { grid-template-columns: repeat(4, 1fr); }
.export-btns .btn { padding: 8px 12px; font-size: 13px; }
.export-btns .row.row--4 .btn { padding: 8px 6px; font-size: 12px; }
.export-note {
  margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--wb-muted);
}
.export-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 0 4px;
  margin: 0;
  border: none;
}
.export-btns > .btn--primary { margin-top: 2px; }
.export-more .btn--block { width: 100%; }
.export-more .export-note { margin: 6px 0 10px; }
.export-more .export-more-label + .row,
.export-more .export-more-label + .btn { margin-top: 0; }
.export-more .export-more-label:not(:first-child) { margin-top: 12px; }
.export-opts .field-label { font-size: 11px; }
.export-opts select {
  width: 100%;
  font: inherit;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--wb-line);
  background: #fff;
  color: var(--wb-ink);
}
.export-opts select:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: #f3f1ec;
}
.export-more { margin-top: 4px; }
.export-more-label {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--wb-muted); margin-bottom: 6px;
}

.tips { font-size: 11.5px; color: var(--ink-soft); background: var(--teal-soft);
  border: 1px solid #CFE3DD; border-radius: var(--r-md); padding: 10px 12px; }
body.app .tips {
  background: var(--wb-teal-soft);
  border-color: #C5DDD6;
  color: var(--wb-ink-soft);
  border-radius: 10px;
}
.tips b { color: var(--teal); }
body.app .tips b { color: var(--wb-teal); }
.tips ul { margin: 5px 0 0; padding-left: 15px; }
.tips li { margin: 2px 0; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 14px 24px; text-align: center;
  font-size: 12px; color: var(--muted);
}
/* 一屏工作台：页脚挤占视口高度会让左右栏被裁切、被迫内部滚动；直接隐藏，workspace 独占剩余高度 */
body.app .site-footer { display: none; }
body.app .site-header { flex: 0 0 auto; }
.site-footer a { color: var(--teal); text-decoration: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  /* 窄屏：一屏工作台放不下三栏，退回整页自然滚动（body 解锁高、各栏取消内部滚动） */
  body.app { display: block; overflow: auto; }
  body.app .workspace {
    grid-template-columns: 1fr;
    flex: none; height: auto; min-height: 0; overflow: visible;
    align-items: start; max-width: 720px;
    margin: 0 auto;
    padding: 12px;
    gap: 12px;
    grid-template-rows: auto;
  }
  body.app .panel,
  body.app .rail,
  body.app .stage { overflow: visible; }
  body.app .rail {
    border: 1px solid var(--wb-line);
    border-radius: 12px;
  }
  body.app .rail--source,
  body.app .rail--results { border-left: 1px solid var(--wb-line); border-right: 1px solid var(--wb-line); }
  body.app .rail-scroll { overflow: visible; }
  body.app .stage {
    border: 1px solid var(--wb-line);
    border-radius: 12px;
    background: var(--wb-rail);
  }
  body.app .app-status { display: none; }
  body.app .hint-toast { position: relative; left: auto; bottom: auto; transform: none; width: auto; max-width: none; }
  body.app .hint-toast.show { transform: none; }
  .canvas-frame { min-height: 320px; }
  #beadCanvas { max-height: none; }
  .site-nav { display: none; }
}

/* ===========================================================================
   落地页 (index.html) — 营销页，整页滚动
   视觉方向：冷雾灰纸 + 拼豆彩色点阵 + Syne 展示字，刻意避开奶油/陶土橙/表情图标
   =========================================================================== */
body.landing {
  --bg: #E8EDF2;
  --bg-2: #DEE5EC;
  --surface: #F7FAFC;
  --ink: #14181C;
  --ink-soft: #3E4750;
  --muted: #6B7580;
  --line: #CDD6DF;
  --line-soft: #DDE4EB;
  --accent: #E11D72;
  --accent-press: #BE185D;
  --accent-soft: #FCE7F1;
  --teal: #0F766E;
  --teal-soft: #D5EFEB;
  --success: #0F766E;
  --font-display: 'Syne', 'Avenir Next', 'Segoe UI', sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,24,28,.05);
  --shadow-md: 0 8px 24px rgba(20,24,28,.08);
  --shadow-lg: 0 18px 48px rgba(20,24,28,.12);

  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 70% 0%, rgba(225,29,114,.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 10% 80%, rgba(15,118,110,.06), transparent 50%),
    linear-gradient(rgba(20,24,28,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,24,28,.03) 1px, transparent 1px);
  background-size: auto, auto, 28px 28px, 28px 28px;
  font-family: var(--font-body);
}

body.landing .site-header {
  background: rgba(232,237,242,.82);
  border-bottom-color: var(--line);
}
body.landing .site-nav a:hover { color: var(--accent); }
body.landing .btn { text-decoration: none; }
body.landing .btn--primary {
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 2px 8px rgba(225,29,114,.25);
}
body.landing .btn--primary:hover { background: var(--accent-press); }
body.landing .btn--ghost {
  background: rgba(247,250,252,.7);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 10px;
}
body.landing .btn--ghost:hover { background: #fff; border-color: var(--ink-soft); }
body.landing .landing-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 20px;
}
body.landing .landing-header .site-nav { justify-self: end; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 720px; }

/* ---------- Hero: brand-first + light multi-color sample (not a heavy block) ---------- */
.hero {
  position: relative;
  min-height: calc(100vh - 56px);
  min-height: calc(100dvh - 56px);
  display: flex;
  align-items: center;
  padding: 56px 0 64px;
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 32px 48px;
  align-items: center;
  width: 100%;
}
.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 540px;
  animation: copy-rise .7s cubic-bezier(.2,.7,.2,1) both;
}
.brand-mark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(48px, 8vw, 84px);
  line-height: .92;
  letter-spacing: -.04em;
  margin: 0 0 18px;
  color: var(--ink);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin: 0 0 14px;
  color: var(--ink-soft);
  max-width: 18em;
}
.hero .lede {
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 28em;
  margin: 0 0 28px;
}
.cta-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cta-row .btn { width: auto; min-width: 148px; }

/* Hero demo carousel: photo → beads → fused → chart */
.hero-demo {
  position: relative;
  width: min(100%, 380px);
  max-width: 380px;
  margin-left: auto;
  animation: hero-in .85s cubic-bezier(.2,.7,.2,1) .08s both;
}
.demo-frame {
  position: relative;
  border-radius: 18px;
  background: rgba(247,250,252,.65);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(20,24,28,.08);
  overflow: hidden;
  aspect-ratio: 1;
}
.demo-slides { position: absolute; inset: 0; }
.demo-slide {
  position: absolute; inset: 0; margin: 0;
  display: grid; place-items: center;
  opacity: 0;
  transform: scale(.985);
  transition: opacity .45s ease, transform .45s ease;
  pointer-events: none;
}
.demo-slide.is-active {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.demo-slide img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  background: #F7FAFC;
}
.demo-progress {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  height: 3px; border-radius: 99px;
  background: rgba(20,24,28,.08);
  overflow: hidden; z-index: 2;
}
.demo-progress i {
  display: block; height: 100%; width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  border-radius: inherit;
}
.demo-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 14px; padding: 0 2px;
}
.demo-label {
  margin: 0;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  letter-spacing: .01em;
}
.demo-idx {
  font-family: var(--font-display);
  font-weight: 700; color: var(--accent);
  margin-right: 6px; letter-spacing: .06em;
}
.demo-dots { display: flex; gap: 8px; align-items: center; }
.demo-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: none; padding: 0; cursor: pointer;
  background: var(--line);
  transition: transform .2s ease, background .2s ease;
}
.demo-dot:hover { background: var(--muted); }
.demo-dot.is-active {
  background: var(--accent);
  transform: scale(1.25);
}

@keyframes hero-in {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes copy-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-copy, .hero-demo { animation: none; }
  .demo-slide { transition: none; }
  .demo-progress { display: none; }
}

/* Section blocks */
.section-block { padding: 72px 0; }
.section-block--alt {
  background: rgba(247,250,252,.55);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.block-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4vw, 34px);
  text-align: center;
  margin: 0 0 8px;
  letter-spacing: -.02em;
}
.block-sub { text-align: center; color: var(--muted); margin: 0 0 40px; font-size: 15px; }

/* Steps — no cards; numbered rows with line icons */
.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 28px;
  counter-reset: none;
}
.step {
  position: relative;
  padding: 0 0 0 0;
  background: none; border: none; border-radius: 0; box-shadow: none;
}
.step + .step { border-left: 1px solid var(--line); padding-left: 28px; }
.step-ico {
  width: 36px; height: 36px; color: var(--accent); margin-bottom: 14px;
}
.step-ico svg { width: 100%; height: 100%; display: block; }
.step-no {
  font-family: var(--font-display);
  font-size: 13px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.step h3 {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em;
}
.step p { font-size: 14.5px; color: var(--ink-soft); margin: 0; line-height: 1.5; }

/* Features — flat list, SVG icons instead of emoji */
.features {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px 32px;
}
.feature {
  background: none; border: none; border-radius: 0; box-shadow: none; padding: 0;
}
.feature-ico {
  width: 40px; height: 40px; margin-bottom: 14px; color: var(--ink);
}
.feature-ico svg { width: 100%; height: 100%; display: block; }
.feature h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em;
}
.feature p { font-size: 14px; color: var(--ink-soft); margin: 0; line-height: 1.5; }

/* FAQ — interactive details keep light containers */
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0 18px;
  box-shadow: none;
  transition: border-color .15s ease;
}
.faq-item:hover, .faq-item[open] { border-color: var(--ink-soft); }
.faq-item summary {
  cursor: pointer; padding: 16px 0; font-weight: 600; font-size: 15px;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; color: var(--accent); font-size: 22px; font-weight: 700; line-height: 1; flex: 0 0 auto;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin: 0 0 16px; font-size: 14px; color: var(--ink-soft); line-height: 1.55; }

/* CTA band */
.cta-band {
  background:
    radial-gradient(ellipse 70% 80% at 80% 50%, rgba(255,255,255,.12), transparent 55%),
    linear-gradient(135deg, #BE185D 0%, #E11D72 45%, #0F766E 120%);
  color: #fff;
  padding: 64px 0;
  text-align: center;
}
.cta-inner h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 3.5vw, 32px);
  margin: 0 0 10px;
  letter-spacing: -.02em;
}
.cta-inner p { margin: 0 0 26px; font-size: 16px; opacity: .9; }
/* Must beat body.landing .btn--primary or the CTA washes into the pink band */
body.landing .cta-band .btn--primary {
  background: #fff;
  color: #9F1239;
  box-shadow: 0 4px 18px rgba(20,24,28,.22);
}
body.landing .cta-band .btn--primary:hover {
  background: #FFF1F6;
  color: #831843;
}
.cta-inner .btn { width: auto; }

/* Footer (landing) */
body.landing .site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 24px 36px;
  text-align: center;
  background: transparent;
}
.footer-inner { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.brand--footer { font-size: 22px; }
.footer-nav { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.footer-nav a { color: var(--ink-soft); text-decoration: none; font-size: 14px; }
.footer-nav a:hover { color: var(--accent); }
.footer-note { font-size: 12.5px; color: var(--muted); margin: 0; }

/* Prose / guide pages — long-tail SEO content */
.prose {
  font-size: 15.5px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.prose > p { margin: 0 0 1.1em; }
.prose a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--accent); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose h2.block-title { color: var(--ink); }
.guide-hero {
  padding: 56px 0 24px;
  text-align: center;
}
.guide-hero .brand-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}
.guide-hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4.5vw, 40px);
  letter-spacing: -.02em;
  margin: 0 0 14px;
  color: var(--ink);
  line-height: 1.15;
}
.guide-hero .lede {
  max-width: 560px;
  margin: 0 auto 28px;
  font-size: 16px;
  color: var(--ink-soft);
}
.guide-toc {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: center;
  font-size: 13.5px;
}
.guide-toc a { color: var(--ink-soft); text-decoration: none; }
.guide-toc a:hover { color: var(--accent); }
.guide-body h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  margin: 2.2em 0 0.6em;
  letter-spacing: -.01em;
}
.guide-body h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 1.6em 0 0.45em;
}
.guide-body ol.guide-steps {
  margin: 0 0 1.2em;
  padding-left: 1.25em;
}
.guide-body ol.guide-steps li { margin-bottom: 0.65em; }
.guide-body ul { margin: 0 0 1.2em; padding-left: 1.25em; }
.guide-body ul li { margin-bottom: 0.4em; }

/* Landing responsive */
@media (max-width: 860px) {
  .hero {
    min-height: auto;
    padding: 40px 0 48px;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .hero-demo {
    justify-self: center;
    max-width: 320px;
    order: -1;
  }
  .hero-copy { max-width: none; }
  .brand-mark { font-size: clamp(42px, 14vw, 64px); }
  .hero h1 { font-size: 22px; }
  .steps, .features { grid-template-columns: 1fr; gap: 28px; }
  .step + .step { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 28px; }
}
