/* 千年人生 · 样式
 * 宣纸与墨色的历史档案风格；纯 CSS，无外部字体与图片。
 */
:root {
  --fs-base: 17px;
  --bg: #e9dfcb;
  --paper: #f7f0df;
  --paper-2: #fbf6ea;
  --paper-3: #f1e7d2;
  --ink: #2b2219;
  --muted: #7a6a55;
  --line: #d6c6a8;
  --line-strong: #b7a17c;
  --accent: #9a3a2b;
  --accent-soft: #b85a45;
  --gold: #9c7a42;
  --good: #3f6b4a;
  --warn: #a2671d;
  --bad: #8b2e2a;
  --shadow: 0 8px 30px rgba(58, 42, 24, .10);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "STSong", serif;
}
[data-theme="dark"] {
  --bg: #14110e;
  --paper: #1e1a15;
  --paper-2: #241f18;
  --paper-3: #2a241c;
  --ink: #e7ddca;
  --muted: #a3937b;
  --line: #3a3228;
  --line-strong: #5a4c3a;
  --accent: #c46750;
  --accent-soft: #d4826b;
  --gold: #c9a76d;
  --good: #7da98a;
  --warn: #d0a05a;
  --bad: #d07a72;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: var(--fs-base); }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .35;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.35), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(120,90,50,.10), transparent 50%),
    repeating-linear-gradient(0deg, rgba(90,70,40,.022) 0 1px, transparent 1px 4px);
  z-index: 0;
}
[data-theme="dark"] body::before { opacity: .18; }
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: .03em; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
small { font-size: .78em; }
::selection { background: rgba(154, 58, 43, .22); }
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: .9rem;
  letter-spacing: .3em;
}

/* ---------- 通用 ---------- */
.muted { color: var(--muted); }
.small { font-size: .85em; }
.tiny { font-size: .76em; }
.bad-text { color: var(--bad); }
.good-text { color: var(--good); }
.eyebrow {
  font-size: .7rem;
  letter-spacing: .28em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: .45em;
}
.notice {
  color: var(--muted);
  font-size: .82rem;
  border-left: 2px solid var(--line-strong);
  padding-left: 12px;
  margin-top: 14px;
  line-height: 1.7;
}
.section-sub {
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  letter-spacing: .18em;
  color: var(--muted);
}

/* ---------- 按钮与标签 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: .5em 1.1em;
  border-radius: 2px;
  font-size: .9rem;
  letter-spacing: .06em;
  transition: transform .12s ease, background .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--paper-3); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: .32em .8em; font-size: .8rem; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
[data-theme="dark"] .btn { color: #1a1611; background: var(--ink); border-color: var(--ink); }
[data-theme="dark"] .btn.ghost { background: transparent; color: var(--ink); }
[data-theme="dark"] .btn.danger { color: #1a1611; }

.link {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 0;
  font-size: .82rem;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--line);
}
.link:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line);
  border-radius: 50%; color: var(--muted); font-size: 1rem;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: .25em;
  padding: .12em .55em;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .06em;
  white-space: nowrap;
}
.chip-ok { color: var(--good); border-color: rgba(63,107,74,.45); }
.chip-warn { color: var(--warn); border-color: rgba(162,103,29,.45); }
.chip-bad { color: var(--bad); border-color: rgba(139,46,42,.45); }
.chip-muted { color: var(--muted); opacity: .7; }
.chip-illegal { color: var(--accent); border-color: var(--accent); }
.chip-gold { color: var(--gold); border-color: rgba(156,122,66,.45); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }

/* ---------- 标题页 ---------- */
.title-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 22px;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255,255,255,.5), transparent 55%),
    linear-gradient(160deg, var(--paper) 0%, var(--bg) 60%, var(--paper-3) 100%);
  overflow: hidden;
  z-index: 1;
}
[data-theme="dark"] .title-screen {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(120,90,60,.18), transparent 55%),
    linear-gradient(160deg, #1b1712 0%, var(--bg) 60%, #100e0b 100%);
}
.title-inner { max-width: 660px; text-align: center; position: relative; z-index: 2; }
.seal-big {
  width: 68px; height: 68px; margin: 0 auto 22px;
  display: grid; place-items: center;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 34px;
  letter-spacing: 0;
  transform: rotate(-3deg);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--accent);
}
.title-inner h1 {
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  letter-spacing: .18em;
  margin-left: .18em;
  font-weight: 500;
  line-height: 1.15;
}
.title-sub {
  font-size: 1.05rem;
  letter-spacing: .16em;
  color: var(--muted);
  margin-bottom: 22px;
}
.title-lead {
  font-size: .84rem;
  line-height: 2;
  color: var(--muted);
  letter-spacing: .08em;
  margin-bottom: 28px;
}
.title-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn.big { padding: .82em 2.1em; font-size: 1rem; letter-spacing: .22em; }
.title-saves {
  margin: 34px auto 0;
  max-width: 520px;
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.save-line {
  width: 100%;
  display: flex; flex-direction: column;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 2px; text-align: left;
}
.save-line:hover { background: var(--paper-3); }
.save-line span { font-size: .88rem; }
.save-line small { color: var(--muted); font-size: .72rem; }
.title-foot {
  margin-top: 38px;
  font-size: .72rem;
  color: var(--muted);
  line-height: 2;
  letter-spacing: .05em;
}
.title-ornament {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6vw; opacity: .35;
}
.title-ornament span {
  width: 1px; height: 42vh;
  background: linear-gradient(transparent, var(--line-strong), transparent);
}
.title-ornament i {
  width: 34vw; height: 34vw; max-width: 440px; max-height: 440px;
  border: 1px solid var(--line);
  border-radius: 50%;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
}

/* ---------- 外壳 ---------- */
.shell {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr) 286px;
  min-height: 100vh;
  position: relative; z-index: 1;
}
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  display: flex; flex-direction: column;
  padding: 22px 14px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; padding: 0 6px 20px;
  border-bottom: 1px solid var(--line);
}
.seal {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1.5px solid var(--accent); color: var(--accent);
  font-size: 1rem; flex: 0 0 auto;
}
.brand b { display: block; font-size: .98rem; letter-spacing: .12em; }
.brand small { display: block; font-size: .52rem; letter-spacing: .16em; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; border-left: 2px solid transparent;
  padding: 9px 10px; text-align: left; color: var(--muted);
  font-size: .85rem; letter-spacing: .08em;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.on { border-left-color: var(--accent); color: var(--accent); background: rgba(154,58,43,.06); }
.nav-glyph {
  width: 22px; height: 22px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  font-size: .68rem; flex: 0 0 auto;
}
.nav-item.on .nav-glyph { border-color: var(--accent); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 10px; }

.main { min-width: 0; height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: 0 0 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(247,240,223,.82);
  backdrop-filter: blur(6px);
  z-index: 5;
}
[data-theme="dark"] .topbar { background: rgba(30,26,21,.85); }
.topbar-place { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.topbar-place .year { font-size: .9rem; letter-spacing: .08em; white-space: nowrap; }
.topbar-place .place { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.time-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  padding: 7px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  flex: 0 0 auto;
  font-size: .75rem;
}
.time-date { color: var(--accent); white-space: nowrap; letter-spacing: .05em; }
.time-ap { color: var(--muted); white-space: nowrap; }
.time-cash { color: var(--muted); white-space: nowrap; }
.time-spacer { flex: 1; min-width: 8px; }
.time-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-left: auto; }
.time-bar .btn { padding: .28em .65em; font-size: .72rem; white-space: nowrap; }
.auto-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .auto-btn.on { color: #1a1611; }
.speed-group { display: inline-flex; align-items: center; gap: 2px; border-left: 1px solid var(--line); padding-left: 5px; }
.speed-chip {
  background: transparent; border: 1px solid var(--line);
  padding: .18em .38em; font-size: .64rem; color: var(--muted);
  border-radius: 2px; line-height: 1.4;
}
.speed-chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-theme="dark"] .speed-chip.on { color: #1a1611; }
.ap-mini {
  font-size: .7rem; color: var(--muted);
  border: 1px solid var(--line); padding: .15em .6em; border-radius: 2px;
  white-space: nowrap;
}
.main-content {
  flex: 1; overflow-y: auto;
  padding: 24px 26px 60px;
  scroll-behavior: smooth;
}
.mobile-nav { display: none; }

/* ---------- 侧栏 ---------- */
.aside {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  border-left: 1px solid var(--line);
  padding: 22px 18px;
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
}
.side-block { margin-bottom: 22px; }
.side-title {
  font-size: .68rem; letter-spacing: .22em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 10px;
}
.side-line { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; padding: 4px 0; }
.side-line span { color: var(--muted); }
.side-line b { font-weight: 500; text-align: right; }
.meter { display: grid; grid-template-columns: 36px 1fr 28px; align-items: center; gap: 8px; margin-bottom: 7px; font-size: .74rem; }
.meter span { color: var(--muted); }
.meter em { font-style: normal; color: var(--muted); text-align: right; }
.advance-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.advance-row .btn { padding: .42em .2em; font-size: .78rem; }

/* ---------- 面板与档案 ---------- */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 20px 22px;
  margin-bottom: 18px;
  position: relative;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 1.18rem; letter-spacing: .08em; }
.dossier { padding: 26px 26px 20px; }
.dossier-top { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.person-name { font-size: 2rem; letter-spacing: .1em; margin: 0 0 4px; font-weight: 500; }
.courtesy { font-size: .78rem; color: var(--muted); margin-left: 10px; letter-spacing: .08em; }
.person-sub { color: var(--muted); font-size: .82rem; letter-spacing: .05em; margin: 0; }
.age-seal {
  width: 78px; height: 78px; flex: 0 0 auto;
  border: 1px solid var(--line-strong); border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--accent); line-height: 1.1;
}
.age-seal b { font-size: 1.7rem; font-weight: 500; }
.age-seal span { font-size: .6rem; letter-spacing: .2em; }
.age-seal small { font-size: .58rem; color: var(--muted); letter-spacing: .1em; }
.situation { font-size: .92rem; line-height: 1.9; margin: 14px 0 16px; color: var(--ink); }
.ap-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 12px; }
.ap-label { font-size: .72rem; color: var(--muted); letter-spacing: .14em; }
.ap-note { font-size: .72rem; color: var(--muted); }
.pip {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--line-strong); display: inline-block; margin-right: 4px;
}
.pip.on { background: var(--accent); border-color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.quick-list { display: flex; flex-direction: column; gap: 8px; }
.quick-action {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 9px 11px; text-align: left; width: 100%;
}
.quick-action:hover { border-color: var(--line-strong); background: var(--paper-3); }
.qa-glyph {
  width: 26px; height: 26px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; font-size: .7rem; color: var(--accent);
}
.qa-body { flex: 1; min-width: 0; }
.qa-body b { display: block; font-size: .86rem; font-weight: 500; }
.qa-body small { display: block; color: var(--muted); font-size: .68rem; }
.mini-chronicle { display: flex; flex-direction: column; gap: 8px; }
.mini-entry { display: flex; gap: 8px; font-size: .78rem; line-height: 1.6; border-bottom: 1px dashed var(--line); padding-bottom: 7px; }
.mini-year { color: var(--accent); flex: 0 0 auto; font-size: .68rem; padding-top: 2px; }
.family-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.family-strip > div { border-right: 1px solid var(--line); padding-right: 10px; }
.family-strip > div:last-child { border-right: 0; }
.family-strip b { display: block; font-size: 1rem; font-weight: 500; }
.family-strip small { display: block; color: var(--muted); font-size: .68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 进度条 ---------- */
.bar {
  height: 5px; background: var(--line);
  position: relative; overflow: hidden; border-radius: 4px;
}
.bar span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.bar.health span { background: var(--good); }
.bar.mood span { background: var(--gold); }
.bar.rep span { background: #6f7f9a; }
.bar.aff span { background: var(--accent-soft); }
.bar.skill span { background: var(--gold); }
.bar.stability span { background: #6f7f9a; }
.bar.economy span { background: var(--good); }
[data-theme="dark"] .bar.rep span, [data-theme="dark"] .bar.stability span { background: #8797b2; }

/* ---------- 行动 ---------- */
.cat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cat-chip {
  background: transparent; border: 1px solid var(--line);
  padding: .28em .7em; font-size: .74rem; color: var(--muted);
  border-radius: 2px; letter-spacing: .05em;
}
.cat-chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-theme="dark"] .cat-chip.on { color: #1a1611; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.action-card {
  background: var(--paper); border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  padding: 15px 16px 13px; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.action-card.s-allowed { border-left-color: var(--good); }
.action-card.s-conditional { border-left-color: var(--warn); }
.action-card.s-forbidden { border-left-color: var(--bad); opacity: .76; }
.action-card.s-illegal { border-left-color: var(--accent); }
.action-card.s-blocked { border-left-color: var(--line-strong); opacity: .68; }
.action-head { display: flex; gap: 10px; align-items: flex-start; }
.action-glyph {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--accent); font-size: .8rem;
}
.action-title { flex: 1; min-width: 0; }
.action-title h4 { margin: 0 0 2px; font-size: .98rem; letter-spacing: .05em; }
.action-title p { margin: 0; font-size: .68rem; color: var(--muted); }
.action-desc { font-size: .8rem; color: var(--muted); line-height: 1.7; margin: 10px 0 8px; }
.cond-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.cond { font-size: .66rem; border: 1px solid var(--line); padding: .08em .4em; color: var(--muted); }
.cond.met { color: var(--good); border-color: rgba(63,107,74,.35); }
.cond.unmet { color: var(--bad); border-color: rgba(139,46,42,.35); }
.reason { font-size: .7rem; color: var(--bad); margin: 4px 0; line-height: 1.6; }
.action-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mini-meta { display: flex; gap: 8px; align-items: center; font-size: .64rem; color: var(--muted); }
.illegal-mark { color: var(--accent); border: 1px solid var(--accent); padding: 0 .3em; }
.conf { border: 1px solid var(--line); padding: 0 .3em; }

/* ---------- 人物 ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.person-card {
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 11px 12px; text-align: left; width: 100%;
}
.person-card:hover { border-color: var(--line-strong); background: var(--paper-3); }
.person-card.dead { opacity: .55; }
.person-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.person-head b { font-weight: 500; font-size: .9rem; }
.affinity { display: grid; grid-template-columns: 30px 1fr 24px; gap: 6px; align-items: center; margin-top: 8px; font-size: .66rem; color: var(--muted); }
.affinity em { font-style: normal; text-align: right; }

/* ---------- 家族 ---------- */
.family-stats { display: flex; gap: 14px; font-size: .74rem; color: var(--muted); }
.law-note { background: var(--paper-3); border: 1px solid var(--line); padding: 9px 12px; font-size: .78rem; }
.family-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.tree-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.tree-card {
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 8px 10px; min-width: 112px; text-align: left;
  display: flex; flex-direction: column; gap: 1px;
}
.tree-card:hover { border-color: var(--line-strong); }
.tree-card.dead { opacity: .5; }
.tree-card small { font-size: .6rem; color: var(--muted); letter-spacing: .08em; }
.tree-card b { font-weight: 500; font-size: .84rem; }
.tree-card span { font-size: .64rem; color: var(--muted); }
.tree-extra { display: block; font-style: normal; font-size: .58rem; color: var(--accent); line-height: 1.35; margin-top: 2px; }
.person-extra { font-size: .6rem; color: var(--accent); margin-top: 2px; }
.ancestor-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* 关系树：每个辈分一层，卡片向上连线 */
.genealogy {
  border: 1px solid var(--line); background: var(--paper-3);
  padding: 16px 10px 18px; margin: 10px 0 16px; overflow-x: auto;
}
.gen-level { position: relative; }
.gen-level + .gen-level { margin-top: 30px; }
.gen-level + .gen-level::before {
  content: ''; position: absolute; top: -30px; left: 50%;
  width: 1px; height: 30px; background: var(--line-strong);
}
.gen-level + .gen-level::after {
  content: ''; position: absolute; top: -15px; left: 8%; right: 8%;
  height: 1px; background: var(--line);
}
.gen-label {
  text-align: center; font-size: .6rem; letter-spacing: .16em;
  color: var(--muted); margin-bottom: 7px;
}
.gen-row {
  display: flex; justify-content: center; align-items: flex-start;
  gap: 10px; flex-wrap: nowrap; min-width: max-content;
}
.gen-row .tree-card { min-width: 96px; max-width: 154px; position: relative; }
.gen-level + .gen-level .tree-card::before {
  content: ''; position: absolute; top: -15px; left: 50%;
  width: 1px; height: 15px; background: var(--line);
}
.gen-row .tree-card small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-row .tree-card b { line-height: 1.25; }


/* ---------- 财富 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.stat-box { border: 1px solid var(--line); background: var(--paper-2); padding: 10px 12px; }
.stat-box small { display: block; color: var(--muted); font-size: .66rem; letter-spacing: .1em; }
.stat-box b { display: block; font-size: 1.02rem; font-weight: 500; margin-top: 3px; }
.ledger { width: 100%; border-collapse: collapse; font-size: .78rem; }
.table-wrap { overflow-x: auto; }
.ledger th, .ledger td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.ledger th { color: var(--muted); font-weight: 400; font-size: .68rem; letter-spacing: .1em; }
.skill-list { display: flex; flex-direction: column; gap: 8px; }
.skill-row { display: grid; grid-template-columns: 36px 1fr 28px; gap: 8px; align-items: center; font-size: .74rem; }
.skill-row span { color: var(--muted); }
.skill-row em { font-style: normal; text-align: right; color: var(--muted); }
.ledger-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 5px 14px; margin: 10px 0 4px; }
.ledger-cat { display: flex; justify-content: space-between; gap: 10px; font-size: .74rem; border-bottom: 1px dotted var(--line); padding: 4px 0; }
.ledger-cat span { color: var(--muted); }
.ledger-cat b { font-weight: 500; }
.ledger-entries { display: flex; flex-direction: column; gap: 3px; }
.ledger-entry { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; font-size: .74rem; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.ledger-date { color: var(--accent); font-size: .66rem; white-space: nowrap; }
.ledger-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ledger-entry b { font-weight: 500; white-space: nowrap; }

/* ---------- 国家 ---------- */
.world-bars { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0; }
.world-bars > div { display: grid; grid-template-columns: 30px 1fr 24px; gap: 8px; align-items: center; font-size: .72rem; color: var(--muted); }
.world-bars em { font-style: normal; text-align: right; }
.rights-table { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.rights-group h5 {
  font-size: .7rem; letter-spacing: .2em; color: var(--gold);
  margin: 0 0 5px; padding-bottom: 4px; border-bottom: 1px solid var(--line);
}
.right-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 4px 0; font-size: .76rem; border-bottom: 1px dotted var(--line); }
.right-row small { grid-column: 1 / -1; color: var(--muted); font-size: .64rem; }

/* ---------- 编年史 ---------- */
.chron-year { margin-bottom: 18px; }
.chron-year h4 { font-size: .8rem; color: var(--accent); letter-spacing: .12em; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 8px; }
.chron-entry { display: flex; gap: 8px; font-size: .8rem; line-height: 1.75; padding: 3px 0; }
.chron-entry.imp { color: var(--ink); }
.chron-tag {
  flex: 0 0 auto; font-size: .6rem; letter-spacing: .1em; color: var(--muted);
  border: 1px solid var(--line); padding: 0 .3em; height: 1.5em; margin-top: .2em;
}
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 90px 1fr; gap: 12px; border-left: 1px solid var(--line); padding-left: 14px; position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: -3px; top: .55em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent);
}
.timeline-item.world::before { background: var(--gold); }
.timeline-year { font-size: .7rem; color: var(--muted); letter-spacing: .05em; }
.timeline-item b { font-size: .84rem; font-weight: 500; }
.timeline-item p { margin: 2px 0 0; font-size: .76rem; color: var(--muted); line-height: 1.7; }
.muted-timeline { opacity: .78; }

/* ---------- 存档 ---------- */
.save-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.save-card { border: 1px solid var(--line); background: var(--paper-2); padding: 12px 14px; display: flex; flex-direction: column; min-height: 150px; }
.save-head { display: flex; justify-content: space-between; align-items: center; }
.save-head b { font-weight: 500; font-size: .88rem; }
.save-meta { font-size: .72rem; color: var(--muted); line-height: 1.7; margin: 8px 0; flex: 1; }
.save-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.save-io { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ---------- 总结 ---------- */
.summary-shell { min-height: 100vh; position: relative; z-index: 1; }
.summary-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 26px; border-bottom: 1px solid var(--line); }
.summary-wrap { max-width: 860px; margin: 0 auto; padding: 36px 22px 80px; }
.summary-scroll { background: var(--paper); border: 1px solid var(--line); padding: 38px 42px; box-shadow: var(--shadow); }
.summary-name { font-size: 2.4rem; letter-spacing: .12em; font-weight: 500; margin-bottom: 4px; }
.summary-dates { color: var(--accent); font-size: .9rem; letter-spacing: .08em; }
.summary-cause { color: var(--muted); font-size: .8rem; }
.summary-stats { margin: 22px 0; }
.highlights { padding-left: 1.2em; font-size: .86rem; line-height: 1.9; }
.highlights li { margin-bottom: 6px; }
.summary-family { font-size: .9rem; }
.summary-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ---------- 创建页 ---------- */
.create-screen { max-width: 820px; margin: 0 auto; padding: 30px 20px 70px; position: relative; z-index: 1; }
.back-link { margin-bottom: 14px; }
.create-card h2 { font-size: 1.7rem; font-weight: 500; letter-spacing: .1em; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin: 18px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: .78rem; color: var(--muted); }
.form-grid input, .form-grid select {
  background: var(--paper-2); border: 1px solid var(--line);
  padding: .55em .7em; font-size: .84rem; color: var(--ink);
  border-radius: 2px; width: 100%;
}
.form-grid input:focus, .form-grid select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(28, 22, 16, .55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  max-width: 580px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
  animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(10px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-close {
  position: absolute; right: 10px; top: 8px;
  background: transparent; border: 0; font-size: 1.3rem; color: var(--muted);
  line-height: 1;
}
.modal-close:hover { color: var(--accent); }
body.modal-open { overflow: hidden; }
.modal-body h2 { font-size: 1.55rem; font-weight: 500; letter-spacing: .08em; }
.birth-line { color: var(--muted); font-size: .82rem; }
.birth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.birth-grid > div { border: 1px solid var(--line); padding: 8px 10px; background: var(--paper-2); }
.birth-grid small { display: block; color: var(--muted); font-size: .64rem; letter-spacing: .1em; }
.birth-grid b { font-weight: 500; font-size: .88rem; }
.interact-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.interact-row .btn { min-width: 78px; }
.text-input {
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  padding: .32em .5em; font: inherit; font-size: .74rem; width: min(320px, 55vw);
}
.text-input:focus { outline: none; border-color: var(--accent); }
.select-input {
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  padding: .32em .5em; font: inherit; font-size: .74rem; min-width: 180px;
}
.select-input:focus { outline: none; border-color: var(--accent); }
.check-line { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); }
.birth-parents { font-size: .8rem; line-height: 1.9; color: var(--muted); }
.narrative { font-size: .84rem; line-height: 1.85; color: var(--muted); }
.modal-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }

.event-text { font-size: .92rem; line-height: 1.95; margin: 14px 0 20px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; flex-direction: column; gap: 2px;
  text-align: left; background: var(--paper-2);
  border: 1px solid var(--line); padding: 11px 14px;
}
.choice:hover { border-color: var(--accent); background: var(--paper-3); }
.choice .choice-label { font-size: .88rem; }
.choice small { color: var(--muted); font-size: .68rem; }
.choice.disabled { opacity: .45; }
.choice.disabled:hover { border-color: var(--line); background: var(--paper-2); }

.heir-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.heir-card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px;
  text-align: left; background: var(--paper-2); border: 1px solid var(--line);
  padding: 10px 12px;
}
.heir-card:hover { border-color: var(--accent); }
.heir-card b { font-weight: 500; }
.heir-card span { font-size: .72rem; color: var(--muted); text-align: right; }
.heir-card small { grid-column: 1 / -1; color: var(--gold); font-size: .7rem; }

.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .84rem; }
.seg { display: flex; align-items: center; gap: 4px; }
.seg-btn { background: transparent; border: 1px solid var(--line); padding: .22em .65em; font-size: .74rem; color: var(--muted); }
.seg-btn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
[data-theme="dark"] .seg-btn.on { color: #1a1611; }
.font-preview { font-size: .7rem; color: var(--muted); min-width: 34px; text-align: center; }
.about { margin-top: 18px; font-size: .72rem; color: var(--muted); line-height: 1.8; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper);
  padding: .65em 1.2em; font-size: .82rem; max-width: min(88vw, 620px);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
  line-height: 1.6;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--warn); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
[data-theme="dark"] .toast { color: #1a1611; }
[data-theme="dark"] .toast.warn, [data-theme="dark"] .toast.bad { color: #1a1611; }

/* ---------- 滚动条 ---------- */
.main-content::-webkit-scrollbar, .aside::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-thumb, .aside::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.main-content::-webkit-scrollbar-track, .aside::-webkit-scrollbar-track, .modal::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
  .aside { display: none; }
  .main-content { padding: 20px 20px 50px; }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .family-strip { grid-template-columns: 1fr 1fr; }
  .rights-table { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .main { height: auto; min-height: 100vh; }
  .topbar { position: sticky; top: 0; height: 52px; flex-basis: 52px; padding: 0 14px; }
  .time-bar { position: sticky; top: 52px; z-index: 4; padding: 6px 12px; }
  .time-bar .btn { padding: .25em .5em; font-size: .68rem; }
  .time-actions { width: 100%; margin-left: 0; }
  .time-cash { display: none; }
  .speed-chip { padding: .15em .3em; font-size: .6rem; }
  .topbar-place .place { max-width: 46vw; }
  .main-content { overflow: visible; padding: 14px 12px 92px; }
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--paper); border-top: 1px solid var(--line);
    overflow-x: auto; padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .mobile-nav .nav-item {
    flex: 0 0 auto; flex-direction: column; gap: 2px;
    padding: 4px 11px; border-left: 0; border-top: 2px solid transparent;
    font-size: .62rem; letter-spacing: .02em;
  }
  .mobile-nav .nav-item.on { border-top-color: var(--accent); background: transparent; }
  .mobile-nav .nav-glyph { width: 20px; height: 20px; font-size: .6rem; }
  .panel { padding: 15px 14px; }
  .dossier { padding: 18px 15px; }
  .person-name { font-size: 1.55rem; }
  .age-seal { width: 62px; height: 62px; }
  .age-seal b { font-size: 1.35rem; }
  .action-grid { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .family-strip { grid-template-columns: 1fr 1fr; }
  .family-strip > div:nth-child(2) { border-right: 0; }
  .save-grid { grid-template-columns: 1fr; }
  .ledger-entry { grid-template-columns: 1fr auto; }
  .ledger-date { grid-column: 1 / -1; }
  .summary-wrap { padding: 18px 10px 80px; }
  .summary-scroll { padding: 24px 18px; }
  .summary-name { font-size: 1.8rem; }
  .summary-top { padding: 12px 14px; }
  .modal { padding: 22px 18px; max-height: 92vh; }
  .genealogy { padding: 12px 6px 14px; }
  .gen-row { gap: 6px; }
  .gen-row .tree-card { min-width: 84px; max-width: 132px; padding: 7px 8px; }
  .toast { bottom: 84px; }
  .title-ornament { display: none; }
  .title-inner h1 { font-size: 2.7rem; }
  .title-actions .btn.big { padding: .7em 1.5em; }
}
@media (max-width: 420px) {
  .people-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .birth-grid { grid-template-columns: 1fr 1fr; }
  .rights-table { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
