/* ═══════════════════════════════════════════════════════════════════════
   映格 YINGE · 生产版样式表
   ───────────────────────────────────────────────────────────────────────
   核心判断：修图界面必须用暗底。不是为了"高级感"，是因为浅色底会和照片
   做同时对比（simultaneous contrast），让用户误判曝光与色偏；浅青底
   (#D0EAEA) 更会与肤色互相污染。Lightroom / VSCO / Snapseed 全都用暗底，
   这是功能选择。

   于是确立双表面（dual surface）：
     · 明亮（Beachside 品牌色延续）—— 空状态、导出面板。仪式感与信任。
     · 暗房（品牌青的低明度派生）—— 照片舞台。让照片成为唯一光源。

   两个表面共享同一套尺度、圆角、动效与强调色，切换时只换色不换结构。
   设计方案与实测对比度见 设计-界面双表面.md 与 知识库.md §9 / §14。
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* ── 品牌色：Beachside 七色盘（延续既有识别） ── */
  --paper:    #F3FAFA;
  --card:     #FFFFFF;
  --line:     #D0EAEA;
  --primary:  #ACDBDB;
  --soft:     #88CCCC;
  --sea:      #65BCBC;
  --teal:     #48A6A6;
  --deep:     #246B70;
  --ink:      #16302F;   /* 比旧版 #203F42 更深，小字更扎实 */
  --muted:    #55716F;

  /* ── 暗房：品牌青的低明度派生，不是中性灰 ── */
  --room:       #0B1312;   /* 舞台底 */
  --room-1:     #121C1B;   /* 托盘底 */
  --room-2:     #1A2726;   /* 控件底 */
  --room-3:     #24332F;   /* 悬停 / 描边底 */
  --room-line:  #2A3D3A;
  --room-ink:   #EAF2F1;
  --room-muted: #8AA3A0;   /* on --room-1 对比度 6.48:1 */

  /* ── 强调：两表面各一档，保证各自达 AA ── */
  --accent:     #246B70;   /* on 明亮底 5.82:1 */
  --accent-lit: #5FC9CE;   /* on 暗房底 8.89:1 */
  --accent-glow: rgba(95, 201, 206, .28);

  /* ── 尺度：4 基数 ── */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* ── 圆角 ── */
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px; --r-pill: 999px;

  /* ── 动效：一条曲线贯穿，避免"每个组件各自弹性"的廉价感 ── */
  --dur-fast: 140ms;
  --dur-mid:  220ms;
  --dur-slow: 320ms;
  --ease:     cubic-bezier(.32, .72, 0, 1);

  --tap: 44px;   /* 最小触摸目标，全站强制 */
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  font-synthesis: none;
  -webkit-tap-highlight-color: transparent;
  color: var(--ink);
  background: var(--line);
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--accent-lit);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
.welcome :focus-visible, .sheet :focus-visible { outline-color: var(--accent); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap;
}

/* ══════════════ 外壳 ══════════════ */

.app {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100svh;
  min-height: 560px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  transition: background var(--dur-slow) var(--ease);
}
.app[data-stage="studio"], .app[data-stage="collage"] { background: var(--room); }

/* 部分 Android Chrome 安装到桌面后，standalone 模式会把 safe-area-inset-top
   报成 0，但窗口顶端仍有系统栏渐变阴影。至少留 12px，避免顶栏按钮被遮住；
   iPhone 刘海机型继续使用更大的系统安全区值。 */
@media (display-mode: standalone) {
  .app { padding-top: max(env(safe-area-inset-top), 12px); }
}

/* 桌面：居中成卡片，给一点场域感 */
@media (min-width: 600px) {
  body { display: grid; place-items: center; }
  .app {
    height: min(880px, 100svh);
    border-radius: var(--r-xl);
    box-shadow: 0 30px 90px rgba(11, 19, 18, .35);
  }
}

/* ══════════════ 空状态 ══════════════ */

.welcome {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--sp-6) var(--sp-6);
}
.welcome-inner { display: flex; flex-direction: column; align-items: stretch; }

.brand { text-align: center; }
.brand h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 46px;
  font-weight: 500;
  letter-spacing: .16em;
  text-indent: .16em;           /* 抵消末字右侧的字距，让视觉真正居中 */
  line-height: 1.1;
}
.brand-latin {
  margin: var(--sp-2) 0 0;
  font: 10px/1 ui-monospace, SFMono-Regular, monospace;
  letter-spacing: .42em;
  text-indent: .42em;
  color: var(--teal);
}
.welcome-lede {
  margin: var(--sp-6) 0 0;
  text-align: center;
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
  letter-spacing: .04em;
  color: var(--ink);
}
.welcome-sub {
  margin: var(--sp-2) 0 var(--sp-8);
  text-align: center;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.btn-primary {
  width: 100%;
  min-height: 56px;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-primary:hover:not(:disabled) { background: var(--soft); }
.btn-primary:active:not(:disabled) { transform: scale(.985); }
.btn-primary:disabled { opacity: .45; }

.btn-ghost {
  width: 100%;
  min-height: var(--tap);
  margin-top: var(--sp-3);
  border-radius: var(--r-pill);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}
.btn-ghost:hover { background: rgba(36, 107, 112, .07); }
.btn-ghost:disabled { opacity: .5; }

.btn-outline {
  width: 100%;
  min-height: 50px;
  margin-top: var(--sp-2);
  border: 1px solid var(--teal);
  border-radius: var(--r-md);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
}
.btn-outline:hover { background: rgba(72, 166, 166, .09); }
.welcome-collage { margin-top: var(--sp-3); }

/* ══════════════ 基础拼图 ══════════════ */
.collage { height:100%; display:flex; flex-direction:column; color:var(--room-ink); background:var(--room); user-select:none; -webkit-user-select:none; }
.collage-bar { flex:none; }
.collage-stage { position:relative; flex:1; min-height:180px; display:grid; place-items:center; overflow:hidden; padding:14px; background:#07100f; touch-action:none; }
.collage-stage canvas { display:block; max-width:100%; max-height:100%; width:auto; height:auto; box-shadow:0 12px 34px rgba(0,0,0,.36); touch-action:none; }
.collage-stage p { position:absolute; left:12px; right:12px; bottom:8px; margin:0; text-align:center; font-size:10px; color:rgba(255,255,255,.74); pointer-events:none; }
.collage-tools { flex:none; padding:10px 12px max(12px,env(safe-area-inset-bottom)); background:var(--room-1); border-top:1px solid var(--room-line); }
.collage-row { display:flex; gap:8px; overflow-x:auto; padding:3px 0; }
.collage-row button, .collage-row label { flex:none; min-height:44px; display:flex; align-items:center; justify-content:center; padding:0 13px; border:1px solid var(--room-line); border-radius:999px; color:var(--room-muted); font-size:11px; }
.collage-row button[aria-pressed="true"] { border-color:var(--accent-lit); color:var(--room-ink); background:rgba(95,201,206,.15); }
.collage-row.compact { justify-content:space-between; overflow:visible; }
.collage-row label { gap:5px; padding:0 9px; }
.collage-row select { max-width:72px; border:0; color:var(--room-ink); background:transparent; font-size:11px; }
@media (max-height:700px) { .collage-tools { padding-top:5px; } .collage-row button,.collage-row label { min-height:40px; } }

.trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  margin: var(--sp-6) 0 0;
  font-size: 11.5px;
  color: var(--muted);
}
.trust-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(72, 166, 166, .16);
}
.welcome-foot {
  margin: var(--sp-8) 0 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
  opacity: .8;
}

/* ══════════════ 编辑态外壳 ══════════════ */

.studio {
  height: 100%;
  display: flex;
  flex-direction: column;
  color: var(--room-ink);
  /* 编辑态以手势为主。禁止长按把按钮、提示文字拖成系统选区。 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 轻点照片进入纯净预览：只留下照片与原片对比反馈。 */
.studio.is-previewing .bar,
.studio.is-previewing .rail,
.studio.is-previewing .tray {
  display: none !important;
}
.studio.is-composing > .bar:not(.compose-bar),
.studio.is-composing .rail,
.studio.is-composing > .tray { display: none !important; }
.studio.is-composing .stage { margin: 0; border-radius: 0; }
.compose-bar { grid-template-columns: 1fr auto 1fr; }
.compose-reset { min-height: var(--tap); padding: 0 var(--sp-3); color: var(--room-muted); font-size: 12px; }
.studio.is-previewing .stage {
  margin: 0;
  border-radius: 0;
}
.studio.is-previewing .hint { display: none !important; }

/* ── 顶栏：只有三件事 ── */
.bar {
  flex: none;
  height: 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--sp-3);
}
.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-self: start;
  min-height: var(--tap);
  padding: 0 var(--sp-2) 0 0;
  font-size: 14px;
  color: var(--room-muted);
  transition: color var(--dur-fast) var(--ease);
}
.bar-btn:hover { color: var(--room-ink); }
.bar-btn:disabled { opacity: .4; }
.bar-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bar-btn.dark { color: var(--muted); justify-self: end; padding: 0 0 0 var(--sp-2); }
.bar-btn.dark:hover { color: var(--ink); }

.bar-count {
  margin: 0;
  font: 11px/1 ui-monospace, SFMono-Regular, monospace;
  letter-spacing: .1em;
  color: var(--room-muted);
}
.bar-save {
  justify-self: end;
  min-height: 36px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--accent-lit);
  color: #06201F;
  font-size: 13.5px;
  font-weight: 700;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.bar-save:disabled { background: var(--room-2); color: var(--room-muted); }
.bar-save:not(:disabled):active { transform: scale(.96); }

/* ── 照片轨：只在选了多张时出现 ──
   批处理的前提是"能到达每一张"。只有一个预览画布，就必须有切换入口；
   没有它，选 9 张和选 1 张对用户是同一件事——只能看到第一张。 */
.rail {
  flex: none;
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--room-1);
  border-bottom: 1px solid var(--room-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-photo {
  flex: none;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--room-2);
  opacity: .62;
  transition: opacity var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.rail-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-photo[aria-pressed="true"] {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--accent-lit);
}
.rail-photo:disabled { opacity: .35; }

/* ── 照片舞台：占满剩余高度，托盘不再压住照片 ── */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 var(--sp-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  background: var(--room);
  transition: margin var(--dur-mid) var(--ease), border-radius var(--dur-mid) var(--ease);
}
.stage:not(.is-empty) { touch-action: none; }
/* 还没渲染出照片时，隐藏画布的默认 300×150 盒，别让一块灰板冒充照片 */
.stage.is-empty .plate { display: none; }
.plate { position: absolute; inset: 0; }
.plate canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  transform-origin: center;
}
.plate canvas.mask-debug { z-index: 3; mix-blend-mode: screen; }
.crop-canvas {
  position: absolute; z-index: 5; display: block; pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(3, 8, 8, .72), 0 0 0 1px rgba(234, 242, 241, .82);
}
.crop-frame { position: absolute; z-index: 6; pointer-events: none; }
.crop-frame::before, .crop-frame::after {
  content: ''; position: absolute; inset: 33.333% 0 auto; height: 1px; background: rgba(255,255,255,.32);
  box-shadow: 0 calc(var(--crop-h, 0px) / 3) 0 rgba(255,255,255,.32);
}
.crop-frame::after { inset: 0 auto 0 33.333%; width: 1px; height: auto; box-shadow: calc(var(--crop-w, 0px) / 3) 0 0 rgba(255,255,255,.32); }
.crop-frame > i { position: absolute; width: 22px; height: 22px; border-color: #fff; border-style: solid; }
.crop-frame > i:nth-child(1) { left:0; top:0; border-width:2px 0 0 2px; }
.crop-frame > i:nth-child(2) { right:0; top:0; border-width:2px 2px 0 0; }
.crop-frame > i:nth-child(3) { right:0; bottom:0; border-width:0 2px 2px 0; }
.crop-frame > i:nth-child(4) { left:0; bottom:0; border-width:0 0 2px 2px; }
.crop-handle { position:absolute; right:-18px; bottom:-18px; width:44px; height:44px; pointer-events:auto; touch-action:none; }
.crop-handle::after { content:''; position:absolute; right:10px; bottom:10px; width:8px; height:8px; border-right:2px solid #fff; border-bottom:2px solid #fff; }
.stage.show-original #after-canvas { visibility: hidden; }
.stage.is-zoomed { cursor: grab; }
.stage.is-zoomed:active { cursor: grabbing; }

.tag {
  position: absolute; left: var(--sp-4); top: var(--sp-4);
  z-index: 2;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  background: rgba(95, 201, 206, .92);
  color: #06201F;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.reset {
  position: absolute; right: var(--sp-4); top: var(--sp-4);
  z-index: 2;
  min-height: var(--tap);
  padding: 0 var(--sp-4);
  border-radius: var(--r-pill);
  border: 1px solid var(--room-line);
  background: rgba(18, 28, 27, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--room-ink);
  font: 11px/1 ui-monospace, monospace;
}
.busy {
  position: absolute; inset: 0;
  z-index: 3;
  display: grid; place-items: center;
  background: rgba(11, 19, 18, .35);
}
.spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--room-line);
  border-top-color: var(--accent-lit);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 一次性手势提示：只在首次进入时出现 */
.hint {
  position: absolute; left: 50%; bottom: var(--sp-5);
  z-index: 2;
  margin: 0;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(18, 28, 27, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--room-ink);
  font-size: 11.5px;
  white-space: nowrap;
  animation: hint-in var(--dur-slow) var(--ease), hint-out var(--dur-slow) var(--ease) 3.6s forwards;
}
@keyframes hint-in  { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes hint-out { to   { opacity: 0; transform: translate(-50%, 6px); } }

/* ── 托盘：贴底实体面板，与照片分区明确（不再悬浮压住照片下部） ── */
.tray {
  flex: none;
  padding: var(--sp-3) 0 var(--sp-2);
  background: var(--room-1);
  border-top: 1px solid var(--room-line);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.compose-entry {
  display:flex; align-items:center; justify-content:center; gap:8px; width:calc(100% - 40px); min-height:44px;
  margin:4px 20px 0; border-top:1px solid var(--room-line); color:var(--room-ink); font-size:12.5px;
}
.compose-entry svg { width:18px; height:18px; fill:none; stroke:var(--accent-lit); stroke-width:1.8; stroke-linecap:round; }
.compose-tray { flex:none; padding:10px 0 max(10px, env(safe-area-inset-bottom)); background:var(--room-1); border-top:1px solid var(--room-line); }
.compose-tabs { display:grid; grid-template-columns:1fr 1fr; width:180px; margin:0 auto 8px; padding:3px; border-radius:999px; background:var(--room-2); }
.compose-tabs button { min-height:36px; border-radius:999px; color:var(--room-muted); font-size:12px; }
.compose-tabs button[aria-selected="true"] { background:var(--room-3); color:var(--room-ink); }
.compose-panel { min-height:78px; }
.compose-readout { display:flex; justify-content:space-between; padding:2px 20px 0; font-size:12px; color:var(--room-muted); }
.compose-readout output { color:var(--accent-lit); font:12px/1 ui-monospace,monospace; }
.ratio-list { display:flex; gap:8px; padding:3px 16px 8px; overflow-x:auto; scrollbar-width:none; }
.ratio-list::-webkit-scrollbar { display:none; }
.ratio-list button { flex:none; min-width:48px; min-height:38px; padding:0 12px; border:1px solid var(--room-line); border-radius:999px; color:var(--room-muted); font-size:11px; }
.ratio-list button[aria-pressed="true"] { border-color:var(--accent-lit); background:rgba(95,201,206,.16); color:var(--room-ink); }
.ratio-actions { display:flex; justify-content:space-between; padding:0 18px; }
.ratio-actions button { min-height:36px; color:var(--accent-lit); font-size:11px; }

/* ── 胶片格 ── */
.film {
  display: flex;
  gap: 9px;
  padding: 0 var(--sp-4) var(--sp-1);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  touch-action: pan-x;
}
.film::-webkit-scrollbar { display: none; }

.swatch {
  flex: none;
  width: 62px;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--room-muted);
  transition: color var(--dur-fast) var(--ease);
}
.swatch:disabled { cursor: default; }
.swatch-thumb {
  position: relative;
  width: 62px; height: 62px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--room-2);
  box-shadow: 0 0 0 1px var(--room-line);
  transition: box-shadow var(--dur-mid) var(--ease), transform var(--dur-mid) var(--ease);
}
.swatch-thumb canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.swatch-name {
  font-size: 10.5px;
  line-height: 1.2;
  letter-spacing: .01em;
  white-space: nowrap;
}
/* 未选中整体降亮度，选中的成为视觉焦点 */
.swatch[aria-pressed="false"] .swatch-thumb { opacity: .68; }
.swatch[aria-pressed="true"] { color: var(--room-ink); font-weight: 600; }
.swatch[aria-pressed="true"] .swatch-thumb {
  opacity: 1;
  transform: scale(1.06);
  box-shadow: 0 0 0 2px var(--accent-lit), 0 0 16px var(--accent-glow);
}

/* ── 读数行：命名 + 定位说明 + 数值 ──
   预设的差异说明原来只写在 title 属性里，移动端永远看不到；
   现在它就在屏幕上。 */
.readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5) var(--sp-1);
}
.readout-text { display: flex; align-items: baseline; gap: var(--sp-2); min-width: 0; }
.readout-name { font-size: 13.5px; font-weight: 600; color: var(--room-ink); white-space: nowrap; }
.readout-note {
  font-size: 11px;
  color: var(--room-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.readout-value {
  display: flex; align-items: baseline; gap: 1px;
  font: 12px/1 ui-monospace, SFMono-Regular, monospace;
  color: var(--accent-lit);
}
.readout-value .unit { font-size: 10px; opacity: .7; }

/* ── 滑杆：加粗轨道 + 悬浮滑钮（44px 触摸区靠 padding 撑，不靠视觉） ── */
.slider { padding: var(--sp-1) var(--sp-5) var(--sp-2); }
/* 滑轨加"已填充"段。这不是装饰：原来 room-3 在托盘底上只有 1.32:1，
   远低于 WCAG 1.4.11 对控件要求的 3:1；而且两条滑杆（强度 / 美肤）都没有
   填充段，用户只能挨个读数字才知道谁大谁小。填充段一次解决三件事：
   值可瞥见、控件边界达标、与进度环的弧视觉同源。
   --fill 由 JS 在 input 事件与初始化时写入，伪元素继承自定义属性。
   用纯百分比即可：22px 滑钮的半径正好盖住最大 11px 的偏差，误差全程藏在滑钮底下。 */
.slider input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: none;
  touch-action: pan-x;
  --fill: 0%;
}
.slider input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background:
    linear-gradient(to right, var(--accent-lit) var(--fill), transparent var(--fill)),
    var(--room-3);
}
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--accent-lit);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.slider input::-moz-range-track { height: 6px; border-radius: 3px; background: var(--room-3); }
/* Firefox 原生就有填充段，不用线性渐变 */
.slider input::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent-lit); }
.slider input::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--accent-lit); }
.slider input:disabled { opacity: .35; }

/* ── 「美肤」折叠行：主任务只有调色，美肤是加分项 ── */
.tray-more {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: calc(100% - var(--sp-5) * 2);
  min-height: var(--tap);
  margin: 0 var(--sp-5);
  padding: 0 2px;
  border-top: 1px solid var(--room-line);
  color: var(--room-muted);
  font-size: 12.5px;
  transition: color var(--dur-fast) var(--ease);
}
.tray-more:hover { color: var(--room-ink); }
.tray-more[aria-expanded="true"] { color: var(--room-ink); }
.tray-more > span:first-child { flex: none; }
.tray-more-value {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(95, 201, 206, .16);
  color: var(--accent-lit);
  font: 10.5px/1.4 ui-monospace, monospace;
}
.tray-more svg {
  width: 18px; height: 18px; margin-left: auto;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--dur-mid) var(--ease);
}
.tray-more[aria-expanded="true"] svg { transform: rotate(180deg); }

.extra { padding-bottom: var(--sp-1); }

/* ══════════════ 导出面板 ══════════════ */

.sheet {
  width: min(100%, 440px);
  max-height: 92svh;
  margin: auto auto 0;
  padding: 0 var(--sp-6) max(var(--sp-6), env(safe-area-inset-bottom));
  border: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  background: var(--paper);
  color: var(--ink);
  overflow-y: auto;
}
.sheet::backdrop { background: rgba(11, 19, 18, .62); backdrop-filter: blur(6px); }
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: var(--r-xl); }
}
.sheet-grab {
  width: 36px; height: 4px;
  margin: var(--sp-3) auto var(--sp-4);
  border-radius: 2px;
  background: var(--line);
}

.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.sheet-eyebrow {
  margin: 0;
  font: 9px/1.6 ui-monospace, monospace;
  letter-spacing: .3em;
  color: var(--teal);
}
.sheet h2 {
  margin: var(--sp-1) 0 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: .02em;
}
.sheet-meta {
  margin: var(--sp-3) 0 var(--sp-5);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}
.sheet-note {
  margin: var(--sp-5) 0 0;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}

.fieldset { margin: 0 0 var(--sp-5); padding: 0; border: 0; }
.fieldset legend {
  padding: 0 0 var(--sp-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
}
.seg {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 52px;
  padding: 0 var(--sp-4);
  margin-bottom: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.seg:hover { border-color: var(--soft); }
.seg input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.seg span { display: flex; align-items: baseline; gap: var(--sp-2); font-size: 14px; font-weight: 500; }
.seg-sub { font-size: 11px; font-weight: 400; color: var(--muted); }
/* :has() 在 iOS 15 上无效，所以 app.js 同时写 data-on；两条都留着 */
.seg:has(input:checked), .seg[data-on="true"] {
  border-color: var(--accent);
  background: rgba(172, 219, 219, .22);
}

/* 进度：环形 + 百分比，比一条横条更有"正在逐张处理"的信息量 */
.sheet-progress { display: grid; place-items: center; gap: var(--sp-4); padding: var(--sp-8) 0 var(--sp-6); }
.ring {
  position: relative;
  width: 108px; height: 108px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--accent) var(--p, 0%), var(--line) 0);
  transition: background var(--dur-fast) linear;
}
.ring::before {
  content: '';
  position: absolute;
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--paper);
}
.ring-text {
  position: relative;
  font: 20px/1 ui-monospace, monospace;
  color: var(--ink);
}

/* 不确定态：单张照片时 i/1 恒为 0，百分比没有信息量——环会空着一动不动，
   然后直接跳到 100%。与其给一个假的 0%，不如老实转圈。多张照片仍走确定态，
   因为那时 i/n 是真实的"已完成比例"。 */
.ring.is-indeterminate {
  background: conic-gradient(transparent 0 55%, var(--accent) 55% 92%, transparent 92% 100%);
  animation: ring-spin 1.05s linear infinite;
}
@keyframes ring-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  /* 全站降级会把动画压到 0.01ms/1 次，转圈会冻在 360° = 起点，正好留下一个静态弧 */
  .ring.is-indeterminate { animation: none; }
}

/* 结果段：换了一个"完成"的视觉调性，不再和设置段混同 */
.sheet-done { text-align: center; padding-top: var(--sp-1); }
.done-mark {
  width: 56px; height: 56px;
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(172, 219, 219, .5);
}
.done-mark svg { width: 28px; height: 28px; fill: none; stroke: var(--deep); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sheet-done h2 { margin: 0 0 var(--sp-2); font-size: 24px; }
.sheet-done .sheet-meta { margin: 0 0 var(--sp-6); }

/* ══════════════ 动效降级 ══════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .hint { animation: none; opacity: 1; }
}

/* 短屏：压缩托盘，优先保照片高度 */
@media (max-height: 700px) {
  .swatch, .swatch-thumb { width: 54px; }
  .swatch-thumb { height: 54px; }
  .readout { padding-top: var(--sp-2); }
  .welcome-lede { font-size: 19px; margin-top: var(--sp-5); }
  .welcome-sub { margin-bottom: var(--sp-6); }
  .brand h1 { font-size: 40px; }
}

/* 首页操作层级：统一形态，区分视觉权重。只作用于欢迎页。 */
.welcome-inner { width:100%; max-width:360px; margin-inline:auto; }
.welcome .brand-latin { letter-spacing:.23em; font-size:9px; opacity:.85; }
.welcome .welcome-sub { margin:12px 0 32px; font-size:13px; }
.welcome-actions { display:grid; gap:12px; }
.welcome-actions .btn-primary,
.welcome-actions .btn-outline { min-height:54px; margin:0; border-radius:16px; font-size:15px; font-weight:550; letter-spacing:.04em; }
.welcome-actions .btn-primary { position:relative; background:var(--deep); color:var(--paper); border:1px solid var(--deep); }
.welcome-actions .btn-primary span { position:absolute; right:22px; font-size:20px; font-weight:400; }
.welcome-actions .btn-primary:hover { background:#1c595d; }
.welcome-actions .btn-outline { border-color:#b7d2d0; background:transparent; color:var(--deep); }
.welcome-actions .btn-outline:hover { border-color:var(--deep); background:#e7f2f1; }
.welcome-resume { min-height:44px; margin:0; border:0; border-radius:12px; color:var(--deep); font-size:13px; text-decoration:underline; text-underline-offset:5px; text-decoration-color:#b7d2d0; }
.welcome-resume:hover { background:#e7f2f1; }
.welcome-formats { margin:16px 0 0; text-align:center; font-size:10.5px; line-height:1.8; color:var(--muted); }
.welcome .trust { margin:28px 0 0; padding-top:22px; border-top:1px solid #d7e7e5; font-size:11px; gap:9px; }
.welcome .trust-dot { width:5px; height:5px; box-shadow:none; background:var(--deep); opacity:.65; flex:none; }
.welcome .welcome-foot { margin:28px 0 0; font-size:10px; letter-spacing:.06em; opacity:1; color:#657e7b; }
.welcome-foot span { padding-inline:5px; }
@media(max-width:360px) { .welcome .welcome-sub { font-size:12px; } .welcome-formats { font-size:10px; } }
