:root {
  --bg: #14100e; --surface: #221a15; --ink: #f4ece5; --sub: rgba(244, 236, 229, .55);
  --line: rgba(255, 255, 255, .08); --accent: #e2a58e; --accent2: #bb6f7a; --on: #fff;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: radial-gradient(120% 46% at 50% 0%, #261c16 0%, rgba(38, 28, 22, 0) 62%), var(--bg);
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; }

/* 分屏骨架: 一屏一件事, 内容区可滚, 底部按钮固定 */
.app { max-width: 430px; margin: 0 auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
/* 电脑上打开(老板评审/发链接): 收成一台"手机", 不做成细长条 */
@media (min-width: 520px) {
  .app {
    height: calc(100vh - 64px); height: calc(100dvh - 64px); margin: 32px auto;
    border-radius: 38px; overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .07);
  }
}
#screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pg { flex: 1; min-height: 0; display: flex; flex-direction: column; animation: pgin .28s ease-out; }
@keyframes pgin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scrollarea { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 22px 8px; }
.foot { flex: none; padding: 10px 22px calc(14px + env(safe-area-inset-bottom)); }

/* 通用元素 */
.primary {
  display: block; width: 100%; padding: 17px 0; border: none; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on);
  font-size: 17px; font-weight: 600; letter-spacing: .06em; cursor: pointer;
  box-shadow: 0 10px 26px rgba(187, 111, 122, .38);
  transition: transform .12s ease;
}
.primary:active { transform: scale(.98); }
.primary[disabled] { opacity: .6; }
.ghost {
  display: block; width: 100%; padding: 16px 0; border: 1px solid var(--line);
  border-radius: 16px; background: rgba(255, 255, 255, .07); color: var(--ink);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.ghost:active { transform: scale(.98); }
.link {
  border: none; background: none; color: var(--sub); font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

/* 屏1: 传照片 —— 全屏模特大图压底, 标题+按钮浮在图上 */
.pg-photo { position: relative; overflow: hidden; }
.pg-photo .homeanim { position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; }
.pg-photo .homevid {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; width: 100%; height: 100%;
  object-fit: cover; pointer-events: none;
}
.pg-photo .homeanim img {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 16%;
  opacity: 0; will-change: opacity, transform;
  animation: homefade 10.8s ease-in-out infinite, homezoom 7.5s ease-in-out infinite alternate;
}
.pg-photo .homeanim img:nth-child(2) { animation-delay: -3.6s; }
.pg-photo .homeanim img:nth-child(3) { animation-delay: -7.2s; }
@keyframes homefade {
  0% { opacity: 1; } 24% { opacity: 1; } 33.3% { opacity: 0; }
  92% { opacity: 0; } 100% { opacity: 1; }
}
@keyframes homezoom { from { transform: scale(1.03); } to { transform: scale(1.12); } }
.pg-photo .homeshade {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 7, 6, .38) 0%, rgba(10, 7, 6, .06) 26%,
    rgba(10, 7, 6, .58) 58%, rgba(10, 7, 6, .94) 82%, #0f0b0a 100%);
}
.pg-photo .scrollarea { position: relative; display: flex; flex-direction: column; }
.pg-photo .foot { position: relative; }
.brand { font-size: 12px; letter-spacing: .24em; color: rgba(255, 255, 255, .7); text-align: center; }
.h1 {
  margin: auto 0 8px; font-size: 34px; font-weight: 800; line-height: 1.34;
  letter-spacing: .01em; color: #fff; text-shadow: 0 2px 18px rgba(0, 0, 0, .3);
  text-align: center;
}
.sub {
  font-size: 13.5px; color: rgba(255, 255, 255, .78); letter-spacing: .04em;
  line-height: 1.6; text-shadow: 0 1px 10px rgba(0, 0, 0, .35); text-align: center;
}
.pg-photo .foot .primary { max-width: 340px; margin: 0 auto; }   /* 对称居中 */
.hl { color: var(--accent); }
.pg-photo.has-photo .h1 { margin: 16px 0 14px; }
.preview {
  display: block; width: 100%; max-height: 52vh; object-fit: cover;
  margin: auto 0 0; border-radius: 20px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .5);
}
.repick-row { margin: 14px 0 auto; text-align: center; }
.primary.cta { display: flex; align-items: center; justify-content: center; gap: 9px; }
.ctaic { width: 20px; height: 20px; flex: none; }
.ver { text-align: center; font-size: 11px; color: rgba(255, 255, 255, .42); margin-top: 10px; }

/* 屏2: 挑款 */
.prow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.pthumb { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; }
.h2 { margin: 10px 0 16px; font-size: 22px; }
.styles-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.scard {
  display: flex; flex-direction: column; gap: 3px; text-align: left; min-width: 0;
  padding: 10px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform .1s ease, border-color .1s ease;
}
.scard:active { transform: scale(.97); border-color: rgba(226, 165, 142, .6); }
.scard-img {
  display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: 10px; margin-bottom: 7px;
}
.smedia { position: relative; display: block; }
.vbadge {
  position: absolute; right: 7px; top: 7px; padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; color: #fff; background: rgba(12, 8, 6, .62);
  border: 1px solid rgba(255, 255, 255, .38);
}
.vlay {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 60;
  background: rgba(8, 5, 4, .93); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 0 22px;
}
.vlay .vv { width: auto; max-width: 100%; max-height: 66vh; border-radius: 18px; }
.vlay .vname { color: #f2e7e0; margin: 16px 0 14px; font-size: 15px; }
.vsnd {
  margin-left: 10px; padding: 4px 12px; border-radius: 99px; font-size: 12px;
  border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .1);
  color: #fff; cursor: pointer; vertical-align: 1px;
}
.vlay .vtry { width: 78%; max-width: 320px; }
.vx {
  position: absolute; right: 16px; top: 16px; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .08); color: #fff; font-size: 21px; line-height: 1;
  cursor: pointer;
}
.sname { font-size: 14px; font-weight: 600; padding: 0 2px; }
.sfit {
  font-size: 11px; color: var(--sub); line-height: 1.4; padding: 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 屏3: 生成中 */
.pg-gen { align-items: center; justify-content: center; }
.genbox { width: 100%; padding: 0 34px; text-align: center; }
.genphoto {
  width: 84px; height: 84px; border-radius: 22px; object-fit: cover;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 165, 142, .4); }
  50% { box-shadow: 0 0 0 16px rgba(226, 165, 142, 0); }
}
.ptxt { font-size: 14px; margin: 22px 0 14px; }
.bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.bar i {
  display: block; height: 100%; width: 5%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .9s ease;
}
.err {
  background: rgba(214, 104, 84, .14); border: 1px solid rgba(214, 104, 84, .4);
  border-radius: 12px; padding: 12px 14px; font-size: 13px; color: #f2b4a3;
  line-height: 1.7; text-align: left;
}
.errbtns { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }

/* 屏4: 结果 */
.rhead {
  flex: none; display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 22px 10px;
}
.rname { font-size: 17px; font-weight: 700; }
.rhint { font-size: 12px; color: var(--sub); }
.hint-ok { font-size: 12px; color: #8fc79a; }
.rbig {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 0 22px;
}
.rimg {
  max-width: 100%; max-height: 100%; border-radius: 16px;
  object-fit: cover;      /* 原照/效果图都填满同一框: 显示尺寸完全一致(裁边缘, 主体保留) */
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55);
  transition: opacity .35s ease;
}
.thumbs {
  flex: none; display: flex; gap: 8px; overflow-x: auto;
  padding: 12px 22px 2px;
}
.thumb {
  width: 50px; height: 62px; object-fit: cover; border-radius: 10px;
  border: 2px solid transparent; opacity: .65; cursor: pointer; flex: none;
}
.thumb.on { border-color: var(--accent); opacity: 1; }
.pills {
  flex: none; display: flex; flex-wrap: wrap; justify-content: center;
  padding: 12px 22px 2px;
}
.pills .pill + .pill { margin-left: 8px; }   /* 老微信内核不支持 flex gap */
.pill {
  padding: 7px 16px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06); color: rgba(244, 236, 229, .75);
  font-size: 13px; cursor: pointer;
}
.pill.on {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent; color: #fff; font-weight: 600;
}
.pill.soon { opacity: .45; }   /* 后台生成中: 弱化, 好一个点亮一个 */
.pill, .thumb { transition: transform .1s ease, background .15s ease, opacity .15s ease; }
.pill:active, .thumb:active { transform: scale(.94); }
.rfoot { display: flex; }
.rfoot > * + * { margin-left: 10px; }
.rfoot .primary { flex: 1; }
.rfoot .ghost { flex: none; width: 112px; padding: 17px 0; }
