:root {
  /* 品牌 tokens（ROADMAP §5.1：奶油糖果浅色） */
  --bg: #FFF8F4;
  --card: #FFFFFF;
  --line: #FFE3EC;
  --ink: #4A3F55;
  --muted: #8A7F92;
  --pink: #FF7BA9;
  --pink-deep: #F2568C;
  --mint: #6FD6C0;
  --butter: #FFD166;
  --lav: #B49BFF;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(255,123,169,.14);
  --shadow-lg: 0 20px 60px rgba(74,63,85,.14);

  /* 旧变量名保留（组件里仍在用） */
  --panel: var(--card);
  --panel2: #FFF5F7;
  --text: var(--ink);
  --accent: var(--pink);
  --accent2: var(--lav);

  --font-title: "Douxiaopin Title", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;

  --tap: 44px;             /* 最小可点区域 */
  --header-h: 56px;
  --bar-h: 60px;
}

/* 自托管得意黑子集（Smiley Sans, SIL OFL 1.1；只含站内标题用字） */
@font-face {
  font-family: "Douxiaopin Title";
  src: url("./fonts/douxiaopin-title.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
/* hidden 属性必须压过作者样式（main/header 上的 display:grid/flex 会盖掉 UA 的 display:none） */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font-body);
  display: flex; flex-direction: column;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

/* ---------------- 顶栏 ---------------- */
header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: var(--header-h); padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.2) blur(8px);
}
.brand {
  font-family: var(--font-title); font-weight: 700; font-size: 19px; letter-spacing: .5px;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.logo { width: 26px; height: 26px; border-radius: 8px; display: block; flex: none; }
.brand span { font-family: var(--font-body); font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 2px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------- 主区域栅格 ---------------- */
main {
  flex: 1; display: grid; min-height: 0;
  grid-template-columns: 300px minmax(0, 1fr) 264px;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "panel stage side"
    "tools stage side";
}
#panel { grid-area: panel; }
#stage { grid-area: stage; }
#side  { grid-area: side; }
#tools { grid-area: tools; }

aside {
  background: var(--card);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
#panel { border-right: 1px solid var(--line); padding-bottom: 20px; }
#side { border-left: 1px solid var(--line); }

.panel-head, .side-head {
  display: none; align-items: center; justify-content: space-between;
  position: sticky; top: -12px; z-index: 2;
  margin: -12px -14px 8px; padding: 10px 14px;
  background: var(--card); border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.panel-head b, .side-head b { font-family: var(--font-title); font-size: 15px; letter-spacing: .5px; }
.panel-head-actions { display: flex; gap: 6px; }
#panel-renew { display: none; }

#stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 16px; min-height: 0;
  background-color: var(--bg);
  /* 豆子背景纹理（纯 CSS，无图片请求） */
  background-image:
    radial-gradient(circle at 22% 12%, rgba(255,123,169,.16) 0%, transparent 55%),
    radial-gradient(circle at 82% 82%, rgba(111,214,192,.16) 0%, transparent 50%),
    radial-gradient(circle, rgba(180,155,255,.20) 1.6px, transparent 1.7px);
  background-size: auto, auto, 20px 20px;
}
#empty { color: var(--muted); text-align: center; line-height: 2; padding: 24px; }
/* 空状态：用 3×3 颗豆子拼一个小图案（纯 CSS，不依赖 emoji 字体） */
#empty::before {
  content: ""; display: block; width: 46px; height: 46px; margin: 0 auto 12px;
  background-image:
    radial-gradient(circle at 25% 25%, var(--pink) 0 7px, transparent 7px),
    radial-gradient(circle at 75% 25%, var(--lav) 0 7px, transparent 7px),
    radial-gradient(circle at 25% 75%, var(--mint) 0 7px, transparent 7px),
    radial-gradient(circle at 75% 75%, var(--butter) 0 7px, transparent 7px);
  background-size: 100% 100%;
  opacity: .75;
}
canvas {
  image-rendering: pixelated; border-radius: 14px;
  box-shadow: var(--shadow-lg); background: #fff; max-width: 100%; height: auto;
}
.hidden { display: none !important; }

/* ---------------- 控件 ---------------- */
label { display: block; margin: 6px 0; font-size: 12px; color: var(--muted); }
label > input, label > select { width: 100%; margin-top: 4px; }
input[type=text], input[type=number], input:not([type]), select {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 10px; font: inherit; outline: none;
  min-height: var(--tap);
}
input:focus, select:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255,123,169,.18); }
input[type=color] { padding: 2px; height: var(--tap); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); width: 100%; }
input[type=range] {
  width: 100%; min-height: var(--tap); accent-color: var(--pink);
  -webkit-appearance: none; appearance: none; background: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px; background: #FFE3EC;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 22%, var(--pink) 40%);
  border: 1px solid var(--pink-deep); box-shadow: 0 3px 8px rgba(255,123,169,.45);
  cursor: pointer;
}
input[type=range]::-moz-range-track { height: 8px; border-radius: 999px; background: #FFE3EC; }
input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--pink);
  border: 1px solid var(--pink-deep); cursor: pointer;
}
.slider b { float: right; color: var(--ink); font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); min-height: var(--tap); }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--pink); }

button {
  /* 果冻感：浅底 + 内高光 + 轻微下压 */
  background: linear-gradient(#FFFDFE, #FFF1F6);
  color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 0 14px; font: inherit; cursor: pointer;
  min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 0 rgba(255,123,169,.16), inset 0 1px 0 #fff;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s;
  -webkit-tap-highlight-color: transparent;
}
button:hover { border-color: var(--pink); background: linear-gradient(#FFFFFF, #FFE9F1); }
button:active { transform: translateY(1px) scale(.99); box-shadow: 0 1px 0 rgba(255,123,169,.18), inset 0 1px 0 #fff; }
button.primary {
  background: linear-gradient(180deg, #FF9BBD, var(--pink));
  border-color: var(--pink-deep); color: #fff; font-weight: 700;
  box-shadow: 0 6px 18px rgba(255,123,169,.32), inset 0 1px 0 rgba(255,255,255,.5);
}
button.primary:hover { background: linear-gradient(180deg, #FF8DB3, var(--pink-deep)); border-color: var(--pink-deep); }
button.ghost { background: transparent; box-shadow: none; border-color: var(--line); }
button.ghost:hover { background: #FFF1F6; }
button.wide { width: 100%; margin-top: 8px; }
button[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
button[disabled]:hover { border-color: var(--line); background: linear-gradient(#FFFDFE, #FFF1F6); }
button.active, .tool.active {
  background: linear-gradient(180deg, #FF9BBD, var(--pink));
  border-color: var(--pink-deep); color: #fff; font-weight: 700;
  box-shadow: 0 4px 14px rgba(255,123,169,.28), inset 0 1px 0 rgba(255,255,255,.45);
}
.icon-btn { min-height: var(--tap); min-width: var(--tap); padding: 0 10px; gap: 6px; font-size: 13px; }

/* 焦点环（键盘可见） */
:focus-visible {
  outline: 3px solid rgba(255,123,169,.65);
  outline-offset: 2px;
  border-radius: 8px;
}

.tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.tab { flex: 1; padding: 0; font-size: 13px; }
.pane { padding-bottom: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; width: 100%; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 14px 12px;
  text-align: center; color: var(--muted); cursor: pointer; transition: .15s;
  background: #FFFCFD; min-height: 104px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.drop:hover, .drop.over { border-color: var(--pink); color: var(--ink); background: rgba(255,123,169,.08); }
.drop-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: #FFEDF3; color: var(--pink-deep); font-weight: 700; font-size: 15px;
}
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* 工具条（桌面在左下、移动端吸底） */
#tools {
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  background: var(--card); padding: 10px 14px 12px;
  position: sticky; bottom: 0; z-index: 12;
}
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tools button { padding: 0; font-size: 12px; min-height: var(--tap); }
.current {
  margin-top: 8px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
#current-swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line); display: inline-block; }
#current-key { font-weight: 700; color: var(--ink); }

/* 侧栏统计 / 色板 */
.stats { font-size: 12px; color: var(--muted); line-height: 1.9; }
.stats b { color: var(--ink); }
.sub { font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.palette { display: flex; flex-direction: column; gap: 3px; }
.swatch {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px; min-height: 32px;
  border-radius: 8px; cursor: pointer; font-size: 11px; color: var(--muted);
  border: 1px solid transparent;
}
.swatch:hover { background: var(--panel2); }
.swatch.active { border-color: var(--pink); background: rgba(255,123,169,.14); color: var(--ink); }
.swatch i { width: 16px; height: 16px; border-radius: 5px; border: 1px solid rgba(74,63,85,.12); flex: none; }
.swatch span { flex: 1; }
.swatch em { font-style: normal; color: var(--ink); font-weight: 600; }

/* ---------------- 徽标 / 弹窗 ---------------- */
.badge {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.free { color: #B07B12; border-color: rgba(255,209,102,.75); background: #FFF6DE; }
.badge.day { color: #C93D6B; border-color: rgba(255,123,169,.65); background: #FFEDF3; }
.badge.forever { color: #6C4BC9; border-color: rgba(180,155,255,.65); background: #F1ECFF; }
.badge.expired { color: #C0324F; border-color: rgba(224,68,106,.4); background: #FFECF0; }
.modal {
  position: fixed; inset: 0; background: rgba(74,63,85,.38);
  display: flex; align-items: center; justify-content: center; z-index: 60;
  backdrop-filter: blur(3px); padding: 16px;
}
.modal-card {
  width: min(420px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 20px; box-shadow: var(--shadow-lg);
}
.modal-card h3 { margin: 0 0 6px; font-size: 17px; font-family: var(--font-title); letter-spacing: .5px; }
.modal-card input {
  width: 100%; margin: 10px 0; font: 700 16px/1.4 ui-monospace, monospace;
  letter-spacing: 2px; text-align: center; text-transform: uppercase;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.msg { font-size: 12px; min-height: 18px; color: #C0324F; }
.msg.ok { color: #12876A; }
.msg.err { color: #C0324F; }
.buy { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.8; }

/* ---------------- 页脚 ---------------- */
#site-footer {
  border-top: 1px solid var(--line); background: var(--card);
  padding: 10px 16px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
#site-footer a { color: var(--muted); text-decoration: none; }
#site-footer a:hover { color: var(--pink-deep); text-decoration: underline; }
#site-footer .foot-links a { margin-right: 12px; }
#site-footer .sep { margin-right: 12px; }
#site-footer .foot-credit { font-size: 11px; }

/* ---------------- 激活墙 ---------------- */
.wall {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px 48px;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,123,169,.22) 0%, transparent 55%),
    radial-gradient(circle at 85% 85%, rgba(180,155,255,.20) 0%, transparent 55%),
    radial-gradient(circle, rgba(255,123,169,.16) 1.6px, transparent 1.7px);
  background-size: auto, auto, 22px 22px;
}
.wall[hidden] { display: none !important; }
.wall-card {
  width: min(560px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 30px 26px 24px; box-shadow: var(--shadow-lg);
}
.wall-card h1 { margin: 0 0 8px; font-size: 24px; line-height: 1.35; font-family: var(--font-title); letter-spacing: .5px; }
.wall-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.wall-points { margin: 0 0 20px; padding-left: 18px; font-size: 13px; }
.wall-points li { margin: 7px 0; color: var(--muted); }
.wall-points b { color: var(--ink); }
.wall-plans { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.wall-plan {
  flex: 1 1 160px; display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; background: #FFF6F9;
}
.wall-plan b { font-size: 14px; }
.wall-plan span { color: var(--pink-deep); font-weight: 700; font-size: 17px; font-family: var(--font-title); }
.wall-form { display: flex; gap: 8px; }
.wall-form input {
  flex: 1; min-width: 0; font: 700 15px/1.4 ui-monospace, monospace;
  letter-spacing: 2px; text-align: center; text-transform: uppercase; min-height: var(--tap);
}
.wall-form button { flex: none; padding: 0 22px; }
.wall .hint { color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* ---------------- 抽屉 / 遮罩 / 移动底栏 ---------------- */
.scrim {
  position: fixed; inset: 0; background: rgba(74,63,85,.32);
  backdrop-filter: blur(2px); z-index: 40;
}
#panel-toggle, #side-toggle, #mobile-bar { display: none; }

/* ---------------- 断点：768–1099 参数抽屉 ---------------- */
@media (max-width: 1099px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
      "stage"
      "tools";
  }
  #panel-toggle { display: inline-flex; }
  #panel, #side {
    position: fixed; top: var(--header-h); bottom: 0; z-index: 50;
    width: min(340px, 86vw); overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transition: transform .22s ease;
  }
  #panel { left: 0; transform: translateX(-104%); border-right: 1px solid var(--line); }
  #side { right: 0; transform: translateX(104%); border-left: 1px solid var(--line); }
  body.panel-open #panel { transform: none; }
  body.side-open #side { transform: none; }
  body.side-open #side-toggle { display: inline-flex; }
  .panel-head, .side-head { display: flex; }
  #tools { border-right: 0; }
  #side-toggle { display: inline-flex; }
}

/* ---------------- 断点：<768 单列 + 吸底工具栏 ---------------- */
@media (max-width: 767px) {
  :root { --header-h: 54px; --bar-h: 64px; }
  body { padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); }
  header { padding: 6px 10px; gap: 6px; flex-wrap: wrap; row-gap: 6px; }
  .brand { font-size: 17px; flex: 1; }
  .brand span { display: none; }
  /* 手机顶栏分两行：第一行 参数/品牌/色板，第二行 套餐状态与品牌色号选择 */
  #panel-toggle { order: 1; }
  .brand { order: 2; }
  #side-toggle { order: 3; }
  .head-actions { order: 4; flex: 1 1 100%; gap: 6px; justify-content: space-between; }
  .head-actions select { flex: 1; min-width: 0; }
  #activate-btn { display: none; }        /* 移动端把「续费/换卡」放进参数抽屉 */
  #panel-renew { display: inline-flex; }
  #export { display: none; }                        /* 移动端改用底栏的「下载」 */
  #panel-toggle { display: inline-flex; }
  #panel, #side { width: 92vw; }
  #tools {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    border-top: 1px solid var(--line); border-right: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .tools { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .current { display: none; }
  #mobile-bar[hidden] { display: none !important; }
  #mobile-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    display: flex; gap: 8px; align-items: center;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
    backdrop-filter: blur(8px);
  }
  #mobile-bar button { flex: 1; min-height: var(--tap); }
  /* 底栏盖住工具条：把工具条抬高一层，避免两者重叠 */
  #tools { bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
  #site-footer { font-size: 11px; padding: 10px 12px 14px; }
  .wall { padding: 20px 12px 32px; }
  .wall-card { padding: 22px 18px 20px; border-radius: 18px; }
  .wall-card h1 { font-size: 20px; }
  .wall-plans { flex-direction: column; }
  .wall-plan { flex: 0 0 auto; flex-direction: row; align-items: center; justify-content: space-between; }
  .wall-form { flex-direction: column; }
  .wall-form button { width: 100%; }
  .swatch { min-height: var(--tap); }
  .palette { gap: 4px; }
}

/* 触摸设备：可点区域统一 ≥44px */
@media (pointer: coarse) {
  button, .swatch, .tab, input[type=range] { min-height: var(--tap); }
}

/* 动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  button:active { transform: none; }
}
/* ---------------- 新手 / 专业 双模式 ---------------- */
.seg {
  display: inline-flex; padding: 3px; gap: 3px;
  background: #FFF1F6; border: 1px solid var(--line); border-radius: 999px;
}
.seg-btn {
  min-height: var(--tap); padding: 0 14px; border: 0; border-radius: 999px;
  background: transparent; box-shadow: none; font-size: 13px; color: var(--muted);
}
.seg-btn:hover { background: rgba(255,255,255,.7); border: 0; }
.seg-btn.active {
  background: linear-gradient(180deg, #FF9BBD, var(--pink)); color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(255,123,169,.3), inset 0 1px 0 rgba(255,255,255,.5);
}

/* 3 步引导：首次出图成功后收起 */
.guide {
  margin: 0 0 10px; padding: 8px 12px 8px 26px; border-radius: 14px;
  background: #FFF7FA; border: 1px dashed rgba(255,123,169,.45);
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
.guide li { margin: 2px 0; display: block; }
.guide b { color: var(--ink); margin-right: 4px; }
.guide[hidden] { display: none !important; }

.chips-label { font-size: 12px; color: var(--muted); margin: 10px 0 6px; display: flex; gap: 6px; align-items: baseline; }
.hint-inline { color: var(--pink-deep); font-size: 11px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
/* 尺寸只有 4 档，排一行；风格 2×2 更省高度 */
#size-chips { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#size-chips .chip { font-size: 12px; padding: 4px 2px; }
#size-chips .chip small { display: none; }
.chip {
  min-height: var(--tap); padding: 6px 8px; border-radius: 12px; font-size: 13px;
  flex-direction: column; gap: 0; line-height: 1.25;
}
.chip small { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.chip.active { background: linear-gradient(180deg, #FF9BBD, var(--pink)); border-color: var(--pink-deep); color: #fff; }
.chip.active small { color: rgba(255,255,255,.85); }

.params { margin: 12px 0; border-radius: 12px; background: #FFFCFD; border: 1px solid var(--line); padding: 8px 10px; }
.params summary { cursor: pointer; font-size: 13px; color: var(--ink); min-height: 32px; display: flex; align-items: center; }
.params textarea {
  width: 100%; margin-top: 6px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--ink); background: #fff;
  resize: vertical;
}
.params-actions { display: flex; gap: 6px; margin-top: 8px; }
.params-actions button { flex: 1; font-size: 12px; padding: 0 8px; }
.presets { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.preset {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; background: #fff;
}
.preset b { flex: 1; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset button { min-height: 34px; padding: 0 8px; font-size: 12px; }

@media (max-width: 767px) {
  .seg-btn { min-height: var(--tap); padding: 0 10px; font-size: 12px; }
  .seg { padding: 2px; }
  .chips { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- 导出组 / 底稿弹窗 / 用量表 ---------------- */
.export-group { display: flex; gap: 6px; align-items: center; }
.export-group #export-more { padding: 0 10px; font-weight: 700; letter-spacing: 1px; }

.usage { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.usage-row {
  display: grid; grid-template-columns: 18px 1fr auto auto; gap: 6px;
  align-items: center; font-size: 11px; color: var(--muted);
  padding: 2px 4px; border-radius: 6px;
}
.usage-row:hover { background: var(--panel2); }
.usage-row i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(74,63,85,.14); }
.usage-row b { color: var(--ink); font-weight: 600; font-family: ui-monospace, monospace; }
.usage-row em { font-style: normal; color: var(--ink); font-weight: 700; }
.usage-row s { color: var(--muted); font-size: 10px; text-decoration: none; }
.usage-head { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; margin-bottom: 4px; }

.sheet-card { width: min(560px, 100%); }
.sheet-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 6px; }
.sheet-form label { margin: 0; }
.sheet-toggles { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 10px; }
.sheet-toggles .check { min-height: 34px; font-size: 12px; white-space: nowrap; flex: 0 0 auto; }
.sheet-summary {
  font-size: 12px; color: var(--muted); background: #FFF7FA; border: 1px dashed rgba(255,123,169,.45);
  border-radius: 12px; padding: 10px 12px; line-height: 1.8;
}
.sheet-summary b { color: var(--ink); }
.sheet-actions { flex-wrap: wrap; }
.sheet-actions button { flex: 1 1 auto; }
@media (max-width: 767px) {
  .sheet-form { grid-template-columns: 1fr; }
  .export-group { display: none; }   /* 移动端走底栏「下载图纸」→ 弹窗 */
}

/* ---------------- 图片体检 / 一键优化（S6） ---------------- */
.health {
  margin-top: 10px; padding: 10px 12px; border-radius: 14px;
  background: #FFFCFD; border: 1px solid var(--line);
}
.health[hidden] { display: none !important; }
.health-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.health-head b { font-family: var(--font-title); font-size: 14px; letter-spacing: .5px; }
.health-notes { margin: 0 0 8px; padding-left: 16px; font-size: 12px; line-height: 1.65; color: var(--muted); }
.health-notes li.ok { color: #12876A; }
.health-notes li.warn { color: #B4530A; }
.health-notes li.info { color: var(--muted); }
.health-actions { display: flex; flex-direction: column; gap: 6px; }
.health-row { display: flex; gap: 6px; }
.health-row button { flex: 1; font-size: 12px; padding: 0 8px; }
.prep-compare { margin-top: 8px; font-size: 11px; }
.prep-compare[hidden] { display: none !important; }
.prep-card { width: min(620px, 100%); }
.prep-compare-head {
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 4px;
}
.prep-slider {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #fff; border: 1px solid var(--line); margin: 6px 0 8px;
}
.prep-slider canvas { display: block; width: 100%; height: auto; border-radius: 0; box-shadow: none; }
.prep-slider input[type=range] {
  position: absolute; left: 0; right: 0; bottom: 2px; width: 100%; margin: 0;
  min-height: 26px; background: transparent;
}
.prep-slider input[type=range]::-webkit-slider-runnable-track { background: rgba(74,63,85,.25); height: 4px; }
#prep-steps { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* 教程入口（激活墙 / 空状态） */
.wall-guide { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.wall-guide a { color: var(--pink-deep); text-decoration: none; font-weight: 600; }
.wall-guide a:hover { text-decoration: underline; }
#empty .empty-guide { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--pink-deep); text-decoration: none; }
#empty .empty-guide:hover { text-decoration: underline; }
