/* h5/style.css —— 浅色纸张风（复刻小程序视觉，纯前端 H5 版） */
:root {
  --paper: #f5f0e6;
  --ink: #2c2c2c;
  --muted: #6b6678;
  --card: #ffffff;
  --line: #ece6d8;
  --dark: #1a1a1a;
  --light: #b54a3f;
  --accent: #34507a;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(60, 50, 30, 0.08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 540px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 14px 40px;
}
.boot { text-align: center; color: var(--muted); margin-top: 80px; font-size: 15px; }
.boot-error { text-align: center; margin: 70px 20px; padding: 24px 18px; background: #fff; border-radius: 16px; box-shadow: 0 6px 20px rgba(60,50,30,.08); }
.boot-error-title { font-size: 17px; font-weight: 700; color: #c0392b; margin-bottom: 8px; }
.boot-error-msg { font-size: 13px; color: #8a8478; line-height: 1.6; word-break: break-all; }
.boot-error-btn { margin: 16px auto 10px; display: block; padding: 10px 26px; border: none; border-radius: 22px; background: #5b8def; color: #fff; font-size: 14px; cursor: pointer; }
.boot-error-tip { font-size: 12px; color: #b3ada1; line-height: 1.6; }
button { font-family: inherit; cursor: pointer; }
/* 去掉移动端点按后残留的蓝色焦点框（仅保留键盘聚焦可见轮廓） */
.option, .btn, .quiz-back, .test-card { outline: none; -webkit-tap-highlight-color: transparent; }
.option:focus-visible { outline: 2px solid #34507a; outline-offset: 2px; border-radius: 14px; }
.font-hand { font-family: "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", cursive; }

/* ---------- 首页 ---------- */
.home-header { text-align: center; margin: 18px 0 22px; }
.app-title { font-family: "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", cursive; font-size: 38px; color: var(--ink); line-height: 1.3; }
.app-subtitle { color: var(--muted); font-size: 14px; margin-top: 6px; letter-spacing: 1px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.test-card {
  border-radius: var(--radius); padding: 16px 10px 14px; text-align: center;
  box-shadow: var(--shadow); color: #2c2418; min-height: 116px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform .12s ease;
}
.test-card:active { transform: scale(0.96); }
.test-icon { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 8px; }
.test-tt { font-size: 14px; font-weight: 700; line-height: 1.25; }
.test-ds { font-size: 11px; opacity: .72; margin-top: 5px; line-height: 1.3; }

/* ---------- 通用区块 ---------- */
.header-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 4px; margin: 8px 0 18px; font-family: "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", cursive; font-size: 24px; line-height: 1.45; text-align: center; }
.ht-pre, .ht-post { color: var(--muted); font-size: 15px; white-space: nowrap; }
.ht-badge { font-size: 22px; font-weight: 700; margin: 0 5px; max-width: 100%; word-break: break-word; }
.tag-pill { display: inline-block; background: #fff7e9; color: #8a5a2b; border: 1px solid #f0dcb8; padding: 9px 16px; border-radius: 999px; font-size: 14px; margin: 0 auto 18px; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; color: #3a342a; margin-bottom: 12px; position: relative; padding-left: 11px; }
.card-title::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px; background: var(--accent); }
.type-card .card-title::before { background: var(--light); }
.type-name { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.type-desc { font-size: 14px; line-height: 1.7; color: #555; }
.disclaimer-card { background: #fbf8f1; }
.disclaimer-text { font-size: 12px; line-height: 1.6; color: #9a9488; }
.footer-btns { display: flex; gap: 12px; margin-top: 6px; }
.btn { flex: 1; border: none; border-radius: 999px; padding: 13px 0; font-size: 15px; font-weight: 700; }
.btn-primary { background: linear-gradient(135deg, #3a5a8c, #34507a); color: #fff; }
.btn-outline { background: #fff; color: #34507a; border: 1px solid #c9d4e6; }
.btn:active { opacity: .85; }

/* ---------- 双面对照（七宗罪） ---------- */
.top-cards { display: flex; gap: 12px; margin-bottom: 12px; }
.top-card { flex: 1; border-radius: var(--radius); padding: 16px 12px; text-align: center; box-shadow: var(--shadow); }
.top-card.dark { background: #1f1f1f; color: #fff; }
.top-card.light { background: #fbeee9; color: #9c4034; }
.top-label { display: block; font-size: 12px; opacity: .8; margin-bottom: 8px; }
.top-value { font-size: 20px; font-weight: 800; line-height: 1.25; }
.diff-pill { text-align: center; margin-bottom: 14px; }
.diff-text { display: inline-block; background: #eef1f6; color: #4a5a72; padding: 6px 14px; border-radius: 999px; font-size: 13px; }
.detail-card .group { margin-bottom: 14px; }
.group-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 999px; margin-bottom: 10px; }
.group-tag.dark { background: #1f1f1f; color: #fff; }
.group-tag.light { background: #fbeee9; color: #9c4034; }
.dim-item { margin-bottom: 14px; }
.dim-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.dim-name { font-size: 14px; font-weight: 600; color: #3a342a; }
.dim-score { font-size: 14px; font-weight: 700; color: #5b6678; }
.progress { height: 8px; background: #efeae0; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; transition: width .4s ease; background: linear-gradient(90deg, #4a6ea8, #34507a); }
.progress-bar.dark { background: linear-gradient(90deg, #3a3a3a, #1a1a1a); }
.progress-bar.light { background: linear-gradient(90deg, #d06a5f, #b54a3f); }
.dim-desc { font-size: 12px; line-height: 1.55; color: #8a8478; margin-top: 6px; }

/* ---------- 七宗罪装饰图 ---------- */
.decor-card { text-align: center; margin: 0 0 12px; }
.decor-scale { max-width: 148px; width: 52%; height: auto; opacity: .95; display: block; margin: 0 auto; border-radius: 10px; }

/* ---------- 哲学家 / 人生流派 / 爱情阵营 / 人格阴影 / 深层欲望 / 中国哲学家结果配图 ---------- */
.result-art { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; margin: 0 0 14px; display: block; box-shadow: 0 4px 14px rgba(60, 50, 30, 0.08); }

/* ---------- 扇形 / 条形统计图 ---------- */
.chart-card { padding: 16px 14px; }
.chart-card .card-title { margin-bottom: 10px; }
.chart-canvas { width: 100%; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; font-size: 12px; color: #555; }
.chart-legend .lg { display: inline-flex; align-items: center; }
.chart-legend .lg i { width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; display: inline-block; }

/* ---------- 维度通用布局 ---------- */
.top-dim-card { text-align: center; padding: 24px 16px; background: linear-gradient(135deg, #fbf6ea, #ffffff); }
.top-dim-label { font-size: 13px; color: var(--muted); }
.top-dim-name { font-size: 28px; font-weight: 800; margin: 8px 0 4px; }
.top-dim-score { font-size: 16px; font-weight: 700; color: var(--accent); margin-bottom: 12px; }
.top-dim-desc { font-size: 14px; line-height: 1.75; color: #555; text-align: left; }
.second-dim-card { text-align: center; background: #fbf3f1; }
.second-label { font-size: 13px; color: #b1645a; }
.second-name { font-size: 22px; font-weight: 800; margin: 4px 0; }
.second-score { font-size: 15px; font-weight: 700; color: #b1645a; }

/* ---------- 七宗罪雷达图 ---------- */
.radar-card { padding: 16px 12px 12px; }
.radar-canvas { width: 100%; height: 340px; display: block; margin: 6px auto 0; }

/* ---------- MBTI ---------- */
.mbti-type-card { text-align: center; padding: 30px 20px 26px; background: linear-gradient(135deg, #eef2f7 0%, #ffffff 60%); }
.mbti-type { font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 62px; font-weight: 800; letter-spacing: 6px; color: #34507a; line-height: 1; }
.mbti-nick { font-family: "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", cursive; font-size: 26px; color: #222b3a; margin: 10px 0 14px; }
.mbti-overview { font-size: 14px; line-height: 1.75; color: #5b6678; text-align: left; }
.mbti-axes-card .axis { padding: 12px 0; border-bottom: 1px solid #f2f2f2; }
.mbti-axes-card .axis:last-child { border-bottom: none; }
.axis-row { display: flex; align-items: center; margin: 8px 0; }
.axis-side { width: 96px; display: flex; flex-direction: column; align-items: center; }
.axis-side.win .axis-letter { color: #34507a; }
.axis-letter { font-size: 16px; font-weight: 800; color: #9aa6b8; }
.axis-name { font-size: 11px; color: var(--muted); margin-top: 2px; }
.axis-bar { flex: 1; height: 8px; background: #efeae0; border-radius: 999px; overflow: hidden; margin: 0 8px; }
.axis-bar-fill { height: 100%; border-radius: 999px; }
.axis-bar-fill.left { background: #6b8cc4; }
.axis-bar-fill.right { background: #34507a; }
.axis-pct { width: 44px; text-align: right; font-size: 14px; font-weight: 600; color: #5b6678; }
.bullet { position: relative; padding-left: 18px; font-size: 14px; line-height: 1.6; color: #4a4a4a; margin-bottom: 8px; }
.bullet::before { content: ""; position: absolute; left: 4px; top: 9px; width: 7px; height: 7px; border-radius: 50%; background: #34507a; }
.paragraph { font-size: 14px; line-height: 1.75; color: #5b6678; }

/* ---------- SBTI ---------- */
.sbti-type-card { text-align: center; padding: 30px 20px 26px; background: linear-gradient(135deg, #f7eef7 0%, #ffffff 60%); }
.sbti-emoji { font-size: 66px; line-height: 1.1; margin-bottom: 8px; }
.sbti-code { font-family: "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", cursive; font-size: 28px; font-weight: 700; color: #7a3a7a; margin-bottom: 14px; }
.sbti-desc { font-size: 14px; line-height: 1.8; color: #6b5b6e; text-align: left; }
.sbti-quote { margin-top: 14px; padding: 10px 14px; background: #f7eef7; border-left: 3px solid #b07ac0; border-radius: 8px; font-size: 13px; color: #7a3a7a; font-style: italic; text-align: left; }
.sbti-pair-card { display: flex; gap: 12px; }
.pair-item { flex: 1; background: #f9f3fb; border-radius: var(--radius); padding: 14px 12px; text-align: center; }
.pair-label { font-size: 12px; color: #9a7aa0; margin-bottom: 6px; }
.pair-val { font-size: 18px; font-weight: 800; color: #7a3a7a; letter-spacing: 2px; }

/* ---------- 答题页 ---------- */
.quiz { padding-top: 4px; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.quiz-back { background: none; border: none; color: var(--muted); font-size: 14px; padding: 6px 0; }
.quiz-counter { font-size: 13px; color: var(--muted); }
.quiz-progress { height: 6px; background: #e7e0d2; border-radius: 999px; overflow: hidden; margin-bottom: 20px; }
.quiz-progress-fill { height: 100%; background: linear-gradient(90deg, #3a5a8c, #34507a); border-radius: 999px; transition: width .25s ease; }
.quiz-question { font-size: 19px; font-weight: 700; line-height: 1.6; margin-bottom: 22px; color: #2c2c2c; word-break: break-word; overflow-wrap: anywhere; }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  position: relative;
  display: block; width: 100%;
  background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 15px 44px 15px 16px; font-size: 15px; line-height: 1.55; color: #3a342a; text-align: left;
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
  transition: border-color .12s, background .12s, transform .12s;
}
.option.selected { border-color: #34507a; background: #eef3fa; color: #1f3556; font-weight: 600; }
.option.selected::after { content: "✓"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-weight: 800; color: #34507a; font-size: 17px; }
.option:active { transform: scale(0.99); }
.quiz-nav { display: flex; gap: 12px; margin-top: 26px; }
.quiz-nav .btn[disabled] { opacity: .45; }

/* 入场动画（轻量，贴合原版） */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.quiz-question, .options, .card { animation: fadeUp .28s ease both; }
@media (prefers-reduced-motion: reduce) { .quiz-question, .options, .card { animation: none; } }

/* 小屏适配 */
@media (max-width: 360px) {
  .grid { gap: 9px; }
  .test-card { min-height: 104px; padding: 13px 7px 11px; }
  .test-tt { font-size: 13px; }
  .mbti-type { font-size: 52px; }
  .option { padding: 14px 40px 14px 14px; font-size: 14px; }
}

/* ---------- SBTI 从夯到拉排行榜 ---------- */
.rank-tip { font-size: 12px; color: #9a7aa0; margin-bottom: 12px; }
.rank-list { display: flex; flex-direction: column; gap: 7px; }
.rank-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 12px; background: #f9f6fb; }
.rank-item.rank-you { background: linear-gradient(90deg, #f3e6f7, #efe6fb); border: 1px solid #d9bce6; }
.rank-no { width: 18px; text-align: center; font-size: 12px; font-weight: 700; color: #b3a8bd; flex-shrink: 0; }
.rank-item.rank-you .rank-no { color: #7a3a7a; }
.rank-emoji { font-size: 17px; width: 22px; text-align: center; flex-shrink: 0; }
.rank-name { font-size: 14px; font-weight: 600; color: #4a4452; min-width: 64px; flex-shrink: 0; }
.rank-you-tag { font-size: 11px; font-weight: 700; color: #fff; background: #7a3a7a; border-radius: 999px; padding: 1px 8px; flex-shrink: 0; }
.rank-bar { flex: 1; height: 8px; background: #ece6f2; border-radius: 999px; overflow: hidden; }
.rank-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #b07ac0, #7a3a7a); transition: width .4s ease; }
.rank-item.rank-you .rank-fill { background: linear-gradient(90deg, #8e5aa8, #5a2a7a); }
