:root {
  --cream: #f2eee3;
  --paper: #fffcf3;
  --ink: #292822;
  --muted: #6f6a5f;
  --orange: #f6c321;
  --orange-dark: #d79e00;
  --yellow: #f6c321;
  --mint: #f6c321;
  --blue: #f6c321;
  --line: rgba(41, 40, 34, 0.18);
  --shadow: 0 24px 65px rgba(55, 49, 35, 0.13);
  --radius-xl: 36px;
  --radius-lg: 24px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(246, 195, 33, 0.23), transparent 28rem),
    repeating-linear-gradient(92deg, rgba(55, 47, 31, 0.012) 0 1px, transparent 1px 4px),
    var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

button, input { font: inherit; }
button { color: inherit; }

.background-shape {
  position: fixed;
  z-index: -1;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255, 107, 68, 0.14);
  border-radius: 45% 55% 58% 42%;
  pointer-events: none;
}
.background-shape--one { top: -160px; right: -130px; transform: rotate(24deg); }
.background-shape--two { bottom: -230px; left: -170px; transform: rotate(-20deg); }

.site-header, .site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
}

.brand {
  display: inline-flex;
  gap: 14px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand__logo {
  display: block;
  width: 112px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(73, 57, 20, 0.11);
}

.brand__subline {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 172px);
  margin: 0 auto;
}

.screen { display: none; }
.screen--active { display: block; animation: fade-up 0.45s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: clamp(44px, 8vw, 110px);
  align-items: center;
  min-height: 680px;
  padding: 48px 0 78px;
}

.hero.screen--active { display: grid; }
.hero__copy { max-width: 620px; }

.eyebrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 20px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.eyebrow span { font-size: 18px; }

.hero h1, .result__intro h1 {
  margin: 0;
  font-family: "HanziPen SC", "STKaiti", "Kaiti SC", "Songti SC", serif;
  font-weight: 700;
  letter-spacing: -0.055em;
}

.hero h1 { font-size: clamp(46px, 6.2vw, 78px); line-height: 1.08; }
.hero h1 em {
  display: inline;
  padding: 0 0.05em;
  color: var(--ink);
  background: linear-gradient(transparent 68%, rgba(246, 195, 33, 0.9) 0);
  font-style: normal;
}

.hero__intro {
  margin: 26px 0 32px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.pet-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 590px;
  padding: 22px;
  background: rgba(255, 252, 243, 0.82);
  border: 1px solid rgba(41, 40, 34, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 50px rgba(63, 50, 33, 0.08);
  backdrop-filter: blur(12px);
}

.field-label { grid-column: 1 / -1; font-size: 13px; font-weight: 700; }

#pet-name {
  grid-column: 1 / -1;
  width: 100%;
  padding: 15px 17px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#pet-name:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 107, 68, 0.12); }
#pet-name::placeholder { color: #afb3b0; }

.species-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  min-width: 0;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
}

.species-picker legend { margin-bottom: 10px; font-size: 13px; font-weight: 700; }

.species-option { position: relative; display: flex; gap: 10px; align-items: center; padding: 11px 13px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.species-option--selected { background: #fff8da; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(246, 195, 33, 0.32); }
.species-option input { position: absolute; opacity: 0; }
.species-option__face {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  overflow: hidden;
  place-items: center;
  background: #f4ead4;
  border-radius: 50%;
}
.species-option__face img { width: 58px; height: 58px; object-fit: contain; }
.species-option strong, .species-option small { display: block; }
.species-option strong { font-size: 14px; }
.species-option small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.primary-button, .secondary-button {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.primary-button { color: var(--ink); background: var(--yellow); border: 1px solid var(--ink); box-shadow: 4px 5px 0 var(--ink); }
.primary-button:hover { background: #ffd649; box-shadow: 2px 3px 0 var(--ink); transform: translate(2px, 2px); }
.primary-button span { margin-left: 18px; font-size: 20px; }
.pet-form > .primary-button { grid-column: 1 / -1; margin-top: 4px; }
.secondary-button { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.secondary-button:hover { border-color: rgba(37, 48, 43, 0.3); transform: translateY(-2px); }

.test-meta { display: flex; gap: 26px; margin-top: 23px; color: var(--muted); font-size: 12px; }
.test-meta strong { color: var(--ink); font-family: Georgia, serif; font-size: 18px; }

.hero__visual { position: relative; display: grid; min-height: 560px; place-items: center; }
.pet-portrait { position: relative; display: block; width: min(450px, 94%); aspect-ratio: 0.88; overflow: hidden; background: var(--yellow); border: 9px solid var(--paper); border-radius: 44% 44% 18px 18px; box-shadow: var(--shadow); transform: rotate(1deg); }
.pet-portrait::after { position: absolute; right: -20%; bottom: -18%; width: 130%; height: 38%; background: #d9cdb6; border-radius: 50% 50% 0 0; content: ""; transform: rotate(-5deg); }
.pet-portrait__halo { position: absolute; top: 11%; left: 17%; width: 66%; aspect-ratio: 1; background: rgba(255, 252, 243, 0.43); border-radius: 50%; }
.pet-portrait__dog, .pet-portrait__cat { position: absolute; z-index: 1; object-fit: contain; filter: drop-shadow(0 13px 9px rgba(58, 47, 25, 0.12)); }
.pet-portrait__dog { right: -2%; bottom: 6%; width: 66%; transform: rotate(3deg); }
.pet-portrait__cat { bottom: 5%; left: -9%; width: 60%; transform: rotate(-4deg); }
.spark { position: absolute; z-index: 2; color: #fff; }
.spark--one { top: 18%; left: 15%; font-size: 32px; }
.spark--two { top: 12%; right: 17%; font-size: 18px; }
.spark--three { right: 13%; bottom: 32%; color: var(--ink); font-size: 11px; }
.sticker { position: absolute; z-index: 3; padding: 14px 18px; background: #fff; border: 1px solid var(--line); box-shadow: 0 14px 35px rgba(56, 47, 36, 0.12); font-size: 13px; line-height: 1.5; }
.sticker--top { top: 8%; right: -2%; border-radius: 18px 18px 4px 18px; transform: rotate(5deg); }
.sticker--bottom { bottom: 8%; left: -2%; border-radius: 18px 18px 18px 4px; transform: rotate(-6deg); }
.sticker--bottom span { display: inline-block; margin-right: 5px; padding: 2px 5px; color: #fff; background: var(--ink); border-radius: 4px; font-size: 10px; }

.quiz { width: min(720px, 100%); margin: 0 auto; padding: 55px 0 90px; }
.quiz__topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.text-button { padding: 8px 0; color: var(--muted); background: none; border: 0; cursor: pointer; }
.text-button:hover { color: var(--ink); }
.progress-track { height: 6px; overflow: hidden; background: rgba(37, 48, 43, 0.08); border-radius: 999px; }
.progress-bar { width: 8.333%; height: 100%; background: linear-gradient(90deg, var(--orange), #ff9a62); border-radius: inherit; transition: width 0.35s ease; }

.question-card { margin-top: 32px; padding: clamp(28px, 5vw, 48px); background: rgba(255, 255, 255, 0.78); border: 1px solid rgba(255, 255, 255, 0.9); border-radius: var(--radius-xl); box-shadow: var(--shadow); text-align: center; }
.question-card__icon { display: grid; width: 66px; height: 66px; margin: 0 auto 17px; place-items: center; color: var(--ink); background: var(--yellow); border: 2px solid var(--ink); border-radius: 50%; box-shadow: 3px 3px 0 var(--ink); font-family: Georgia, serif; font-size: 22px; font-weight: 800; transform: rotate(-3deg); }
.question-card__context { margin: 0 0 11px; color: var(--orange-dark); font-size: 12px; font-weight: 750; letter-spacing: 0.14em; }
.question-card h2 { max-width: 600px; margin: 0 auto; font-family: "HanziPen SC", "STKaiti", "Kaiti SC", serif; font-size: clamp(27px, 4vw, 38px); font-weight: 600; line-height: 1.4; letter-spacing: -0.03em; }
.answer-list { display: grid; gap: 11px; margin-top: 34px; text-align: left; }
.answer-button { position: relative; width: 100%; min-height: 62px; padding: 14px 52px 14px 18px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; line-height: 1.45; text-align: left; transition: border-color 0.18s, background 0.18s, transform 0.18s; }
.answer-button::after { position: absolute; top: 50%; right: 18px; display: grid; width: 25px; height: 25px; place-items: center; color: #a6aaa7; border: 1px solid var(--line); border-radius: 50%; content: "→"; font-size: 13px; transform: translateY(-50%); }
.answer-button:hover, .answer-button:focus-visible { background: #fff8da; border-color: var(--ink); outline: none; transform: translateX(3px); }
.answer-button:hover::after { color: var(--ink); background: var(--yellow); border-color: var(--ink); }
.quiz__hint { margin: 19px 0 0; color: #919692; font-size: 12px; text-align: center; }
.quiz-navigation { display: flex; justify-content: center; margin-top: 15px; }
.previous-question-button {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  color: var(--ink);
  background: rgba(255, 252, 243, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.previous-question-button:hover,
.previous-question-button:focus-visible {
  background: #fff8da;
  border-color: var(--ink);
  outline: none;
  transform: translateY(-1px);
}
.previous-question-button span[aria-hidden="true"] { font-size: 17px; }

.result { width: min(760px, 100%); margin: 0 auto; padding: 52px 0 90px; }
.result__intro { margin-bottom: 24px; text-align: center; }
.result__intro .eyebrow { justify-content: center; }
.result__intro h1 { font-size: clamp(32px, 5vw, 48px); }
.result__intro h1 span { color: var(--ink); background: linear-gradient(transparent 66%, var(--yellow) 0); }
.result-card { position: relative; overflow: hidden; padding: clamp(28px, 5vw, 48px); color: #fff; background: var(--ink); border-radius: var(--radius-xl); box-shadow: 0 30px 80px rgba(37, 48, 43, 0.25); }
.result-card::before { position: absolute; top: -120px; right: -100px; width: 320px; height: 320px; background: var(--result-color, var(--orange)); border-radius: 50%; content: ""; opacity: 0.9; }
.result-card::after { position: absolute; right: 40px; bottom: 30px; width: 90px; height: 90px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 45% 55%; content: ""; transform: rotate(30deg); }
.result-card__header { position: relative; z-index: 2; display: flex; justify-content: space-between; margin-bottom: 28px; font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.result-card__serial { color: rgba(255, 255, 255, 0.62); }
.result-card__animal { position: absolute; z-index: 1; top: 44px; right: 28px; width: 190px; height: 190px; object-fit: contain; filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.12)); transform: rotate(4deg); }
.result-card__code { position: relative; z-index: 2; margin: 0 0 5px; color: var(--yellow); font-size: 11px; font-weight: 750; letter-spacing: 0.16em; }
.result-card__mbti { position: relative; z-index: 2; display: inline-flex; margin: 5px 0 10px; padding: 7px 12px; color: var(--ink); background: var(--yellow); border-radius: 999px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; }
.result-card h2 { position: relative; z-index: 2; max-width: 70%; margin: 0; font-family: "HanziPen SC", "STKaiti", "Kaiti SC", serif; font-size: clamp(42px, 7vw, 68px); line-height: 1.15; letter-spacing: -0.05em; }
.result-card__tagline { position: relative; z-index: 2; margin: 13px 0 32px; color: rgba(255, 255, 255, 0.74); font-size: 14px; }
.trait-list { position: relative; z-index: 2; display: grid; gap: 15px; padding: 22px; background: rgba(255, 255, 255, 0.075); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; }
.trait-row__labels { display: flex; justify-content: space-between; margin-bottom: 7px; color: rgba(255, 255, 255, 0.64); font-size: 11px; }
.trait-row__labels strong { color: #fff; font-size: 12px; }
.trait-row__track { height: 7px; overflow: hidden; background: rgba(255, 255, 255, 0.12); border-radius: 99px; }
.trait-row__fill { height: 100%; background: var(--result-color, var(--orange)); border-radius: inherit; }
.result-card__description { position: relative; z-index: 2; margin: 26px 0 20px; color: rgba(255, 255, 255, 0.82); font-size: 15px; line-height: 1.8; }
.result-tags { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px; }
.result-tags span { padding: 7px 11px; color: #fff; background: rgba(255, 255, 255, 0.1); border-radius: 999px; font-size: 11px; }
.mate-tip { display: flex; gap: 15px; margin-top: 18px; padding: 20px 22px; background: #fff8da; border: 1px solid var(--line); border-radius: var(--radius-md); }
.mate-tip__icon { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; color: var(--ink); background: var(--yellow); border: 1px solid var(--ink); border-radius: 50%; font: 800 10px Arial; }
.mate-tip strong { font-size: 13px; }
.mate-tip p { margin: 5px 0 0; color: #676353; font-size: 13px; line-height: 1.65; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.result-actions .text-button { grid-column: 1 / -1; justify-self: center; }
.result-disclaimer { margin: 15px 0 0; color: #999d9a; font-size: 10px; line-height: 1.6; text-align: center; }
.confetti { display: flex; justify-content: center; gap: 24px; height: 20px; color: var(--orange); }
.confetti span:nth-child(even) { color: var(--mint); font-size: 9px; }
.confetti span:nth-child(3) { color: var(--yellow); transform: translateY(-8px); }

.site-footer { display: flex; justify-content: space-between; padding: 26px 0 32px; color: #999d9a; border-top: 1px solid var(--line); font-size: 11px; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 24px; padding: 12px 17px; color: #fff; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s; }
.toast--show { opacity: 1; transform: translateY(0); }
.wechat-preview[hidden] { display: none; }
.wechat-preview {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  overflow: auto;
  padding: 64px 18px 30px;
  place-items: start center;
  background: rgba(25, 24, 20, 0.88);
  -webkit-overflow-scrolling: touch;
}
.wechat-preview__panel { width: min(520px, 100%); text-align: center; }
.wechat-preview__panel p { margin: 0 0 14px; color: #fff; font-size: 15px; font-weight: 700; }
.wechat-preview__panel img { display: block; width: 100%; height: auto; background: var(--cream); border-radius: 16px; box-shadow: 0 18px 55px rgba(0, 0, 0, 0.32); -webkit-touch-callout: default; }
.wechat-preview__close { position: fixed; z-index: 2; top: max(16px, env(safe-area-inset-top)); right: 18px; display: grid; width: 38px; height: 38px; place-items: center; color: #fff; background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 50%; cursor: pointer; font-size: 26px; line-height: 1; }

@media (max-width: 860px) {
  .hero.screen--active { display: block; }
  .hero { padding-top: 34px; }
  .hero__copy { margin: 0 auto; }
  .hero__visual { min-height: 470px; margin-top: 54px; }
  .pet-portrait { width: min(370px, 82%); }
  .sticker--top { right: 4%; }
  .sticker--bottom { left: 5%; }
}

@media (max-width: 560px) {
  .site-header, .site-footer, .app-shell { width: min(100% - 28px, 1180px); }
  .site-header { min-height: 72px; }
  .brand__logo { width: 92px; height: 59px; }
  .brand__subline { display: none; }
  .hero { min-height: auto; padding: 40px 0 60px; }
  .hero h1 { font-size: 42px; }
  .hero__intro { font-size: 15px; }
  .pet-form { grid-template-columns: 1fr; padding: 17px; }
  .species-picker { grid-template-columns: 1fr 1fr; }
  .species-option { padding: 9px; }
  .species-option__face { font-size: 24px; }
  .test-meta { justify-content: space-between; gap: 10px; }
  .hero__visual { display: none; }
  .quiz, .result { padding-top: 34px; }
  .question-card { margin-top: 23px; padding: 26px 18px; border-radius: 27px; }
  .question-card h2 { font-size: 25px; }
  .answer-button { min-height: 67px; }
  .previous-question-button { min-height: 48px; padding: 0 20px; }
  .result-card { padding: 28px 22px; border-radius: 28px; }
  .result-card__animal { top: 58px; right: 12px; width: 118px; height: 118px; }
  .result-card h2 { max-width: 76%; font-size: 39px; }
  .result-card__header { gap: 12px; }
  .result-actions { grid-template-columns: 1fr; }
  .result-actions .text-button { grid-column: auto; }
  .site-footer { display: grid; gap: 5px; }
  .toast { right: 14px; bottom: 14px; left: 14px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
