/* ============================================================
   「我重生了」样式系统
   基调：宣纸米白 + 朱墨 + 金边；按朝代切换主题变量
   ============================================================ */

:root {
  --paper: #f7f1e3;
  --paper-2: #fffdf7;
  --paper-3: #efe6d2;
  --ink: #2b2118;
  --ink-2: #5a4a3a;
  --ink-3: #8b7a66;
  --line: #d9cbb0;
  --line-2: #c4b291;

  --accent: #8c1d3c;
  --accent-soft: #f3e3e8;
  --accent-ink: #ffffff;
  --gold: #b8944f;
  --gold-soft: #f4e8cc;

  --cloth-1: #6a4a30;
  --cloth-2: #2a2015;
  --sky: #d9e4ec;

  --ok: #3d7a52;
  --warn: #b8863a;
  --bad: #a03a34;

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 22px;
  --shadow: 0 2px 0 rgba(90, 74, 58, .12), 0 8px 24px rgba(90, 74, 58, .13);
  --shadow-s: 0 1px 0 rgba(90, 74, 58, .16), 0 3px 10px rgba(90, 74, 58, .10);

  --f-body: "Noto Serif SC", "Songti SC", "SimSun", "Source Han Serif SC", serif;
  --f-display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --f-ui: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  --f-mono: "SF Mono", "Cascadia Mono", Consolas, monospace;
}

/* ---------- 朝代主题 ---------- */
[data-theme="zhou-bronze"]   { --accent:#6b4a2a; --accent-soft:#efe3d0; --cloth-1:#6a4a30; --cloth-2:#2a2015; --gold:#8a6a33; --sky:#d9d3c2; }
[data-theme="qin-black"]     { --accent:#8a1f1f; --accent-soft:#f0dcdc; --cloth-1:#2b2b2b; --cloth-2:#141414; --gold:#9a8a5a; --sky:#cfc7bb; }
[data-theme="han-red"]       { --accent:#a3272b; --accent-soft:#f5dfda; --cloth-1:#8c2f26; --cloth-2:#3a1a14; --gold:#a9823f; --sky:#dcd3c2; }
[data-theme="tang-vermilion"]{ --accent:#c1442e; --accent-soft:#f8e0d5; --cloth-1:#b04a2c; --cloth-2:#4a2015; --gold:#c69a4a; --sky:#e3d3ae; }
[data-theme="song-celadon"]  { --accent:#4a7a6d; --accent-soft:#dfeae4; --cloth-1:#7d9a8e; --cloth-2:#31423d; --gold:#8f9a6b; --sky:#dce8e4; }
[data-theme="yuan-steppe"]   { --accent:#7a5c2e; --accent-soft:#efe4cd; --cloth-1:#8a6a3a; --cloth-2:#3a2c18; --gold:#b09150; --sky:#e0d8c2; }
[data-theme="ming-crimson"]  { --accent:#9a2233; --accent-soft:#f2dce0; --cloth-1:#7a1f2a; --cloth-2:#2e1219; --gold:#b0924f; --sky:#dcd2c0; }
[data-theme="qing-ochre"]    { --accent:#8a6a1f; --accent-soft:#f2e7c8; --cloth-1:#a8843a; --cloth-2:#3d2f14; --gold:#c0a052; --sky:#e5dcc4; }
[data-theme="republic-indigo"]{ --accent:#2f4a7a; --accent-soft:#dde4f0; --cloth-1:#3a4a6a; --cloth-2:#1a2033; --gold:#8a8a6a; --sky:#d6dae4; }
[data-theme="modern-red"]    { --accent:#b8202a; --accent-soft:#f7dede; --cloth-1:#a83a3a; --cloth-2:#2a2024; --gold:#b09550; --sky:#d8e0e6; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 18% 12%, rgba(184, 148, 79, .07), transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(140, 29, 60, .05), transparent 46%);
  background-attachment: fixed;
  min-height: 100vh;
}

#app { max-width: 1080px; margin: 0 auto; padding: 0 16px 96px; }

/* ---------- 顶部 ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; margin: 0 -16px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top h1 {
  font-family: var(--f-display); font-size: 21px; margin: 0;
  letter-spacing: 3px; font-weight: 700;
  color: var(--cloth-2);
}
.top h1 .sub { font-size: 12px; letter-spacing: 1px; color: var(--ink-3); font-family: var(--f-ui); margin-left: 8px; }
.top .sp { flex: 1; }

.btn {
  font-family: var(--f-ui); font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink);
  transition: transform .12s, box-shadow .12s, background .12s;
  box-shadow: var(--shadow-s);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-s);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card.tight { padding: 14px 16px; }

.card-title {
  font-family: var(--f-display); font-size: 17px; font-weight: 700;
  margin: 0 0 12px; color: var(--cloth-2);
  display: flex; align-items: center; gap: 8px;
}
.card-title::before {
  content: ''; width: 4px; height: 17px; border-radius: 2px;
  background: var(--accent); display: inline-block;
}
.card-title .tagline { font-size: 12px; font-weight: 400; color: var(--ink-3); font-family: var(--f-ui); margin-left: auto; }

/* ---------- 朝代选择 ---------- */
.dyn-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 12px;
}
.dyn {
  position: relative; cursor: pointer; text-align: left;
  padding: 14px 14px 12px; border-radius: var(--r-m);
  border: 1.5px solid var(--line); background: var(--paper-2);
  transition: transform .14s, box-shadow .14s, border-color .14s;
  font-family: var(--f-ui);
  box-shadow: var(--shadow-s);
  overflow: hidden;
}
.dyn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(150deg, var(--accent-soft), transparent 55%);
  opacity: 0; transition: opacity .16s; pointer-events: none;
}
.dyn:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.dyn:hover::after { opacity: .55; }
.dyn.on { border-color: var(--accent); border-width: 2px; }
.dyn.on::after { opacity: 1; }
.dyn .dn { font-family: var(--f-display); font-size: 18px; font-weight: 700; color: var(--cloth-2); }
.dyn .dy { font-size: 12px; color: var(--ink-3); margin-top: 3px; font-family: var(--f-mono); }
.dyn .dc { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; position: relative; z-index: 1; }
.dyn .era {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}

/* ---------- 年份选择 ---------- */
.year-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.year-row input[type=number], .year-row select {
  font-family: var(--f-mono); font-size: 15px; padding: 8px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--paper-2); color: var(--ink); width: 120px;
}
.hint { font-size: 13px; color: var(--ink-3); }

/* ---------- 人生主界面 ---------- */
.life-head {
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
  margin-bottom: 16px;
}
.avatar {
  width: 88px; height: 88px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--accent); overflow: hidden;
  background: var(--paper-3); box-shadow: var(--shadow-s);
}
.avatar svg { width: 100%; height: 100%; display: block; }
.life-id { flex: 1; min-width: 240px; }
.life-id .nm { font-family: var(--f-display); font-size: 26px; font-weight: 700; color: var(--cloth-2); }
.life-id .meta { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.life-id .era-line {
  margin-top: 8px; font-size: 13px; color: var(--ink-2);
  background: var(--gold-soft); border-left: 3px solid var(--gold);
  padding: 6px 12px; border-radius: 0 var(--r-s) var(--r-s) 0;
}
.life-id .era-line b { color: var(--cloth-2); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.stat {
  background: var(--paper-2); border: 1px solid var(--line);
  border-radius: var(--r-s); padding: 10px 12px;
}
.stat .k { font-size: 11px; color: var(--ink-3); letter-spacing: 1px; }
.stat .v { font-family: var(--f-mono); font-size: 20px; font-weight: 700; color: var(--cloth-2); margin-top: 2px; }
.bar { height: 4px; border-radius: 2px; background: var(--paper-3); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); transition: width .5s; }
.bar.hl i { background: var(--ok); }
.bar.h  i { background: #4a7ba8; }
.bar.sm i { background: var(--gold); }
.bar.so i { background: var(--accent); }
/* 强度条（兵事/饥馑） */
.lvl {
  display: inline-block; width: 74px; height: 7px; border-radius: 4px;
  background: var(--paper-3); overflow: hidden; vertical-align: 1px;
  border: 1px solid var(--line);
}
.lvl i { display: block; height: 100%; border-radius: 4px; transition: width .5s; }
.lvl.ok i { background: var(--ok); }
.lvl.warn i { background: var(--warn); }
.lvl.bad i { background: var(--bad); }
.lvltx { margin-left: 7px; font-size: 12px; color: var(--ink-3); }

/* ---------- 事件流 ---------- */
.feed { max-height: 460px; overflow-y: auto; padding-right: 6px; }
.feed::-webkit-scrollbar { width: 7px; }
.feed::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.entry {
  display: flex; gap: 10px; padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14.5px; line-height: 1.65;
}
.entry:last-child { border-bottom: none; }
.entry .age {
  flex: none; width: 42px; text-align: right;
  font-family: var(--f-mono); font-size: 12px; color: var(--ink-3);
  padding-top: 3px;
}
.entry .tx { flex: 1; }
.entry.k-big .tx { font-weight: 700; color: var(--accent); }
.entry.k-loss .tx { color: var(--bad); }
.entry.k-warm .tx { color: var(--ok); }
.entry.k-hist .tx { color: var(--cloth-2); }
/* 举世大事：一生只撞上十几条，值得单独占一档视觉 */
.entry.is-hist {
  background: linear-gradient(90deg, var(--gold-soft), transparent 78%);
  border-left: 3px solid var(--gold);
  margin-left: -11px;
  padding: 5px 0 5px 8px;
}
.entry.is-hist .tx { color: var(--cloth-2); font-weight: 600; }
.entry.is-hist .age { color: var(--gold); font-weight: 700; }
.hist-mark {
  display: inline-block; font-size: 11px; font-weight: 700; line-height: 1;
  color: #fdf8ec; background: var(--gold);
  padding: 3px 5px; border-radius: 4px; margin-right: 7px;
  vertical-align: 1.5px; letter-spacing: 0;
}
.entry.k-ms { color: var(--ink-2); font-style: italic; }
.entry.k-dec .tx { color: var(--cloth-2); font-weight: 600; }
/* 「人生第一次」醒目标记 */
.entry.is-first { background: linear-gradient(90deg, var(--gold-soft), transparent 70%); padding-left: 8px; border-radius: 0 var(--r-s) var(--r-s) 0; }
.entry.is-first .tx { color: var(--cloth-2); font-weight: 600; }
.first-mark {
  display: inline-block; font-size: 11px; font-weight: 700; line-height: 1;
  color: var(--paper-2); background: var(--accent);
  padding: 3px 5px; border-radius: 4px; margin-right: 7px;
  vertical-align: 1.5px; letter-spacing: 0;
}
.entry .fact {
  display: block; font-size: 12px; color: var(--ink-3);
  margin-top: 3px; padding-left: 9px; border-left: 2px solid var(--line);
}

/* ---------- 抉择弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(30, 22, 14, .58);
  backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  background: var(--paper-2); border-radius: var(--r-l);
  border: 1px solid var(--line-2);
  max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 70px rgba(20, 14, 8, .42);
  padding: 26px 28px;
  animation: pop .26s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { transform: translateY(18px) scale(.97); opacity: 0 } to { transform: none; opacity: 1 } }
.sheet h2 {
  font-family: var(--f-display); font-size: 21px; margin: 0 0 12px;
  color: var(--cloth-2);
}
.sheet .body { font-size: 15px; color: var(--ink-2); line-height: 1.8; }
.sheet .fact {
  font-size: 12.5px; color: var(--ink-3); margin: 12px 0 18px;
  padding: 8px 12px; background: var(--paper-3); border-radius: var(--r-s);
  border-left: 3px solid var(--gold);
}
/* 抉择时的时局说明 */
.sheet .hist {
  font-size: 13px; color: var(--ink-2); margin: 12px 0 14px;
  padding: 9px 12px; background: var(--accent-soft); border-radius: var(--r-s);
  border-left: 3px solid var(--accent); line-height: 1.7;
}
.sheet .hist-tag {
  display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent);
  letter-spacing: 1px; margin-right: 8px; vertical-align: 1px;
}
.choice {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--r-m);
  background: var(--paper); padding: 13px 16px; margin-bottom: 10px;
  font-family: var(--f-ui); transition: all .14s;
}
.choice:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateX(3px); }
.choice .lb { font-weight: 700; font-size: 15px; color: var(--cloth-2); }
.choice .sb { font-size: 13px; color: var(--ink-3); margin-top: 2px; }

/* ---------- 重心选择 ---------- */
.focus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }

/* ---------- 底部操作条 ---------- */
.bar-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  display: flex; gap: 12px; align-items: center; justify-content: center;
}
.bar-actions .inner { display: flex; gap: 10px; align-items: center; width: 100%; max-width: 1048px; }

/* ---------- 重心选择（横向滚动） ---------- */
.focus-strip {
  display: flex; gap: 8px; overflow-x: auto; flex: 1; min-width: 0;
  padding-bottom: 4px; scrollbar-width: thin;
}
.focus-strip::-webkit-scrollbar { height: 6px; }
.focus-strip::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.focus {
  cursor: pointer; padding: 7px 13px; border-radius: 999px; flex: none;
  border: 1.5px solid var(--line); background: var(--paper-2);
  font-family: var(--f-ui); transition: all .13s; text-align: left;
  white-space: nowrap;
}
.focus:hover { border-color: var(--accent); }
.focus.on { border-color: var(--accent); background: var(--accent-soft); }
.focus .fn { font-weight: 700; font-size: 13.5px; color: var(--cloth-2); }
.focus .fd { font-size: 11px; color: var(--ink-3); }
.bar-actions .bar-label {
  font-size: 12px; color: var(--ink-3); flex: none; writing-mode: vertical-rl;
  letter-spacing: 2px; text-align: center;
}

/* ---------- 结算 ---------- */
/* ---------- 人生档案卡（结算页） ---------- */
/* 参考「人生纪录」版式：顶部色带 + 头像 + 大名字 + 两列信息 + 人生地图 + 超大百分比 */
.lifecard {
  --seal: #2f6f5e;
  --seal-1: #e9f1ea;
  --seal-2: #c3dac9;
  --seal-3: #94bfa0;
  --seal-4: #5f9d76;
  --seal-5: #2f6f4f;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-l);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lc-band {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 24px;
  background: var(--accent); color: var(--accent-ink);
}
.lc-band .t { font-family: var(--f-display); font-size: 18px; font-weight: 700; letter-spacing: .14em; }
.lc-band .n { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .1em; opacity: .82; }
.lc-body {
  position: relative; padding: 22px 24px 24px;
  background-image: repeating-radial-gradient(circle at 88% 12%,
    rgba(47, 111, 94, .05) 0 1px, transparent 1px 44px);
}
.lc-kicker { font-size: 11.5px; font-weight: 600; letter-spacing: .34em; color: var(--seal); margin-bottom: 16px; }
.lc-hero { display: grid; grid-template-columns: 94px 1fr; gap: 20px; align-items: start; }
.lc-avatar {
  width: 94px; height: 94px; border-radius: 6px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--paper-3); flex: none;
}
.lc-avatar svg { width: 100%; height: 100%; display: block; }
.lc-meta { font-size: 12.5px; letter-spacing: .06em; color: var(--seal); margin-bottom: 4px; }
.lc-name {
  font-family: var(--f-display); font-size: 38px; font-weight: 700;
  line-height: 1.12; letter-spacing: .04em; color: var(--ink); margin: 0 0 8px;
  word-break: break-all;
}
.lc-dates { font-family: var(--f-mono); font-size: 13.5px; color: var(--ink-2); letter-spacing: .02em; }
.lc-place { font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.lc-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 17px 30px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
}
.lc-cell .k { font-size: 11.5px; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 3px; }
.lc-cell .v { font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.4; }
.lc-cell .v.bad { color: var(--bad); }
.lc-maprow {
  display: grid; grid-template-columns: 1fr 250px; gap: 26px; align-items: end;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
}
.lc-legend { font-size: 11.5px; color: var(--ink-3); margin-bottom: 9px; letter-spacing: .02em; }
.lc-map { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3.5px; max-width: 300px; }
.lc-map i { display: block; aspect-ratio: 1 / 1; border-radius: 1.5px; background: var(--seal-1); }
.lc-map i.l2 { background: var(--seal-2); }
.lc-map i.l3 { background: var(--seal-3); }
.lc-map i.l4 { background: var(--seal-4); }
.lc-map i.l5 { background: var(--seal-5); }
.lc-map i.mark { box-shadow: 0 0 0 1.5px var(--ink); }
.lc-map i.end { background: var(--cloth-2); }
.lc-mapwrap { align-self: start; }
.lc-big { text-align: right; align-self: center; }
.lc-big .num {
  font-family: var(--f-display); font-size: 62px; font-weight: 700;
  line-height: .95; letter-spacing: -.02em; color: var(--seal);
}
.lc-big .cap { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin-top: 8px; }
.lc-big .sub { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; margin-top: 6px; font-family: var(--f-mono); text-wrap: pretty; }
.lc-ledger {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3); letter-spacing: .02em;
}
.lc-foot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line);
}
.lc-foot .q { font-family: var(--f-display); font-size: 14.5px; color: var(--ink); letter-spacing: .02em; }
.lc-foot .brand { font-family: var(--f-display); font-size: 14px; font-weight: 700; color: var(--accent); letter-spacing: .1em; }
@media (max-width: 640px) {
  .lc-hero { grid-template-columns: 74px 1fr; gap: 14px; }
  .lc-avatar { width: 74px; height: 74px; }
  .lc-name { font-size: 29px; }
  .lc-grid { gap: 14px 18px; }
  .lc-maprow { grid-template-columns: 1fr; gap: 18px; }
  .lc-big { text-align: left; }
  .lc-big .num { font-size: 48px; }
  .lc-band .t { font-size: 15px; letter-spacing: .1em; }
  .lc-band .n { font-size: 10.5px; }
}

.epitaph {
  text-align: center; padding: 30px 20px;
  background: linear-gradient(180deg, var(--paper-2), var(--paper-3));
  border-radius: var(--r-l); border: 1px solid var(--line-2);
}
.epitaph .big {
  font-family: var(--f-display); font-size: 40px; font-weight: 700;
  color: var(--cloth-2); letter-spacing: 4px; margin: 8px 0;
}
.epitaph .sub { font-size: 14px; color: var(--ink-2); }
.epitaph .cause {
  display: inline-block; margin-top: 12px; padding: 6px 18px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 14px;
}

/* ---------- 面板/信息 ---------- */
.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); font-size: 13px; }
.kv dd { margin: 0; color: var(--ink); }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--paper-3); color: var(--ink-2); border: 1px solid var(--line);
}
.chip.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip.gold { background: var(--gold-soft); border-color: var(--gold); color: var(--cloth-2); }

.detail-item {
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.detail-item:last-child { border-bottom: none; }
.detail-item .dt { font-weight: 700; font-size: 14px; color: var(--cloth-2); }
.detail-item .db { font-size: 13.5px; color: var(--ink-2); line-height: 1.75; margin-top: 3px; }

.strata-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px;
}
.strata-row:last-child { border-bottom: none; }
.strata-row .tier {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line);
}
.strata-row .tier.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- 后台 ---------- */
.admin-grid { display: grid; grid-template-columns: 190px 1fr; gap: 14px; }
@media (max-width: 780px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button {
  text-align: left; padding: 9px 13px; border-radius: var(--r-s);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-family: var(--f-ui); font-size: 14px; color: var(--ink-2);
}
.admin-nav button.on { background: var(--paper-2); border-color: var(--line); color: var(--cloth-2); font-weight: 700; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; }
table.tbl th { font-size: 11.5px; color: var(--ink-3); letter-spacing: .5px; font-weight: 600; }
table.tbl tr:hover td { background: var(--paper-3); }
.table-wrap { max-height: 460px; overflow: auto; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.field input, .field textarea, .field select {
  width: 100%; font-family: var(--f-ui); font-size: 14px; padding: 8px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r-s);
  background: var(--paper-2); color: var(--ink);
}
.field textarea { min-height: 80px; resize: vertical; line-height: 1.6; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: var(--cloth-2); color: var(--paper-2);
  padding: 10px 20px; border-radius: 999px; font-size: 14px; z-index: 200;
  box-shadow: var(--shadow); animation: pop .24s;
}

/* ---------- 加载 ---------- */
.loading { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.spinner {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 14px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

.muted { color: var(--ink-3); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ============================================================
   出生卡 —— 仿「出生证明」证件风
   ============================================================ */
.birth-wrap { max-width: 720px; margin: 0 auto; padding: 10px 0 40px; }

.cert {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
/* 防伪底纹 */
.cert::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(184,148,79,.05) 6px 7px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(184,148,79,.05) 6px 7px);
}
.cert-band {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 18px;
  font-family: var(--f-ui); font-size: 13px; letter-spacing: .06em;
}
.cert-band .cb-r { font-family: var(--f-mono); font-size: 11.5px; opacity: .92; }

.cert-body { padding: 22px 24px 18px; position: relative; }
.cert-label {
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .22em;
  color: var(--ink-3); text-transform: uppercase; margin-bottom: 2px;
}
.cert-name {
  font-family: var(--f-display); font-size: 40px; font-weight: 700;
  color: var(--cloth-2); letter-spacing: .06em; line-height: 1.15; margin-bottom: 12px;
}
.cert-story {
  font-family: var(--f-display); font-size: 15.5px; line-height: 1.95;
  color: var(--ink-2); padding: 12px 14px; margin-bottom: 18px;
  background: var(--paper-3); border-left: 3px solid var(--gold); border-radius: 0 var(--r-s) var(--r-s) 0;
}

.cert-sec {
  font-family: var(--f-ui); font-size: 11.5px; letter-spacing: .18em;
  color: var(--accent); font-weight: 700;
  margin: 20px 0 9px; padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.cert-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 10px 16px; }
.cf .cf-k { font-size: 10.5px; letter-spacing: .1em; color: var(--ink-3); font-family: var(--f-ui); }
.cf .cf-v {
  font-family: var(--f-display); font-size: 15px; color: var(--cloth-2);
  line-height: 1.5; margin-top: 1px;
}
.cf .cf-sub { display: block; font-size: 11.5px; color: var(--ink-3); font-family: var(--f-ui); margin-top: 1px; }

.cert-sibs { display: flex; flex-wrap: wrap; gap: 8px; }
.sib {
  min-width: 96px; padding: 7px 11px; border-radius: var(--r-s);
  background: var(--paper-3); border: 1px solid var(--line);
}
.sib.me { background: var(--accent-soft); border-color: var(--accent); }
.sib.dead { opacity: .52; }
.sib.dead .sib-n { text-decoration: line-through; }
.sib .sib-n { font-family: var(--f-display); font-size: 14.5px; color: var(--cloth-2); }
.sib .sib-d { font-size: 11px; color: var(--ink-3); font-family: var(--f-ui); margin-top: 1px; }
.cert-note { font-size: 12px; color: var(--ink-3); margin-top: 8px; font-family: var(--f-ui); }

.cert-origin {
  padding: 13px 15px; background: var(--paper-3); border-radius: var(--r-s);
  border: 1px solid var(--line-2);
}
.co-h { font-family: var(--f-display); font-size: 17px; font-weight: 700; color: var(--cloth-2); margin-bottom: 6px; }
.co-b { font-family: var(--f-display); font-size: 13.5px; line-height: 1.85; color: var(--ink-2); }
.co-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); font-family: var(--f-ui); }
.co-hm { font-size: 12px; color: var(--ink-3); margin-top: 6px; font-family: var(--f-ui); font-style: italic; }
.co-tr, .co-cl { font-size: 13px; line-height: 1.8; color: var(--ink-2); margin-top: 9px; font-family: var(--f-display); }
.co-sn { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; font-family: var(--f-ui); }
.co-tag {
  display: inline-block; font-size: 10px; letter-spacing: .1em; padding: 1px 6px;
  border-radius: 3px; background: var(--accent); color: var(--accent-ink);
  margin-right: 7px; vertical-align: 1px; font-family: var(--f-ui);
}
.cert-exam {
  margin-top: 10px; padding: 10px 13px; font-size: 13px; line-height: 1.8;
  background: var(--gold-soft); border-left: 3px solid var(--gold); border-radius: 0 var(--r-s) var(--r-s) 0;
  font-family: var(--f-display); color: var(--ink-2);
}
.cert-hist {
  margin-top: 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.8;
  font-family: var(--f-display);
}
.cert-foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 14px 24px; border-top: 1px solid var(--line); background: var(--paper-3);
}
.birth-tip {
  text-align: center; margin-top: 18px; font-size: 13px; line-height: 1.9;
  font-family: var(--f-display); color: var(--ink-2);
}

/* ============================================================
   顶部计时条 —— 仿参考站 topbar（年龄 + 年份 + 4px 进度条 + 倍速）
   ============================================================ */
.timebar {
  position: sticky; top: 0; z-index: 45;
  background: color-mix(in srgb, var(--paper) 93%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 9px 0 0; margin: -18px 0 14px;
}
.tb-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tb-age { display: flex; align-items: baseline; gap: 8px; }
.tb-age .ta-n {
  font-family: var(--f-display); font-size: 26px; font-weight: 700;
  color: var(--cloth-2); line-height: 1;
}
.tb-age .ta-n small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.tb-age .ta-y { font-family: var(--f-mono); font-size: 13px; color: var(--ink-3); }
.tb-prog { flex: 1; min-width: 120px; }
.tb-prog .track { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.tb-prog .fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }
.tb-prog .pct { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; font-family: var(--f-mono); }
.tb-speed { display: flex; align-items: center; gap: 4px; }
.tb-speed .sp {
  font-family: var(--f-ui); font-size: 11.5px; padding: 4px 8px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); cursor: pointer;
}
.tb-speed .sp.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tb-speed .sp:hover:not(.on) { border-color: var(--accent); }

@media (max-width: 620px) {
  .cert-name { font-size: 31px; }
  .cert-body { padding: 18px 16px 14px; }
  .cert-foot { flex-wrap: wrap; }
  .tb-age .ta-n { font-size: 21px; }
}

/* 底部重心栏：标签 + 横排可滚动的选项 + 右侧固定按钮 */
.bar-btns { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.bar-actions .inner { display: flex; gap: 10px; align-items: center; }
.bar-label { flex: 0 0 auto; }
.focus-strip .focus .fn { font-size: 13px; }
.focus-strip .focus .fd { font-size: 10.5px; opacity: .8; }

/* ============================================================
   亲属面板 —— 谁活着、谁死了、什么营生、多少钱、亲不亲
   ============================================================ */
.kin-sec {
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .16em;
  color: var(--accent); font-weight: 700;
  margin: 14px 0 7px;
}
.kin-sec:first-of-type { margin-top: 6px; }
.kin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px; }
.kin {
  padding: 8px 10px; border-radius: var(--r-s);
  background: var(--paper-3); border: 1px solid var(--line);
}
.kin-dead { opacity: .6; }
.kin-dead .kin-h b, .kin-dead .kin-h { text-decoration: line-through; }
.kin .kin-h { font-family: var(--f-display); font-size: 14px; color: var(--cloth-2); line-height: 1.4; }
.kin .kin-h b {
  display: inline-block; font-size: 10.5px; font-family: var(--f-ui); font-weight: 700;
  padding: 1px 5px; border-radius: 3px; background: var(--accent-soft);
  color: var(--accent); margin-right: 5px; text-decoration: none;
}
.kin .kin-d { font-size: 11.5px; color: var(--ink-2); font-family: var(--f-ui); margin-top: 2px; }
.kin .kin-f { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.kin .kin-rel {
  font-size: 10.5px; font-family: var(--f-ui); color: var(--gold);
  background: var(--gold-soft); padding: 1px 5px; border-radius: 3px;
}
.kin .kin-rel.ghost { color: var(--ink-3); background: transparent; padding: 0; }
.kin .kin-help { font-size: 10.5px; color: var(--ink-3); font-family: var(--f-ui); }
.kin-inc {
  font-family: var(--f-ui); font-size: 12.5px; line-height: 1.8;
  padding: 8px 11px; margin: 8px 0 4px;
  background: var(--gold-soft); border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-s) var(--r-s) 0; color: var(--ink-2);
}
.kin-inc b { color: var(--cloth-2); }

/* hidden 属性必须压过 .focus-strip 的 display:flex，
   否则「心思」收起后重心条仍然显示（东家要求默认不显示） */
.bar-actions .focus-strip[hidden] { display: none !important; }

/* ---------- 投胎页（点过朝代之后的独立一屏） ---------- */
.pick-head { text-align: center; padding: 6px 4px 2px; }
.pick-name {
  font-family: var(--f-display); font-size: 30px; margin: 4px 0 2px;
  color: var(--cloth-2); letter-spacing: 1px;
}
.pick-years { font-size: 13px; color: var(--ink-3); letter-spacing: 1px; }
.pick-cover { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.pick-cap { margin-top: 4px; font-size: 12px; color: var(--ink-3); }
.pick-head .era {
  display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: var(--accent); color: #fff; letter-spacing: 1px;
}
.pick-acts {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px;
}
.pick-acts .btn { flex: 1 1 0; min-width: 96px; }
@media (max-width: 480px) {
  .pick-name { font-size: 24px; }
  .pick-acts .btn { flex: 1 1 100%; }
}

/* ---------- 成就卡（一世留名） ---------- */
.ach-wrap { display: flex; flex-direction: column; gap: 12px; }
.ach-card {
  position: relative; padding: 14px 16px 14px 18px;
  background: #fffdf7; border: 1px solid #e6ddc9; border-radius: 10px;
  box-shadow: 0 1px 0 #efe8d6 inset;
}
.ach-card::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px;
  border-radius: 2px; background: var(--cloth-2, #8C1D3C);
}
.ach-card.k-medicine::before { background: #0F6E68; }
.ach-card.k-book::before { background: #8a6a2f; }
.ach-head { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #8a7f6d; }
.ach-kind {
  padding: 1px 7px; border-radius: 999px; background: #f3ece0;
  color: var(--cloth-2, #8C1D3C); letter-spacing: .5px;
}
.ach-card.k-medicine .ach-kind { color: #0F6E68; }
.ach-card.k-book .ach-kind { color: #8a6a2f; }
.ach-field { color: #a09582; }
.ach-age { margin-left: auto; }
.ach-title {
  font-family: var(--f-display); font-size: 17px; margin: 7px 0 6px;
  color: #2c2620; line-height: 1.4;
}
.ach-desc { font-size: 13px; line-height: 1.75; color: #4a4238; }
.ach-reward { margin-top: 8px; font-size: 12px; color: #7a6a52; font-style: italic; }
.ach-epi {
  margin-top: 10px; padding: 9px 11px; border-radius: 6px;
  background: #f7f1e4; border-left: 2px solid #c9b98f;
  font-size: 12.5px; line-height: 1.7; color: #5f5342;
}
.epi-mark {
  display: inline-block; margin-right: 6px; padding: 0 4px; border-radius: 3px;
  background: #8C1D3C; color: #fff; font-size: 10px; vertical-align: 1px;
}
.achiline {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed #d8cdb6;
  font-size: 12.5px; line-height: 1.8; color: #6b5f4c;
}

/* ---------- 朝代卡上的「分期」标签 ----------
   原来跟着每张卡的主题色走，二十六张卡二十几种颜色，很乱。
   改成按分期固定五色：同一时期的朝代永远同一种颜色。 */
.dyn .era { background: #8a7f6d; color: #fff; }
.dyn[data-era="先秦"] .era { background: #6b4a2a; }  /* 青铜褐 */
.dyn[data-era="中古"] .era { background: #8C1D3C; }  /* 绛红 */
.dyn[data-era="近世"] .era { background: #2f5d6a; }  /* 靛青 */
.dyn[data-era="近代"] .era { background: #4a4a55; }  /* 玄灰 */
.dyn[data-era="现代"] .era { background: #b8202a; }  /* 朱红 */

/* 弹层右上角的关闭按钮 —— 玩家总得有个出口 */
.sheet { position: relative; }
.sheet-x {
  position: absolute; top: 10px; right: 12px;
  width: 30px; height: 30px; line-height: 1;
  border: none; border-radius: 50%;
  background: transparent; color: var(--ink-3);
  font-size: 22px; cursor: pointer; font-family: var(--f-ui);
  transition: background .12s, color .12s;
}
.sheet-x:hover { background: var(--paper-3); color: var(--ink); }

/* ---------- 读碑：一个人的一生 ---------- */
.life-sheet { max-width: 680px; max-height: 86vh; overflow-y: auto; }
.life-head { text-align: center; padding: 2px 0 14px; border-bottom: 1px solid var(--line); }
.life-name {
  font-family: var(--f-display); font-size: 26px; color: var(--cloth-2);
  letter-spacing: 2px; margin-bottom: 6px;
}
.life-meta { font-size: 12.5px; color: var(--ink-2); line-height: 1.9; }
.life-sec {
  font-family: var(--f-ui); font-size: 11px; letter-spacing: .16em;
  color: var(--accent); font-weight: 700; margin: 18px 0 8px;
}
.life-fam { font-size: 13px; line-height: 1.9; color: var(--ink-2); }
.life-feed { max-height: 340px; overflow-y: auto; padding-right: 4px; }
