/* 《最后的统治者》— 亮色调：奶白公文纸、暖金、克制的权力感。 */
:root {
  --bg: #efe7d6;
  --bg-2: #e7dcc6;
  --bg-glow: #f8f1e2;
  --topbar-bg: rgba(239, 231, 214, 0.9);
  --loading-bg: rgba(243, 236, 222, 0.66);
  --paper: #fcf8ef;
  --paper-2: #f5eede;
  --ink: #221a0e;
  --ink-dim: #524631;
  --ink-faint: #837660;
  --gold: #8a6c22;
  --gold-dim: #b9a05a;
  --red: #b0472f;
  --green: #5d7d36;
  --amber: #c08418;
  --line: #ddd0b6;
  --line-soft: #e8ddc6;
  --summary: #6f614a;
  --choice-plain: #fff;
  --choice-hover: #f3e8cf;
  --choice-active: #eedfbf;
  --choice-selected: #f8efd8;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(80, 60, 20, 0.16);
  --serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1100px 540px at 50% -8%, var(--bg-glow) 0%, var(--bg) 62%),
    var(--bg);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
#app { max-width: 780px; margin: 0 auto; min-height: 100%; padding: 0 16px 80px; display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--ink-dim); font-weight: 400; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px 10px; border-bottom: 0;
  position: sticky; top: 0; z-index: 5; isolation: isolate;
  background: none;
}
#topbar::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw;
  transform: translateX(-50%); z-index: -1; pointer-events: none;
  background: linear-gradient(var(--bg), var(--topbar-bg));
  border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
#topbar .tb-left { min-width: 0; flex: 1; }
#topbar .tb-center { text-align: center; flex: 0 0 auto; padding: 0 10px; }
#topbar .tb-right { display: flex; align-items: center; gap: 10px; padding-right: 10px; flex: 0 0 auto; }
.identity-line { display: flex; align-items: baseline; flex-wrap: wrap; min-width: 0; }
#nation { font-family: var(--serif); font-weight: 700; letter-spacing: 0.04em; color: var(--gold); }
#leader-name { margin-left: 8px; font-size: 0.85em; }
.top-summary { margin-top: 2px; max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--summary); font-size: .82em; line-height: 1.28; font-weight: 450; }
#year-label { font-family: var(--sans); font-size: 1.06em; font-weight: 800; }
#phase-label { display: block; font-size: 0.76em; }
.net { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-faint); display: inline-block; margin-left: 4px; }
.net.online { background: var(--green); box-shadow: 0 0 8px rgba(93,125,54,.6); }
.net.offline { background: var(--ink-faint); }
.net.error { background: var(--red); }
.net.checking { background: var(--amber); box-shadow: 0 0 8px rgba(192,132,24,.55); animation: netPulse 1s ease-in-out infinite; }
@keyframes netPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- 面板 ---------- */
.panel { background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }

/* ---------- 核心指标：竖向比例条，五个一行 ---------- */
.core-row { display: flex; justify-content: space-between; gap: 6px; }
.cind { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; padding-top: 4px; }
.cind .ci-icon { width: 22px; height: 22px; color: var(--ink-dim); }
.cind .ci-name { font-size: 0.72em; color: var(--ink-faint); letter-spacing: 0.06em; }
.vbar { width: 16px; height: 66px; background: #e3d8bf; border-radius: 8px; position: relative; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.vbar .fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 8px 8px; transition: height .45s cubic-bezier(.19,1,.22,1); }
.fill.good { background: linear-gradient(180deg, #7c9a4e, #5d7d36); }
.fill.mid  { background: linear-gradient(180deg, #d6b24e, #bb8f23); }
.fill.bad  { background: linear-gradient(180deg, #c86a4f, #b0472f); }
.delta-float {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  font-size: 0.82em; font-weight: 700; font-variant-numeric: tabular-nums;
  pointer-events: none; white-space: nowrap; animation: floatUp 1.7s ease-out forwards; z-index: 3;
}
.delta-float.up { color: var(--green); }
.delta-float.down { color: var(--red); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px);} 15% { opacity: 1;} 100% { opacity: 0; transform: translate(-50%, -22px);} }

/* ---------- 装饰指标：横向两行小条 ---------- */
.deco-grid { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 16px; }
.dind { display: flex; align-items: center; gap: 6px; font-size: 0.74em; color: var(--ink-dim); }
.dind .di-icon { width: 14px; height: 14px; color: var(--ink-faint); flex: none; }
.dind .di-name { flex: none; }
.dind .hbar { flex: 1; height: 5px; background: #e3d8bf; border-radius: 3px; overflow: hidden; }
.dind .hbar .hfill { height: 100%; background: var(--gold-dim); border-radius: 3px; transition: width .4s; }
.dind .di-label { flex: none; color: var(--ink-faint); font-size: 0.92em; }

/* ---------- 人物 ---------- */
.people-row { display: flex; gap: 10px; }
.person { flex: 1; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; position: relative; }
.person:hover { transform: translateY(-2px); border-color: var(--gold-dim); box-shadow: var(--shadow); }
.person .p-name { font-family: var(--serif); font-size: 0.9em; }
.person .p-title { font-size: 0.66em; color: var(--ink-faint); }
.person .p-dots { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.loy-loyal { background: var(--green); }
.dot.loy-ok { background: var(--gold-dim); }
.dot.loy-uneasy { background: var(--amber); }
.dot.loy-danger { background: var(--red); }
.dot.comp { box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); }
.dot.comp-high { background: #4f74c0; }
.dot.comp-mid { background: #b9aa86; }
.dot.comp-low { background: #d9cdb3; }
.person.gone { opacity: 0.42; cursor: default; }
.person.gone:hover { transform: none; box-shadow: none; }

/* ---------- 舞台 / 卡片 ---------- */
#stage { flex: 1; }
.card { background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; animation: cardIn .3s cubic-bezier(.19,1,.22,1); position: relative; overflow: hidden; }
.card.chaincard { border-left: 4px solid var(--gold); }
.card-copy { position: relative; z-index: 1; }
/* 有画像时：左文字 / 右画像 并排，卡片高度取两者较高者，画像列不会被截断 */
.card.has-portrait { display: flex; align-items: stretch; gap: 10px; }
.card.has-portrait .card-copy { flex: 1; min-width: 0; order: 1; }
.card-portrait {
  z-index: 0; pointer-events: none; align-self: stretch; order: 2;
  flex: 0 0 clamp(128px, 30%, 196px);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px;
  padding-top: 14px; padding-bottom: 8px;
}
.card-portrait .cp-fig {
  width: 100%; aspect-ratio: 1 / 1; opacity: .92;
  -webkit-mask-image: radial-gradient(142% 118% at 50% 34%, #000 48%, transparent 82%);
  mask-image: radial-gradient(142% 118% at 50% 34%, #000 48%, transparent 82%);
}
.card-portrait .cp-fig .portrait-svg { display: block; width: 100%; height: 100%; }
.card-portrait .cp-cap { display: flex; flex-direction: column; align-items: center; gap: 9px; margin-top: 4px; }
.card-portrait .cp-title { font-size: .92em; color: var(--ink-dim); letter-spacing: .05em; }
.card-portrait .cp-name { font-family: var(--sans); font-weight: 500; font-size: .92em; color: var(--ink); }
.card-portrait .cp-icon { color: var(--gold); margin-top: 2px; }
.card-portrait .cp-icon .role-icon { width: 22px; height: 22px; display: block; }
.card.chaincard .card-portrait .cp-fig { opacity: .9; }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; } }
.card .kicker { font-size: 0.72em; letter-spacing: 0.16em; color: var(--gold); text-transform: uppercase; }
.card .title { font-family: var(--serif); font-size: 1.3em; margin: 4px 0 12px; }
.card .narrative { font-family: var(--serif); font-size: 1.02em; white-space: pre-wrap; }
.card .speaker { color: var(--gold); font-style: italic; }
.options { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.option { text-align: left; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; font-family: var(--serif); font-size: 0.98em; cursor: pointer; transition: border-color .12s, background .12s, transform .08s; }
.option:hover { border-color: var(--gold); background: #fff; }
.option:active { transform: scale(.995); }
.result-text { font-family: var(--serif); font-size: 1.02em; white-space: pre-wrap; }
.continue { margin-top: 16px; }

/* 结算明细 chips */
.summary-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 2px; }
.chip { font-size: 0.8em; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper); font-variant-numeric: tabular-nums; }
.chip.up { color: var(--green); border-color: #b9c48f; }
.chip.down { color: var(--red); border-color: #e0b09f; }
.chip.neutral { color: var(--ink-dim); }

/* ---------- 预算 ---------- */
.budget .total-note { font-size: 0.82em; color: var(--ink-dim); margin-bottom: 12px; }
.alloc { margin: 12px 0; }
.alloc .alloc-head { display: flex; justify-content: space-between; font-size: 0.92em; }
.alloc .alloc-head .pct { color: var(--gold); font-variant-numeric: tabular-nums; }
.alloc input[type=range] { width: 100%; accent-color: var(--gold); }
.alloc .desc { font-size: 0.74em; color: var(--ink-faint); }

/* ---------- 按钮 ---------- */
button { font-family: var(--sans); }
.primary { background: linear-gradient(180deg, #b9933a, var(--gold)); color: #fff; border: none; border-radius: 9px; padding: 11px 22px; font-size: 1em; font-weight: 700; cursor: pointer; letter-spacing: 0.05em; }
.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.ghost { background: transparent; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 0.82em; cursor: pointer; }
.ghost:hover { color: var(--ink); border-color: var(--gold-dim); }
.ghost:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- 浮层 ---------- */
.overlay { position: fixed; inset: 0; background: rgba(60, 48, 24, 0.4); display: flex; align-items: center; justify-content: center; z-index: 35; padding: 20px; }
.overlay-box { background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 1px solid var(--gold-dim); border-radius: var(--radius); max-width: 560px; width: 100%; max-height: 84vh; overflow: auto; padding: 22px; position: relative; box-shadow: var(--shadow); }
.overlay-close { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--ink-dim); font-size: 1.5em; cursor: pointer; line-height: 1; }
.overlay-close:hover { color: var(--ink); }
.overlay h3 { font-family: var(--serif); margin: 0; }

/* 人物详情 / 私信 */
.pd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pd-tag { font-size: 0.74em; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 2px 10px; color: var(--ink-dim); }
.pd-blurb { font-family: var(--serif); color: var(--ink-dim); font-style: italic; margin: 4px 0 10px; }
.pd-status { font-family: var(--serif); }
.pd-status p { margin: 5px 0; }
.pd-actions { margin-top: 14px; display: flex; gap: 10px; align-items: center; }
.pd-reason { font-size: 0.8em; color: var(--ink-faint); }
.adv-opt { text-align: left; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; margin-bottom: 9px; cursor: pointer; font-family: var(--serif); }
.adv-opt:hover { border-color: var(--gold); background: #fff; }
.adv-opt .ao-kind { font-size: 0.7em; letter-spacing: .12em; color: var(--gold); text-transform: uppercase; display: block; margin-bottom: 2px; }
.adv-reveal { font-family: var(--serif); white-space: pre-wrap; margin: 8px 0; }
.adv-clue { font-family: var(--serif); color: var(--ink-faint); font-style: italic; margin-top: 8px; }

/* 档案室 */
.archive-entry { border-bottom: 1px solid var(--line-soft); padding: 9px 0; }
.archive-entry .ay { color: var(--gold); font-size: 0.78em; }
.archive-entry .at { font-family: var(--serif); }
.archive-entry .ar { font-size: 0.85em; color: var(--ink-dim); }

/* ---------- 加载浮层 ---------- */
#loading { position: fixed; inset: 0; background: var(--loading-bg); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 40; }
#loading .lo-box { text-align: center; }
.spinner { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; margin: 0 auto 14px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading .lo-line { font-family: var(--serif); color: var(--ink-dim); font-size: 0.95em; min-height: 1.5em; }

/* ---------- 启动 / 简报 / 结局 ---------- */
.boot { position: fixed; inset: 0; background: radial-gradient(900px 500px at 50% 28%, var(--bg-glow), var(--bg)); display: flex; align-items: center; justify-content: center; z-index: 30; text-align: center; }
.boot-inner { max-width: 480px; padding: 20px; }
.boot h1 { font-family: var(--serif); font-size: 2.6em; margin: 0 0 6px; color: var(--gold); letter-spacing: 0.08em; }
.boot .subtitle { color: var(--ink-dim); margin: 0 0 26px; }
.boot .epigraph { font-family: var(--serif); font-style: italic; color: var(--ink-faint); margin: 0 0 30px; }
.boot .boot-foot { margin-top: 22px; font-size: 0.8em; }
.version { display: inline-block; margin-top: 4px; color: var(--ink-faint); cursor: pointer; border-bottom: 1px dotted var(--ink-faint); }
.version:hover { color: var(--gold); border-bottom-color: var(--gold); }
.changelog { max-height: calc(70vh - 14px); overflow-y: auto; margin-top: 14px; margin-right: -10px; padding-right: 14px; scrollbar-gutter: stable; }
.changelog h3 { font-family: var(--serif); color: var(--gold); margin: 0 0 10px; }
.changelog h4 { font-family: var(--serif); margin: 16px 0 4px; font-size: 1.02em; }
.changelog h5 { margin: 10px 0 2px; font-size: .82em; color: var(--gold); letter-spacing: .04em; }
.changelog ul { margin: 2px 0 8px; padding-left: 20px; }
.changelog li { margin: 3px 0; font-size: .9em; color: var(--ink-dim); line-height: 1.5; }
.changelog p { font-size: .86em; color: var(--ink-faint); }
.changelog a { color: var(--gold); }

.briefing .bf-people { margin: 14px 0; }
.briefing .bf-person { border-left: 3px solid var(--gold-dim); padding: 4px 0 4px 12px; margin: 9px 0; }
.briefing .bf-person .bn { font-family: var(--serif); font-weight: 700; }
.briefing .bf-person .bt { font-size: 0.78em; color: var(--ink-faint); }
.briefing .bf-person .bb { font-family: var(--serif); font-style: italic; color: var(--ink-dim); font-size: 0.92em; }
.briefing .bf-guide { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 14px 0; font-size: 0.92em; }
.briefing .bf-guide li { margin: 4px 0; }
.bf-actions { margin-top: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.bf-manual-hint { font-size: .82em; }
.bf-manual-hint b { color: var(--gold); font-weight: 600; }
.seed-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 18px; padding: 9px 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(255,255,255,.45); font-size: .86em; }
.seed-label { color: var(--ink-faint); }
.seed-code { font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--ink-dim); }
.seed-copy { padding: 4px 10px; }

.ending { text-align: center; }
.ending .verdict-tag { font-size: 0.8em; letter-spacing: 0.2em; color: var(--gold); text-transform: uppercase; }
.ending h2 { font-family: var(--serif); font-size: 1.8em; margin: 6px 0 4px; }
.obituary { text-align: left; font-family: var(--serif); white-space: pre-wrap; line-height: 1.85; margin: 16px 0; }
.obituary.official { border-left: 3px solid var(--gold); padding-left: 14px; }
.obituary.wiki { border-left: 3px solid var(--ink-faint); padding-left: 14px; color: var(--ink-dim); }
.score-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-variant-numeric: tabular-nums; }
.score-table td { padding: 6px 4px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.score-table td:last-child { text-align: right; color: var(--gold); }
.score-table tr.total td { font-weight: 700; font-size: 1.15em; border-bottom: none; border-top: 2px solid var(--gold-dim); }
.achievements { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; }
.ach { font-size: 0.78em; background: var(--paper-2); border: 1px solid var(--gold-dim); border-radius: 20px; padding: 4px 12px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--paper); border: 1px solid var(--gold-dim); color: var(--ink); padding: 9px 16px; border-radius: 8px; font-size: 0.85em; z-index: 50; box-shadow: var(--shadow); opacity: 0; transition: opacity .25s; pointer-events: none; }
#toast.show { opacity: 1; }

/* ====================== v1.2 覆盖 ====================== */
body { font-weight: 450; color: var(--ink); }
.card .narrative { font-weight: 500; color: var(--ink); }
.card .title { font-weight: 800; }
.option { font-weight: 600; color: var(--ink); }
.option:hover { background: var(--choice-hover); border-color: var(--gold); }
.option:active { background: var(--choice-active); }
.result-text { font-weight: 500; color: var(--ink); }
.kicker { font-weight: 700; }

#topbar .tb-left { padding-left: 6px; }

/* 核心竖条：图标外层 + 甜区标记 */
.cind .ci-icon { width: 22px; height: 22px; color: var(--ink-dim); display: flex; align-items: center; justify-content: center; }
.cind .ci-icon svg { width: 22px; height: 22px; }
.cind .ci-name { font-weight: 600; color: var(--ink-dim); }
.vbar { position: relative; }
.vbar .sweet { position: absolute; left: -2px; right: -2px; top: 31%; height: 38%; border-top: 1px dashed rgba(90,74,40,.35); border-bottom: 1px dashed rgba(90,74,40,.35); pointer-events: none; }

/* 装饰指标：纯文字三色 */
.deco-grid { grid-template-columns: repeat(4, 1fr); gap: 6px 14px; }
.dind { gap: 5px; font-weight: 600; }
.dind .di-icon { display: inline-flex; width: 14px; height: 14px; }
.dind .di-icon svg { width: 14px; height: 14px; }
.dind .di-name { color: var(--ink-dim); }
.dind.deco-good .di-label { color: var(--green); }
.dind.deco-mid .di-label { color: var(--amber); }
.dind.deco-bad .di-label { color: var(--red); }
.dind.deco-good .di-icon { color: var(--green); }
.dind.deco-mid .di-icon { color: var(--amber); }
.dind.deco-bad .di-icon { color: var(--red); }

/* 人物：忠诚比例条 */
.people-hint { font-size: .76em; margin-bottom: 8px; }
.person .p-top { display: flex; align-items: center; justify-content: space-between; }
.person .p-name { font-weight: 700; }
.person .loybar { margin-top: 6px; height: 5px; background: #e3d8bf; border-radius: 3px; overflow: hidden; }
.person .loyfill { height: 100%; border-radius: 3px; transition: width .4s; }
.loyfill.loy-loyal { background: var(--green); }
.loyfill.loy-ok { background: var(--gold-dim); }
.loyfill.loy-uneasy { background: var(--amber); }
.loyfill.loy-danger { background: var(--red); }
.dot.comp-high { background: #3f63ad; }
.dot.comp-mid { background: #b9aa86; }
.dot.comp-low { background: #d9cdb3; }

@media (max-width: 560px) { .deco-grid { grid-template-columns: 1fr 1fr; } }

/* ====================== v1.3 ====================== */
.panel-kicker { font-size: .72em; letter-spacing: .16em; color: var(--gold); text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.people-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.people-head .panel-kicker { margin-bottom: 0; flex: none; }
.simmering-summary { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--ink-dim); font-family: var(--sans); font-size: .88em; line-height: 1.35; text-align: right; }
.simmering-label { flex: none; font-family: var(--sans); color: var(--gold); font-size: .74em; font-weight: 800; letter-spacing: .12em; }
.simmering-summary span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 装饰指标：整行居中 */
.deco-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 58px; }
.dind { flex: 0 0 auto; }

/* 人物：选项卡 */
.people-tabs { display: flex; gap: 6px; }
.ptab { flex: 1; background: var(--paper-2); border: 1px solid var(--line); border-bottom: none; border-radius: 9px 9px 0 0; padding: 8px 10px; cursor: pointer; text-align: left; transition: background .12s; }
.ptab:hover { background: #f3e8cf; }
.ptab.active { background: var(--paper); border-color: var(--gold-dim); box-shadow: 0 -2px 0 var(--gold) inset; }
.ptab.gone { opacity: .45; cursor: default; }
.ptab .pt-name { display: block; font-family: var(--sans); font-weight: 400; font-size: .98em; letter-spacing: 0; }
.ptab .pt-meter { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.ptab .pt-mark { flex: none; font-size: .64em; font-weight: 800; color: var(--ink-faint); line-height: 1; }
.ptab .pt-loy { display: block; flex: 1; height: 5px; background: #e3d8bf; border-radius: 3px; overflow: hidden; }
.ptab .pt-loy .loyfill { height: 100%; border-radius: 3px; transition: width .4s; }
.people-detail { border: 1px solid var(--gold-dim); border-radius: 0 0 10px 10px; background: var(--paper); padding: 12px 14px; }
.pd .pd-head { display: flex; align-items: baseline; gap: 10px; }
.pd .pd-name { font-family: var(--serif); font-weight: 800; font-size: 1.05em; }
.pd .pd-title { color: var(--ink-faint); font-size: .8em; }
.pd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pd-tag { font-size: .74em; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 2px 10px; color: var(--ink-dim); }
.pd-tag .tag-ic { display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.pd-tag .tag-ic svg { width: 13px; height: 13px; }
.chip-loy.loy-loyal, .chip-comp.comp-high { border-color: #b9c48f; color: var(--green); }
.chip-loy.loy-uneasy { border-color: #e3c98f; color: var(--amber); }
.chip-loy.loy-danger { border-color: #e0b09f; color: var(--red); }
.pd-blurb { font-family: var(--serif); color: var(--ink-dim); font-style: italic; font-size: .92em; margin: 12px 0 8px; }
.pd-status { font-family: var(--serif); }
.pd-status p { margin: 4px 0; }
.pd-actions { margin-top: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pd-engage { padding: 8px 18px; font-size: .92em; }
.pd-reason { font-size: .8em; color: var(--ink-faint); }

/* 私信选项：与主卡选项同字体同字号 */
.adv-opt { font-family: var(--serif); font-size: .98em; font-weight: 600; color: var(--ink); padding: 12px 14px; border-radius: 9px; }
.adv-opt:hover { background: var(--choice-hover); }
.adv-opt .ao-kind { font-family: var(--sans); }
.adv-reveal { font-weight: 500; }

/* 加载进度条 */
.lo-progress { width: 220px; height: 6px; background: #e3d8bf; border-radius: 4px; margin: 14px auto 0; overflow: hidden; }
.lo-bar { height: 100%; width: 4%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 4px; transition: width .6s cubic-bezier(.19,1,.22,1); }
.ob-quote { text-align: center; color: var(--ink-dim); }

/* ====================== v1.4 ====================== */
/* 修复：比例条的 fill 必须 block，否则 width 不生效（之前忠诚条为空的原因） */
.loyfill { display: block; height: 100%; border-radius: 3px; }

/* 人物 tab 加大，显示名字+职位 */
.ptab { padding: 9px 12px; min-height: 56px; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.ptab .pt-name { font-size: 1em; }
.ptab .pt-title { display: block; font-size: .68em; color: var(--ink-faint); line-height: 1.25; }
.ptab .pt-loy { display: block; flex: 1; height: 5px; background: #e3d8bf; border-radius: 3px; overflow: hidden; }

/* 详情：忠诚/能力用标签，不显示数值比例条 */
.pd-tag.pd-loy-loyal { color: var(--green); border-color: rgba(93,125,54,.35); }
.pd-tag.pd-loy-uneasy { color: var(--amber); border-color: rgba(184,119,46,.35); }
.pd-tag.pd-loy-danger { color: var(--red); border-color: rgba(164,74,63,.35); }
.pd-tag.pd-comp-high { color: #3f63ad; border-color: rgba(63,99,173,.35); }

/* 状态区人物行：低行高、扁平化，靠近指标读法 */
.people-tabs {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px;
}
.ptab {
  min-height: 0; padding: 4px 8px; border: 0; border-radius: 6px; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-dim); line-height: 1.15; text-align: center;
}
.ptab:hover, .ptab.active:hover { background: var(--choice-plain); }
.ptab.active { background: transparent; border-color: transparent; box-shadow: none; }
.ptab.gone { opacity: .45; cursor: pointer; }
.pt-line { min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.ptab .pt-name { flex: none; display: inline; font-size: .88em; font-weight: 600; color: var(--ink-dim); }
.ptab .pt-title { min-width: 0; display: inline; overflow: hidden; text-overflow: ellipsis; color: var(--ink-faint); font-size: .68em; line-height: 1.1; }
.ptab .pt-meter { width: min(88px, 100%); display: flex; align-items: center; gap: 5px; margin-top: 0; }
.ptab .pt-mark { flex: none; font-size: .64em; font-weight: 800; color: var(--ink-faint); line-height: 1; }
.ptab .pt-loy { display: block; flex: 1; height: 5px; background: #e3d8bf; border-radius: 3px; overflow: hidden; }
.ptab .pt-loy .loyfill { height: 100%; border-radius: 3px; transition: width .4s; }
.pt-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-dim); opacity: .9; }
.pt-dot.loy-loyal { background: var(--green); }
.pt-dot.loy-ok { background: var(--gold-dim); }
.pt-dot.loy-uneasy { background: var(--amber); }
.pt-dot.loy-danger { background: var(--red); }

/* ---------- 人物画像：状态栏职业 icon / 召见小头像 / 详情半身像 ---------- */
/* 状态栏：纯职业 icon 圆徽（暖金线条，公文纸底） */
.pt-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 18%, #fffdf6, var(--paper-2));
  border: 1.5px solid var(--line); color: var(--gold);
}
.pt-avatar .role-icon { width: 19px; height: 19px; display: block; }
.ptab.active .pt-avatar { border-color: var(--gold-dim); }
.ptab.gone .pt-avatar { filter: grayscale(.6); opacity: .7; }
.pt-text { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }

/* 召见选人：open-peeps 圆形小头像（取景到头肩，略缩小并上移） */
.sp-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none;
  background: radial-gradient(120% 120% at 50% 24%, #fffdf6, var(--paper-2)); border: 1.5px solid var(--line);
}
.sp-avatar .portrait-svg { width: 142%; height: 142%; margin: -8% 0 0 -21%; display: block; }
.summon-person.active .sp-avatar { border-color: var(--gold-dim); }

/* 详情：open-peeps 半身像（无 icon），方形圆角；人像略缩小并上移居中 */
.pd-top { display: flex; align-items: flex-start; gap: 14px; }
.pd-top-text { min-width: 0; flex: 1; }
.pd-avatar {
  width: 92px; height: 92px; flex: none; border-radius: 10px; overflow: hidden;
  background: linear-gradient(180deg, #fffdf6, var(--paper-2)); border: 1px solid var(--line);
}
.pd-avatar .portrait-svg { width: 108%; height: 108%; margin: -4% 0 0 -4%; display: block; }
.pd-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.pd-role-icon { display: inline-flex; align-items: center; color: var(--gold); flex: none; align-self: center; }
.pd-role-icon .role-icon { width: 16px; height: 16px; display: block; }
.pd.has-avatar .pd-tags { margin-bottom: 0; }




/* 年终召见卡：左列选人 + 右侧详情 */
.advisor-card .narrative { margin-bottom: 14px; }
.summon-split { display: flex; gap: 16px; align-items: flex-start; }
.summon-tabs { flex: 0 0 clamp(150px, 30%, 200px); display: flex; flex-direction: column; gap: 8px; margin: 0; }
.summon-detail { flex: 1; min-width: 0; }
.summon-person {
  text-align: left; background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; display: flex; align-items: center; gap: 9px;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.summon-person:hover { border-color: var(--gold); background: var(--choice-plain); }
.summon-person.active { border-color: var(--gold-dim); background: var(--choice-selected); }
.summon-person.gone { opacity: .45; }
.sp-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.sp-name { font-weight: 800; font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-title { color: var(--ink-faint); font-size: .74em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.advisor-card .pd { margin-top: 0; padding: 0; border: 0; background: none; }
.advisor-actions { align-items: center; }
.advisor-options .ao-kind { display: block; margin-bottom: 2px; font-family: var(--sans); font-size: .7em; letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.advisor-reshuffle { margin-top: 10px; }

/* 非核心指标再拉开间距 */
.deco-grid { gap: 12px 58px; }

/* 设置 / 确认弹窗（层级高于启动屏） */
.settings-ov { position: fixed; inset: 0; background: rgba(60,48,24,.5); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.settings-box { background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 1px solid var(--gold-dim); border-radius: var(--radius); max-width: 440px; width: 100%; padding: 22px; box-shadow: var(--shadow); }
.settings-box h3 { font-family: var(--serif); margin: 0 0 6px; }
.set-field { margin: 10px 0; }
.set-label { display: block; font-size: .78em; color: var(--ink-dim); margin-bottom: 4px; }
.set-input { width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: 7px; padding: 8px 10px; font-family: var(--sans); font-size: .92em; }
.set-actions { margin-top: 16px; display: flex; gap: 10px; }
.set-status { margin-top: 10px; font-size: .82em; min-height: 1.2em; }
.set-actions button:disabled { opacity: .55; cursor: default; }
.boot-actions { display: flex; flex-direction: column; gap: 10px; justify-content: center; align-items: center; }

/* 刷新时随机挑一套底色，不改变布局与机制 */
body[data-theme="slate"] {
  --bg: #e6e7e1;
  --bg-2: #d8dacf;
  --bg-glow: #f4f5ed;
  --topbar-bg: rgba(230, 231, 225, 0.9);
  --loading-bg: rgba(230, 231, 225, 0.66);
  --paper: #fbfbf5;
  --paper-2: #f0f1e9;
  --ink: #1d211d;
  --ink-dim: #464d45;
  --ink-faint: #737c70;
  --gold: #6f7350;
  --gold-dim: #a3a783;
  --red: #9b4c43;
  --green: #59755a;
  --amber: #9e7d29;
  --line: #cfd3c5;
  --line-soft: #dde0d5;
  --summary: #667064;
  --choice-plain: #fbfbf5;
  --choice-hover: #e8ece0;
  --choice-active: #dde4d4;
  --choice-selected: #eef2e4;
}
body[data-theme="crimson"] {
  --bg: #efe2d7;
  --bg-2: #e2cfc2;
  --bg-glow: #fbefe5;
  --topbar-bg: rgba(239, 226, 215, 0.9);
  --loading-bg: rgba(239, 226, 215, 0.66);
  --paper: #fff7ee;
  --paper-2: #f6e9dc;
  --ink: #251811;
  --ink-dim: #5a4438;
  --ink-faint: #8a7466;
  --gold: #8b5e2e;
  --gold-dim: #bd9a6f;
  --red: #a63f3a;
  --green: #5f7a4b;
  --amber: #b06f28;
  --line: #dfc8b8;
  --line-soft: #ead8ca;
  --summary: #7d6254;
  --choice-plain: #fff7ee;
  --choice-hover: #f2dfd4;
  --choice-active: #e9d1c2;
  --choice-selected: #f7e6da;
}
body[data-theme="verdigris"] {
  --bg: #e3e7da;
  --bg-2: #d4dccb;
  --bg-glow: #f3f6e8;
  --topbar-bg: rgba(227, 231, 218, 0.9);
  --loading-bg: rgba(227, 231, 218, 0.66);
  --paper: #fbfbef;
  --paper-2: #eef3e4;
  --ink: #182119;
  --ink-dim: #3f513f;
  --ink-faint: #70806c;
  --gold: #6d7a38;
  --gold-dim: #a3ad68;
  --red: #9f4c3d;
  --green: #3f765a;
  --amber: #9d7f23;
  --line: #ccd8bf;
  --line-soft: #dce5d2;
  --summary: #60735f;
  --choice-plain: #fbfbef;
  --choice-hover: #e1ead8;
  --choice-active: #d4e1ca;
  --choice-selected: #eaf1dc;
}

@media (max-width: 560px) {
  .deco-grid { grid-template-columns: 1fr 1fr; }
  #topbar {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "identity center actions" "summary summary summary";
    align-items: center; gap: 4px 6px; min-height: 68px; padding: 8px 2px 8px;
  }
  #topbar .tb-left { display: contents; }
  #topbar .tb-center { grid-area: center; justify-self: center; padding: 0 4px; min-width: 52px; }
  #topbar .tb-right {
    grid-area: actions; justify-self: end; display: flex; flex-direction: column;
    align-items: stretch; gap: 2px; padding-right: 0;
  }
  #topbar .ghost { white-space: nowrap; padding: 4px 8px; font-size: .76em; line-height: 1.15; }
  #topbar #net-status { position: absolute; right: 2px; bottom: 8px; margin-left: 0; }
  .identity-line { grid-area: identity; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; line-height: 1.14; }
  #nation, #leader-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #nation { width: 100%; font-size: .92em; }
  #leader-name { width: 100%; margin-left: 0; font-size: .76em; }
  .top-summary {
    grid-area: summary; max-width: 100%; margin-top: 2px; padding-right: 18px; white-space: normal;
    font-size: .76em; line-height: 1.25; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  #topbar .top-summary.hidden {
    display: block !important; visibility: hidden; min-height: 1.25em;
  }
  #year-label { white-space: nowrap; font-size: .95em; }
  #phase-label { font-size: .68em; }
  /* 事件卡：窄屏改为上下堆叠，画像在文字下方居中，避免侧栏过窄 */
  .card.has-portrait { flex-direction: column; }
  .card.has-portrait .card-copy { order: 1; }
  .card-portrait { order: 2; flex-basis: auto; width: 100%; flex-direction: row; justify-content: center; gap: 14px; padding-top: 10px; }
  .card-portrait .cp-fig { width: clamp(96px, 32vw, 140px); }
  .card-portrait .cp-cap { margin-top: 0; align-items: flex-start; justify-content: center; }
  .people-head { align-items: flex-start; flex-direction: column; }
  .simmering-summary { justify-content: flex-start; text-align: left; }
  .simmering-summary span:last-child { white-space: normal; }
  .people-tabs { grid-template-columns: 1fr 1fr; }
  .summon-split { flex-direction: column; }
  .summon-tabs { flex-basis: auto; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .summon-person { min-width: 0; }
  .people-row { flex-wrap: wrap; }
  .person { min-width: 45%; }
}
