/* 人像图工作台（原「参考图工作台」，芦嘉怡 2026-10-27）：全屏一层，按做脸顺序分步。
   换脸一批十几张、抽卡 6 组 12 张，所以结果区占满屏宽、按批分组；每张点开是能左右翻的大图。 */

.pw-root {
  width: min(1680px, 100%);
  height: calc(100vh - 2 * var(--sheet-pad));
  height: calc(100dvh - 2 * var(--sheet-pad));
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: var(--sh-3); overflow: hidden;
}
.pw-top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 20px 10px; border-bottom: 0.5px solid var(--hair);
}
.pw-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.pw-title h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.pw-sub { color: var(--text-2); font-size: 13px; }
.pw-x { margin-left: auto; }

/* 顶上「现在定下来的」四格：一眼看到这个角色的脸做到哪了 */
.pw-final { display: flex; gap: 8px; flex-wrap: wrap; }
.pw-final-slot {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px;
  border: 0.5px solid var(--hair-strong); border-radius: 999px; background: var(--surface-sunken);
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer;
}
.pw-final-slot img, .pw-final-ph {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  background: var(--bg-deep); color: var(--text-3);
}
.pw-final-slot.is-empty { color: var(--text-3); border-style: dashed; }

/* flex: none —— 页签条带了 overflow-x（手机上能横滑），在纵向 flex 里会被当成可以压扁的项，
   下面内容一多它就被挤成半截字（嘉怡 10/27 17:42 截图）。顶栏同理。 */
.pw-top { flex: none; }
.pw-tabs { flex: none; display: flex; gap: 4px; padding: 8px 20px 0; border-bottom: 0.5px solid var(--hair); overflow-x: auto; overflow-y: hidden; }
.pw-tab {
  font: inherit; font-size: 14px; padding: 8px 14px; border: 0; background: none; cursor: pointer;
  color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -0.5px; white-space: nowrap;
}
.pw-tab.is-on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.pw-tab:last-child { margin-left: auto; }

.pw-body { flex: 1 1 auto; overflow: auto; padding: 16px 20px 28px; }
.pw-sec { margin-bottom: 26px; }
.pw-sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.pw-sec-head h3 { margin: 0; font-size: 15px; font-weight: 650; }
.pw-sec-sub { color: var(--text-2); font-size: 13px; }
.pw-note { color: var(--text-2); font-size: 13px; margin: 8px 0; }
.pw-note.is-err { color: var(--red); }

.pw-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.pw-filter-lab { color: var(--text-2); }
.pw-select { width: auto; min-width: 96px; padding: 4px 8px; font-size: 13px; }
.pw-filter-note { color: var(--text-3); font-size: 12px; }

/* 网格：屏多宽就摆多少列 */
.pw-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.pw-card {
  position: relative; min-width: 0; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-sunken); border: 0.5px solid var(--hair-strong);
}
.pw-card > img, .pw-shot img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; }
.pw-skel { aspect-ratio: 3 / 4; animation: pw-pulse 1.2s ease-in-out infinite alternate; }
@keyframes pw-pulse { from { opacity: 0.5; } to { opacity: 1; } }

.pw-pick { cursor: pointer; }
.pw-pick.is-on { outline: 3px solid var(--accent); outline-offset: -3px; }
.pw-check {
  position: absolute; left: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700;
}
/* 右上角的 ×：虚线小圆，看得到但不抢眼（嘉怡「右上角虚标」） */
.pw-x-mark {
  position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.9); background: rgba(0, 0, 0, 0.35); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.pw-x-mark:hover { background: rgba(215, 0, 21, 0.85); border-style: solid; }
.pw-zoom {
  position: absolute; right: 6px; bottom: 30px; padding: 2px 8px; border-radius: 999px; border: 0;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11.5px; cursor: zoom-in;
}
.pw-cap {
  padding: 4px 8px; font-size: 11.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pw-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 120px; aspect-ratio: 3 / 4; border: 1.5px dashed var(--hair-strong); background: none;
  font: inherit; font-size: 13px; color: var(--accent); cursor: pointer;
}
.pw-add-plus { font-size: 30px; line-height: 1; }

.pw-acts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.pw-count { font-size: 13px; color: var(--orange); }
.pw-count.is-ok { color: var(--green); }
.pw-sent {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 12px;
  border-radius: var(--r-md); background: var(--accent-soft); font-size: 13px;
}

.pw-current { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.pw-current img { width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; cursor: zoom-in; }

.pw-batch { margin-bottom: 18px; }
.pw-batch-head { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.pw-shot { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; position: relative; }
.pw-result.is-on { outline: 3px solid var(--green); outline-offset: -3px; }
.pw-badge {
  position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: 999px;
  background: var(--green); color: #fff; font-size: 11.5px; font-weight: 600;
}
.pw-refs { display: flex; align-items: center; gap: 8px; padding: 5px 6px; font-size: 11px; color: var(--text-3); }
.pw-ref { display: inline-flex; align-items: center; gap: 3px; }
.pw-ref img { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; }
.pw-strength { margin-left: auto; }

/* ② 抽卡：一组一张卡（正 + 侧并排），屏宽够就一行三组 */
.pw-pairs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pw-pair {
  padding: 10px; border-radius: var(--r-lg); border: 0.5px solid var(--hair-strong); background: var(--surface-sunken);
  display: flex; flex-direction: column; gap: 8px;
}
.pw-pair.is-on { outline: 3px solid var(--green); outline-offset: -2px; }
.pw-pair-head { font-size: 13px; font-weight: 600; }
.pw-pair-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pw-pair-cell { position: relative; border-radius: var(--r-md); overflow: hidden; background: var(--bg-deep); }
.pw-pair-view {
  position: absolute; left: 6px; top: 6px; z-index: 1; padding: 1px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11px;
}
.pw-pair-empty { aspect-ratio: 3 / 4; display: grid; place-items: center; font-size: 12px; color: var(--text-3); }

.pw-slots { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.pw-slot { width: 280px; display: flex; flex-direction: column; gap: 6px; }
.pw-slot-lab { font-size: 13px; font-weight: 600; color: var(--text-2); }
.pw-slot-shot {
  width: 100%; aspect-ratio: 3 / 4; border-radius: var(--r-md); overflow: hidden;
  border: 0.5px solid var(--hair-strong); background: var(--surface-sunken);
}
.pw-slot-shot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.pw-slot-shot.is-empty { display: grid; place-items: center; border-style: dashed; }
/* 身材参考是全身图：整张放进格子，不裁（以前存的三联图被裁成只剩中间的侧面） */
.pw-slot[data-slot="body_ref_url"] .pw-slot-shot img { object-fit: contain; background: #fff; }
.pw-howto { flex: 1 1 320px; max-width: 560px; font-size: 13.5px; line-height: 1.6; padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface-sunken); }
.pw-howto p { margin: 4px 0; }
.pw-bodynote { margin-top: 14px; max-width: 760px; }
.pw-bodynote-text { display: block; width: 100%; margin: 8px 0; padding: 8px 10px; font: inherit; font-size: 14px; line-height: 1.6; border: 1px solid var(--hair-strong); border-radius: 10px; resize: vertical; }

.pw-body .facereal { margin-top: 8px; }

/* 大图：左边图占满，右边一栏对照 + 动作 */
.pw-viewer {
  width: min(1600px, 100%);
  height: calc(100vh - 2 * var(--sheet-pad));
  height: calc(100dvh - 2 * var(--sheet-pad));
  display: grid; grid-template-columns: minmax(0, 1fr) 300px;
  background: #111; border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-3);
}
.pw-v-stage { position: relative; min-height: 0; }
/* 绝对定位才拿得到确定的高度：网格里拉伸出来的格子，子元素 max-height:100% 不生效，竖图会溢出 */
.pw-v-stage img {
  position: absolute; inset: 0; margin: auto; display: block;
  max-width: calc(100% - 24px); max-height: calc(100% - 24px); object-fit: contain;
}
.pw-v-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0;
  border-radius: 12px; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 34px; cursor: pointer;
}
.pw-v-nav:disabled { opacity: 0.25; cursor: default; }
.pw-v-nav.is-prev { left: 12px; }
.pw-v-nav.is-next { right: 12px; }
.pw-v-side {
  background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow: auto;
}
.pw-v-head { display: flex; align-items: center; justify-content: space-between; }
.pw-v-count { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pw-v-title { font-size: 15px; font-weight: 650; }
.pw-v-sub { font-size: 12.5px; color: var(--text-2); }
.pw-v-ref { margin: 0; }
.pw-v-ref img { width: 100%; max-height: 220px; object-fit: contain; background: var(--surface-sunken); border-radius: var(--r-md); display: block; }
.pw-v-ref figcaption { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.pw-v-acts { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.pw-v-tip { font-size: 11.5px; color: var(--text-3); text-align: center; }

@media (max-width: 760px) {
  .pw-viewer { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .pw-v-side { max-height: 45vh; }
  .pw-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pw-pairs { grid-template-columns: 1fr; }
  .pw-tab:last-child { margin-left: 0; }
}

/* ③ 身材假人（body-mannequin.js）：左边 3D 舞台，右边参数 */
.mq { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
.mq-stage {
  position: relative; height: 680px; border-radius: var(--r-lg); overflow: hidden;
  background: #fff; border: 0.5px solid var(--hair-strong);
}
.mq-stage canvas { display: block; width: 100% !important; height: 100% !important; }
.mq-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); font-size: 13px; pointer-events: none; }
.mq-status:empty { display: none; }
.mq-hint {
  position: absolute; left: 12px; bottom: 10px; padding: 3px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 12px; pointer-events: none;
}
.mq-panel { display: flex; flex-direction: column; gap: 10px; max-height: 680px; overflow-y: auto; padding-right: 4px; }
.mq-panel > * { flex: none; }   /* 面板能滚，里面每块不许被压扁（男女切换曾被挤成一条线） */
.mq-seg { display: inline-flex; border: 0.5px solid var(--hair-strong); border-radius: 999px; overflow: hidden; align-self: flex-start; }
.mq-seg-btn { font: inherit; font-size: 14px; padding: 6px 22px; border: 0; background: none; cursor: pointer; color: var(--text-2); }
.mq-seg-btn.is-on { background: var(--accent); color: #fff; }
.mq-row { display: flex; flex-direction: column; gap: 3px; }
.mq-row-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.mq-row-lab { font-weight: 600; min-width: 4em; }
.mq-row-val { color: var(--text-2); font-variant-numeric: tabular-nums; }
.mq-auto { margin-left: auto; font: inherit; font-size: 12px; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; }
.mq-row input[type="range"] { width: 100%; }
.mq-row input.is-auto { opacity: 0.55; }
.mq-select { font-size: 13px; padding: 4px 8px; }
.mq-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.mq-note { font-size: 12px; line-height: 1.5; color: var(--text-2); padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-sunken); }
.mq-ends { font-size: 11.5px; color: var(--text-3); margin-top: -6px; }
.mq-parts { border-top: 0.5px solid var(--hair); padding-top: 6px; }
.mq-parts > summary { font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.mq-parts-body { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.mq-parts-body .mq-auto { align-self: flex-end; }
.mq-actions { margin-top: auto; display: flex; gap: 8px; }
@media (max-width: 760px) {
  .mq { grid-template-columns: 1fr; }
  .mq-stage { height: 440px; }
}
.mq-row[hidden] { display: none; }

/* ① 已选的底图：一排小图，× 取消 */
.pw-chosen { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; min-height: 64px;
  padding: 8px 10px; border-radius: var(--r-md); background: var(--surface-sunken); }
.pw-chosen-lab { font-size: 13px; color: var(--text-2); margin-right: 4px; }
.pw-chosen-item { position: relative; }
.pw-chosen-item img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-sm); display: block; cursor: zoom-in; }
.pw-chosen-item .pw-x-mark { width: 20px; height: 20px; top: -6px; right: -6px; font-size: 13px; }
.pw-body .fl-embed { margin-top: 6px; }
.pw-result .btn { margin: 6px; }
.pw-real-note { margin: 6px 6px 0; font-size: 12px; color: var(--text-2); line-height: 1.4; }

/* 从项目头点正脸 / 侧脸进来时，那一格闪一下 */
.pw-slot.is-focus { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--r-md); transition: outline-color .3s; }
