/* =========================================================
   MBTI 测试 · 样式
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --bg-inset: #fbfbfc;
  --fg: #14161a;
  --fg-sub: #4d5560;
  --fg-muted: #6b7480;
  --line: #e3e6ea;
  --line-strong: #cdd2d9;
  --accent: #0e7c66;
  --accent-ink: #0a5f4e;
  --accent-soft: #e9f5f1;
  --accent-line: #b7ddd2;
  --warn: #a1450a;
  --warn-soft: #fdf1e7;
  --good: #0e7c66;
  --btn-fg: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 46rem;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --bg-soft: #191a1d;
    --bg-inset: #17181b;
    --fg: #e9eaec;
    --fg-sub: #b3bac3;
    --fg-muted: #8b929c;
    --line: #2a2c31;
    --line-strong: #3a3d44;
    --accent: #3ddcbb;
    --accent-ink: #6ff0d4;
    --accent-soft: #10251f;
    --accent-line: #1e4b3f;
    --warn: #f0a45c;
    --warn-soft: #2a1d10;
    --good: #3ddcbb;
    --btn-fg: #06251d;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
               "Noto Sans SC", sans-serif;
  font-size: 17px;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { line-height: 1.35; letter-spacing: -.015em; }
p { margin: 0 0 1em; }
b, strong { font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent-soft); color: var(--fg); }

/* ---------- 骨架 ---------- */
.site-head {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 24px 0;
}
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: var(--btn-fg);
  font-size: 13px;
  font-weight: 700;
}
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand-sub { font-size: 13px; color: var(--fg-muted); }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.site-foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 24px 56px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.75;
  color: var(--fg-muted);
}
.site-foot p { margin: 0 0 .5em; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 24px;
  min-height: 48px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              transform .18s var(--ease), color .18s var(--ease);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.btn-primary { background: var(--accent); color: var(--btn-fg); }
.btn-primary:hover { background: var(--accent-ink); transform: translateY(-1px); }
@media (prefers-color-scheme: dark) {
  .btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--fg-sub);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ---------- 首页 ---------- */
.home-title {
  font-size: clamp(1.9rem, 5.2vw, 2.9rem);
  font-weight: 700;
  letter-spacing: -.03em;
  margin: 0 0 26px;
}
.home-lede {
  font-size: 17px;
  line-height: 1.9;
  color: var(--fg-sub);
  max-width: 38em;
  margin: 0 0 40px;
}

.home-cta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 64px;
}
.home-cta .btn-primary { min-height: 52px; padding: 0 34px; font-size: 16px; }
.home-cta-note { font-size: 13.5px; color: var(--fg-muted); }

.sec-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: none;
  color: var(--fg-muted);
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.dim-list { margin: 0 0 56px; }
.dim-row {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 8px 28px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.dim-row:last-child { border-bottom: 0; }
.dim-row dt { font-size: 15px; color: var(--fg); }
.dim-row dt b { font-weight: 700; color: var(--accent); }
.dim-row dd { margin: 0; font-size: 15px; line-height: 1.8; color: var(--fg-sub); }

.home-note {
  padding: 26px 0 0;
  border-top: 1px solid var(--line);
  font-size: 15.5px;
  line-height: 1.9;
  color: var(--fg-sub);
}
.home-note .sec-title { margin-bottom: 18px; }
.home-note strong { color: var(--fg); }

/* ---------- 答题 ---------- */
.quiz-bar { margin: 0 0 40px; }
.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--fg-muted);
}
.quiz-step { font-weight: 600; color: var(--fg-sub); }
.quiz-count { font-variant-numeric: tabular-nums; }

.progress {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width .35s var(--ease);
}

.quiz-list { margin: 0 0 40px; }

.q-card {
  padding: 30px 0 26px;
  border-bottom: 1px solid var(--line);
}
.q-card:first-child { padding-top: 0; }
.q-card:last-child { border-bottom: 0; }

.q-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin: 0 0 20px;
}
.q-num {
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  letter-spacing: .06em;
  padding-top: .3em;
}
.q-text {
  margin: 0;
  font-size: 17.5px;
  line-height: 1.7;
  font-weight: 500;
  color: var(--fg);
}

.q-opts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  max-width: 24rem;
  margin: 0 0 10px;
  padding-left: 40px;
}
.q-opt {
  appearance: none;
  border: 0;
  background: transparent;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background .16s var(--ease), transform .16s var(--ease);
}
.q-opt:hover { background: var(--bg-soft); }
.q-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.q-dot {
  display: block;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  transition: all .16s var(--ease);
}
.q-opt:nth-child(1) .q-dot { width: 10px; height: 10px; }
.q-opt:nth-child(2) .q-dot { width: 14px; height: 14px; }
.q-opt:nth-child(3) .q-dot { width: 18px; height: 18px; }
.q-opt:nth-child(4) .q-dot { width: 22px; height: 22px; }
.q-opt:nth-child(5) .q-dot { width: 26px; height: 26px; }

.q-opt.is-on { background: var(--accent-soft); }
.q-opt.is-on .q-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.q-scale {
  display: flex;
  justify-content: space-between;
  max-width: 24rem;
  padding-left: 40px;
  font-size: 12.5px;
  color: var(--fg-muted);
}

.quiz-nav {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}
.quiz-nav .btn { flex: 1; }
.quiz-hint {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--fg-muted);
  text-align: center;
}

/* ---------- 结果 ---------- */
.result-body { margin: 0 0 48px; }

.r-hero { margin: 0 0 28px; }
.r-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}
.r-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .02em;
}
@media (prefers-color-scheme: dark) {
  .r-badge { color: #0b0b0d; }
}
.r-code {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.r-name {
  font-size: clamp(1.7rem, 4.6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -.03em;
  margin: 0 0 14px;
}
.r-tagline {
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg-sub);
  margin: 0 0 14px;
  font-weight: 500;
}
.r-summary {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--fg-sub);
  margin: 0;
}

/* 综合评分 */
.r-score {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
}
.r-score-num-wrap { flex: none; text-align: center; }
.r-score-num {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}
.r-score-unit {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-top: 8px;
  letter-spacing: .02em;
}
.r-score-info { flex: 1; min-width: 0; }
.r-score-grade {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}
.r-score-desc { margin: 0; font-size: 14.5px; line-height: 1.75; color: var(--fg-sub); }
.r-score-note {
  font-size: 13px;
  line-height: 1.75;
  color: var(--fg-muted);
  margin: 0 0 40px;
}

/* 四维 */
.r-dims { margin: 0 0 52px; }
.dim { margin: 0 0 26px; }
.dim:last-child { margin-bottom: 0; }
.dim-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 10px;
}
.dim-label { font-size: 15px; font-weight: 600; }
.dim-desc { font-size: 13px; color: var(--fg-muted); }
.dim-track {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line);
  margin: 0 0 9px;
}
.dim-fill-l, .dim-fill-r {
  height: 100%;
  transition: width .5s var(--ease);
}
.dim-legend {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.dim-side { display: inline-flex; align-items: baseline; gap: 6px; color: var(--fg-muted); }
.dim-side b { font-weight: 700; font-size: 14px; }
.dim-side i { font-style: normal; font-variant-numeric: tabular-nums; }
.dim-side.is-active b, .dim-side.is-active i { font-weight: 700; }

/* 优势 / 短板 */
.r-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin: 0 0 52px;
}
.r-list ul { margin: 0; padding: 0; list-style: none; }
.r-list li {
  position: relative;
  padding: 0 0 12px 22px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--fg-sub);
}
.r-list li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 700;
  font-size: 14px;
}
.r-list--good li::before { content: '+'; color: var(--good); }
.r-list--warn li::before { content: '−'; color: var(--warn); }

.r-block { margin: 0 0 44px; }
.r-sec-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  color: var(--fg-muted);
  margin: 0 0 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.r-traits { margin: 0; padding: 0; list-style: none; }
.r-traits li {
  padding: 0 0 10px 18px;
  position: relative;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--fg-sub);
}
.r-traits li::before {
  content: '';
  position: absolute;
  left: 0; top: .72em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}
.r-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.r-tag {
  padding: 5px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 14px;
  color: var(--fg-sub);
}
.r-note { font-size: 13.5px; line-height: 1.75; color: var(--fg-muted); margin: 0; }
.r-text { font-size: 15.5px; line-height: 1.85; color: var(--fg-sub); margin: 0; }
.r-growth { margin: 0; padding-left: 1.3em; }
.r-growth li {
  font-size: 15.5px;
  line-height: 1.8;
  color: var(--fg-sub);
  padding-bottom: 9px;
}
.r-growth li::marker { color: var(--accent); font-weight: 700; }

.r-disclaimer {
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.8;
  color: var(--fg-muted);
  margin: 0;
}

.result-actions { display: flex; gap: 12px; }
.result-actions .btn { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 14px);
  background: var(--fg);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
  z-index: 100;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .wrap { padding: 36px 20px 56px; }
  .site-head { padding: 18px 20px 0; }

  .home-title { font-size: 1.75rem; margin-bottom: 20px; }
  .home-lede { font-size: 16px; margin-bottom: 32px; }
  .home-cta { margin-bottom: 48px; gap: 12px; }
  .home-cta .btn-primary { width: 100%; }

  .dim-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 14px 0;
  }

  .q-card { padding: 24px 0 22px; }
  .q-text { font-size: 16.5px; }
  .q-opts, .q-scale { padding-left: 0; max-width: none; }
  .q-opt { width: 52px; height: 52px; }

  .r-score { flex-direction: column; align-items: flex-start; gap: 16px; }
  .r-score-num-wrap { text-align: left; }
  .r-two { grid-template-columns: 1fr; gap: 32px; }
  .dim-head { flex-wrap: wrap; gap: 4px 10px; }
}

@media (max-width: 380px) {
  .q-opt { width: 46px; height: 46px; }
}

@media print {
  .site-head, .site-foot, .result-actions, .toast, .quiz-nav, .quiz-hint { display: none; }
  body { font-size: 12pt; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* =========================================================
   分享 / 邀请 / 备考导流
   ========================================================= */

/* 首页：被邀请提示 */
.invite-note {
  margin: 0 0 26px;
  padding: 13px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--fg-sub);
}
.invite-note strong { color: var(--accent-ink); }
@media (prefers-color-scheme: dark) {
  .invite-note strong { color: var(--accent); }
}

/* 弱按钮 */
.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
  min-height: 42px;
  font-weight: 500;
  font-size: 14px;
}
.btn-quiet:hover { color: var(--fg); background: var(--bg-soft); }

/* 结果页分享区 */
.result-share {
  padding: 26px 0 0;
  border-top: 1px solid var(--line);
}
.result-share .r-sec-title { margin-bottom: 18px; }
.result-actions { display: flex; gap: 12px; margin-bottom: 10px; }
.result-actions--sub { margin-bottom: 0; }
.result-actions .btn { flex: 1; }

/* 备考模块 */
.r-study {
  margin: 0 0 40px;
  padding: 26px 0 0;
  border-top: 1px solid var(--line);
}
.r-study .r-sec-title { margin-bottom: 18px; }
.r-study-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 6px 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.r-study-row:last-of-type { border-bottom: 0; }
.r-study-k {
  font-size: 13.5px;
  color: var(--fg-muted);
  letter-spacing: .02em;
  padding-top: .18em;
}
.r-study-v { font-size: 15.5px; line-height: 1.75; color: var(--fg-sub); }
.r-study-acts {
  display: flex;
  gap: 10px;
  margin: 20px 0 14px;
  flex-wrap: wrap;
}
.r-study-acts .btn { flex: 1; min-width: 150px; text-align: center; }
.r-study-acts a.btn { display: inline-flex; align-items: center; justify-content: center; }
.r-study-acts a.btn:hover { text-decoration: none; }

/* 弹层 */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 11, .82);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.modal-body {
  position: relative;
  max-width: 380px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.share-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.modal-hint {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0 0 14px;
}
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

@media (max-width: 720px) {
  .r-study-row { grid-template-columns: 1fr; gap: 3px; padding: 14px 0; }
  .r-study-k { font-size: 12.5px; }
  .r-study-acts { flex-direction: column; }
  .r-study-acts .btn { width: 100%; }
  .result-share .result-actions { flex-direction: column; }
  .modal { padding: 16px; }
  .modal-body { max-width: none; }
}
