:root {
  --primary: #4d6a53;
  --primary-light: #6c8d71;
  --primary-dark: #3a5040;
  --bg: #f6faf6;
  --card: #ffffff;
  --text: #1e2a22;
  --text-light: #6a786f;
  --border: #dbe8dd;
  --soft: #edf6ef;
  --shadow: 0 4px 24px rgba(47,73,55,.09);
  --shadow-sm: 0 2px 8px rgba(47,73,55,.07);
  --radius: 18px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.container { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.page-hidden { display: none !important; }

/* ========== 首页 ========== */
#page-home { min-height: 100vh; display: flex; flex-direction: column; }

.hero {
  text-align: center;
  padding: 52px 20px 36px;
  background: linear-gradient(145deg, #2d4a35 0%, #4d6a53 40%, #6c8d71 70%, #8aaa8e 100%);
  color: #fff;
  border-radius: 0 0 36px 36px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -30px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: 2px; margin-bottom: 8px; position: relative; z-index: 1; }
.hero p { font-size: 14px; opacity: .88; position: relative; z-index: 1; margin-bottom: 6px; }
.hero-sub { font-size: 12px; opacity: .7; position: relative; z-index: 1; }
.back-home {
  position: absolute; top: 16px; left: 16px;
  color: rgba(255,255,255,.85); text-decoration: none;
  font-size: 13px; font-weight: 500; z-index: 10;
  padding: 4px 12px; border-radius: 20px;
  background: rgba(255,255,255,.15); backdrop-filter: blur(4px);
  transition: background .2s;
}
.back-home:hover { background: rgba(255,255,255,.25); }

.intro-section { padding: 20px 16px; }
.intro-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.intro-card h3 { font-size: 15px; color: var(--primary); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.intro-card ul { padding-left: 16px; }
.intro-card li { font-size: 13px; color: var(--text-light); line-height: 1.9; }

.dim-groups { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.dim-group { font-size: 13px; color: var(--text-light); padding: 8px 12px; background: var(--soft); border-radius: 8px; }
.dim-group strong { color: var(--primary); }

.btn-start {
  display: block; width: calc(100% - 32px); max-width: 400px;
  margin: 8px auto 48px; padding: 16px;
  background: linear-gradient(135deg, #3a5040, #6c8d71);
  color: #fff; border: none; border-radius: 50px;
  font-size: 18px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 20px rgba(47,73,55,.3);
  letter-spacing: 2px; transition: transform .2s;
}
.btn-start:active { transform: scale(.97); }

/* ========== 答题页 ========== */
#page-test { min-height: 100vh; padding-bottom: 100px; }
.test-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--card); padding: 12px 16px 10px;
  box-shadow: var(--shadow-sm);
}
.progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.progress-bar { flex: 1; height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3a5040, #6c8d71); border-radius: 4px; transition: width .4s ease; }
.progress-text { font-size: 12px; font-weight: 600; color: var(--primary); min-width: 44px; text-align: right; }
.encourage-text { font-size: 12px; color: var(--text-light); text-align: center; padding: 2px 0; }

.question-area { padding: 20px 0; position: relative; overflow: hidden; min-height: 200px; }
.question-card {
  background: var(--card); border-radius: var(--radius);
  padding: 24px 20px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: opacity .15s ease, transform .15s ease;
}
.question-card.slide-out-left  { opacity: 0; transform: translateX(-60px); pointer-events: none; }
.question-card.slide-out-right { opacity: 0; transform: translateX(60px);  pointer-events: none; }
.question-card.slide-in-left  { animation: slideInLeft .15s ease forwards; }
.question-card.slide-in-right { animation: slideInRight .15s ease forwards; }
@keyframes slideInLeft  { from { opacity: 0; transform: translateX(60px); }  to { opacity: 1; transform: none; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: none; } }

.q-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  color: var(--primary-light); background: var(--soft);
  padding: 3px 10px; border-radius: 20px; margin-bottom: 12px;
}
.q-text { font-size: 15px; line-height: 1.75; color: var(--text); margin-bottom: 20px; font-weight: 500; }

.q-options { display: flex; flex-direction: column; gap: 10px; }
.q-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--soft);
  cursor: pointer; transition: all .2s; user-select: none;
}
.q-option:hover { border-color: var(--primary-light); background: #e4f0e6; }
.q-option.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, #e4f0e6, #d4e8d7);
  box-shadow: 0 2px 10px rgba(47,73,55,.12);
}
.q-option-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--card); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--primary);
  flex-shrink: 0; transition: all .2s;
}
.q-option.selected .q-option-letter { background: var(--primary); color: #fff; border-color: var(--primary); }
.q-option-text { font-size: 14px; color: var(--text); line-height: 1.5; }

.test-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex; gap: 12px; padding: 12px 16px 24px;
  background: rgba(246,250,246,.9); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.btn-prev, .btn-next {
  flex: 1; padding: 14px; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-prev {
  background: var(--soft); color: var(--primary);
  border: 1.5px solid var(--border);
}
.btn-prev:disabled { opacity: .4; cursor: default; }
.btn-next {
  background: linear-gradient(135deg, #3a5040, #6c8d71);
  color: #fff; box-shadow: 0 4px 14px rgba(47,73,55,.25);
}
.btn-next:disabled { opacity: .5; cursor: default; }

/* ========== 报告页 ========== */
#page-report { min-height: 100vh; padding-bottom: 60px; }
.report-hero {
  text-align: center; padding: 36px 20px 28px;
  background: linear-gradient(145deg, #2d4a35, #4d6a53, #6c8d71);
  color: #fff; border-radius: 0 0 32px 32px; margin-bottom: 0;
}
.report-hero h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.report-hero p { font-size: 13px; opacity: .85; }

.report-section {
  background: var(--card); border-radius: var(--radius);
  padding: 22px 20px; margin: 14px 16px 0;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}
.section-title { font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }

/* 主卡 */
.report-main-type { text-align: center; }
.main-type-code { font-size: 52px; font-weight: 900; letter-spacing: 3px; line-height: 1.1; margin-bottom: 6px; }
.main-type-name { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.main-type-mode { font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.main-type-badge {
  display: inline-block; font-size: 12px; color: #fff;
  padding: 4px 14px; border-radius: 20px; margin-bottom: 12px; font-weight: 600;
}
.main-type-sub { font-size: 13px; color: var(--text-light); margin-bottom: 14px; line-height: 1.6; }
.main-type-intro {
  font-size: 15px; font-style: italic; color: var(--primary);
  padding: 12px 16px; background: var(--soft); border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary-light);
}

/* 描述 */
.report-desc-text { font-size: 14px; color: var(--text-light); line-height: 1.85; }

/* 次要人格 */
.secondary-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--soft); border-radius: var(--radius-sm);
}
.secondary-code { font-size: 20px; font-weight: 800; }
.secondary-cn { font-size: 14px; color: var(--text); font-weight: 600; }
.secondary-sim { font-size: 12px; color: var(--text-light); margin-left: auto; }

/* 维度 */
.dim-grid { display: flex; flex-direction: column; gap: 14px; }
.dim-item { }
.dim-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.dim-name { font-size: 14px; font-weight: 600; color: var(--text); }
.dim-tag { font-size: 10px; color: #fff; padding: 2px 8px; border-radius: 10px; }
.dim-level { font-size: 12px; color: var(--text-light); margin-left: auto; white-space: nowrap; }
.level-L { color: #e17055; }
.level-M { color: #f39c12; }
.level-H { color: #27ae60; }
.dim-bar-bg { height: 5px; background: var(--border); border-radius: 3px; margin-bottom: 5px; overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }
.level-bar-L { background: linear-gradient(90deg, #e17055, #fab1a0); }
.level-bar-M { background: linear-gradient(90deg, #f39c12, #fdcb6e); }
.level-bar-H { background: linear-gradient(90deg, #27ae60, #55efc4); }
.dim-expl { font-size: 12px; color: var(--text-light); line-height: 1.6; }

/* 排行 */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item { display: flex; align-items: center; gap: 10px; }
.rank-num {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
  background: #b2bec3;
}
.rank-1 { background: #f1c40f; }
.rank-2 { background: #95a5a6; }
.rank-3 { background: #cd7f32; }
.rank-info { width: 72px; flex-shrink: 0; }
.rank-code { font-size: 13px; font-weight: 700; }
.rank-cn { font-size: 11px; color: var(--text-light); }
.rank-bar-wrap { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.rank-bar { height: 100%; border-radius: 3px; transition: width .5s; }
.rank-sim { font-size: 12px; color: var(--text-light); min-width: 36px; text-align: right; }

/* 免责 */
.disclaimer {
  font-size: 12px; color: var(--text-light); text-align: center;
  padding: 16px; line-height: 1.7;
}

.btn-restart {
  display: block; width: calc(100% - 32px); max-width: 400px;
  margin: 20px auto 0; padding: 15px;
  background: var(--soft); color: var(--primary);
  border: 1.5px solid var(--border); border-radius: 50px;
  font-size: 16px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.btn-restart:hover { background: var(--primary); color: #fff; }

/* 报告页英雄区：主卡 + 图片一体化 */
.report-card-hero {
  background: var(--card);
  border-radius: var(--radius);
  margin: 14px 16px 0;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.report-card-hero .report-main-type {
  padding: 24px 20px 16px;
  text-align: center;
}
#report-poster {
  /* 图片紧跟主卡底部，无额外外边距 */
}
.poster-wrap {
  background: linear-gradient(145deg, #2d4a35, #4d6a53);
  position: relative;
}
.poster-img {
  width: 100%;
  display: block;
  max-height: 360px;
  object-fit: cover;
  object-position: center top;
}
.poster-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 40px 20px 18px;
  background: linear-gradient(to top, rgba(30,42,34,.9), transparent);
  color: #fff;
  font-size: 15px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: .3px;
}

/* 原作者信息 */
.author-credit {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--soft);
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  border: 1px solid var(--border);
}
.author-avatar {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #2d4a35, #6c8d71);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.author-info { flex: 1; min-width: 0; }
.author-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.author-name a { color: var(--primary); text-decoration: none; }
.author-name a:hover { text-decoration: underline; }
.author-desc {
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.7;
}

/* 章节分隔 */
.chapter-divider {
  text-align: center; margin: 20px 16px 0;
  position: relative;
}
.chapter-divider::before {
  content: '';
  position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border);
}
.chapter-divider span {
  position: relative; background: var(--bg);
  padding: 0 14px; font-size: 13px; font-weight: 600; color: var(--primary);
}
