/* ============================================================
 * 十六型人格测试 PRO版 — Apple 风格样式
 * 设计语言：大留白 · 渐变大标题 · 玻璃拟态 · 精致线性图标 · 柔和动效
 * ============================================================ */
:root {
  /* Apple 标志性色板 */
  --bg: #f5f5f7;                 /* 苹果官网灰 */
  --card: #ffffff;
  --text: #1d1d1f;               /* 近黑 */
  --text2: #86868b;              /* 次级灰 */
  --text3: #b8b8bf;
  --line: rgba(0, 0, 0, 0.06);
  --accent: #0071e3;             /* Apple 蓝 */
  --accent-hover: #0077ed;
  --purple: #6e5ce6;
  --green: #34a47b;
  --blue: #3a7fd5;
  --yellow: #e59a2c;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.06);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.58;
  letter-spacing: -0.01em;
}
button { font-family: inherit; cursor: pointer; letter-spacing: inherit; }
::selection { background: rgba(0, 113, 227, 0.15); }

/* ---------- 页面切换 ---------- */
.page { display: none; max-width: 560px; margin: 0 auto; padding: 24px 20px 48px; min-height: 100vh; }
.page-active { display: block; animation: pageIn 0.5s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 Hero ---------- */
.hero { text-align: center; padding: 52px 0 34px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--text2);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-radius: 980px; padding: 6px 16px; margin-bottom: 22px;
  letter-spacing: 0.02em;
}
.hero-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.hero-title {
  font-size: 44px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.12;
  background: linear-gradient(135deg, #1d1d1f 30%, #6e5ce6 75%, #3a7fd5 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  margin-bottom: 12px;
}
.hero-sub { color: var(--text2); font-size: 16px; font-weight: 400; letter-spacing: -0.01em; }
.hero-sub strong { color: var(--text); font-weight: 600; }

/* ---------- 断点续测 ---------- */
.resume-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 20px;
  animation: pageIn 0.4s var(--ease);
}
.resume-info { display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; }
.resume-info span { color: var(--text2); font-size: 12.5px; font-weight: 400; }
.resume-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- 等级卡片 ---------- */
.level-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.level-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
  text-align: left; width: 100%;
}
.level-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.level-card:active { transform: scale(0.985); }
.level-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.level-icon svg { width: 22px; height: 22px; }
.level-body { flex: 1; min-width: 0; }
.level-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.level-desc { font-size: 13px; color: var(--text2); margin-top: 2px; }
.level-meta { text-align: right; font-size: 12px; color: var(--text2); flex-shrink: 0; line-height: 1.5; }
.level-meta b { display: block; font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.level-arrow { color: var(--text3); flex-shrink: 0; transition: transform 0.3s var(--ease); }
.level-card:hover .level-arrow { transform: translateX(3px); color: var(--text2); }

/* ---------- 历史结果 ---------- */
.history-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.history-head h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.history-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.history-item .avatar-mini { width: 42px; height: 44px; flex-shrink: 0; }
.history-item .avatar-mini svg { width: 100%; height: 100%; }
.history-item-info { flex: 1; min-width: 0; }
.history-item-info b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.history-item-info span { display: block; font-size: 12px; color: var(--text2); margin-top: 1px; }
.history-empty { text-align: center; color: var(--text3); font-size: 13.5px; padding: 22px 0; }

.disclaimer { text-align: center; font-size: 11.5px; color: var(--text3); margin-top: 44px; letter-spacing: 0.01em; }

/* ---------- 通用按钮（Apple 胶囊） ---------- */
.btn {
  border: none; border-radius: 980px; padding: 13px 26px;
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), opacity 0.25s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { text-decoration: underline; }
.btn-sm { padding: 8px 18px; font-size: 13.5px; }
.link-btn {
  background: none; border: none; color: var(--accent);
  font-size: 14px; font-weight: 500; padding: 4px;
  transition: opacity 0.2s;
}
.link-btn:hover { opacity: 0.75; }
.link-btn:active { opacity: 0.55; }
.icon-btn {
  background: rgba(255, 255, 255, 0.8); border: 1px solid var(--line);
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 19px; line-height: 1; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.icon-btn:hover { background: #fff; transform: scale(1.04); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- 答题页 ---------- */
.quiz-topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 44px; position: sticky; top: 0; z-index: 10; }
.quiz-progress { flex: 1; }
.quiz-progress-text { font-size: 12.5px; color: var(--text2); text-align: center; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.quiz-progress-track { height: 4px; background: rgba(0, 0, 0, 0.07); border-radius: 980px; overflow: hidden; }
.quiz-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--purple), var(--blue));
  border-radius: 980px; transition: width 0.45s var(--ease);
}
.level-tag {
  font-size: 12px; font-weight: 600; color: var(--text);
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--line);
  padding: 5px 13px; border-radius: 980px; flex-shrink: 0;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

.quiz-body { text-align: center; animation: pageIn 0.4s var(--ease); }
.quiz-dim {
  display: inline-block; font-size: 12px; font-weight: 500; color: var(--text2);
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 20px;
}
.quiz-question {
  font-size: 25px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.35;
  margin-bottom: 40px; padding: 0 6px;
}
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.option-card {
  background: var(--card); border: 1.5px solid transparent; border-radius: var(--radius-lg);
  padding: 24px 22px; font-size: 16.5px; font-weight: 500; color: var(--text); text-align: left;
  letter-spacing: -0.01em; line-height: 1.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s var(--ease);
}
.option-card:hover { border-color: rgba(0, 113, 227, 0.5); box-shadow: var(--shadow); transform: translateY(-1px); }
.option-card:active { transform: scale(0.98); border-color: var(--accent); background: #fbfbfd; }
.option-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text3); font-size: 12px; font-weight: 500;
}
.option-divider::before, .option-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.prev-link { margin-top: 30px; color: var(--text2); }
.prev-link[disabled] { opacity: 0.3; pointer-events: none; }

/* ---------- 结果页 ---------- */
.result-hero { text-align: center; padding: 26px 0 10px; }
.result-avatar { width: 168px; height: 176px; margin: 0 auto; animation: floatIn 0.7s var(--ease); }
@keyframes floatIn { from { opacity: 0; transform: scale(0.86) translateY(10px); } to { opacity: 1; transform: none; } }
.result-avatar svg { width: 100%; height: 100%; }
.result-code {
  font-size: 46px; font-weight: 700; letter-spacing: 0.08em; margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.result-name { font-size: 19px; font-weight: 600; letter-spacing: 0.06em; margin-top: 2px; }
.result-group {
  display: inline-block; font-size: 12.5px; font-weight: 500; letter-spacing: 0.04em;
  padding: 5px 16px; border-radius: 980px; margin-top: 12px; color: #fff;
}

.result-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; margin-top: 14px;
  animation: pageIn 0.5s var(--ease) both;
}
.result-card:nth-child(2) { animation-delay: 0.05s; }
.result-card:nth-child(3) { animation-delay: 0.1s; }
.result-card h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.result-summary { font-size: 15.5px; line-height: 1.7; color: var(--text); }
.result-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13.5px; color: var(--text2);
}
.result-meta b { color: var(--text); font-weight: 600; }

/* 维度条 */
.dim-row { margin-bottom: 18px; }
.dim-row:last-child { margin-bottom: 0; }
.dim-labels { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; margin-bottom: 6px; }
.dim-labels .dim-strong { font-weight: 700; color: var(--text); }
.dim-labels .dim-pct { color: var(--text2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dim-track { display: flex; height: 6px; border-radius: 980px; overflow: hidden; background: rgba(0,0,0,0.05); }
.dim-fill { height: 100%; border-radius: 980px; transition: width 0.8s var(--ease); }
.dim-note { font-size: 12px; color: var(--text2); margin-top: 5px; }

/* 标签 */
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-row .tag {
  font-size: 13.5px; font-weight: 500; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 980px;
  transition: background 0.25s;
}
.tag-row .tag:hover { background: #ebebef; }

.plain-list { list-style: none; }
.plain-list li { font-size: 14.5px; padding: 7px 0 7px 22px; position: relative; line-height: 1.55; }
.plain-list li::before {
  content: ""; position: absolute; left: 4px; top: 15px;
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.55;
}
#result-strengths li::before { background: var(--green); opacity: 0.8; }
#result-weaknesses li::before { background: var(--yellow); opacity: 0.8; }

/* 相容类型 */
.compat-row { display: flex; gap: 10px; }
.compat-item { flex: 1; text-align: center; background: var(--bg); border-radius: 14px; padding: 14px 6px; }
.compat-item .compat-code { font-weight: 700; font-size: 17px; letter-spacing: 0.05em; }
.compat-item .compat-name { font-size: 12px; color: var(--text2); margin-top: 2px; }
.advice-text { font-size: 13.5px; color: var(--text2); margin-top: 12px; line-height: 1.7; }

/* ---------- 阶位 + 分数 + 能量 ---------- */
.level-card-result { padding: 20px 22px; }
.level-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.level-badge {
  display: inline-block; font-size: 14px; font-weight: 700; letter-spacing: 0.05em;
  color: #fff; padding: 8px 18px; border-radius: 980px;
  box-shadow: 0 4px 14px rgba(110, 92, 230, 0.3);
}
.level-meta { text-align: right; }
.level-score {
  font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.level-score span { font-size: 14px; font-weight: 500; color: var(--text2); margin-left: 2px; }
.level-score-label { font-size: 11.5px; color: var(--text2); margin-top: 4px; letter-spacing: 0.04em; }

.energy-row { display: flex; align-items: center; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.energy-label { font-size: 12.5px; color: var(--text2); flex-shrink: 0; font-weight: 500; }
.energy-label span { color: var(--text); font-weight: 600; }
.energy-bar { flex: 1; height: 6px; background: rgba(0,0,0,0.05); border-radius: 980px; overflow: hidden; }
.energy-fill { height: 100%; width: 0; border-radius: 980px; transition: width 0.9s var(--ease); }
.energy-pct { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 40px; text-align: right; }

/* ---------- 特质 + 短句 ---------- */
.traits-card { padding: 20px 22px; text-align: center; }
.traits-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 14px; }
.trait-chip {
  font-size: 13px; font-weight: 600; color: var(--text);
  background: linear-gradient(135deg, rgba(110, 92, 230, 0.08), rgba(58, 127, 213, 0.08));
  border: 1px solid rgba(110, 92, 230, 0.15);
  padding: 6px 14px; border-radius: 980px;
}
.tagline {
  font-size: 14.5px; line-height: 1.7; color: var(--text); font-style: italic;
  position: relative; padding: 0 8px;
}

/* ---------- 雷达图 ---------- */
.radar-card { padding: 18px 8px 8px; }
.radar-wrap { display: flex; justify-content: center; padding: 6px 0 14px; }
.radar-wrap svg { max-width: 320px; width: 100%; height: auto; }

.result-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 28px; }
.result-actions .btn { width: 100%; }
.result-actions .btn-ghost { border: 1px solid var(--line); border-radius: 980px; color: var(--text); }
.result-actions .btn-ghost:hover { background: rgba(255,255,255,0.8); text-decoration: none; }

/* ---------- 弹窗（玻璃拟态） ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); animation: maskIn 0.3s var(--ease); }
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
.modal-body {
  position: relative; width: 100%; max-width: 560px; max-height: 84vh;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(28px); backdrop-filter: saturate(180%) blur(28px);
  border-radius: 22px 22px 0 0; padding: 20px 20px 26px;
  display: flex; flex-direction: column;
  animation: sheetUp 0.4s var(--ease);
}
@keyframes sheetUp { from { transform: translateY(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.report-content {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.85; white-space: pre-wrap;
  overflow-y: auto; background: rgba(245, 245, 247, 0.9);
  border-radius: 14px; padding: 18px; color: var(--text);
}

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.85);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 11px 22px; border-radius: 980px; z-index: 200;
  animation: toastIn 0.3s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 桌面适配 ---------- */
@media (min-width: 640px) {
  .page { padding-top: 56px; }
  .hero-title { font-size: 52px; }
  .quiz-options { max-width: 460px; margin: 0 auto; }
  .modal { align-items: center; }
  .modal-body { border-radius: 22px; max-width: 520px; }
  .result-actions { max-width: 380px; margin-left: auto; margin-right: auto; }
}
