:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e4e7ec;
  --text: #23262f;
  --muted: #7a8194;
  --accent: #5b6ef5;
  --accent2: #7d5cf6;
  --ok: #2f9e6e;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 24, 40, 0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: calc(100vh - 90px);
}

.topbar {
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-brand {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}
.topbar-brand .accent { color: var(--accent); }
.btn-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-main:hover { border-color: var(--accent); color: var(--accent); }

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  padding: 16px;
  line-height: 1.8;
}
.footer-main { color: var(--accent); text-decoration: none; }
.footer-main:hover { text-decoration: underline; }

/* ============ 通用 ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--accent);
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: #4a5cd8; }
.btn:active { transform: scale(0.98); }
.btn.ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.ghost:hover { background: #f0f2f7; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 24px; }

.fade-up { animation: fadeUp 0.35s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.pop-in { animation: popIn 0.35s ease both; }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* ============ 首页 ============ */
.hero { text-align: center; padding: 34px 12px 20px; }
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text);
}
.logo-mark svg { width: 28px; height: 28px; color: var(--accent); }
.hero h1 { margin: 14px 0 8px; font-size: 24px; line-height: 1.4; color: var(--text); }
.hero h1::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  margin: 12px auto 0;
}
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; line-height: 1.8; font-size: 14px; }
.count-badge {
  display: inline-block;
  margin-top: 14px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}
.count-badge .mi { vertical-align: -2px; margin-right: 5px; color: var(--accent); }

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.quiz-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 210px;
  border-top: 3px solid var(--q-accent, var(--accent));
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.quiz-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.q-thumbs {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  gap: 6px;
  width: max-content;
}
.q-thumbs > span {
  position: relative;
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f3f8;
  border: 1px solid var(--border);
}
.q-thumbs svg, .q-thumbs img { position: absolute; inset: 0; width: 100%; height: 100%; }
.quiz-card h3 { font-size: 19px; margin: 14px 0 6px; color: var(--text); }
.quiz-card p { font-size: 13px; line-height: 1.6; color: var(--muted); }
.quiz-card .meta { display: flex; justify-content: flex-end; margin-top: 14px; }
.quiz-card .go {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: #eef0ff;
  padding: 5px 14px;
  border-radius: 999px;
}

/* ============ 题目页 ============ */
.quiz-head { text-align: center; margin-bottom: 22px; }
.quiz-head .back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease;
}
.quiz-head .back:hover { background: #f0f2f7; color: var(--text); }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s ease;
}
.back:hover { background: #f0f2f7; color: var(--text); }
.quiz-head .q-icon svg { width: 40px; height: 40px; color: var(--accent); }
.quiz-head h2 { margin: 8px 0 6px; font-size: 22px; color: var(--text); }
.quiz-head .sub { color: var(--muted); font-size: 13.5px; line-height: 1.7; max-width: 640px; margin: 0 auto; }

.progress-wrap { max-width: 560px; margin: 20px auto 6px; }
.progress-info { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.progress-info span:last-child {
  font-weight: 700;
  color: var(--accent);
  background: #eef0ff;
  padding: 2px 10px;
  border-radius: 999px;
}
.progress-track { height: 8px; border-radius: 999px; background: #e8ebf1; overflow: hidden; }
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.question-box { max-width: 680px; margin: 0 auto; }
.question-box .q-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  padding: 24px 20px;
  margin-bottom: 18px;
  color: var(--text);
}
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option:hover { border-color: var(--accent); background: #f8f9ff; }
.option .opt-key {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: #f1f3f8;
  color: var(--muted);
}
.option.selected { border-color: var(--accent); background: #eef0ff; }
.option.selected .opt-key { background: var(--accent); color: #fff; }

.invite-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 24px;
  text-align: center;
}
.invite-avatar { width: 96px; height: 96px; margin: 0 auto 14px; }
.invite-avatar .avatar-stack { border-radius: 50%; overflow: hidden; border: 1px solid var(--border); }
.invite-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.invite-title strong { color: var(--accent); }
.invite-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.name-input {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s ease;
}
.name-input:focus { border-color: var(--accent); }

.invite-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}
.invite-bar .name-input { margin: 0; max-width: 180px; }

.relation-card {
  padding: 22px;
  margin-bottom: 18px;
  text-align: center;
}
.relation-card h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 16px;
}
.relation-card h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.relation-avatars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 16px;
}
.rel-person { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; }
.rel-avatar { width: 84px; height: 84px; }
.rel-avatar .avatar-stack { border-radius: 50%; overflow: hidden; border: 1px solid var(--border); }
.rel-name { font-size: 13px; font-weight: 600; color: var(--text); max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rel-plus { color: var(--accent); display: inline-flex; }
.rel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border-radius: 999px;
  background: #eef0ff;
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
}
.rel-desc { font-size: 14px; line-height: 1.8; color: #4c5368; max-width: 480px; margin: 0 auto 10px; }
.rel-advice { font-size: 13px; color: var(--muted); max-width: 480px; margin: 0 auto; }

/* ============ 结果页 ============ */
.result-wrap { max-width: 760px; margin: 0 auto; }
.result-hero {
  text-align: center;
  padding: 26px 20px 22px;
  margin-bottom: 18px;
}
.result-label {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #f1f3f8;
  border: 1px solid var(--border);
  color: var(--muted);
  margin-bottom: 12px;
}
.hidden-label {
  background: #fff8ec;
  border-color: #f3d9a4;
  color: #9a6b12;
}
.result-avatar { margin: 10px auto 12px; width: 150px; height: 150px; }
.result-avatar svg { width: 100%; height: 100%; overflow: visible; }
.avatar-stack { position: relative; display: block; width: 100%; height: 100%; }
.avatar-stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.result-avatar .avatar-stack { border-radius: 50%; overflow: hidden; border: 1px solid var(--border); }
.avatar-stack svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.result-hero h2 { font-size: 24px; margin-bottom: 6px; color: var(--text); }
.result-hero .match-line { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.match-line strong { color: var(--accent); font-size: 16px; }
.wealth-line {
  display: inline-block;
  margin: 6px 0 12px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #fff8ec;
  border: 1px solid #f3d9a4;
  color: #9a6b12;
  font-size: 12.5px;
  font-weight: 600;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.tag {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: #f1f3f8;
  border: 1px solid var(--border);
  color: var(--muted);
}

.result-block { padding: 20px 22px; margin-bottom: 18px; }
.result-block h3, .dim-section h3, .rank-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--text);
}
.result-block h3 .dot, .dim-section h3 .dot, .rank-section h3 .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.detail-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.detail-item {
  background: #f8f9fb;
  border: 1px solid #eceef3;
  border-radius: 12px;
  padding: 13px 15px;
}
.detail-item h4 { font-size: 13.5px; color: var(--text); margin-bottom: 5px; }
.detail-item p { font-size: 13.5px; line-height: 1.8; color: #4c5368; }

.quote-box {
  text-align: center;
  font-style: italic;
  font-size: 15px;
  line-height: 1.8;
  color: #4c5368;
  padding: 18px 20px;
  margin: 14px 0;
  background: #f8f9fb;
  border-left: 3px solid var(--accent);
}
.quote-box::before { content: "“"; font-size: 28px; color: var(--accent); display: block; margin-bottom: 2px; }

.advice-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  background: #f3faf6;
  border: 1px solid #dcefe4;
  border-radius: 12px;
  margin-top: 14px;
}
.advice-box .icon { color: var(--ok); display: inline-flex; margin-top: 2px; }
.advice-box p { font-size: 13.5px; line-height: 1.8; color: #3c4a44; }

.dim-section { padding: 20px 22px; margin-bottom: 18px; }
.radar-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  padding: 14px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.radar-wrap svg { width: 280px; max-width: 100%; height: auto; }
.dim-bars { display: flex; flex-direction: column; gap: 12px; }
.dim-row .dim-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.dim-row .dim-top .dim-name { font-weight: 600; display: inline-flex; align-items: center; }
.dim-icon { display: inline-flex; margin-right: 6px; color: var(--accent); }
.dim-row .dim-top .dim-val { color: var(--text); font-weight: 700; }
.dim-row .dim-desc { font-size: 12px; color: var(--muted); margin-bottom: 5px; line-height: 1.5; }
.dim-track { height: 7px; border-radius: 999px; background: #e8ebf1; overflow: hidden; }
.dim-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  animation: growBar 0.8s ease both;
  transform-origin: left;
}
@keyframes growBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.rank-section { padding: 20px 22px; margin-bottom: 18px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px;
  border-bottom: 1px solid #f0f2f6;
}
.rank-item:last-child { border-bottom: 0; }
.rank-item .rank-no { width: 24px; text-align: center; font-weight: 700; color: var(--muted); font-size: 13px; }
.rank-thumb {
  position: relative;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f3f8;
  border: 1px solid var(--border);
  display: inline-block;
}
.rank-thumb svg, .rank-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; }
.rank-item .rank-name { flex: 0 0 auto; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.rank-item .rank-track { flex: 1; height: 7px; border-radius: 999px; background: #e8ebf1; overflow: hidden; }
.rank-item .rank-fill { height: 100%; border-radius: 999px; background: var(--accent); opacity: 0.75; animation: growBar 0.8s ease both; transform-origin: left; }
.rank-item.top { background: #f5f6ff; border-radius: 10px; padding: 12px 10px; }
.rank-item.top .rank-no { color: var(--accent); }
.rank-item .rank-pct { width: 46px; text-align: right; font-size: 12.5px; color: var(--muted); }

.score-track-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.score-track { flex: 1; height: 10px; border-radius: 999px; background: #e8ebf1; overflow: hidden; }
.score-fill { height: 100%; border-radius: 999px; background: var(--accent); animation: growBar 0.8s ease both; transform-origin: left; }
.score-num { flex: none; font-size: 14px; font-weight: 800; color: var(--text); }

.band-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 7px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.band-row.active { background: #f5f6ff; border-color: var(--accent); }
.band-no {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f1f3f8;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.band-row.active .band-no { background: var(--accent); color: #fff; }
.band-name { flex: 1; font-size: 13.5px; font-weight: 600; }
.band-range { font-size: 12px; color: var(--muted); }
.band-now {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.hidden-note {
  margin-top: 12px;
  text-align: center;
  color: #9a6b12;
  font-size: 13px;
}

.hidden-hint {
  margin-top: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}

.lock-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12.5px;
}
.lock-row .mi { color: var(--accent); }

.result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.btn svg { width: 16px; height: 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 99;
  box-shadow: 0 8px 24px rgba(20, 24, 40, 0.18);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .hero { padding-top: 24px; }
  .hero h1 { font-size: 20px; }
  .logo { font-size: 24px; }
  .quiz-grid { grid-template-columns: 1fr; }
  .result-block, .dim-section, .rank-section { padding: 16px 14px; }
  .result-hero h2 { font-size: 20px; }
  .rank-item .rank-name { max-width: 130px; }
}
