:root {
  --primary: #6B409C;
  --primary-dark: #54307C;
  --primary-light: #EFE8F9;
  --bg: #F7F3FC;
  --card: #ffffff;
  --text: #332B3D;
  --muted: #8B8098;
  --border: #E6DDF2;
  --star: #f5b301;
  --green: #3aa876;
  --red: #d4574e;
  --shadow: 0 4px 20px rgba(107, 64, 156, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

.boot { text-align: center; padding: 80px 0; color: var(--muted); }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--primary), #9B6FD0);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.18); }
.user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.user .logout { cursor: pointer; opacity: 0.85; }
.user .logout:hover { opacity: 1; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.btn {
  display: inline-block;
  border: none;
  border-radius: 24px;
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
}
.btn:hover { opacity: 0.88; }
.btn.primary { background: linear-gradient(135deg, var(--primary), #9B6FD0); color: #fff; }
.btn.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--red); }
.btn.small { padding: 6px 14px; font-size: 13px; border-radius: 18px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }

.label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
textarea { min-height: 160px; resize: vertical; }
.tips { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 18px; }

.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 24px 0 8px; }
.footer-disclaimer {
  text-align: center;
  font-size: 12px;
  color: #B3A8C4;
  padding: 10px 0 20px;
}
.loading { text-align: center; padding: 60px 0; color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- 登录 ---------- */
.login-wrap { max-width: 400px; margin: 60px auto 0; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .heart {
  width: 96px; height: 96px; margin: 0 auto 14px;
  border-radius: 22%;
  display: block;
  background: #fff;
  box-shadow: 0 8px 28px rgba(107, 64, 156, 0.28);
}
.login-logo h1 { font-size: 22px; }
.login-logo p { color: var(--muted); font-size: 13px; }
.mode-tabs { display: flex; gap: 20px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.mode-tabs span { padding: 8px 2px; cursor: pointer; color: var(--muted); }
.mode-tabs span.on { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }
.form-item { margin-bottom: 12px; }

/* ---------- 首页档案卡片 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.person-card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
  border: 1px solid transparent;
}
.person-card:hover { transform: translateY(-3px); border-color: var(--primary-light); }
.pc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 600; flex-shrink: 0;
}
.pc-name { font-weight: 600; font-size: 16px; }
.relation-chip {
  display: inline-block; font-size: 11px; color: var(--primary);
  background: var(--primary-light); border-radius: 10px; padding: 1px 8px; margin-left: 6px;
}
.pc-sub { font-size: 12px; color: var(--muted); }
.pc-stars { font-size: 14px; letter-spacing: 1px; }
.st { color: #DDD4EA; }
.st.on { color: var(--star); }
.pc-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 8px; }
.trend-up { color: var(--green); font-weight: 600; }
.trend-down { color: var(--red); font-weight: 600; }
.trend-flat { color: var(--muted); }

/* ---------- 详情页 ---------- */
.back-link { display: inline-block; margin-bottom: 14px; font-size: 14px; }
.person-header { display: flex; align-items: center; gap: 14px; }
.person-header .avatar { width: 56px; height: 56px; font-size: 24px; }
.person-header h2 { font-size: 20px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.stat-cell { text-align: center; background: var(--bg); border-radius: 12px; padding: 10px 4px; }
.stat-cell .v { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-cell .k { font-size: 12px; color: var(--muted); }

.chart-box { width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-empty { text-align: center; color: var(--muted); padding: 40px 0; }
svg text.ax { font-size: 11px; fill: #A394BC; }
svg text.dotv { font-size: 11px; fill: var(--primary); font-weight: 600; }

.record-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 4px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.record-item:last-child { border-bottom: none; }
.record-item:hover .ri-title { color: var(--primary); }
.ri-main { flex: 1; min-width: 0; }
.ri-title { font-weight: 600; font-size: 15px; }
.ri-sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-score { text-align: right; flex-shrink: 0; }
.ri-score .s { font-size: 22px; font-weight: 700; color: var(--primary); }
.ri-score .u { font-size: 12px; color: var(--muted); }
.source-chip {
  font-size: 11px; border-radius: 8px; padding: 1px 7px;
  background: #eef4f0; color: var(--green); flex-shrink: 0;
}
.source-chip.img { background: #fdf3e7; color: #d08a2d; }
.record-del { color: var(--muted); font-size: 12px; cursor: pointer; flex-shrink: 0; }
.record-del:hover { color: var(--red); }

/* ---------- 检测表单 ---------- */
.img-upload {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}
.img-upload:hover { border-color: var(--primary); color: var(--primary); }
.img-preview { max-width: 100%; max-height: 300px; border-radius: 10px; display: block; margin: 0 auto; }
.img-actions { text-align: center; margin-top: 8px; }
#imgInput { display: none; }

/* ---------- 结果页 ---------- */
.result-hero { text-align: center; padding: 28px 16px; }
.result-hero .lv-title { font-size: 26px; font-weight: 700; color: var(--primary); }
.result-stars { font-size: 26px; letter-spacing: 3px; margin: 12px 0; }
.result-score { color: var(--muted); font-size: 14px; }
.result-score b { color: var(--primary); font-size: 22px; }
.result-tags { margin-top: 10px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 11px; border-radius: 10px; padding: 2px 10px; background: var(--bg); color: var(--muted); }
.tag.engine { background: #eef4f0; color: var(--green); }
.tag.note { background: #fdf3e7; color: #d08a2d; }
.lv-desc { color: var(--muted); font-size: 14px; max-width: 480px; margin: 10px auto 0; }

.dim-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dim-label { width: 64px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.dim-track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.dim-fill { height: 100%; background: linear-gradient(90deg, #9B6FD0, var(--primary)); border-radius: 4px; }
.dim-val { width: 34px; text-align: right; font-size: 13px; color: var(--primary); font-weight: 600; }

.sec-title { font-size: 15px; font-weight: 600; margin: 18px 0 10px; }
.hl-list li, .sug-list li { font-size: 14px; color: #4A3F58; margin-bottom: 6px; margin-left: 18px; }
.summary-text { font-size: 14px; color: #4A3F58; }
details.raw { margin-top: 14px; }
details.raw summary { font-size: 13px; color: var(--muted); cursor: pointer; }
details.raw pre {
  white-space: pre-wrap; word-break: break-all; font-size: 13px;
  background: var(--bg); border-radius: 10px; padding: 12px; margin-top: 8px;
  max-height: 300px; overflow: auto;
}
.result-img { max-width: 100%; max-height: 320px; border-radius: 10px; margin-top: 12px; display: block; }
.result-foot { display: flex; gap: 12px; margin-top: 18px; }

/* ---------- 移动端适配（H5） ---------- */
@media (max-width: 640px) {
  .container { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stat-cell .v { font-size: 16px; }
  .result-stars { font-size: 20px; letter-spacing: 2px; }
  .result-hero .lv-title { font-size: 22px; }
  .card { padding: 16px; }
  .actions .btn { flex: 1; }
}

/* ===== 缘友测 · 全站整体美化覆盖段 ===== */
body {
  background: linear-gradient(180deg, #FCFAFE 0%, #F4EEFB 320px, #F7F3FC 100%);
  min-height: 100vh;
}
.topbar {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(107, 64, 156, 0.08);
  box-shadow: 0 4px 22px rgba(107, 64, 156, 0.08);
}
.card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 8px 30px rgba(107, 64, 156, 0.09), 0 2px 8px rgba(107, 64, 156, 0.04);
  background: rgba(255, 255, 255, 0.94);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.btn.primary {
  background: linear-gradient(135deg, #6B409C 0%, #8A5BC2 55%, #9B6FD0 100%);
  box-shadow: 0 6px 18px rgba(107, 64, 156, 0.3);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(107, 64, 156, 0.38); opacity: 1; }
.btn.ghost:hover { background: rgba(107, 64, 156, 0.06); }
.login-logo .heart {
  border-radius: 22%;
  box-shadow: 0 12px 34px rgba(107, 64, 156, 0.22);
}
.login-logo h1 {
  background: linear-gradient(135deg, #6B409C, #A984D8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 4px;
}
.tag.engine { background: linear-gradient(135deg, #6B409C, #9B6FD0); color: #fff; font-weight: 600; }
.dim-track { height: 10px; border-radius: 999px; }
.dim-fill { background: linear-gradient(90deg, #8A5BC2, #C9A8EC); border-radius: 999px; transition: width 0.6s ease; }
.lv-title {
  background: linear-gradient(135deg, #6B409C, #A984D8);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
.result-score b { color: #6B409C; font-size: 1.6em; }
.avatar { box-shadow: 0 5px 14px rgba(107, 64, 156, 0.22); border: 2px solid rgba(255, 255, 255, 0.9); }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
input, select, textarea {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: #9B6FD0;
  box-shadow: 0 0 0 3px rgba(155, 111, 208, 0.15);
  outline: none;
}
