:root {
  color-scheme: light;
  --paper: #f6f2e8;
  --card: #fffcf4;
  --ink: #354338;
  --muted: #59665a;
  --coral: #9d492e;
  --line: #d7d9c5;
  --serif: Baskerville, "Songti SC", STSong, Georgia, serif;
  --sans: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 4px;
}
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 400; }
h1:focus { outline: none; }

.top, main, .footer { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }

.top {
  min-height: 88px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font: italic 700 39px/1 var(--serif);
  letter-spacing: -.045em;
  padding-block: 8px;
}
.brand span { color: var(--coral); }
.header-right { display: flex; align-items: center; gap: 24px; }
.back-link { font-size: .86rem; color: var(--muted); }
.back-link:hover, .footer a:hover { color: var(--coral); text-decoration: underline; text-underline-offset: 4px; }

.language {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 100px;
}

.language button {
  min-width: 44px;
  min-height: 40px;
  background: transparent;
  border: 0;
  border-radius: inherit;
  font-size: .83rem;
  font-weight: 600;
}

.language button[aria-pressed="true"] { background: var(--ink); color: var(--card); }

main { padding-block: clamp(24px, 5vw, 64px) 28px; }

.intro {
  position: relative;
  isolation: isolate;
  min-height: 480px;
  display: grid;
  grid-template-columns: 1.06fr 1fr;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
}

.intro-copy { padding: clamp(32px, 6vw, 86px); padding-right: 18px; z-index: 1; }

.kicker { font-size: .86rem; color: var(--coral); font-weight: 650; letter-spacing: .06em; }

.intro h1 {
  max-width: 9em;
  margin-block: 15px 18px;
  font-size: clamp(3.25rem, 6.15vw, 6rem);
  letter-spacing: -.042em;
  line-height: .99;
  text-wrap: balance;
}
:lang(zh-CN) .intro h1 { line-height: 1.05; }

.intro-description { max-width: 31ch; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.12rem); }

.button, .quiet {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 100px;
  font-weight: 650;
  font-size: .94rem;
}
.button { border: 1px solid transparent; }
.primary { background: var(--ink); color: var(--card); }
.primary:hover { background: #46594a; }
.outline { background: transparent; border-color: var(--line); }
.outline:hover, .quiet:hover:not(:disabled) { background: #eaeade; }
.quiet { background: transparent; border: 0; }
.quiet:disabled { opacity: .4; }
.intro .button { margin-top: 28px; padding-inline: 22px; }
.intro .button span[aria-hidden] { font-size: 1.15rem; font-weight: 400; }
.time { margin-top: 10px; color: var(--muted); font-size: .83rem; }
.version-note { margin-top: 9px; color: var(--coral); font-size: .82rem; }

.paper-art { position: relative; align-self: stretch; min-height: 360px; background: #e6eadc; overflow: hidden; }
.art-grid {
  position: absolute;
  inset: 0;
  opacity: .46;
  background:
    radial-gradient(circle at 1px 1px, #81877555 .7px, transparent .9px) 0 0 / 6px 6px,
    repeating-linear-gradient(0deg, #a7b2a743 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, #a7b2a743 0 1px, transparent 1px 28px);
}
.paper {
  position: absolute;
  display: grid;
  place-items: center;
  width: 33%;
  aspect-ratio: 1;
  border-radius: 4% 8% 5% 4%;
  background-image: radial-gradient(circle at 1px 1px, #36342626 .7px, transparent .9px);
  background-size: 4px 4px;
  box-shadow: 5px 9px 0 #4c573923, 0 16px 27px #35433824;
}
.paper-sage { background-color: #a8bda0; left: 17%; top: 17%; transform: rotate(-13deg); }
.paper-gold { background-color: #edce7d; left: 50%; top: 20%; transform: rotate(13deg); }
.paper-peach { background-color: #e9af97; left: 19%; top: 49%; transform: rotate(8deg); }
.paper-cream { background-color: #f8e9c7; left: 52%; top: 52%; transform: rotate(-8deg); }
.petals {
  width: 59%; aspect-ratio: 1; transform: rotate(12deg);
  background:
    radial-gradient(ellipse at center, #f6ead1 66%, transparent 69%) top left / 50% 50% no-repeat,
    radial-gradient(ellipse at center, #f6ead1 66%, transparent 69%) top right / 50% 50% no-repeat,
    radial-gradient(ellipse at center, #f6ead1 66%, transparent 69%) bottom left / 50% 50% no-repeat,
    radial-gradient(ellipse at center, #f6ead1 66%, transparent 69%) bottom right / 50% 50% no-repeat;
}
.sun {
  width: 58%; aspect-ratio: 1; border-radius: 50%;
  background: repeating-linear-gradient(-33deg, #82492d 0 4%, transparent 4% 9%);
}
.arch { width: 58%; height: 57%; border: 8px double #764534; border-bottom: 0; border-radius: 60% 60% 0 0; }
.ribbons {
  width: 58%; height: 53%; transform: rotate(-14deg);
  background:
    radial-gradient(ellipse at 50% 105%, transparent 51%, #657c61 54% 69%, transparent 72%) 0 0 / 50% 42% repeat-x,
    radial-gradient(ellipse at 50% -7%, transparent 51%, #657c61 54% 69%, transparent 72%) 25% 87% / 50% 42% repeat-x;
}
.thread {
  position: absolute; inset: 7% 6% 8% 5%; border: 1px dashed #52674a87;
  transform: rotate(8deg); border-radius: 49% 41% 45% 55%; pointer-events: none;
}

.quiz { width: min(100%, 840px); margin-inline: auto; }
.progress-head { display: flex; justify-content: space-between; color: var(--muted); font-size: .84rem; }
.progress-head strong { color: var(--ink); font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 7px; margin: 9px 0 15px; display: block; appearance: none; border: 0; background: #e1e4d6; border-radius: 100px; overflow: hidden; }
progress::-webkit-progress-bar { background: #e1e4d6; }
progress::-webkit-progress-value { background: #55765d; border-radius: 100px; }
progress::-moz-progress-bar { background: #55765d; border-radius: 100px; }

.quiz-card {
  min-height: 345px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(24px, 5vw, 52px);
}
.quiz h1 { font-size: clamp(1.65rem, 3.6vw, 3rem); line-height: 1.24; text-wrap: pretty; }
.quiz-card p { margin-top: 10px; font-size: .91rem; color: var(--muted); }

.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 19px; }
.pair-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f1f1e6;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
}
.pair-letter {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  aspect-ratio: 1;
  background: #e1e8d9;
  border: 1px solid #b6c4b0;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 700;
}
.choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; margin-top: 14px; }
.choices button {
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 8px 4px;
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.25;
  background: #f9f7ed;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.choices button[aria-pressed="true"] { background: #dfe9d8; border-color: #55765d; box-shadow: inset 0 0 0 1px #55765d; }

.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; }
.finish-review { display: flex; margin: 0 auto; }
.storage-note { text-align: center; font-size: .81rem; color: var(--muted); margin-top: 8px; }

.results { width: min(100%, 930px); margin-inline: auto; }
.result-card {
  display: grid;
  grid-template-columns: .92fr 1.08fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}
.result-summary { background: #e9eddf; }
.result-summary, .result-details { padding: clamp(24px, 4vw, 50px); }
.result-summary h1 { font-size: clamp(4.5rem, 10vw, 8rem); font-style: italic; letter-spacing: -.08em; line-height: 1.02; margin-block: 8px 10px; }
.result-summary h2, .result-details h2 { font-size: clamp(1.45rem, 2.8vw, 2.15rem); line-height: 1.2; }
.result-summary h2 + p { margin-top: 12px; color: var(--muted); }
.axis { margin-top: 18px; }
.axis-heading, .axis-endpoints { display: flex; justify-content: space-between; gap: 12px; }
.axis-heading h3 { display: flex; align-items: center; gap: 7px; font-size: .91rem; font-weight: 700; }
.axis-heading > span { font-size: .81rem; color: var(--coral); }
.axis-mark {
  display: inline-block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #dce6d5;
  position: relative;
}
.axis-mark::before { content: ""; position: absolute; inset: 5px; }
[data-axis="EI"] .axis-mark::before { background: #537457; border-radius: 50%; }
[data-axis="SN"] .axis-mark { background: #f1e5bb; }
[data-axis="SN"] .axis-mark::before { background: #926927; transform: rotate(45deg) scale(.8); }
[data-axis="TF"] .axis-mark { background: #f3d8cc; }
[data-axis="TF"] .axis-mark::before { border: 2px solid #a45c42; border-radius: 2px; }
[data-axis="JP"] .axis-mark { background: #e5e1ed; }
[data-axis="JP"] .axis-mark::before { border-top: 2px solid #6d627c; border-bottom: 2px solid #6d627c; border-radius: 50%; }
.result-note { margin-top: 15px; color: var(--muted); font-size: .82rem; }
.axis-endpoints { font-size: .77rem; color: var(--muted); }
.axis-endpoints span { max-width: 48%; }
.axis-endpoints span:last-child { text-align: right; }
.axis-track {
  position: relative;
  height: 7px;
  margin-block: 8px 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #a3b79f 0%, #e2e3d3 50%, #ddb29d 100%);
}
.axis-track::before { content: ""; position: absolute; left: 50%; inset-block: 0; width: 1px; background: #777762; }
.axis-track span {
  position: absolute;
  left: var(--marker);
  top: 50%;
  transform: translate(-50%, -50%);
  width: 13px;
  height: 13px;
  background: var(--ink);
  border: 2px solid var(--card);
  border-radius: 50%;
}

.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }
.status { text-align: center; color: var(--muted); font-size: .84rem; }
.status:not(:empty) { margin-top: 9px; }
.share-url {
  display: block;
  width: min(100%, 460px);
  margin: 8px auto 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--card);
  font: inherit;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px 24px;
  border-top: 1px solid var(--line);
  padding-block: 18px 24px;
  color: var(--muted);
  font-size: .82rem;
}
.footer a { white-space: nowrap; }

@media (max-width: 740px) {
  .top, main, .footer { width: calc(100% - 36px); }
  .top { min-height: 70px; }
  .brand { font-size: 33px; }
  .header-right { gap: 10px; }
  .intro { min-height: 0; grid-template-columns: 1fr; border-radius: 22px; }
  .intro-copy { padding: 29px 24px 27px; }
  .intro h1 { font-size: clamp(2.65rem, 10vw, 4rem); margin-block: 10px 12px; }
  .intro .button { margin-top: 20px; }
  .paper-art { min-height: 0; height: clamp(160px, 32vw, 214px); }
  .paper { width: clamp(61px, 16vw, 98px); }
  .paper-sage { left: 14%; top: 19%; }
  .paper-gold { left: 34%; top: 39%; }
  .paper-peach { left: 52%; top: 18%; }
  .paper-cream { left: 69%; top: 41%; }
  .thread { inset: 13% 6%; transform: rotate(-6deg); }
  .choices { margin-top: 12px; }
  .result-card { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  main { padding-block: 18px 22px; }
  .quiz-card { min-height: 0; padding: 19px; border-radius: 16px; }
  .quiz-card p { margin-top: 7px; font-size: .83rem; }
  .pair { gap: 8px; margin-top: 13px; }
  .pair-option { flex-direction: column; gap: 5px; padding: 9px; font-size: .88rem; }
  .pair-letter { flex: none; width: 23px; }
  .choices { gap: 4px; }
  .choices button { min-height: 51px; padding-inline: 1px; font-size: .75rem; }
  .footer { padding-block: 12px 18px; }
}

@media (max-width: 358px) {
  .top, main, .footer { width: calc(100% - 26px); }
  .header-right { gap: 8px; }
  .back-link { font-size: .74rem; }
  .intro-copy { padding-inline: 21px; }
  .result-actions .button, .result-actions .quiet { padding-inline: 12px; }
}
