:root {
  color-scheme: dark;
  --bg: #100e0e;
  --surface: #1c1818;
  --ink: #fff6ed;
  --muted: #bfb4b1;
  --rule: #3c3332;
  --red: #ff655f;
  --dark-red: #281310;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
button, a { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid #ff958e; outline-offset: 4px; }
h1:focus { outline: none; }
a { color: inherit; }
.shell { width: min(1200px, calc(100% - 96px)); margin-inline: auto; }
.top { height: 76px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--rule); }
.brand { display: inline-flex; align-items: center; gap: 9px; white-space: nowrap; background: none; border: 0; border-left: 4px solid var(--red); color: var(--ink); padding: 1px 0 1px 12px; font-weight: 850; font-size: 19px; letter-spacing: .08em; }
.brand img { flex: none; object-fit: contain; }
.top-label { color: var(--muted); font-size: 13px; letter-spacing: .07em; }
main { flex: 1; }
.hero { --cover-red: #ff5865; display: grid; grid-template-columns: .83fr 1.17fr; gap: clamp(18px,3vw,42px); align-items: center; min-height: 605px; padding: 36px 0; }
.hero-copy { padding: 12px 0 27px 14px; }
.hero h1 { font-size: clamp(49px, 6.85vw, 97px); line-height: 1.065; letter-spacing: -.073em; font-weight: 950; margin: 0; }
.hero h1 span { color: var(--cover-red); }
.hero p { color: var(--muted); font-size: clamp(15px, 1.55vw, 19px); line-height: 1.7; margin: 23px 0 28px; }
.hero-actions { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hero-actions > span { color: var(--muted); font-size: 13px; letter-spacing: .055em; }
.hero-visual { position: relative; margin: 0; min-width: 0; }
.hero-visual picture {
  display: block;
  overflow: hidden;
  background: #211521;
  aspect-ratio: 1.36;
  clip-path: polygon(4% 0,100% 0,100% 94%,96% 100%,0 100%,0 6%);
}
.hero-visual img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 13px; min-height: 50px; padding: 12px 20px; border: 1px solid transparent; border-radius: 4px; text-decoration: none; font-weight: 750; line-height: 1.25; transition: background .15s, border-color .15s; }
.button span { font-size: 1.22em; line-height: 1; }
.primary { background: var(--red); color: #150908; }
.primary:hover:not(:disabled) { background: #ff817a; }
.primary:disabled { background: #3b3030; color: #b9aaaa; }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.secondary:hover { border-color: var(--muted); }
.quiet { color: var(--muted); background: transparent; padding-inline: 3px; }
.quiet:hover:not(:disabled) { color: var(--ink); }
.quiet:disabled { opacity: .45; }
.hero .button { min-width: 170px; min-height: 54px; background: var(--cover-red); }
.hero .button:hover { background: #ff7881; }
.frame { width: min(720px, 100%); margin: 65px auto 73px; }
.quiz-status { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .035em; }
progress { appearance: none; display: block; width: 100%; height: 5px; margin-top: 13px; background: var(--surface); border: 0; border-radius: 20px; }
progress::-webkit-progress-bar { background: var(--surface); border-radius: 20px; }
progress::-webkit-progress-value { background: var(--red); border-radius: 20px; }
progress::-moz-progress-bar { background: var(--red); border-radius: 20px; }
.quiz h1 { margin: 39px 0 30px; font-size: clamp(28px,4vw,50px); line-height: 1.24; letter-spacing: -.04em; font-weight: 880; text-wrap: balance; }
.question-context {
  width: fit-content;
  max-width: 100%;
  margin: 28px 0 14px;
  padding: 6px 11px;
  border-left: 3px solid var(--red);
  border-radius: 3px;
  background: var(--dark-red);
  color: #ffd3ce;
  font-size: clamp(16px,1.8vw,18px);
  font-weight: 780;
  line-height: 1.4;
}
.question-context:not([hidden]) + h1 { margin-top: 0; }
.options { display: grid; gap: 12px; }
.option { display: flex; align-items: center; text-align: left; gap: 19px; padding: 16px 21px; min-height: 68px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 4px; font-size: 16px; line-height: 1.5; }
.option:hover { border-color: #8e7775; }
.option[aria-pressed=true] { border-color: var(--red); background: var(--dark-red); }
.letter { width: 35px; flex-shrink: 0; padding-right: 12px; color: var(--red); border-right: 1px solid var(--rule); font-weight: 800; }
.quiz-actions { display: flex; gap: 20px; justify-content: space-between; margin-top: 27px; }
.result {
  --agent-ink: var(--bg);
  --agent-accent: var(--red);
  --agent-highlight: var(--ink);
  --agent-line: color-mix(in srgb, var(--agent-accent) 34%, var(--agent-ink));
  --agent-muted: color-mix(in srgb, var(--agent-highlight) 69%, var(--agent-ink));
  margin-top: 46px;
}
.result-hero {
  position: relative;
  aspect-ratio: 1000 / 720;
  overflow: hidden;
  background: var(--agent-ink);
  border: 1px solid var(--agent-line);
  border-radius: 6px;
}
#agent-scene { display: block; width: 100%; height: 100%; }
.result-name {
  position: absolute;
  bottom: 11%;
  left: 6%;
  max-width: 72%;
  color: var(--agent-highlight);
  text-shadow: 0 2px 14px var(--agent-ink);
}
.result-name p { margin: 0 0 10px; color: var(--agent-muted); font-weight: 680; }
.result h1 { margin: 0; font-size: clamp(49px,8vw,87px); font-weight: 950; line-height: 1.02; letter-spacing: -.06em; }
#agent-en { display: inline-block; color: var(--agent-accent); font-weight: 780; letter-spacing: .12em; font-size: 16px; text-transform: uppercase; margin: 13px 10px 0 0; }
.role { border-left: 2px solid var(--agent-line); padding-left: 9px; color: var(--agent-highlight); font-weight: 730; font-size: 14px; }
.result-body h2 { margin: 25px 0 11px; font-size: clamp(23px,3.25vw,34px); line-height: 1.3; }
.result-body p { color: var(--agent-muted); line-height: 1.8; margin: 0 0 12px; }
.result-body h3 { font-size: 15px; margin: 22px 0 12px; }
.traits { display: flex; flex-wrap: wrap; list-style: none; gap: 8px; padding: 0; margin: 0 0 23px; }
.traits li { padding: 6px 11px; border: 1px solid var(--agent-line); color: var(--agent-highlight); font-size: 13px; border-radius: 3px; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result .primary, #save-dialog .primary { background: var(--agent-accent); color: var(--agent-ink); }
.result .primary:hover:not(:disabled), #save-dialog .primary:hover { background: var(--agent-highlight); }
.result .primary:disabled { opacity: .62; }
.source { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); text-underline-offset: 4px; }
.personality { margin-top: 38px; padding-top: 25px; border-top: 1px solid var(--agent-line); }
.personality h2 { margin: 0; font-size: clamp(23px,3.4vw,31px); line-height: 1.25; }
.personality p, .personality dd { color: var(--muted); line-height: 1.7; margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.personality p.personality-intro { margin: 8px 0 17px; font-size: 13px; }
.personality-types { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.personality-type { border: 1px solid var(--agent-line); border-left: 2px solid var(--agent-accent); background: var(--agent-ink); border-radius: 4px; padding: 16px 18px; }
.personality-type h3 { color: var(--muted); font-size: 13px; font-weight: 680; letter-spacing: .025em; margin: 0; }
.personality-value { display: flex; align-items: baseline; gap: 9px; color: var(--agent-highlight); font-weight: 850; font-size: clamp(27px,4vw,36px); line-height: 1.18; margin: 6px 0 9px; }
#zodiac-symbol { color: var(--agent-accent); font-size: .82em; }
.personality p.personality-small { color: var(--agent-highlight); font-size: 12px; margin-top: 6px; }
.personality-details { margin: 17px 0 0; }
.personality-details > div { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 14px; padding-block: 12px; border-bottom: 1px solid var(--agent-line); }
.personality-details dt { align-self: start; color: var(--agent-highlight); font-size: 14px; font-weight: 700; line-height: 1.7; }
@media (max-width: 510px) {
  .personality { margin-top: 30px; }
  .personality-types { grid-template-columns: 1fr; gap: 9px; }
  .personality-details > div { grid-template-columns: 1fr; gap: 4px; }
}
.foot { color: var(--muted); font-size: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule); padding-block: 16px; line-height: 1.6; }
.foot p { margin: 0; }
.foot a { flex: none; text-underline-offset: 3px; }
dialog { --agent-ink: var(--bg); --agent-accent: var(--red); --agent-highlight: var(--ink); max-width: min(440px, calc(100% - 28px)); max-height: calc(100dvh - 30px); background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; padding: 18px; }
dialog::backdrop { background: #000b; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dialog-top h2 { margin: 0; font-size: 21px; }
dialog p { color: var(--muted); font-size: 13px; margin-top: 4px; }
dialog img { display: block; width: 100%; max-height: 59dvh; object-fit: contain; margin: 0 auto 14px; }
dialog .primary { width: 100%; }
@media (max-width: 680px) {
  .shell { width: calc(100% - 40px); }
  .top { height: 63px; }
  .frame { margin: 33px auto 43px; }
  .quiz h1 { margin: 27px 0 23px; }
  .question-context { margin-top: 21px; }
  .option { font-size: 15px; padding-inline: 14px; gap: 13px; min-height: 65px; }
  .result-name p { font-size: 12px; margin-bottom: 6px; }
  .result h1 { font-size: clamp(32px, 10.5vw, 62px); }
  #agent-en { font-size: 12px; margin: 7px 6px 0 0; }
  .role { padding-left: 6px; font-size: 12px; }
  .foot { padding-block: 13px; }
}
@media (max-width: 820px) {
  .hero { display: flex; flex-direction: column; align-items: stretch; gap: 0; min-height: 0; padding: 25px 0 29px; }
  .hero-copy { display: contents; }
  .hero h1 { font-size: clamp(43px,10.8vw,70px); order: 0; }
  .hero p { margin: 11px 0 16px; order: 1; }
  .hero-visual { order: 2; }
  .hero-visual picture { aspect-ratio: 1.45; max-height: 340px; }
  .hero-actions { order: 3; gap: 12px; margin-top: 17px; }
  .hero-actions > span { font-size: 12px; }
  .hero .button { min-width: 143px; min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
