/* ============ 心屿测评 · SCL-90 精简版 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --violet: #8b5cf6;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1e2235;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #eef0f6;
  --green: #22c55e;
  --yellow: #ca8a04;
  --orange: #ea580c;
  --red: #dc2626;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(46, 52, 102, 0.08);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

.screen { display: none; min-height: 100vh; padding-bottom: 40px; }
.screen.active { display: block; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 16px;
  padding: 22px 20px;
}

.btn {
  border: none; border-radius: 14px; font-size: 1rem; font-weight: 600;
  padding: 14px 20px; cursor: pointer; transition: transform .12s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible, .quiz-option:focus-visible, .fd-head:focus-visible, .topbar-back:focus-visible {
  outline: 3px solid rgba(99, 102, 241, .35);
  outline-offset: 3px;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--violet)); color: #fff; box-shadow: 0 6px 16px rgba(99, 102, 241, .35); }
.btn-ghost { background: #f1f2f8; color: var(--text-2); }
.btn-block { display: block; width: 100%; }

.brand-badge {
  display: inline-block; background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  font-size: .8rem; padding: 5px 14px; letter-spacing: 2px; margin-bottom: 14px;
}

.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; background: rgba(244,245,251,.92); backdrop-filter: blur(8px);
  font-weight: 600;
}
.topbar-back { border: none; background: none; font-size: 1.6rem; line-height: 1; color: var(--text-2); cursor: pointer; padding: 0 6px; }

.foot-disclaimer { text-align: center; color: var(--text-3); font-size: .72rem; padding: 18px 30px 0; line-height: 1.6; }

/* ---------- 卡密页 ---------- */
.key-hero {
  background: linear-gradient(160deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  color: #fff; padding: 64px 24px 90px; text-align: center; border-radius: 0 0 36px 36px;
}
.key-hero h1 { font-size: 1.7rem; letter-spacing: 1px; margin-bottom: 12px; }
.hero-sub { font-size: .85rem; opacity: .85; line-height: 1.8; }
.hero-tags { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hero-tags span {
  font-size: .72rem; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  padding: 4px 12px; border-radius: 999px;
}

.key-card { margin-top: -52px; position: relative; }
.key-card h2 { font-size: 1.15rem; text-align: center; }
.key-tip { text-align: center; color: var(--text-3); font-size: .76rem; margin: 8px 0 18px; }
.key-input {
  width: 100%; padding: 15px 16px; font-size: 1rem; text-align: center; letter-spacing: 1px;
  border: 2px solid var(--line); border-radius: 14px; outline: none; transition: border-color .2s;
  text-transform: uppercase; font-family: "Consolas", monospace;
}
.key-input:focus { border-color: var(--primary); }
.key-error { color: var(--red); font-size: .78rem; min-height: 22px; text-align: center; padding-top: 6px; }

/* ---------- 说明页 ---------- */
.intro-card h2 { font-size: 1.15rem; margin-bottom: 14px; }
.intro-list { list-style: none; }
.intro-list li { font-size: .88rem; color: var(--text-2); line-height: 1.7; padding: 8px 0 8px 22px; position: relative; border-bottom: 1px dashed var(--line); }
.intro-list li::before { content: ""; position: absolute; left: 4px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.intro-list b { color: var(--text); }
.intro-notice {
  background: #fff7ed; color: #9a3412; font-size: .76rem; line-height: 1.7;
  border-radius: 12px; padding: 12px 14px; margin: 16px 0;
}
#intro-start { margin-top: 4px; }

/* ---------- 答题页 ---------- */
.progress-track { height: 5px; background: #e5e7f2; margin: 0 16px; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--violet)); border-radius: 99px; transition: width .25s ease; }

.quiz-card { margin-top: 18px; }
.quiz-question { font-size: 1.22rem; font-weight: 700; line-height: 1.6; margin-bottom: 20px; }
.quiz-options { display: flex; flex-direction: column; gap: 12px; }
.quiz-option {
  display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  width: 100%; border: 2px solid var(--line); border-radius: 14px; cursor: pointer;
  font: inherit; font-size: .95rem; text-align: left; color: var(--text);
  transition: all .15s; background: #fff;
}
.quiz-option:disabled { cursor: default; opacity: 1; }
.quiz-option .opt-key {
  width: 30px; height: 30px; border-radius: 50%; background: #f1f2f8; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0;
}
.quiz-option.selected { border-color: var(--primary); background: #eef2ff; }
.quiz-option.selected .opt-key { background: var(--primary); color: #fff; }
.quiz-notice { min-height: 20px; margin-top: 14px; color: var(--orange); font-size: .78rem; line-height: 1.6; text-align: center; }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 10px; }
.quiz-nav .btn { padding: 10px 18px; font-size: .85rem; }

/* ---------- 结果页 ---------- */
.result-hero {
  background: linear-gradient(160deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  color: #fff; padding: 46px 24px 70px; text-align: center; border-radius: 0 0 36px 36px;
}
.result-hero h1 { font-size: 1.5rem; letter-spacing: 2px; }
.result-date { font-size: .78rem; opacity: .8; margin-top: 8px; }

.overall-card { margin-top: -46px; text-align: center; }
.overall-label { font-size: .85rem; color: var(--text-2); font-weight: 600; letter-spacing: 2px; }
.overall-score { font-size: 3.4rem; font-weight: 800; line-height: 1.15; margin-top: 8px; font-variant-numeric: tabular-nums; }
.overall-full { font-size: .74rem; color: var(--text-3); }
.overall-level-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0 10px; }
.overall-advice { font-size: .78rem; color: var(--text-2); }
.overall-summary { font-size: .86rem; color: var(--text-2); line-height: 1.8; background: #f8f9fe; border-radius: 12px; padding: 14px; margin-top: 10px; text-align: left; }
.overall-top { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.overall-top .top-chip { font-size: .74rem; padding: 5px 12px; border-radius: 999px; background: #eef2ff; color: var(--primary-dark); font-weight: 600; }

.level-badge {
  display: inline-block; font-size: .74rem; font-weight: 700; padding: 4px 12px; border-radius: 999px; color: #fff;
}
.level-badge.lg { font-size: .9rem; padding: 7px 22px; border-radius: 12px; }

.crisis-card { background: #fef2f2; border: 1px solid #fecaca; }
.crisis-title { color: var(--red); font-weight: 700; font-size: .92rem; margin-bottom: 8px; }
.crisis-card p { font-size: .82rem; color: #7f1d1d; line-height: 1.8; }

.card-heading { color: var(--text); font-size: 1.12rem; font-weight: 750; text-align: center; letter-spacing: 2px; }
.section-subtitle { margin-top: 7px; color: var(--text-3); font-size: .74rem; text-align: center; }
.radar-card { padding-bottom: 16px; }
.radar-wrap { width: 100%; margin-top: 8px; }
#factor-radar { display: block; width: 100%; height: 340px; }
.radar-note { padding-top: 8px; border-top: 1px solid var(--line); color: var(--text-3); font-size: .7rem; line-height: 1.6; text-align: center; }

.section-title { font-size: 1.02rem; font-weight: 700; margin: 26px 16px 4px; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; }
.legend span { font-size: .72rem; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

.factor-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.factor-table th { color: var(--text-3); font-weight: 500; font-size: .74rem; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.factor-table td { padding: 11px 6px; border-bottom: 1px solid var(--line); }
.factor-table tr:last-child td { border-bottom: none; }
.factor-table .fd-name { font-weight: 600; }
.factor-table .fd-score { font-variant-numeric: tabular-nums; }
.factor-table .fd-mean { font-weight: 700; font-variant-numeric: tabular-nums; }
.scale-note { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--text-3); font-size: .68rem; line-height: 1.65; }

.factor-detail { margin: 14px 16px; padding: 0; overflow: hidden; }
.fd-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 17px 18px 12px; border: 0; background: transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.fd-head-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.fd-head-right { display: flex; align-items: baseline; gap: 4px; flex-shrink: 0; }
.fd-name { font-weight: 700; font-size: .98rem; }
.fd-score-num { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fd-score-unit { color: var(--text-2); font-size: .72rem; white-space: nowrap; }
.fd-sub { font-size: .7rem; color: var(--text-3); padding: 0 18px 12px; margin-top: -6px; }
.fd-arrow { margin-left: 5px; color: var(--text-3); transition: transform .2s; font-size: .8rem; }
.factor-detail.open .fd-arrow { transform: rotate(90deg); }
.fd-body { display: none; padding: 0 18px 18px; }
.factor-detail.open .fd-body { display: block; }
.fd-description { margin: 2px 0 12px; color: var(--text-2); font-size: .84rem; line-height: 1.85; }
.fd-block { background: #f8f9fe; border-radius: 12px; padding: 13px 14px; margin-top: 10px; }
.fd-block-title { font-size: .78rem; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.fd-block-title i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.fd-block p { font-size: .82rem; color: var(--text-2); line-height: 1.85; }

.guidance-title { display: flex; align-items: center; gap: 8px; }
.guidance-title svg { width: 22px; height: 22px; fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guidance-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.guidance-card { display: flex; align-items: flex-start; gap: 14px; margin: 0 16px; padding: 18px; }
.guidance-icon {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 12px; background: #eef2ff; color: var(--primary);
}
.guidance-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.guidance-content h3 { margin: 1px 0 7px; font-size: .92rem; }
.guidance-content p { color: var(--text-2); font-size: .8rem; line-height: 1.8; }
.guidance-card.professional { background: #f8f7ff; border: 1px solid #e4e1ff; }

.result-actions { margin: 26px 16px 0; display: flex; flex-direction: column; gap: 12px; }

/* ---------- 分享弹层 ---------- */
.share-modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 20, 40, .82);
  display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto;
}
.share-inner { max-width: 380px; width: 100%; margin: auto; }
.share-inner img {
  display: block; width: 100%; max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px);
  object-fit: contain; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.share-tip { color: rgba(255,255,255,.85); font-size: .78rem; text-align: center; margin: 14px 0; }
.share-inner .btn-ghost { background: rgba(255,255,255,.14); color: #fff; }

@media (max-width: 360px) {
  html { font-size: 15px; }
  #factor-radar { height: 310px; }
  .fd-head { padding-left: 15px; padding-right: 15px; }
  .fd-head-right { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
