:root {
  --primary: #7fc99c;
  --primary-deep: #3f8f6b;
  --primary-soft: #e5f4ea;
  --ink: #243b31;
  --ink-2: #4c6258;
  --ink-3: #7d9188;
  --paper: #f6f9f4;
  --card: #ffffff;
  --line: rgba(36, 59, 49, 0.12);
  --gold: #c9a24b;
  --rose: #cf8b9c;
  --blue: #6d8fb2;
  --violet: #9a8fbe;
  --danger: #c65d5d;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(36, 59, 49, 0.08);
  --shadow-sm: 0 2px 10px rgba(36, 59, 49, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
}

img { max-width: 100%; display: block; }

button, input {
  font: inherit;
  color: inherit;
}

button { cursor: pointer; }

a { color: var(--primary-deep); text-decoration: none; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

.view {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px 36px;
  flex: 1;
}

/* 顶部导航 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  object-fit: cover;
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-size: 17px;
  color: var(--ink);
}

.brand-text small {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.topnav a {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}

.topnav a.active {
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 600;
}

.auth-chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  border-radius: 999px;
  min-height: 30px;
  padding: 2px 10px;
  font-size: 12px;
  white-space: nowrap;
  flex: none;
}

.auth-chip.ok {
  border-color: rgba(63, 143, 107, 0.35);
  background: var(--primary-soft);
  color: var(--primary-deep);
}

/* 首页 */
.hero {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  margin: 14px 0 18px;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
  background: var(--ink);
}

.hero-bg {
  position: absolute;
  inset: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 38, 30, 0.08) 0%, rgba(20, 38, 30, 0.62) 72%, rgba(20, 38, 30, 0.82) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 26px 22px 22px;
  color: #fff;
  width: 100%;
}

.hero-content .hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  opacity: 0.92;
  margin-bottom: 8px;
}

.hero-content .hero-brand img {
  width: 26px;
  height: 26px;
  border-radius: 5px;
}

.hero-content h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: 0;
}

.hero-content p {
  margin: 0 0 14px;
  font-size: 14px;
  opacity: 0.88;
  max-width: 460px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-align: center;
}

.btn:active { transform: translateY(1px); }

.btn.ghost {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.btn.dark {
  background: var(--ink);
  color: #fff;
}

.btn.outline {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink-2);
}

.btn.small {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 13px;
}

.btn.block { width: 100%; }

.section {
  margin: 22px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
}

.section-head .more {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}

.module-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.module-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 132px;
  text-align: left;
  color: var(--ink);
}

.module-card .module-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 19px;
  background: var(--primary-soft);
}

.module-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.module-card p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.module-card .module-meta {
  margin-top: auto;
  font-size: 12px;
  color: var(--ink-2);
}

.intro-band {
  background: var(--primary-soft);
  border: 1px solid rgba(63, 143, 107, 0.18);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.intro-band .band-icon {
  font-size: 22px;
  flex: none;
}

.intro-band p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

/* 列表卡片 */
.list-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: block;
  color: var(--ink);
}

.list-card + .list-card { margin-top: 10px; }

.list-card .card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.list-card .card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
}

.list-card h3 {
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1.4;
}

.list-card .tagline {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
}

.list-card .card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11px;
  white-space: nowrap;
}

.pill.gold {
  background: #f7efd9;
  border-color: rgba(201, 162, 75, 0.35);
  color: #8a671c;
}

.pill.green {
  background: var(--primary-soft);
  border-color: rgba(63, 143, 107, 0.3);
  color: var(--primary-deep);
}

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--ink-3);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty .empty-icon { font-size: 34px; margin-bottom: 8px; }

.empty p { margin: 4px 0; font-size: 14px; }

/* 问卷详情 */
.test-hero {
  margin: 14px 0 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 12px;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.test-hero::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(127, 201, 156, 0.16);
}

.test-hero .test-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #b9dcc8;
  margin-bottom: 8px;
}

.test-hero h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.35;
  position: relative;
  z-index: 1;
}

.test-hero p {
  margin: 0;
  font-size: 13px;
  opacity: 0.88;
  position: relative;
  z-index: 1;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.meta-row .pill {
  background: rgba(255, 255, 255, 0.9);
}

.notice {
  background: var(--card);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 12px;
}

.start-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.start-panel h2 { margin: 0 0 8px; font-size: 16px; }

.start-panel ul {
  margin: 0 0 16px;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 13px;
}

/* 答题页 */
.quiz-wrap {
  max-width: 560px;
  margin: 0 auto;
}

.quiz-head {
  position: sticky;
  top: 62px;
  z-index: 20;
  background: var(--paper);
  padding: 8px 0 10px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(36, 59, 49, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-deep);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.question-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
  margin-top: 6px;
}

.question-card .q-no {
  font-size: 12px;
  color: var(--primary-deep);
  font-weight: 600;
}

.question-card h2 {
  margin: 6px 0 16px;
  font-size: 18px;
  line-height: 1.5;
}

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

.option-btn {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.option-btn:active { transform: translateY(1px); }

.option-btn .opt-letter {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.option-btn.selected {
  border-color: var(--primary-deep);
  background: var(--primary-soft);
}

.option-btn.selected .opt-letter {
  background: var(--primary-deep);
  color: #fff;
  border-color: var(--primary-deep);
}

.quiz-nav {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.quiz-nav .btn { flex: 1; }

/* 过渡动画 */
.transition-wrap {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px 16px;
}

.transition-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary-deep);
  animation: spin 1s linear infinite;
  display: grid;
  place-items: center;
  font-size: 34px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.transition-wrap h2 {
  margin: 20px 0 8px;
  font-size: 20px;
}

.transition-wrap p {
  margin: 0;
  color: var(--ink-3);
  font-size: 13px;
}

.transition-steps {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  text-align: left;
}

.transition-steps .step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}

.transition-steps .step.done { color: var(--primary-deep); }

.transition-steps .step .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
  flex: none;
}

.transition-steps .step.done .dot { background: var(--primary-deep); }

/* 报告 */
.report-head {
  margin: 14px 0 14px;
}

.report-head .crumbs {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.report-head h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.4;
}

.result-hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 14px;
}

.result-hero .figure-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center 30%;
  background: var(--ink);
}

.result-hero .result-body {
  padding: 16px;
}

.result-hero .result-tag {
  display: inline-flex;
  font-size: 12px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 8px;
}

.result-hero h2 {
  margin: 0 0 4px;
  font-size: 23px;
}

.result-hero .result-era {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 8px;
}

.result-hero blockquote {
  margin: 0 0 10px;
  padding: 0 0 0 10px;
  border-left: 3px solid var(--gold);
  color: var(--ink-2);
  font-size: 14px;
}

.result-hero p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.score-row {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}

.score-ring {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: conic-gradient(var(--primary-deep) calc(var(--score) * 1%), var(--primary-soft) 0);
  display: grid;
  place-items: center;
  position: relative;
}

.score-ring::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--card);
}

.score-ring .score-inner {
  position: relative;
  text-align: center;
  z-index: 1;
}

.score-ring .score-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
}

.score-ring .score-label {
  font-size: 11px;
  color: var(--ink-3);
}

.score-copy h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.score-copy p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-2);
}

.score-copy .pill { font-size: 12px; }

.block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 14px;
}

.block h3 {
  margin: 0 0 12px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.block h3 .block-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  font-size: 14px;
}

.radar-box {
  width: 100%;
  max-width: 320px;
  margin: 0 auto 6px;
  aspect-ratio: 1 / 1;
}

.radar-box canvas {
  width: 100%;
  height: 100%;
}

.radar-note {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  margin: 0;
}

.dim-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dim-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
}

.dim-item .dim-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--paper);
}

.dim-item .dim-info {
  min-width: 0;
}

.dim-item .dim-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 4px;
}

.dim-item .dim-top b { font-weight: 600; }

.dim-item .dim-top span { color: var(--ink-3); }

.dim-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}

.dim-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary-deep);
}

.dim-desc {
  font-size: 12px;
  color: var(--ink-3);
  margin: 3px 0 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-list .pill { font-size: 12px; min-height: 26px; }

.list-with-num {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-with-num li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}

.list-with-num li .num {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.advice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.advice-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--paper);
}

.advice-item b {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--ink);
}

.advice-item p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.report-actions {
  position: sticky;
  bottom: 10px;
  z-index: 20;
  display: flex;
  gap: 10px;
  background: rgba(246, 249, 244, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.report-actions .btn { flex: 1; }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(23, 36, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal {
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow: auto;
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 22px;
  position: relative;
}

.modal .modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1;
}

.modal h3 {
  margin: 0 0 6px;
  font-size: 19px;
}

.modal .modal-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--ink-3);
}

.code-input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  margin-bottom: 12px;
}

.code-input:focus {
  border-color: var(--primary-deep);
  background: #fff;
}

.modal .btn { width: 100%; margin-top: 4px; }

.modal .modal-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
}

.poster-preview {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: #fff;
}

/* Toast */
.toast-root {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: 86vw;
}

.toast {
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 18px 16px 26px;
  margin-top: auto;
}

.site-footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.site-footer img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  margin-bottom: 2px;
}

.site-footer p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
}

.site-footer span {
  font-size: 11px;
  color: var(--ink-3);
}

@media (min-width: 520px) {
  .module-grid { grid-template-columns: repeat(3, 1fr); }
  .module-card { min-height: 148px; }
  .advice-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { min-height: 340px; }
  .hero-content h1 { font-size: 32px; }
}

@media (max-width: 420px) {
  .topnav a { padding: 6px; font-size: 12px; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 16px; }
  .score-row { grid-template-columns: 112px 1fr; }
  .score-ring { width: 104px; height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
