/*
 * 类人审判所 —— 样式。
 *
 * 移动端优先。这个产品的入口是小红书，用户 99% 在手机竖屏上打开，
 * 桌面端只是顺便能看。所以基准是 375px 宽，桌面用 max-width 兜住。
 *
 * 配色取自配置里的 share_template.theme_presets.dark_red，
 * 页面和分享图必须同色——用户截屏发出去的东西和站内看到的必须是同一个东西。
 */

:root {
  --bg: #100e12;
  --bg2: #22131a;
  --accent: #e23e3e;
  --text: #f5f0ea;
  --muted: #8a8078;
  --line: rgba(245, 240, 234, 0.1);
  --card: rgba(245, 240, 234, 0.04);

  --pad: 20px;
  --radius: 14px;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  /* 顶部一层暗红辉光，让页面不像纯黑那么平 */
  background-image:
    radial-gradient(120% 60% at 50% -10%, rgba(226, 62, 62, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, #0b090d 100%);
  background-attachment: fixed;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 0 var(--pad) 64px; }

a { color: inherit; text-decoration: none; }

/* ---------- 品牌头 ---------- */

.brand {
  padding: 28px 0 22px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.brand-mark::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  vertical-align: middle;
}
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }

/* ---------- 首页 ---------- */

.hero { padding: 34px 0 30px; }
.hero h1 {
  margin: 0 0 14px;
  font-size: 33px;
  line-height: 1.32;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }

.section-label {
  margin: 30px 0 14px;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.test-card {
  display: block;
  padding: 22px 20px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.18s, transform 0.18s;
}
.test-card:active { transform: scale(0.985); border-color: rgba(226, 62, 62, 0.5); }
.test-card h3 { margin: 0 0 8px; font-size: 19px; font-weight: 700; }
.test-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.test-card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; }
.tag {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}

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

.quiz-top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 0 12px;
  background: linear-gradient(180deg, var(--bg) 72%, transparent 100%);
}
.bar {
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  transition: width 0.28s ease;
}
.counter { margin-top: 9px; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }

.q-scene {
  margin: 26px 0 10px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.q-prompt {
  margin: 0 0 26px;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.45;
}

.opts { display: flex; flex-direction: column; gap: 11px; }
.opt {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: 100%;
  padding: 17px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.opt:active { transform: scale(0.985); }
.opt .k {
  flex: none;
  width: 23px; height: 23px;
  margin-top: 1px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  font-size: 12px;
  line-height: 21px;
  text-align: center;
  color: var(--muted);
}
.opt.on { border-color: var(--accent); background: rgba(226, 62, 62, 0.12); }
.opt.on .k { border-color: var(--accent); background: var(--accent); color: #fff; }

.nav-row { display: flex; gap: 10px; margin-top: 26px; }

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

.btn {
  display: block;
  width: 100%;
  padding: 17px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: 0.4; cursor: default; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 500;
}
.btn.ghost:hover { border-color: var(--muted); }

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

.verdict-card {
  margin-top: 8px;
  padding: 34px 24px 30px;
  border-radius: 20px;
  text-align: center;
  background:
    radial-gradient(90% 80% at 50% 0%, rgba(226, 62, 62, 0.24) 0%, transparent 68%),
    linear-gradient(180deg, var(--bg2) 0%, rgba(34, 19, 26, 0.3) 100%);
  border: 1px solid rgba(226, 62, 62, 0.24);
}
.score-num {
  font-size: 74px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.score-num small { font-size: 17px; font-weight: 500; color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.score-label { font-size: 13px; color: var(--muted); letter-spacing: 0.14em; margin-top: 12px; }

.type-name {
  margin: 20px 0 0;
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.verdict-line {
  margin: 14px auto 0;
  max-width: 330px;
  font-size: 16px;
  line-height: 1.72;
  color: rgba(245, 240, 234, 0.86);
}

.body-p { margin: 0 0 16px; font-size: 16px; line-height: 1.85; }

.traits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.trait {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: rgba(245, 240, 234, 0.78);
}

.indices { display: flex; flex-direction: column; gap: 16px; margin-top: 26px; }
.index-row { }
.index-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-bottom: 7px;
}
.index-head b { font-weight: 600; color: var(--text); }
.index-head span { color: var(--accent); font-variant-numeric: tabular-nums; }
.index-bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.index-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

.quote-card {
  margin-top: 28px;
  padding: 24px 22px;
  border-radius: var(--radius);
  border: 1px dashed rgba(226, 62, 62, 0.4);
  background: rgba(226, 62, 62, 0.06);
  font-size: 17px;
  line-height: 1.75;
  font-weight: 600;
}

.block {
  margin-top: 34px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.block-label {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.teaser {
  padding: 22px 20px;
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(226, 62, 62, 0.16), rgba(226, 62, 62, 0.04));
  border: 1px solid rgba(226, 62, 62, 0.3);
}
.teaser h4 { margin: 0 0 9px; font-size: 17px; }
.teaser p { margin: 0; color: rgba(245, 240, 234, 0.72); font-size: 14px; }

/* 分享卡：生成后原地替换成 img，方便长按保存 */
#shareCanvas { display: none; }
#shareImg { width: 100%; border-radius: var(--radius); display: block; }

.disclaimer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* ---------- 答题页里的一次性提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(245, 240, 234, 0.95);
  color: #16121a;
  font-size: 14px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}
.toast.on { opacity: 1; }

/* ---------- 后台 ---------- */

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 26px; }
.kpi {
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.kpi b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
table.data th { color: var(--muted); font-weight: 500; font-size: 12px; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.err-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: #ff8f8f; }
.warn-list { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: #e0c07a; }

@media (min-width: 600px) {
  .hero h1 { font-size: 38px; }
  .q-prompt { font-size: 26px; }
}
