:root {
  color-scheme: light;
  --paper: #f7f1e6;
  --card: #fcf8f0;
  --ink: #282820;
  --muted: #61574c;
  --red: #9a3729;
  --red-dark: #7e2b20;
  --line: #d9cdbb;
  --serif: "Quiz Serif", "Songti SC", SimSun, serif;
  --sans: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 260px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 87% 18%, #ecd9bf6e, transparent 47rem),
    repeating-linear-gradient(119deg, #79583403 0 1px, transparent 1px 5px),
    var(--paper);
  color: var(--ink);
  font: 1rem/1.7 var(--sans);
}
button { font: inherit; }
button:enabled { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}
h1:focus, [tabindex="-1"]:focus { outline: none; }
p, h1, h2, ul, blockquote { margin: 0; }
ul { padding: 0; list-style: none; }

.site { width: min(100% - 2.5rem, 75rem); margin-inline: auto; }
.masthead, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.25rem;
}
.masthead { min-height: 5rem; border-bottom: 1px solid var(--line); }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font: 700 1.125rem/1.2 var(--serif);
  letter-spacing: .13em;
  white-space: nowrap;
}
.brand-seal {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--red);
  box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 4px #e7ac91;
  color: #fff4e7;
  font-size: .88rem;
  letter-spacing: .06em;
  border-radius: 3px 5px 3px 4px;
}
.masthead-note, .site-footer, .duration, .progress-copy { color: var(--muted); font-size: .875rem; }
.masthead-note { letter-spacing: .1em; }

.hero {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  align-items: center;
  gap: clamp(2.5rem, 6.5vw, 6rem);
  padding: 2.75rem clamp(0rem, 2vw, 1.75rem) 3rem;
}
.hero-copy { padding-block: .75rem; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--red);
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .14em;
}
.eyebrow > span:first-child {
  width: .5rem;
  height: .5rem;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  flex: none;
}
.hero h1 {
  margin: 1.05rem 0 1.35rem;
  font: 800 clamp(2.4rem, 5.15vw, 4.9rem)/1.16 var(--serif);
  letter-spacing: -.055em;
}
.hero h1 > span { display: block; }
.hero-accent { color: var(--red); }
.hero-accent small { font-size: .56em; vertical-align: .18em; letter-spacing: -0.24em; }
.intro { color: #514538; line-height: 1.95; }
.hero-actions { display: flex; align-items: center; gap: 1.15rem; margin-top: 1.8rem; }
.button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  padding: .65rem 1.25rem;
  border: 1px solid transparent;
  border-radius: .2rem;
  font-weight: 650;
  line-height: 1.45;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button-primary { background: var(--red); color: #fff8ed; }
.button-primary:enabled:hover { background: var(--red-dark); }
.button-primary:disabled { background: #e8ded1; color: #695e51; }
.button-outline { border-color: #c0ad97; background: transparent; color: #4d4136; }
.button-outline:hover { background: #eee2d3; border-color: #a98f73; }
.hero-actions .button {
  min-height: 3.4rem;
  min-width: 10.25rem;
  padding-inline: 1.6rem;
  box-shadow: inset 0 0 0 3px var(--red), inset 0 0 0 4px #efbaa979;
  letter-spacing: .13em;
}
.hero-actions .button:hover { box-shadow: inset 0 0 0 3px var(--red-dark), inset 0 0 0 4px #efbaa979; }
.hero-art {
  position: relative;
  justify-self: center;
  width: min(100%, 29rem);
  padding: .62rem;
  border: 1px solid #bda88d;
  background: #eee1cc;
  box-shadow: 0 18px 36px #5c3b2221, inset 0 0 0 3px var(--paper);
}
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.13;
  object-fit: cover;
  object-position: 50% 57%;
}
.archetype-band {
  display: flex;
  gap: .8rem 2.4rem;
  align-items: center;
  padding: 1.15rem 1.6rem;
  border-block: 1px solid var(--line);
  background: #eee1cf61;
}
.band-title { flex: none; color: var(--muted); font-size: .875rem; font-weight: 650; }
.archetypes { display: flex; gap: .35rem clamp(.8rem, 3vw, 2.4rem); flex-wrap: wrap; }
.archetypes li {
  display: flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
  font: 650 1rem/1.75 var(--serif);
}
.archetypes li::before { content: ""; width: .27rem; height: .27rem; background: var(--red); transform: rotate(45deg); }
.site-footer { margin-block: 1.2rem 1.5rem; font-size: .8125rem; }
.site-footer p:last-child { flex: none; }

.quiz { width: min(100%, 46rem); margin: clamp(1.6rem, 4vw, 3.1rem) auto; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.question-number {
  color: var(--red);
  font: 700 1.6rem/1 var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
}
.question-number span + span { margin-left: .35em; color: var(--muted); font-size: .6em; }
.track { height: .36rem; margin-top: .65rem; background: #e6d8c5; border-radius: 2rem; overflow: hidden; }
.track-fill { height: 100%; width: 0; background: var(--red); border-radius: inherit; transition: width .24s ease; }
.progress-copy { margin-top: .45rem; text-align: right; }
.question-card {
  margin-top: .75rem;
  padding: clamp(1rem, 4.5vw, 2.6rem);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  background: var(--card);
  box-shadow: 0 15px 45px #5c3b2211;
}
.question-card h1 { font: 750 clamp(1.45rem, 3.5vw, 2.15rem)/1.45 var(--serif); }
.answer-hint { margin: .38rem 0 1.15rem; color: var(--muted); font-size: .875rem; }
.option-list { display: grid; gap: .58rem; }
.option {
  display: flex;
  position: relative;
  align-items: center;
  gap: .8rem;
  min-height: 3.25rem;
  padding: .62rem .8rem;
  border: 1px solid var(--line);
  border-radius: .2rem;
  background: #fffdf7;
  cursor: pointer;
  line-height: 1.5;
  transition: background-color .16s ease, border-color .16s ease;
}
.option:hover { border-color: #a78b70; }
.option.is-selected { border-color: var(--red); background: #f7e8dc; }
.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.option:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.option-letter {
  display: grid;
  place-items: center;
  flex: 0 0 1.66rem;
  height: 1.66rem;
  border: 1px solid #c3aa91;
  border-radius: .16rem;
  color: #5e4231;
  font: 700 .875rem/1 var(--serif);
}
.is-selected .option-letter { border-color: var(--red); background: var(--red); color: #fff8ed; }
.quiz-actions { display: flex; justify-content: space-between; gap: .65rem; margin-top: 1.2rem; }
.quiz-actions .button { min-width: 6.25rem; }
.enter { animation: enter .28s ease-out both; }
@keyframes enter { from { opacity: .15; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

.result { width: min(100%, 36rem); margin: clamp(1.15rem, 3.5vw, 2.5rem) auto; }
.result-card {
  --result-ink: #536253;
  overflow: hidden;
  border: 1px solid #cdbba2;
  background: var(--card);
  box-shadow: 0 15px 40px #5c3b2221;
}
.result-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 11.25rem;
  padding: 1.55rem clamp(1.15rem, 5vw, 2.35rem);
  border-bottom: 3px double #cdbba2;
  background: linear-gradient(90deg, #f3e7d2 14%, #f3e7d2ea 42%, #f3e7d257 100%), url("assets/mountain.webp") 55% 38% / cover;
}
.result-kicker { color: #544537; font-size: .875rem; font-weight: 650; letter-spacing: .14em; }
.result-heading h1 { margin-block: .12rem .32rem; color: #29271f; font: 800 clamp(2.5rem, 10vw, 4rem)/1.15 var(--serif); }
.result-role { color: var(--result-ink); font-weight: 750; letter-spacing: .12em; }
.result-seal {
  display: grid;
  place-items: center;
  flex: 0 0 clamp(3.1rem, 12vw, 4.2rem);
  aspect-ratio: 1;
  transform: rotate(-7deg);
  background: var(--red);
  box-shadow: inset 0 0 0 4px var(--red), inset 0 0 0 5px #ffdec4c9;
  color: #fff5e7;
  border-radius: 3px 5px 2px 5px;
  font: 750 clamp(1.6rem, 6vw, 2.25rem)/1 var(--serif);
}
.result-body { padding: 1.4rem clamp(1.15rem, 5vw, 2.35rem) 1rem; }
.result-body blockquote {
  padding-left: .85rem;
  border-left: 3px solid var(--red);
  color: var(--red-dark);
  font: 750 clamp(1.13rem, 4.5vw, 1.47rem)/1.6 var(--serif);
}
.result-tags { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin-top: .9rem; }
.result-tags li {
  padding: .12rem .54rem;
  border: 1px solid #d5c4ac;
  border-radius: .2rem;
  color: #514237;
  background: #f4ebdc;
  font-size: .875rem;
}
.result-detail { margin-top: .95rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.result-detail h2 { margin-bottom: .18rem; color: var(--result-ink); font: 800 1rem/1.5 var(--serif); }
.result-detail p { color: #443a31; line-height: 1.65; }
.result-detail .result-traits { margin-top: .28rem; color: var(--muted); font-size: .875rem; }
.bonus { padding: .65rem .8rem; border: 1px solid #e5d6bd; background: #f5ecd9; }
.result-credit {
  margin-top: 1rem;
  color: var(--muted);
  font: 650 .8125rem/1.5 var(--serif);
  letter-spacing: .09em;
  text-align: center;
}
.result-credit span { padding-inline: .22rem; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin-top: 1.15rem; }
#save-status { flex-basis: 100%; color: var(--muted); font-size: .875rem; text-align: center; }
#save-status:empty { display: none; }
#share-preview { width: min(100%, 24rem); align-self: center; }
.noscript { margin-top: 1rem; color: var(--red-dark); }

@media (max-width: 56rem) {
  .hero { gap: clamp(1.5rem, 4.5vw, 2.5rem); }
  .hero h1 { font-size: clamp(2.4rem, 5.85vw, 4rem); }
  .archetype-band { gap: .5rem 1rem; padding-inline: .85rem; }
}
@media (max-width: 42rem) {
  .site { width: calc(100% - 2rem); }
  .masthead { min-height: 4rem; }
  .masthead-note { font-size: .75rem; letter-spacing: 0; text-align: right; }
  .brand { gap: .5rem; font-size: 1rem; }
  .brand-seal { width: 2rem; height: 2rem; font-size: .73rem; }
  .hero { grid-template-columns: 1fr; padding: 1.75rem 0 1.5rem; gap: 1.45rem; }
  .hero-copy { padding: 0; }
  .hero h1 { margin-block: .75rem .9rem; font-size: clamp(2.35rem, 8.9vw, 3.7rem); }
  .hero-actions { margin-top: 1.2rem; }
  .intro { line-height: 1.7; }
  .hero-art { width: 100%; padding: .45rem; }
  .hero-art img { aspect-ratio: 1.13; object-position: 50% 51%; }
  .archetype-band { display: grid; padding-block: .75rem; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: .3rem; margin-top: .85rem; }
  .result-hero { min-height: 8.5rem; }
}
@media (max-width: 29rem) {
  .archetypes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 23rem) {
  .site { width: calc(100% - 1.25rem); }
  .hero h1 { font-size: clamp(2rem, 9.7vw, 2.35rem); }
  .masthead-note { max-width: 8.3rem; }
  .option { padding-inline: .55rem; gap: .55rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
