:root {
  --bg: #eef1ef;
  --card: #fbfcfb;
  --text: #1f2a2e;
  --muted: #6c7a7f;
  --line: #d9dfdc;
  --accent: #8c1d3f;
  --accent-ink: #ffffff;
  --good: #2b7a57;
  --bad: #b04545;
  --mood: 140, 29, 63;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1d2227;
    --text: #e8eeee;
    --muted: #93a1a6;
    --line: #2f383d;
    --accent: #e0668f;
    --accent-ink: #1a0d13;
    --good: #6cc59b;
    --bad: #e88a8a;
    --mood: 224, 102, 143;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.7 -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
#app { max-width: 1040px; margin: 0 auto; padding: 16px; }
[hidden] { display: none !important; }
.center { text-align: center; padding-top: 12vh; }
.center .lead { max-width: 36em; margin-left: auto; margin-right: auto; }
.kicker { color: var(--muted); font-size: 13px; letter-spacing: .12em; margin: 0; }
h1 { font-family: "Songti SC", "Noto Serif SC", serif; font-size: 44px; line-height: 1.2; margin: 8px 0 16px; }
h2 { margin: 0 0 8px; font-size: 20px; }
h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: .04em; }
.lead { font-size: 16px; }
.dim { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
.note.credit { margin-top: 6px; opacity: .75; }
.note.credit a { color: inherit; }
.note { color: var(--muted); font-size: 12px; max-width: 40em; margin: 40px auto 0; }
button {
  font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.big { font-size: 16px; padding: 12px 36px; margin-top: 20px; }
button.link { border: 0; background: none; color: var(--muted); text-decoration: underline; margin-top: 12px; }
button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* 抽签 */
.reveal-name { font-family: "Songti SC", "Noto Serif SC", serif; font-size: 64px; margin: 20px 0 8px; min-height: 1.3em; }

/* 出生登记 */
.paper { max-width: 640px; margin: 4vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.paper-head { background: var(--accent); color: var(--accent-ink); display: flex; justify-content: space-between; padding: 10px 16px; font-size: 14px; letter-spacing: .08em; }
.paper-body { padding: 20px; }
.label { font-size: 12px; color: var(--muted); }
.rows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 20px 0 0; }
.rows div { min-width: 0; }
.rows dt { font-size: 12px; color: var(--muted); }
.rows dd { margin: 0; font-weight: 600; }
.rows.tight { grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
.rows.tight dt, .rows.tight dd { font-size: 13px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 4px 0 10px; }
.top-line { display: flex; align-items: baseline; gap: 12px; }
.brand { font-family: "Songti SC", "Noto Serif SC", serif; font-size: 18px; }
.age { font-size: 30px; font-weight: 700; }
.progress { height: 3px; background: var(--line); margin: 4px 0 8px; }
#progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; }

/* 布局 */
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } .side { order: 2; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 12px; }
.panel.idcard { padding: 0; overflow: hidden; }
.idc-body { padding: 12px 16px 14px; }
.idc-name { font-family: "Songti SC", "Noto Serif SC", serif; font-size: 20px; margin-bottom: 8px; }

/* 状态条 */
.stat { display: grid; grid-template-columns: 4.5em 1fr 2em; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; }
.track { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); transition: width .5s; }
.stat span:last-child { text-align: right; color: var(--muted); }

/* 重心 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { border-radius: 999px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* 纪录 */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 3.4em 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; }
.feed .yr { font-size: 12px; color: var(--muted); padding-top: 2px; }
.feed .lead-line { color: var(--muted); font-size: 13px; }
.feed .pick-line { color: var(--muted); font-size: 13px; font-style: italic; }
.feed .t { font-weight: 600; }
.feed .good .t { color: var(--good); }
.feed .bad .t { color: var(--bad); }
.feed .note .t { font-weight: 400; font-style: italic; }
.feed .birth .t { font-weight: 700; }
.feed .fact { margin-top: 4px; padding: 6px 10px; font-size: 12px; background: var(--bg); border-left: 3px solid var(--accent); color: var(--muted); }
.feed .tag { display: inline-block; font-size: 11px; padding: 0 6px; margin-right: 6px; border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; font-weight: 400; }
.feed li.new { animation: pop .5s ease-out; }
@keyframes pop { from { background: rgba(var(--mood), .15); } to { background: transparent; } }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal-card { background: var(--card); border-radius: 8px; max-width: 480px; width: 100%; padding: 20px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--accent); margin-bottom: 8px; }
.choices { display: grid; gap: 8px; margin-top: 14px; }
.choices button { text-align: left; padding: 12px 14px; font-size: 14px; }
.choices button b { display: inline-block; width: 1.6em; color: var(--muted); font-weight: 400; }
#modal-input { width: 100%; font: inherit; padding: 10px; border: 1px solid var(--accent); border-radius: 6px; background: var(--bg); color: var(--text); margin-top: 8px; }

/* 结局 */
#end { max-width: 720px; margin: 0 auto; padding-top: 6vh; }
.end-lines p { margin: 6px 0; }
.life-map { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 420px; margin-top: 8px; }
.life-map i { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 3px; background: rgba(var(--mood), var(--a, .1)); }
.row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
summary { cursor: pointer; font-size: 14px; font-weight: 600; }
