:root {
  --bg: #0f0f0f;
  --card: #1d1d1d;
  --accent: #ff5151;
  --grad-pink: linear-gradient(180deg, #f3cee5 0%, #cf7aff 100%);
  --grad-white: linear-gradient(180deg, #ffffff 0%, #bcbcbc 100%);
  --muted: rgba(255, 255, 255, 0.55);
  --line: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: #fff;
  font-family: Inter, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body { min-height: 100vh; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

button { font-family: inherit; }

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 1100px 560px at 50% -8%, rgba(104, 54, 130, 0.85), rgba(63, 37, 77, 0.5) 42%, rgba(15, 15, 15, 0) 72%),
    linear-gradient(180deg, rgba(63, 37, 77, 0.6) 0%, rgba(15, 15, 15, 0.36) 50%, rgba(15, 15, 15, 0) 100%);
}

.side {
  position: absolute;
  top: 72px;
  height: calc(100vh - 72px);
  z-index: 1;
  opacity: 0.6;
  pointer-events: none;
  overflow: hidden;
}
.side-l { left: 0; }
.side-r { right: 0; }
.side img { display: block; height: 100%; width: auto; }

.head {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--headGap, 44px);
  padding: 16px 24px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  color: #fff;
  text-decoration: none;
  transform: scale(1.2);
  transform-origin: center;
}
.logo-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  line-height: 1;
  padding-top: 2px;
}

.steps-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.back {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #1d1d1d;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.back:hover { background: #2a2a2a; }
.back[hidden] { display: none; }

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.step {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  cursor: default;
  padding: 0;
  transition: background 0.25s, color 0.25s, transform 0.25s;
}
.step svg { width: 18px; height: 18px; fill: currentColor; }
.step.done { background: var(--grad-pink); color: #17121c; cursor: pointer; }
.step.done:hover { transform: scale(1.06); }
.step.now { background: var(--grad-pink); color: #17121c; }
.step.future { pointer-events: none; }

.stepper .link {
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 1px;
}
.stepper .link.on { background: #dca6ff; }

.main {
  position: relative;
  z-index: 2;
  padding: 0 24px var(--mainPb, 170px);
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title {
  margin: var(--heroMt, 15px) 0 0;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}
.hero-title .grad {
  background: linear-gradient(96deg, #ffb7d5 0%, #ff8fd0 38%, #c77aff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.section-title {
  margin: var(--secMt, 28px) 0 var(--secMb, 27px);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.sub-title {
  margin: var(--subMt, 46px) 0 var(--subMb, 22px);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

/* ---------- 选项卡片 ---------- */

.cards {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.cards::-webkit-scrollbar { display: none; }

.cards .track {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: max-content;
  margin: 0 auto;
  padding: var(--trackPad, 22px) 12px;
}

.card {
  position: relative;
  flex: 0 0 auto;
  width: var(--cw, 202px);
  height: var(--ch, 359px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.22, 0.68, 0.24, 1), margin 0.35s cubic-bezier(0.22, 0.68, 0.24, 1), box-shadow 0.3s, filter 0.3s;
  -webkit-tap-highlight-color: transparent;
}
.card img,
.card video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.card video { z-index: 1; }
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.72) 100%);
  pointer-events: none;
}
.card .lbl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  z-index: 3;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.65);
}
.card .check {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  width: 20px;
  height: 20px;
  display: none;
  border-radius: 50%;
  background: #ff5151;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.card:not(.on) { filter: brightness(0.78); }
.card:hover:not(.on) { filter: brightness(0.95); }

.card.on {
  transform: scale(1.114);
  margin: 0 calc(var(--cw, 202px) * 0.057);
  box-shadow: 0 0 0 2px #ff5151, 0 18px 44px rgba(0, 0, 0, 0.5);
  z-index: 5;
  filter: none;
}
.card.on .check { display: block; }

/* 画风：两张竖版大卡，选中不放大 */
.cards.style { --cw: min(clamp(240px, 24vw, 480px), var(--styleCw, 480px)); }
.cards.style .card { height: auto; aspect-ratio: 2 / 3; }
.cards.style .track { padding-top: 12px; }
.cards.style .card.on {
  transform: none;
  margin: 0;
  box-shadow: 0 0 0 2px #ff5151, 0 18px 44px rgba(0, 0, 0, 0.5);
}

/* 性格：原图 9:16，卡片按同比例给宽，整张图不裁切；步骤只有 4 张，卡再放大一档 */
.cards[data-key="personality"] { --ch: min(560px, 55vh); --cw: calc(var(--ch) * 0.5625); }
.cards[data-key="personality"] .track {
  padding-top: max(12px, calc(var(--ch) * 0.06));
  padding-bottom: max(12px, calc(var(--ch) * 0.06));
}

/* ---------- 年龄 ---------- */

.age-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 640px;
  max-width: calc(100vw - 48px);
  margin-top: var(--ageMt, 28px);
}
.age-block .age-title {
  margin: 18px 0 22px;
  font-size: 24px;
  font-weight: 600;
}
.age-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 16px;
  background: #ff5151;
  color: #0f0f0f;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.age-slider {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin-top: 22px;
}
.age-slider span {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex: 0 0 auto;
}
.age-slider input {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  outline: none;
  background: linear-gradient(90deg, #fff 0 var(--p, 8%), #3d3d3d var(--p, 8%) 100%);
  cursor: pointer;
}
.age-slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 4px;
  height: 46px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
}
.age-slider input::-moz-range-thumb {
  width: 4px;
  height: 46px;
  border: 0;
  border-radius: 2px;
  background: #fff;
}
.age-slider input::-moz-range-track { height: 4px; background: #3d3d3d; border-radius: 2px; }

/* ---------- 发色 / 眼睛 ---------- */

.swatches {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}
.swatch {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  position: relative;
  background: var(--c);
  transition: transform 0.2s, box-shadow 0.2s;
}
.swatch:hover { transform: scale(1.06); }
.swatch.on {
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.swatch.on::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.swatch.on.light::after { color: #0f0f0f; }

/* ---------- 声音 ---------- */

.voices-title {
  margin: var(--voiceMt, 58px) 0 var(--voiceMb, 30px);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
}

.voices {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  width: 640px;
  max-width: calc(100vw - 32px);
}
.voice {
  width: 151px;
  height: var(--voiceH, 120px);
  flex: 1 1 0;
  min-width: 0;
  max-width: 151px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 0;
  border-radius: 16px;
  background: var(--card);
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: box-shadow 0.25s, color 0.25s, transform 0.2s;
}
.voice:hover { color: #fff; }
.voice.on {
  box-shadow: 0 0 0 2px #ff5151;
  color: #fff;
}
.voice .vic {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.25s;
}
.voice.on .vic { background: rgba(255, 255, 255, 0.14); }
.voice .vic svg { width: 18px; height: 18px; fill: currentColor; }
.voice .vlabel { font-size: 16px; font-weight: 600; }
.voice.speaking .vic { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}

/* ---------- 摘要 ---------- */

/* 对齐参考站：2×3 大图卡 + 一行信息卡（性格/年龄/发色/声音） */
.sum-wrap {
  --sumCardH: clamp(150px, 27.5vh, 300px);
  --sumCardW: calc(var(--sumCardH) * 2 / 3);
  --sumGap: clamp(8px, 1.1vh, 12px);
  --sumInfoH: clamp(64px, calc(var(--sumCardH) * 0.39), 120px);
  width: min(calc(var(--sumCardW) * 3 + var(--sumGap) * 2), 92vw);
  margin: 0 auto;
}
.sum-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sumGap);
}
.sum-card {
  position: relative;
  height: var(--sumCardH);
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  overflow: hidden;
  cursor: pointer;
  color: #fff;
}
.sum-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.sum-card:hover img { transform: scale(1.03); }
.sum-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.72) 100%);
}
.sum-card .lbl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  z-index: 2;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}
.sum-info {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sumGap);
  margin-top: var(--sumGap);
}
.si {
  height: var(--sumInfoH);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 6px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}
.si:hover { background: #26262e; }
.si-media { display: grid; place-items: center; }
.si-face {
  width: calc(var(--sumInfoH) * 0.36);
  height: calc(var(--sumInfoH) * 0.36);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 12%;
}
.si-num {
  font-size: clamp(16px, calc(var(--sumInfoH) * 0.2), 24px);
  font-weight: 600;
  line-height: 1;
}
.si .dot {
  width: calc(var(--sumInfoH) * 0.32);
  height: calc(var(--sumInfoH) * 0.32);
  border-radius: 50%;
  background: var(--c);
}
.si .spk {
  width: calc(var(--sumInfoH) * 0.34);
  height: calc(var(--sumInfoH) * 0.34);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
}
.si-cap {
  font-size: clamp(10.5px, 1.2vh, 12px);
  color: var(--muted);
  white-space: nowrap;
}
.si-cap em { font-style: normal; color: #fff; font-weight: 600; }

/* ---------- 底部操作栏 ---------- */

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(14, 14, 14, 0) 0%, #0e0e0e 72%);
  pointer-events: none;
}
.footer button { pointer-events: auto; }

.btn-back,
.btn-next {
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 24px;
  color: #0f0f0f;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
}
.btn-back:hover,
.btn-next:hover { filter: brightness(1.05); }
.btn-back:active,
.btn-next:active { transform: scale(0.98); }
.btn-back {
  width: 95px;
  background: var(--grad-white);
}
.btn-back svg { stroke: #0f0f0f; }
.btn-back[hidden] { display: none; }
.btn-next {
  width: 229px;
  background: var(--grad-pink);
}
.footer .btn-next.wide { width: 336px; }
.footer .btn-next .spark { font-size: 17px; line-height: 1; }

/* ---------- 响应式 ---------- */

/* 桌面端：纵向尺寸随视口高度收缩，1080P（含缩放屏）下不出现滚动条 */
@media (min-width: 761px) {
  :root {
    --headGap: min(44px, 4.2vh);
    --heroMt: min(15px, 1.8vh);
    --secMt: min(28px, 3.4vh);
    --secMb: min(27px, 3.2vh);
    --trackPad: clamp(8px, 2.4vh, 22px);
    --cw: 232px;
    --ch: min(460px, 45vh);
    --ageMt: min(28px, 3.4vh);
    --subMt: min(46px, 5.6vh);
    --subMb: min(22px, 2.6vh);
    --voiceMt: min(58px, 6vh);
    --voiceMb: min(30px, 3.2vh);
    --voiceH: min(120px, 13vh);
    --mainPb: clamp(64px, 11.5vh, 170px);
    --styleCw: 44vh;
  }
  /* LOGO 挪到左上角，步骤条居中上移，把纵向空间让给图片 */
  .head { padding-top: 14px; }
  .logo {
    position: absolute;
    left: 24px;
    top: 18px;
    transform: scale(1.12);
    transform-origin: left center;
  }
}

/* 较矮视口：发型/声音等步骤同步压缩 */
@media (min-width: 761px) and (max-height: 1000px) {
  :root {
    --headGap: min(44px, 3.8vh);
    --subMt: min(34px, 3.2vh);
    --subMb: min(16px, 2vh);
    --voiceMt: min(40px, 4.2vh);
    --voiceMb: min(22px, 2.2vh);
    --voiceH: min(104px, 11vh);
  }
  .swatch { width: min(40px, 4.4vh); height: min(40px, 4.4vh); }
}

/* 更矮视口（900 及以下）：卡片和间距再收一档 */
@media (min-width: 761px) and (max-height: 920px) {
  :root {
    --secMt: min(28px, 2.2vh);
    --secMb: min(27px, 2vh);
    --ch: min(460px, 41vh);
    --ageMt: min(28px, 2.6vh);
    --subMt: min(34px, 2.6vh);
    --subMb: min(16px, 1.6vh);
    --voiceMt: min(40px, 3.6vh);
    --voiceMb: min(22px, 2vh);
    --voiceH: min(104px, 9.5vh);
  }
  .swatch { width: min(40px, 3.8vh); height: min(40px, 3.8vh); }
  .age-block .age-title { margin: 10px 0 12px; }
  .age-slider { margin-top: 12px; }
}

@media (max-width: 1100px) {
  .side { display: none; }
}

@media (max-width: 760px) {
  .head { gap: 14px; padding: 14px 14px 0; }
  .logo { height: 28px; transform: scale(1); }
  .logo svg { width: 28px; height: 19px; }
  .logo-text { font-size: 20px; letter-spacing: 2px; }
  .back {
    position: fixed;
    top: 20px;
    left: 14px;
    z-index: 30;
    width: 30px;
    height: 30px;
    background: transparent;
  }
  .steps-row { gap: 0; width: 100%; }
  .stepper { width: 100%; justify-content: space-between; }
  .step { width: 28px; height: 28px; }
  .step svg { width: 16px; height: 16px; }
  .stepper .link { width: auto; flex: 1 1 auto; max-width: 21px; margin: 0 2px; }

  .main { padding: 0 14px 150px; }
  .hero-title { font-size: 28px; margin: 18px 0 6px; white-space: normal; }
  .section-title { font-size: 20px; margin: 16px 0 34px; }
  .sub-title { font-size: 15px; margin: 34px 0 18px; }
  .voices-title { font-size: 20px; margin: 40px 0 22px; }

  .cards .track { padding: 20px 10px 20px; }
  .card { border-radius: 14px; }
  .card .lbl { font-size: 15px; bottom: 10px; }
  .card.on { transform: none; margin: 0; }
  .cards.style { --cw: calc(50vw - 24px); }
  .cards.style .card { aspect-ratio: 9 / 20; }

  .age-block { width: 100%; }
  .age-block .age-title { font-size: 20px; margin: 14px 0 18px; }
  .age-slider { gap: 10px; }

  .swatch { width: 36px; height: 36px; }

  .voices { gap: 8px; width: 100%; }
  .voice { height: 104px; border-radius: 14px; gap: 10px; }
  .voice .vlabel { font-size: 14px; }

  .sum-wrap { --sumCardH: auto; --sumInfoH: 92px; width: 100%; }
  .sum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sum-card { height: auto; aspect-ratio: 2 / 3; }
  .sum-card .lbl { bottom: 10px; font-size: 14px; }
  .sum-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .footer { height: 112px; }
  .btn-back { width: 95px; }
  .btn-next { width: 229px; }
  .footer .btn-next.wide { width: 300px; }
}
