:root {
  --paper: #fff8f0;
  --paper-2: #fffdf7;
  --line: #f0dcc8;
  --text: #3d3428;
  --muted: #8a7d6f;
  --accent: #ff5c4a;
  --accent-soft: #ffb5a8;
  --juice: #ff7a45;
  --juice-soft: #ffd4b8;
  --lemon: #ffe566;
  --pink-pop: #ff6b9d;
  --mint: #3ecf8e;
  --radius: 18px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "ZCOOL KuaiLe", "Noto Sans SC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 120% 80% at 8% 0%, rgba(255, 230, 170, 0.55), transparent 52%),
    radial-gradient(ellipse 90% 55% at 92% 12%, rgba(255, 180, 200, 0.35), transparent 48%),
    linear-gradient(180deg, #fff2e0 0%, var(--paper) 38%, #ffefe8 100%);
  overflow-x: hidden;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Ccircle cx='4' cy='4' r='1.2' fill='%23e85d4c' opacity='.12'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.shell:has(#screen-result.screen--active) {
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding-top: max(0.5rem, env(safe-area-inset-top));
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.screen {
  display: none;
  width: 100%;
  animation: fadeIn 0.45s ease;
}

.screen--active {
  display: block;
}

/* 欢迎 / 测验：全视口下内容块水平居中（不仅限于窄屏） */
#screen-welcome.screen--active,
#screen-quiz.screen--active {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 2px dashed rgba(61, 52, 40, 0.18);
  background: var(--paper-2);
}

.chip--warn {
  color: #c45c3a;
}

.chip--hot {
  color: var(--mint);
}

/* 入口：什么?! NBTI又来了 */
.hero-stage {
  position: relative;
  height: 2.5rem;
  margin: 0 auto 0.25rem;
  width: 100%;
  max-width: min(320px, 100%);
}

.hero-deco {
  position: absolute;
  font-weight: 800;
  color: var(--accent);
  opacity: 0.35;
  animation: hero-deco-drift 4s ease-in-out infinite;
}

.hero-deco--a {
  left: 8%;
  top: 0;
  font-size: 1.25rem;
  animation-delay: 0s;
}

.hero-deco--b {
  right: 12%;
  top: 0.35rem;
  font-size: 1.5rem;
  color: var(--mint);
  animation-delay: 0.6s;
}

.hero-deco--c {
  left: 50%;
  top: -0.2rem;
  font-size: 2rem;
  opacity: 0.55;
  animation: hero-bang 0.9s ease-in-out infinite;
}

@keyframes hero-deco-drift {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(4px, -6px) rotate(8deg);
  }
}

@keyframes hero-bang {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.55;
  }
  50% {
    transform: translateX(-50%) scale(1.15);
    opacity: 0.85;
  }
}

.hero-shout--1 {
  margin: 0 0 0.15rem;
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 8vw, 2.35rem);
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.04em;
  animation: hero-shout-in 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes hero-shout-in {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-6deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.title {
  font-family: var(--font-display);
  font-size: clamp(2.85rem, 12vw, 3.85rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0 0 1.35rem;
  line-height: 1.08;
  color: var(--text);
  width: 100%;
  text-align: center;
}

.title__n {
  color: var(--accent);
}

.title--entrance {
  animation: title-pop 0.75s cubic-bezier(0.34, 1.56, 0.64, 1) 0.12s both;
}

.title-again {
  display: inline-block;
  margin-left: 0.08em;
  color: var(--accent);
  animation: title-again-wobble 2.2s ease-in-out 0.8s infinite;
}

@keyframes title-pop {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes title-again-wobble {
  0%,
  100% {
    transform: rotate(0deg) translateY(0);
  }
  20% {
    transform: rotate(-3deg) translateY(-2px);
  }
  40% {
    transform: rotate(3deg) translateY(0);
  }
  60% {
    transform: rotate(-2deg) translateY(-1px);
  }
}

.btn--pop {
  animation: btn-pop-in 0.55s ease-out 0.45s both, btn-breathe 2.8s ease-in-out 1.2s infinite;
}

@keyframes btn-pop-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes btn-breathe {
  0%,
  100% {
    box-shadow: 0 8px 0 #c94a3d, 0 14px 28px rgba(232, 93, 76, 0.28);
  }
  50% {
    box-shadow: 0 10px 0 #c94a3d, 0 18px 32px rgba(232, 93, 76, 0.34);
  }
}

.subtitle {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.lead {
  margin: 0 0 1.5rem;
  line-height: 1.75;
  font-size: 1.02rem;
  color: var(--text);
  opacity: 0.92;
}

.spark {
  color: var(--accent);
  font-weight: 700;
}

.fineprint {
  margin: 1.1rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}

.btn {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  width: 100%;
  max-width: min(320px, 100%);
  margin-left: auto;
  margin-right: auto;
  display: block;
  background: linear-gradient(180deg, #ff8a76 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 8px 0 #c94a3d, 0 14px 28px rgba(232, 93, 76, 0.28);
  border: 2px solid #c94a3d;
}

.btn--primary:hover {
  filter: brightness(1.03);
}

.btn--ghost {
  width: 100%;
  margin-top: 0.75rem;
  background: var(--paper-2);
  color: var(--muted);
  border: 2px dashed var(--line);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--accent-soft);
}

/* Quiz */
.quiz-head {
  margin-bottom: 1rem;
  width: 100%;
  max-width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.progress-wrap {
  height: 10px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(61, 52, 40, 0.06);
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lemon), var(--juice));
  transition: width 0.35s ease;
}

.quiz-meta {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.q-card {
  background: var(--paper-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  box-shadow: 0 6px 0 rgba(61, 52, 40, 0.06);
  width: 100%;
  max-width: min(420px, 100%);
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  box-sizing: border-box;
}

.q-text {
  margin: 0 0 1.1rem;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.55;
  text-align: center;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.opt {
  font-family: inherit;
  text-align: center;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.opt:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 4px 0 rgba(232, 93, 76, 0.15);
}

.opt:active {
  transform: translateY(2px);
}

.opt--neutral {
  background: rgba(255, 255, 255, 0.55);
  border-style: dashed;
  color: var(--muted);
  font-size: 0.9rem;
}

.opt--neutral:hover {
  border-color: var(--accent-soft);
  color: var(--text);
}

.opt:focus-visible {
  outline: 2px solid var(--juice);
  outline-offset: 2px;
}

/* Result：全屏居中、比例协调 */
#screen-result {
  width: 100%;
}

#screen-result.screen--active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  box-sizing: border-box;
}

.result-sheet {
  width: 100%;
  max-width: min(440px, 100%);
  min-height: min(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom), 900px);
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(0.25rem, 1.8vh, 0.65rem);
  padding: 0.35rem 0.65rem;
  box-sizing: border-box;
}

.result-head {
  width: 100%;
  text-align: center;
}

.result-figure {
  margin: 0 auto;
  max-width: min(136px, 34vw);
  flex-shrink: 0;
}

.result-illu {
  position: relative;
  width: 100%;
  max-width: min(136px, 34vw);
  margin: 0 auto;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-illu-deco {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 0.95rem;
  z-index: 2;
  animation: illu-deco 2.4s ease-in-out infinite;
  filter: drop-shadow(0 1px 0 rgba(61, 52, 40, 0.1));
}

@keyframes illu-deco {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0);
  }
  50% {
    transform: rotate(6deg) translateY(-2px);
  }
}

.illu-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.illu-float {
  animation: illu-float 2.8s ease-in-out infinite;
  transform-origin: 50% 60%;
}

@keyframes illu-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.result-illu--t .illu-svg {
  filter: saturate(0.9) brightness(0.95);
}

.result-illu--a .illu-svg {
  filter: saturate(1.08);
}

/* 梗型覆盖插画：与 app.js 中 OVERRIDE 一一对应 */
.persona-meme .illu-svg {
  overflow: visible;
}

.illu-meme-wrap {
  width: 100%;
  max-width: min(136px, 34vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.illu-meme-img {
  width: 100%;
  height: auto;
  max-height: min(136px, 34vw);
  object-fit: contain;
  display: block;
  border-radius: 12px;
  border: 2px solid var(--line);
  box-shadow: 0 4px 0 rgba(61, 52, 40, 0.06);
  background: #fff;
}

.persona-meme-enfpa .illu-nailong,
.persona-meme-enfpt .illu-nailong {
  border-radius: 14px;
}

.persona-meme-istpa .illu-jiahao {
  border-radius: 12px;
}

.persona-meme-isfpa .illu-liuyifei {
  border-radius: 12px;
  object-position: center 22%;
}

.persona-meme-estpt .illu-peng {
  border-radius: 12px;
  object-position: center 18%;
}

.persona-meme-estpa .illu-liangzi {
  border-radius: 12px;
  object-position: center 35%;
}

.persona-meme-infpa .illu-wanou {
  border-radius: 12px;
  object-position: center 25%;
}

.result-illu--t .illu-meme-img {
  filter: saturate(0.92) brightness(0.96);
}

.result-illu--a .illu-meme-img {
  filter: saturate(1.06);
}

.persona-meme-entpa .ikun-ball-img {
  filter: drop-shadow(0 2px 0 rgba(61, 52, 40, 0.18));
}

svg.illu-weiren {
  animation: weiren-jitter 2.6s steps(2, end) infinite;
}

@keyframes weiren-jitter {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(1px, -1px);
  }
}

.result-rarity-block {
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf9 0%, #fff8f0 100%);
  border: 2px solid var(--line);
  box-shadow: 0 4px 14px rgba(61, 52, 40, 0.06);
  text-align: center;
}

.result-rarity-block--ssr {
  border-color: #ffb84d;
  background: linear-gradient(180deg, #fff9e6 0%, #fff3d6 100%);
}
.result-rarity-block--ur {
  border-color: #e879a9;
  background: linear-gradient(180deg, #fff5f9 0%, #ffe8f2 100%);
}
.result-rarity-block--sr {
  border-color: #ff9a6b;
  background: linear-gradient(180deg, #fff8f3 0%, #ffe8dc 100%);
}
.result-rarity-block--r {
  border-color: #ffd54a;
  background: linear-gradient(180deg, #fffdf5 0%, #fff3d0 100%);
}
.result-rarity-block--u {
  border-color: var(--mint);
  background: linear-gradient(180deg, #f4fff8 0%, #e8faf0 100%);
}
.result-rarity-block--n {
  border-color: var(--line);
}

.result-rarity-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
}

.result-rarity-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

.result-rarity-tier {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--accent);
}

.result-rarity-stars {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: #ffb020;
}

.result-rarity-pct {
  margin: 0 0 0.25rem;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text);
  opacity: 0.92;
}

.result-rarity-blurb {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.result-match-block {
  margin: 0;
  width: 100%;
  padding: 0.35rem 0.5rem;
  background: var(--paper-2);
  border: 2px dashed var(--line);
  border-radius: 10px;
  text-align: center;
}

.result-match-label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.result-match-num {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--juice);
}

.result-match-bar-wrap {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  overflow: hidden;
}

.result-match-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lemon), var(--juice));
  transition: width 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.result-code {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--juice);
  word-break: break-all;
  line-height: 1.2;
}

.result-name {
  margin: 0.05rem 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  text-align: center;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  line-height: 1.15;
}

.result-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.result-tagline {
  margin: 0 0 0.15rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.result-body {
  width: 100%;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
  line-height: 1.45;
  font-size: 0.72rem;
  color: var(--text);
  box-shadow: 0 3px 0 rgba(61, 52, 40, 0.04);
  text-align: center;
}

.result-body p {
  margin: 0 0 0.35rem;
}

.result-body p:last-child {
  margin-bottom: 0;
}

.result-share {
  width: 100%;
  margin: 0;
  padding: 0.38rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 230, 170, 0.35);
  border: 2px dashed rgba(255, 180, 120, 0.55);
  font-size: 0.68rem;
  color: #8a5a2a;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}

.btn--result {
  margin-top: 0.15rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0.48rem 0.85rem;
  font-size: 0.78rem;
  border-radius: 12px;
  width: 100%;
  max-width: 280px;
  display: block;
}

/* 人格插画：动作与梗强绑定 */
.persona-enfp .enfp-wing-l {
  animation: enfp-wing 0.55s ease-in-out infinite alternate;
  transform-origin: 28px 108px;
}
.persona-enfp .enfp-wing-r {
  animation: enfp-wing-r 0.55s ease-in-out infinite alternate;
  transform-origin: 172px 108px;
}
@keyframes enfp-wing {
  from {
    transform: translate(28px, 108px) rotate(-32deg);
  }
  to {
    transform: translate(28px, 108px) rotate(-10deg);
  }
}
@keyframes enfp-wing-r {
  from {
    transform: translate(172px, 108px) rotate(32deg);
  }
  to {
    transform: translate(172px, 108px) rotate(10deg);
  }
}
.persona-enfp .enfp-blush {
  animation: enfp-blush 1.1s ease-in-out infinite;
}
@keyframes enfp-blush {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
    transform: scale(1.12);
  }
}

.persona-enfj .enfj-spot {
  animation: enfj-spot 1.4s ease-in-out infinite;
}
@keyframes enfj-spot {
  50% {
    opacity: 0.85;
    transform: translateY(2px);
  }
}
.persona-enfj .enfj-star {
  animation: enfj-star 2.8s linear infinite;
  transform-origin: 100px 44px;
}
@keyframes enfj-star {
  to {
    transform: rotate(360deg);
  }
}
.persona-enfj .enfj-spark,
.persona-enfj .enfj-spark2 {
  animation: enfj-blink 1.1s ease-in-out infinite;
}
@keyframes enfj-blink {
  50% {
    opacity: 0.35;
    transform: scale(0.85);
  }
}

.persona-entp .entp-spiral {
  animation: entp-spin 5s linear infinite;
  transform-origin: 100px 100px;
}
@keyframes entp-spin {
  to {
    transform: rotate(360deg);
  }
}
.persona-entp .entp-q {
  animation: entp-pop 0.85s ease-in-out infinite;
}
@keyframes entp-pop {
  0%,
  100% {
    transform: translate(118px, 52px) scale(1);
  }
  50% {
    transform: translate(118px, 52px) scale(1.14);
  }
}
.persona-entp .entp-bub,
.persona-entp .entp-bub2 {
  animation: entp-bub 1.2s ease-in-out infinite;
}
@keyframes entp-bub {
  50% {
    opacity: 0.45;
  }
}

.persona-infp .infp-heart {
  animation: infp-heart 1.2s ease-in-out infinite;
  transform-origin: 100px 72px;
}
@keyframes infp-heart {
  50% {
    transform: scale(1.08);
  }
}
.persona-infp .infp-moon {
  animation: infp-moon 2.4s ease-in-out infinite;
}
@keyframes infp-moon {
  50% {
    opacity: 0.75;
    transform: translateY(-3px);
  }
}
.persona-infp .infp-scarf {
  animation: infp-scarf 1.5s ease-in-out infinite;
}
@keyframes infp-scarf {
  50% {
    transform: translateX(2px);
  }
}

.persona-infj .infj-cheese {
  animation: infj-nibble 1.2s ease-in-out infinite;
}
@keyframes infj-nibble {
  50% {
    transform: translateX(3px) rotate(2deg);
  }
}

.persona-intp .intp-z1 {
  animation: intp-z 1.4s ease-in-out infinite;
}
.persona-intp .intp-z2 {
  animation: intp-z 1.4s ease-in-out 0.2s infinite;
}
.persona-intp .intp-z3 {
  animation: intp-z 1.4s ease-in-out 0.35s infinite;
}
@keyframes intp-z {
  0%,
  100% {
    opacity: 0.35;
    transform: translate(0, 6px);
  }
  50% {
    opacity: 1;
    transform: translate(0, 0);
  }
}

.persona-intj .intj-rook {
  animation: intj-rook 2.6s ease-in-out infinite;
}
@keyframes intj-rook {
  0%,
  100% {
    transform: translate(100px, 36px);
  }
  50% {
    transform: translate(100px, 36px) translateY(-3px);
  }
}

.persona-esfp .esfp-spark-top {
  animation: esfp-glint 1s ease-in-out infinite;
  transform-origin: 100px 52px;
}
@keyframes esfp-glint {
  0%,
  100% {
    opacity: 1;
    transform: translate(100px, 52px) rotate(0deg);
  }
  50% {
    opacity: 0.7;
    transform: translate(100px, 52px) rotate(18deg) scale(1.06);
  }
}
.persona-esfp .esfp-dot {
  animation: esfp-dot 0.8s ease-in-out infinite;
}
@keyframes esfp-dot {
  50% {
    opacity: 0.4;
  }
}

.persona-esfj .esfj-bouquet {
  animation: esfj-sway 1.8s ease-in-out infinite;
  transform-origin: 100px 36px;
}
@keyframes esfj-sway {
  0%,
  100% {
    transform: translate(100px, 24px) rotate(0deg);
  }
  50% {
    transform: translate(100px, 24px) rotate(-5deg);
  }
}

.persona-estp .estp-speed,
.persona-estp .estp-speed2 {
  animation: estp-whoosh 0.45s ease-in-out infinite alternate;
}
@keyframes estp-whoosh {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}
.persona-estp .estp-shade {
  animation: estp-nod 1.2s ease-in-out infinite;
  transform-origin: 100px 64px;
}
@keyframes estp-nod {
  50% {
    transform: rotate(-4deg);
  }
}

.persona-estj .estj-check {
  animation: estj-stamp 1.6s ease-in-out infinite;
}
@keyframes estj-stamp {
  50% {
    transform: translateY(1px) scale(1.04);
  }
}

.persona-isfp .isfp-ear-l,
.persona-isfp .isfp-ear-r {
  animation: isfp-ear 1.1s ease-in-out infinite alternate;
}
@keyframes isfp-ear {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-2px);
  }
}
.persona-isfp .isfp-paw {
  animation: isfp-paw 1s ease-in-out infinite;
  transform-origin: 108px 132px;
}
@keyframes isfp-paw {
  50% {
    transform: scale(1.08);
  }
}

.persona-isfj .isfj-heart {
  animation: isfj-heart 1.2s ease-in-out infinite;
  transform-origin: 100px 138px;
}
@keyframes isfj-heart {
  50% {
    transform: scale(1.1);
  }
}

.persona-istp .istp-banana {
  animation: istp-banana 1.1s ease-in-out infinite;
}
@keyframes istp-banana {
  50% {
    transform: translateY(-3px) rotate(-3deg);
  }
}
.persona-istp .istp-wrench {
  animation: istp-wrench 0.9s ease-in-out infinite alternate;
  transform-origin: 132px 56px;
}
@keyframes istp-wrench {
  from {
    transform: translate(132px, 56px) rotate(35deg);
  }
  to {
    transform: translate(132px, 56px) rotate(22deg);
  }
}

@media (max-height: 720px) {
  .result-figure {
    max-width: 96px;
  }
  .result-illu {
    max-width: 96px;
  }
  .illu-meme-wrap {
    max-width: 96px;
  }
  .illu-meme-img {
    max-height: 96px;
  }
  .result-body {
    font-size: 0.66rem;
  }
}

@media (min-width: 480px) {
  .q-card {
    padding: 1.65rem 1.45rem;
  }
}

/* 手机端：内容区水平居中 + 安全区，避免贴边与顶对齐突兀 */
@media (max-width: 639px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  .shell {
    width: 100%;
    max-width: 100%;
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    justify-content: center;
    align-items: center;
  }

  .shell:has(#screen-result.screen--active) {
    align-items: center;
    justify-content: center;
    padding-top: max(0.75rem, env(safe-area-inset-top));
  }

  #screen-welcome,
  #screen-quiz {
    width: 100%;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  #screen-result {
    width: 100%;
    max-width: 100%;
    min-height: 100dvh;
  }

  .hero-deco--a {
    left: 5%;
  }

  .hero-deco--b {
    right: 5%;
  }

  .hero-deco--c {
    animation: hero-bang-m 0.9s ease-in-out infinite;
  }

  @keyframes hero-bang-m {
    0%,
    100% {
      transform: translateX(-50%) scale(1);
      opacity: 0.55;
    }
    50% {
      transform: translateX(-50%) scale(1.15);
      opacity: 0.85;
    }
  }

  .result-sheet {
    align-items: center;
    width: 100%;
    max-width: min(440px, 100%);
    min-height: min(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom), 920px);
    margin-left: auto;
    margin-right: auto;
    padding-left: max(0.65rem, env(safe-area-inset-left));
    padding-right: max(0.65rem, env(safe-area-inset-right));
  }

  .result-match-block,
  .result-body,
  .result-share {
    width: 100%;
  }

  .btn--ghost.btn--result {
    max-width: min(320px, 100%);
    margin-left: auto;
    margin-right: auto;
  }
}
