:root {
  --paper: #f8faf7;
  --ink: #16201d;
  --muted: #65706b;
  --line: #dfe4dc;
  --green: #25a18e;
  --red: #e84855;
  --yellow: #f6c445;
  --blue: #536dfe;
  --cyan: #42b8d4;
  --violet: #7f5af0;
  --surface: #ffffff;
  --shadow: 0 18px 60px rgba(22, 32, 29, 0.12);
  --radius: 8px;
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(248, 250, 247, 0.94), rgba(248, 250, 247, 1)),
    repeating-linear-gradient(
      90deg,
      rgba(37, 161, 142, 0.08) 0,
      rgba(37, 161, 142, 0.08) 1px,
      transparent 1px,
      transparent 56px
    );
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app {
  min-height: 100vh;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(248, 250, 247, 0.9);
  border-bottom: 1px solid rgba(223, 228, 220, 0.8);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  font-size: 16px;
  font-weight: 850;
  background: var(--ink);
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.1;
  font-weight: 850;
}

.brand-sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ghost-btn,
.text-btn,
.primary-btn,
.secondary-btn,
.icon-btn,
.option-btn,
.chip-btn {
  min-height: 42px;
  border-radius: var(--radius);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 15px;
  white-space: nowrap;
  font-weight: 760;
}

.primary-btn {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 10px 24px rgba(22, 32, 29, 0.18);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.text-btn:hover,
.option-btn:hover,
.chip-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.ghost-btn,
.text-btn {
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(22, 32, 29, 0.12);
}

.text-btn {
  border-color: transparent;
}

.icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 18px;
  font-weight: 900;
}

.main {
  flex: 1;
}

.hero {
  min-height: calc(100vh - 63px);
  display: grid;
  align-items: center;
  width: min(940px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 38px;
}

.hero h1 {
  max-width: 650px;
  margin: 0;
  font-size: 58px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
}

.hero h1 span {
  color: var(--green);
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 28px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
  margin-top: 28px;
}

.stat-tile {
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-number {
  margin: 0;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.stat-label {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.content-wrap {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 58px;
}

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

.atlas-head {
  justify-content: flex-start;
  gap: 44px;
}

.section-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 840;
}

.section-title {
  margin: 0;
  font-size: 34px;
  line-height: 1.18;
  font-weight: 900;
}

.section-desc {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.info-grid {
  display: grid;
  gap: 22px;
}

.field-group {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field-title {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 860;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-btn {
  padding: 10px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.chip-btn.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.info-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.quiz-layout {
  display: block;
  width: min(780px, 100%);
  margin: 0 auto;
}

.quiz-main {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(22, 32, 29, 0.08);
}

.progress-line {
  height: 9px;
  overflow: hidden;
  background: #e9eee7;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--red));
  transition: width 0.24s ease;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

.question-title {
  min-height: 104px;
  margin: 28px 0 20px;
  font-size: 28px;
  line-height: 1.35;
  font-weight: 900;
}

.options {
  display: grid;
  gap: 12px;
}

.option-btn {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
}

.option-btn.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(37, 161, 142, 0.12);
}

.option-key {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 900;
}

.option-copy {
  min-width: 0;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 720;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.auto-hint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.45;
}

.quiz-side {
  display: grid;
  gap: 14px;
}

.side-panel {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.side-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 860;
}

.dim-list {
  display: grid;
  gap: 8px;
}

.dim-chip {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.dim-chip strong {
  color: var(--ink);
}

.loading {
  min-height: calc(100vh - 63px);
  display: grid;
  place-items: center;
  padding: 32px;
}

.loading-box {
  width: min(560px, 100%);
  padding: 28px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.loader {
  display: grid;
  width: 78px;
  height: 78px;
  place-items: center;
  margin: 0 auto 20px;
  color: #fff;
  background: conic-gradient(var(--green), var(--yellow), var(--red), var(--blue), var(--green));
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

.loader::after {
  content: "M";
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: var(--ink);
  border-radius: 50%;
  font-weight: 900;
}

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

.result-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.result-visual,
.result-summary,
.module-panel,
.detail-panel,
.atlas-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-visual {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 20px;
}

.avatar {
  position: relative;
  display: grid;
  box-sizing: border-box;
  min-height: 260px;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, white), #fff 62%),
    linear-gradient(0deg, rgba(22, 32, 29, 0.04), rgba(22, 32, 29, 0.04));
  border: 1px solid rgba(22, 32, 29, 0.08);
  border-radius: var(--radius);
}

.image-avatar {
  min-height: 320px;
  padding: 14px;
  background: #fff;
}

.avatar::before {
  content: "";
  position: absolute;
  inset: 22px;
  z-index: 3;
  border: 2px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--radius);
  pointer-events: none;
}

.image-avatar::before {
  inset: 14px;
}

.avatar-code {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  padding: 7px 9px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.avatar-img {
  position: relative;
  z-index: 2;
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100% - 56px);
  max-height: 290px;
  object-fit: contain;
  border-radius: 8px;
}

.avatar-prop {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(22, 32, 29, 0.12);
  border-radius: var(--radius);
  font-size: 28px;
}

.doctor {
  position: relative;
  z-index: 2;
  width: 142px;
  height: 188px;
}

.doctor-head {
  position: absolute;
  top: 6px;
  left: 40px;
  width: 62px;
  height: 68px;
  background: #f4c9a7;
  border: 3px solid var(--ink);
  border-radius: 40% 40% 46% 46%;
}

.doctor-head::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 8px;
  width: 46px;
  height: 23px;
  background: var(--ink);
  border-radius: 50% 50% 38% 38%;
}

.doctor-head::after {
  content: "";
  position: absolute;
  top: 34px;
  left: 19px;
  width: 22px;
  height: 7px;
  border-bottom: 3px solid #8b4d3d;
  border-radius: 50%;
}

.doctor-eye {
  position: absolute;
  top: 28px;
  width: 7px;
  height: 7px;
  background: var(--ink);
  border-radius: 50%;
}

.doctor-eye.left {
  left: 18px;
}

.doctor-eye.right {
  right: 18px;
}

.doctor-body {
  position: absolute;
  top: 78px;
  left: 20px;
  width: 102px;
  height: 104px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px 18px 10px 10px;
}

.doctor-body::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 46px;
  width: 10px;
  height: 84px;
  background: color-mix(in srgb, var(--accent) 75%, white);
  border-radius: 8px;
}

.steth {
  position: absolute;
  top: 102px;
  left: 50px;
  width: 42px;
  height: 44px;
  border: 3px solid var(--accent);
  border-top: 0;
  border-radius: 0 0 24px 24px;
}

.steth::after {
  content: "";
  position: absolute;
  right: -12px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border: 3px solid var(--ink);
  border-radius: 50%;
}

.result-summary {
  padding: 22px;
}

.result-overview {
  margin-bottom: 24px;
}

.result-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.big-code {
  padding: 8px 10px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 900;
}

.fit-score {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.result-title {
  margin: 18px 0 8px;
  font-size: 38px;
  line-height: 1.12;
  font-weight: 900;
}

.manifesto {
  margin: 0;
  color: #2f3a36;
  font-size: 19px;
  line-height: 1.65;
  font-weight: 720;
}

.result-avatar-slot {
  margin-top: 18px;
}

.result-avatar-slot .image-avatar {
  min-height: 300px;
  padding: 12px;
}

.result-avatar-slot .avatar-img {
  max-width: min(76%, 520px);
  max-height: 240px;
}

.summary-copy {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.result-footer-panel {
  margin-top: 24px;
}

.result-footer-panel .result-actions {
  margin-top: 0;
}

.module-grid {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.module-panel,
.detail-panel {
  padding: 20px;
}

.radar-wrap {
  display: grid;
  place-items: center;
}

#radarCanvas {
  display: block;
  width: min(340px, 100%);
  height: auto;
}

.bar-list {
  display: grid;
  gap: 13px;
}

.score-bar {
  display: grid;
  gap: 7px;
}

.score-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  background: #e9eee7;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.28s ease;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.insight-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  padding: 12px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.55;
}

.dim-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dim-tile {
  padding: 12px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.dim-name {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dim-value {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}

.dim-level {
  color: var(--accent);
  font-size: 13px;
}

.atlas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.atlas-item {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 8px;
  aspect-ratio: 1 / 1;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
  text-align: left;
}

.atlas-mini {
  min-height: 92px;
  display: grid;
  align-content: space-between;
  padding: 10px;
  background: color-mix(in srgb, var(--accent) 10%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, white);
  border-radius: var(--radius);
}

.atlas-image {
  position: relative;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  background: #fff;
}

.atlas-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.atlas-image .atlas-code {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.atlas-code {
  width: fit-content;
  padding: 5px 7px;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.atlas-prop {
  justify-self: end;
  font-size: 26px;
}

.atlas-name {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.atlas-desc {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.atlas-desc + .atlas-desc {
  -webkit-line-clamp: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(22, 32, 29, 0.58);
}

.modal.active {
  display: grid;
}

.poster-panel {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  background: #fff;
  border-radius: var(--radius);
}

.poster-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.poster-head h3 {
  margin: 0;
  font-size: 19px;
}

.poster-preview {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.poster-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  display: none;
  max-width: min(420px, calc(100% - 32px));
  padding: 11px 14px;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius);
  transform: translateX(-50%);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.45;
}

.toast.active {
  display: block;
}

.disclaimer {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 940px) {
  .topbar {
    padding: 12px 16px;
  }

  .brand-sub {
    display: none;
  }

  .hero {
    min-height: auto;
    width: min(720px, calc(100% - 32px));
    padding-top: 28px;
  }

  .hero h1 {
    font-size: 42px;
  }

  .quiz-layout,
  .result-hero,
  .module-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .dim-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .image-avatar {
    min-height: 280px;
  }

  .avatar-img {
    max-height: 250px;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
  }

  .top-actions .ghost-btn {
    display: none;
  }

  .hero h1 {
    font-size: 35px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 27px;
  }

  .question-title {
    min-height: 128px;
    font-size: 22px;
  }

  .quiz-main,
  .result-summary,
  .result-visual,
  .module-panel,
  .detail-panel {
    padding: 16px;
  }

  .result-title {
    font-size: 30px;
  }

  .result-avatar-slot .image-avatar {
    min-height: 250px;
    padding: 10px;
  }

  .result-avatar-slot .avatar-img {
    max-width: min(80%, 390px);
    max-height: 200px;
  }

  .dim-grid {
    grid-template-columns: 1fr;
  }

  .atlas-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .atlas-item {
    padding: 9px;
    gap: 6px;
  }

  .atlas-code {
    padding: 4px 6px;
    font-size: 10px;
  }

  .atlas-image .atlas-code {
    top: 8px;
    left: 8px;
  }

  .atlas-name {
    font-size: 14px;
  }

  .atlas-desc {
    font-size: 11px;
    line-height: 1.25;
    -webkit-line-clamp: 2;
  }

  .atlas-desc + .atlas-desc {
    display: none;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .text-btn {
    width: 100%;
  }

  .info-actions,
  .quiz-actions,
  .result-actions,
  .poster-actions {
    flex-direction: column;
  }
}
