:root {
  color-scheme: dark;
  --ink: #111421;
  --outside: #0a0d16;
  --surface: #181d2e;
  --surface-hover: #222b41;
  --text: #eef0fc;
  --muted: #b4bed6;
  --line: #39425a;
  --purple: #c4b8f7;
  --purple-dark: #231b3c;
  --cyan: #acdce8;
  --body: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
  --display: 'Songti SC', 'Noto Serif CJK SC', 'SimSun', serif;
  background: var(--outside);
  color: var(--text);
  font: 400 16px/1.6 var(--body);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { width: min(100%, 520px); margin: 0 auto; min-height: 100svh; background: var(--ink); }
::selection { background: var(--purple); color: var(--purple-dark); }
h1, h2, h3, p, dl, dd, ul { margin: 0; }
h1 { line-height: 1.28; text-wrap: balance; }
a { color: var(--purple); text-underline-offset: 3px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
h1:focus { outline: none; }

.shell { width: calc(100% - 34px); margin-inline: auto; }
.site-header { border-bottom: 0.5px solid var(--line); }
.header-inner { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header-title { color: var(--muted); font-size: .875rem; }
.wordmark, .text-button { border: 0; background: transparent; color: var(--text); min-height: 42px; }
.wordmark { display: flex; align-items: center; gap: 8px; padding: 0; font-weight: 750; letter-spacing: .07em; }
.text-button { color: var(--muted); padding: 0 8px; }
.text-button:hover, .text-button:focus-visible { color: var(--text); }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { position: fixed; z-index: 1; left: 12px; top: 12px; padding: 10px 16px; background: var(--purple); color: var(--purple-dark); }

.hero, .result { padding: 22px 0 max(20px, env(safe-area-inset-bottom)); }
.home-title { text-align: center; }
.home-title h1, .report-head h1 { font: 700 clamp(34px, 9.3vw, 52px)/1.2 var(--display); letter-spacing: -.035em; }
.lede { color: var(--muted); margin: 7px auto 0; max-width: 28em; font-size: .9375rem; line-height: 1.65; }
.hero-art { width: min(100%, 316px); aspect-ratio: 1; position: relative; margin: 1px auto 5px; isolation: isolate; }
.hero-art img { position: absolute; display: block; height: auto; width: 51%; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.wheel-disc { position: absolute; inset: 13%; border: 0.5px solid var(--line); border-radius: 50%; }
.wheel-disc::before, .wheel-disc::after { content: ''; position: absolute; border: 0.5px solid var(--line); border-radius: 50%; inset: 12%; }
.wheel-disc::after { inset: 24%; border-style: dashed; }
.wheel-labels { position: absolute; inset: 0; list-style: none; padding: 0; }
.wheel-labels li { position: absolute; transform: translate(-50%, -50%); min-width: 55px; text-align: center; background: var(--ink); padding: 1px 4px; line-height: 1.25; }
.wheel-labels strong { font-size: .9375rem; color: var(--text); }
.wheel-labels small { display: block; color: var(--purple); font-size: .75rem; letter-spacing: .035em; }
.test-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 9px 0; border-block: 0.5px solid var(--line); text-align: center; }
.test-facts div { display: flex; flex-direction: column-reverse; gap: 1px; padding-inline: 8px; }
.test-facts div + div { border-left: 0.5px solid var(--line); }
.test-facts dt { color: var(--muted); font-size: .8rem; }
.test-facts dd { color: var(--purple); font-weight: 700; }
.mode-picker, .answer-list { border: 0; padding: 0; margin: 0; min-width: 0; }
.mode-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.mode-option, .answer-option { display: flex; align-items: center; gap: 9px; border: 0.5px solid var(--line); background: var(--surface); cursor: pointer; border-radius: 5px; }
.mode-option { padding: 8px 9px; min-height: 59px; }
.mode-option strong { display: block; font-size: .9375rem; }
.mode-option small { display: block; color: var(--muted); font-size: .75rem; }
.mode-option input { appearance: none; margin: 0; flex: 0 0 14px; width: 14px; height: 14px; border: 1px solid var(--muted); border-radius: 50%; display: grid; place-items: center; }
.mode-option input:checked { border-color: var(--purple); }
.mode-option input:checked::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--purple); }
.mode-option:hover, .answer-option:hover { background: var(--surface-hover); }
.mode-option:has(:checked), .answer-option:has(:checked) { border-color: var(--purple); background: var(--surface-hover); }
.mode-option input:focus-visible { outline: none; }
.mode-option:has(:focus-visible) strong, .answer-option:has(:focus-visible) .answer-text { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.primary, .secondary { min-height: 44px; padding: 8px 14px; border: 0.5px solid transparent; border-radius: 5px; font-weight: 700; }
.primary { background: var(--purple); color: var(--purple-dark); }
.primary:hover:enabled { background: #dcd1ff; }
.primary:disabled { background: #272b41; color: var(--muted); }
.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.secondary:hover:enabled, .download:hover { border-color: var(--purple); }
.secondary:disabled { color: var(--muted); opacity: .65; }
.home-actions, .result-actions { display: grid; gap: 7px; margin-top: 10px; }
.footnote { color: var(--muted); font-size: .8rem; line-height: 1.55; margin-top: 10px; }
.hero > .footnote, .result > .footnote { text-align: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.quiz { padding-block: 16px max(20px, env(safe-area-inset-bottom)); }
.quiz-status { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .9rem; }
#question-count { font-variant-numeric: tabular-nums; color: var(--purple); }
progress { display: block; appearance: none; width: 100%; height: 4px; margin: 7px 0 14px; border: 0; background: var(--line); accent-color: var(--purple); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--purple); }
progress::-moz-progress-bar { background: var(--purple); }
.question-panel { border: 0.5px solid var(--line); background: var(--surface); border-radius: 8px; padding: 13px; }
.question-number { width: max-content; min-width: 2.4em; color: var(--purple); font-weight: 700; font-variant-numeric: tabular-nums; border-bottom: 0.5px solid var(--line); margin-bottom: 6px; }
.quiz h1 { font-size: clamp(21px, 5.4vw, 28px); line-height: 1.42; }
.question-help { color: var(--muted); font-size: .8125rem; margin: 6px 0 12px; }
.answer-list { display: grid; gap: 6px; }
.answer-option { min-height: 47px; padding: 6px 9px; background: var(--ink); }
.answer-key { width: 1.9em; flex: 0 0 1.9em; font-size: .875rem; text-align: center; font-weight: 700; color: var(--purple); border: .5px solid var(--line); border-radius: 3px; }
.answer-option:has(:checked) .answer-key { background: var(--purple); color: var(--purple-dark); border-color: var(--purple); }
.quiz-actions { display: grid; grid-template-columns: 1fr 1.55fr; margin-top: 10px; }

.report-head { text-align: center; padding: 1px 0 14px; }
.report-head h1 { font-size: clamp(31px, 7.6vw, 42px); }
.report-overview { display: grid; grid-template-columns: .8fr 1.2fr; gap: 8px; margin-bottom: 10px; }
.report-overview:has(#overall[hidden]) { grid-template-columns: 1fr; }
.report-block { background: var(--surface); border: .5px solid var(--line); border-radius: 8px; padding: 11px 13px; min-width: 0; }
.result > .report-block { margin-bottom: 9px; }
.report-block h2 { font-size: 1rem; margin-bottom: 6px; }
.report-block p, .balance { color: var(--muted); font-size: .875rem; }
.overall { align-content: center; }
.overall strong { font-size: clamp(27px, 7vw, 38px); color: var(--purple); line-height: 1; font-variant-numeric: tabular-nums; }
.score-scale { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.brief, .balance { grid-column: 1 / -1; }
.balance { padding-inline: 2px; text-align: center; }
.chiefs { display: grid; min-width: 0; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.chief { display: grid; align-content: center; gap: 2px; }
.chief h2 { color: var(--muted); font-size: .8125rem; margin: 0; }
.chief .chief-value { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 5px; color: var(--purple); }
.chief.virtue .chief-value { color: var(--cyan); }
.chief-value strong { font-size: 1.25rem; }
.chief-value span { font-variant-numeric: tabular-nums; }
.chart-caption { margin-top: -3px; }
#radar { display: block; width: min(100%, 384px); height: auto; margin-inline: auto; }
.chart-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .8rem; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-item::before { content: ''; width: 10px; height: 2px; background: var(--purple); }
.legend-item.virtue::before { background: var(--cyan); }
.rankings { display: grid; gap: 8px; margin-bottom: 9px; }
.rankings:has(.virtue) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ranks { list-style: none; padding: 0; display: grid; gap: 3px; }
.rank-row { display: grid; grid-template-columns: max-content 1fr 3ch; align-items: center; gap: 5px; font-size: .8125rem; }
.rank-value { text-align: right; font-variant-numeric: tabular-nums; }
.rank-bar { background: var(--line); display: block; height: 3px; }
.rank-fill { background: var(--purple); height: 100%; display: block; }
.virtue .rank-fill { background: var(--cyan); }
.insight-block { display: grid; grid-template-columns: 1fr minmax(48px, 20%); align-items: center; gap: 8px; }
.insight-block img { display: block; width: 100%; height: auto; border-radius: 50%; }
.keywords, .matrix-legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 6px; }
.keywords li { color: var(--purple); font-size: .8125rem; padding-inline: 5px; border: .5px solid var(--line); border-radius: 3px; }
.matrix, .advice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
.matrix-cell, .advice-item { border-top: .5px solid var(--line); padding: 5px 0 3px; }
.matrix-cell h3, .advice-item h3 { font-size: .875rem; }
.matrix-cell header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 6px; }
.matrix-value { color: var(--purple); font-variant-numeric: tabular-nums; font-size: .875rem; }
.matrix-legend li { color: var(--muted); font-size: .75rem; padding-bottom: 1px; border-bottom: 1px solid var(--level); }
.matrix-cell { border-top-color: var(--level); }
[data-level='0'] { --level: #5a6888; }
[data-level='1'] { --level: #8b86b5; }
[data-level='2'] { --level: #b5a3e1; }
[data-level='3'] { --level: #a5deec; }
.result-actions { margin-top: 12px; }

body:has(dialog[open]) { overflow: hidden; }
dialog { width: min(calc(100% - 28px), 416px); max-height: calc(100svh - 28px); border: .5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); padding: 13px; }
dialog::backdrop { background: #060810ca; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog-header h2 { font-size: 1rem; }
dialog form { margin-top: 10px; }
dialog form button { width: 100%; }
.history-list { padding: 0; list-style: none; }
.history-list li { border-bottom: .5px solid var(--line); }
.history-entry { text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; align-items: center; color: var(--text); background: transparent; border: 0; padding: 7px 0; width: 100%; }
.history-entry:hover { color: var(--purple); }
.history-entry time { color: var(--muted); font-size: .8125rem; }
.history-score { color: var(--purple); font-variant-numeric: tabular-nums; grid-column: 2; grid-row: 1 / 3; }
.share-code { display: block; width: min(190px, 100%); height: auto; border-radius: 4px; margin: 10px auto 4px; }
.share-url, .share-feedback { text-align: center; overflow-wrap: anywhere; }
.share-actions { justify-content: center; margin-top: 9px; }
.share-feedback { color: var(--muted); font-size: .8125rem; }
.share-feedback:not(:empty) { margin-top: 5px; }
.download { text-decoration: none; }

@media (max-width: 360px) {
  .shell { width: calc(100% - 24px); }
  .mode-option { gap: 5px; padding-inline: 6px; }
  .report-block { padding-inline: 9px; }
}

@media (max-height: 760px) {
  .hero { padding-top: 16px; }
  .hero-art { width: min(100%, 268px); }
}

@media (forced-colors: active) {
  .mode-option input { appearance: auto; }
  .primary { border-color: ButtonText; }
}

@media print {
  :root {
    color-scheme: light;
    --ink: #fff;
    --outside: #fff;
    --surface: #fff;
    --surface-hover: #fff;
    --text: #151927;
    --muted: #30374b;
    --line: #b7bdd0;
    --purple: #4a3679;
    --purple-dark: #fff;
    --cyan: #245b71;
  }
  body, .shell { width: 100%; }
  .site-header, .result-actions, .skip-link, dialog, .insight-block img, .chart-legend { display: none !important; }
  .result { padding: 0; }
  .report-block { break-inside: avoid; }
  .insight-block { display: block; }
  #radar { max-width: 310px; }
}