/* 仕途模拟器 · 政务风 UI
   配色：藏蓝（体制）+ 米白（纸张）+ 金（嘉奖）+ 朱红（警示）
   移动优先，宽屏居中。 */

:root {
  --navy-900: #0f1a2e;
  --navy-800: #16233c;
  --navy-700: #1e2f4d;
  --navy-600: #2b4066;
  --ink: #1c2431;
  --ink-soft: #4a5568;
  --paper: #f6f2e9;
  --paper-2: #fffdf8;
  --line: #d9d2c4;
  --gold: #c8a45c;
  --gold-soft: #e3cd97;
  --jade: #3f8f6f;
  --blue: #4a6fa5;
  --rose: #b4585f;
  --danger: #a8323a;
  --shadow: 0 10px 30px rgba(15, 26, 46, 0.16);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy-900);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

body {
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(200, 164, 92, 0.12), transparent 60%),
    linear-gradient(180deg, #0f1a2e 0%, #16233c 40%, #101a2c 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

#app { max-width: 780px; margin: 0 auto; padding: 0 14px 40px; }

.screen { display: none; }
.screen.active { display: block; animation: fade 0.22s ease; }
.hidden { display: none !important; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fade 0.24s ease; }

/* ------------------------------- 通用组件 ------------------------------- */

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 0 0 12px;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--navy-700);
  padding-left: 10px;
  border-left: 3px solid var(--gold);
}

.btn {
  font: inherit;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  background: transparent;
  color: inherit;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.995); }

.btn-primary {
  background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
  color: #f7f3e8;
  border-color: var(--navy-800);
  box-shadow: 0 4px 14px rgba(15, 26, 46, 0.3);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--navy-600), var(--navy-700)); }

.btn-outline { border-color: var(--navy-600); color: var(--navy-700); background: rgba(255, 255, 255, 0.6); }
.btn-outline:hover { background: #fff; }

.btn-ghost { color: var(--ink-soft); border-color: rgba(0, 0, 0, 0.08); background: rgba(255, 255, 255, 0.35); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.75); }

.btn-lg { padding: 15px 24px; font-size: 17px; letter-spacing: 0.06em; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; margin-top: 14px; }

/* ------------------------------- 开始页 ------------------------------- */

.start-wrap { padding-top: 34px; }

.start-head { text-align: center; color: var(--paper); margin-bottom: 22px; }

/* 起点分组选项卡 */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  font: inherit; cursor: pointer; font-size: 13px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-soft);
}
.tab.active { background: var(--navy-700); color: #f6f2e9; border-color: var(--navy-700); }

/* 出身卡 */
.bg-list { display: grid; gap: 8px; }
.bg {
  text-align: left; font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2);
  padding: 11px 13px; display: grid; gap: 3px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.bg:hover { border-color: var(--gold); }
.bg.selected { border-color: var(--gold); background: #fffaf0; box-shadow: 0 0 0 2px rgba(200, 164, 92, 0.25) inset; }
.bg strong { font-size: 15px; color: var(--navy-800); }
.bg-desc { font-size: 12.5px; color: var(--ink-soft); }

/* 难度 */
.diff-list { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.diff {
  font: inherit; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2);
  padding: 10px; display: grid; gap: 3px;
}
.diff.selected { border-color: var(--gold); background: #fffaf0; }
.diff strong { font-size: 14px; color: var(--navy-800); }
.diff span { font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; }

/* 传承 */
.legacy-list { margin: 0; padding-left: 18px; font-size: 13.5px; color: #3b4657; }
.legacy-list li { margin-bottom: 5px; }

.origin.locked { opacity: 0.62; }
.locked-note { color: #9d6a2f; }

.origin-special { font-size: 12px; color: #8a6a1f; margin-top: 2px; }

.seal {
  width: 62px; height: 62px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(160deg, #9d2f33, #7d2226);
  color: #f7e9c9;
  font-size: 34px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(157, 47, 51, 0.4);
  font-family: "Songti SC", "SimSun", serif;
}

.start-head h1 {
  margin: 0 0 10px;
  font-size: 30px; letter-spacing: 0.22em; font-weight: 600;
  font-family: "Songti SC", "SimSun", serif;
  color: #f3ecdc;
}
.tagline { margin: 0 0 12px; color: rgba(246, 242, 233, 0.78); font-size: 15px; }
.disclaimer { margin: 0; font-size: 12px; color: rgba(246, 242, 233, 0.42); line-height: 1.6; }

.origin-list { display: grid; gap: 10px; }

.origin {
  text-align: left;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  padding: 13px 14px;
  display: grid;
  gap: 4px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.origin:hover { border-color: var(--gold); }
.origin.selected { border-color: var(--gold); background: #fffaf0; box-shadow: 0 0 0 2px rgba(200, 164, 92, 0.25) inset; }
.origin strong { font-size: 16px; color: var(--navy-800); }
.origin-desc { font-size: 13px; color: var(--ink-soft); }
.origin-effects { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.origin-effects span { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #efe9dc; color: var(--ink-soft); }
.origin-effects .up { background: #e4f0e9; color: #2e7d5b; }
.origin-effects .down { background: #f6e4e4; color: #9d3a40; }

.seed-row { display: flex; align-items: center; gap: 8px; }
.seed-row label { font-size: 14px; color: var(--ink-soft); }
.seed-row input {
  flex: 1; min-width: 0;
  font: inherit; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink);
}
.seed-hint { margin: 8px 0 0; font-size: 12px; color: #8a8375; }

.start-actions { display: grid; gap: 10px; margin-top: 18px; }
.start-sub { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------- 游戏页 HUD ------------------------------- */

.hud {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--navy-700), var(--navy-800));
  color: var(--paper);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px 16px;
  margin: 0 -14px 12px;
  box-shadow: 0 6px 20px rgba(15, 26, 46, 0.35);
}
.hud-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hud-age { font-size: 26px; font-weight: 700; color: var(--gold-soft); line-height: 1; }
.hud-age em { font-size: 12px; font-style: normal; margin-left: 2px; color: rgba(246, 242, 233, 0.6); }
.hud-post { display: grid; min-width: 0; }
.hud-post strong { font-size: 15px; }
.hud-post span { font-size: 11.5px; color: rgba(246, 242, 233, 0.62); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-right { text-align: right; font-size: 12px; color: rgba(246, 242, 233, 0.8); }
.hud-phase { margin-top: 2px; color: var(--gold-soft); letter-spacing: 0.1em; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 10px; margin-bottom: 10px; }
.stat { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 9px; padding: 6px 8px; }
.stat-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: rgba(246, 242, 233, 0.75); }
.stat-value { font-weight: 700; font-size: 13px; color: #f3ecdc; }
.stat-bar { height: 5px; margin-top: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.stat-bar i { display: block; height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.lv-high { background: linear-gradient(90deg, #4f9e77, #6dbf95); }
.lv-mid { background: linear-gradient(90deg, #b79a56, #d3b979); }
.lv-low { background: linear-gradient(90deg, #c07a52, #db9a6d); }
.lv-critical { background: linear-gradient(90deg, #a8323a, #cf5a5f); }

.stat-evidence .stat-value { color: #e8c0c2; }

/* ------------------------------- 两本账 ------------------------------- */

.finance {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 10px;
}
.fin-item {
  flex: 1 1 calc(50% - 8px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px; padding: 6px 10px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.fin-label { font-size: 11.5px; color: rgba(246, 242, 233, 0.7); }
.fin-item strong { font-size: 13.5px; color: #f3ecdc; }
.fin-item.clean { border-left: 3px solid #4a6fa5; }
.fin-item.dirty { border-left: 3px solid #b4585f; background: rgba(180, 88, 95, 0.14); }
.fin-item.dirty strong { color: #f0c9cb; }
.fin-item.warn { border-left: 3px solid #c8a45c; }
.fin-note {
  flex: 1 1 100%; font-size: 12px; color: rgba(246, 242, 233, 0.72);
  background: rgba(255, 255, 255, 0.05); border-radius: 8px; padding: 6px 10px;
}
.fin-note.danger { color: #f0c9cb; background: rgba(180, 88, 95, 0.18); }

/* ------------------------------- 行动面板 ------------------------------- */

.panel-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ap-badge {
  font-size: 12px; padding: 2px 10px; border-radius: 999px;
  background: var(--navy-700); color: #f6f2e9; white-space: nowrap;
}

.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.action {
  font: inherit; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 10px; background: var(--paper-2);
  padding: 9px 11px; display: grid; gap: 2px;
  transition: background 0.15s, box-shadow 0.15s;
}
.action:hover { background: #fffdf6; box-shadow: 0 3px 10px rgba(15, 26, 46, 0.08); }
.action.disabled { opacity: 0.42; cursor: not-allowed; border-left-color: #bdb6a6; }
.action-name { font-size: 14px; color: var(--navy-800); }
.action-cost { font-size: 11.5px; color: #8a6a1f; }
.action-desc { font-size: 11.5px; color: #8a8375; line-height: 1.45; }
.action-lock { font-size: 11.5px; color: #97333a; line-height: 1.45; margin-top: 2px; }
.action.disabled .action-lock { opacity: 0.9; }

.action-sub {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; border-radius: 9px; background: #f2ece0;
}

.action-log { margin-top: 10px; }
.action-log p {
  margin: 0 0 6px; font-size: 13px; color: #4a5568;
  padding-left: 10px; border-left: 2px solid var(--gold-soft);
}

/* ------------------------------- 人情抽屉 ------------------------------- */

.npc-list { list-style: none; margin: 0; padding: 0; }
.npc-list li { padding: 10px 0; border-bottom: 1px solid #eae4d7; }
.npc-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.npc-row strong { color: var(--navy-800); font-size: 15px; }
.npc-role { font-size: 11.5px; color: #8a8375; }
.npc-favor { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.npc-hint { font-size: 12.5px; color: #8a8375; margin: 12px 0 0; }

/* ------------------------------- 家庭面板：婚恋 / 配偶 / 子女 ------------------------------- */

.fam-status {
  display: grid; gap: 4px; margin-bottom: 12px;
  padding: 9px 11px; border-radius: 9px; background: #f2ece0;
  font-size: 13.5px; color: #3b4657;
}
.fam-warn { color: #97333a; font-weight: 600; }
.fam-good { color: #2b7355; font-weight: 600; }
.fam-hint { font-size: 12px; color: #8a8375; }
.fam-empty { font-size: 13px; color: #8a8375; margin: 6px 0 12px; }
.fam-sub { margin: 16px 0 8px; font-size: 14px; color: var(--navy-700); }

.cand-list, .kid-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cand, .kid {
  border: 1px solid var(--line); border-left: 3px solid #4a6fa5;
  border-radius: 10px; background: var(--paper-2); padding: 10px 12px;
}
.kid { border-left-color: #4f9e77; }
.cand-head, .kid-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cand-head strong, .kid-head strong { font-size: 15px; color: var(--navy-800); }
.cand-job, .kid-head span { font-size: 11.5px; color: #8a8375; text-align: right; }
.cand-desc { font-size: 12.5px; color: var(--ink-soft); margin: 3px 0 6px; }
.cand-meta { font-size: 12px; color: #4a5568; margin-top: 3px; }
.cand-effect {
  font-size: 12px; color: #8a6a1f; margin-top: 5px;
  padding-left: 8px; border-left: 2px solid var(--gold-soft);
}

.spouse-card {
  border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 10px; background: #fffaf0; padding: 12px;
  margin-bottom: 10px;
}
.spouse-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.spouse-head strong { font-size: 16px; color: var(--navy-800); }
.spouse-head span { font-size: 12px; color: #8a8375; }

.family-outcome { list-style: none; margin: 0; padding: 0; }
.family-outcome li { padding: 10px 0; border-bottom: 1px solid #eae4d7; }
.family-outcome li:last-child { border-bottom: none; }
.family-outcome strong { color: var(--navy-800); font-size: 15px; margin-right: 8px; }
.family-outcome span { font-size: 12px; color: #8a8375; }
.family-outcome p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-soft); }

/* 起名弹窗 */
#modal-name .modal-card { max-width: 440px; }
.name-desc { font-size: 13px; color: var(--ink-soft); margin: 0 0 12px; }
#name-input {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.name-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ------------------------------- 继承父业 ------------------------------- */

.father-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.father-head strong { font-size: 17px; color: var(--navy-800); }
.father-head span { font-size: 12px; color: #8a8375; }
.father-rows { list-style: none; margin: 0 0 10px; padding: 0; }
.father-rows li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid #eae4d7; font-size: 13px;
}
.father-rows li:last-child { border-bottom: none; }
.father-rows span { color: var(--ink-soft); }
.father-rows strong { color: var(--navy-800); text-align: right; }
.father-note {
  margin: 8px 0 12px; font-size: 13px; color: #8a6a1f;
  padding-left: 10px; border-left: 3px solid var(--gold);
}

.inherit-actions { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
.inherit-btn {
  font: inherit; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 11px; background: var(--paper-2);
  padding: 11px 13px; display: grid; gap: 3px;
}
.inherit-btn.selected { border-color: var(--gold); background: #fffaf0; box-shadow: 0 0 0 2px rgba(200, 164, 92, 0.25) inset; }
.inherit-btn strong { font-size: 15px; color: var(--navy-800); }
.inherit-btn span { font-size: 12px; color: var(--ink-soft); }

/* 家谱 */
.lineage { list-style: none; margin: 0; padding: 0; }
.lineage li {
  display: grid; grid-template-columns: 68px 1fr auto; gap: 10px; align-items: baseline;
  padding: 9px 0 9px 12px; border-bottom: 1px solid #eae4d7;
  border-left: 3px solid var(--line);
}
.lineage li:last-child { border-bottom: none; }
.lineage .lin-prev { border-left-color: #8a8375; }
.lineage .lin-now { border-left-color: var(--gold); }
.lineage .lin-next { border-left-color: #4f9e77; }
.lin-who { font-size: 11.5px; color: #8a8375; }
.lineage strong { font-size: 14.5px; color: var(--navy-800); }
.lineage li > span:last-child { font-size: 12.5px; color: var(--ink-soft); text-align: right; }

/* ------------------------------- 结算：财产与作品 ------------------------------- */

.asset-list { list-style: none; margin: 0; padding: 0; }
.asset-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #eae4d7; font-size: 14px;
}
.asset-list li:last-child { border-bottom: none; }
.asset-list span { color: var(--ink-soft); }
.asset-list strong { color: var(--navy-800); }
.asset-note { margin: 12px 0 0; font-size: 12.5px; color: #8a8375; line-height: 1.7; }

.works-list { list-style: none; margin: 0; padding: 0; }
.works-list li {
  padding: 9px 0 9px 12px; border-bottom: 1px solid #eae4d7;
  border-left: 3px solid #4f9e77; display: grid; gap: 2px;
}
.works-list li.scandal { border-left-color: #a8323a; }
.works-list li:last-child { border-bottom: none; }
.works-list strong { color: var(--navy-800); font-size: 14.5px; }
.works-list span { font-size: 12.5px; color: #8a8375; }

.warning {
  background: linear-gradient(90deg, rgba(168, 50, 58, 0.22), rgba(168, 50, 58, 0.06));
  border: 1px solid rgba(207, 90, 95, 0.4);
  color: #f0c9cb;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.warning.urgent { border-color: rgba(207, 90, 95, 0.75); color: #ffd9db; }

/* ------------------------------- 事件卡 ------------------------------- */

.event-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  position: relative;
}
.event-card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(200, 164, 92, 0.28);
  border-radius: 10px; pointer-events: none;
}

.event-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.event-head h2 {
  margin: 0; font-size: 19px; color: var(--navy-800); letter-spacing: 0.04em;
  font-family: "Songti SC", "SimSun", serif;
}
.event-tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 999px;
  background: #e8e1d2; color: var(--navy-700); border: 1px solid var(--line);
}
.event-tag.danger { background: #f7dedf; color: #8f2b31; border-color: #e0b6b8; }

.event-text { color: #2a3342; font-size: 15px; }
.event-text p { margin: 0 0 11px; }
.event-text p:last-child { margin-bottom: 0; }

.options { display: grid; gap: 10px; margin-top: 16px; }

.option {
  text-align: left; font: inherit; cursor: pointer;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid; gap: 3px;
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s;
}
.option:hover { background: #fffdf6; box-shadow: 0 4px 14px rgba(15, 26, 46, 0.1); }
.option:active { transform: translateY(1px); }
.option-label { font-size: 15px; color: var(--navy-800); }
.option-hint { font-size: 12.5px; color: #8a8375; }

.result { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.result-text { font-size: 15px; color: #2a3342; }
.result-text p { margin: 0 0 10px; }
.result-text p:last-child { margin-bottom: 0; }

.deltas { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-size: 12.5px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid transparent; background: #eee7da; color: var(--ink-soft);
}
.chip.pos { background: #e4f0e9; color: #2b7355; border-color: #cadfd4; }
.chip.neg { background: #f7e2e3; color: #97333a; border-color: #e8c6c8; }
.chip.warn { background: #f6ecd6; color: #8a6a1f; border-color: #e6d5ab; }
.chip.npc { background: #e7ecf6; color: #3a5178; border-color: #ccd7ea; }
.chip.tiny { font-size: 11.5px; padding: 1px 8px; }
.option-numbers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.tl-action .tl-title { color: #3a5178; }

.game-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }

/* ------------------------------- 履历抽屉 ------------------------------- */

.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; top: 20vh;
  background: var(--paper);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.4);
  padding: 16px 16px 24px;
  overflow-y: auto;
  z-index: 40;
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -16px; background: var(--paper); padding: 4px 0 10px; }
.drawer-head h3 { margin: 0; font-size: 16px; color: var(--navy-800); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before {
  content: ""; position: absolute; left: -19px; top: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--gold);
}
.tl-age { font-size: 12px; color: #8a8375; }
.tl-title { font-size: 14px; color: var(--navy-800); font-weight: 600; }
.tl-choice { font-size: 13px; color: var(--ink-soft); }
.timeline-empty { color: #8a8375; font-size: 14px; padding-left: 0; }
.timeline-empty::before { display: none; }

/* ------------------------------- 结算页 ------------------------------- */

.result-wrap { padding-top: 28px; }

.ending-badge {
  display: inline-block;
  font-size: 12px; letter-spacing: 0.2em;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); color: #f3ecdc;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.rank-best { background: #1f5c42; border-color: #2f7d5b; color: #e9f6ee; }
.rank-good { background: #2b4a72; border-color: #3d638f; color: #e8f0fa; }
.rank-neutral { background: #4a4a4a; border-color: #6a6a6a; color: #f0f0f0; }
.rank-bad { background: #7a4a1e; border-color: #9c6430; color: #fbf0e2; }
.rank-worst { background: #7d2226; border-color: #9d2f33; color: #fbe6e6; }

.ending-name {
  margin: 12px 0 6px;
  font-size: 30px; letter-spacing: 0.1em; color: #f7f1e2; font-weight: 600;
  font-family: "Songti SC", "SimSun", serif;
}
.ending-sub { margin: 0 0 18px; color: rgba(246, 242, 233, 0.68); font-size: 13.5px; }

.ending-panel { background: linear-gradient(180deg, #fffdf8, #f7f1e4); }
.ending-text { font-size: 15.5px; color: #232c3a; }
.ending-text p { margin: 0 0 12px; }
.ending-text p:last-child { margin-bottom: 0; }

.score-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.score-num { font-size: 34px; font-weight: 700; color: var(--navy-800); }
.score-num em { font-size: 16px; font-style: normal; margin-left: 6px; color: var(--gold); }
.score-label { font-size: 13px; color: var(--ink-soft); }

.stats-final { grid-template-columns: repeat(4, 1fr); }
.stats-final .stat { background: #f2ece0; border-color: var(--line); }
.stats-final .stat-top { color: var(--ink-soft); }
.stats-final .stat-value { color: var(--navy-800); }
.stats-final .stat-bar { background: #e2dbcb; }

.highlights { margin: 14px 0 0; padding-left: 18px; color: #3b4657; font-size: 14px; }
.highlights li { margin-bottom: 6px; }

.resume { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.resume table { width: 100%; border-collapse: collapse; font-size: 13px; }
.resume th, .resume td { padding: 7px 9px; text-align: left; border-bottom: 1px solid #eae4d7; vertical-align: top; }
.resume thead th {
  position: sticky; top: 0; background: #efe9dc; color: var(--navy-700);
  font-size: 12px; letter-spacing: 0.06em; z-index: 1;
}
.resume .c-age { width: 42px; color: #8a8375; white-space: nowrap; }
.resume .c-tier { width: 78px; color: var(--navy-700); white-space: nowrap; }
.resume .c-event { width: 34%; color: #3b4657; }
.resume .c-choice { color: #6a6153; }

.cast-outcomes { list-style: none; margin: 0; padding: 0; }
.cast-outcomes li { padding: 10px 0; border-bottom: 1px solid #eae4d7; }
.cast-outcomes li:last-child { border-bottom: none; }
.cast-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cast-name strong { color: var(--navy-800); font-size: 15px; }
.cast-rel { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eee7da; color: var(--ink-soft); }
.cast-fate { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }

.result-actions { display: grid; gap: 10px; margin-top: 20px; }
.unlocked-note { text-align: center; color: var(--gold-soft); font-size: 13.5px; margin-top: 14px; }

/* ------------------------------- 图鉴页 ------------------------------- */

.codex-wrap { padding-top: 26px; }
.codex-head { text-align: center; color: var(--paper); margin-bottom: 8px; }
.codex-head h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: 0.16em; font-family: "Songti SC", "SimSun", serif; }
.codex-head p { margin: 0; font-size: 13px; color: rgba(246, 242, 233, 0.7); }

.codex-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.codex-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--paper-2); }
.codex-item.locked { background: #efeade; color: #96907f; }
.codex-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.codex-head-row strong { font-size: 15px; color: var(--navy-800); }
.codex-item.locked .codex-head-row strong { color: #8d8776; }
.codex-rank { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: #eee7da; color: var(--ink-soft); }
.codex-item .rank-best .codex-rank, .codex-item.rank-best { border-color: #7fb79b; }
.codex-item.rank-worst { border-color: #c99a9c; }
.codex-hint { font-size: 12.5px; color: #8a8375; margin-top: 4px; }
.codex-meta { font-size: 12px; color: #2e7d5b; margin-top: 4px; }

.achievements { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ach { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--paper-2); display: grid; }
.ach.locked { background: #efeade; color: #96907f; }
.ach-name { font-size: 14px; color: var(--navy-800); }
.ach.locked .ach-name { color: #8d8776; }
.ach-desc { font-size: 12px; color: #8a8375; }

.stat-list { list-style: none; margin: 0; padding: 0; }
.stat-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eae4d7; font-size: 14px; color: var(--ink-soft); }
.stat-list li:last-child { border-bottom: none; }
.stat-list strong { color: var(--navy-800); }

.codex-actions { display: grid; gap: 10px; margin-top: 18px; }

/* ------------------------------- 弹层与提示 ------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 16, 28, 0.66);
  display: grid; place-items: center;
  padding: 20px;
}
.modal-card {
  background: var(--paper);
  border-radius: 14px;
  padding: 20px;
  max-width: 560px;
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 12px; font-size: 19px; color: var(--navy-800); font-family: "Songti SC", "SimSun", serif; }
.modal-body p { margin: 0 0 11px; font-size: 14.5px; color: #2f3947; }
.modal-body em { font-style: normal; color: var(--navy-700); border-bottom: 1px dashed var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: rgba(20, 30, 48, 0.94); color: #f4efe3;
  padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  z-index: 80; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-width: 86vw; text-align: center;
}

/* ------------------------------- 响应式 ------------------------------- */

@media (max-width: 420px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .achievements { grid-template-columns: 1fr; }
  .hud-age { font-size: 22px; }
  .event-head h2 { font-size: 17px; }
  .ending-name { font-size: 25px; }
  .action-grid { grid-template-columns: 1fr; }
  .diff-list { grid-template-columns: 1fr; }
  .fin-item { flex: 1 1 100%; }
}

@media (min-width: 700px) {
  #app { padding: 0 20px 60px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .origin-list { grid-template-columns: repeat(3, 1fr); }
  .bg-list { grid-template-columns: repeat(2, 1fr); }
  .action-grid { grid-template-columns: repeat(3, 1fr); }
  .result-actions { grid-template-columns: repeat(2, 1fr); }
  .drawer { left: 50%; transform: translateX(-50%); max-width: 780px; border-radius: 16px; top: 12vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
