/* 布局：浅紫底上一列 480px 的白色“档案页”；人物名与题目用衬线，界面用系统黑体。 */
:root {
  --ground: #ECE7F7;      /* 浅紫底 */
  --sheet: #FFFFFF;       /* 档案纸 */
  --tint: #F5F2FC;        /* 纸上的浅底块 */
  --ink: #221B33;         /* 墨色 */
  --ink-2: #625A78;       /* 次要文字 */
  --line: #DED7EF;        /* 细线 */
  --accent: #5737BE;      /* 紫墨 */
  --accent-soft: #E7E0FB;
  --on-accent: #FFFFFF;
  --seal: #B3362C;        /* 印泥红，只用于印章与警示 */
  --shadow: 0 1px 0 rgba(60, 40, 120, 0.06), 0 14px 34px -22px rgba(60, 40, 120, 0.45);
  --scrim: rgba(24, 16, 40, 0.48);

  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-num: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-sheet: 20px;
  --r-ctl: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #15111D; --sheet: #211B2D; --tint: #2A2338; --ink: #EEE9F8; --ink-2: #A9A1BE;
    --line: #382F4A; --accent: #A994FF; --accent-soft: #332957; --on-accent: #17112A;
    --seal: #E46A5E; --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 34px -22px rgba(0, 0, 0, 0.8);
    --scrim: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #15111D; --sheet: #211B2D; --tint: #2A2338; --ink: #EEE9F8; --ink-2: #A9A1BE;
  --line: #382F4A; --accent: #A994FF; --accent-soft: #332957; --on-accent: #17112A;
  --seal: #E46A5E; --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 34px -22px rgba(0, 0, 0, 0.8);
  --scrim: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: 12px 120px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- 通用 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font-size: 14px;
  color: var(--ink-2);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.topbar .brand svg { width: 22px; height: 22px; color: var(--accent); }
.linkbtn {
  background: none; border: 0; padding: 10px 4px; cursor: pointer;
  color: var(--ink-2); font-size: 14px;
}
.linkbtn:hover { color: var(--accent); }

.sheet {
  position: relative;
  background: var(--sheet);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
/* 档案袋标签页 */
.sheet.folder { border-top-left-radius: 0; margin-top: 26px; }
.folder-tab {
  position: absolute;
  left: 0; top: -26px;
  height: 27px;
  padding: 0 16px;
  display: flex; align-items: center;
  background: var(--sheet);
  border-radius: 12px 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.eyebrow { font-size: 13px; letter-spacing: 0.06em; color: var(--ink-2); margin: 0; }
.latin { font-size: 10.5px; letter-spacing: 0.12em; color: var(--ink-2); margin: 0; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; font-weight: 700; }
h1 { font-size: 30px; line-height: 1.3; }
h2 { font-size: 23px; line-height: 1.4; }
h3 { font-size: 18px; line-height: 1.4; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; line-height: 1.6; }
.stack { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 12px 18px;
  border-radius: var(--r-ctl);
  border: 1.5px solid transparent;
  font-weight: 600; font-size: 16px;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-danger { background: var(--seal); color: #fff; }

.icon-badge {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.icon-badge svg { width: 36px; height: 36px; }

/* ---------- 首页 ---------- */
.hero { display: flex; flex-direction: column; gap: 14px; }
.hero h1 { font-size: 32px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info {
  background: var(--tint);
  border-radius: 14px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.info b { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.info span { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.note-card {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
}
.footnote { text-align: center; font-size: 12px; color: var(--ink-2); letter-spacing: 0.04em; }
.resume {
  background: var(--accent-soft);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  color: var(--ink);
}

/* ---------- 范围选择 ---------- */
.choice {
  position: relative;
  text-align: left;
  width: 100%;
  background: var(--sheet);
  border: 1.5px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 16px 16px 16px 52px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.choice::before {
  content: "";
  position: absolute; left: 18px; top: 19px;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--sheet);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--tint); }
.choice[aria-checked="true"]::before { border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--sheet), inset 0 0 0 10px var(--accent); }
.choice b { font-size: 17px; }
.choice span { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.hint {
  font-size: 14px; color: var(--ink-2);
  background: var(--tint); border-radius: 12px; padding: 12px 14px;
}

/* ---------- 答题 ---------- */
.progress { display: flex; align-items: center; gap: 12px; }
.progress .count { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.progress .bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.25s ease; }
.q-tag { font-family: var(--font-num); font-size: 13px; color: var(--accent); letter-spacing: 0.08em; }
.q-title { font-size: 24px; }
.q-stem { font-size: 16px; line-height: 1.75; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { padding-block: 15px; font-size: 16px; line-height: 1.6; }
.opt::before { top: 50%; transform: translateY(-50%); }
.quiz-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--ground);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.quiz-nav .row { max-width: 448px; margin: 0 auto; }
.quiz-nav .row > .btn-ghost { flex: 0 0 36%; }

/* ---------- 过渡 ---------- */
.computing { min-height: 50vh; display: grid; place-items: center; text-align: center; }
.computing p { font-family: var(--font-display); font-size: 19px; line-height: 1.8; }

/* ---------- 结果 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.chip.weak { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.notice {
  font-size: 14px; line-height: 1.6;
  border-left: 3px solid var(--seal);
  padding: 2px 0 2px 12px;
  color: var(--ink);
}
.tie { font-size: 15px; line-height: 1.75; }

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--sheet); border-radius: 14px; box-shadow: var(--shadow);
  overflow-x: auto;
}
.tab {
  flex: 1; min-width: max-content; min-height: 44px; padding: 8px 14px;
  border: 0; border-radius: 10px; background: transparent; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink-2);
}
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }

.persona-head { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; padding-right: 48px; }
.monogram {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--font-display); font-weight: 700; font-size: 28px;
}
.persona-name { font-size: 34px; line-height: 1.2; }
.persona-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--accent); letter-spacing: 0.06em; }
.positioning { font-size: 15px; color: var(--ink-2); }
.verdict {
  background: var(--tint); border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.verdict small { font-size: 12px; letter-spacing: 0.12em; color: var(--ink-2); }
.verdict p { font-family: var(--font-display); font-size: 20px; line-height: 1.6; font-weight: 600; }
.seal {
  position: absolute; right: 18px; top: 22px;
  writing-mode: vertical-rl;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 0.1em;
  color: var(--seal); border: 2px solid var(--seal); border-radius: 5px;
  padding: 6px 3px; transform: rotate(-7deg); opacity: 0.85;
  user-select: none;
}

.section { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.section p { font-size: 16px; }
.why { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.why li { display: flex; flex-direction: column; gap: 8px; }
.why .text { font-size: 16px; line-height: 1.7; }
.ev {
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
  background: var(--tint); border-radius: 10px; padding: 8px 12px;
}
.ev q { quotes: "「" "」"; color: var(--ink); }
.bullets { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.bullets li::marker { color: var(--accent); }
details { border-radius: 12px; }
details summary { cursor: pointer; font-size: 14px; color: var(--accent); padding: 6px 0; min-height: 32px; }
details .sources { display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.6; color: var(--ink-2); margin-top: 6px; }
details .sources a { word-break: break-all; }

.side-item { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.side-item:first-of-type { border-top: 0; padding-top: 0; }
.side-item .who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.side-item .who b { font-family: var(--font-display); font-size: 19px; }
.side-item .who span { color: var(--accent); font-weight: 600; font-size: 14px; }
.side-item .rank { font-size: 12px; color: var(--ink-2); letter-spacing: 0.06em; }

.actions { display: flex; flex-direction: column; gap: 10px; }
.result-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--ground); border-top: 1px solid var(--line); z-index: 10;
}
.result-bar .btn { display: flex; width: 100%; max-width: 448px; margin: 0 auto; }

/* 本次决策侧重 */
.lean { display: flex; flex-direction: column; gap: 10px; }
.lean-row { display: grid; grid-template-columns: 5.2em 1fr; gap: 10px; align-items: center; }
.lean-row .lbl { font-size: 14px; white-space: nowrap; }
.lean-track { position: relative; height: 12px; border-radius: 6px; background: var(--tint); }
.lean-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1.5px; background: var(--line); }
.lean-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.lean-bar.pos { left: 50%; background: var(--accent); }
.lean-bar.neg { right: 50%; background: var(--ink-2); opacity: 0.35; }
.lean-axis { display: grid; grid-template-columns: 5.2em 1fr 1fr; gap: 10px; font-size: 12px; color: var(--ink-2); }
.lean-axis span:last-child { text-align: right; }
.dimdefs { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.dimdefs b { color: var(--ink); font-weight: 600; }

.answers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.answers li { display: grid; grid-template-columns: 2.4em 1fr auto; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.answers li:first-child { border-top: 0; }
.answers .n { font-family: var(--font-num); font-size: 13px; color: var(--accent); padding-top: 2px; }
.answers .t { font-weight: 600; font-size: 15px; }
.answers .a { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.answers .linkbtn { color: var(--accent); padding: 0 4px; min-height: 32px; }

.compare { display: flex; flex-direction: column; gap: 12px; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.g-card {
  text-align: left; background: var(--sheet); border: 0; border-radius: 16px; box-shadow: var(--shadow);
  padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.g-card .monogram { width: 40px; height: 40px; font-size: 20px; }
.g-card b { font-family: var(--font-display); font-size: 18px; }
.g-card span { font-size: 13px; color: var(--accent); font-weight: 600; }
.g-card p { font-size: 13px; color: var(--ink-2); line-height: 1.55; }

/* ---------- 底部弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: var(--scrim);
  display: flex; align-items: flex-end; justify-content: center;
}
.dialog {
  width: 100%; max-width: 480px; max-height: 90%;
  overflow-y: auto;
  background: var(--sheet);
  border-radius: 22px 22px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 16px;
  animation: rise 0.22s ease-out;
}
.share-img { width: 100%; max-width: 100%; border-radius: 14px; box-shadow: var(--shadow); display: block; }
.copy-field { width: 100%; font: inherit; font-size: 14px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--tint); color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--sheet); font-size: 14px;
  padding: 10px 16px; border-radius: 999px; z-index: 60; white-space: nowrap;
}

.screen { animation: fade 0.25s ease-out; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@keyframes fade { from { opacity: 0.4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 520px) {
  .app { padding-block: 28px 120px; }
}
