:root {
  color-scheme: light;
  --ink: #2f3933;
  --muted: #6d756f;
  --paper: #f3f4ee;
  --paper-strong: #fbfbf8;
  --line: rgba(47, 57, 51, 0.08);
  --line-strong: rgba(47, 57, 51, 0.14);
  --accent: #56615b;
  --accent-strong: #3d4742;
  --green: #71857a;
  --purple: #807992;
  --yellow: #8a8e66;
  --blue: #6d8895;
  --shadow: 0 18px 48px rgba(47, 57, 51, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f8f8f4 0%, var(--paper) 100%);
}

body.is-share-open {
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1100px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.home-panel {
  display: flex;
  min-height: calc(100svh - 88px);
  align-items: center;
  justify-content: center;
  padding: 44px 0 64px;
}

.intro-copy {
  width: min(860px, 100%);
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  text-align: center;
  animation: riseIn 680ms ease both;
}

.eyebrow,
.section-kicker,
.axis-label {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  max-width: 8.4em;
  font-size: clamp(48px, 7.2vw, 68px);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro-lede {
  max-width: 22em;
  margin: 24px 0 0;
  color: var(--ink);
  font-size: clamp(18px, 2.2vw, 21px);
  line-height: 1.72;
}

.home-summary {
  display: grid;
  gap: 14px;
  margin-top: 30px;
  justify-items: center;
}

.home-summary-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.home-summary-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 640px;
}

.home-summary-list span {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--accent-strong);
  background: rgba(251, 251, 248, 0.76);
  font-size: 14px;
  font-weight: 700;
}

.ghost-action {
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.ghost-action:hover {
  background: rgba(86, 97, 91, 0.12);
}

.ghost-action:focus-visible,
.option-button:focus-visible {
  outline: 3px solid rgba(86, 97, 91, 0.2);
  outline-offset: 2px;
}

.home-actions {
  display: grid;
  width: min(100%, 420px);
  gap: 14px;
  margin-top: 32px;
}

.primary-action {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 20px;
  color: var(--paper-strong);
  background: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 180ms ease,
    opacity 180ms ease;
}

.home-actions .ghost-action,
.home-actions .primary-action {
  width: 100%;
}

.primary-action:hover {
  background: var(--accent);
}

.primary-action:focus-visible {
  outline: 3px solid rgba(86, 97, 91, 0.2);
  outline-offset: 2px;
}

.type-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
  max-width: 520px;
  justify-content: center;
}

.type-rail span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(86, 97, 91, 0.06);
  font-size: 12px;
  font-weight: 700;
}

.test-panel,
.result-panel {
  padding: clamp(28px, 4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.94);
  box-shadow: var(--shadow);
}

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

.quiz-page {
  animation: riseIn 420ms ease both;
}

.progress-row,
.result-topline,
.nav-row,
.share-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.progress-row,
.result-topline,
.nav-row {
  align-items: center;
}

.quiz-topline {
  margin-bottom: 14px;
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
}

.share-panel-head {
  align-items: flex-start;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.progress-row h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
}

.progress-meter {
  width: min(360px, 34vw);
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(86, 97, 91, 0.08);
}

.quiz-page .progress-meter {
  width: 100%;
}

.progress-meter span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 320ms ease;
}

.question-frame {
  min-height: 390px;
  margin-top: 28px;
}

.question-frame.is-changing {
  animation: questionSwap 280ms ease both;
}

.question-frame h3 {
  max-width: 980px;
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  line-height: 1.2;
  letter-spacing: 0;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 26px;
}

.option-grid[data-count="3"] .option-button:last-child {
  grid-column: 1 / -1;
}

.option-button {
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  color: var(--ink);
  background: rgba(86, 97, 91, 0.035);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 190ms ease,
    background 190ms ease,
    color 190ms ease;
}

.option-button strong {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.option-button span {
  display: block;
  font-size: 18px;
  line-height: 1.55;
}

.option-button:hover {
  border-color: rgba(86, 97, 91, 0.18);
  background: rgba(86, 97, 91, 0.07);
}

.option-button.is-selected {
  color: var(--paper-strong);
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.option-button.is-selected strong {
  color: rgba(251, 251, 248, 0.7);
}

.nav-row {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ghost-action {
  border: 1px solid var(--line);
  padding: 0 16px;
  color: var(--accent-strong);
  background: rgba(86, 97, 91, 0.05);
  font-weight: 700;
}

.ghost-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.result-panel {
  animation: riseIn 520ms ease both;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(47, 57, 51, 0.16);
  backdrop-filter: blur(8px);
  animation: riseIn 240ms ease both;
}

.share-dialog {
  width: min(100%, 430px);
  max-height: calc(100svh - 48px);
  overflow: auto;
  padding: clamp(18px, 4vw, 24px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.98);
  box-shadow: 0 22px 72px rgba(47, 57, 51, 0.12);
}

.share-panel-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.share-panel-head h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.share-preview {
  display: grid;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(47, 57, 51, 0.05);
  border-radius: 8px;
  background: rgba(86, 97, 91, 0.03);
}

#shareCanvas {
  display: block;
  width: min(100%, 380px);
  max-width: 100%;
  aspect-ratio: 9 / 16;
  height: auto;
  max-height: min(72svh, 680px);
  border: 1px solid rgba(47, 57, 51, 0.05);
  border-radius: 8px;
  background: var(--paper-strong);
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.share-actions .ghost-action {
  width: 100%;
}

.result-layout {
  display: grid;
  gap: clamp(24px, 3vw, 32px);
  margin-top: 28px;
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(220px, 312px) minmax(0, 1fr);
  gap: clamp(24px, 3.4vw, 42px);
  align-items: start;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(251, 251, 248, 0.98), rgba(248, 248, 243, 0.9));
}

.result-media {
  display: grid;
  align-content: start;
}

.result-figure {
  width: min(100%, 300px);
  justify-self: start;
}

.result-overview {
  display: grid;
  gap: 18px;
  align-content: start;
}

.hero-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 14px;
}

.result-report {
  display: grid;
  gap: 22px;
}

.result-band {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.result-band-lead {
  padding-top: 0;
  border-top: 0;
}

.result-section {
  display: grid;
  gap: 12px;
}

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

.result-section-head .section-kicker {
  margin-bottom: 0;
}

.result-section-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.result-heading {
  display: grid;
  gap: 8px;
}

.group-name {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-heading h2 {
  margin: 0;
  font-size: clamp(42px, 6vw, 56px);
  max-width: 10ch;
  line-height: 1.02;
  letter-spacing: 0;
}

.verdict {
  margin: 0;
  max-width: 40em;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.88;
}

.catchphrase-line {
  display: block;
  color: var(--accent-strong);
  font-size: 24px;
  line-height: 1.55;
  font-weight: 700;
}

.hate-meter {
  margin: 0;
}

.hate-meter-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.hate-meter-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hate-meter-head strong {
  font-size: 30px;
  line-height: 1;
}

.hate-bar {
  height: 8px;
  margin: 14px 0 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(86, 97, 91, 0.08);
}

.hate-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 520ms ease;
}

.hate-meter p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.metric-card {
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(86, 97, 91, 0.03);
}

.summary-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(86, 97, 91, 0.035);
}

.summary-card .section-kicker {
  margin-bottom: 0;
}

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

.stability-card {
  gap: 10px;
}

.stability-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 14px;
}

.stability-head strong {
  font-size: 28px;
  line-height: 1;
}

.stability-head span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.stability-note {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.hero-summary {
  padding: 0 0 2px;
  border: 0;
  background: transparent;
}

.result-quote {
  display: grid;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.78);
}

.quote-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-grid,
.result-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.detail-block {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(86, 97, 91, 0.03);
}

.detail-block .section-kicker {
  margin-bottom: 0;
}

.detail-copy {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.8;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-list span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--accent-strong);
  background: rgba(251, 251, 248, 0.86);
  font-size: 13px;
  font-weight: 700;
}

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

.bullet-list li {
  position: relative;
  padding-left: 16px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
}

.bullet-list li::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.result-section-head.compact {
  align-items: flex-start;
}

.detail-block-wide .detail-copy {
  max-width: 46em;
}

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

.score-item {
  display: grid;
  gap: 10px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.72);
}

.score-item strong {
  display: block;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.score-bar {
  height: 8px;
  margin: 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(86, 97, 91, 0.08);
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.score-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.illustration-frame {
  position: relative;
  display: grid;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.72);
}

#resultIllustration {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  background: rgba(86, 97, 91, 0.03);
}

.type-mark {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border-radius: 999px;
  padding: 0 16px;
  color: var(--paper-strong);
  background: rgba(47, 57, 51, 0.86);
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  backdrop-filter: blur(10px);
}

.result-figure.is-fallback .illustration-frame {
  min-height: 220px;
  padding: 14px;
  place-items: center;
}

.result-figure.is-fallback #resultIllustration {
  display: none;
}

.result-figure.is-fallback .type-mark {
  position: static;
  min-height: 176px;
  width: 100%;
  justify-content: center;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  font-size: 52px;
}

.result-panel[data-group="mist"] .type-mark,
.result-panel[data-group="mist"] .hate-bar span,
.result-panel[data-group="mist"] .score-bar span,
.result-panel[data-group="mist"] .bullet-list li::before {
  background-color: var(--green);
}

.result-panel[data-group="mist"] .group-name,
.result-panel[data-group="mist"] .quote-label,
.result-panel[data-group="mist"] .stability-head span {
  color: var(--green);
}

.result-panel[data-group="prism"] .type-mark,
.result-panel[data-group="prism"] .hate-bar span,
.result-panel[data-group="prism"] .score-bar span,
.result-panel[data-group="prism"] .bullet-list li::before {
  background-color: var(--purple);
}

.result-panel[data-group="prism"] .group-name,
.result-panel[data-group="prism"] .quote-label,
.result-panel[data-group="prism"] .stability-head span {
  color: var(--purple);
}

.result-panel[data-group="pulse"] .type-mark,
.result-panel[data-group="pulse"] .hate-bar span,
.result-panel[data-group="pulse"] .score-bar span,
.result-panel[data-group="pulse"] .bullet-list li::before {
  background-color: var(--yellow);
}

.result-panel[data-group="pulse"] .group-name,
.result-panel[data-group="pulse"] .quote-label,
.result-panel[data-group="pulse"] .stability-head span {
  color: var(--yellow);
}

.result-panel[data-group="rivet"] .type-mark,
.result-panel[data-group="rivet"] .hate-bar span,
.result-panel[data-group="rivet"] .score-bar span,
.result-panel[data-group="rivet"] .bullet-list li::before {
  background-color: var(--blue);
}

.result-panel[data-group="rivet"] .group-name,
.result-panel[data-group="rivet"] .quote-label,
.result-panel[data-group="rivet"] .stability-head span {
  color: var(--blue);
}

[hidden] {
  display: none !important;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes questionSwap {
  from {
    opacity: 0.2;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 880px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding: 18px 0 42px;
  }

  .home-panel {
    min-height: calc(100svh - 32px);
    padding: 24px 0 36px;
  }

  .intro-copy {
    display: flex;
    width: 100%;
    margin: 0 auto;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  h1 {
    max-width: 8em;
    font-size: 44px;
  }

  .intro-lede {
    margin-top: 24px;
    font-size: 18px;
  }

  .home-summary {
    margin-top: 26px;
  }

  .home-summary-list {
    max-width: 100%;
  }

  .test-panel,
  .result-panel {
    padding: 18px;
  }

  .share-modal {
    padding: 14px;
  }

  .share-dialog {
    width: min(100%, 420px);
    max-height: calc(100svh - 28px);
    padding: 16px;
  }

  .progress-row,
  .result-topline,
  .share-panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-topline {
    gap: 14px;
  }

  .progress-meter {
    width: 100%;
  }

  .progress-row h2,
  .question-frame h3 {
    font-size: 28px;
  }

  .question-frame {
    min-height: auto;
    margin-top: 24px;
  }

  .option-grid,
  .result-hero,
  .hero-meta-grid,
  .report-grid,
  .score-grid,
  .result-duo {
    grid-template-columns: 1fr;
  }

  .result-layout,
  .result-report {
    gap: 20px;
  }

  .result-figure {
    justify-self: center;
  }

  .result-hero {
    gap: 20px;
    padding: 18px;
  }

  .illustration-frame {
    padding: 0;
  }

  .option-button {
    min-height: 92px;
    padding: 16px;
  }

  .type-mark {
    left: 10px;
    bottom: 10px;
    min-height: 40px;
    padding: 0 14px;
    font-size: 20px;
  }

  .result-figure.is-fallback .type-mark {
    min-height: 156px;
    font-size: 46px;
  }

  .result-heading h2 {
    font-size: 40px;
  }

  .verdict {
    font-size: 17px;
  }

  .catchphrase-line {
    font-size: 19px;
  }

  .summary-copy,
  .detail-copy {
    font-size: 16px;
  }

  .stability-head strong {
    font-size: 24px;
  }

  .detail-block,
  .summary-card,
  .metric-card,
  .result-quote,
  .score-item {
    padding: 16px;
  }

  .hate-meter-head strong {
    font-size: 28px;
  }

  .share-panel-head h2 {
    font-size: 28px;
  }

  .share-preview {
    padding: 10px;
  }

  #shareCanvas {
    width: min(100%, 332px);
    max-height: min(66svh, 620px);
  }
}

@media (max-width: 480px) {
  .app-shell {
    width: min(100% - 18px, 420px);
  }

  h1 {
    font-size: 36px;
  }

  .intro-lede {
    font-size: 16px;
  }

  .home-summary {
    gap: 12px;
  }

  .home-summary-list {
    gap: 8px;
  }

  .home-summary-list span {
    min-height: 34px;
    padding: 0 13px;
    font-size: 13px;
  }

  .home-actions {
    width: 100%;
    margin-top: 28px;
  }

  .progress-row h2,
  .question-frame h3 {
    font-size: 24px;
  }

  .progress-row,
  .nav-row {
    gap: 12px;
  }

  .nav-row {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .ghost-action {
    width: 100%;
  }

  .primary-action {
    width: 100%;
  }

  .result-actions,
  .share-actions {
    width: 100%;
  }

  .share-modal {
    padding: 10px;
  }

  .share-dialog {
    width: 100%;
    max-height: calc(100svh - 20px);
    padding: 14px;
  }

  .share-actions {
    grid-template-columns: 1fr;
  }

  #shareCanvas {
    width: min(100%, 300px);
    max-height: min(60svh, 560px);
  }

  .option-button span {
    font-size: 16px;
  }

  .tag-list span {
    font-size: 12px;
  }

  .result-heading h2 {
    font-size: 34px;
  }

  .summary-copy {
    font-size: 15px;
  }

  .stability-head strong {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
