/* fitting-widget v0 — 渠道中立量体表单 + 荐码（E0-K2，无 3D） */

.fitting-widget-host {
  min-width: 0;
  max-width: 100%;
  --fw-bg: var(--fitting-bg, #f6f4f1);
  --fw-card: var(--fitting-card, #ffffff);
  --fw-text: var(--fitting-text, #1f1f1f);
  --fw-muted: var(--fitting-muted, #6b6b6b);
  --fw-accent: var(--fw-primary, var(--fitting-accent, #2f5d50));
  --fw-accent-light: var(--fitting-accent-light, #e8f2ee);
  --fw-border: var(--fitting-border, #e5e1db);
  --fw-warn: var(--fitting-warn, #9a6b1a);
  --fw-bad: var(--fitting-bad, #a33b3b);
  --fw-radius: var(--fitting-radius, 12px);
  font-family: var(--fw-font-family, var(--fitting-font, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif));
  color: var(--fw-text);
  background: var(--fw-bg);
}

.fw-root {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

/* 品牌条：仅在 options.theme.brandName / logoUrl 提供时渲染（M9-02 主题换皮） */
.fw-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius);
  background: var(--fw-card);
  color: var(--fw-text);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  min-height: 2rem;
}

.fw-brand-logo {
  height: 1.4rem;
  width: auto;
  max-width: 6rem;
  object-fit: contain;
  display: block;
}

.fw-brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fw-section {
  min-width: 0;
  background: var(--fw-card);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius);
  padding: 1rem;
  overflow: visible;
}

.fw-heading {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  line-height: 1.4;
  overflow: visible;
}

.fw-subheading {
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
}

.fw-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}

.fw-product {
  display: grid;
  gap: 0.25rem;
  text-align: left;
  padding: 0.6rem;
  border: 2px solid var(--fw-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.fw-product--selected {
  border-color: var(--fw-accent);
  background: var(--fw-accent-light);
}

.fw-product-thumb {
  display: grid;
  place-items: center;
  height: 64px;
  border-radius: 6px;
  background: linear-gradient(135deg, #dfe8e3, #c5d4cc);
  color: var(--fw-accent);
  font-weight: 700;
  font-size: 0.8rem;
}

.fw-product-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.fw-product-desc {
  font-size: 0.75rem;
  color: var(--fw-muted);
}

.fw-form {
  display: grid;
  gap: 0.75rem;
}

.fw-form-hint {
  margin: -0.35rem 0 0.25rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--fw-muted);
  overflow: visible;
  word-break: break-word;
}

.fw-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.fw-photo-slot {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px dashed var(--fw-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.fw-photo-preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 5;
  min-height: 240px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f6;
  border: 1px solid var(--fw-border);
}

.fw-photo-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.fw-photo-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--fw-muted);
  background: repeating-linear-gradient(
    -45deg,
    #f8fafc,
    #f8fafc 8px,
    #f1f5f9 8px,
    #f1f5f9 16px
  );
}

.fw-photo-slot--filled {
  border-style: solid;
}

.fw-photo-slot input[type="file"] {
  width: 100%;
  min-width: 0;
  font-size: 0.75rem;
}

.fw-photo-name {
  font-size: 0.72rem;
  color: var(--fw-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fw-photo-status {
  margin: 0.65rem 0 0.35rem;
  padding: 0.2rem 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--fw-muted);
  min-height: 1.5em;
  overflow: visible;
  word-break: break-word;
  white-space: normal;
}

.fw-step-badge {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--fw-accent-light);
  color: var(--fw-accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.fw-photo-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

.fw-photo-badge--ok {
  background: #e7f6ee;
  color: #1f7a45;
}

.fw-photo-badge--bad {
  background: #fdecec;
  color: var(--fw-bad);
}

.fw-photo-slot--ok {
  border-color: #1f7a45;
}

.fw-photo-slot--bad {
  border-color: var(--fw-bad);
}

.fw-pose-errors {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--fw-bad);
  font-size: 0.85rem;
}

.fw-model-id {
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: var(--fw-accent-light);
  color: var(--fw-accent);
  font-size: 0.9rem;
  word-break: break-all;
}

/* 默认首屏：仅步骤1 上传三视图；步骤2/商品在开始量体后再展开 */
.fw-root[data-fw-flow-stage="capture"] [data-fw-refine],
.fw-root[data-fw-flow-stage="capture"] [data-fw-products-section],
.fw-root[data-fw-flow-stage="photos"] [data-fw-refine],
.fw-root[data-fw-flow-stage="photos"] [data-fw-products-section] {
  display: none !important;
}

/* 步骤3：生成成功（preview/saved/confirmed）前不显示 */
.fw-root:not([data-fw-flow-stage="preview"]):not([data-fw-flow-stage="saved"]):not([data-fw-flow-stage="confirmed"]) [data-fw-preview-section] {
  display: none !important;
}

.fw-capture-basics {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.75rem 0;
  min-width: 0;
}

.fw-capture-gender {
  max-width: 12rem;
}

.fw-capture-hw {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
}

.fw-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.fw-modal[hidden] {
  display: none !important;
}

.fw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.fw-modal-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.1rem 1.2rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
  display: grid;
  gap: 0.65rem;
}

/* 拍照采集可选勾选 */
.fw-photo-opt-in {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.04);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--fw-text, #1e293b);
  cursor: pointer;
}

.fw-photo-opt-in input[type="checkbox"] {
  margin-top: 0.15rem;
  flex: 0 0 auto;
}

.fw-photo-grid[hidden] {
  display: none !important;
}

/* 修改参数：步骤1无三视图，仅性别/身高/体重 */
.fw-photos--basics-only .fw-photo-grid,
.fw-photos--basics-only [data-fw-actions-capture],
.fw-photos--basics-only [data-fw-photo-status],
.fw-photos--basics-only [data-fw-pose-errors] {
  display: none !important;
}

.fw-photos--basics-only .fw-capture-basics {
  margin-top: 0;
}

.fw-photos--compact .fw-form-hint,
.fw-photos--compact .fw-actions,
.fw-photos--compact .fw-photo-slot input[type="file"],
.fw-photos--compact .fw-photo-name,
.fw-photos--compact .fw-photo-placeholder {
  display: none;
}

.fw-photos--compact .fw-photo-grid {
  margin-bottom: 0.35rem;
}

.fw-photos--compact .fw-photo-preview {
  aspect-ratio: 3 / 5;
}

.fw-photos--compact .fw-photo-slot {
  padding: 0.35rem;
}

@media (max-width: 720px) {
  .fw-photo-grid {
    grid-template-columns: 1fr;
  }
}

.fw-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.fw-measure-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.fw-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 0.75rem;
  padding: 0.2rem;
  border-radius: 8px;
  background: #eef2f7;
  /* 吸顶：到顶后钉住，下方量体列表继续滚 */
  position: sticky;
  top: 0;
  z-index: 6;
  box-shadow: 0 1px 0 rgba(30, 75, 140, 0.06);
}

.fw-root--h5 .fw-tabs {
  top: env(safe-area-inset-top, 0px);
  margin-left: -0.85rem;
  margin-right: -0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: 0;
  background: #eef2f7;
}

.fw-tab {
  flex: 1 1 0;
  margin: 0;
  padding: 0.45rem 0.35rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5b6b7c;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.fw-tab.is-active {
  background: #fff;
  color: var(--fw-primary, #1e4b8c);
  box-shadow: 0 1px 2px rgba(30, 75, 140, 0.12);
}

/* 三面板同列叠放：宽度取最宽内容，高度仅由当前 TAB 决定 */
.fw-tab-panels {
  display: grid;
  width: 100%;
  min-width: 0;
}

.fw-tab-panel {
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  height: 0;
  overflow: hidden;
}

.fw-tab-panel.is-active {
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
  height: auto;
  overflow: visible;
}

.fw-tab-hint {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  color: var(--fw-muted, #64748b);
}

.fw-method-placeholder {
  box-sizing: border-box;
  width: 100%;
  min-height: 8rem;
  padding: 0.85rem 0.9rem;
  border: 1px dashed #c5d0de;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.85rem;
  line-height: 1.5;
}

.fw-method-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #1e4b8c;
}

.fw-compare {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #f7f9fc;
  font-size: 0.78rem;
}
.fw-compare-title {
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #1e4b8c;
}
.fw-compare-table {
  width: 100%;
  border-collapse: collapse;
}
.fw-compare-table th,
.fw-compare-table td {
  padding: 0.2rem 0.35rem;
  text-align: left;
  border-bottom: 1px solid #e6e9f0;
}
.fw-compare-table th { color: #64748b; font-weight: 600; }
.fw-compare-hot td { color: #b45309; font-weight: 600; }
.fw-compare-note { margin: 0.4rem 0 0; color: #64748b; }

/* 单行：标签 | [−1 −0.1 值 +0.1 +1] | 单位（单位列固定，不被挤掉） */
.fw-stepper-field.fw-field,
.fw-slider-field.fw-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: stretch;
  column-gap: 0.35rem;
  row-gap: 0;
  min-width: 0;
  width: 100%;
}

.fw-stepper-field .fw-label,
.fw-slider-field .fw-label {
  flex: none;
  margin: 0;
  max-width: 3.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fw-muted);
}

.fw-stepper-controls {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  width: 100%;
  max-width: none;
}

.fw-stepper-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0.15rem;
  border-radius: 7px;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  white-space: nowrap;
}

/* 外档 ±1：略深描边，仍浅底（与内档色差收敛） */
.fw-stepper-btn--coarse {
  min-width: 2.2rem;
  height: 2.5rem;
  border: 1px solid #8ea0b8;
  background: #e6ecf4;
  color: #314960;
  font-size: 0.76rem;
  font-weight: 700;
}

.fw-stepper-btn--coarse:active {
  background: #d5dee9;
}

/* 内档 ±0.1：更浅一点 */
.fw-stepper-btn--fine {
  min-width: 2.45rem;
  height: 2.5rem;
  border: 1px solid #c8d2df;
  background: #f4f6f9;
  color: #4d6178;
  font-size: 0.7rem;
  font-weight: 600;
}

.fw-stepper-btn--fine:active {
  background: #e8edf3;
}

.fw-slider-value {
  font-variant-numeric: tabular-nums;
  color: var(--fw-text);
  font-weight: 600;
}

.fw-stepper-unit,
.fw-slider-unit {
  flex: none;
  flex-shrink: 0;
  min-width: 1.5rem;
  font-size: 0.8rem;
  color: var(--fw-muted);
  white-space: nowrap;
  text-align: left;
  justify-self: start;
}

.fw-range {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  accent-color: var(--fw-accent);
  cursor: pointer;
}

/* 数值框加宽；固定宽度，不挤单位 */
.fw-stepper-field.fw-field input[type="number"],
.fw-slider-field.fw-field input[type="number"],
.fw-stepper-controls input[type="number"] {
  flex: 0 0 5.75rem;
  box-sizing: border-box;
  width: 5.75rem;
  max-width: 5.75rem;
  min-width: 5.75rem;
  text-align: center;
  padding: 0.4rem 0.3rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (max-width: 520px) {
  .fw-row {
    grid-template-columns: 1fr;
  }
}

.fw-field {
  display: grid;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.fw-label {
  color: var(--fw-muted);
}

.fw-field input,
.fw-field select {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--fw-border);
  border-radius: 8px;
  font: inherit;
  color: var(--fw-text);
  background: #fff;
}

.fw-field select option {
  color: var(--fw-text);
  background: #fff;
}

.fw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fw-btn {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  cursor: pointer;
}

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

.fw-btn--primary {
  background: var(--fw-accent);
  color: #fff;
}

.fw-btn--secondary {
  background: #fff;
  border-color: var(--fw-border);
  color: var(--fw-text);
}

.fw-error {
  margin: 0;
  color: var(--fw-bad);
  font-size: 0.85rem;
}

.fw-status {
  margin: 0 0 0.5rem;
  color: var(--fw-muted);
  font-size: 0.85rem;
}

.fw-result-primary {
  margin: 0 0 0.25rem;
}

.fw-result-score,
.fw-result-alt,
.fw-result-note,
.fw-result-est {
  margin: 0.25rem 0;
  font-size: 0.9rem;
}

.fw-result-est {
  color: var(--fw-muted);
  font-size: 0.8rem;
}

.fw-result-list {
  margin: 0.25rem 0 0.5rem 1.1rem;
  padding: 0;
  font-size: 0.85rem;
}

.fw-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--fw-accent-light);
  color: var(--fw-accent);
}

.fw-tag--warn {
  background: #f8f0df;
  color: var(--fw-warn);
}

.fw-tag--bad {
  background: #faeaea;
  color: var(--fw-bad);
}

.fw-debug {
  margin: 0;
  font-size: 0.75rem;
  color: var(--fw-muted);
}

[hidden] {
  display: none !important;
}

.fw-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.fw-layout-main,
.fw-layout-preview {
  min-width: 0;
  max-width: 100%;
}

.fw-section.fw-preview {
  position: relative;
  z-index: 0;
  overflow: hidden;
}



/* ── H5 / 手机嵌入 ───────────────────────────────────── */

.fitting-widget-host--h5,
.fw-root--h5 {
  -webkit-tap-highlight-color: transparent;
}

.fitting-widget-host--h5 {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.fw-root--h5 .fw-actions-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  /* 勿用负底边距，否则会盖住同卡片内的状态文案 */
  margin: 0.5rem -0.85rem 0;
  padding: 0.75rem 0.85rem 0.85rem;
  background: linear-gradient(180deg, rgba(246, 244, 241, 0) 0%, var(--fw-card) 28%);
  flex-direction: column;
  overflow: visible;
}

/* 步骤2：底部按钮改为文档流，避免与吸顶 TAB 双 sticky 在 web-view 里锁死滚动 */
.fw-root--h5[data-fw-flow-stage="measures"] .fw-actions-bar[data-fw-actions-measures] {
  position: static;
  margin: 0.85rem 0 0;
  padding: 0.65rem 0 0;
  background: transparent;
}

.fw-root--h5 .fw-section {
  padding: 0.85rem;
  padding-bottom: 1rem;
  border-radius: 10px;
  overflow: visible;
}

.fw-root--h5 .fw-photo-status {
  font-size: 0.82rem;
  line-height: 1.55;
  padding: 0.25rem 0.1rem;
}

.fw-root--h5 .fw-products {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-bottom: 0.15rem;
}

.fw-root--h5 .fw-product {
  flex: 0 0 9.5rem;
  scroll-snap-align: start;
}

.fw-root--h5 .fw-row {
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.fw-root--h5 .fw-stepper-field.fw-field,
.fw-root--h5 .fw-slider-field.fw-field {
  gap: 0.25rem;
  column-gap: 0.25rem;
}

.fw-root--h5 .fw-stepper-controls {
  gap: 0.12rem;
  max-width: none;
}

.fw-root--h5 .fw-stepper-btn--coarse,
.fw-root--h5 .fw-stepper-btn--fine {
  height: 2.75rem;
  min-height: 2.75rem;
  min-width: 1.85rem;
  padding: 0 0.08rem;
  font-size: 0.62rem;
}

.fw-root--h5 .fw-stepper-btn--coarse {
  min-width: 1.75rem;
  font-size: 0.68rem;
}

.fw-root--h5 .fw-stepper-btn--fine {
  min-width: 2rem;
  font-size: 0.62rem;
}

.fw-root--h5 .fw-stepper-field.fw-field input[type="number"],
.fw-root--h5 .fw-slider-field.fw-field input[type="number"],
.fw-root--h5 .fw-stepper-controls input[type="number"] {
  flex: 0 1 4rem;
  width: 4rem;
  max-width: 4.25rem;
  min-width: 3.25rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.15rem;
  font-size: 16px;
}

.fw-root--h5 .fw-stepper-unit {
  flex: none;
  min-width: 1.4rem;
  font-size: 0.75rem;
}

.fw-root--h5 .fw-field input:not([type="number"]),
.fw-root--h5 .fw-field select {
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
  font-size: 16px;
}

.fw-root--h5 .fw-btn {
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  font-size: 1rem;
}

.fw-root--h5 .fw-actions-bar .fw-btn {
  width: 100%;
}

.fw-exit-panel {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: #eef6ef;
  border: 1px solid #cfe3d2;
}

.fw-exit-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #1f6b3a;
}

.fw-exit-hint {
  margin: 0 0 0.65rem;
  color: var(--fw-muted);
  font-size: 0.9rem;
}

.fw-postsave-panel {
  margin-top: 0.85rem;
  padding: 0.85rem;
  border-radius: 10px;
  background: #f0f6ff;
  border: 1px solid #c9daf5;
}

.fw-postsave-title {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #1e4a8a;
}

.fw-postsave-hint {
  margin: 0 0 0.65rem;
  color: var(--fw-muted);
  font-size: 0.9rem;
}

.fw-postsave-actions {
  margin-top: 0.25rem;
}

.fw-root--h5 .fw-layout {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* 量体表单/生成按钮在上，三维模型在下 */
.fw-root--h5 .fw-layout-main {
  order: 1;
}

.fw-root--h5 .fw-layout-preview {
  order: 2;
}

.fw-root--h5 .fw-preview-host {
  height: min(42vh, 360px);
  min-height: 240px;
}

.fw-root--h5 .fw-debug {
  display: none;
}

@media (max-width: 768px) {
  .fitting-widget-host:not(.fitting-widget-host--h5) .fw-row {
    grid-template-columns: 1fr;
  }

  .fitting-widget-host:not(.fitting-widget-host--h5) .fw-field input,
  .fitting-widget-host:not(.fitting-widget-host--h5) .fw-field select {
    font-size: 16px;
    min-height: 2.75rem;
  }

  .fitting-widget-host:not(.fitting-widget-host--h5) .fw-btn {
    min-height: 2.75rem;
  }
}

.fw-preview-hint {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--fw-muted);
}

.fw-preview-host {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: min(52vh, 420px);
  min-height: 320px;
  border: 1px solid var(--fw-border);
  border-radius: 10px;
  overflow: hidden;
  contain: layout paint;
  background: linear-gradient(180deg, #f4efe8 0%, #e5ddd2 100%);
  user-select: none;
}

.fw-preview-actions {
  margin-top: 0.5rem;
}

/* 步骤3 底部：保存 / 修正 */
.fw-actions-preview {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fw-preview-host .mesh-drag-hint {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgba(47, 93, 80, 0.88);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  pointer-events: none;
  z-index: 2;
}

.fw-preview-host .mesh-viewer-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--fw-bad);
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.85rem;
  text-align: center;
  z-index: 3;
}

.fw-preview-host .mesh-viewer-note {
  position: absolute;
  left: 0.6rem;
  bottom: 0.45rem;
  margin: 0;
  pointer-events: none;
  z-index: 2;
  font-size: 0.75rem;
  color: var(--fw-muted);
  text-shadow: 0 1px 0 #fff;
}

.fw-preview-host canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  cursor: grab;
  touch-action: none;
}

/* ── AI 试穿（M9-02 延伸）────────────────────────────────── */

.fw-tryon-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.fw-tryon-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fw-text);
  margin-right: auto;
}

.fw-tryon-start {
  position: relative;
}

/* 试穿入口红点：有已完成未查看结果 */
.fw-tryon-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fw-bad);
  border: 1.5px solid #fff;
}

/* 试穿记录数字角标 */
.fw-tryon-badge {
  display: inline-block;
  margin-left: 0.3rem;
  min-width: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--fw-bad);
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.1rem;
  text-align: center;
}

/* 顶部通知条 */
.fw-tryon-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--fw-accent);
  border-radius: var(--fw-radius);
  background: var(--fw-accent-light);
  color: var(--fw-text);
  font-size: 0.85rem;
  line-height: 1.4;
}

.fw-tryon-notice--clickable {
  cursor: pointer;
}

.fw-tryon-notice-text {
  flex: 1 1 auto;
  min-width: 0;
}

.fw-tryon-notice-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--fw-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
}

/* 模特选择 */
.fw-tryon-models {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.6rem;
}

.fw-tryon-model {
  display: grid;
  gap: 0.3rem;
  padding: 0.4rem;
  border: 2px solid var(--fw-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: center;
}

.fw-tryon-model:hover,
.fw-tryon-model:focus-visible {
  border-color: var(--fw-accent);
}

.fw-tryon-model--on {
  border-color: var(--fw-accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.28);
}

.fw-tryon-photo-del {
  display: block;
  font-size: 0.72rem;
  color: #b91c1c;
}

.fw-tryon-photos-panel {
  width: min(520px, 100%);
}

.fw-tryon-model-thumb {
  width: 100%;
  aspect-ratio: 3 / 5;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: #f3f4f6;
}

.fw-tryon-model-label {
  font-size: 0.78rem;
  color: var(--fw-muted);
}

/* 记录列表 */
.fw-tryon-records-panel {
  width: min(520px, 100%);
}

.fw-tryon-record-list {
  display: grid;
  gap: 0.5rem;
  max-height: 55vh;
  overflow: auto;
}

.fw-tryon-record {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem;
  border: 1px solid var(--fw-border);
  border-radius: 8px;
  background: #fff;
}

.fw-tryon-record--done {
  cursor: pointer;
  border-color: var(--fw-accent);
}

.fw-tryon-record-thumb {
  flex: 0 0 3rem;
  width: 3rem;
  height: 4rem;
  object-fit: cover;
  border-radius: 6px;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  color: var(--fw-muted);
  text-align: center;
}

.fw-tryon-record-info {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.fw-tryon-record-product {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fw-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fw-tryon-record-meta {
  font-size: 0.75rem;
  color: var(--fw-muted);
}

.fw-tryon-record-err {
  font-size: 0.75rem;
  color: var(--fw-bad);
  word-break: break-all;
}

/* 结果大图 */
.fw-tryon-result-panel {
  width: min(480px, 100%);
}

.fw-tryon-result-img {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 8px;
  background: #f3f4f6;
}

/* 试穿入口：商家模特效果图（catalog pic_url；FIT-1 摊平后 role 丢失） */
.fw-tryon-model-fig {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.fw-tryon-model-img {
  width: 4.5rem;
  height: 6rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--fw-border);
  background: #f3f4f6;
}

.fw-tryon-model-cap {
  font-size: 0.78rem;
  color: var(--fw-muted);
}

.fw-tryon-privacy {
  color: var(--fw-muted);
}
