/* bead-studio · app.css — 基础 + 通用组件 + 首页
 * 规范：DESIGN.md（§3 玻璃 / §5 空间 / §7 组件 / §8 动效） */

/* ---------- 基础 ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 350;
  line-height: var(--lh-body);
  color: var(--color-ink);
  background:
    radial-gradient(900px 620px at 82% -8%, color-mix(in oklab, var(--color-accent) 9%, transparent), transparent 62%),
    var(--color-paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--color-ink); text-decoration: none; }
img, canvas, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }

.tnum { font-variant-numeric: tabular-nums; }

::selection { background: color-mix(in oklab, var(--color-accent) 32%, transparent); }

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.icon {
  width: calc(20px * var(--ui-scale));
  height: calc(20px * var(--ui-scale));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.12s !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- 布局 ---------- */

.container {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.section { padding: var(--space-3xl) 0 0; }

/* ---------- 玻璃（只用于浮层） ---------- */

.glass-chrome,
.glass-panel,
.glass-float {
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-sheen);
  -webkit-backdrop-filter: blur(var(--glass-blur-chrome)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-chrome)) saturate(var(--glass-saturate));
}
.glass-chrome { background: var(--glass-chrome-bg); }
.glass-panel {
  background: var(--glass-panel-bg);
  box-shadow: var(--glass-sheen), var(--glow-panel); /* v2.41：面板辉光 */
  -webkit-backdrop-filter: blur(var(--glass-blur-panel)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-panel)) saturate(var(--glass-saturate));
}
.glass-float {
  background: var(--glass-float-bg);
  box-shadow: var(--glass-sheen), var(--glass-shadow), var(--glow-float); /* v2.41：浮层辉光 */
  -webkit-backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  height: calc(40px * var(--ui-scale));
  padding: 0 calc(20px * var(--ui-scale));
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--ui-md);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-accent-ink);
}
.btn--primary:hover { background: color-mix(in oklab, var(--color-accent) 86%, var(--color-ink)); }
.btn--primary:active { background: color-mix(in oklab, var(--color-accent) 76%, var(--color-ink)); }

.btn--ghost {
  border-color: color-mix(in oklab, var(--color-ink) 14%, transparent);
  color: var(--color-ink);
}
.btn--ghost:hover { background: color-mix(in oklab, var(--color-ink) 6%, transparent); }

.btn--text { color: var(--color-ink-2); padding: 0 10px; }
.btn--text:hover { color: var(--color-ink); }

.btn--sm { height: calc(32px * var(--ui-scale)); padding: 0 calc(14px * var(--ui-scale)); font-size: var(--ui-sm); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* 开关型按钮（如 锁定缩放 / 定位辅助线） */
.btn--ghost.is-active {
  background: var(--color-accent-soft);
  border-color: color-mix(in oklab, var(--color-accent) 45%, transparent);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: calc(36px * var(--ui-scale));
  height: calc(36px * var(--ui-scale));
  border-radius: var(--radius-btn);
  color: var(--color-ink-2);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: color-mix(in oklab, var(--color-ink) 6%, transparent); color: var(--color-ink); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: calc(28px * var(--ui-scale));
  padding: 0 calc(12px * var(--ui-scale));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  font-size: calc(12.5px * var(--ui-scale));
  color: var(--color-ink-2);
  white-space: nowrap;
}

.chip--todo { color: var(--color-muted); border-style: dashed; }

/* 视觉隐藏（只给读屏用：给可见文字补上下文时用，不改布局） */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- 开关（开关行：说明 + 拨动开关） ---------- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--ui-sm);
  color: var(--color-ink-2);
}

.switch { position: relative; width: calc(36px * var(--ui-scale)); height: calc(20px * var(--ui-scale)); flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.switch__track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--color-ink) 14%, transparent);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: calc(2px * var(--ui-scale));
  left: calc(2px * var(--ui-scale));
  width: calc(16px * var(--ui-scale));
  height: calc(16px * var(--ui-scale));
  border-radius: 50%;
  background: var(--color-ink);
  transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.switch input:checked + .switch__track { background: var(--color-accent); }
.switch input:checked + .switch__track::after { transform: translateX(calc(16px * var(--ui-scale))); background: var(--color-accent-ink); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ---------- 对话框（玻璃浮层，压暗 + 模糊背景） ---------- */

.dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  color: var(--color-ink);
  overflow: visible;
}
.dialog::backdrop {
  background: oklch(12% 0.02 70 / 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.dialog__card {
  width: min(440px, calc(100vw - 32px));
  border-radius: var(--radius-panel);
  padding: 20px;
  display: grid;
  gap: 16px;
}

.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog__title {
  font-family: var(--font-display);
  font-size: var(--ui-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.dialog__head .icon-btn { width: calc(32px * var(--ui-scale)); height: calc(32px * var(--ui-scale)); }

.dialog__body { display: grid; gap: 12px; }
.dialog__body[hidden] { display: none; }

.dialog__preview {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-card);
  background: color-mix(in oklab, var(--color-void) 40%, transparent);
}
.dialog__preview canvas { border-radius: 6px; }
.dialog__preview figcaption { font-family: var(--font-mono); font-size: calc(12px * var(--ui-scale)); color: var(--color-muted); text-align: center; }

.dialog__hint { font-size: var(--ui-xs); color: var(--color-muted); line-height: 1.7; }

.dialog__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dialog__note { font-size: calc(12px * var(--ui-scale)); color: var(--color-muted); }
.dialog__actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- 导航（N5 浮动玻璃胶囊） ---------- */

.nav {
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  z-index: 50;
  /* v2.40.1：容器只负责「全宽 + 居中 + 左右留 16px」——
     此前是 left: 50% + translateX(-50%)，而 fixed 元素的收缩宽度上限＝视口 − left，
     于是胶囊可用宽只有半屏：内容超了就把链接挤成竖排文字（1001px 窗口实测胶囊 513 宽 / 链接 40×96px / 导航 114px 高）。
     容器不吃点击（可点区域＝胶囊本身），避免透明条挡页面。 */
  display: flex;
  justify-content: center;
  padding: 0 16px;
  pointer-events: none;
}

.nav__pill {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  max-width: 100%;
  padding: 8px 10px 8px 14px;
  border-radius: var(--radius-pill);
  pointer-events: auto;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: var(--space-xs);
}

.nav__wordmark {
  font-family: var(--font-display);
  font-size: calc(15px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav__links { display: flex; gap: 2px; }

.nav__link {
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: var(--ui-md);
  /* v2.40.1：链接绝不收缩折行——放不下时由胶囊换行，而不是把「怎么拼」折成竖排 */
  flex: none;
  white-space: nowrap;
  color: var(--color-ink-2);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav__link:hover { color: var(--color-ink); background: color-mix(in oklab, var(--color-ink) 5%, transparent); }
.nav__link.is-active { color: var(--color-ink); }

.nav__actions { display: flex; align-items: center; gap: var(--space-3xs); margin-left: var(--space-2xs); }

/* 主题切换图标显隐 */
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* v2.55 主题跟随时间：自动档在按钮右下角点一颗琥珀小点（手选浅 / 深后消失），一眼看出「不是我定的」 */
[data-theme-toggle] { position: relative; }
[data-theme-mode="auto"] [data-theme-toggle]::after {
  content: "";
  position: absolute;
  right: calc(7px * var(--ui-scale));
  bottom: calc(7px * var(--ui-scale));
  width: calc(4px * var(--ui-scale));
  height: calc(4px * var(--ui-scale));
  border-radius: 50%;
  background: var(--color-accent);
}

/* v2.40.1：≤1023px 胶囊可换行（内容真放不下时整组落到第二行，绝不挤窄链接 / 不出屏）；
   ≤720px 再把链接整排收隐（v1 规则），窄屏只留 logo + 操作组 */
@media (max-width: 1023px) {
  .nav__pill {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
    border-radius: var(--radius-panel);
  }
  .nav__logo { margin-right: 0; }
  .nav__actions { margin-left: 0; }
}
@media (max-width: 720px) {
  .nav__links { display: none; }
}

/* ---------- 首页 · Hero（工具即首屏） ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-2xl);
  align-items: center;
  padding-top: 150px;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: 600;
  line-height: var(--lh-display);
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin-bottom: var(--space-md);
}

.hero__sub {
  font-size: calc(17px * var(--ui-scale));
  line-height: 1.75;
  color: var(--color-ink-2);
  max-width: 34ch;
  margin-bottom: var(--space-lg);
}

.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-lg); }

/* v2.56 首页豆号入口：一行「有豆号？ [6 位数字] 打开」，提示在下一行 */
.bean-open {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: calc(var(--space-sm) * -0.25) 0 var(--space-md);
}
.bean-open__label { font-size: var(--ui-sm); color: var(--color-muted); }
.bean-open .bean-open__input {
  flex: 0 0 auto;
  width: calc(132px * var(--ui-scale));
  text-align: center;
  letter-spacing: 0.16em;
  font-family: var(--font-mono);
}
.bean-open__hint {
  flex-basis: 100%;
  margin: 0;
  font-size: var(--ui-xs);
  color: var(--color-muted);
}
.bean-open.is-invalid .bean-open__input { border-color: var(--color-danger); }
.bean-open.is-invalid .bean-open__hint { color: var(--color-danger); }

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: calc(12.5px * var(--ui-scale));
  color: var(--color-muted);
}
.hero__facts .sep { color: var(--color-rule); }

/* 上传卡（玻璃浮层） */
.upload-card {
  border-radius: var(--radius-panel);
  padding: var(--space-md);
}

.dropzone {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 24px;
  border: 1px dashed color-mix(in oklab, var(--color-ink) 20%, transparent);
  border-radius: var(--radius-card);
  text-align: center;
  transition: border-color var(--dur-base) var(--ease-out);
}
.dropzone:hover { border-color: color-mix(in oklab, var(--color-accent) 55%, transparent); }
.dropzone .icon { width: calc(28px * var(--ui-scale)); height: calc(28px * var(--ui-scale)); color: var(--color-ink-2); }
.dropzone__title { font-size: calc(15px * var(--ui-scale)); font-weight: 500; }
.dropzone__meta { font-size: calc(12.5px * var(--ui-scale)); color: var(--color-muted); }

/* 投放卡：拖入态 / 动作行 / 行内原因（v2.28） */
.dropzone.is-over {
  border-color: var(--color-accent);
  border-style: solid;
  background: color-mix(in oklab, var(--color-accent) 8%, transparent);
}
.dropzone[data-busy] { cursor: progress; }
.dropzone[data-busy] .dropzone__actions { opacity: 0.6; pointer-events: none; }
.dropzone__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  align-items: center;
  justify-content: center;
}
.dropzone__note { font-size: var(--ui-xs); color: var(--color-warn); line-height: 1.7; max-width: 34ch; }

.upload-card__foot {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-sm);
}

/* ---------- 首页 · 步骤（真实序号的编号流） ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.step { border-top: 1px solid var(--color-rule); padding-top: 20px; }
.step__num {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--ui-sm);
  color: var(--color-accent);
  margin-bottom: 10px;
}
.step__title { font-size: var(--ui-lg); font-weight: 600; margin-bottom: 6px; }
.step__text { font-size: var(--ui-md); color: var(--color-ink-2); line-height: 1.7; }

/* ---------- 首页 · 功能深潜（非对称） ---------- */

.feature {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: var(--space-2xl);
  align-items: center;
  margin-top: var(--space-xl);
}
.feature--flip { grid-template-columns: 1.08fr 0.92fr; }
.feature--flip .feature__media { order: -1; }

.feature__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-xs);
}

.feature__text { font-size: calc(15px * var(--ui-scale)); color: var(--color-ink-2); line-height: 1.75; max-width: 40ch; }

.feature__list { display: grid; gap: 10px; margin-top: var(--space-sm); }
.feature__list li {
  position: relative;
  padding-left: 20px;
  font-size: var(--ui-md);
  color: var(--color-ink-2);
}
.feature__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--color-accent-soft);
  border: 1px solid color-mix(in oklab, var(--color-accent) 45%, transparent);
}

.demo-figure {
  border-radius: var(--radius-panel);
  padding: var(--space-sm);
}
.demo-figure canvas {
  width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  background: var(--color-paper);
}
.demo-figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  font-family: var(--font-mono);
  font-size: calc(12px * var(--ui-scale));
  color: var(--color-muted);
}

/* 焦点模式预览卡（真实组件） */
.focus-widget {
  display: grid;
  gap: var(--space-sm);
  border-radius: var(--radius-panel);
  padding: var(--space-md);
}
.focus-widget__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); }
.focus-widget__label { font-family: var(--font-mono); font-size: calc(12px * var(--ui-scale)); color: var(--color-muted); }
.focus-widget__timer { font-family: var(--font-mono); font-size: calc(20px * var(--ui-scale)); }
.progress {
  height: 8px;
  border-radius: var(--radius-pill);
  background: color-mix(in oklab, var(--color-ink) 10%, transparent);
  overflow: hidden;
}
.progress__fill { height: 100%; width: 58%; background: var(--color-accent); border-radius: var(--radius-pill); }
.focus-widget__meta { display: flex; justify-content: space-between; font-size: var(--ui-sm); color: var(--color-ink-2); }
.focus-widget__actions { display: flex; flex-wrap: wrap; gap: var(--space-2xs); align-items: center; }

/* ---------- 首页 · 色卡 ---------- */

.brand-chips { display: flex; flex-wrap: wrap; gap: var(--space-2xs); margin: var(--space-md) 0 var(--space-sm); }

.swatch-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklab, var(--color-ink) 14%, transparent);
}
.palette-note { margin-top: var(--space-sm); font-size: var(--ui-sm); color: var(--color-muted); }

/* ---------- 首页 · FAQ ---------- */

.faq { margin-top: var(--space-lg); }
.faq__item { border-top: 1px solid var(--color-rule-2); padding: 18px 0; }
.faq__item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: calc(15px * var(--ui-scale));
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--color-muted);
  font-size: var(--ui-lg);
  line-height: 1;
}
.faq__item[open] summary::after { content: "−"; }
.faq__item p {
  margin-top: var(--space-xs);
  font-size: var(--ui-md);
  color: var(--color-ink-2);
  line-height: 1.75;
  max-width: var(--measure);
}

/* ---------- 首页 · 收尾 CTA ---------- */

.cta-band {
  display: grid;
  justify-items: center;
  gap: var(--space-sm);
  text-align: center;
  border-radius: var(--radius-panel);
  padding: var(--space-xl) var(--space-md);
  margin-top: var(--space-3xl);
}
.cta-band h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.cta-band p { color: var(--color-ink-2); font-size: calc(15px * var(--ui-scale)); }

/* ---------- 页脚（Ft5 一句话陈述） ---------- */

.footer { margin-top: var(--space-2xl); border-top: 1px solid var(--color-rule-2); padding: var(--space-xl) 0 40px; }
.footer__statement {
  font-family: var(--font-display);
  font-size: calc(20px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md);
}
.footer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  font-size: calc(12.5px * var(--ui-scale));
  color: var(--color-muted);
}
.footer__meta a { color: var(--color-ink-2); }
.footer__meta a:hover { color: var(--color-ink); }

/* ---------- 响应式（首页） ---------- */

@media (max-width: 1023px) {
  /* v2.40.2：只保留导航净空顶距（≤1023 胶囊可能换两行）。堆叠排布下移到 ≤900px——
     此前 1023 就堆叠，901–1023（常见笔记本窗口）首屏文字左贴、右侧一大片空白 */
  .hero { padding-top: 170px; }
}

/* ≤900：真正放不下两列时才堆叠（首屏文案在上、投放卡在下）。
   文字一律左对齐：v2.40.3 试过单列居中，用户判定「居中 ng」，v2.40.4 已回退。
   v2.40.5：左右留白加宽（用户「左对齐可以，但别贴着屏幕边」）——24px → 30–48px。 */
@media (max-width: 900px) {
  .container { padding-inline: clamp(30px, 8.5vw, var(--space-xl)); }
  /* v2.41 首屏主视角：顶距与节距收一档，让投放卡的主按钮落进首屏 */
  .hero { grid-template-columns: 1fr; gap: var(--space-lg); padding-top: 140px; }
  .hero__sub { margin-bottom: var(--space-md); }
  .hero__cta { margin-bottom: var(--space-md); }
  .feature, .feature--flip { grid-template-columns: 1fr; gap: var(--space-lg); }
  .feature--flip .feature__media { order: 0; }
  .steps { grid-template-columns: 1fr; gap: var(--space-md); }
}

/* ≤640：手机首屏再收一档（标题 / 投放卡压缩），主按钮「选择图片」必须落在首屏内。
   注意：首屏文字（标题 / 副标题 / 事实行 / 卡片内边距）**不随「界面大小」放大**——
   首屏要装得下主按钮；其余界面照常随档（见 DESIGN §5 界面大小纪律的例外说明）。 */
@media (max-width: 640px) {
  .hero { padding-top: 128px; } /* 手机宽度胶囊最多两行（下沿 ~117） */
  .hero__title { font-size: 30px; line-height: 1.3; }
  .hero__sub { font-size: 15px; line-height: 1.65; margin-bottom: var(--space-sm); }
  .hero__cta { margin-bottom: var(--space-sm); }
  .hero__facts { font-size: 12px; }
  .upload-card { padding: var(--space-sm); }
  .dropzone { padding: 24px 18px; }
  .dropzone .icon { width: 22px; height: 22px; }
}

/* ≤360：更小的手机（320–360）首屏再让一手——事实行让位给主按钮 */
@media (max-width: 360px) {
  .hero { padding-top: 118px; }
  .hero__facts { display: none; }
}

/* ---------- 工作台共享组件（编辑器 / 生成流程共用，v2.4 起） ---------- */

/* 角落返回胶囊 */
.back-pill {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: calc(36px * var(--ui-scale));
  padding: 0 calc(14px * var(--ui-scale));
  border-radius: var(--radius-pill);
  font-size: var(--ui-sm);
  color: var(--color-ink-2);
}
.back-pill:hover { color: var(--color-ink); }
.back-pill .icon { width: calc(16px * var(--ui-scale)); height: calc(16px * var(--ui-scale)); }

/* 触屏「单指干活」的工具（矩形选区）：画布上禁止原生滚动，单指才不会被滚动抢走（v2.39）。
   其余工具保持 scroller 的 pan-x pan-y —— 单指拖动仍是平移。 */
body.editor--touch-drag .board-area { touch-action: none; }

/* 画布滚动容器：标尺 + 画布作为一个整体滚动/缩放（滚轮、双指、拖拽平移） */
.stage__scroller {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: auto;
  padding: 88px 48px 108px;
  touch-action: pan-x pan-y;
  scrollbar-width: thin;
  cursor: grab;
}
.stage__scroller.is-panning { cursor: grabbing; }

/* 标尺 + 画布区 */
.board-area {
  margin: auto;
  flex: none;
  display: grid;
  grid-template-columns: var(--editor-ruler) auto;
  grid-template-rows: var(--editor-ruler) auto;
  grid-template-areas:
    "corner rtop"
    "rleft  board";
  gap: 6px;
}

/* 关闭「显示标尺」：标尺与角格让位，画布独自铺开 */
.board-area.rulers-off {
  grid-template-columns: auto;
  grid-template-rows: auto;
  grid-template-areas: "board";
}
.board-area.rulers-off .ruler { display: none; }

.ruler { border-radius: 6px; background: var(--color-paper-2); }
/* v2.49：标尺＝**图案的边框**，随图案一起缩放 / 滚动，不再 sticky。
   v2.44 的 sticky 把尺子钉在滚动容器上沿：放大后图案上边框滚出屏外，尺子却停在原来那一行、
   浮在图中间（用户：「标尺应该固定在图案边框上，现在放大标尺还是在原地」）。
   「刻度显示不全」仍由 v2.44 的两项解决：尺子铺满整幅图纸宽 + 窄屏最小格径 5。 */
.ruler--corner { grid-area: corner; }
.ruler--top { grid-area: rtop; }
.ruler--left { grid-area: rleft; }
.ruler canvas { display: block; border-radius: 6px; }

.board-wrap {
  grid-area: board;
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-sheen), 0 24px 64px -40px oklch(8% 0.02 70 / 0.8);
  background: var(--color-paper);
}
.board-wrap canvas { display: block; }
/* 悬停预览层：跟随画布尺寸（JS 同步），只画描边 / 当前色预览，不挡指针 */
#board-hover { position: absolute; inset: 0; pointer-events: none; }

/* 底部色量条 */
.strip {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: min(940px, calc(100% - 88px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.cap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
}
/* 可点击色票（编辑器：选当前色） */
button.cap { background: none; color: inherit; font: inherit; cursor: pointer; }
button.cap:hover { background: color-mix(in oklab, var(--color-ink) 6%, transparent); }
button.cap.is-current {
  background: var(--color-accent-soft);
  box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--color-accent) 55%, transparent);
}
.cap__dot { width: calc(12px * var(--ui-scale)); height: calc(12px * var(--ui-scale)); border-radius: 50%; border: 1px solid color-mix(in oklab, var(--color-ink) 25%, transparent); }
.cap__code { font-family: var(--font-mono); font-size: var(--ui-xs); color: var(--color-ink-2); }
.cap__count { font-family: var(--font-mono); font-size: var(--ui-xs); }

.strip__spacer { flex: 1; }

/* 当前色读数（编辑器：点色票即当前笔色） */
.strip__current {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--color-rule);
}
.strip__current-label { font-size: var(--ui-xs); color: var(--color-muted); }
.strip__current-dot {
  width: calc(14px * var(--ui-scale));
  height: calc(14px * var(--ui-scale));
  border-radius: 50%;
  background: var(--color-muted);
  border: 1px solid color-mix(in oklab, var(--color-ink) 25%, transparent);
}
.strip__current-code { font-family: var(--font-mono); font-size: var(--ui-sm); }

.strip__total {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: none;
  padding-left: 12px;
  border-left: 1px solid var(--color-rule);
}
.strip__total-label { font-size: var(--ui-xs); color: var(--color-muted); }
.strip__total-num { font-family: var(--font-mono); font-size: var(--ui-md); font-weight: 600; }
.strip__extra { font-family: var(--font-mono); font-size: var(--ui-xs); color: var(--color-muted); flex: none; }

/* 右侧设置面板 */
.panel {
  height: 100dvh;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 28px;
  padding: var(--space-md) 20px calc(var(--space-xl) + 26px); /* 底部多留一点，让开右下角「设计样张」角标 */
  border-left: 1px solid var(--glass-border);
  scrollbar-width: thin;
}

.panel__section { display: grid; gap: 12px; align-content: start; }

/* v2.45：面板分节**不做折叠**（v2.42 的折叠已整体回退——用户真机判定「这些地方没有做抽屉的必要」：
   设置本来就该一眼看全，折叠只是多一次点击）。此处曾有的 .panel__toggle / .panel__body / 箭头样式已删除。 */

/* v2.42：窄屏触控尺寸达标（设计 §7：高度 40、触控 44）——段控件 / 按钮 / 输入框在触屏上不缩水 */
@media (max-width: 1023px) {
  .seg { min-height: 44px; padding-inline: 14px; }
  .btn, .btn--sm, .icon-btn, .strip__detail { min-height: 44px; }
  .input { min-height: 44px; height: auto; }
  .switch-row { min-height: 44px; }
  /* 色卡行 / 明细行也是主要点按对象 */
  .swatch-row { min-height: 44px; }

  /* 生成页主按钮常驻：末尾动作分节吸底（吸底元素必须在「高容器」里才有效——
     分节自己的高度 ≈ 一根动作条，若把 sticky 放在里面的 .gen-nav 上，容器高＝条高＝无处可吸） */
  .panel-step[data-step="3"] > .panel__section:last-child {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding-top: 10px;
    border-top: 1px solid var(--color-rule);
    background: color-mix(in oklab, var(--color-paper-2) 96%, transparent);
  }
  .gen-nav { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
}

.panel__title {
  font-size: var(--ui-md);
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-rule-2);
}

.panel__hint { font-size: var(--ui-xs); color: var(--color-muted); line-height: 1.7; }

/* 豆号（v2.47）：两个按钮 + 可展开的 6 位输入 + 结果行（码用 mono、等宽数字） */
.bean { display: grid; gap: 8px; }
.bean__row { display: flex; flex-wrap: wrap; gap: 8px; }
.bean__open { display: flex; gap: 8px; }
.bean__open .input { flex: 1; min-width: 0; letter-spacing: 0.18em; }
.bean__result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--color-line);
  border-radius: 12px;
  background: var(--color-paper-2);
}
.bean__label { font-size: var(--ui-xs); color: var(--color-muted); }
.bean__code {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.16em;
  font-size: calc(15px * var(--ui-scale));
  color: var(--color-accent);
}
.bean__works { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.bean__work {
  min-height: 28px;
  padding: 2px 8px;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.bean__work:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* 快捷键小字（工具弹层 / 面板提示共用） */
.kbd {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--color-rule);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: calc(10px * var(--ui-scale));
  line-height: 1.6;
  color: var(--color-muted);
}

/* 字段 / 输入 */
.field { display: grid; gap: 6px; }
.field__label { font-size: calc(12.5px * var(--ui-scale)); color: var(--color-ink-2); }

.input {
  width: 100%;
  height: calc(38px * var(--ui-scale));
  padding: 0 calc(12px * var(--ui-scale));
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-input);
  font-size: var(--ui-md);
  color: var(--color-ink);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.input::placeholder { color: var(--color-muted); }
.input:focus { outline: none; border-color: var(--color-accent); }

/* 滑杆（容差等连续值 · v2.27）：轨道已填段＝琥珀（--range-fill 由 JS 给百分比），滑钮墨色圆 */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: calc(20px * var(--ui-scale));
  background: none;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(
    to right,
    var(--color-accent) 0 var(--range-fill, 25%),
    color-mix(in oklab, var(--color-ink) 14%, transparent) var(--range-fill, 25%) 100%
  );
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: calc(16px * var(--ui-scale));
  height: calc(16px * var(--ui-scale));
  margin-top: calc((4px - 16px * var(--ui-scale)) / 2);
  border-radius: 50%;
  background: var(--color-ink);
}
.range:hover::-webkit-slider-thumb,
.range:active::-webkit-slider-thumb { background: color-mix(in oklab, var(--color-ink) 72%, var(--color-accent)); }
.range:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-pill); }
.range:disabled { opacity: 0.55; cursor: not-allowed; }
.range::-moz-range-track { height: 4px; border-radius: var(--radius-pill); background: color-mix(in oklab, var(--color-ink) 14%, transparent); }
.range::-moz-range-progress { height: 4px; border-radius: var(--radius-pill); background: var(--color-accent); }
.range::-moz-range-thumb { width: calc(16px * var(--ui-scale)); height: calc(16px * var(--ui-scale)); border: none; border-radius: 50%; background: var(--color-ink); }
.range:hover::-moz-range-thumb,
.range:active::-moz-range-thumb { background: color-mix(in oklab, var(--color-ink) 72%, var(--color-accent)); }

/* 分段控件（数量多时换行——面板重排纪律：不得撑破固定宽面板） */
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: calc(3px * var(--ui-scale));
  padding: calc(3px * var(--ui-scale));
  background: color-mix(in oklab, var(--color-ink) 6%, transparent);
  border-radius: var(--radius-btn);
}
.seg {
  flex: 1 1 auto;
  min-width: calc(56px * var(--ui-scale));
  height: calc(30px * var(--ui-scale));
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: var(--ui-sm);
  color: var(--color-ink-2);
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.seg:hover { color: var(--color-ink); }
.seg.is-active { background: var(--color-accent-soft); color: var(--color-ink); font-weight: 500; }

/* ---------- 色卡抽屉（底部浮出 · v2.31） ---------- */

.palette-drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  visibility: hidden;
}
.palette-drawer.is-open { visibility: visible; }
.palette-drawer__scrim {
  position: absolute;
  inset: 0;
  background: var(--color-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.palette-drawer.is-open .palette-drawer__scrim { opacity: 1; pointer-events: auto; }

.palette-drawer__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  max-height: min(72vh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  transform: translateY(100%);
  transition: transform var(--dur-base) var(--ease-out);
}
.palette-drawer.is-open .palette-drawer__sheet { transform: translateY(0); }

.palette-drawer__head { display: flex; align-items: center; gap: var(--space-xs); }
.palette-drawer__current { display: inline-flex; align-items: center; gap: 8px; }
.palette-drawer__current .swatch-row__dot { width: calc(22px * var(--ui-scale)); height: calc(22px * var(--ui-scale)); }
.palette-drawer__code { font-family: var(--font-mono); font-size: calc(13px * var(--ui-scale)); color: var(--color-ink); }
.palette-drawer__title {
  flex: 1;
  min-width: 0;
  font-size: var(--ui-sm);
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-drawer__filters { display: grid; gap: var(--space-2xs); }
.palette-drawer__filters .input { height: calc(34px * var(--ui-scale)); }
.palette-drawer__empty { font-size: var(--ui-xs); color: var(--color-muted); }

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(52px * var(--ui-scale)), 1fr));
  gap: var(--space-2xs);
  align-content: start;
}
.palette-cell { display: grid; justify-items: center; gap: 4px; padding: 4px; border-radius: var(--radius-btn); }
.palette-cell__chip {
  width: 100%;
  height: calc(28px * var(--ui-scale));
  border-radius: 8px;
  border: 1px solid var(--color-rule);
  background: var(--palette-cell, transparent);
}
.palette-cell__code { font-family: var(--font-mono); font-size: calc(10.5px * var(--ui-scale)); color: var(--color-muted); line-height: 1.2; }
.palette-cell:hover .palette-cell__chip { border-color: var(--color-accent); }
.palette-cell.is-used .palette-cell__chip { box-shadow: 0 0 0 2px color-mix(in oklab, var(--color-ink) 45%, transparent); }
.palette-cell.is-current .palette-cell__chip { box-shadow: 0 0 0 2px var(--color-accent); }
.palette-cell.is-current .palette-cell__code { color: var(--color-ink); font-weight: 600; }

/* 窄屏：色格收一档（一屏更多列，少滚一点） */@media (max-width: 640px) {
  .palette-grid { grid-template-columns: repeat(auto-fill, minmax(calc(40px * var(--ui-scale)), 1fr)); }
  .palette-cell { padding: 2px; }
  .palette-cell__chip { height: calc(24px * var(--ui-scale)); }
  .palette-cell__code { font-size: calc(9.5px * var(--ui-scale)); }
}

/* 品牌换算条（色卡抽屉底部 · v2.33） */
.palette-convert {
  display: grid;
  gap: 6px;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-btn);
  background: var(--color-accent-soft);
}
.palette-convert__row { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; }
.palette-convert__text { flex: 1; min-width: 0; font-size: var(--ui-sm); color: var(--color-ink-2); }
.palette-convert__text b { color: var(--color-ink); font-weight: 600; }

/* 色卡清单行 */
.swatch-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
/* 可点击色卡行（编辑器：选当前色） */
button.swatch-row {
  width: 100%;
  text-align: left;
  padding: 5px 8px;
  margin-inline: -8px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
button.swatch-row:hover { background: color-mix(in oklab, var(--color-ink) 5%, transparent); }
button.swatch-row.is-current {
  background: var(--color-accent-soft);
  box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--color-accent) 55%, transparent);
}
.swatch-row__dot { width: calc(22px * var(--ui-scale)); height: calc(22px * var(--ui-scale)); border-radius: 7px; border: 1px solid color-mix(in oklab, var(--color-ink) 15%, transparent); flex: none; }
.swatch-row__code { font-family: var(--font-mono); font-size: var(--ui-xs); width: 42px; }
.swatch-row__name { font-size: var(--ui-sm); color: var(--color-ink-2); flex: 1; }
.swatch-row__count { font-family: var(--font-mono); font-size: var(--ui-xs); color: var(--color-ink-2); }

/* ---------- 界面大小（v2.22 · 全站 UI 缩放入口） ---------- */

/* 「Aa」按钮内的字样（按钮盒本身用 .icon-btn / .btn--sm） */
.ui-aa {
  font-family: var(--font-display);
  font-size: calc(13px * var(--ui-scale));
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* 三档选择浮层（玻璃单选菜单；位置由 ui-scale.js 锚定按钮下方、右对齐并避让视口） */
.ui-menu {
  position: fixed;
  z-index: 70;
  min-width: calc(150px * var(--ui-scale));
  padding: 6px;
  border-radius: var(--radius-panel);
  display: grid;
  gap: 2px;
}
.ui-menu[hidden] { display: none; }
.ui-menu__title {
  font-size: var(--ui-xs);
  color: var(--color-muted);
  padding: 6px 10px 4px;
}
.ui-menu__item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: calc(32px * var(--ui-scale));
  padding: 0 10px;
  border-radius: var(--radius-btn);
  font-size: var(--ui-sm);
  color: var(--color-ink-2);
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.ui-menu__item:hover { background: color-mix(in oklab, var(--color-ink) 6%, transparent); color: var(--color-ink); }
.ui-menu__item[aria-checked="true"] { background: var(--color-accent-soft); color: var(--color-ink); }
.ui-menu__tick {
  width: calc(15px * var(--ui-scale));
  height: calc(15px * var(--ui-scale));
  color: var(--color-accent);
  visibility: hidden;
}
.ui-menu__item[aria-checked="true"] .ui-menu__tick { visibility: visible; }
.ui-menu__hint {
  font-size: var(--ui-xs);
  color: var(--color-muted);
  line-height: 1.6;
  max-width: calc(190px * var(--ui-scale));
  padding: 4px 10px 6px;
}

/* ============================================================
   v2.40 · 移动端组件形态（用户指令：不许横滑 / 错位 → 抽屉·下拉·标签页；
   瞬时反馈走 Toast）＋ 平滑滚动
   ============================================================ */

/* ---------- 平滑滚动 ---------- */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Toast：底部居中玻璃浮卡，浮在最上层、不占布局 ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: var(--glass-float-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  box-shadow: var(--glass-shadow), var(--glass-sheen), var(--glow-float);
  color: var(--color-ink);
  font-size: var(--ui-sm);
  line-height: 1.45;
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
  animation: toast-in var(--dur-base) var(--ease-out) both;
}
.toast__dot {
  flex: none;
  width: calc(8px * var(--ui-scale));
  height: calc(8px * var(--ui-scale));
  border-radius: 50%;
  background: var(--color-accent);
}
.toast--warn .toast__dot { background: var(--color-danger); }
.toast--done .toast__dot { box-shadow: 0 0 0 calc(3px * var(--ui-scale)) color-mix(in oklab, var(--color-accent) 30%, transparent); }
.toast.is-out { animation: toast-out var(--dur-fast) var(--ease-out) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast.is-out { animation: none; opacity: 0; }
}

/* ---------- 色量明细抽屉（窄屏底条「明细」的落点 · 与色卡抽屉同款形态） ---------- */
.counts-sheet { position: fixed; inset: 0; z-index: 80; }
.counts-sheet[hidden] { display: none; }
.counts-sheet__scrim {
  position: absolute;
  inset: 0;
  background: var(--color-scrim);
  animation: counts-fade var(--dur-base) var(--ease-out) both;
}
.counts-sheet__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 560px);
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  background: var(--glass-float-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  box-shadow: var(--glass-shadow), var(--glass-sheen), var(--glow-float);
  animation: counts-up var(--dur-base) var(--ease-out) both;
}
.counts-sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 18px;
  border-bottom: 1px solid var(--color-rule);
}
.counts-sheet__title { font-size: var(--ui-md); font-weight: 600; }
.counts-sheet__body { overflow-y: auto; padding: 6px 12px calc(14px + env(safe-area-inset-bottom, 0px)); }
.counts-sheet__empty { padding: 20px 6px; color: var(--color-muted); font-size: var(--ui-sm); }
.counts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px; /* 触控行高底线 */
  padding: 6px 8px;
  border-radius: 12px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
button.counts-row { cursor: pointer; }
button.counts-row:hover { background: color-mix(in oklab, var(--color-ink) 6%, transparent); }
.counts-row__dot {
  flex: none;
  width: calc(18px * var(--ui-scale));
  height: calc(18px * var(--ui-scale));
  border-radius: 5px;
  border: 1px solid color-mix(in oklab, var(--color-ink) 22%, transparent);
}
.counts-row__code { font-family: var(--font-mono); font-size: var(--ui-sm); }
.counts-row__count { margin-left: auto; font-family: var(--font-mono); font-size: var(--ui-sm); color: var(--color-ink-2); }
@keyframes counts-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes counts-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .counts-sheet__sheet, .counts-sheet__scrim { animation: none; }
}

/* ---------- 窄屏：底部色量条不再横滑——色票排进「明细」抽屉，底条只留一行读数 ---------- */
.strip__detail {
  display: none;
  flex: none;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--color-ink-2);
  font-size: var(--ui-sm);
}
.strip__detail:hover { background: color-mix(in oklab, var(--color-ink) 6%, transparent); }
@media (max-width: 1023px) {
  .strip { overflow: visible; gap: 6px; }
  .strip .cap { display: none; }
  .strip__detail { display: inline-flex; }
  /* 紧凑读数：标签与板型 / 色数读数省略（面板里有全量），数值与「明细」始终留在胶囊内；
     选区读数保留、放不下时省略号收缩（绝不溢出胶囊） */
  .strip__current-label,
  .strip__total-label,
  .strip__extra-meta { display: none; }
  .strip__extra { flex: 0 1 auto; min-width: 0; display: inline-flex; overflow: hidden; }
  /* 选区读数窄屏改走 Toast（见 editor.js setSelection）——底条不留半截文字 */
  .strip__extra-sel { display: none; }
}

/* ============================================================
   v2.41 · 骨架屏 + 加载指示（用户指令：加载指示、骨架屏、面板毛玻璃 + glow）
   ============================================================ */

/* ---------- 骨架屏：内容未就绪时的同尺寸占位（不跳动、不撒谎） ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: color-mix(in oklab, var(--color-ink) 6%, transparent);
  border-radius: var(--radius-card);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in oklab, var(--color-ink) 9%, transparent), transparent);
  transform: translateX(-100%);
  animation: skeleton-sweep 1.5s var(--ease-out) infinite;
}
@keyframes skeleton-sweep { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; opacity: 0.45; }
}
.skeleton--line { height: calc(14px * var(--ui-scale)); border-radius: 7px; }
.skeleton--title { height: calc(22px * var(--ui-scale)); border-radius: 9px; }
.skeleton--block { height: calc(112px * var(--ui-scale)); border-radius: var(--radius-panel); }
.skeleton--row { height: 44px; border-radius: 12px; }

/* ---------- 加载指示：玻璃浮卡 + 旋转指示器（延迟 120ms 才出现，见 js/busy.js） ---------- */
.busy {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--color-void) 42%, transparent);
  animation: busy-fade 280ms var(--ease-out) both; /* 短活一闪而过：280ms 淡入还没到全显就撤了 */
}
@keyframes busy-fade { from { opacity: 0; } to { opacity: 1; } }
.busy[hidden] { display: none; }
.busy__card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-panel);
  background: var(--glass-float-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur-float)) saturate(var(--glass-saturate));
  box-shadow: var(--glass-sheen), var(--glass-shadow), var(--glow-float);
  color: var(--color-ink);
  font-size: var(--ui-sm);
}
.busy__spinner {
  flex: none;
  width: calc(18px * var(--ui-scale));
  height: calc(18px * var(--ui-scale));
  border: 2px solid color-mix(in oklab, var(--color-accent) 28%, transparent);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: busy-spin 0.9s linear infinite;
}
@keyframes busy-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .busy__spinner { animation-duration: 2.4s; }
}

/* ---------- v2.58 404：找不到的地址也给一块像样的画板 ---------- */

.nf {
  display: grid;
  place-items: center;
  min-height: 68vh;
  padding-top: calc(120px + 24px * var(--ui-scale));
  padding-bottom: 72px;
}
.nf__card {
  width: min(560px, 100%);
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  text-align: center;
}
.nf__code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: calc(56px * var(--ui-scale));
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--color-neutral);
  font-variant-numeric: tabular-nums;
}
.nf__title {
  margin: var(--space-sm) 0 var(--space-2xs);
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}
.nf__text {
  margin: 0 0 var(--space-md);
  font-size: var(--ui-sm);
  color: var(--color-ink-2);
}
.nf__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: center;
}
.nf__note {
  margin: var(--space-sm) 0 0;
  font-size: var(--ui-xs);
  color: var(--color-muted);
}
@media (max-width: 640px) {
  .nf { padding-top: calc(96px + 24px * var(--ui-scale)); min-height: 60vh; }
  .nf__card { padding: var(--space-md); }
  .nf__code { font-size: calc(44px * var(--ui-scale)); }
}
