:root {
  --bg-1: #f0f4ff;
  --bg-2: #fef6f9;
  --bg-3: #f6f3ff;
  --ink: #1a1d2e;
  --ink-2: #4b5066;
  --muted: #8a8fa3;
  --line: rgba(26, 29, 46, 0.08);
  --card: #ffffff;
  --card-2: #fafbff;
  --primary: #6366f1;
  --primary-d: #4f46e5;
  --shadow-sm: 0 1px 2px rgba(26, 29, 46, 0.04);
  --shadow-md: 0 8px 24px rgba(99, 102, 241, 0.08), 0 2px 6px rgba(26, 29, 46, 0.05);
  --shadow-lg: 0 20px 50px rgba(99, 102, 241, 0.14), 0 4px 12px rgba(26, 29, 46, 0.06);
  --radius: 16px;

  --t-O: #8b5cf6;
  --t-C: #10b981;
  --t-E: #f59e0b;
  --t-A: #ec4899;
  --t-N: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, var(--bg-1) 0%, transparent 45%),
    radial-gradient(circle at 100% 0%, var(--bg-3) 0%, transparent 45%),
    radial-gradient(circle at 50% 100%, var(--bg-2) 0%, transparent 50%),
    #fdfdff;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html[lang="zh"] body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', 'Inter', sans-serif;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.view { display: none; animation: fadeIn 320ms ease both; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* ---------- Hero ---------- */
.hero { padding: 32px 0 0; }

.badge {
  display: inline-block;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--primary-d);
  background: rgba(99, 102, 241, 0.1);
  border-radius: 999px;
  margin-bottom: 20px;
}

h1 {
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 20px;
}

.grad {
  background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lede {
  font-size: 18px;
  color: var(--ink-2);
  margin: 0 0 28px;
  max-width: 56ch;
}

.lede strong { color: var(--ink); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 160ms ease;
  background: transparent;
  color: var(--ink);
}

.btn.lg { padding: 16px 28px; font-size: 17px; border-radius: 14px; }

.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-d) 100%);
  color: white;
  box-shadow: var(--shadow-md);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn.primary:active { transform: translateY(0); }

.btn.ghost {
  border-color: var(--line);
  background: white;
  color: var(--ink-2);
}
.btn.ghost:hover:not(:disabled) { color: var(--ink); border-color: rgba(99, 102, 241, 0.3); }
.btn.ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.resume { margin-top: 12px; }

.trait-list {
  list-style: none;
  padding: 0;
  margin: 40px 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.trait-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}
.trait-list strong { color: var(--ink); margin-right: 4px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.t-O { background: var(--t-O); }
.dot.t-C { background: var(--t-C); }
.dot.t-E { background: var(--t-E); }
.dot.t-A { background: var(--t-A); }
.dot.t-N { background: var(--t-N); }

.fineprint {
  font-size: 13px;
  color: var(--muted);
  margin-top: 24px;
}

/* ---------- Test view ---------- */
.progress-wrap { margin-bottom: 24px; }

.progress {
  height: 6px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary) 0%, #ec4899 100%);
  border-radius: 999px;
  transition: width 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
.muted { color: var(--muted); font-weight: 400; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}

.q-card {
  padding: 36px 32px 28px;
  animation: qIn 280ms ease both;
}
.q-card.leaving { animation: qOut 180ms ease both; }

@keyframes qIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes qOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-6px); }
}

.q-prefix {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 500;
}

.q-text {
  font-size: clamp(22px, 3.6vw, 28px);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 28px;
  min-height: 2.6em;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 8px;
  font-family: inherit;
  background: var(--card-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 140ms ease;
  color: var(--ink-2);
}
.opt:hover {
  border-color: var(--primary);
  background: white;
  color: var(--ink);
  transform: translateY(-2px);
}
.opt.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(236, 72, 153, 0.06));
  color: var(--primary-d);
}
.opt .num {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.opt .label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

/* ---------- Results ---------- */
.results-header { margin-bottom: 28px; }
.results-header h1 { font-size: clamp(28px, 4.5vw, 40px); margin-bottom: 12px; }

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.trait-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: traitIn 400ms ease both;
}
.trait-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--trait-color, var(--primary));
}

.trait-card[data-trait="O"] { --trait-color: var(--t-O); }
.trait-card[data-trait="C"] { --trait-color: var(--t-C); }
.trait-card[data-trait="E"] { --trait-color: var(--t-E); }
.trait-card[data-trait="A"] { --trait-color: var(--t-A); }
.trait-card[data-trait="N"] { --trait-color: var(--t-N); }

@keyframes traitIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.trait-card:nth-child(1) { animation-delay: 0ms; }
.trait-card:nth-child(2) { animation-delay: 60ms; }
.trait-card:nth-child(3) { animation-delay: 120ms; }
.trait-card:nth-child(4) { animation-delay: 180ms; }
.trait-card:nth-child(5) { animation-delay: 240ms; }

.trait-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.trait-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.trait-score {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.trait-score .pct { color: var(--trait-color); font-size: 22px; }
.trait-band {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--trait-color) 14%, transparent);
  color: var(--trait-color);
  margin-left: 8px;
  vertical-align: middle;
}
.trait-tagline {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}

.trait-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}
.trait-bar-fill {
  height: 100%;
  width: 0;
  background: var(--trait-color);
  border-radius: 999px;
  transition: width 800ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.trait-interp {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ---------- Radar ---------- */
.radar-wrap {
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}
#radar { width: 100%; max-width: 360px; height: auto; }
.radar-grid { fill: none; stroke: rgba(26, 29, 46, 0.08); stroke-width: 1; }
.radar-axis { stroke: rgba(26, 29, 46, 0.06); stroke-width: 1; }
.radar-shape {
  fill: rgba(99, 102, 241, 0.18);
  stroke: #6366f1;
  stroke-width: 2;
  stroke-linejoin: round;
}
.radar-dot { stroke: white; stroke-width: 2; }
.radar-label { font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600; fill: var(--ink-2); }
.radar-label-pct { font-size: 10px; fill: var(--muted); }

/* ---------- Combinations ---------- */
.combinations-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}
.combo-card {
  background: linear-gradient(135deg, #f0f4ff, #fef6f9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.combo-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary-d);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.combo-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.combo-summary {
  font-size: 14px;
  color: var(--ink-2);
  font-style: italic;
  margin: 0 0 12px;
}
.combo-desc { font-size: 15px; color: var(--ink); margin: 0 0 14px; line-height: 1.55; }
.combo-section { margin-top: 8px; }
.combo-section h4 {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 4px;
}
.combo-section.strengths h4 { color: var(--t-C); }
.combo-section.watch h4 { color: var(--t-N); }
.combo-section p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.55; }

/* ---------- Trait life-implication sections ---------- */
.trait-implications {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.imp-row h4 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--trait-color, var(--primary));
  margin: 0 0 4px;
}
.imp-row p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }

/* ---------- Email capture ---------- */
.email-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(236, 72, 153, 0.04));
  border: 1px solid var(--line);
  padding: 24px;
  margin-bottom: 20px;
}
.email-card-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.email-card-head p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--ink-2);
}
.email-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.email-form input[type="email"] {
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  background: white;
  color: var(--ink);
  transition: border-color 140ms ease;
}
.email-form input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
}
.email-form .btn {
  white-space: nowrap;
}
.email-form .checkbox {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  margin-top: 4px;
}
.email-form .checkbox input {
  margin-top: 3px;
  cursor: pointer;
  accent-color: var(--primary);
}
.email-fineprint {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.email-success {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
  border-radius: 10px;
  font-size: 14px;
}
.email-success.hidden { display: none; }

/* ---------- Inline email notice (queue mode) ---------- */
.email-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  font-size: 13px;
  color: #92400e;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  line-height: 1.5;
}
.email-notice.hidden { display: none; }
.email-notice strong { color: #78350f; }

/* ---------- Flash toast ---------- */
.flash {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  background: var(--ink);
  color: white;
  font-size: 14px;
  font-weight: 500;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.flash.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Lang toggle ---------- */
.lang-toggle {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: var(--shadow-sm);
}
.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 140ms ease;
}
.lang-toggle button:hover { color: var(--ink); }
.lang-toggle button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: white;
}
.lang-toggle .sep { color: var(--line); }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--muted);
}
.footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
.footer a:hover { color: var(--ink-2); }
.footer .sep { margin: 0 8px; opacity: 0.5; }

/* ---------- Responsive ---------- */
@media (max-width: 540px) {
  .shell { padding: 28px 16px; }
  .q-card { padding: 26px 20px; }
  .scale { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .opt { padding: 14px 4px; }
  .opt .label { display: none; }
  .opt .num { font-size: 20px; }
  .trait-card { padding: 18px 18px 18px 22px; }
  .email-form { grid-template-columns: 1fr; }
  .combo-card { padding: 18px 18px; }
}

/* ---------- Print ---------- */
@media print {
  body { background: white; }
  .no-print { display: none !important; }
  .shell { padding: 0; max-width: 760px; }
  .card, .combo-card, .trait-card { box-shadow: none; break-inside: avoid; }
  h1 { font-size: 28px; }
  .radar-wrap { padding: 12px; }
  .footer { display: none; }
}

/* ---------- A11y ---------- */
.btn:focus-visible, .opt:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
