/* ============================================================
   AI 人格测试 · 深空 AI 风
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b0d18;
  --card: rgba(255,255,255,0.05);
  --line: rgba(255,255,255,0.1);
  --text: #e2e8f0;
  --dim: #94a3b8;
  --violet: #7c3aed;
  --cyan: #06b6d4;
  --pink: #f0abfc;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* 背景光效 */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 85% -5%, rgba(124,58,237,0.28), transparent 70%),
    radial-gradient(500px 380px at -10% 100%, rgba(6,182,212,0.22), transparent 70%),
    radial-gradient(400px 300px at 100% 70%, rgba(240,171,252,0.12), transparent 70%);
}

/* 屏幕切换 */
.screen {
  display: none;
  min-height: 100dvh;
  padding: 24px 20px;
  animation: fadeIn .4s ease;
}
.screen.active { display: flex; flex-direction: column; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.grad { background: linear-gradient(90deg, #a78bfa, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- 欢迎页 ---------- */
#screen-welcome { justify-content: center; }
.welcome-inner { text-align: center; }

.logo-badge {
  width: 76px; height: 76px;
  margin: 0 auto 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; color: #fff;
  box-shadow: 0 10px 40px rgba(124,58,237,0.45);
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.welcome-title { font-size: 42px; font-weight: 800; letter-spacing: 2px; }
.welcome-sub { margin-top: 14px; font-size: 17px; color: var(--dim); line-height: 1.7; }

.welcome-meta {
  margin: 26px 0 34px;
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
}
.welcome-meta span {
  font-size: 13px; color: var(--dim);
  background: var(--card); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 999px;
}

.welcome-foot { margin-top: 16px; font-size: 12px; color: rgba(148,163,184,0.7); }

/* ---------- 按钮 ---------- */
.btn-primary {
  width: 100%;
  padding: 16px;
  border: none; border-radius: 18px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  color: #fff; font-size: 17px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(124,58,237,0.35);
  transition: transform .15s, box-shadow .15s;
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 4px 16px rgba(124,58,237,0.3); }

.btn-ghost {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line); border-radius: 18px;
  background: rgba(255,255,255,0.04);
  color: var(--dim); font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.btn-ghost:active { background: rgba(255,255,255,0.09); }

.btn-wide { max-width: 420px; margin: 0 auto; }
#screen-welcome .btn-primary { max-width: 420px; margin: 0 auto; }

/* ---------- 答题页 ---------- */
.quiz-top {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 34px;
}
.progress-track {
  flex: 1; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,0.08); overflow: hidden;
}
.progress-bar {
  height: 100%; width: 9%;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  border-radius: 3px;
  transition: width .35s ease;
}
.quiz-count { font-size: 13px; color: var(--dim); white-space: nowrap; }

.quiz-body { flex: 1; display: flex; flex-direction: column; }
.quiz-q {
  font-size: 20px; font-weight: 700; line-height: 1.6;
  margin-bottom: 26px;
}

.quiz-opts { display: flex; flex-direction: column; gap: 14px; }
.quiz-opt {
  width: 100%; text-align: left;
  padding: 18px 18px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--card);
  color: var(--text); font-size: 16px; line-height: 1.55;
  cursor: pointer;
  transition: border-color .15s, transform .1s, background .2s;
}
.quiz-opt:active { transform: scale(0.98); }
.quiz-opt:hover { border-color: rgba(167,139,250,0.5); }
.quiz-opt.picked {
  border-color: var(--violet);
  background: linear-gradient(90deg, rgba(124,58,237,0.22), rgba(6,182,212,0.18));
  font-weight: 600;
}

/* ---------- 自由写作页 ---------- */
.write-hint { font-size: 13px; color: var(--dim); margin: -14px 0 16px; }
.write-input {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line); border-radius: 16px;
  background: rgba(255,255,255,0.05);
  color: var(--text); font-size: 16px; line-height: 1.7;
  resize: none; outline: none;
  font-family: inherit;
}
.write-input:focus { border-color: var(--cyan); }
#screen-write .btn-primary { margin-top: 22px; }

/* ---------- 结果页 ---------- */
.result-hero {
  text-align: center; padding: 20px 0 10px;
  --pc1: #7c3aed;
  --pc2: #06b6d4;
}
.result-emoji {
  width: 96px; height: 96px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--pc1) 28%, transparent), transparent 72%);
  border: 2px solid color-mix(in srgb, var(--pc2) 55%, transparent);
  box-shadow: 0 10px 40px color-mix(in srgb, var(--pc1) 25%, transparent);
  animation: popIn .55s cubic-bezier(.34,1.56,.64,1) both;
}
.result-stamp {
  display: inline-block;
  font-size: 13px; letter-spacing: 3px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 18px; margin-bottom: 12px;
  animation: fadeUp .5s ease .12s both;
}
.result-name { font-size: 40px; font-weight: 800; animation: fadeUp .6s ease .22s both; }
.result-code {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 15px; font-weight: 700; letter-spacing: 4px;
  color: var(--pc1);
  background: color-mix(in srgb, var(--pc1) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--pc1) 40%, transparent);
  padding: 5px 16px; border-radius: 999px;
  animation: fadeUp .5s ease .16s both;
}
.result-rarity { animation: fadeUp .6s ease .3s both; }
.result-tagline { animation: fadeUp .6s ease .38s both; }

@keyframes popIn {
  from { transform: scale(0) rotate(-12deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes fadeUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.rcard-title.pink { color: #f9a8d4; }
.result-rarity { margin-top: 12px; font-size: 14px; color: #e9d5ff; }
.result-tagline {
  margin: 18px auto 0; max-width: 380px;
  font-size: 16px; line-height: 1.8; color: #cbd5e1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px;
}

.result-cards { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.rcard {
  background: var(--card);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px;
}
.rcard-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.rcard-title.red { color: #fca5a5; }
.rcard-title.violet { color: #a78bfa; }
.rcard-title.cyan { color: #22d3ee; }
.rcard-text { font-size: 15px; line-height: 1.7; color: #cbd5e1; }
.rcard-text .fp-item { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.rcard-text .fp-lean { color: #a78bfa; white-space: nowrap; }

.habit-item { padding: 5px 0; font-size: 14px; line-height: 1.65; color: #cbd5e1; }
.result-identity {
  margin: 14px auto 0; max-width: 380px;
  font-size: 15px; line-height: 1.8; font-weight: 600;
  color: var(--pc1);
  background: color-mix(in srgb, var(--pc1) 10%, transparent);
  border: 1px dashed color-mix(in srgb, var(--pc1) 45%, transparent);
  border-radius: 16px;
  padding: 14px 18px;
  animation: fadeUp .6s ease .46s both;
}
.dim-item { padding: 6px 0; }
.dim-label { font-size: 14px; color: #e2e8f0; }
.sim-note { font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.sim-item { padding: 7px 0; }
.sim-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.sim-name { font-size: 14px; font-weight: 600; color: #e2e8f0; }
.sim-pct { font-size: 14px; font-weight: 700; color: #a78bfa; }
.sim-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.sim-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transition: width .8s ease;
}

.result-model {
  margin-top: 8px; text-align: center;
  font-size: 15px; color: var(--pink);
  font-weight: 600;
}
.result-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }

/* ---------- 分享卡片页 ---------- */
.card-page { display: flex; flex-direction: column; align-items: center; padding-top: 10px; }
.card-frame {
  width: 100%; max-width: 380px;
  border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.card-frame canvas, .card-frame img { display: block; width: 100%; height: auto; }
.card-hint { margin: 16px 0 22px; font-size: 13px; color: var(--dim); }
#screen-card .btn-wide { max-width: 380px; }
