:root {
  --bg: #ffffff;
  --bg2: #f7f8fa;
  --bg3: #f0f1f5;
  --line: rgba(0,0,0,0.06);
  --line2: rgba(0,0,0,0.12);
  --text: #1a1a1f;
  --text2: #55555a;
  --text3: #88888f;
  --gold: #2d6df6;
  --gold2: #4b89ff;
  --gold3: #6aa3ff;
  --ai:    #2d6df6;
  --cog:   #17c3ba;
  --con:   #ff6b6b;
  --exp:   #ff9f43;
  --sys:   #4dabf7;
  --net:   #51cf66;
  --ene:   #f06595;
  --r: 16px;
  --r2: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans SC', sans-serif;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  width: 100%;
  height: 100%;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' 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)' opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 9999; opacity: .4;
}

.screen { display: none; min-height: 100vh; min-height: -webkit-fill-available; width: 100%; }
.screen.active { display: flex; flex-direction: column; }

/* ══════════ COVER ══════════ */
#s-cover {
  position: relative;
  align-items: center; justify-content: center;
  padding: max(20px, 5vh) 20px;
  overflow: hidden;
  width: 100%;
}

.cover-bg {
  position: absolute; inset: 0; overflow: hidden;
}
.cover-bg-circle {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .12;
}
.cb1 { width: 300px; height: 300px; background: var(--ai); top: -100px; left: -100px; animation: drift1 12s ease-in-out infinite; }
.cb2 { width: 240px; height: 240px; background: var(--ene); bottom: -80px; right: -60px; animation: drift2 10s ease-in-out infinite; }
.cb3 { width: 180px; height: 180px; background: var(--gold); top: 40%; left: 40%; animation: drift3 14s ease-in-out infinite; }

@keyframes drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,20px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-20px,-30px)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(15px,-15px)} }

.cover-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; width: 100%; max-width: 400px;
}

.cover-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 500; letter-spacing: .18em;
  color: var(--gold); text-transform: uppercase;
  border: 1px solid rgba(45,109,246,.3);
  border-radius: 40px; padding: 6px 16px;
  margin-bottom: 24px;
  animation: fadeUp .6s ease both;
}
.eyebrow-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity=1} 50%{opacity=.3} }

.cover-title {
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(28px, 8vw, 36px); font-weight: 700; line-height: 1.2;
  letter-spacing: .02em;
  color: var(--text);
  margin-bottom: 8px;
  animation: fadeUp .6s .1s ease both;
}
.cover-title span { color: var(--gold2); }

.cover-subtitle {
  font-size: 14px; color: var(--text2); line-height: 1.7;
  margin-bottom: 28px;
  animation: fadeUp .6s .2s ease both;
  padding: 0 10px;
}

.name-input-wrap {
  width: 100%;
  max-width: 320px;
  margin-bottom: 14px;
  animation: fadeUp .6s .25s ease both;
}
.name-input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--line2);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.name-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(45,109,246,.12);
}

.cover-dims {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  width: 100%; margin-bottom: 28px;
  animation: fadeUp .6s .3s ease both;
}
.cover-dim {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 6px;
  text-align: center;
  min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cover-dim-icon { font-size: 18px; margin-bottom: 4px; }
.cover-dim-name { font-size: 10px; color: var(--text2); line-height: 1.3; }

.cover-meta {
  display: flex; gap: 20px; margin-bottom: 32px;
  animation: fadeUp .6s .4s ease both;
}
.meta-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.meta-num { font-size: 24px; font-weight: 700; color: var(--gold2); font-family: 'Noto Serif SC', serif; }
.meta-label { font-size: 11px; color: var(--text3); }

.btn-start {
  width: 100%; max-width: 320px;
  padding: 18px;
  background: var(--gold);
  color: #fff;
  border: none; border-radius: 50px;
  font-size: 16px; font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  transition: background .2s, transform .1s;
  animation: fadeUp .6s .5s ease both;
  position: relative; overflow: hidden;
  min-height: 56px;
}
.btn-start::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
  transform: translateX(-100%);
  animation: shimmer 2.5s 1.5s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.btn-start:active { transform: scale(.97); }

@keyframes fadeUp { from { opacity=0; transform:translateY(20px); } to { opacity=1; transform:translateY(0); } }

/* ══════════ QUIZ ══════════ */
#s-quiz { padding: 0; width: 100%; }

.quiz-topbar {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
  flex-shrink: 0;
  width: 100%;
}
.quiz-progress-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.quiz-dim-badge {
  font-size: 11px; font-weight: 500; letter-spacing: .1em;
  padding: 4px 12px; border-radius: 20px;
  white-space: nowrap;
}
.quiz-qnum { font-size: 12px; color: var(--text3); }
.progress-track {
  height: 2px; background: var(--line2); border-radius: 1px; overflow: hidden;
  width: 100%;
}
.progress-fill {
  height: 100%; border-radius: 1px; transition: width .4s ease;
  background: var(--gold);
}

.quiz-body { flex: 1; overflow-y: auto; padding: 24px 20px 120px; width: 100%; }

.q-text {
  font-size: 18px; font-weight: 500; line-height: 1.6;
  color: var(--text); margin-bottom: 24px;
  font-family: 'Noto Serif SC', serif;
  padding-right: 10px;
}

.opts { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.opt {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border: 1px solid var(--line2);
  border-radius: var(--r); cursor: pointer;
  background: var(--bg2);
  transition: border-color .15s, background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  min-height: 70px;
}
.opt:active { transform: scale(.98); }
.opt.selected {
  border-color: var(--gold);
  background: rgba(45,109,246,.06);
}
.opt-letter {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--text2);
  flex-shrink: 0; margin-top: 2px;
  transition: background .15s, color .15s, border-color .15s;
}
.opt.selected .opt-letter {
  background: var(--gold); color: #fff; border-color: var(--gold);
}
.opt-text { font-size: 15px; color: var(--text); line-height: 1.6; flex: 1; }

.quiz-footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  background: var(--bg2);
  border-top: 1px solid var(--line);
  display: flex; gap: 12px;
  width: 100%;
  z-index: 100;
}
/* ———— 已优化：更醒目的上一题按钮 ———— */
.btn-prev {
  width: 56px; height: 52px;
  background: rgba(45, 109, 246, 0.1);
  border: 1px solid var(--gold);
  border-radius: var(--r);
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.btn-prev:active {
  background: var(--gold);
  color: #fff;
  transform: scale(0.98);
}
.btn-prev:disabled {
  opacity: .3;
  cursor: not-allowed;
  border-color: var(--line2);
  color: var(--text2);
  background: var(--bg3);
}
.btn-next {
  flex: 1; padding: 16px;
  background: var(--gold); color: #fff;
  border: none; border-radius: var(--r);
  font-size: 16px; font-weight: 700;
  cursor: pointer; letter-spacing: .04em;
  transition: opacity .15s, transform .1s;
  min-height: 52px;
}
.btn-next:active { transform: scale(.98); }
.btn-next.submit { background: var(--gold2); }

/* ══════════ RESULT ══════════ */
#s-result { padding: 0; overflow-y: auto; width: 100%; }

.result-hero {
  padding: 40px 20px 32px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  text-align: center; position: relative; overflow: hidden;
  width: 100%;
}
.result-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(45,109,246,.08) 0%, transparent 70%);
}
.result-hero-eyebrow {
  font-size: 11px; letter-spacing: .15em; color: var(--gold);
  text-transform: uppercase; margin-bottom: 12px; position: relative;
}
.result-type {
  font-family: 'Noto Serif SC', serif;
  font-size: 24px; font-weight: 700; color: var(--text);
  line-height: 1.3; margin-bottom: 8px; position: relative;
}
.result-score-big {
  font-size: 60px; font-weight: 700; color: var(--gold2);
  font-family: 'Noto Serif SC', serif; line-height: 1;
  margin-bottom: 4px; position: relative;
}
.result-score-label { font-size: 12px; color: var(--text3); position: relative; }

.result-body { padding: 24px 20px 40px; width: 100%; }

.section-label {
  font-size: 11px; letter-spacing: .14em; color: var(--gold);
  text-transform: uppercase; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  width: 100%;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.radar-container {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 16px;
  margin-bottom: 24px; text-align: center;
  width: 100%;
  display: flex; justify-content: center;
}
canvas#radar { width: 100%; max-width: 280px; height: auto; }

.dim-scores { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; width: 100%; }
.dim-score-row { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; width: 100%; }
.dim-score-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dim-score-left { display: flex; align-items: center; gap: 10px; }
.dim-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dim-score-name { font-size: 14px; font-weight: 500; color: var(--text); }
.dim-score-sub { font-size: 11px; color: var(--text3); }
.dim-score-val { font-size: 18px; font-weight: 700; font-family: 'Noto Serif SC', serif; }
.dim-bar-bg { height: 4px; background: var(--line2); border-radius: 2px; overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 2px; transition: width 1s ease; }
.dim-bar-tag { margin-top: 6px; font-size: 11px; }

.profile-block {
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r2); padding: 20px; margin-bottom: 16px;
  width: 100%;
}
.profile-block h3 { font-size: 15px; font-weight: 500; margin-bottom: 12px; color: var(--text); }
.profile-block p { font-size: 13px; color: var(--text2); line-height: 1.8; }
.profile-block p + p { margin-top: 8px; }

.layer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; width: 100%; }
.layer-card { background: var(--bg3); border-radius: 12px; padding: 12px 10px; text-align: center; }
.layer-score { font-size: 22px; font-weight: 700; font-family: 'Noto Serif SC', serif; color: var(--gold2); }
.layer-name { font-size: 11px; color: var(--text3); margin-top: 3px; }

.advice-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); width: 100%; }
.advice-item:last-child { border-bottom: none; }
.advice-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.advice-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.advice-text { font-size: 12px; color: var(--text2); line-height: 1.6; }

.result-cta { padding: 0 20px 40px; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.btn-share-result {
  width: 100%; padding: 16px;
  background: var(--gold); color: #fff;
  border: none; border-radius: 50px;
  font-size: 16px; font-weight: 700; letter-spacing: .04em;
  cursor: pointer; transition: opacity .15s, transform .1s;
  min-height: 56px;
}
.btn-share-result:active { transform: scale(.98); }
.btn-retry2 {
  width: 100%; padding: 14px;
  background: transparent; color: var(--text2);
  border: 1px solid var(--line2); border-radius: 50px;
  font-size: 14px; cursor: pointer; transition: background .15s;
  min-height: 50px;
}
.btn-retry2:active { background: var(--line); }

/* ══════════ SHARE CARD ══════════ */
#s-share {
  align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
  width: 100%;
}
.share-card {
  width: 100%; max-width: 340px;
  background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 20px; overflow: hidden;
}
.share-card-header {
  padding: 28px 20px 24px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f7f8fa 100%);
  text-align: center; border-bottom: 1px solid var(--line);
  position: relative;
}
.share-card-header::before {
  content: '';position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 0%, rgba(45,109,246,.1), transparent 60%),
  radial-gradient(circle at 70% 100%, rgba(45,109,246,.05), transparent 60%);
}
.sc-badge { font-size: 10px; letter-spacing: .18em; color: var(--gold); text-transform: uppercase; margin-bottom: 12px; position: relative; }
.sc-type { font-family: 'Noto Serif SC', serif; font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; position: relative; }
.sc-score { font-size: 52px; font-weight: 700; color: var(--gold2); font-family: 'Noto Serif SC', serif; line-height: 1; position: relative; }
.sc-score-label { font-size: 11px; color: var(--text3); position: relative; }
.share-radar { padding: 16px; text-align: center; }
.share-dims { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 0 16px 16px; }
.share-dim-row { display: flex; align-items: center; gap: 6px; }
.share-dim-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.share-dim-name { font-size: 11px; color: var(--text2); flex: 1; }
.share-dim-val { font-size: 12px; font-weight: 500; }
.share-footer {
  padding: 12px 20px; border-top: 1px solid var(--line);
  text-align: center; font-size: 11px; color: var(--text3); letter-spacing: .05em;
}
.share-actions { display: flex; gap: 10px; padding: 16px 20px 20px; }
.btn-dl {
  flex: 1; padding: 14px;
  background: var(--gold); color: #fff;
  border: none; border-radius: 40px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  min-height: 48px;
}
.btn-back {
  padding: 14px 20px; background: transparent; color: var(--text2);
  border: 1px solid var(--line2); border-radius: 40px;
  font-size: 14px; cursor: pointer;
  min-height: 48px;
}

@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
.shake { animation: shake .3s ease; }

/* 移动端额外兼容 */
@media (max-width: 375px) {
  .cover-dims { grid-template-columns: repeat(2, 1fr); }
  .share-dims { grid-template-columns: 1fr; }
}
