:root {
  --purple: #6d5bd0;
  --purple-2: #8b7cf0;
  --purple-3: #b9aef7;
  --bg: #f6f4fd;
  --ink: #1f1b2e;
  --ink-2: #54506b;
  --ink-3: #8d88a3;
  --line: #ece8f7;
  --white: #fff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(88, 70, 170, .10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 18px 120px;
  position: relative;
}

.screen { display: none; animation: fade .28s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 首屏决策前先隐藏，避免闪现 */
body.booting .app { opacity: 0; }
body.ready .app { opacity: 1; transition: opacity .2s ease; }

/* ---------------- 入口解锁 ---------------- */
.gate { text-align: center; padding: 100px 8px 0; }
.gate-lock {
  width: 64px; height: 64px; margin: 0 auto 20px;
  border-radius: 50%; background: #f1edfd;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.gate-title { font-size: 24px; font-weight: 700; margin: 0 0 10px; letter-spacing: .5px; }
.gate-sub { font-size: 13px; color: var(--ink-3); margin: 0 0 30px; }
.gate-input {
  width: 100%; text-align: center; font-size: 30px; letter-spacing: 14px;
  padding: 18px 10px 18px 24px; border-radius: 16px;
  border: 1.5px solid var(--line); background: #fff; outline: none;
  font-family: inherit; transition: border-color .2s, box-shadow .2s;
  color: var(--ink);
}
.gate-input::placeholder { letter-spacing: 10px; color: #cfcadf; }
.gate-input:focus { border-color: var(--purple-2); box-shadow: 0 4px 18px rgba(109,91,208,.12); }
.gate-input.shake { animation: shake .3s ease; border-color: #e08a8a; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.gate-msg { font-size: 13px; color: #d05a5a; min-height: 20px; margin: 12px 0 0; }

/* ---------------- 首页 ---------------- */
.hero {
  margin: 0 -18px;
  padding: 44px 30px 40px;
  background: linear-gradient(155deg, #6d5bd0 0%, #8b7cf0 55%, #b9aef7 100%);
  border-radius: 0 0 28px 28px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.12);
}
.hero-quote {
  font-family: Georgia, serif; font-size: 60px; line-height: .6;
  opacity: .45; margin-bottom: 14px;
}
.hero-title {
  font-size: 27px; line-height: 1.42; font-weight: 700;
  margin: 0 0 16px; letter-spacing: .5px;
}
.hero-sub {
  margin: 0; font-size: 13.5px; opacity: .88; font-weight: 400;
}

.intro-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 18px; margin: -26px 0 22px;
  box-shadow: var(--shadow); position: relative; z-index: 2;
}
.intro-desc {
  margin: 0 0 14px; padding-bottom: 14px;
  border-bottom: 1px dashed #ece8f7;
  font-size: 13.5px; line-height: 1.85; color: var(--ink-2);
  text-align: justify;
}
.intro-row {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: var(--ink-2); padding: 7px 0;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--purple-2); margin-top: 8px; flex: none;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: block; width: 100%; border: none; cursor: pointer;
  border-radius: 14px; padding: 15px 18px;
  font-size: 16px; font-weight: 600; font-family: inherit;
  transition: transform .12s ease, opacity .2s ease;
  text-align: center; text-decoration: none;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: linear-gradient(135deg, #6d5bd0, #8b7cf0);
  color: #fff; box-shadow: 0 8px 20px rgba(109, 91, 208, .30);
  margin-top: 12px;
}
.btn-ghost {
  background: transparent; color: var(--ink-3);
  font-weight: 500; font-size: 14px; padding: 12px;
}
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-sm { width: auto; padding: 10px 18px; font-size: 14px; margin: 0; border-radius: 12px; }

.foot-note {
  text-align: center; font-size: 11.5px; color: var(--ink-3);
  margin: 26px 0 10px; line-height: 1.7;
}

/* ---------------- 答题 ---------------- */
.quiz-top {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 14px;
}
.icon-btn {
  border: none; background: var(--white); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 50%;
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(88,70,170,.08); flex: none;
}
.progress-wrap { flex: 1; }
.progress-bar {
  height: 5px; background: #e8e3f8; border-radius: 99px; overflow: hidden;
}
.progress-bar i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #6d5bd0, #a99bf7);
  border-radius: 99px; transition: width .3s ease;
}
.progress-text { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; text-align: right; }

.q-card {
  background: var(--white); border-radius: 22px;
  padding: 24px 20px 20px; box-shadow: var(--shadow);
}
.q-tag {
  display: inline-block; font-size: 11.5px; color: var(--purple);
  background: #f1edfd; padding: 4px 11px; border-radius: 99px;
  margin-bottom: 14px; letter-spacing: .3px;
}
.q-scene {
  background: #faf8ff; border-left: 3px solid var(--purple-3);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
}
.q-scene-text {
  margin: 0; font-size: 15px; color: var(--ink-2); line-height: 1.85;
}
.q-text {
  font-size: 18px; line-height: 1.62; font-weight: 600;
  margin: 0 0 22px; letter-spacing: .2px;
}
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fbfaff; border: 1.5px solid var(--line);
  border-radius: 14px; padding: 14px 14px;
  cursor: pointer; transition: all .16s ease; text-align: left;
  font-family: inherit; font-size: 14.5px; color: var(--ink); line-height: 1.55;
  position: relative; overflow: hidden;
}
.opt.chosen::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px;
  width: 0; background: linear-gradient(90deg, #6d5bd0, #a294f6);
  animation: optfill .5s linear forwards;
}
@keyframes optfill { from { width: 0; } to { width: 100%; } }
.opt:active { transform: scale(.99); }
.opt .k {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: #ece8f9; color: var(--purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-top: 1px;
}
.opt.chosen {
  border-color: var(--purple-2); background: #f4f1ff;
  box-shadow: 0 4px 14px rgba(109,91,208,.14);
}
.opt.chosen .k { background: var(--purple); color: #fff; }

/* ---------------- 结果 ---------------- */
.result-hero {
  margin: 0 -18px; padding: 36px 24px 30px;
  background: linear-gradient(160deg, #efeaff 0%, #f8f5ff 60%, #fdfbff 100%);
  border-radius: 0 0 30px 30px; text-align: center;
}
.result-label { font-size: 12.5px; color: var(--ink-3); letter-spacing: 1px; }
.match-num {
  font-size: 62px; font-weight: 800; line-height: 1.05;
  background: linear-gradient(135deg, #5b48c8, #9b8cf5);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin: 8px 0 2px; letter-spacing: -1px;
}
.match-num em { font-size: 26px; font-style: normal; margin-left: 2px; }
.figure-name {
  font-size: 34px; font-weight: 800; letter-spacing: 6px;
  margin: 4px 0 6px; text-indent: 6px;
}
.figure-role { font-size: 13px; color: var(--ink-2); letter-spacing: .5px; }
.tags { display: flex; gap: 8px; justify-content: center; margin: 16px 0 10px; flex-wrap: wrap; }
.tags span {
  font-size: 12.5px; color: #5b48c8; background: #fff;
  border: 1px solid #e3dcfb; padding: 5px 14px; border-radius: 99px;
}
.topdim {
  display: inline-block; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, #7c6ade, #9b8cf5);
  padding: 6px 16px; border-radius: 99px; margin-top: 8px;
}

.voice-card {
  margin: 18px 0 0; background: var(--white); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
  border-left: 3px solid var(--purple-3);
}
.voice-label { font-size: 11.5px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: .5px; }
.voice-text { font-size: 15.5px; color: var(--ink); font-weight: 500; line-height: 1.7; }

.sec {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; margin-top: 14px; box-shadow: var(--shadow);
}
.sec-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.sec-no {
  font-size: 12px; color: var(--purple); font-weight: 700;
  letter-spacing: 1px; opacity: .8;
}
.sec-title { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.sec-body { font-size: 14.5px; color: var(--ink-2); line-height: 1.85; white-space: pre-line; }

.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-name { width: 40px; font-size: 13px; color: var(--ink-2); flex: none; }
.bar-track { flex: 1; display: block; height: 7px; background: #efebfb; border-radius: 99px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #6d5bd0, #a294f6);
  width: 0; transition: width .7s cubic-bezier(.2,.8,.2,1);
}
.bar-val { width: 28px; text-align: right; font-size: 12.5px; color: var(--ink-3); flex: none; }

.sub-card {
  background: #faf8ff; border-radius: 14px; padding: 14px 16px; margin-top: 10px;
}
.sub-card h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--purple); font-weight: 700; }
.sub-card p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.8; }

.line-item {
  font-size: 15px; color: var(--ink); line-height: 1.8;
  padding: 12px 16px; background: #faf8ff; border-radius: 12px; margin-top: 9px;
  border-left: 2px solid var(--purple-3);
}

.sec-locked {
  background: #fbfaff; border: 1px dashed #ddd5f7;
  color: var(--ink-3); display: flex; align-items: center; gap: 10px;
  justify-content: space-between;
}
.sec-locked .lock-ico {
  width: 26px; height: 26px; border-radius: 50%; background: #efebfb;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}

.alt-box {
  margin-top: 22px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #f7f4ff 0%, #fdfbff 70%);
  border: 1px solid #e9e2fb; border-radius: 18px;
  padding: 16px 14px 12px;
}
.alt-box::before {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(150,132,245,.16), transparent 70%);
}
.alt-title {
  font-size: 12.5px; color: var(--ink-3); margin-bottom: 11px;
  text-align: center; letter-spacing: .3px; position: relative;
}
.alt-list { display: flex; gap: 10px; position: relative; }
.alt-item {
  flex: 1; background: #fff; border-radius: 14px;
  padding: 14px 8px 12px; text-align: center;
  box-shadow: 0 4px 14px rgba(88,70,170,.07);
}
.alt-item b {
  display: block; font-size: 17px; font-weight: 700;
  letter-spacing: 2px; margin-bottom: 3px; text-indent: 2px;
}
.alt-item span { font-size: 12px; color: var(--ink-3); }
.alt-item.locked { background: #fff; border: 1px dashed #ddd5f7; }
.alt-pct {
  font-size: 24px; font-weight: 800; line-height: 1.2;
  background: linear-gradient(135deg, #6d5bd0, #a294f6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.alt-pct i { font-size: 13px; font-style: normal; margin-left: 1px; }
.alt-lock {
  font-size: 11.5px; color: #a8a3bb; margin-top: 6px;
  background: #f5f2fd; border-radius: 99px; padding: 3px 0;
}
.alt-cta {
  display: block; width: 100%; margin-top: 12px; padding: 8px 0 2px;
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--purple); position: relative;
}

.result-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 4px; }

/* ---------------- 底部支付条 ---------------- */
.paybar {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 480px; margin: 0 auto;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 -6px 24px rgba(88,70,170,.10);
  border-top: 1px solid var(--line); z-index: 30;
}
.paybar-info { flex: 1; min-width: 0; }
.paybar-title { font-size: 14px; font-weight: 600; }
.paybar-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- 弹窗 ---------------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(24,18,45,.45); }
.modal-body {
  position: relative; width: 100%; max-width: 480px;
  background: #fff; border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .26s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute; right: 14px; top: 12px; border: none; background: none;
  font-size: 24px; color: var(--ink-3); cursor: pointer; line-height: 1;
}
.modal-title { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.modal-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.modal-foot { font-size: 12px; color: #d05a5a; text-align: center; min-height: 18px; margin: 12px 0 0; }

.tabs { display: flex; background: #f4f1fd; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tab {
  flex: 1; border: none; background: none; padding: 9px; border-radius: 9px;
  font-size: 14px; color: var(--ink-3); cursor: pointer; font-family: inherit;
}
.tab.active { background: #fff; color: var(--purple); font-weight: 600; box-shadow: 0 2px 8px rgba(88,70,170,.10); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font-size: 16px; font-family: inherit;
  letter-spacing: 2px; text-transform: uppercase; background: #fbfaff;
  outline: none; transition: border-color .2s;
}
.input:focus { border-color: var(--purple-2); background: #fff; }

.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin: 12px 0 0; }

.plan {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 14px; margin-bottom: 10px; background: #fbfaff;
}
.plan.plan-deep {
  border-color: #ded5fb; background: linear-gradient(135deg, #f7f3ff, #fdfbff);
  box-shadow: 0 4px 16px rgba(109, 91, 208, .08);
}
.plan-info { flex: 1; min-width: 0; }
.plan-name { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }
.plan-name i {
  font-style: normal; font-size: 10.5px; font-weight: 600;
  color: #fff; background: linear-gradient(135deg, #6d5bd0, #9b8cf5);
  padding: 2px 7px; border-radius: 99px; margin-left: 4px; vertical-align: 1px;
}
.plan-desc { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }
.plan-btn {
  flex: none; border: none; cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, #6d5bd0, #8b7cf0); color: #fff;
  border-radius: 12px; padding: 10px 16px; font-size: 15px; font-weight: 700;
}
.plan-btn:disabled { opacity: .55; }

.price-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; background: #faf8ff; border-radius: 12px; margin-bottom: 6px;
  font-size: 14px; color: var(--ink-2);
}
.price-line b { font-size: 22px; color: var(--purple); }

.pay-result { margin-top: 14px; font-size: 13px; color: var(--ink-2); text-align: center; }
.pay-result a {
  display: block; margin-top: 10px; padding: 13px;
  background: #07c160; color: #fff; border-radius: 12px;
  text-decoration: none; font-weight: 600;
}

.share-preview { text-align: center; margin: 6px 0 14px; }
.share-preview canvas { width: 100%; max-width: 320px; border-radius: 14px; box-shadow: var(--shadow); }
.share-preview img { width: 100%; display: block; border-radius: 14px; box-shadow: var(--shadow); }
.save-tip {
  margin: 14px 0 0; padding: 12px 14px; border-radius: 12px;
  background: #f5f2ff; color: #5b48c8;
  font-size: 13px; line-height: 1.7; text-align: center;
}
.save-tip b { font-weight: 700; color: #4b39b8; }

.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(30,22,55,.9); color: #fff; padding: 12px 20px;
  border-radius: 12px; font-size: 13.5px; z-index: 99; max-width: 78vw;
  text-align: center; line-height: 1.6;
}
