:root {
  --bg: #fdf9f2;
  --card: #ffffff;
  --ink: #2c2c2a;
  --ink-2: #6b6a64;
  --line: #e8e4da;
  --accent: #534ab7;
  --accent-soft: #eeedfe;
  --warn: #993c1d;
  --ok: #0f6e56;
  --radius: 16px;
  /* 统一卡片语言：与首页 hero / 结果卡同源 */
  --radius-card: 22px;
  --shadow-card: 0 14px 34px -22px rgba(44, 44, 42, 0.5);
  /* 8 种搭子人格的强调色，用于顶部彩条 */
  --rainbow: linear-gradient(90deg,
    #3b6d11 0 12.5%, #d85a30 12.5% 25%, #993c1d 25% 37.5%, #185fa5 37.5% 50%,
    #ba7517 50% 62.5%, #534ab7 62.5% 75%, #993556 75% 87.5%, #0c447c 87.5% 100%);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
}
.app-shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
h1, h2, h3 { font-weight: 700; letter-spacing: 0.01em; }
p { word-break: break-word; }

/* 欢迎 */
.welcome { display: flex; flex-direction: column; gap: 16px; padding-top: 4dvh; animation: rise 0.3s ease; }
.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
/* 顶部彩条 = 8 种搭子人格的专属强调色，呼应结果卡卡面 */
.hero::before {
  content: "";
  display: block;
  height: 8px;
  background: var(--rainbow);
}
.hero-top { padding: 20px 20px 14px; display: flex; flex-direction: column; gap: 10px; }
.badge { align-self: flex-start; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.hero-top h1 { font-size: 34px; line-height: 1.22; }
.hero-top .subhead { font-size: 17px; color: var(--ink-2); }
.hero-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.hero-quote {
  position: relative;
  background: var(--accent-soft);
  border-radius: 16px;
  padding: 16px 16px 15px 38px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.68;
}
.hero-quote::before {
  content: "\201C";
  position: absolute;
  left: 13px;
  top: 9px;
  font-size: 30px;
  line-height: 1;
  opacity: 0.38;
  font-family: Georgia, "Songti SC", serif;
}
.tips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.tips li { background: #faf8f3; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); }
.privacy { font-size: 13px; color: var(--ink-2); background: var(--card); border-radius: var(--radius); padding: 12px 14px; border: 1px solid var(--line); }
.privacy.repeat {
  border: 1px dashed var(--accent, #534ab7);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(83, 74, 183, 0.06);
}

.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 4px 2px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.welcome .btn-primary { box-shadow: 0 14px 26px -16px rgba(83, 74, 183, 0.85); }

/* 按钮 */
.btn { display: block; width: 100%; border: none; border-radius: 14px; padding: 15px 18px; font-size: 17px; font-weight: 600; cursor: pointer; transition: transform 0.05s ease, opacity 0.15s; text-align: center; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink-2); font-weight: 500; padding: 12px; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row .btn { flex: 1; }
.btn-skip { background: transparent; color: var(--ink-2); font-weight: 500; }

/* 进度 */
.progress-wrap { position: sticky; top: 0; background: var(--bg); padding: 10px 0 8px; z-index: 5; }
.progress-text { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.progress-text .pct { color: var(--accent); font-weight: 700; }
.progress-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8f88e0); border-radius: 999px; transition: width 0.25s ease; }

/* 题卡 */
.qcard {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  margin-top: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: rise 0.22s ease;
}
.qcard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--rainbow);
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.qtitle { font-size: 20px; line-height: 1.45; }
.qnote { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; background: #faf8f3; border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; font-size: 15.5px; cursor: pointer; transition: border-color 0.12s, background 0.12s, transform 0.08s; color: var(--ink); font-family: inherit; line-height: 1.5; }
.opt:hover { border-color: #d6d1e8; }
.opt:active { transform: scale(0.99); }
.opt .mark { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #c9c5ba; margin-top: 2px; display: grid; place-items: center; font-size: 13px; color: #fff; background: transparent; transition: background 0.12s, border-color 0.12s; }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.selected .mark { background: var(--accent); border-color: var(--accent); }
.opt.selected .mark::after { content: "\2713"; font-size: 13px; line-height: 1; }
.opt.single .mark { border-radius: 50%; }
.opt.single.selected .mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.opt.disabled { opacity: 0.45; }
.opt .src-tag { flex: none; font-size: 11px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-top: 3px; }
.hint { font-size: 13px; color: var(--warn); margin-top: 10px; min-height: 1.4em; }
textarea { width: 100%; min-height: 130px; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 15.5px; font-family: inherit; resize: vertical; background: #faf8f3; color: var(--ink); transition: border-color 0.12s; }
textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.char-count { text-align: right; font-size: 12px; color: var(--ink-2); margin-top: 4px; font-variant-numeric: tabular-nums; }
.subhead-label { font-size: 14px; font-weight: 600; color: var(--accent); margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.subhead-label::before { content: ""; width: 4px; height: 15px; border-radius: 2px; background: var(--accent); flex: none; }

/* 结果页 */
.result { display: flex; flex-direction: column; gap: 14px; padding-top: 12px; animation: rise 0.3s ease; }
.result .eyebrow { text-align: center; color: var(--ink-2); font-size: 15px; }
.result .pname { text-align: center; font-size: 34px; line-height: 1.3; }
.pcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-card); }
.pcard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--rainbow);
  z-index: 1;
}
.pcard img, .pimg-placeholder { display: block; width: 100%; height: auto; }
.pcard img { aspect-ratio: 4 / 5; object-fit: cover; background: var(--accent-soft); }
.pimg-placeholder { aspect-ratio: 1; display: grid; place-items: center; font-size: 64px; color: var(--ink-2); background: var(--accent-soft); }
.pbody { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.catchphrase { font-size: 17px; font-weight: 600; color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.block {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px 16px 20px;
  overflow: hidden;
  box-shadow: 0 10px 26px -22px rgba(44, 44, 42, 0.5);
}
.block::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  opacity: 0.55;
}
.block h3 { font-size: 14px; margin-bottom: 8px; color: var(--accent); letter-spacing: 0.02em; }
.block p, .block li { font-size: 14.5px; }
.block ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.sticker { align-self: center; font-size: 13px; border-radius: 999px; padding: 5px 14px; font-weight: 600; }
.sticker.warn { background: #faeeda; color: var(--warn); }
.sticker.info { background: #e1f5ee; color: var(--ok); }
.footer-note { text-align: center; font-size: 12px; color: var(--ink-2); padding: 8px 6px 0; }
.save-status { text-align: center; font-size: 13px; }
.save-status.ok { color: var(--ok); }
.save-status.bad { color: var(--warn); }

/* 提交页 */
.submit-page { display: flex; flex-direction: column; gap: 16px; padding-top: 12dvh; animation: rise 0.3s ease; }
.submit-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 28px 22px 22px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.submit-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--rainbow); }
.submit-icon { font-size: 44px; line-height: 1; text-align: center; }
.submit-card h1 { font-size: 26px; text-align: center; }
.submit-card .subhead { font-size: 15px; color: var(--ink-2); text-align: center; }
.submit-card .btn-row { margin-top: 6px; }

/* 管理页 */
.admin { padding-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.admin-head {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 22px 20px 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 8px; background: var(--rainbow); }
.admin-head h1 { font-size: 24px; }
.admin-head p { font-size: 14px; color: var(--ink-2); }
.admin input { border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; font-size: 16px; background: #faf8f3; color: var(--ink); font-family: inherit; transition: border-color 0.12s; }
.admin input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.admin .stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 14px; box-shadow: 0 10px 26px -22px rgba(44, 44, 42, 0.5); }
.admin .stat ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.admin .stat-label { font-size: 12px; color: var(--ink-2); letter-spacing: 0.04em; margin-bottom: 4px; }
.admin .stat-value { font-size: 26px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.admin .btn { margin-top: 4px; }
@media (min-width: 520px) { .app-shell { padding-top: 40px; } }
