:root {
  color-scheme: light;
  --background: #f8f2eb;
  --paper: #fffbf7;
  --wine: #641d2e;
  --wine-dark: #4d1523;
  --ink: #31231f;
  --muted: #6e5a53;
  --rule: #ddd0c8;
  --accent: #a05b62;
  --body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --title: "Songti SC", "SimSun", "Noto Serif CJK SC", "STSong", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--background); font: 1rem/1.65 var(--body); }
body:has(dialog[open]) { overflow: hidden; }
img { display: block; max-width: 100%; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
h1:focus, h2:focus { outline: none; }
.frame { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
.narrow { width: min(680px, calc(100% - 48px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--rule); }
.masthead-inner { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { color: var(--wine); font-family: var(--title); font-size: 1.25rem; font-weight: 700; letter-spacing: .09em; }
.eyebrow { color: var(--wine); font-size: .875rem; font-weight: 600; letter-spacing: .14em; }
.button {
  border: 1px solid transparent;
  border-radius: 5px;
  background: none;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: .9375rem;
  line-height: 1.35;
  text-align: center;
}
.primary { color: var(--paper); background: var(--wine); }
.primary:hover { background: var(--wine-dark); }
.outline { color: var(--wine); border-color: var(--accent); }
.outline:hover, .quiet:hover { background: #f0e4dc; }
.quiet { color: var(--wine); min-height: 44px; padding-inline: 12px; }
.button[disabled] { cursor: default; opacity: .45; background: transparent; }

.hero {
  display: grid;
  grid-template: 1fr auto / minmax(0, .88fr) minmax(0, 1.12fr);
  gap: 24px 50px;
  align-items: start;
  padding-block: clamp(42px, 6.1vw, 94px);
}
.hero-copy { align-self: end; }
.hero h1 {
  color: var(--wine);
  font-family: var(--title);
  font-size: clamp(3rem, 5.5vw, 5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.065em;
  padding-block: 17px 22px;
}
.hero-description { max-width: 27ch; font-size: 1.0625rem; color: var(--muted); line-height: 1.85; }
.hero-image { grid-column: 2; grid-row: 1 / 3; background: #a57961; align-self: stretch; border-radius: 7px; overflow: hidden; }
.hero-image img { width: 100%; height: 100%; aspect-ratio: 1.43; object-fit: cover; object-position: 58% center; }
.hero-action { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; }
.hero-action .button { min-height: 52px; min-width: 146px; }
.hero-meta { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: .875rem; }
.hero-meta span { width: 1px; height: 12px; background: var(--accent); }
.display-title { color: var(--wine); font: 700 clamp(1.9rem, 3vw, 2.6rem)/1.18 var(--title); letter-spacing: -.045em; }
.footer { border-top: 1px solid var(--rule); }
.footer-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 22px; padding-block: 12px; font-size: .8125rem; color: var(--muted); }

.quiz-shell { min-height: calc(100svh - 147px); padding-block: clamp(32px, 6vw, 70px) 60px; }
.quiz-header { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-bottom: 23px; }
.quiz-counter { font-size: .875rem; font-variant-numeric: tabular-nums; color: var(--wine); }
.progress-track { grid-column: 1 / -1; height: 4px; border-radius: 8px; background: #e9d9d3; overflow: hidden; }
.progress-track div { height: 100%; background: var(--wine); width: var(--progress, 0%); transition: width .22s ease; }
.question-card { border: 1px solid var(--rule); background: var(--paper); border-radius: 9px; padding: clamp(21px, 5vw, 43px); }
.question-card h1 { color: var(--wine); font: 700 clamp(1.65rem, 3.8vw, 2.4rem)/1.45 var(--title); letter-spacing: -.025em; }
.question-hint { margin-top: 9px; color: var(--muted); font-size: .875rem; }
.question-options { display: grid; gap: 10px; margin-top: 24px; }
.answer {
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-align: left;
  background: #fcf7f1;
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: 12px;
  min-height: 56px;
  align-items: center;
  padding: 12px 14px;
  line-height: 1.5;
  cursor: pointer;
}
.answer-letter { color: var(--wine); font: 700 1.06rem Georgia, serif; }
@media (hover: hover) { .answer:hover { border-color: var(--accent); background: #f5e9e2; } }
.answer[aria-pressed="true"] { background: #f1e1df; border-color: var(--wine); }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 17px; gap: 12px; }

.result-shell { width: min(942px, calc(100% - 72px)); margin-inline: auto; padding-block: 48px 68px; }
.result-cover {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 9px;
  overflow: hidden;
}
.result-copy { padding: 32px clamp(22px, 5vw, 48px); display: flex; flex-direction: column; justify-content: center; }
.result-name { color: var(--wine); font: 700 clamp(3.25rem, 7vw, 5.5rem)/1.06 var(--title); letter-spacing: -.075em; margin-top: 10px; }
.result-slogan { color: var(--wine); font-size: clamp(1rem, 2.5vw, 1.25rem); font-weight: 600; margin-top: 12px; }
.result-score { margin-top: 17px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; }
.result-score strong { color: var(--wine); font: 400 clamp(2.5rem, 6vw, 4rem)/1 Georgia, serif; font-variant-numeric: lining-nums; letter-spacing: -.055em; }
.result-score span { color: var(--muted); font-size: .875rem; }
.result-photo { min-height: 280px; background: var(--type-color, #9f6a76); width: 100%; height: 100%; object-fit: cover; }
.result-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding-block: 15px 26px; }
.result-secondary { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary-type { border: 1px solid var(--rule); border-radius: 4px; background: transparent; cursor: pointer; padding: 6px 10px; min-height: 42px; font-size: .875rem; }
.secondary-type:hover { background: #f1e5dd; }
.secondary-type strong { color: var(--wine); font-weight: 700; }
.result-block { border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding: clamp(19px, 4vw, 34px); }
.result-block + .result-block { margin-top: 18px; }
.result-block h2 { margin-bottom: 10px; }
.result-intro { font-size: 1.0625rem; color: var(--muted); }
.traits-entry { grid-column: 1 / -1; }
.traits-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.reading-entry .trait-item { display: flex; gap: 10px; padding: 13px; border-radius: 5px; background: #f6ede6; color: var(--ink); font-size: .875rem; line-height: 1.65; }
.trait-number { flex: none; color: var(--wine); font: 400 .8rem/1.8 Georgia, serif; }
.dimension-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 22px; }
.dimension-row { min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; padding-block: 14px; border-top: 1px solid var(--rule); }
.dimension-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px; }
.dimension-name { color: var(--ink); font: 700 1.15rem/1.35 var(--title); }
.top-dimension .dimension-name { color: var(--wine); }
.dimension-note { color: var(--muted); font-size: .75rem; }
.dimension-value { color: var(--muted); font: 400 1.3rem/1 Georgia, serif; font-variant-numeric: tabular-nums; }
.top-dimension .dimension-value { color: var(--wine); font-weight: 700; }
.dimension-meter { grid-column: 1 / -1; height: 9px; border-radius: 8px; background: #f0e7dd; overflow: hidden; }
.dimension-fill { display: block; height: 100%; border-radius: 8px; background: var(--dimension-color); opacity: .62; }
.top-dimension .dimension-fill { opacity: 1; }
.dimension-parts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.dimension-chip { color: var(--muted); font-size: .75rem; }
.dimension-chip + .dimension-chip::before { content: "·"; margin-right: 6px; }
.coordinate-block .charts { margin-top: 20px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: center; }
.chart h3 { font-size: .95rem; color: var(--muted); font-weight: 600; }
.chart .radar { width: min(100%, 470px); height: auto; display: block; margin-inline: auto; }
.bars { margin-top: 20px; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.bar { text-align: center; font-size: .6875rem; display: grid; gap: 6px; font-variant-numeric: tabular-nums; grid-template-rows: 15px 114px auto; }
.bar .bar-number { color: var(--muted); }
.bar .bar-name { color: var(--muted); white-space: nowrap; letter-spacing: -.05em; }
.bar.main-bar .bar-name, .bar.main-bar .bar-number { color: var(--wine); font-weight: 700; }
.bar-track { width: 54%; height: 100%; background: #f0e7dd; margin-inline: auto; display: flex; flex-direction: column; justify-content: end; border-radius: 2px; overflow: hidden; }
.bar-fill { height: var(--score); background: var(--color); opacity: .71; }
.main-bar .bar-fill { opacity: 1; }
.chart-note { color: var(--muted); font-size: .8125rem; margin-top: 15px; }
.reading-grid { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.reading-entry { padding: 16px; border-top: 1px solid var(--rule); }
.reading-entry h3 { font-size: 1rem; color: var(--wine); margin-bottom: 6px; }
.reading-entry p, .reading-entry li { color: var(--muted); font-size: .9375rem; }
.reading-entry.emphasis { background: #f3e8e2; border-radius: 5px; border-color: transparent; }
.levels { padding-inline-start: 1.25rem; margin-block: 7px 0; }
.levels .active-level { color: var(--wine); font-weight: 600; }
.result-end { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }

dialog {
  width: min(540px, calc(100% - 30px));
  max-height: min(90vh, 90dvh);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  overflow: auto;
}
dialog::backdrop { background: rgb(44 24 26 / .62); }
.modal-inner { padding: 18px 20px 22px; }
.modal-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.modal-top h2 { color: var(--wine); font: 700 1.7rem/1.25 var(--title); }
.modal-close { min-height: 42px; }
.modal-type-image { width: 100%; aspect-ratio: 2.25; object-fit: cover; border-radius: 6px; background: #eadad0; }
.modal-slogan { margin-block: 12px 5px; font-size: 1.12rem; color: var(--wine); font-weight: 600; }
.modal-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.modal-description { color: var(--muted); }
.share-preview { width: min(100%, 320px); margin-inline: auto; border-radius: 5px; }

@media (max-width: 880px) {
  .hero { gap: 20px 27px; }
  .hero h1 { font-size: clamp(2.8rem, 7.3vw, 4.5rem); }
  .charts { grid-template-columns: 1fr; gap: 20px; }
  .bar { font-size: .75rem; }
  .dimension-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .frame, .result-shell { width: calc(100% - 36px); }
  .narrow { width: calc(100% - 28px); }
  .masthead-inner { min-height: 59px; }
  .brand { font-size: 1.06rem; }
  .hero { grid-template: auto auto auto / 1fr; gap: 17px; padding-block: 31px 33px; }
  .hero h1 { font-size: clamp(2.9rem, 11vw, 4.4rem); padding-block: 10px 12px; }
  .hero-description { font-size: .975rem; line-height: 1.65; max-width: 28ch; }
  .hero-image { grid-column: 1; grid-row: 2; }
  .hero-image img { aspect-ratio: 1.64; }
  .hero-action { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 8px; }
  .hero-action .button { width: 100%; min-height: 46px; }
  .footer-inner { min-height: 58px; }
  .quiz-shell { min-height: calc(100svh - 119px); padding-block: 24px 40px; }
  .quiz-header { margin-bottom: 15px; padding-inline: 4px; }
  .question-card { padding: 18px 15px 10px; }
  .question-options { margin-top: 17px; }
  .answer { padding-inline: 12px; gap: 8px; }
  .result-shell { padding-block: 24px 45px; }
  .result-cover { grid-template-columns: minmax(0, 1fr); }
  .result-photo { grid-row: 1; aspect-ratio: 1.75; min-height: 0; }
  .result-copy { padding: 18px; }
  .result-name { margin-top: 4px; }
  .result-slogan { margin-top: 8px; }
  .result-score { margin-top: 10px; }
  .result-side { gap: 11px; padding-block: 10px 18px; }
  .result-side > .button { width: 100%; }
  .result-block { padding: 16px 12px; }
  .bar { grid-template-rows: 15px 95px auto; font-size: .6875rem; justify-items: center; }
  .bar .bar-name { writing-mode: vertical-rl; letter-spacing: .05em; }
  .reading-grid { grid-template-columns: 1fr; gap: 7px; }
  .reading-entry { padding: 12px 7px; }
  .reading-entry.emphasis { padding-inline: 12px; }
  .traits-list { grid-template-columns: 1fr; gap: 8px; }
  .dimension-list { grid-template-columns: 1fr; gap: 0; margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
