/* ============================================================
   人格测评 renge.folo.cn — 设计系统
   纸本 / 朱砂 / 宋体标题，移动优先，微信内置浏览器友好
   ============================================================ */

:root {
  --paper: #fbf8f3;
  --paper-2: #f4eee3;
  --paper-3: #ece3d3;
  --ink: #1b1917;
  --ink-2: #46403a;
  --ink-3: #837a6b;
  --line: #e2d8c8;
  --line-2: #d3c6b1;
  --accent: #b23a29;
  --accent-d: #8e2b1d;
  --indigo: #22485c;
  --gold: #a0762a;
  --green: #3f6b4f;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 0 rgba(27, 25, 23, .04), 0 8px 24px -18px rgba(27, 25, 23, .5);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --max: 1080px;
  --max-narrow: 720px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

::selection { background: rgba(178, 58, 41, .16); }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.wrap-narrow { width: 100%; max-width: var(--max-narrow); margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(251, 248, 243, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; gap: 14px; height: 56px; }
.logo { display: flex; align-items: center; gap: 9px; flex: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); color: #fff;
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  display: grid; place-items: center; letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.logo-txt { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: .06em; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 7px 10px; font-size: 14px; color: var(--ink-2); white-space: nowrap;
  border-radius: 999px;
}
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a.on { color: var(--accent); background: rgba(178, 58, 41, .08); font-weight: 600; }

/* ---------- 通用文字 ---------- */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.3; margin: 0; letter-spacing: .01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
.lead { font-size: 17px; color: var(--ink-2); }
.kicker {
  font-size: 12px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-3); font-family: var(--sans); font-weight: 600;
}
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.accent { color: var(--accent); }
.num { font-family: var(--serif); font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: var(--radius-s); font-size: 16px; font-weight: 600;
  cursor: pointer; transition: transform .12s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--accent-d); }
.btn:active { transform: translateY(1px); }
.btn-lg { min-height: 54px; font-size: 17px; padding: 0 30px; width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- 卡片 ---------- */
.card {
  background: #fffdf9; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.card-flat { background: transparent; box-shadow: none; }

/* ---------- 首页 hero ---------- */
.hero { padding: 40px 0 28px; position: relative; }
.hero::after {
  content: ""; position: absolute; inset: auto 0 -1px 0; height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}
.hero h1 { font-size: 34px; line-height: 1.25; margin: 10px 0 14px; max-width: 20em; }
.hero .lead { max-width: 34em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; font-size: 13px; color: var(--ink-3); }
.hero-meta b { color: var(--ink); font-family: var(--serif); font-size: 15px; }

/* ---------- 分类 ---------- */
.section { padding: 34px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 21px; }
.section-head .more { font-size: 13px; color: var(--ink-3); }
.section-head .more:hover { color: var(--accent); }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.cat-card {
  display: block; padding: 18px 16px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fffdf9; position: relative; overflow: hidden;
  transition: border-color .15s ease, transform .15s ease;
}
.cat-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.cat-card .en { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.cat-card h3 { margin: 4px 0 6px; font-size: 18px; }
.cat-card p { font-size: 13px; color: var(--ink-3); margin: 0; line-height: 1.6; }
.cat-card .n { position: absolute; right: 14px; top: 12px; font-family: var(--serif); font-size: 13px; color: var(--line-2); }

/* ---------- 测试卡 ---------- */
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 12px; }
.test-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fffdf9; transition: border-color .15s ease, transform .15s ease;
}
.test-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.test-card .top { display: flex; align-items: center; gap: 8px; }
.test-card h3 { font-size: 17px; }
.test-card .meta { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.test-card .desc { font-size: 13px; color: var(--ink-2); margin: 0; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11px;
  letter-spacing: .04em; border: 1px solid var(--line-2); color: var(--ink-3); background: var(--paper-2);
}
.badge-hot { border-color: rgba(178, 58, 41, .3); color: var(--accent); background: rgba(178, 58, 41, .07); }
.badge-play { border-color: rgba(160, 118, 42, .3); color: var(--gold); background: rgba(160, 118, 42, .08); }

/* ---------- 面包屑 ---------- */
.crumb { font-size: 12.5px; color: var(--ink-3); padding: 16px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumb a:hover { color: var(--accent); }
.crumb span[aria-current] { color: var(--ink-2); }

/* ---------- 测试详情页 ---------- */
.test-hero { padding: 18px 0 8px; }
.test-hero h1 { font-size: 32px; margin: 8px 0 10px; }
.test-hero .sub { font-size: 14px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 6px 16px; }
.test-hero .sub b { color: var(--ink); font-family: var(--serif); }
.start-box { margin: 22px 0 10px; }
.start-box .hint { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.prose h2 { font-size: 20px; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 17px; margin: 22px 0 8px; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.25em; }
.prose li { margin-bottom: .4em; }
.prose blockquote {
  margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--accent);
  background: var(--paper-2); border-radius: 0 var(--radius-s) var(--radius-s) 0; color: var(--ink-2); font-size: 14px;
}
.note {
  border: 1px solid var(--line); background: var(--paper-2); border-radius: var(--radius-s);
  padding: 12px 14px; font-size: 13px; color: var(--ink-2); line-height: 1.7;
}
.note-warn { border-color: rgba(178, 58, 41, .3); background: rgba(178, 58, 41, .05); }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 18px 0; }
.facts > div { background: #fffdf9; padding: 12px 14px; }
.facts dt { font-size: 12px; color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font-family: var(--serif); font-size: 16px; }

/* ---------- 类型卡（内链） ---------- */
.type-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.type-links a {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--ink-2); background: #fffdf9;
  font-family: var(--serif); letter-spacing: .02em;
}
.type-links a:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 答题页 ---------- */
.quiz { min-height: 100vh; display: flex; flex-direction: column; }
.quiz-bar { position: sticky; top: 0; z-index: 30; background: rgba(251, 248, 243, .95); border-bottom: 1px solid var(--line); }
.quiz-bar-in { display: flex; align-items: center; gap: 14px; height: 52px; }
.quiz-back { font-size: 13px; color: var(--ink-3); background: none; border: 0; padding: 6px 0; cursor: pointer; }
.quiz-progress { flex: 1; height: 3px; background: var(--paper-3); border-radius: 2px; overflow: hidden; }
.quiz-progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.quiz-count { font-family: var(--serif); font-size: 13px; color: var(--ink-3); min-width: 46px; text-align: right; }
.quiz-body { flex: 1; padding: 26px 0 40px; }
.q-index { font-family: var(--serif); font-size: 13px; color: var(--accent); letter-spacing: .1em; }
.q-text { font-family: var(--serif); font-size: 23px; line-height: 1.5; margin: 10px 0 24px; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 15px 16px; background: #fffdf9; border: 1px solid var(--line);
  border-radius: var(--radius-s); font-size: 15.5px; line-height: 1.55; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 52px;
}
.opt:hover { border-color: var(--line-2); background: #fff; }
.opt.sel { border-color: var(--accent); background: rgba(178, 58, 41, .06); color: var(--accent-d); font-weight: 600; }
.opt .k {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-2);
  display: grid; place-items: center; font-size: 11.5px; color: var(--ink-3);
  font-family: var(--serif); margin-top: 1px;
}
.opt.sel .k { background: var(--accent); border-color: var(--accent); color: #fff; }
.quiz-tip { font-size: 12.5px; color: var(--ink-3); margin-top: 18px; text-align: center; }
.quiz-nav { display: flex; gap: 10px; margin-top: 22px; }
.quiz-nav .btn { flex: 1; }

/* ---------- 结果页 ---------- */
.result-hero { padding: 30px 0 10px; text-align: left; }
.result-code {
  font-family: var(--serif); font-size: 60px; line-height: 1; letter-spacing: .04em;
  color: var(--accent); margin: 6px 0 4px; word-break: break-all;
}
.result-code.sm { font-size: 40px; }
.result-name { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; }
.result-tagline { font-size: 15px; color: var(--ink-2); }

.bars { margin: 22px 0; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 68px 1fr 42px; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .lbl { color: var(--ink-2); }
.bar-track { height: 6px; background: var(--paper-3); border-radius: 3px; overflow: hidden; }
.bar-track > i { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; transition: width .6s cubic-bezier(.2,.7,.3,1); }
.bar-row.top .bar-track > i { background: var(--accent); }
.bar-row .val { font-family: var(--serif); color: var(--ink-3); text-align: right; }

.result-sec { margin: 26px 0; }
.result-sec h2 { font-size: 18px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.result-sec h2::before { content: ""; width: 4px; height: 16px; background: var(--accent); border-radius: 2px; }
.result-sec p { font-size: 15.5px; color: var(--ink-2); }

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.pill-list li {
  font-size: 13.5px; padding: 5px 12px; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-2);
}
.pill-accent li { background: rgba(178, 58, 41, .06); border-color: rgba(178, 58, 41, .22); color: var(--accent-d); }

.match-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.match-box { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; background: #fffdf9; }
.match-box h4 { font-size: 13px; color: var(--ink-3); margin: 0 0 6px; font-family: var(--sans); }
.match-box p { margin: 0; font-size: 14px; font-family: var(--serif); }

.share-row { display: flex; gap: 10px; margin: 24px 0; flex-wrap: wrap; }
.share-row .btn { flex: 1; min-width: 130px; }

/* 类型页 FAQ */
.faq { border-top: 1px solid var(--line); margin-top: 26px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { font-family: var(--serif); font-size: 16px; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; float: right; color: var(--ink-3); }
.faq details[open] summary::after { content: "－"; }
.faq p { margin: 10px 0 0; font-size: 14.5px; color: var(--ink-2); }

/* ---------- 文章 ---------- */
.article-hero { padding: 22px 0 6px; }
.article-hero h1 { font-size: 27px; line-height: 1.4; }
.article-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; display: flex; gap: 14px; flex-wrap: wrap; }
.article-body { padding: 18px 0 10px; }
.article-body h2 { font-size: 20px; margin: 28px 0 10px; }
.article-body h3 { font-size: 17px; margin: 20px 0 8px; }
.article-body p { font-size: 16px; color: var(--ink-1, #241f1b); }
.article-body ul, .article-body ol { padding-left: 1.2em; margin: 0 0 1em; }
.article-body li { margin-bottom: .35em; }
.article-body table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 14px 0; }
.article-body th, .article-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.article-body th { background: var(--paper-2); font-weight: 600; }
.answer-box {
  border: 1px solid var(--line-2); background: #fffdf9; border-radius: var(--radius-s);
  padding: 16px 18px; margin: 18px 0; font-size: 15.5px;
}
.answer-box b { color: var(--accent); }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; margin: 16px 0; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: top; }
.tbl th { font-size: 12.5px; color: var(--ink-3); font-weight: 600; background: var(--paper-2); }
.tbl td.n { font-family: var(--serif); font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 30px 0 40px; font-size: 13px; color: var(--ink-3); }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.footer h4 { font-size: 13px; color: var(--ink-2); margin: 0 0 8px; font-family: var(--sans); }
.footer a { display: inline-block; margin: 0 12px 6px 0; }
.footer a:hover { color: var(--accent); }
.footer-bottom { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.8; }

/* ---------- 即时玩法（抽签/塔罗/星盘/姓名） ---------- */
.instant { padding: 26px 0 40px; }
.instant-stage {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fffdf9;
  padding: 26px 20px; text-align: center; position: relative; overflow: hidden;
}
.instant-stage .big-glyph {
  font-family: var(--serif); font-size: 72px; line-height: 1; color: var(--accent); margin: 10px 0;
}
.shake { animation: shake .5s ease; }
@keyframes shake {
  0%,100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-6px) rotate(-3deg); }
  50% { transform: translateY(2px) rotate(3deg); }
  75% { transform: translateY(-3px) rotate(-1deg); }
}
.field { margin: 14px 0; text-align: left; }
.field label { font-size: 13px; color: var(--ink-3); display: block; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; min-height: 48px; padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius-s); background: #fff; color: var(--ink);
  font-family: var(--sans);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- 分享卡（隐藏 canvas 容器） ---------- */
#share-canvas { position: absolute; left: -9999px; top: 0; }

/* ---------- 工具类 ---------- */
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; } .mb8 { margin-bottom: 8px; } .mb16 { margin-bottom: 16px; } .mb24 { margin-bottom: 24px; }
.tc { text-align: center; } .tr { text-align: right; }
.hr { height: 1px; background: var(--line); border: 0; margin: 26px 0; }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 响应式 ---------- */
@media (min-width: 640px) {
  h1 { font-size: 34px; }
  .hero h1 { font-size: 40px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .result-code { font-size: 72px; }
}

@media (min-width: 960px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 56px 0 40px; }
  .hero h1 { font-size: 46px; }
  .test-hero h1 { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}