:root {
  color-scheme: light;
  --ink: #181a1b;
  --muted: #666b70;
  --line: #e3e5e7;
  --soft: #f6f7f8;
  --paper: #ffffff;
  --red: #c64036;
  --red-soft: #fbefed;
  --green: #29756c;
  --green-soft: #eaf4f1;
  --amber: #9a681e;
  --amber-soft: #fbf4e8;
  --focus: #1f64b5;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.65;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible + label {
  outline: 3px solid rgba(31, 100, 181, 0.28);
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-size: 15px;
}

.text-button {
  padding: 8px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.text-button:hover {
  color: var(--ink);
}

#app {
  width: min(100%, 820px);
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  padding: 56px 28px 72px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 680px;
  margin: 0;
  font-size: 40px;
  line-height: 1.22;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.35;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: 0;
}

.lead {
  max-width: 660px;
  margin: 20px 0 0;
  color: #44484b;
  font-size: 18px;
}

.start-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 40px 0 34px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact {
  padding: 22px 18px 22px 0;
}

.fact + .fact {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.fact strong,
.fact span {
  display: block;
}

.fact strong {
  margin-bottom: 3px;
  font-size: 20px;
}

.fact span {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.button {
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  cursor: pointer;
}

.button:hover {
  background: var(--soft);
}

.button.primary {
  color: #fff;
  background: var(--ink);
}

.button.primary:hover {
  background: #333638;
}

.button.danger {
  border-color: var(--red);
  color: var(--red);
}

.button:disabled {
  border-color: #cfd2d4;
  color: #9ba0a4;
  background: var(--soft);
  cursor: not-allowed;
}

.progress-wrap {
  margin-bottom: 46px;
}

.progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  background: var(--line);
}

.progress-value {
  height: 100%;
  background: var(--red);
  transition: width 180ms ease;
}

.stage-progress {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.stage-segment {
  height: 3px;
  background: #eceeef;
}

.stage-segment.complete {
  background: #8f969a;
}

.stage-segment.current {
  background: var(--red);
}

.save-state {
  min-height: 20px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.question-number {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.question-prompt {
  margin: 14px 0 0;
  color: #44484b;
}

.choices {
  display: grid;
  gap: 10px;
  margin: 32px 0 0;
}

.choice-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-label {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-height: 58px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.choice-label:hover {
  border-color: #9da2a6;
  background: #fbfbfb;
}

.choice-input:checked + .choice-label {
  border-color: var(--ink);
  background: var(--soft);
}

.choice-key {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #c8cbce;
  border-radius: 50%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.choice-input:checked + .choice-label .choice-key {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.question-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.section-break {
  padding: 20px 0 6px;
}

.section-break p {
  max-width: 620px;
  color: var(--muted);
}

.result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 34px;
  align-items: stretch;
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.result-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.result-name {
  margin-bottom: 14px;
  font-size: 38px;
}

.result-quote {
  margin: 20px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--red);
  color: #424649;
  font-weight: 700;
}

.portrait-slot {
  min-height: 260px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #d5d8da;
  border-radius: 5px;
  background: var(--soft);
  aspect-ratio: 4 / 5;
}

.portrait-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--portrait-position, 50% 50%);
}

.result-section {
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}

.result-section > p {
  margin: 12px 0 0;
  color: #43474a;
}

.result-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 30px;
  margin-top: 24px;
}

.result-point span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
}

.pressure-list {
  display: grid;
  gap: 16px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.pressure-item {
  padding-left: 15px;
  border-left: 3px solid var(--amber);
}

.pressure-kind {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pressure-item p {
  margin: 4px 0 0;
  color: #4a4e51;
}

.tag-list,
.note-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.tag,
.note {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.tag {
  color: #315e58;
  background: var(--green-soft);
}

.note {
  color: #755119;
  background: var(--amber-soft);
}

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

.behavior-score-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 260px);
  gap: 38px;
  align-items: start;
}

.behavior-score-copy {
  min-width: 0;
}

.behavior-score-copy > h2 {
  margin-top: 0;
}

.behavior-score-portrait {
  align-self: stretch;
  margin: 0;
}

.behavior-score-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 390px;
  border-radius: 4px;
  object-fit: cover;
  object-position: 50% 22%;
  box-shadow: 0 8px 24px rgba(24, 26, 27, 0.12);
}

.confucian-title {
  font-size: 28px;
  font-weight: 700;
}

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

.total-score strong {
  margin-right: 3px;
  color: var(--ink);
  font-size: 28px;
}

.score-bars {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

.score-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 38px;
  gap: 12px;
  align-items: center;
}

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

.bar-value {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.axis-bars .bar-value {
  background: #4c565d;
}

.score-number {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

details {
  margin-top: 22px;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

.details-body {
  margin-top: 18px;
}

.disclaimer {
  padding: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.action-status {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--green);
  font-size: 13px;
}

.about-list {
  margin: 28px 0 0;
  padding-left: 20px;
}

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

.error-message {
  margin-top: 14px;
  color: var(--red);
  font-size: 14px;
}

@media (max-width: 640px) {
  .site-header {
    padding: 0 18px;
  }

  .brand span:last-child {
    max-width: 170px;
    line-height: 1.25;
  }

  #app {
    padding: 38px 18px 58px;
  }

  .site-footer {
    flex-direction: column;
    gap: 2px;
    padding: 16px 18px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 24px;
  }

  .lead {
    font-size: 16px;
  }

  .start-facts {
    grid-template-columns: 1fr;
  }

  .fact,
  .fact + .fact {
    padding: 14px 0;
    border-left: 0;
  }

  .fact + .fact {
    border-top: 1px solid var(--line);
  }

  .progress-wrap {
    margin-bottom: 34px;
  }

  .choice-label {
    padding: 14px 12px;
  }

  .result-header {
    grid-template-columns: 1fr;
  }

  .portrait-slot {
    width: 100%;
    max-width: 420px;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .result-name {
    font-size: 31px;
  }

  .result-points {
    grid-template-columns: 1fr;
  }

  .confucian-head {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .behavior-score-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .behavior-score-portrait img {
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: 762 / 618;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
