/* ============================================================
   全局
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%;
  /* 字体栈覆盖 iOS / Android / Windows / macOS，避免各平台落到不同默认字体导致排版差异 */
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "WenQuanYi Micro Hei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f3f1f8;
  color: #2d2a3e;
  -webkit-font-smoothing: antialiased;
  /* 禁止移动端字体自动放大：Android Chrome 字体增强、iOS 横屏字号膨胀 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* 表单元素默认不继承页面字体，各平台默认字体不同，必须显式继承 */
input, textarea, select, button { font-family: inherit; }
body { overflow-x: hidden; -webkit-overflow-scrolling: touch; }
/* 用 100% 而非 100vh：iOS/微信下 100vh 含地址栏高度，会导致底部被工具栏遮挡 */
#app { max-width: 480px; margin: 0 auto; min-height: 100%; background: #f3f1f8; position: relative; }
.page { display: none; padding: 20px 16px 40px; }
.page.active { display: block; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 14px; font-size: 16px; font-weight: 600;
  padding: 14px 20px; cursor: pointer; transition: all .2s; font-family: inherit;
}
.btn-primary { background: #7b6bd6; color: #fff; box-shadow: 0 6px 16px rgba(123,107,214,.3); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { background: #c9c2e8; box-shadow: none; }
.btn-ghost { background: #fff; color: #7b6bd6; border: 1.5px solid #d9d2f0; }
.btn-ghost:active { background: #f3f1f8; }
.btn-lg { width: 100%; padding: 16px; font-size: 17px; }
.btn-sm { padding: 10px 20px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; margin-bottom: 10px; }

/* ============================================================
   验证码页
   ============================================================ */
.code-card {
  background: #fff; border-radius: 24px; padding: 40px 24px 32px;
  text-align: center; margin-top: 40px; box-shadow: 0 8px 30px rgba(123,107,214,.08);
}
.code-icon { font-size: 54px; margin-bottom: 16px; }
.code-title { font-size: 12px; letter-spacing: 2px; color: #9b93b8; font-weight: 600; }
.code-sub { font-size: 26px; margin: 12px 0 8px; color: #2d2a3e; }
.code-desc { font-size: 14px; color: #7a7391; line-height: 1.7; margin-bottom: 24px; }
.code-input {
  width: 100%; text-align: center; font-size: 26px; letter-spacing: 14px;
  padding: 16px 10px; border: 2px solid #e5e0f5; border-radius: 16px;
  outline: none; background: #faf9fe; color: #2d2a3e; font-weight: 600;
}
.code-input:focus { border-color: #7b6bd6; }
.code-error { color: #e05a5a; font-size: 13px; margin-top: 12px; min-height: 18px; }
#code-btn { margin-top: 18px; }

/* ============================================================
   首页
   ============================================================ */
.home-card {
  background: #fff;
  border-radius: 28px;
  padding: 36px 22px 28px;
  box-shadow: 0 10px 40px rgba(123, 107, 214, .08);
  text-align: center;
}
.home-icon {
  width: 84px; height: 84px;
  margin: 0 auto 22px;
  border-radius: 22px;
  background: #7b6bd6; color: #fff;
  font-size: 42px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(123, 107, 214, .35);
}
.home-title {
  font-size: 32px; font-weight: 800; line-height: 1.3;
  color: #4a3f8f; margin-bottom: 12px; letter-spacing: 1px;
}
.home-subtitle {
  font-size: 13px; letter-spacing: 3px; color: #9b93b8;
  font-weight: 600; margin-bottom: 22px;
}
.home-desc {
  font-size: 15px; line-height: 1.9; color: #6b6482;
  margin-bottom: 26px; text-align: left;
}
.home-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 22px;
}
.home-grid-item {
  background: #faf9fe; border: 1.5px solid #eeebfa;
  border-radius: 18px; padding: 18px 10px; text-align: center;
}
.home-grid-title { font-size: 18px; font-weight: 700; color: #7b6bd6; margin-bottom: 6px; }
.home-grid-sub { font-size: 13px; color: #8b84a3; }
.home-note {
  background: #faf9fe; border-left: 4px solid #7b6bd6;
  border-radius: 14px; padding: 16px 18px; text-align: left; margin-bottom: 24px;
}
.home-note-title { font-size: 15px; font-weight: 700; color: #2d2a3e; margin-bottom: 8px; }
.home-note p { font-size: 14px; line-height: 1.8; color: #6b6482; }
.home-card .btn-lg { width: 100%; margin-bottom: 12px; }
.home-card .btn-lg:last-child { margin-bottom: 0; }

/* ============================================================
   偏好页
   ============================================================ */
.pref-card {
  background: #fff; border-radius: 24px; padding: 26px 20px;
  margin-top: 20px; box-shadow: 0 8px 30px rgba(123,107,214,.08);
}
.step-label { font-size: 12px; letter-spacing: 1px; color: #9b93b8; font-weight: 600; margin-bottom: 12px; }
.pref-title { font-size: 22px; margin-bottom: 8px; color: #2d2a3e; }
.pref-desc { font-size: 13px; color: #7a7391; line-height: 1.7; margin-bottom: 20px; }
.pref-options { display: flex; flex-direction: column; margin-bottom: 24px; }
/* 兼容：不用 flex gap（老 WebView 不支持），改用相邻兄弟 margin */
.pref-options > * + * { margin-top: 12px; }
.pref-option {
  display: flex; align-items: center; padding: 16px;
  background: #faf9fe; border: 2px solid #eeebfa; border-radius: 16px;
  cursor: pointer; text-align: left; font-family: inherit; transition: all .2s;
}
.pref-option > * + * { margin-left: 14px; }
.pref-option.active { border-color: #7b6bd6; background: #f2effc; }
.pref-icon {
  width: 44px; height: 44px; border-radius: 12px; background: #7b6bd6; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.pref-text strong { font-size: 15px; color: #2d2a3e; display: block; margin-bottom: 3px; }
.pref-text small { font-size: 12px; color: #8b84a3; }
.pref-actions { display: flex; }
.pref-actions > * + * { margin-left: 12px; }
.pref-actions .btn { flex: 1; min-width: 0; }

/* ============================================================
   答题页
   ============================================================ */
.quiz-top-card {
  background: #fff; border-radius: 18px;
  padding: 16px 18px 18px; margin-bottom: 14px;
  box-shadow: 0 6px 24px rgba(123, 107, 214, .06);
}
.quiz-top-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.quiz-top-left { display: flex; align-items: center; }
.quiz-top-left > * + * { margin-left: 8px; }
.quiz-top-icon { font-size: 18px; }
.quiz-top-dim { font-size: 15px; font-weight: 700; color: #7b6bd6; }
.quiz-top-right { display: flex; align-items: center; font-size: 14px; color: #8b84a3; }
.quiz-top-right > * + * { margin-left: 10px; }
.quiz-top-percent { color: #7b6bd6; font-weight: 700; }
.quiz-progress-bar { height: 8px; background: #eeebfa; border-radius: 4px; overflow: hidden; }
#quiz-progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #9b8ce8, #7b6bd6);
  border-radius: 4px; transition: width .3s ease;
}
.quiz-card {
  background: #fff; border-radius: 24px;
  padding: 24px 20px 22px;
  box-shadow: 0 10px 40px rgba(123, 107, 214, .08);
}
.quiz-dim-tag {
  display: inline-flex; align-items: center;
  font-size: 13px; font-weight: 600; color: #7b6bd6;
  background: #f2effc; padding: 6px 14px; border-radius: 20px; margin-bottom: 18px;
}
.quiz-dim-tag > * + * { margin-left: 6px; }
.quiz-dim-icon { font-size: 14px; }
.quiz-question {
  font-size: 20px; line-height: 1.6; font-weight: 700;
  color: #2d2a3e; margin-bottom: 22px;
}
.quiz-options { display: flex; flex-direction: column; }
.quiz-options > * + * { margin-top: 12px; }
.quiz-option {
  display: flex; align-items: flex-start;
  width: 100%; text-align: left; padding: 16px 16px;
  background: #faf9fe; border: 2px solid #eeebfa; border-radius: 18px;
  font-family: inherit; cursor: pointer; transition: all .18s;
}
.quiz-option > * + * { margin-left: 12px; }
.quiz-option:active { transform: scale(.99); }
.quiz-option.selected { border-color: #7b6bd6; background: #f2effc; }
.quiz-option-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #c9c2e8; flex-shrink: 0; margin-top: 2px;
  position: relative; transition: all .18s;
}
.quiz-option.selected .quiz-option-radio { border-color: #7b6bd6; background: #7b6bd6; }
.quiz-option.selected .quiz-option-radio::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
  transform: translate(-50%, -50%);
}
.quiz-option-body { flex: 1; }
.quiz-option-text {
  font-size: 15.5px; line-height: 1.5; color: #2d2a3e;
  font-weight: 600; margin-bottom: 6px;
}
.quiz-option-hint { font-size: 13px; color: #8b84a3; line-height: 1.5; }
.quiz-bottom {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 24px;
}
.quiz-hint { font-size: 12px; color: #a9a2bd; }

/* ============================================================
   结果页
   ============================================================ */
.result-page { padding: 0; }
.result-hero {
  background: #fff; border-radius: 24px;
  padding: 28px 20px 22px; text-align: center;
  margin-bottom: 14px; box-shadow: 0 8px 30px rgba(123, 107, 214, .08);
}
.result-hero-label { font-size: 13px; color: #9b93b8; letter-spacing: 1px; margin-bottom: 14px; }
.result-hero-portrait { width: 150px; margin: 0 auto 14px; }
.result-hero-portrait svg {
  width: 100%; height: auto; display: block; border-radius: 20px;
  box-shadow: 0 10px 28px rgba(123, 107, 214, .22);
}
.result-hero-percent {
  font-size: 56px; font-weight: 800; color: #7b6bd6;
  line-height: 1; letter-spacing: -1px; margin-bottom: 12px;
}
.result-hero-name { font-size: 30px; font-weight: 700; color: #2d2a3e; margin-bottom: 8px; }
.result-hero-title { font-size: 14px; color: #8b84a3; margin-bottom: 16px; }
.result-hero-tags { display: flex; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.result-hero-tags span {
  font-size: 12px; color: #7b6bd6; background: #eeebfa;
  padding: 6px 14px; border-radius: 20px;
  margin-right: 8px; margin-bottom: 8px;
}
.result-hero-core {
  display: inline-block; font-size: 13px; color: #fff;
  background: #b9b0e8; padding: 7px 20px; border-radius: 20px;
}
.result-quote {
  background: #eeebfa; border-radius: 18px;
  padding: 18px 18px 20px; margin-bottom: 14px;
}
.result-quote-label { font-size: 13px; color: #7b6bd6; font-weight: 600; margin-bottom: 10px; }
.result-quote-text { font-size: 16px; line-height: 1.8; color: #3d3852; }
.result-block {
  background: #fff; border-radius: 20px;
  padding: 22px 20px; margin-bottom: 14px;
  box-shadow: 0 8px 30px rgba(123, 107, 214, .06);
}
.result-block-title { font-size: 18px; font-weight: 700; color: #2d2a3e; margin-bottom: 16px; }
.result-block-text { font-size: 15px; line-height: 2; color: #5b5473; }
.result-bars { display: flex; flex-direction: column; }
.result-bars > * + * { margin-top: 16px; }
.result-bar-row { display: flex; align-items: center; }
.result-bar-row > * + * { margin-left: 12px; }
.result-bar-label { font-size: 14px; color: #6b6482; width: 40px; flex-shrink: 0; }
.result-bar-track { flex: 1; height: 10px; background: #eeebfa; border-radius: 5px; overflow: hidden; }
.result-bar-fill {
  height: 100%; background: linear-gradient(90deg, #9b8ce8, #7b6bd6);
  border-radius: 5px; transition: width .8s ease;
}
.result-bar-score { font-size: 14px; color: #7b6bd6; font-weight: 600; width: 34px; text-align: right; flex-shrink: 0; }
.result-base { display: flex; flex-direction: column; }
.result-base > * + * { margin-top: 14px; }
.result-base-item { background: #faf9fe; border-radius: 16px; padding: 16px 18px; }
.result-base-item strong { display: block; font-size: 15px; color: #2d2a3e; margin-bottom: 8px; }
.result-base-item p { font-size: 14px; line-height: 1.9; color: #6b6482; }
.result-real { background: #faf9fe; border-radius: 16px; padding: 18px; }
.result-real-label { font-size: 14px; color: #7b6bd6; font-weight: 600; margin-bottom: 10px; }
.result-real p { font-size: 15px; line-height: 1.9; color: #5b5473; }
.result-warn { display: flex; flex-direction: column; }
.result-warn > * + * { margin-top: 14px; }
.result-warn-item { background: #faf9fe; border-radius: 16px; padding: 16px 18px; }
.result-warn-label { font-size: 14px; color: #7b6bd6; font-weight: 600; margin-bottom: 8px; }
.result-warn-item p { font-size: 14px; line-height: 1.9; color: #6b6482; }
.result-lines { display: flex; flex-direction: column; }
.result-lines > * + * { margin-top: 12px; }
.result-lines div {
  background: #faf9fe; border-radius: 16px; padding: 16px 18px;
  font-size: 15px; line-height: 1.8; color: #3d3852;
}
.result-actions {
  margin-top: 22px;
  display: flex; flex-direction: column;
}
.result-actions > * + * { margin-top: 12px; }
.result-actions .btn {
  width: 100%; padding: 16px; border-radius: 14px;
  font-size: 16px; font-weight: 600;
}
.result-actions-row { display: flex; }
.result-actions-row > * + * { margin-left: 12px; }
.result-actions-row .btn { flex: 1; width: auto; min-width: 0; }
.result-footer-note {
  text-align: center; font-size: 12px; color: #a9a2bd;
  line-height: 1.7; padding: 18px 10px 4px;
}

/* 八维雷达图 */
.result-radar { display: flex; justify-content: center; margin-bottom: 18px; }
.result-radar svg { width: 100%; max-width: 280px; height: auto; }

/* 9:16 分享卡片 */
.result-sharecard-wrap { margin: 4px 0 14px; }
.result-sharecard-title { font-size: 13px; color: #9b93b8; text-align: center; margin-bottom: 12px; }
.result-sharecard {
  width: 300px; max-width: 86%; margin: 0 auto; min-height: 533px;
  background: linear-gradient(160deg, #8a78e0, #5b4ba8);
  border-radius: 22px; padding: 22px 20px;
  color: #fff; text-align: center;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 14px 40px rgba(91, 75, 168, .35);
  position: relative; overflow: hidden;
}
.result-sharecard::after {
  /* 不用 inset（老 WebView 不支持），展开写四个方向 */
  content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(circle at 30% 8%, rgba(255,255,255,.20), transparent 60%);
  pointer-events: none;
}
.sc-top { font-size: 12px; letter-spacing: 2px; opacity: .85; position: relative; }
.sc-portrait { width: 118px; margin: 10px auto 6px; position: relative; }
.sc-portrait svg { width: 100%; height: auto; display: block; border-radius: 18px; }
.sc-name { font-size: 30px; font-weight: 800; margin-top: 4px; font-family: 'KaiTi','STKaiti','SimSun',serif; position: relative; }
.sc-title { font-size: 13px; opacity: .9; margin-top: 4px; position: relative; }
.sc-percent { font-size: 46px; font-weight: 800; line-height: 1; margin: 10px 0 2px; position: relative; }
.sc-percent span { font-size: 15px; font-weight: 600; margin-left: 4px; opacity: .9; }
.sc-quote { font-size: 14px; line-height: 1.7; opacity: .95; margin: 8px 6px; position: relative; }
.sc-traits { width: 100%; margin-top: 6px; display: flex; flex-direction: column; position: relative; }
.sc-traits > * + * { margin-top: 8px; }
.sc-trait { display: flex; align-items: center; }
.sc-trait > * + * { margin-left: 10px; }
.sc-trait-name { font-size: 13px; width: 34px; text-align: right; opacity: .95; flex-shrink: 0; }
.sc-trait-bar { flex: 1; height: 8px; background: rgba(255,255,255,.25); border-radius: 4px; overflow: hidden; }
.sc-trait-bar i { display: block; height: 100%; background: #ffd86b; border-radius: 4px; }
.sc-footer { margin-top: auto; padding-top: 12px; font-size: 12px; opacity: .8; position: relative; }

/* ============================================================
   移动端
   ============================================================ */
@media (max-width: 360px) {
  .home-title { font-size: 26px; }
  .home-grid-title { font-size: 16px; }
  .quiz-question { font-size: 18px; }
  .quiz-option-text { font-size: 14.5px; }
  .result-hero-percent { font-size: 48px; }
  .result-hero-name { font-size: 26px; }
}
