:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #171616;
  background: #f0e7df;
  --purple: #683986;
  --ink-purple: #44245f;
  --lavender: #e7d9ec;
  --quiz-paper: #fdf8f5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button { font: inherit; }
p, h1, h2 { margin: 0; }
button:focus-visible { outline: 2px solid var(--purple); outline-offset: 4px; }

.app {
  max-width: 440px;
  margin-inline: auto;
  container-type: inline-size;
  background: var(--quiz-paper);
}

.home {
  min-height: 100dvh;
  padding: max(3.1cqw, env(safe-area-inset-top)) 2.9cqw
    max(8cqw, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 46% 49%, #fffaf2 18%, #faf1e8 100%);
}

.home-title {
  position: relative;
  height: 63cqw;
  margin: 0 2cqw 2.1cqw;
  display: grid;
  align-content: start;
  justify-items: center;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-weight: 900;
  line-height: 1.03;
  text-align: center;
  letter-spacing: -.065em;
  transform: rotate(-7deg);
}

.title-line {
  display: block;
  position: relative;
  isolation: isolate;
  white-space: nowrap;
  font-size: 12.25cqw;
  -webkit-text-stroke: .21cqw currentColor;
}

.title-first {
  z-index: 1;
  margin: 2.7cqw 13cqw 0 0;
  padding: 1.75cqw 5cqw 1.5cqw;
  color: var(--ink-purple);
}

.title-first::before,
.title-first::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(0 38%, 7% 24%, 9% 10%, 25% 9%, 29% 2%, 50% 6%,
    56% 0, 61% 7%, 79% 2%, 84% 7%, 96% 5%, 100% 56%, 96% 92%,
    78% 98%, 59% 91%, 39% 94%, 24% 100%, 8% 92%, 3% 65%);
}

.title-first::before { inset: -1.8cqw -1.3cqw; background: var(--ink-purple); }
.title-first::after { inset: -1.35cqw -.85cqw; background: #fffdf9; }

.title-middle,
.title-last {
  z-index: 2;
  color: #fffdf9;
  background: var(--ink-purple);
  border-radius: 2.5cqw 4cqw 3.3cqw 2.3cqw;
  box-shadow: 0 .8cqw 0 .8cqw #fff9ef, .5cqw 1.5cqw 0 1cqw #efdecc;
}

.title-middle {
  padding: 2.1cqw 4cqw .9cqw;
  margin: -.65cqw 0 0 5.5cqw;
  font-size: 11.7cqw;
}

.title-last {
  padding: 1.2cqw 1.6cqw 2cqw .8cqw;
  margin-top: -.4cqw;
  color: #ffe8aa;
  font-size: 16.65cqw;
  letter-spacing: -.079em;
}

.title-sparks {
  position: absolute;
  z-index: 3;
  inset: 10cqw 4.6cqw auto auto;
  width: 13cqw;
  height: 14cqw;
  pointer-events: none;
}

.title-sparks i {
  position: absolute;
  width: 3.35cqw;
  height: 7.5cqw;
  border: .48cqw solid var(--ink-purple);
  border-radius: .95cqw;
  background: #fec758;
  box-shadow: .4cqw .65cqw 0 #f0deca;
}

.title-sparks i:nth-child(1) { left: 0; top: 0; transform: rotate(24deg); }
.title-sparks i:nth-child(2) { left: 5.6cqw; top: 3.3cqw; transform: rotate(48deg); }
.title-sparks i:nth-child(3) { left: 7.7cqw; top: 9.2cqw; transform: rotate(70deg) scale(.84); }

.home-title::after {
  content: "";
  position: absolute;
  right: 15cqw;
  bottom: 3.4cqw;
  width: 27cqw;
  height: 2.4cqw;
  border-top: .85cqw solid #c95c45;
  border-radius: 50%;
  transform: rotate(-5deg);
}

.home-art { display: block; width: 100%; border-radius: 7cqw; }

.question-count {
  position: relative;
  isolation: isolate;
  width: max-content;
  margin: 4.1cqw auto 0;
  padding: .6cqw 3.2cqw 1.2cqw;
  color: var(--ink-purple);
  font-size: 6cqw;
  font-weight: 900;
  font-style: italic;
  line-height: 1.08;
  transform: rotate(-5deg);
}

.question-count::before {
  content: "";
  position: absolute;
  inset: 7% 0 2%;
  z-index: -1;
  border-radius: 20% 10% 17% 12%;
  background: #e3c9ed;
}

.question-count::after {
  content: "";
  position: absolute;
  inset: 31% -6cqw;
  z-index: -1;
  border-inline: 3.6cqw solid var(--ink-purple);
  mask: linear-gradient(170deg, transparent 31%, #000 32% 43%, transparent 44% 54%,
    #000 55% 66%, transparent 67%);
}

.question-count span { font-size: 10.7cqw; letter-spacing: -.09em; margin-right: .3cqw; }

.primary {
  border: 0;
  color: #fff;
  background: #603680;
  font-weight: 800;
  cursor: pointer;
}

.primary:active:not(:disabled) { background: #4f2a6d; }
.primary:disabled { background: #d6c8df; color: #514459; cursor: default; }

.start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3cqw;
  width: 89%;
  min-height: 17.2cqw;
  margin: 7.2cqw auto 0;
  border-radius: 100vw;
  box-shadow: 0 2.2cqw 0 .8cqw #d5b8e1;
  font-size: 8.8cqw;
  letter-spacing: .035em;
}

.start span[aria-hidden] { font-size: 1.1em; }

.quiz {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: max(6.3cqw, env(safe-area-inset-top)) 3.5cqw
    max(8.8cqw, env(safe-area-inset-bottom));
  background: var(--quiz-paper);
}

.quiz-header { margin-inline: .8cqw; }
.quiz-navigation { display: flex; justify-content: space-between; align-items: center; }

.previous {
  display: inline-flex;
  align-items: center;
  gap: 2.7cqw;
  padding: 0 0 0 1.1cqw;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: clamp(16px, 4.55cqw, 20px);
  font-weight: 750;
  cursor: pointer;
}

.previous:disabled { color: #807686; cursor: default; opacity: .62; }
.chevron {
  width: 2.4cqw;
  height: 2.4cqw;
  border: solid currentColor;
  border-width: 0 0 3px 3px;
  transform: rotate(45deg);
}

.step-label { font-size: clamp(17px, 5cqw, 23px); font-weight: 800; }

progress {
  display: block;
  width: 100%;
  height: 2.2cqw;
  margin-top: 2.4cqw;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  appearance: none;
  background: var(--lavender);
  color: var(--purple);
}

progress::-webkit-progress-bar { background: var(--lavender); }
progress::-webkit-progress-value { background: var(--purple); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--purple); border-radius: 99px; }

.question {
  margin: 5.3cqw 1.6cqw 0;
  color: #151515;
  font-size: clamp(19px, 5.95cqw, 26px);
  font-weight: 800;
  line-height: 1.39;
  line-break: strict;
}

.question:focus { outline: none; }

.quiz-art {
  display: grid;
  align-items: end;
  justify-items: center;
  flex: 1 1 0;
  min-height: 65px;
  margin: 1.7cqw .8cqw 4.2cqw;
}

.quiz-art img {
  display: block;
  width: 100%;
  height: min(31cqw, 17dvh);
  object-fit: contain;
  object-position: bottom center;
  mix-blend-mode: multiply;
  filter: brightness(1.032);
}

.answer-form { display: flex; flex-direction: column; }
.options { display: grid; gap: 2.55cqw; margin: 0; padding: 0; border: 0; min-width: 0; }

.option {
  position: relative;
  display: flex;
  min-height: 14.4cqw;
  align-items: center;
  gap: 3.6cqw;
  padding: 2.4cqw 2.85cqw;
  border: 1.4px solid #ded8d5;
  border-radius: 3cqw;
  cursor: pointer;
}

.option:has(input:checked) { border-color: var(--purple); background: #eee2f1; }
.option:has(input:focus-visible) { outline: 2px solid var(--purple); outline-offset: 3px; }
.option input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.option-letter {
  display: grid;
  place-items: center;
  flex: 0 0 8.35cqw;
  height: 8.35cqw;
  border-radius: 2.15cqw;
  background: #eae5e2;
  font-size: clamp(16px, 5.6cqw, 24px);
  font-weight: 850;
  line-height: 1;
}

.option:has(input:checked) .option-letter { background: var(--purple); color: #fff; }
.option-text { font-size: clamp(13px, 3.75cqw, 16.5px); font-weight: 500; line-height: 1.4; }

.next {
  width: 100%;
  min-height: max(45px, 14.3cqw);
  margin-top: 9.9cqw;
  border-radius: 3.8cqw;
  font-size: clamp(21px, 6.1cqw, 28px);
}

@media (max-height: 710px) {
  .quiz { padding-block: max(4.2cqw, env(safe-area-inset-top))
    max(4.7cqw, env(safe-area-inset-bottom)); }
  .question { margin-top: 3.6cqw; }
  .quiz-art { margin-bottom: 2.8cqw; }
  .quiz-art img { height: min(25.5cqw, 15dvh); }
  .next { margin-top: 5.1cqw; }
}

@media (max-height: 600px) {
  .quiz { padding-block: max(3.4cqw, env(safe-area-inset-top))
    max(3.7cqw, env(safe-area-inset-bottom)); }
  .question { font-size: clamp(17px, 5.2cqw, 21px); }
  .quiz-art { min-height: 44px; margin-bottom: 2.5cqw; }
  .quiz-art img { height: min(20cqw, 12dvh); }
  .options { gap: 1.6cqw; }
  .option { min-height: 12.6cqw; padding-block: 1.55cqw; }
  .next { margin-top: 4.2cqw; }
}

.result {
  --result-border: #79518c;
  min-height: 100dvh;
  padding: max(4cqw, env(safe-area-inset-top)) 4.1cqw
    max(4.2cqw, env(safe-area-inset-bottom));
  background: #fcf8f3;
  color: #211a24;
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .98fr);
  align-items: center;
  gap: 2cqw;
  margin: 1.5cqw 0 5cqw;
}

#result-title { min-width: 0; color: var(--ink-purple); }
#result-title:focus { outline: none; }

.result-prefix {
  display: inline-block;
  padding: .55cqw 2.5cqw 1.1cqw;
  border-radius: 40px;
  color: #211a24;
  background: #ffe7a5;
  font-size: clamp(15px, 5.45cqw, 23px);
  font-weight: 900;
  white-space: nowrap;
  transform: rotate(-4deg);
}

.result-city {
  display: block;
  margin-top: 1.4cqw;
  color: var(--ink-purple);
  font-size: clamp(44px, 13.9cqw, 61px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -.07em;
  -webkit-text-stroke: .155cqw currentColor;
  overflow-wrap: anywhere;
}

.result-city::after {
  content: "";
  display: block;
  width: 73%;
  height: 2.25cqw;
  margin: 2.4cqw 0 0 1.7cqw;
  border-top: .98cqw solid #f2c444;
  border-radius: 50%;
  transform: rotate(-4deg);
}

.result-city[data-length="3"] { font-size: clamp(34px, 10.8cqw, 47px); }
.result-city[data-length="4"] { font-size: clamp(29px, 9.3cqw, 41px); }

.result-art {
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  width: min(100%, 43cqw);
  justify-self: end;
  margin-inline-end: .8cqw;
}

.result-art::before {
  position: absolute;
  z-index: -1;
  inset: auto 7% -1% 7%;
  height: 13%;
  border-radius: 50%;
  background: #e6d5ef;
  content: "";
}

.result-art > svg {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.result-art > svg { overflow: hidden; }

.result-modules { display: grid; gap: 4.1cqw; }
.result-card { border: 1px solid var(--result-border); border-radius: 15px; background: #fffbf6; }

.result-lifestyle,
.result-preferences,
.result-neighborhood {
  min-width: 0;
  padding: 3.55cqw 4.1cqw 4.4cqw;
}

.module-title {
  display: table;
  margin: 0 0 2.7cqw;
  padding: .55cqw 2.1cqw .9cqw;
  border-radius: 24px;
  background: #ebdcef;
  color: var(--ink-purple);
  font-size: clamp(18px, 5.15cqw, 24px);
  line-height: 1.25;
  font-weight: 850;
}

.result p {
  font-size: clamp(14px, 3.95cqw, 17px);
  line-height: 1.65;
  line-break: strict;
  overflow-wrap: anywhere;
  text-indent: 2em;
}

.result p + p { margin-top: .72em; }
.result p strong { color: #48275f; font-weight: 800; }
.result-preferences { background: #f2eaf7; }
.bar-row + .bar-row { margin-top: 2.7cqw; }
.bar-labels {
  margin-bottom: 1.15cqw;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 3cqw;
  font-size: clamp(14px, 3.9cqw, 17px);
  font-weight: 750;
  line-height: 1.3;
}

.bar-labels strong { font-variant-numeric: tabular-nums; }

.preference-bar {
  display: block;
  appearance: none;
  width: 100%;
  height: clamp(8px, 2.45cqw, 12px);
  background: #e0cde9;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
}

.preference-bar::-webkit-meter-bar {
  background: #e0cde9;
  border: 0;
  height: 100%;
}

.preference-bar::-webkit-meter-optimum-value,
.preference-bar::-webkit-meter-suboptimum-value,
.preference-bar::-webkit-meter-even-less-good-value {
  background: #733c8b;
  border-radius: 99px;
}
.preference-bar::-moz-meter-bar { background: #733c8b; border-radius: 99px; }

.result-match .module-title {
  padding-left: .4cqw;
  padding-right: .4cqw;
  margin-left: 1.9cqw;
  border-radius: 0;
  background: linear-gradient(transparent 73%, #ffe6a3 74% 95%, transparent 96%);
  color: #211a24;
}

.match-intro { margin: 0 2cqw 2.7cqw; }
.match-point {
  display: grid;
  grid-template-columns: clamp(31px, 11cqw, 48px) minmax(0, 1fr);
  align-items: start;
  gap: 3.2cqw;
  padding: 2.9cqw 3.4cqw 3.2cqw;
  margin-top: 1.95cqw;
}

.point-visual {
  display: grid;
  place-items: center;
  padding: .65cqw 2cqw .65cqw 0;
  border-right: 1px solid #d0b9dc;
}

.result-icon {
  width: 100%;
  aspect-ratio: 1;
  fill: #efdff3;
  stroke: #663888;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.point-copy h3 {
  margin: 0 0 .75cqw;
  color: var(--ink-purple);
  font-size: clamp(16px, 4.55cqw, 20px);
  line-height: 1.4;
}

.result-neighborhood { background: #f8f8ed; }
.neighborhood-summary { margin: 0 0 2.9cqw; }

.neighborhood-case {
  display: grid;
  grid-template-columns: clamp(26px, 8.2cqw, 36px) minmax(0, 1fr);
  column-gap: 2cqw;
  padding-top: 2.9cqw;
  border-top: 1px solid #d4c3db;
}

.restart {
  display: block;
  width: 100%;
  min-height: 49px;
  margin-top: 3.4cqw;
  border-radius: 99px;
  font-size: clamp(20px, 5.55cqw, 25px);
}

@media (max-width: 360px) {
  .result-hero { margin-top: 3cqw; }
  .result-city { font-size: 11.8cqw; }
  .result-prefix { font-size: 5.1cqw; }
}
