:root {
  --aqua: #08c5d1;
  --aqua-deep: #02aab7;
  --cream: #fffaf0;
  --ink: #171717;
  --coral: #ff5b55;
  --coral-dark: #e63f49;
  --yellow: #ffd54a;
  --purple: #6d4bd1;
  --line: 3px solid var(--ink);
  --shadow: 7px 8px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--aqua);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14px 14px, rgba(255, 255, 255, 0.12) 1px, transparent 1.5px) 0 0 / 28px 28px,
    var(--aqua);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.quiz-shell {
  width: min(760px, 100%);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
}

.screen {
  min-height: 100vh;
  min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) 22px max(38px, env(safe-area-inset-bottom));
}

.mini-header,
.result-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.mini-header a,
.result-brand a {
  border: var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  color: white;
  background: var(--ink);
  text-decoration: none;
}

.intro-screen {
  display: flex;
  flex-direction: column;
}

.intro-paper {
  position: relative;
  z-index: 2;
  width: calc(100% - 8px);
  margin: 6px 0 0;
  transform: rotate(-1.5deg);
}

.intro-paper::before {
  content: "";
  position: absolute;
  inset: 28px -7px -10px 12px;
  z-index: -2;
  background: var(--coral);
  clip-path: polygon(1% 5%, 97% 0, 100% 90%, 3% 100%);
}

.intro-paper p {
  width: fit-content;
  margin: 0 0 10px 18px;
  padding: 10px 16px;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 800;
  background: var(--cream);
  clip-path: polygon(2% 5%, 100% 0, 97% 95%, 0 100%);
}

.intro-paper h1 {
  margin: 0;
  padding: 18px 18px 20px;
  font-size: clamp(48px, 13vw, 86px);
  line-height: 0.98;
  letter-spacing: -0.06em;
  background: var(--cream);
  clip-path: polygon(1% 4%, 98% 0, 100% 89%, 94% 100%, 2% 95%);
  text-shadow: 2px 2px 0 white;
}

.intro-flower {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  margin-top: -4px;
}

.intro-flower img {
  width: min(58vw, 330px);
  filter: drop-shadow(6px 9px 0 rgba(23, 23, 23, 0.2));
  animation: flowerFloat 3.8s ease-in-out infinite;
}

.spark {
  position: absolute;
  color: white;
  font-size: 34px;
  animation: blink 1.9s ease-in-out infinite alternate;
}

.spark-one {
  left: 13%;
  top: 28%;
}

.spark-two {
  right: 12%;
  bottom: 22%;
  animation-delay: 0.8s;
}

.intro-copy {
  max-width: 600px;
  margin: 4px auto 22px;
  font-size: clamp(17px, 4.5vw, 21px);
  font-weight: 650;
  line-height: 1.75;
  text-align: center;
}

.intro-actions {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-height: 58px;
  border: var(--line);
  border-radius: 18px;
  padding: 14px 30px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  color: white;
  background: var(--coral);
  box-shadow: var(--shadow);
  font-size: 20px;
}

.secondary-button {
  color: var(--ink);
  background: var(--cream);
  box-shadow: 5px 6px 0 var(--ink);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translate(-2px, -2px);
}

.primary-button:active,
.secondary-button:active {
  transform: translate(5px, 6px);
  box-shadow: 0 0 0 var(--ink);
}

.intro-actions span {
  font-size: 13px;
  font-weight: 800;
}

.question-screen {
  display: grid;
  align-content: start;
}

.question-header {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  gap: 14px;
}

.back-button,
.close-button {
  width: 46px;
  height: 46px;
  border: var(--line);
  border-radius: 50%;
  background: var(--cream);
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
}

.question-header > div {
  display: grid;
  gap: 8px;
}

#progressText {
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: var(--cream);
}

.progress-track i {
  display: block;
  width: 7.14%;
  height: 100%;
  background: var(--coral);
  transition: width 280ms ease;
}

.question-card {
  position: relative;
  margin-top: 52px;
  border: var(--line);
  border-radius: 28px 18px 32px 20px;
  padding: clamp(26px, 7vw, 46px);
  background: var(--cream);
  box-shadow: var(--shadow);
}

.question-card::before {
  content: "LOVE";
  position: absolute;
  top: -22px;
  right: 24px;
  transform: rotate(4deg);
  border: var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  color: white;
  background: var(--purple);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

#questionScene {
  margin: 0 0 14px;
  color: var(--coral-dark);
  font-size: 14px;
  font-weight: 900;
}

#questionTitle {
  margin: 0 0 28px;
  font-size: clamp(27px, 7vw, 42px);
  line-height: 1.35;
  letter-spacing: -0.03em;
}

.answer-list {
  display: grid;
  gap: 14px;
}

.answer-button {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 17px;
  padding: 15px 16px;
  color: var(--ink);
  background: white;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.answer-button span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  background: var(--ink);
  font-size: 13px;
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateX(5px);
  background: #fff0c8;
  outline: 3px solid white;
  outline-offset: 2px;
}

.answer-button.selected {
  color: white;
  background: var(--coral);
}

.question-hint {
  margin: 30px 10px 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.7;
  text-align: center;
}

.result-screen {
  padding-inline: 18px;
}

.result-brand {
  margin-inline: 4px;
}

.result-hero {
  display: grid;
  justify-items: center;
  text-align: center;
}

#resultName {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 14px 18px 18px;
  font-size: clamp(54px, 14vw, 86px);
  line-height: 1;
  letter-spacing: -0.07em;
  background: var(--cream);
  clip-path: polygon(2% 5%, 98% 0, 100% 88%, 94% 100%, 0 93%);
  text-shadow: 3px 3px 0 white;
}

#resultName::after {
  content: "";
  position: absolute;
  inset: auto 6% 3px;
  z-index: -1;
  height: 12px;
  background: var(--coral);
}

.trait-list {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
}

.trait-list span {
  transform: rotate(var(--rotate, 0deg));
  border-radius: 10px;
  padding: 8px 11px;
  color: white;
  background: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

#resultFlower {
  width: min(46vw, 290px);
  margin: 16px 0 8px;
  filter: drop-shadow(6px 8px 0 rgba(23, 23, 23, 0.18));
  animation: resultPop 520ms cubic-bezier(0.2, 0.85, 0.25, 1.25) both;
}

#resultQuote {
  position: relative;
  width: min(600px, 94%);
  margin: 2px 0 38px;
  border: var(--line);
  border-radius: 28px;
  padding: 20px 24px;
  background: var(--cream);
  box-shadow: 5px 6px 0 var(--ink);
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 800;
  line-height: 1.55;
}

#resultQuote::after {
  content: "♥";
  position: absolute;
  right: -13px;
  bottom: -18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  color: white;
  background: var(--coral);
}

.analysis-stack {
  display: grid;
  gap: 24px;
}

.analysis-paper {
  position: relative;
  border: var(--line);
  border-radius: 12px 28px 14px 24px;
  padding: 28px 24px 24px;
  background: var(--cream);
  box-shadow: 6px 7px 0 var(--ink);
}

.analysis-paper:nth-child(even) {
  transform: rotate(0.6deg);
}

.analysis-paper:nth-child(odd) {
  transform: rotate(-0.4deg);
}

.analysis-paper h2,
.match-section > h2 {
  width: fit-content;
  margin: -46px 0 18px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 8px 14px;
  color: white;
  background: var(--ink);
  font-size: clamp(17px, 4.5vw, 21px);
  transform: rotate(-1deg);
}

.analysis-paper p {
  margin: 0;
  font-size: clamp(16px, 4.3vw, 19px);
  font-weight: 600;
  line-height: 1.9;
}

.advice-paper {
  background: #fff0a9;
}

.match-section {
  margin-top: 54px;
  border: var(--line);
  border-radius: 24px;
  padding: 27px 18px 20px;
  background: var(--cream);
  box-shadow: var(--shadow);
}

.match-section > h2 {
  margin-left: auto;
  margin-right: auto;
}

.match-grid {
  display: grid;
  gap: 14px;
}

.match-grid article {
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 17px;
  background: white;
}

.match-grid article:nth-child(1) {
  background: #e7e0ff;
}

.match-grid article:nth-child(2) {
  background: #fff0a9;
}

.match-grid article.friction {
  background: #ffd9d4;
}

.match-grid span {
  display: block;
  color: var(--coral-dark);
  font-size: 13px;
  font-weight: 900;
}

.match-grid strong {
  display: block;
  margin: 4px 0 7px;
  font-size: 25px;
}

.match-grid p {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.7;
}

.share-section {
  display: grid;
  gap: 20px;
  margin-top: 54px;
}

.share-section > div:first-child {
  text-align: center;
}

.share-section h2 {
  margin: 0 0 8px;
  font-size: 26px;
}

.share-section p {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

#shareImage {
  display: block;
  width: min(100%, 430px);
  height: auto;
  margin: 0 auto;
  border: var(--line);
  border-radius: 22px;
  background: var(--aqua);
  box-shadow: var(--shadow);
  -webkit-touch-callout: default;
}

#shareCanvas {
  display: none;
}

.save-hint {
  display: none;
  width: min(100%, 430px);
  margin: 0 auto !important;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 11px 14px;
  background: var(--yellow);
  text-align: center;
  line-height: 1.55;
}

.save-hint strong {
  font-weight: 950;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.share-actions button {
  width: 100%;
  padding-inline: 10px;
}

.tarot-cta {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 16px;
  margin-top: 60px;
  border: var(--line);
  border-radius: 28px 18px 32px 20px;
  padding: 34px 24px 30px;
  color: var(--cream);
  background: var(--ink);
  box-shadow: 8px 9px 0 var(--coral);
  text-align: center;
}

.tarot-cta::before,
.tarot-cta::after {
  content: "✦";
  position: absolute;
  color: var(--yellow);
  font-size: 28px;
}

.tarot-cta::before {
  top: 18px;
  left: 20px;
  transform: rotate(-12deg);
}

.tarot-cta::after {
  right: 20px;
  bottom: 22px;
  transform: rotate(10deg);
}

.tarot-cta > span {
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
}

.tarot-cta h2 {
  max-width: 580px;
  margin: 0;
  font-size: clamp(25px, 6.8vw, 38px);
  line-height: 1.35;
  letter-spacing: -0.035em;
}

.tarot-cta p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 250, 240, 0.86);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.85;
}

.tarot-cta a {
  position: relative;
  z-index: 1;
  border: 2px solid var(--cream);
  border-radius: 18px;
  padding: 15px 20px;
  color: var(--ink);
  background: var(--coral);
  box-shadow: 5px 6px 0 var(--cream);
  font-size: 17px;
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.tarot-cta a:hover {
  transform: translate(-2px, -2px);
}

.tarot-cta a:active {
  transform: translate(4px, 5px);
  box-shadow: none;
}

.tarot-cta small {
  font-weight: 800;
  letter-spacing: 0.06em;
}

.result-footer {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 52px 12px 0;
  text-align: center;
}

.result-footer button {
  border: 0;
  border-bottom: 2px solid var(--ink);
  padding: 4px;
  background: transparent;
  font-weight: 900;
  cursor: pointer;
}

.result-footer span {
  font-weight: 900;
  letter-spacing: 0.04em;
}

.result-footer p {
  max-width: 520px;
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.7;
}

@keyframes flowerFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-9px) rotate(2deg);
  }
}

@keyframes blink {
  from {
    transform: scale(0.7) rotate(-10deg);
    opacity: 0.45;
  }
  to {
    transform: scale(1.08) rotate(8deg);
    opacity: 1;
  }
}

@keyframes resultPop {
  from {
    transform: scale(0.65) rotate(-8deg);
    opacity: 0;
  }
  to {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

@media (min-width: 640px) {
  .screen {
    padding-inline: 48px;
  }

  .match-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .match-grid article {
    min-height: 180px;
  }
}

@media (max-width: 639px) {
  .save-hint {
    display: block;
  }

  #saveButton {
    display: none;
  }

  .share-actions {
    grid-template-columns: 1fr;
  }
}

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