:root {
  color-scheme: light;
  --ink: #251216;
  --muted: #8a6570;
  --subtle: #b88992;
  --paper: rgba(255, 251, 248, 0.88);
  --card: #fffaf7;
  --line: rgba(131, 42, 62, 0.12);
  --rose: #ee5d7c;
  --berry: #8d183a;
  --coral: #ff9b87;
  --apricot: #ffe0bf;
  --lavender: #efe7ff;
  --shadow: 0 22px 58px rgba(116, 28, 50, 0.16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 155, 135, 0.72), transparent 18rem),
    radial-gradient(circle at 10% 18%, rgba(239, 231, 255, 0.95), transparent 16rem),
    linear-gradient(180deg, #fff4ef 0%, #fffaf7 48%, #fff1f4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(141, 24, 58, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(141, 24, 58, 0.035) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, black, transparent 70%);
}

button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px 34px;
}

.landing {
  min-height: calc(100vh - 58px);
  display: grid;
  align-content: start;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 0 12px;
  background: linear-gradient(180deg, rgba(255, 244, 239, 0.96), rgba(255, 244, 239, 0.72));
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--berry);
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--berry), var(--rose) 62%, var(--coral));
  box-shadow: 0 12px 28px rgba(141, 24, 58, 0.24);
}

.link-button {
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--berry);
  background: rgba(255, 255, 255, 0.72);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: min(700px, calc(100vh - 92px));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-top: 6px;
  padding: 300px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 72% 16%, rgba(255, 255, 255, 0.78) 0 3.2rem, transparent 3.25rem),
    radial-gradient(circle at 23% 18%, rgba(239, 231, 255, 0.94), transparent 11rem),
    radial-gradient(circle at 50% 42%, rgba(255, 224, 191, 0.96), transparent 12rem),
    linear-gradient(154deg, #fff9f4 0%, #ffe1dc 45%, #f66b89 100%);
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  top: 42px;
  left: 50%;
  width: 260px;
  height: 260px;
  border-radius: 36% 64% 45% 55%;
  transform: translateX(-50%) rotate(-12deg);
  background:
    linear-gradient(145deg, rgba(141, 24, 58, 0.88), rgba(238, 93, 124, 0.78)),
    radial-gradient(circle at 42% 38%, rgba(255,255,255,.9), transparent 3rem);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 28px 60px rgba(141, 24, 58, 0.22);
}

.hero::after {
  content: "LOVE TYPE";
  position: absolute;
  top: 118px;
  left: 0;
  right: 0;
  color: rgba(255,255,255,.42);
  text-align: center;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: .08em;
}

.cover-art {
  position: absolute;
  inset: 24px 14px auto;
  z-index: 1;
  height: 280px;
  pointer-events: none;
}

.love-disc {
  position: absolute;
  left: 50%;
  top: 38px;
  width: 218px;
  height: 218px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 46% 54% 40% 60%;
  color: #fff;
  transform: translateX(-50%) rotate(-8deg);
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,.34), transparent 3.5rem),
    linear-gradient(145deg, rgba(141,24,58,.78), rgba(238,93,124,.8));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 28px 58px rgba(141, 24, 58, 0.24);
}

.love-disc span {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .22em;
}

.love-disc strong {
  margin-top: 2px;
  font-size: 43px;
  line-height: .9;
  letter-spacing: -.04em;
}

.floating-card {
  position: absolute;
  min-width: 92px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 999px;
  color: var(--berry);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  background: rgba(255,255,255,.72);
  box-shadow: 0 16px 34px rgba(116, 28, 50, 0.12);
  backdrop-filter: blur(14px);
}

.card-a {
  left: 8px;
  top: 70px;
  transform: rotate(-8deg);
}

.card-b {
  right: 4px;
  top: 110px;
  transform: rotate(8deg);
}

.card-c {
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%) rotate(-2deg);
}

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  color: var(--berry);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero h1 {
  position: relative;
  z-index: 1;
  max-width: 330px;
  margin: 0;
  font-size: 48px;
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.lead {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  color: rgba(37, 18, 22, 0.72);
  font-size: 15px;
  line-height: 1.7;
}

.hero-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.hero-card div {
  min-height: 66px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.54);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
  backdrop-filter: blur(12px);
}

.hero-card span {
  display: block;
  color: var(--subtle);
  font-size: 11px;
  margin-bottom: 5px;
}

.hero-card strong {
  display: block;
  color: var(--berry);
  font-size: 15px;
  line-height: 1.2;
}

.primary-button, .secondary-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 20px;
  border: 0;
  text-decoration: none;
  font-weight: 850;
  transition: transform 160ms ease, opacity 160ms ease;
}

.primary-button {
  color: white;
  background: linear-gradient(145deg, var(--berry), var(--rose));
  box-shadow: 0 16px 34px rgba(141, 24, 58, 0.24);
}

.secondary-button {
  color: var(--berry);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
}

.primary-button:active, .secondary-button:active, .link-button:active { transform: scale(.98); }
.primary-button:disabled { opacity: .42; box-shadow: none; cursor: not-allowed; }
.hero-cta {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 16px;
}

.hero-chat-cta {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 10px;
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(14px);
}

.type-preview {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 14px -16px 20px;
  padding: 0 16px 4px;
  scrollbar-width: none;
}

.type-preview::-webkit-scrollbar { display: none; }
.type-preview span {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--berry);
  font-size: 13px;
  font-weight: 750;
  background: rgba(255,255,255,.66);
}

.quiz {
  margin-top: 8px;
  min-height: calc(100vh - 58px);
  padding-bottom: 24px;
}

.quiz-sticky {
  position: sticky;
  top: 58px;
  z-index: 15;
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 14px;
  align-items: center;
  margin: 0 -2px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 250, 247, 0.88);
  box-shadow: 0 16px 38px rgba(116, 28, 50, 0.1);
  backdrop-filter: blur(18px);
}

.quiz-sticky h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1;
}

.progress {
  color: var(--berry);
  text-align: right;
  font-size: 13px;
  font-weight: 850;
}

.progress i {
  display: block;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(141, 24, 58, 0.1);
}

.progress b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--rose), var(--berry));
  transition: width 180ms ease;
}

.scale-guide {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 10px;
  color: var(--subtle);
  font-size: 12px;
  text-align: center;
}

.single-question-shell {
  min-height: 430px;
}

.questions {
  display: grid;
  gap: 12px;
}

.question {
  min-height: 312px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 14px 34px rgba(116, 28, 50, 0.08);
}

.question-step {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: questionPop 220ms ease both;
}

.question-count {
  width: fit-content;
  margin-bottom: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--berry);
  font-size: 12px;
  font-weight: 850;
  background: rgba(255, 224, 191, 0.72);
}

.question p {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 780;
  line-height: 1.48;
}

.options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option span {
  min-height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(141, 24, 58, 0.13);
  border-radius: 15px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  background: #fff;
}

.option input:checked + span {
  color: white;
  border-color: transparent;
  background: linear-gradient(145deg, var(--berry), var(--rose));
  box-shadow: 0 12px 24px rgba(141, 24, 58, 0.2);
}

.submit-dock {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 92px 1fr 132px;
  gap: 8px;
  align-items: center;
  margin: 16px 0 0;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255, 250, 247, 0), rgba(255, 250, 247, 0.95) 28%, rgba(255, 250, 247, 0.98));
  backdrop-filter: blur(18px);
}

.submit-dock .secondary-button,
.submit-dock .primary-button {
  min-height: 48px;
  padding: 0 12px;
}

.secondary-button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.submit-dock p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.result-section {
  padding: 8px 0 46px;
}

.result-card {
  overflow: hidden;
  padding: 22px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 30px;
  color: white;
  background:
    radial-gradient(circle at 78% 8%, rgba(255,255,255,.28), transparent 9rem),
    linear-gradient(160deg, #7c1533 0%, #e85978 56%, #ff9b87 100%);
  box-shadow: var(--shadow);
}

.result-card .eyebrow { color: rgba(255,255,255,.75); }
.result-card h2 {
  margin: 0;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 12px 0 18px;
  color: rgba(255,255,255,.86);
  font-size: 16px;
  line-height: 1.65;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.score-pill {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px;
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(10px);
}

.score-pill span {
  color: rgba(255,255,255,.72);
  font-size: 11px;
}

.score-pill b {
  color: white;
  font-size: 21px;
}

.result-block, .share-card {
  margin-top: 10px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 22px;
  background: rgba(255,255,255,.9);
}

.result-block h3 {
  margin: 0 0 8px;
  color: var(--berry);
  font-size: 16px;
}

.result-block p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.78;
}

.share-card {
  text-align: center;
  background: #fffaf7;
}

.share-card span {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.share-card strong {
  display: block;
  margin: 7px 0;
  color: var(--berry);
  font-size: 34px;
  line-height: 1;
}

.share-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.result-actions #openChat {
  grid-column: 1 / -1;
}

.type-picker-section {
  padding: 8px 0 46px;
}

.type-picker-card {
  min-height: calc(100vh - 92px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 80% 8%, rgba(255,255,255,.7), transparent 8rem),
    linear-gradient(180deg, #fff9f4, #ffe4eb 54%, #fff7f3);
  box-shadow: var(--shadow);
}

.type-picker-card .link-button {
  margin-bottom: 18px;
}

.type-picker-card h2 {
  max-width: 320px;
  margin: 0;
  color: var(--berry);
  font-size: 38px;
  line-height: 1;
}

.type-picker-lead {
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.type-picker-grid {
  display: grid;
  gap: 10px;
}

.type-option {
  width: 100%;
  padding: 15px;
  border: 1px solid rgba(141, 24, 58, .13);
  border-radius: 22px;
  color: var(--ink);
  text-align: left;
  background: rgba(255,255,255,.78);
  box-shadow: 0 12px 26px rgba(116, 28, 50, 0.08);
}

.type-option strong {
  display: block;
  margin-bottom: 6px;
  color: var(--berry);
  font-size: 18px;
}

.type-option span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.chat-section {
  padding: 8px 0 46px;
}

.chat-card {
  min-height: calc(100vh - 92px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 82% 8%, rgba(255,255,255,.7), transparent 8rem),
    linear-gradient(180deg, #fff9f4, #ffe9ee 54%, #fff7f3);
  box-shadow: var(--shadow);
}

.chat-head {
  padding: 16px 16px 12px;
}

.chat-head .link-button {
  margin-bottom: 16px;
}

.chat-head h2 {
  margin: 0;
  color: var(--berry);
  font-size: 34px;
  line-height: 1.02;
}

.chat-head p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.quick-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 12px;
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar { display: none; }

.quick-actions button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid rgba(141, 24, 58, .14);
  border-radius: 999px;
  color: var(--berry);
  font-weight: 800;
  background: rgba(255,255,255,.72);
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 12px 16px 18px;
}

.message {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.62;
}

.message.assistant {
  align-self: flex-start;
  color: var(--ink);
  border: 1px solid rgba(141, 24, 58, .12);
  background: rgba(255,255,255,.88);
}

.message.user {
  align-self: flex-end;
  color: white;
  background: linear-gradient(145deg, var(--berry), var(--rose));
  box-shadow: 0 12px 24px rgba(141, 24, 58, 0.18);
}

.message.loading {
  color: var(--subtle);
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 8px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,250,247,.86);
  backdrop-filter: blur(18px);
}

.chat-input input {
  min-height: 48px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid rgba(141, 24, 58, .14);
  border-radius: 999px;
  color: var(--ink);
  outline: none;
  background: #fff;
}

.chat-input .primary-button {
  min-height: 48px;
  padding: 0 12px;
}

@keyframes questionPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 720px) {
  body {
    padding: 22px 0;
  }

  .app {
    border: 1px solid rgba(141, 24, 58, 0.12);
    border-radius: 34px;
    background: rgba(255,255,255,.34);
    box-shadow: 0 30px 90px rgba(116, 28, 50, 0.16);
  }

  .submit-dock {
    bottom: 22px;
    border-radius: 0 0 34px 34px;
  }
}
