/* ========== 基础与变量 ========== */
:root {
  --bg-deep: #050508;
  --bg-card: rgba(18, 18, 28, 0.72);
  --bg-card-solid: #12121c;
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #f4f4f8;
  --text-muted: rgba(244, 244, 248, 0.62);
  --text-dim: rgba(244, 244, 248, 0.38);
  --accent-a: #8b5cf6;
  --accent-b: #3b82f6;
  --accent-c: #22d3ee;
  --danger: #f472b6;
  --glow: 0 0 32px rgba(139, 92, 246, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font: "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
}

/* ========== 动态背景 ========== */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 80% at 50% -20%, rgba(88, 28, 135, 0.45), transparent 55%),
    radial-gradient(ellipse 90% 60% at 100% 50%, rgba(37, 99, 235, 0.18), transparent 50%),
    radial-gradient(ellipse 80% 50% at 0% 80%, rgba(34, 211, 238, 0.12), transparent 45%),
    linear-gradient(180deg, #0a0a0f 0%, #050508 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: float-orb 18s var(--ease-out) infinite alternate;
}

.orb-a {
  width: min(420px, 90vw);
  height: min(420px, 90vw);
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.55), transparent 70%);
}

.orb-b {
  width: min(380px, 85vw);
  height: min(380px, 85vw);
  bottom: -10%;
  right: -12%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.45), transparent 70%);
  animation-delay: -6s;
}

@keyframes float-orb {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(24px, 18px) scale(1.08);
  }
}

.grid-noise {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ========== 主布局 ========== */
.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 18px calc(28px + var(--safe-bottom));
  max-width: 520px;
  margin: 0 auto;
}

/* 页面过渡 */
.view {
  width: 100%;
  animation: view-in 0.55s var(--ease-out) both;
}

.view.is-leaving {
  animation: view-out 0.38s ease forwards;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-out {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ========== 卡片 ========== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), var(--glow);
  padding: clamp(22px, 5vw, 32px);
}

.card--tight {
  padding: clamp(18px, 4vw, 24px);
}

/* ========== 首页 ========== */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.28);
  margin-bottom: 18px;
}

.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-c), var(--accent-a));
  box-shadow: 0 0 12px var(--accent-c);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.92);
  }
}

.hero-title {
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  background: linear-gradient(120deg, #fff 0%, #e9d5ff 35%, #93c5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 28px;
  max-width: 38ch;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 16px;
  text-align: center;
}

/* ========== 按钮 ========== */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  border-radius: var(--radius-md);
  padding: 16px 22px;
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out), background 0.22s ease;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 45%, #2563eb 100%);
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn--primary:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 48px rgba(124, 58, 237, 0.55), 0 0 28px rgba(59, 130, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn--primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--stroke);
}

.btn--ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.btn--option {
  width: 100%;
  text-align: left;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.45;
  padding: 16px 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-md);
}

.btn--option:hover:not(:disabled) {
  border-color: rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.1);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.15);
  transform: translateX(4px);
}

.btn--option.is-selected {
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(34, 211, 238, 0.08);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.12);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
  min-width: 120px;
  font-size: 14px;
  padding: 14px 16px;
}

/* ========== 测验顶栏 ========== */
.quiz-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.quiz-back {
  font-size: 13px;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  font-family: inherit;
}

.quiz-back:hover {
  color: var(--text-muted);
}

.quiz-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 22px;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b), var(--accent-c));
  width: 0%;
  transition: width 0.45s var(--ease-out);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.5);
}

.question-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.question-text {
  font-size: clamp(17px, 4.5vw, 20px);
  font-weight: 700;
  line-height: 1.45;
  margin: 0 0 22px;
  color: var(--text);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 12px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-c);
}

.btn--option {
  display: flex;
  align-items: flex-start;
}

/* ========== 分析中 ========== */
.loading-card {
  text-align: center;
  padding: 40px 24px;
}

.loading-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px;
}

.loading-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.loader-ring {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-a);
  border-right-color: var(--accent-c);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-lines {
  max-width: 240px;
  margin: 0 auto;
  text-align: left;
}

.loading-line {
  font-size: 13px;
  color: var(--text-dim);
  margin: 8px 0;
  opacity: 0;
  animation: line-in 0.5s ease forwards;
}

.loading-line:nth-child(1) {
  animation-delay: 0.2s;
}
.loading-line:nth-child(2) {
  animation-delay: 0.45s;
}
.loading-line:nth-child(3) {
  animation-delay: 0.7s;
}
.loading-line:nth-child(4) {
  animation-delay: 0.95s;
}

@keyframes line-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========== 结果页 / 报告卡片 ========== */
.result-wrap {
  width: 100%;
}

.report-card {
  position: relative;
  border-radius: var(--radius-xl);
  padding: clamp(22px, 5vw, 30px);
  background: linear-gradient(165deg, rgba(30, 27, 45, 0.95) 0%, rgba(12, 12, 20, 0.98) 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.report-card::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: radial-gradient(circle at 30% 0%, rgba(139, 92, 246, 0.15), transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(59, 130, 246, 0.12), transparent 40%);
  pointer-events: none;
}

.report-card-inner {
  position: relative;
  z-index: 1;
}

.report-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.report-brand-left {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.report-brand-right {
  font-size: 11px;
  color: var(--text-dim);
}

.result-tagline {
  font-size: 12px;
  color: var(--accent-c);
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: 0.06em;
}

.result-name {
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 900;
  line-height: 1.25;
  margin: 0 0 14px;
  background: linear-gradient(100deg, #fff, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.result-meter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(244, 114, 182, 0.1);
  border: 1px solid rgba(244, 114, 182, 0.25);
  margin-bottom: 18px;
}

.result-meter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
}

.result-meter-bar {
  width: 100px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.result-meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f472b6, #a78bfa);
  transition: width 0.8s var(--ease-out);
}

.result-one {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.result-body {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0 0 18px;
}

.result-twist {
  font-size: 15px;
  color: var(--text);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.1);
  border-left: 3px solid var(--accent-a);
  margin: 0 0 16px;
}

.result-punch {
  font-size: 14px;
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.result-actions {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-watermark {
  position: absolute;
  right: -8px;
  bottom: 60px;
  font-size: 56px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  transform: rotate(-12deg);
  pointer-events: none;
  user-select: none;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(120%);
  z-index: 100;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  background: rgba(30, 27, 45, 0.92);
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s ease;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========== 无障碍：减少动效 ========== */
@media (prefers-reduced-motion: reduce) {
  .view,
  .orb,
  .hero-badge-dot,
  .loader-ring,
  .loading-line {
    animation: none !important;
  }
  .progress-fill {
    transition: none;
  }
  .btn {
    transition: none;
  }
}
