/* 我们的恋爱说明书 —— 柔粉配色 + 居中答题区 + 更强的交互反馈。
   主色：#e0578a（我）｜辅色：#ef9a58（Ta）。 */

:root {
  --ink: #3b2b31;
  --ink-2: #70595f;
  --ink-3: #a08d94;
  --primary: #e0578a;
  --primary-deep: #c33c6d;
  --primary-soft: #fdeaf1;
  --partner: #ef9a58;
  --partner-deep: #cf7a35;
  --partner-soft: #fdf1e5;
  --good: #4f9e77;
  --good-soft: #ecf7f1;
  --warm: #d98a3d;
  --line: #f3e2e8;
  --shadow: 0 2px 16px rgba(224, 87, 138, 0.09);
  --shadow-strong: 0 10px 28px rgba(195, 60, 109, 0.24);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  background: linear-gradient(180deg, #fff9fb 0%, #ffeef4 100%);
  background-attachment: fixed;
  min-height: 100%;
}

body {
  padding: max(18px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.app {
  max-width: 520px;
  margin: 0 auto;
}

.screen {
  display: none;
}

.screen.active {
  animation: screenIn 0.32s ease both;
}

#screen-intro.active,
#screen-solo.active,
#screen-couple.active {
  display: block;
}

/* 答题区垂直居中 */
#screen-quiz.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 56px);
  position: relative;
}

/* 顶部标签脱离文档流，保证答题卡本身居中 */
#screen-quiz .sysbar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  white-space: nowrap;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- 卡片 ---------- */

.card {
  background: #fff;
  border-radius: 22px;
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.sysbar {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.3px;
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  margin: 0 0 14px 4px;
  box-shadow: var(--shadow);
}

.sysbar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

h1 {
  font-size: 25px;
  line-height: 1.45;
  margin: 0 0 8px;
  letter-spacing: 0.2px;
}

h2 {
  font-size: 17px;
  margin: 0 0 12px;
}

.meta {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0 0 16px;
}

.body-text {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0 0 12px;
  line-height: 1.85;
}

.body-text b {
  color: var(--primary-deep);
  font-weight: 600;
}

.list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  font-size: 14.5px;
  color: var(--ink-2);
}

.list li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 10px;
  line-height: 1.8;
}

.list li::before {
  content: "♡";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary);
  font-size: 13px;
}

.note {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.75;
  margin-top: 14px;
}

.stage-note {
  font-size: 13px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-radius: 14px;
  padding: 12px 15px;
  margin: 0 0 14px;
  line-height: 1.7;
}

/* ---------- 按钮 ---------- */

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 16.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  margin-top: 12px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:active {
  transform: scale(0.975);
}

.btn-primary {
  background: linear-gradient(135deg, #ef7ba6 0%, #d2457a 100%);
  color: #fff;
  box-shadow: var(--shadow-strong);
}

.btn-ghost {
  background: #fff;
  color: var(--primary-deep);
  border: 1.5px solid #f6d5e1;
}

.btn-ghost:active {
  background: var(--primary-soft);
}

[disabled] {
  opacity: 0.4;
}

/* ---------- 答题页 ---------- */

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 9px;
}

.progress-track {
  height: 8px;
  background: #fbeaf0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 22px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7a8c4, #e0578a);
  transition: width 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.q-index {
  display: inline-block;
  font-size: 12.5px;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 5px 13px;
  margin-bottom: 14px;
}

.q-text {
  font-size: 19px;
  line-height: 1.7;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 0 0 22px;
  color: var(--ink);
  animation: qIn 0.34s ease both;
}

@keyframes qIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 17px;
  color: var(--ink-2);
  font-size: 15.5px;
  font-family: inherit;
  line-height: 1.6;
  padding: 16px 44px 16px 16px;
  margin-bottom: 11px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: optIn 0.4s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.opt:active {
  transform: scale(0.98);
}

.opt .badge {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.opt.picked {
  border-color: var(--primary);
  background: linear-gradient(135deg, #fff4f8 0%, #fde8f0 100%);
  color: var(--primary-deep);
  box-shadow: 0 4px 16px rgba(224, 87, 138, 0.16);
}

.opt.picked .badge {
  background: var(--primary);
  color: #fff;
  transform: scale(1.06);
}

.opt.picked::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 15px;
  height: 8px;
  border-left: 2.5px solid var(--primary);
  border-bottom: 2.5px solid var(--primary);
  transform: translateY(-70%) rotate(-45deg);
  animation: checkIn 0.22s ease both;
}

@keyframes checkIn {
  from {
    opacity: 0;
    transform: translateY(-70%) rotate(-45deg) scale(0.6);
  }
  to {
    opacity: 1;
    transform: translateY(-70%) rotate(-45deg) scale(1);
  }
}

@keyframes optIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.q-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--ink-3);
  font-size: 13.5px;
  font-family: inherit;
  padding: 8px 4px;
  cursor: pointer;
}

.q-hint {
  font-size: 12.5px;
  color: #cbb6be;
}

/* ---------- 结果页 ---------- */

.hero {
  position: relative;
  border-radius: 24px;
  padding: 26px 22px 24px;
  margin-bottom: 14px;
  color: #fff;
  background: linear-gradient(140deg, #f0799f 0%, #d2457a 100%);
  box-shadow: var(--shadow-strong);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -70px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
}

.hero .eyebrow {
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 10px;
}

.hero .level {
  display: inline-block;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.34);
  margin-bottom: 12px;
}

.result-name {
  font-size: 31px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 0 0 12px;
  line-height: 1.3;
}

.result-tag {
  font-size: 15.5px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.96);
  margin: 0;
  position: relative;
  z-index: 1;
}

.subtag {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  position: relative;
  z-index: 1;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 22px 0 10px;
  position: relative;
  padding-left: 13px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
}

.section-title:first-child {
  margin-top: 0;
}

/* 雷达图 */
.radar-wrap {
  text-align: center;
  margin: 6px 0 6px;
}

.radar-wrap canvas {
  width: 100%;
  max-width: 330px;
}

.radar-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 6px;
}

.radar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.radar-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.radar-legend i.a {
  background: var(--primary);
}

.radar-legend i.b {
  background: var(--partner);
}

/* 维度条 */
.metric {
  background: #fff8fb;
  border-radius: 16px;
  padding: 14px 15px;
  margin-bottom: 10px;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 9px;
}

.metric-head .val {
  font-size: 13px;
  color: var(--ink-3);
}

.chip {
  display: inline-block;
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 11px;
}

.chip.good {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.chip.bad {
  background: var(--partner-soft);
  color: var(--partner-deep);
}

.metric-track {
  height: 8px;
  background: #f7e7ee;
  border-radius: 999px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f7a8c4, #e0578a);
  transition: width 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.metric-fill.warn {
  background: linear-gradient(90deg, #f6c79a, #ef9a58);
}

.metric-hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 8px;
  line-height: 1.65;
}

.facts {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.8;
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.scene-box {
  background: var(--partner-soft);
  border-radius: 16px;
  padding: 16px 17px;
  font-size: 14.5px;
  color: #8a5628;
  line-height: 1.85;
}

.strength-box {
  background: var(--good-soft);
  border-radius: 16px;
  padding: 16px 17px;
  font-size: 14.5px;
  color: #2f6a50;
  line-height: 1.85;
}

.fit {
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 0;
}

/* 双人对比 */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 4px;
}

.tag {
  font-size: 12.5px;
  border-radius: 999px;
  padding: 5px 13px;
}

.tag.a {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.tag.b {
  background: var(--partner-soft);
  color: var(--partner-deep);
}

.score-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 0 0 6px;
}

.score-num {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
}

.compare {
  background: #fff8fb;
  border-radius: 16px;
  padding: 15px 15px 12px;
  margin-bottom: 10px;
}

.compare-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 10px;
}

.bar-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
}

.bar-name {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-name.a {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.bar-name.b {
  background: var(--partner-soft);
  color: var(--partner-deep);
}

.bar-track {
  flex: 1 1 auto;
  height: 8px;
  background: #f7e7ee;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.bar-fill.a {
  background: linear-gradient(90deg, #f7a8c4, #e0578a);
}

.bar-fill.b {
  background: linear-gradient(90deg, #f7c79a, #ef9a58);
}

.bar-val {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--ink-3);
  width: 30px;
  text-align: right;
}

.diff-tag {
  font-size: 12px;
  border-radius: 999px;
  padding: 3px 11px;
  background: var(--partner-soft);
  color: var(--partner-deep);
}

.diff-tag.same {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.gap-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 6px;
}

.gap-line {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.85;
  margin: 0 0 12px;
}

.canvas-wrap {
  margin: 18px 0 0;
  text-align: center;
}

.canvas-wrap canvas {
  width: 100%;
  max-width: 300px;
  border-radius: 18px;
  box-shadow: 0 6px 22px rgba(195, 60, 109, 0.16);
}

.tip {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(6px);
  background: rgba(59, 43, 49, 0.93);
  color: #fff;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 84%;
  text-align: center;
  z-index: 99;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 爱情元素 ---------- */

/* 1. 背景上升的爱心 */
.hearts-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.heart {
  position: absolute;
  bottom: -40px;
  line-height: 1;
  color: #f2a0c0;
  animation-name: riseUp;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform, opacity;
}

@keyframes riseUp {
  0% {
    transform: translateY(0) translateX(0) scale(0.7) rotate(-8deg);
    opacity: 0;
  }
  12% {
    opacity: var(--peak, 0.26);
  }
  55% {
    transform: translateY(-52vh) translateX(var(--drift, 14px)) scale(1) rotate(6deg);
    opacity: var(--peak, 0.26);
  }
  100% {
    transform: translateY(-108vh) translateX(0) scale(1.08) rotate(-4deg);
    opacity: 0;
  }
}

/* 2. 点选时迸发的爱心 */
.heart-burst {
  position: fixed;
  line-height: 1;
  color: #e0578a;
  pointer-events: none;
  z-index: 99;
  animation: burstUp 0.9s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}

@keyframes burstUp {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0.95;
  }
  35% {
    transform: translate(-50%, -70px) scale(1.2);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -170px) scale(0.9);
    opacity: 0;
  }
}

/* 3. 双心靠近：重合度越高，两颗心贴得越近 */
.heart-pair {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--gap, 26px);
  margin: 16px 0 2px;
  font-size: 22px;
  line-height: 1;
  transition: gap 1.1s cubic-bezier(0.34, 1.2, 0.64, 1);
  position: relative;
  z-index: 1;
}

.heart-pair span {
  display: inline-block;
  animation: beat 1.8s ease-in-out infinite;
}

.heart-pair .h1 {
  color: #ffffff;
}

.heart-pair .h2 {
  color: #ffd3ba;
  animation-delay: 0.5s;
}

@keyframes beat {
  0%,
  100% {
    transform: scale(1);
  }
  18% {
    transform: scale(1.18);
  }
  36% {
    transform: scale(1);
  }
  54% {
    transform: scale(1.09);
  }
}

.pair-caption {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.82);
  margin: 6px 0 0;
  position: relative;
  z-index: 1;
}

/* ---------- 答案码（异地模式） ---------- */

.code-box {
  background: linear-gradient(135deg, #fff4f8 0%, #fde8f0 100%);
  border: 1.5px dashed #f3bcd1;
  border-radius: 18px;
  padding: 18px 16px 14px;
  text-align: center;
  margin: 4px 0 14px;
}

.code-text {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--primary-deep);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  -webkit-user-select: text;
  user-select: text;
  word-break: break-all;
}

.code-hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 8px;
}

.code-input {
  width: 100%;
  border: 1.5px solid #f3cfdd;
  border-radius: 16px;
  background: #fff8fb;
  padding: 16px 16px;
  font-size: 22px;
  letter-spacing: 4px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  color: var(--primary-deep);
  text-align: center;
  text-transform: uppercase;
  margin: 6px 0 4px;
  outline: none;
}

.code-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(224, 87, 138, 0.12);
}

.code-error {
  font-size: 13px;
  color: #d0455f;
  min-height: 20px;
  margin: 2px 0 2px;
}

#screen-code.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 56px);
  position: relative;
}

#screen-code .sysbar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  white-space: nowrap;
}

/* ---------- 浏览器里的发笔记兜底面板 ---------- */

/* 网页版才出现的返回入口（小工具容器里不注入） */
.web-nav {
  max-width: 520px;
  margin: 0 auto 4px;
}

.web-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-3);
  text-decoration: none;
  padding: 6px 2px;
}

.web-nav a:active {
  color: var(--primary-deep);
}

.share-panel {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding: 14px 16px 12px;
  box-shadow: 0 12px 40px rgba(195, 60, 109, 0.28);
  z-index: 90;
  animation: screenIn 0.3s ease both;
  max-height: 68vh;
  overflow-y: auto;
}

.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.share-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.share-close {
  background: none;
  border: 0;
  color: var(--ink-3);
  font-size: 13.5px;
  font-family: inherit;
  padding: 4px 2px;
  cursor: pointer;
}

.share-text {
  width: 100%;
  border: 1.5px solid #f3cfdd;
  border-radius: 14px;
  background: #fff8fb;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
  font-family: inherit;
  resize: none;
  outline: none;
}

.share-tip {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
  margin: 8px 0 0;
}

.share-panel .btn {
  padding: 12px 16px;
  font-size: 15px;
  margin-top: 8px;
}
