/* =========================================================
   MBTI 人格实验室 · components.css
   各视图组件：首页 / 说明 / 答题 / 分析 / 结果 / 历史
   ========================================================= */

/* ---------- 视图切换 ---------- */
.view { display: none; }
.view.active { display: block; animation: viewIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ---------- 首页 · Hero ---------- */
.hero { text-align: center; padding: 44px 0 28px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-2);
  margin-bottom: 22px;
  animation: fadeUp 0.7s ease both;
}
.hero-title {
  font-size: clamp(38px, 6.4vw, 64px);
  font-weight: 900; line-height: 1.15; letter-spacing: 1px;
  animation: fadeUp 0.7s 0.08s ease both;
}
.grad-text {
  background: var(--grad-main);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(124, 111, 240, 0.4));
}
.hero-sub {
  max-width: 640px; margin: 20px auto 0; color: var(--text-2);
  font-size: 17px; line-height: 1.8;
  animation: fadeUp 0.7s 0.16s ease both;
}
.hero-actions {
  display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
  margin-top: 34px;
  animation: fadeUp 0.7s 0.24s ease both;
}
.hero-stats {
  margin-top: 40px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap;
  animation: fadeUp 0.7s 0.32s ease both;
}
.stat-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 14px; color: var(--text-2);
}
.stat-chip b { font-size: 20px; font-weight: 800; color: var(--text-1); background: var(--grad-main); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-chip span { font-size: 12px; color: var(--text-3); }

/* ---------- 区块标题 ---------- */
.sec-title {
  text-align: center; margin: 64px 0 30px;
  font-size: 26px; font-weight: 800;
}
.sec-title small {
  display: block; margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--text-3);
}

/* ---------- 维度卡片 ---------- */
.dims-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}
.dim-card {
  padding: 26px 22px; text-align: center;
  --ring: color-mix(in srgb, var(--c) 26%, transparent);
}
.dim-icon {
  width: 58px; height: 58px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 26px;
  border-radius: 18px;
  background: var(--ring); color: var(--c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent);
  animation: iconFloat 4.5s ease-in-out infinite;
}
.dim-card:nth-child(2) .dim-icon { animation-delay: 0.6s; }
.dim-card:nth-child(3) .dim-icon { animation-delay: 1.2s; }
.dim-card:nth-child(4) .dim-icon { animation-delay: 1.8s; }
.dim-card h3 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.dim-card p { font-size: 15px; color: var(--text-2); }
.dim-card p b { font-weight: 800; font-size: 17px; }
.dim-card p b.a { color: var(--c); }
.dim-card p b.b { color: var(--accent-2); }
.dim-card p i { font-style: normal; margin: 0 8px; color: var(--text-3); }
.dim-card small { display: block; margin-top: 8px; font-size: 12px; color: var(--text-3); }

/* ---------- 功能卡片 ---------- */
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.feat-card { padding: 24px 22px; }
.feat-ico {
  width: 46px; height: 46px; display: grid; place-items: center;
  font-size: 22px; border-radius: 14px;
  background: var(--card-strong); border: 1px solid var(--card-border);
  margin-bottom: 14px;
}
.feat-card h3 { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.feat-card p { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }

/* ---------- 说明页 ---------- */
.intro-card { max-width: 620px; margin: 0 auto; padding: 40px 36px; }
.intro-head { text-align: center; margin-bottom: 28px; }
.intro-emoji { font-size: 46px; margin-bottom: 10px; animation: iconFloat 4s ease-in-out infinite; }
.intro-head h2 { font-size: 26px; font-weight: 900; }
.intro-head p { color: var(--text-3); font-size: 14px; margin-top: 6px; }
.intro-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 30px; }
.intro-list li {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 16px 18px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.intro-list li:hover { transform: translateX(6px); border-color: var(--card-hover-border); }
.intro-list b {
  flex-shrink: 0; font-size: 13px; font-weight: 800; color: #fff;
  background: var(--grad-main); border-radius: 8px; padding: 3px 9px;
  box-shadow: var(--glow-soft);
}
.intro-list span { font-size: 14.5px; color: var(--text-2); line-height: 1.7; }
.intro-list em { font-style: normal; font-weight: 800; color: var(--text-1); }
.intro-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- 答题页 ---------- */
.quiz-wrap { max-width: 720px; margin: 0 auto; padding: 30px 32px 26px; }
.quiz-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.quiz-count { font-size: 14px; font-weight: 700; color: var(--text-2); }
.quiz-dim {
  font-size: 12.5px; font-weight: 700; color: var(--accent-1);
  background: var(--card-strong); border: 1px solid var(--card-border);
  padding: 4px 12px; border-radius: 999px;
}
.progress {
  height: 8px; border-radius: 999px; background: var(--track);
  overflow: hidden; position: relative; margin-bottom: 26px;
}
.progress-bar {
  height: 100%; border-radius: 999px;
  background: var(--grad-main);
  background-size: 200% 100%;
  animation: progressSheen 3s linear infinite;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 12px rgba(124, 111, 240, 0.6);
}
.quiz-question {
  font-size: clamp(19px, 3vw, 24px); font-weight: 800; line-height: 1.6;
  margin-bottom: 26px; min-height: 2.4em;
}
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  cursor: pointer; font-size: 15px; font-weight: 600; color: var(--text-2);
  transition: all 0.25s ease;
  text-align: left;
}
.opt:hover { border-color: var(--card-hover-border); color: var(--text-1); transform: translateX(4px); }
.opt .opt-key {
  flex-shrink: 0; width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 9px; font-size: 12.5px; font-weight: 800;
  background: var(--card-strong); border: 1px solid var(--card-border);
  color: var(--text-3); transition: all 0.25s ease;
}
.opt:hover .opt-key { color: var(--accent-1); border-color: var(--accent-1); }
.opt.selected {
  border-color: transparent; color: #fff;
  background: var(--grad-main); box-shadow: var(--glow);
  transform: translateX(4px);
}
.opt.selected .opt-key { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.35); color: #fff; }
.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }
.quiz-hint { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--text-3); }

/* ---------- 分析中 ---------- */
.computing {
  max-width: 440px; margin: 60px auto; padding: 60px 36px;
  text-align: center;
}
.loader-ring { position: relative; width: 110px; height: 110px; margin: 0 auto 30px; }
.loader-ring i {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid transparent;
}
.loader-ring i:nth-child(1) { border-top-color: var(--accent-1); animation: spin 1.1s linear infinite; }
.loader-ring i:nth-child(2) { inset: 16px; border-right-color: var(--accent-2); animation: spin 1.4s linear infinite reverse; }
.loader-ring i:nth-child(3) { inset: 32px; border-bottom-color: var(--accent-3); animation: spin 0.9s linear infinite; }
.loader-ring i:nth-child(4) {
  inset: 44px; background: var(--grad-main); border-radius: 50%;
  animation: pulseSoft 1.4s ease-in-out infinite;
}
.computing h3 { font-size: 17px; font-weight: 700; color: var(--text-2); min-height: 1.6em; }
.computing-dots { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.computing-dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--grad-main); animation: dotJump 1.2s ease-in-out infinite;
}
.computing-dots i:nth-child(2) { animation-delay: 0.15s; }
.computing-dots i:nth-child(3) { animation-delay: 0.3s; }

/* ---------- 结果页 ---------- */
.result-wrap { max-width: 760px; margin: 0 auto; }
.result-head { padding: 36px 32px 30px; text-align: center; position: relative; overflow: hidden; }
.result-head::before {
  content: ""; position: absolute; top: -90px; right: -90px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, var(--type-glow, rgba(124,111,240,0.18)), transparent 70%);
  pointer-events: none;
}
.type-badge { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.type-badge .letter {
  width: 64px; height: 76px; display: grid; place-items: center;
  font-size: 38px; font-weight: 900;
  border-radius: 16px; letter-spacing: 0;
  background: color-mix(in srgb, var(--tc, #7c6ff0) 14%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--tc, #7c6ff0) 45%, transparent);
  color: var(--tc, #7c6ff0);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--tc, #7c6ff0) 22%, transparent);
  animation: letterPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  transition: transform 0.3s ease;
}
.type-badge .letter:hover { transform: translateY(-4px) rotate(-3deg); }
.type-badge .letter:nth-child(2) { animation-delay: 0.08s; }
.type-badge .letter:nth-child(3) { animation-delay: 0.16s; }
.type-badge .letter:nth-child(4) { animation-delay: 0.24s; }

.result-type-name { font-size: 30px; font-weight: 900; margin-top: 6px; }
.result-type-name .type-en { font-size: 17px; font-weight: 600; color: var(--text-3); margin-left: 8px; }
.result-tagline {
  margin: 10px auto 0; max-width: 560px;
  font-size: 15px; color: var(--text-2); font-style: italic;
}
.type-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  background: var(--card-strong); border: 1px solid var(--card-border);
  color: var(--text-2);
}

/* 维度条 */
.dim-bars { margin-top: 28px; display: flex; flex-direction: column; gap: 18px; text-align: left; }
.dim-bar { }
.dim-bar-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; margin-bottom: 7px;
}
.dim-bar-label .dl { font-weight: 800; color: var(--text-1); }
.dim-bar-label .dl small { font-weight: 600; color: var(--text-3); margin-left: 8px; }
.dim-bar-label .dp { font-weight: 800; }
.dim-track {
  position: relative; height: 16px; border-radius: 999px;
  background: var(--track); overflow: hidden;
}
.dim-fill-l, .dim-fill-r { position: absolute; top: 0; bottom: 0; transition: width 1s cubic-bezier(0.22, 1, 0.36, 1); }
.dim-fill-l { left: 0; border-radius: 999px 2px 2px 999px; }
.dim-fill-r { right: 0; border-radius: 2px 999px 999px 2px; }
.dim-marker {
  position: absolute; top: -3px; bottom: -3px; width: 4px; border-radius: 4px;
  background: var(--text-1); box-shadow: 0 0 8px rgba(0,0,0,0.4);
  transition: left 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 标签页 */
.result-tabs { margin-top: 18px; padding: 22px 28px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--card-border); padding-bottom: 14px; }
.tab-btn {
  padding: 8px 16px; border-radius: 11px;
  font-size: 14px; font-weight: 700; color: var(--text-3);
  transition: all 0.25s ease;
}
.tab-btn:hover { color: var(--text-1); background: var(--sel-bg); }
.tab-btn.active {
  color: #fff; background: var(--grad-main); box-shadow: var(--glow-soft);
}
.tab-panel { padding-top: 20px; min-height: 150px; animation: fadeUp 0.4s ease both; }
.tab-panel h4 { font-size: 15px; font-weight: 800; margin-bottom: 12px; color: var(--text-2); }
.tab-desc { font-size: 15px; line-height: 1.9; color: var(--text-2); }
.tab-desc em { font-style: normal; font-weight: 800; color: var(--text-1); }
.tab-list { display: flex; flex-direction: column; gap: 10px; }
.tab-list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--card-border);
  font-size: 14.5px; color: var(--text-2); line-height: 1.6;
  transition: transform 0.25s ease;
}
.tab-list li:hover { transform: translateX(4px); }
.tab-list .ti { flex-shrink: 0; }
.tab-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.tab-chips .chip { padding: 9px 16px; font-size: 13.5px; }
.match-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  animation: fadeUp 0.4s ease both;
}
.match-badge {
  flex-shrink: 0; display: flex; gap: 4px;
  font-weight: 900; font-size: 18px;
}
.match-badge span {
  width: 38px; height: 44px; display: grid; place-items: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c, #7c6ff0) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, #7c6ff0) 40%, transparent);
  color: var(--c, #7c6ff0);
}
.match-info h4 { font-size: 15px; font-weight: 800; }
.match-info p { font-size: 13px; color: var(--text-3); margin-top: 2px; }

.result-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: 22px;
}
.result-disclaimer { text-align: center; margin-top: 20px; font-size: 12.5px; color: var(--text-3); }

/* 偏好小结（概述页） */
.pref-summary {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px;
}
.pref-summary .chip {
  padding: 7px 16px; font-size: 13px;
  background: var(--card-strong); border-color: var(--card-hover-border);
  color: var(--text-1);
}

/* 深度解读板块 */
.detail-block {
  padding: 16px 18px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  margin-bottom: 12px;
  transition: transform 0.25s ease, border-color 0.25s ease;
  animation: fadeUp 0.4s ease both;
}
.detail-block:hover { transform: translateX(4px); border-color: var(--card-hover-border); }
.detail-block h4 { font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.detail-block p { font-size: 14px; line-height: 1.85; color: var(--text-2); }

/* ---------- 历史页 ---------- */
.history-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.history-head h2 { font-size: 26px; font-weight: 900; }
.history-sub { font-size: 13.5px; color: var(--text-3); margin-top: 4px; }
.history-tools { display: flex; gap: 10px; align-items: center; }
.select {
  padding: 9px 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--card-border);
  color: var(--text-1); font-size: 14px; font-weight: 600;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  cursor: pointer; outline: none;
}
.select:focus-visible { border-color: var(--accent-2); }
.select option { background: var(--bg-1); color: var(--text-1); }

.history-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.history-item {
  padding: 20px 20px 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 12px;
  animation: fadeUp 0.45s ease both;
}
.history-item:hover { transform: translateY(-4px); }
.hi-top { display: flex; justify-content: space-between; align-items: center; }
.hi-type {
  display: flex; align-items: center; gap: 10px;
  font-size: 17px; font-weight: 900; color: var(--tc, var(--accent-1));
}
.hi-type .hi-code {
  width: 46px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; font-size: 15px;
  background: color-mix(in srgb, var(--tc, #7c6ff0) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc, #7c6ff0) 38%, transparent);
}
.hi-date { font-size: 12px; color: var(--text-3); }
.hi-name { font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.hi-mini { display: flex; gap: 6px; flex-wrap: wrap; }
.hi-mini span {
  flex: 1; min-width: 60px; padding: 4px 8px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--card-border);
  text-align: center; font-size: 11px; font-weight: 700; color: var(--text-3);
}
.hi-mini b { display: block; font-size: 12.5px; color: var(--text-1); }
.hi-actions { display: flex; gap: 8px; }
.hi-actions .btn { flex: 1; padding: 8px 10px; font-size: 12.5px; border-radius: 10px; }

.empty-state { text-align: center; padding: 80px 20px; }
.empty-ico { font-size: 54px; margin-bottom: 14px; animation: iconFloat 4s ease-in-out infinite; }
.empty-state h3 { font-size: 20px; font-weight: 800; }
.empty-state p { color: var(--text-3); margin: 8px 0 22px; font-size: 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  main#app { padding-top: 92px; }
  .quiz-wrap { padding: 22px 18px 20px; }
  .result-head { padding: 28px 20px 24px; }
  .result-tabs { padding: 18px 16px; }
  .tabs { gap: 4px; }
  .tab-btn { padding: 7px 11px; font-size: 13px; }
  .type-badge .letter { width: 54px; height: 64px; font-size: 32px; }
  .intro-card { padding: 28px 20px; }
  .brand-name em { display: none; }
  .nav-btn b { display: none; }
  .history-head { flex-direction: column; align-items: stretch; }
  .history-tools { justify-content: space-between; }
}
