:root {
  color-scheme: light;
  --paper: #faf8f3;
  --ink: #222d32;
  --muted: #516068;
  --mist: #c4dbef;
  --line: #c9d5e0;
  --text-font: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --display-font: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  --wash-a: #d2e4f8;
  --wash-b: #e5dcf4;
  --accent: #365c7a;
  --glass-rim: color-mix(in srgb, var(--accent) 30%, white);
  --glass-film: linear-gradient(150deg, #fffc 0%, #ffffff38 35%, #ffffff18 66%, #ffffff70 100%);
  --glass-bevel: inset 0 1px 1px #fffffff5, inset 1px 0 1px #ffffffbd, inset 0 -2px 2px #ffffffa6;
  --glass-shadow: #30393628;
  --glass-tint: color-mix(in srgb, var(--wash-a) 38%, transparent);
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 63% 54% at 20% 44%, var(--wash-a) 0%, transparent 100%),
    radial-gradient(ellipse 64% 58% at 85% 66%, var(--wash-b) 0%, transparent 100%),
    var(--paper);
  color: var(--ink);
  font: 1rem/1.65 var(--text-font);
}
body[data-palette="home"] { --wash-a: #e5edfa; --wash-b: #cbdff4; --accent: #304e78; }
body[data-palette="sharing"] { --wash-a: #c3eadc; --wash-b: #f8edbf; --accent: #2d6a55; }
body[data-palette="trigger"] { --wash-a: #f7d7c6; --wash-b: #f4dbea; --accent: #864d58; }
body[data-palette="direction"] { --wash-a: #ded1f7; --wash-b: #d3e3fc; --accent: #5b528d; }
body[data-palette="channel"] { --wash-a: #c8eeec; --wash-b: #c7dff8; --accent: #2b6478; }
body[data-palette="cue"] { --wash-a: #f8e7af; --wash-b: #f7d5bb; --accent: #785822; }
body[data-palette="joy"] { --wash-a: #f9d2e4; --wash-b: #e3d7f9; --accent: #854c73; }
body[data-palette="care"] { --wash-a: #e1efc4; --wash-b: #c8eadd; --accent: #4b673c; }
body[data-palette="celebration"] { --wash-a: #f6dfae; --wash-b: #f7d9e3; --accent: #82534d; }
body[data-palette="disclosure"] { --wash-a: #c8d9f4; --wash-b: #ebdbfa; --accent: #4a5c89; }
body[data-palette="repair"] { --wash-a: #f7cfd3; --wash-b: #f9e2c4; --accent: #8a4c55; }
body[data-palette="support"] { --wash-a: #c8e6d8; --wash-b: #d6e8f7; --accent: #2f6660; }
body[data-palette="openness"] { --wash-a: #e5dcf8; --wash-b: #f5dae0; --accent: #735381; }
body[data-palette="remember"] { --wash-a: #e1efc4; --wash-b: #c8eadd; --accent: #4b673c; }
body[data-palette="afterParty"] { --wash-a: #d6d9f6; --wash-b: #f3dcd0; --accent: #4f5687; }
body[data-palette="switchSelf"] { --wash-a: #f4e3c2; --wash-b: #d3e7f2; --accent: #6b5a2e; }
[hidden] { display: none !important; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, summary, .option { -webkit-tap-highlight-color: transparent; }
button:focus-visible, summary:focus-visible, textarea:focus-visible, label:has(:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
h1, h2, h3, p, dl { margin: 0; }

.topbar, footer {
  width: min(calc(100% - 6rem), 76rem);
  margin: 0 auto;
}
.topbar {
  min-height: 5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 670; letter-spacing: .065em; }
.top-label, .kicker { color: var(--muted); font-size: .875rem; }
main { flex: 1; display: grid; align-items: center; width: 100%; }
.view { margin: 0 auto; animation: enter 250ms ease both; }
@keyframes enter { from { transform: translateY(5px); } to { transform: none; } }

.home {
  width: min(calc(100% - 6rem), 69rem);
  padding: clamp(3.25rem, 8vw, 7rem) 0 clamp(4.5rem, 10vw, 8rem);
}
h1 {
  font: 700 clamp(2rem, 6.4vw, 5.1rem)/1.14 var(--display-font);
  letter-spacing: -.058em;
  margin: 0 0 1.25rem;
  width: max-content;
  max-width: 100%;
}
.home-title-line {
  display: block;
  text-align-last: justify;
  text-justify: inter-character;
  white-space: nowrap;
}
.home-title-line + .home-title-line { margin-top: .14em; }
.home-highlight { color: var(--accent); }
.intro-copy { max-width: 22em; color: var(--muted); line-height: 1.85; }
.intro .kicker { margin-top: .82rem; }
.button {
  display: inline-flex;
  min-height: 3.18rem;
  align-items: center;
  justify-content: center;
  padding: .72rem 1.28rem;
  border: 1px solid var(--glass-rim);
  border-radius: .94rem;
  background: var(--glass-film);
  color: var(--ink);
  box-shadow: var(--glass-bevel), 0 4px 8px var(--glass-shadow);
  -webkit-backdrop-filter: blur(12px) saturate(122%);
  backdrop-filter: blur(12px) saturate(122%);
  font-weight: 650;
  transition: box-shadow 180ms ease, transform 180ms ease;
}
.button:hover:not(:disabled) { box-shadow: var(--glass-bevel), 0 6px 12px var(--glass-shadow); }
.button:active:not(:disabled) { transform: scale(.97); }
.primary { background: var(--glass-film), var(--glass-tint); color: var(--accent); }
.button:disabled {
  background: #ffffff2e;
  border-color: #fff9;
  color: #647078;
  box-shadow: inset 0 1px 1px #fffc;
}
.button-quiet { min-height: 2.75rem; padding: .43rem 1rem; font-size: .9rem; }
.start { min-width: 10rem; }
.access { display: grid; gap: .75rem; justify-items: start; max-width: 21rem; margin-top: 1.6rem; }
.access-field { display: grid; gap: .4rem; width: 100%; }
.access-label { font-size: .9rem; font-weight: 600; color: var(--accent); }
.access-input {
  width: 100%;
  min-height: 3.1rem;
  padding: .55rem 1rem;
  border: 1px solid var(--glass-rim);
  border-radius: .9rem;
  background: var(--glass-film), var(--glass-tint);
  box-shadow: var(--glass-bevel);
  color: var(--ink);
  font: 600 1.1rem/1.4 var(--text-font);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.access-input::placeholder { color: var(--muted); font-weight: 400; letter-spacing: normal; text-transform: none; opacity: .75; }
.access-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.access-hint { color: var(--muted); font-size: .85rem; }
.access-status { min-height: 1.4em; color: #9b3d45; font-size: .9rem; }
.access-status:empty { display: none; }

footer {
  color: var(--muted);
  font-size: .875rem;
  border-top: 1px solid var(--line);
  padding: 1rem 0 1.4rem;
}
.result { width: min(calc(100% - 3rem), 38rem); padding: 2.45rem 0 2.9rem; }
.quiz { width: min(calc(100% - 3rem), 35rem); padding: 1.85rem 0 2.3rem; color: var(--accent); }
.quiz .button:not(:disabled) { color: var(--accent); }
.quiz .button:disabled { color: color-mix(in srgb, var(--accent) 60%, #647078); }
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; }
.count { font-variant-numeric: tabular-nums; }
.track { background: color-mix(in srgb, var(--accent) 15%, transparent); border-radius: 99px; overflow: hidden; height: .25rem; }
.track span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 220ms; }
.question-card {
  --fold: 1.75rem;
  --tile-round: 1.25rem;
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: center;
  gap: .46rem;
  min-height: 8.4rem;
  margin-top: 1rem;
  padding: .82rem clamp(1rem, 4vw, 1.5rem) 1.2rem;
  text-align: center;
}
.glass-panel {
  position: absolute;
  pointer-events: none;
  z-index: -1;
  inset: 0;
  filter: drop-shadow(0 6px 6px var(--glass-shadow));
}
.glass-panel::before, .glass-panel::after {
  content: "";
  position: absolute;
}
.glass-panel::before {
  inset: 0;
  clip-path: polygon(0 0, calc(100% - var(--fold)) 0, 100% var(--fold), 100% 100%, 0 100%);
  border: 1px solid var(--glass-rim);
  border-radius: var(--tile-round);
  background: var(--glass-film), radial-gradient(ellipse at 79% 94%, var(--glass-tint), transparent 68%);
  box-shadow: var(--glass-bevel);
}
.glass-panel::after {
  top: 0;
  right: 0;
  width: var(--fold);
  height: var(--fold);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  border-bottom: 1px solid var(--glass-rim);
  border-left: 1px solid var(--glass-rim);
  border-bottom-left-radius: .28rem;
  background: linear-gradient(46deg, #ffffffb8, #ffffff54 46%, var(--glass-rim) 56%, #fff 61%, #ffffff90 66%);
}
.card-letter {
  font: 600 2.35rem/.95 var(--display-font);
  text-shadow: 1px 1px 0 #fffb;
}
.question-letter { justify-self: start; }
.answer-letter { display: block; margin: .48rem .57rem .07rem; text-align: right; font-size: 2.85rem; }
#question-title {
  font: 700 clamp(1.21rem, 2.2vw, 1.67rem)/1.42 var(--display-font);
  text-wrap: balance;
}
.answer-card {
  margin-top: 1rem;
  padding: .26rem .67rem;
  border: 1px solid var(--glass-rim);
  border-radius: 1.25rem;
  background: var(--glass-film);
  box-shadow: var(--glass-bevel), 0 5px 11px var(--glass-shadow);
}
.option {
  position: relative;
  display: grid;
  grid-template-columns: .83rem minmax(0, 1fr) .7rem;
  align-items: center;
  gap: .76rem;
  min-height: 3.16rem;
  padding: .69rem .6rem;
  line-height: 1.47;
  cursor: pointer;
}
.option + .option { border-top: 1px solid color-mix(in srgb, var(--glass-rim) 58%, transparent); }
.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.option:has(:focus-visible) { outline-offset: -2px; }
@media (hover: hover) {
  .option:hover { background: #ffffff4d; }
}
.option:has(:checked) { background: var(--glass-tint); font-weight: 650; }
.option:has(:checked)::after {
  content: "";
  justify-self: center;
  width: .38rem;
  height: .7rem;
  border: solid var(--accent);
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}
.option-icon {
  width: .76rem;
  height: .76rem;
  background: var(--accent);
  opacity: .76;
  clip-path: polygon(50% 0, 65% 35%, 100% 50%, 65% 65%, 50% 100%, 35% 65%, 0 50%, 35% 35%);
}
.option:nth-child(2) .option-icon { clip-path: circle(40%); }
.option:nth-child(3) .option-icon { clip-path: polygon(50% 0, 100% 42%, 50% 100%, 0 42%); }
.option:nth-child(4) .option-icon { border-radius: 68% 12% 65% 65%; clip-path: none; }
.next-row { display: flex; justify-content: flex-end; margin-top: 1rem; }
.next-row .button { min-width: 8rem; }

.result { align-self: start; }
#result-title { font-size: 1rem; font-weight: 600; color: var(--muted); }
.scores { display: flex; justify-content: space-between; gap: 1rem; margin: 1.15rem 0 .88rem; }
.score { display: flex; flex-direction: column-reverse; }
.score dd {
  margin: 0;
  font-size: clamp(2.9rem, 11vw, 5.3rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.065em;
  line-height: 1;
}
.score dt { margin-top: .5rem; font-size: .95rem; }
.score-nong { color: var(--accent); }
.score-dan { color: #45668b; text-align: right; }
.score-bar { background: var(--mist); height: .34rem; border-radius: 99px; overflow: hidden; }
.score-bar span { display: block; height: 100%; background: linear-gradient(90deg, #244d83, #5179ac); }
.result-identity { display: flex; flex-wrap: wrap; gap: .45rem .85rem; align-items: baseline; margin-top: 1.27rem; }
.result-label { color: var(--accent); font: 700 clamp(2rem, 8vw, 3.2rem)/1.16 var(--display-font); }
.result-tone { color: var(--accent); font-size: .875rem; font-weight: 650; }
.result-tagline { margin-top: .3rem; color: var(--accent); font-weight: 650; font-size: 1.1rem; }
.result-body { margin-top: .7rem; line-height: 1.8; text-wrap: pretty; }
.axes { display: grid; gap: .7rem; margin: 1.2rem 0 .4rem; }
.axis { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; }
.axis dt { font-weight: 650; color: var(--accent); }
.axis-label { margin: 0; text-align: right; color: var(--muted); font-size: .9rem; }
.axis-bar { grid-column: 1 / -1; margin: 0; height: .3rem; border-radius: 99px; background: var(--mist); overflow: hidden; }
.axis-bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.comment-title { margin-top: 1.3rem; font-size: .95rem; color: var(--muted); font-weight: 600; }
.result-comment { margin-top: .4rem; font: 700 clamp(1.15rem, 4.3vw, 1.5rem)/1.6 var(--display-font); text-wrap: pretty; }
.score-note { margin-top: .58rem; font-size: .875rem; color: var(--muted); }
.result-details { margin-top: 1.35rem; border-block: 1px solid var(--line); padding: .73rem 0; }
.result-details summary { cursor: pointer; list-style: none; gap: .56rem; }
.result-details summary::-webkit-details-marker { display: none; }
.result-details summary::after { content: "+" / ""; }
.result-details[open] summary::after { content: "−" / ""; }
.dimensions { display: grid; gap: .8rem; margin: .65rem 0 .35rem; }
.dimension { display: grid; grid-template-columns: minmax(6.2rem, .78fr) minmax(0, 1.22fr); gap: .22rem .6rem; }
.dimension dt { color: var(--muted); }
.dimension dd { color: var(--accent); margin: 0; text-align: right; font-weight: 600; }
.dimension .dimension-detail { grid-column: 1 / -1; text-align: left; color: var(--muted); font-size: .875rem; font-weight: 400; }
.research-note { margin-top: .94rem; font-size: .875rem; color: var(--muted); }
.research-note a { color: var(--accent); text-underline-offset: .18em; }
.guide { margin-top: 1.9rem; padding-top: 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
.guide-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; }
.guide-kicker { font-size: .95rem; color: var(--muted); font-weight: 600; }
.guide-body { line-height: 1.85; text-wrap: pretty; }
.guide-body > * + * { margin-top: .8rem; }
.guide-body .guide-title { margin-top: .5rem; color: var(--accent); font: 700 clamp(1.45rem, 5.6vw, 2rem)/1.3 var(--display-font); }
.guide-body .guide-meta { margin-top: .35rem; color: var(--muted); font-size: .9rem; }
.guide-body h3 { margin-top: 1.9rem; color: var(--accent); font-size: 1.08rem; }
.guide-body ul, .guide-body ol { margin-bottom: 0; padding-left: 1.3rem; }
.guide-body li + li { margin-top: .4rem; }
.guide-body strong { color: var(--accent); font-weight: 650; }
.guide-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0 0; }
.guide-table { overflow-x: auto; }
.guide-body table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.6; }
.guide-body th, .guide-body td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.guide-body th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.guide-others { margin-top: 2rem; }
.guide-others-note { margin-top: .3rem; color: var(--muted); font-size: .9rem; }
.guide-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.guide-chip {
  min-height: 2.75rem;
  padding: .4rem 1rem;
  border: 1px solid var(--glass-rim);
  border-radius: 99px;
  background: var(--glass-film), var(--glass-tint);
  color: var(--accent);
  font-weight: 600;
}
.guide-chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.guide-overview { margin-top: 1.4rem; }
.guide-overview .guide-body { margin-top: .6rem; }
.share { padding: 1.4rem 0 0; }
h3 { font-size: 1.13rem; }
.share-message { margin: .53rem 0 .95rem; color: var(--ink); }
.share-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.share-status { color: var(--accent); min-height: 1.52em; margin-top: .45rem; font-size: .875rem; }
#manual-copy { width: 100%; padding: .7rem; background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: .6rem; }
.restart { margin-top: .35rem; min-height: 2.75rem; }

@media (max-width: 700px) {
  body {
    background:
      radial-gradient(ellipse 91% 39% at 8% 35%, var(--wash-a) 0%, transparent 100%),
      radial-gradient(ellipse 87% 42% at 95% 71%, var(--wash-b) 0%, transparent 100%),
      var(--paper);
  }
  .topbar, footer { width: calc(100% - 2.5rem); }
  .topbar { min-height: 4.05rem; }
  main:has(:is(#home, #quiz):not([hidden])) { align-items: start; }
  .quiz { width: min(calc(100% - 2.5rem), 35rem); padding-top: 1.05rem; }
  .home { width: min(calc(100% - 2.5rem), 31rem); padding: clamp(2.15rem, 10svh, 5.7rem) 0 clamp(7rem, 22svh, 13rem); }
  .result { width: min(calc(100% - 2.5rem), 37rem); padding-top: 1.5rem; }
  .intro-copy { max-width: 28em; }
}
@media (max-width: 420px) {
  h1 { font-size: clamp(1.25rem, 8.65vw, 2.05rem); }
}
@media (max-width: 360px) {
  .share-actions { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  .button, .track span { transition: none; }
}
