/* ============================================================
   测评工坊 Quiz Studio - 样式
   设计基调：淡紫 × 白 × 薄荷绿点缀；圆角卡片 + 柔和阴影；
   移动端优先，桌面端居中限宽。
   ============================================================ */

:root {
  /* 配色 */
  --purple-50:  #f6f3fc;
  --purple-100: #ede7f9;
  --purple-300: #c9b8ef;
  --purple-500: #8f6fd8;
  --purple-600: #7a58cd;
  --purple-700: #6748b5;
  --mint-100:   #dcf5ea;
  --mint-500:   #3cb98b;
  --mint-600:   #2fa377;
  --ink-900:    #2b2540;
  --ink-600:    #5d5675;
  --ink-400:    #9891ad;
  --white:      #ffffff;
  --danger-500: #e0647c;

  /* 尺寸 */
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-soft: 0 10px 30px rgba(122, 88, 205, 0.10);
  --shadow-card: 0 4px 18px rgba(43, 37, 64, 0.07);
  --max-width: 480px;
}

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

html, body {
  overflow-x: hidden; /* 保证任何宽度下都无横向滚动条 */
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
    "Source Han Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink-900);
  background: linear-gradient(160deg, #f8f6fe 0%, #f2eefb 55%, #eef7f3 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景装饰 ---------- */
.page-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.blob-1 { width: 320px; height: 320px; background: #ddd0f6; top: -90px; left: -80px; }
.blob-2 { width: 260px; height: 260px; background: #cdeede; bottom: -60px; right: -70px; }
.blob-3 { width: 180px; height: 180px; background: #f3d9ec; top: 40%; right: -60px; opacity: 0.4; }

/* ---------- 布局容器 ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 18px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 视图切换 ---------- */
.view { display: none; flex: 1; flex-direction: column; animation: viewIn 0.28s ease; }
.view.is-active { display: flex; }

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

/* ---------- 通用按钮 ---------- */
.btn {
  font: inherit;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: 13px 22px;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
  color: var(--white);
  box-shadow: 0 6px 16px rgba(122, 88, 205, 0.32);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--purple-600), var(--purple-700)); }

.btn-secondary {
  background: var(--white);
  color: var(--purple-600);
  border: 1.5px solid var(--purple-300);
}
.btn-secondary:hover { background: var(--purple-50); }

.btn-ghost {
  background: transparent;
  color: var(--ink-600);
  padding: 8px;
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--purple-100); }

.btn-block { width: 100%; }

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ---------- 首页 ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 26px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--purple-500), var(--purple-700));
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(122, 88, 205, 0.35);
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 1px; color: var(--purple-700); }

.hero-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 30px 26px 26px;
}

.hero-badge {
  display: inline-block;
  background: var(--mint-100);
  color: var(--mint-600);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 27px;
  line-height: 1.35;
  font-weight: 800;
  margin-bottom: 12px;
}

.hero-desc {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-600);
  margin-bottom: 20px;
}

.hero-points { list-style: none; margin-bottom: 24px; }
.hero-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
  color: var(--ink-900);
  padding: 9px 0;
}
.point-icon {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.point-icon-a { background: var(--purple-500); }
.point-icon-b { background: var(--mint-500); }
.point-icon-c { background: #e08bb1; }

.disclaimer {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-400);
  text-align: center;
  line-height: 1.6;
}

.home-footer {
  margin-top: auto;
  padding-top: 26px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-400);
}

/* ---------- 答题页 ---------- */
.quiz-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 22px;
}
.quiz-progress { flex: 1; }
.quiz-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-600);
  margin-bottom: 7px;
}
.progress-track {
  height: 8px;
  background: var(--purple-100);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple-500), var(--mint-500));
  transition: width 0.3s ease;
}

.question-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 22px;
  flex: 1;
}

.question-text {
  font-size: 19px;
  line-height: 1.55;
  font-weight: 700;
  margin-bottom: 20px;
}

.option-list { display: flex; flex-direction: column; gap: 12px; }

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--purple-50);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px; /* 手机端便于手指点击 */
}
.option-item:hover { background: var(--purple-100); }
.option-item:active { transform: scale(0.985); }

.option-item.is-selected {
  border-color: var(--purple-500);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(143, 111, 216, 0.15);
}

.option-letter {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--white);
  border: 1.5px solid var(--purple-300);
  color: var(--purple-600);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.option-item.is-selected .option-letter {
  background: var(--purple-500);
  border-color: var(--purple-500);
  color: #fff;
}

.quiz-nav {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.quiz-nav .btn { flex: 1; }

/* ---------- 结果页 ---------- */
.view-result { justify-content: center; }

.result-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 30px 24px 26px;
}

.result-eyebrow {
  font-size: 13px;
  font-weight: 600;
  color: var(--mint-600);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.result-name {
  font-size: 30px;
  font-weight: 800;
  background: linear-gradient(120deg, var(--purple-600), var(--mint-600));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--purple-600); /* 不支持渐变时的回退 */
  margin-bottom: 8px;
}

.result-tagline {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 18px;
}

.result-type-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.type-chip {
  flex: 1;
  border-radius: var(--radius-sm);
  background: var(--purple-50);
  padding: 9px 4px;
  text-align: center;
  transition: background 0.2s ease;
}
.type-chip-label { font-size: 11px; color: var(--ink-400); display: block; margin-bottom: 3px; }
.type-chip-score { font-size: 17px; font-weight: 800; color: var(--ink-600); }
.type-chip.is-winner { background: var(--mint-100); }
.type-chip.is-winner .type-chip-score { color: var(--mint-600); }

.result-summary {
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-600);
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--purple-100);
  margin-bottom: 18px;
}

.result-block { margin-bottom: 18px; }
.result-block-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--purple-700);
  margin-bottom: 9px;
}

.result-list { list-style: none; }
.result-list li {
  position: relative;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-600);
  padding: 4px 0 4px 18px;
}
.result-list li::before {
  content: "";
  position: absolute;
  left: 2px; top: 13px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mint-500);
}
.result-list-warn li::before { background: var(--purple-300); }

.result-advice {
  background: var(--purple-50);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  margin-bottom: 18px;
}
.result-advice p { font-size: 14px; line-height: 1.8; color: var(--ink-900); }

.result-share { margin-bottom: 22px; }
.share-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink-600);
  background: var(--mint-100);
  border-radius: var(--radius-md);
  padding: 13px 15px;
}

.result-actions { display: flex; gap: 12px; }
.result-actions .btn { flex: 1; }

.copy-fallback { margin-top: 16px; }
.copy-fallback-hint { font-size: 12.5px; color: var(--ink-600); margin-bottom: 8px; }
.copy-fallback textarea {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-900);
  border: 1.5px solid var(--purple-300);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: vertical;
  background: var(--purple-50);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(43, 37, 64, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 84vw;
  text-align: center;
  z-index: 50;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.is-error { background: var(--danger-500); }

/* ---------- 桌面端微调 ---------- */
@media (min-width: 768px) {
  .app { padding-top: 48px; }
  .hero-title { font-size: 30px; }
  .quiz-nav .btn, .result-actions .btn { padding: 14px 22px; }
}

/* 尊重减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
