/* ==================== MBTI 测试 — 全局 ==================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6d28d9;
  --primary-dark: #5b21b6;
  --primary-light: #ede9fe;
  --accent: #7c3aed;
  --text: #1e293b;
  --text-light: #64748b;
  --card-bg: #ffffff;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(109, 40, 217, .12);
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, #f5f3ff 0%, #eef2ff 45%, #ede9fe 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 14px 60px;
  -webkit-font-smoothing: antialiased;
}
.container { width: 100%; max-width: 640px; }

.hidden { display: none !important; }
.view { animation: fadeIn .35s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 欢迎页 ==================== */
.hero { text-align: center; margin: 10px 0 22px; }
.hero-badge {
  font-size: 3.2em;
  display: inline-block;
  animation: float 3s ease-in-out infinite;
  margin-bottom: 6px;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.hero h1 {
  font-size: 2em;
  color: var(--primary-dark);
  letter-spacing: 1px;
  font-weight: 800;
}
.hero-sub {
  margin-top: 8px;
  color: var(--text-light);
  font-size: .98em;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .info-grid { grid-template-columns: 1fr; } }
.info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 14px;
}
.info-icon { font-size: 1.6em; }
.info-text { display: flex; flex-direction: column; }
.info-text strong { color: var(--primary-dark); font-size: .95em; }
.info-text span { color: var(--text-light); font-size: .82em; margin-top: 2px; }

.tips { margin: 6px 0 18px; }
.tips p { color: var(--text-light); font-size: .9em; padding: 5px 0; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 1.15em;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(109, 40, 217, .35);
  transition: transform .08s, box-shadow .15s;
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 3px 8px rgba(109, 40, 217, .3); }

.btn-ghost {
  padding: 10px 18px;
  font-size: .95em;
  font-weight: 600;
  background: #fff;
  color: var(--primary);
  border: 2px solid #ddd6fe;
  border-radius: 999px;
  cursor: pointer;
  transition: background .12s;
}
.btn-ghost:hover { background: var(--primary-light); }

.foot { text-align: center; margin-top: 20px; color: #a5b4fc; font-size: .8em; }

/* ==================== 答题页 ==================== */
.quiz-header { margin-bottom: 16px; }
.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .9em;
}
.progress-bar {
  height: 8px;
  background: #e0e7ff;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width .3s ease;
}

.question-card { text-align: center; }
.question-text {
  font-size: 1.35em;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 22px;
  min-height: 2.2em;
  font-weight: 700;
}

.answers { display: flex; flex-direction: column; gap: 12px; }
.answer-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 1.02em;
  color: var(--text);
  transition: all .15s;
}
.answer-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.answer-btn:active { transform: scale(.985); }
.answer-btn.selected { border-color: var(--primary); background: var(--primary-light); }
.answer-key {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid #ddd6fe;
  border-radius: 50%;
  font-weight: 800;
  color: var(--primary);
}
.answer-btn.selected .answer-key { background: var(--primary); color: #fff; border-color: var(--primary); }

.or-divider {
  text-align: center;
  color: #a5b4fc;
  font-size: .85em;
  font-weight: 600;
  letter-spacing: 2px;
}

.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
}
.nav-hint { color: #a5b4fc; font-size: .8em; }

/* ==================== 结果页 ==================== */
.result-hero { text-align: center; padding: 10px 0 4px; animation: fadeIn .5s ease; }
.result-type-badge {
  display: inline-block;
  font-size: 3em;
  font-weight: 900;
  letter-spacing: 4px;
  color: #fff;
  padding: 14px 34px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 12px 30px rgba(109, 40, 217, .35);
  margin-bottom: 14px;
  text-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.result-title { font-size: 1.6em; color: var(--primary-dark); }
.result-subtitle { color: var(--text-light); margin-top: 6px; font-size: 1em; }
.result-keywords {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.result-keywords span {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: .85em;
  font-weight: 600;
}

.dimension-card h3, .detail-card h4 { color: var(--primary-dark); margin-bottom: 14px; }
.dim-row { margin-bottom: 16px; }
.dim-row:last-child { margin-bottom: 4px; }
.dim-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: .88em;
  font-weight: 600;
  color: var(--text);
}
.dim-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e0e7ff;
}
.dim-left, .dim-right { height: 100%; transition: width .8s ease; }
.dim-left { background: linear-gradient(90deg, #8b5cf6, #6d28d9); border-radius: 999px 0 0 999px; }
.dim-right { background: linear-gradient(90deg, #34d399, #10b981); border-radius: 0 999px 999px 0; }
.dim-pct { color: var(--text-light); font-weight: 500; }

.detail-block { margin-bottom: 16px; }
.detail-block h4 { margin-bottom: 6px; font-size: 1em; }
.detail-block p { color: #475569; line-height: 1.7; font-size: .95em; }

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.actions .btn-primary, .actions .btn-ghost { width: auto; display: inline-block; padding: 12px 26px; }

/* 结果页类型主题色动态覆盖 */
#typeBadge.theme { background: linear-gradient(135deg, var(--t1), var(--t2)); box-shadow: 0 12px 30px var(--ts); }
