/* ============================================================
   宦海浮沉 · style.css —— 全界面样式（桌面三栏 / 移动单列）
   视觉基调：墨色官衙 × 朱砂红 × 鎏金
   ============================================================ */
:root {
  --bg: #14100c;
  --bg2: #1d1712;
  --panel: rgba(38, 29, 22, 0.92);
  --panel-line: rgba(212, 175, 116, 0.22);
  --ink: #ece3d3;
  --ink-dim: #b3a68f;
  --muted: #857a66;
  --gold: #d4af74;
  --gold-2: #c9992e;
  --red: #b03226;
  --red-deep: #7e1f16;
  --green: #3f9d5f;
  --blue: #3f7fae;
  --purple: #8a5bb0;
  --shadow: 0 10px 34px rgba(0,0,0,.5);
  --font-cn: "Noto Serif SC","Source Han Serif SC","Songti SC","SimSun",serif;
  --font-body: "Noto Sans SC","PingFang SC","Microsoft YaHei","Hiragino Sans GB",sans-serif;
  --font-mono: "JetBrains Mono","Consolas",monospace;
}
* { margin:0; padding:0; box-sizing:border-box; }
html,body { height:100%; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 700px at 82% -8%, rgba(176,50,38,.14), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(201,153,46,.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.hidden { display:none !important; }
button { font-family: inherit; }

/* ---------------- 标题屏 ---------------- */
.screen {
  position: fixed; inset:0; z-index: 60;
  display:flex; align-items:center; justify-content:center;
  background:
    linear-gradient(180deg, rgba(10,7,5,.55), rgba(10,7,5,.88)),
    repeating-linear-gradient(90deg, rgba(212,175,116,.03) 0 1px, transparent 1px 6px),
    radial-gradient(1000px 600px at 50% 0%, rgba(176,50,38,.18), transparent 65%),
    var(--bg);
  overflow:auto;
}
.title-inner {
  max-width: 640px; width: 92%;
  text-align:center; padding: 34px 26px 46px;
  position:relative;
}
.title-inner::before, .title-inner::after {
  content:''; position:absolute; width:120px; height:120px; opacity:.5; pointer-events:none;
}
.title-inner::before { top:-18px; left:-18px; border-top:2px solid var(--gold); border-left:2px solid var(--gold); }
.title-inner::after { bottom:-18px; right:-18px; border-bottom:2px solid var(--gold); border-right:2px solid var(--gold); }
.title-kicker {
  font-family: var(--font-mono); font-size:11px; letter-spacing:.5em;
  color:var(--gold); margin-bottom:18px;
}
.title-main {
  font-family: var(--font-cn); font-weight:900;
  font-size: clamp(52px, 13vw, 92px);
  letter-spacing: .16em; line-height:1.1;
  color: var(--ink);
  text-shadow: 0 0 40px rgba(176,50,38,.55), 0 4px 0 var(--red-deep);
  margin-bottom: 10px;
}
.title-sub { font-family: var(--font-cn); color: var(--gold); letter-spacing:.32em; font-size:15px; margin-bottom:22px; }
.title-desc { color: var(--ink-dim); font-size:14px; line-height:1.9; max-width:460px; margin:0 auto 30px; }
.title-actions { display:flex; flex-direction:column; gap:12px; max-width:300px; margin:0 auto; }
.title-slots { margin-top:26px; display:flex; flex-direction:column; gap:8px; max-width:360px; margin-left:auto; margin-right:auto; }
.slot-card {
  background: rgba(255,255,255,.04); border:1px solid var(--panel-line);
  border-radius:8px; padding:9px 14px; cursor:pointer;
  display:flex; align-items:center; gap:12px; transition:.15s;
  font-size:12.5px; color: var(--ink-dim); text-align:left;
}
.slot-card:hover { border-color: var(--gold); background: rgba(212,175,116,.08); color:var(--ink); }
.slot-card .sc-rank { color: var(--gold); font-weight:600; white-space:nowrap; }
.slot-card .sc-meta { margin-left:auto; font-family:var(--font-mono); font-size:11px; color:var(--muted); }
.title-footer { margin-top:34px; font-size:11px; color:var(--muted); letter-spacing:.1em; }

/* ---------------- 顶栏 ---------------- */
#topbar {
  position: sticky; top:0; z-index:30;
  display:flex; align-items:center; gap:14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(20,14,10,.98), rgba(20,14,10,.86));
  border-bottom: 1px solid var(--panel-line);
  backdrop-filter: blur(8px);
}
.brand { display:flex; align-items:center; gap:9px; min-width:0; }
.brand-logo {
  width:34px; height:34px; flex:0 0 34px;
  background: linear-gradient(145deg, var(--red), var(--red-deep));
  border-radius:8px; color:#f7ead2; font-family:var(--font-cn); font-weight:900;
  font-size:19px; display:flex; align-items:center; justify-content:center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.brand-name { font-family:var(--font-cn); font-weight:800; letter-spacing:.28em; font-size:17px; color:var(--ink); }
.tb-stats { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:0 auto; font-size:12.5px; }
.tb-chip {
  padding:4px 11px; border-radius:999px;
  border:1px solid var(--panel-line); background:rgba(255,255,255,.04);
  color:var(--ink-dim); white-space:nowrap;
  display:inline-flex; align-items:center; gap:6px;
}
.tb-chip b { color:var(--ink); font-weight:700; }
.tb-chip .c-year { color: var(--gold); font-family: var(--font-mono); }
.tb-chip .c-rank { color:#ffd9a0; }
.tb-actions { display:flex; gap:8px; }
.btn {
  border:1px solid var(--panel-line); background:rgba(255,255,255,.05);
  color:var(--ink); padding:8px 15px; border-radius:8px; cursor:pointer;
  font-size:13.5px; transition:.15s; white-space:nowrap;
}
.btn:hover { border-color:var(--gold); background:rgba(212,175,116,.12); }
.btn.primary { background: linear-gradient(145deg, var(--red), #8c2319); border-color: transparent; color:#fff6e6; font-weight:700; }
.btn.primary:hover { filter:brightness(1.12); }
.btn.ghost { background:transparent; font-size:12.5px; padding:6px 11px; }
.btn.big { padding:12px 18px; font-size:15px; letter-spacing:.12em; }
.btn:disabled { opacity:.4; cursor:not-allowed; }

/* ---------------- 三栏布局 ---------------- */
#layout {
  display:grid;
  grid-template-columns: 250px minmax(0,1fr) 300px;
  gap:14px; padding:14px 16px 60px;
  max-width: 1560px; margin: 0 auto;
}
#left-panel, #right-panel { display:flex; flex-direction:column; gap:14px; min-width:0; }
.panel {
  background: var(--panel);
  border:1px solid var(--panel-line);
  border-radius:12px; padding:14px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-family:var(--font-cn); font-size:12.5px; letter-spacing:.3em;
  color:var(--gold); font-weight:700;
  display:flex; align-items:center; gap:8px; margin-bottom:12px;
}
.panel-title::after { content:''; flex:1; height:1px; background:linear-gradient(90deg,var(--gold),transparent); opacity:.4; }

/* ---------------- 属性条 ---------------- */
.attr-row { margin-bottom:11px; }
.attr-head { display:flex; justify-content:space-between; font-size:12px; margin-bottom:4px; color:var(--ink-dim); }
.attr-head .a-val { font-family:var(--font-mono); color:var(--ink); }
.attr-bar {
  height:9px; background:rgba(0,0,0,.42); border-radius:6px; overflow:hidden;
  border:1px solid rgba(255,255,255,.05);
}
.attr-fill {
  height:100%; border-radius:6px; transition: width .55s cubic-bezier(.2,.7,.3,1), background .4s;
  position:relative;
}
.attr-fill.flash-up { box-shadow: 0 0 10px currentColor; }
.attr-fill.low { opacity:.55; }
.attr-fill.danger { animation: pulse-danger 1s infinite; }
@keyframes pulse-danger { 0%,100%{ filter:brightness(1);} 50%{ filter:brightness(1.35);} }
.risk-hint {
  margin-top:4px; padding:8px 10px; border-radius:8px; font-size:12px;
  background: rgba(176,50,38,.14); color:#ff9d8a; border:1px solid rgba(176,50,38,.5);
  animation: pulse-danger 2s infinite;
}

/* ---------------- 资产 ---------------- */
#asset-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.asset-cell {
  background: rgba(0,0,0,.24); border:1px solid rgba(255,255,255,.05);
  border-radius:9px; padding:8px 10px;
}
.asset-cell .al { font-size:10.5px; color:var(--muted); margin-bottom:3px; letter-spacing:.08em; }
.asset-cell .av { font-family:var(--font-mono); font-size:15px; color:var(--ink); }
.asset-cell .av.gold { color: var(--gold); }
.asset-cell .av.red { color:#ff7a66; }
.asset-cell.wide { grid-column: span 2; }
.asset-note { margin-top:9px; font-size:11px; color:var(--muted); line-height:1.6; }

/* ---------------- 人物卡 ---------------- */
.npc-chip {
  display:flex; align-items:center; gap:9px; padding:7px 9px; margin-bottom:7px;
  background: rgba(0,0,0,.22); border-radius:9px; border:1px solid rgba(255,255,255,.05);
}
.npc-avatar {
  width:30px; height:30px; border-radius:50%; flex:0 0 30px;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-cn); font-weight:700; color:#fff7ea; font-size:14px;
  background: linear-gradient(145deg, #5a4433, #37291e);
}
.npc-info { min-width:0; flex:1; }
.npc-name { font-size:13px; color:var(--ink); }
.npc-role { font-size:10.5px; color:var(--muted); }
.npc-favor { font-family:var(--font-mono); font-size:12px; color:var(--gold); }

/* ---------------- 舞台区 ---------------- */
#stage {
  min-width:0; display:flex; flex-direction:column; gap:12px;
}
#stage-meta {
  font-family: var(--font-mono); font-size:12px; color:var(--muted);
  padding:2px 4px; letter-spacing:.12em;
}
#stage-meta b { color: var(--gold); font-weight:600; }
#event-zone {
  background: var(--panel);
  border:1px solid var(--panel-line); border-radius:16px;
  box-shadow: var(--shadow);
  min-height: 380px;
  display:flex; flex-direction:column;
  padding: 26px 30px 30px;
  position: relative;
}
#event-zone::before {
  content:''; position:absolute; inset:10px; pointer-events:none;
  border:1px solid rgba(212,175,116,.09); border-radius:10px;
}
.ev-meta { display:flex; align-items:center; gap:10px; margin-bottom:14px; }
.ev-tag {
  font-size:11px; padding:3px 10px; border-radius:999px; letter-spacing:.18em;
  color:#fff; font-weight:600;
}
.ev-turn { margin-left:auto; font-family:var(--font-mono); font-size:11px; color:var(--muted); }
.ev-title {
  font-family:var(--font-cn); font-size:clamp(22px,3.4vw,30px); font-weight:800;
  color:var(--ink); margin-bottom:16px; line-height:1.4;
}
.ev-text { font-size:15.5px; line-height:2.0; color:#e6dcc8; margin-bottom:26px; white-space:pre-wrap; }
.ev-options { display:flex; flex-direction:column; gap:11px; margin-top:auto; }
.opt-btn {
  text-align:left; padding:13px 16px; border-radius:10px;
  background: rgba(0,0,0,.26); border:1px solid rgba(255,255,255,.09);
  color:var(--ink); font-size:14px; line-height:1.65; cursor:pointer;
  transition:.16s; position:relative;
}
.opt-btn:hover:not(:disabled) {
  border-color:var(--gold); background: rgba(212,175,116,.1);
  transform: translateX(4px);
}
.opt-btn:disabled { opacity:.55; cursor:not-allowed; }
.opt-btn.chosen { border-color: var(--gold); background: rgba(201,153,46,.16); box-shadow: 0 0 0 1px var(--gold); }
.opt-idx {
  display:inline-flex; align-items:center; justify-content:center;
  width:24px; height:24px; border-radius:6px; margin-right:9px;
  background: rgba(212,175,116,.16); color:var(--gold);
  font-family:var(--font-mono); font-size:12px; flex:0 0 auto;
}
.opt-reason { display:block; margin-top:4px; font-size:11.5px; color:var(--muted); font-style:italic; }

/* 选择后结果 */
.result-box {
  margin-top:8px; padding:16px; border-radius:12px;
  background: linear-gradient(135deg, rgba(176,50,38,.16), rgba(201,153,46,.08));
  border:1px solid rgba(212,175,116,.35);
  font-size:15px; line-height:2.0; color:#f4ead6;
}
.delta-stack { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.delta-pill {
  font-family:var(--font-mono); font-size:12.5px; padding:3px 10px; border-radius:999px;
  background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12);
}
.delta-pill.up { color:#7fe0a0; border-color:rgba(63,157,95,.5); background:rgba(63,157,95,.12); }
.delta-pill.down { color:#ff9380; border-color:rgba(176,50,38,.5); background:rgba(176,50,38,.14); }
.delta-pill.neutral { color:var(--ink-dim); }

#btn-next, .stage-cta {
  margin-top:18px; width:100%; padding:14px; font-size:15px; letter-spacing:.3em;
  background: linear-gradient(145deg, var(--red), var(--red-deep));
  border:none; color:#fff4df; border-radius:10px; cursor:pointer; font-weight:700;
}
#btn-next:hover { filter:brightness(1.14); }

/* 晋升等特殊覆盖 */
.promo-banner {
  text-align:center; padding:34px 20px;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(255,215,140,.14), transparent 70%),
    linear-gradient(160deg, #6e120c, #8c2319);
  border-radius:12px; color:#ffedc9;
}
.promo-banner .pb-kicker { font-size:12px; letter-spacing:.6em; opacity:.85; }
.promo-banner .pb-rank { font-family:var(--font-cn); font-size:clamp(30px,6vw,52px); font-weight:900; margin:12px 0; text-shadow:0 0 30px rgba(255,200,90,.5); }
.promo-banner .pb-sub { font-size:14px; letter-spacing:.2em; opacity:.9; }

/* ---------------- 日志 ---------------- */
#log-panel { max-height: calc(100vh - 100px); display:flex; flex-direction:column; }
#log-list { overflow-y:auto; padding-right:6px; font-size:12.5px; line-height:1.7; }
#log-list::-webkit-scrollbar { width:5px; } #log-list::-webkit-scrollbar-thumb { background:rgba(212,175,116,.3); border-radius:3px; }
.log-item { border-left:2px solid var(--panel-line); padding:5px 0 5px 11px; margin-bottom:9px; color:var(--ink-dim); }
.log-item .li-time { font-family:var(--font-mono); font-size:10.5px; color:var(--muted); display:block; margin-bottom:2px; }
.log-item.work { border-color:var(--blue);} .log-item.life { border-color:var(--green);}
.log-item.risk { border-color:var(--red); color:#ffc2b6;} .log-item.opp { border-color:var(--gold);}
.log-item.promo { border-color:var(--gold); color:#ffe3ae; }
.log-item.crisis { border-color:var(--red); color:#ffb0a2; }
.log-item.career { border-color:var(--muted); }
.log-item.era { border-color:var(--purple); color:#dcc8f2; }

/* ---------------- 模态 ---------------- */
#modal-layer {
  position: fixed; inset:0; z-index:80;
  background: rgba(8,5,3,.74); backdrop-filter: blur(6px);
  display:flex; align-items:center; justify-content:center;
  padding: 18px;
}
.modal {
  background: linear-gradient(180deg, #221a13, #191209);
  border:1px solid var(--panel-line); border-radius:16px;
  box-shadow: var(--shadow); max-width:640px; width:100%;
  max-height:88vh; overflow:auto; padding:26px 28px;
  animation: modal-in .3s ease;
}
.modal.wide { max-width:760px; }
@keyframes modal-in { from{ opacity:0; transform:translateY(14px) scale(.98);} to{opacity:1;transform:none;} }
.modal h2 { font-family:var(--font-cn); color:var(--gold); font-size:20px; letter-spacing:.2em; margin-bottom:16px; display:flex; align-items:center; gap:10px; }
.modal h2::after { content:''; flex:1; height:1px; background:linear-gradient(90deg,var(--gold),transparent); opacity:.4; }
.modal p { font-size:14px; line-height:2.0; color:var(--ink-dim); margin-bottom:12px; }
.modal .actions { display:flex; gap:10px; justify-content:flex-end; margin-top:20px; flex-wrap:wrap; }
.mrow { padding:10px 12px; border-radius:9px; background:rgba(255,255,255,.03); border:1px solid var(--panel-line); margin-bottom:9px; display:flex; align-items:center; gap:12px; }
.mrow .mr-main { flex:1; font-size:13.5px; color:var(--ink); }
.mrow .mr-sub { font-size:11px; color:var(--muted); }
.review-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin:10px 0; }
.review-cell { background:rgba(0,0,0,.25); border:1px solid rgba(255,255,255,.07); border-radius:10px; padding:11px 13px; }
.review-cell .rl { font-size:11px; color:var(--muted); margin-bottom:5px; letter-spacing:.1em; }
.review-cell .rv { font-size:16px; font-weight:700; color:var(--ink); font-family:var(--font-mono); }
.review-cell .rv.good { color:#7fe0a0; } .review-cell .rv.bad { color:#ff9380; }
.badge-rating { display:inline-block; padding:2px 12px; border-radius:999px; font-size:13px; letter-spacing:.2em; font-weight:700; margin-left:6px; }
.badge-excellent { background:rgba(201,153,46,.22); color:#ffd37a; border:1px solid rgba(201,153,46,.6); }
.badge-qualified { background:rgba(63,157,95,.18); color:#8fe6aa; border:1px solid rgba(63,157,95,.5); }
.badge-basic { background:rgba(63,127,174,.18); color:#9ec8e8; border:1px solid rgba(63,127,174,.5); }
.badge-unqualified { background:rgba(176,50,38,.22); color:#ff9380; border:1px solid rgba(176,50,38,.6); }

/* ---------------- 结局屏 ---------------- */
.ending-overlay {
  text-align:center; position:relative;
}
.ending-overlay .e-title { font-family:var(--font-cn); font-size:clamp(38px,8vw,64px); font-weight:900; letter-spacing:.2em; margin:20px 0 8px; }
.ending-overlay .e-tag { font-size:12px; letter-spacing:.4em; color:var(--gold); margin-bottom:22px; }
.ending-overlay .e-desc { font-size:15px; line-height:2.1; color:#e9dfca; max-width:560px; margin:0 auto 22px; }
.e-seal {
  width:86px; height:86px; margin:0 auto 16px; border-radius:12px;
  background: linear-gradient(145deg, #c0392b, #7e1f16);
  border:2px solid rgba(255,220,180,.6);
  color:#ffefd8; font-family:var(--font-cn); font-weight:900;
  display:flex; align-items:center; justify-content:center; font-size:40px;
  box-shadow: 0 0 30px rgba(176,50,38,.6); transform: rotate(-6deg);
}
.ending-stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(120px,1fr)); gap:10px; margin:22px 0; }
.estat { background:rgba(0,0,0,.26); border-radius:10px; padding:11px 8px; border:1px solid rgba(255,255,255,.06); }
.estat .es-v { font-family:var(--font-mono); font-size:18px; color:var(--gold); }
.estat .es-l { font-size:11px; color:var(--muted); margin-top:4px; }
#resume-canvas { width:100%; max-width:360px; border-radius:8px; box-shadow: var(--shadow); margin:10px auto; display:block; }
.top-choice { text-align:left; background:rgba(255,255,255,.04); border:1px solid var(--panel-line); border-radius:9px; padding:9px 13px; margin-bottom:8px; }
.top-choice .tc-ev { font-size:12px; color:var(--muted); font-family:var(--font-mono); margin-bottom:3px; }
.top-choice .tc-opt { font-size:13.5px; color:var(--ink); }

/* ---------------- 暗角 & 崩溃 ---------------- */
#vignette {
  position:fixed; inset:0; pointer-events:none; z-index:20;
  box-shadow: inset 0 0 160px 60px rgba(80,0,0,.55);
  opacity:0; transition: opacity 1s;
}
#vignette.on { opacity:1; }
#crisis-flash {
  position:fixed; inset:0; z-index:50; pointer-events:none;
  background: radial-gradient(700px 400px at 50% 45%, rgba(176,50,38,.0), rgba(120,10,6,.72));
  animation: crisis-in .8s ease;
}
@keyframes crisis-in { 0%{opacity:0;} 30%{opacity:1;} 100%{opacity:.25;} }

/* toast */
#toast {
  position:fixed; left:50%; bottom:28px; transform:translateX(-50%);
  z-index:90; background:#251a12; color:#f0e3cd;
  border:1px solid var(--gold); padding:10px 22px; border-radius:10px;
  font-size:13.5px; box-shadow:var(--shadow); transition: opacity .3s;
  opacity:0; pointer-events:none; max-width:90vw;
}
#toast.show { opacity:1; }

/* 结束屏进度 */
.progress-track { display:flex; align-items:center; gap:0; flex-wrap:wrap; justify-content:center; }
.dot { width:10px; height:10px; border-radius:50%; margin:0 1px; background:#3a2d20; }
.dot.done { background:var(--gold); }
.dot.now { background:var(--red); box-shadow:0 0 8px var(--red); }
.timeline-strip { display:flex; gap:4px; flex-wrap:wrap; justify-content:center; max-width:640px; margin-top:8px; }

/* ================= 移动端 ================= */
@media (max-width: 1100px) {
  #layout { grid-template-columns: 1fr; }
  #left-panel { flex-direction:row; flex-wrap:wrap; }
  #left-panel .panel { flex:1 1 45%; min-width:220px; }
  #right-panel { order: 3; }
  #log-panel { max-height: 320px; }
  .brand-name { display:none; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  #topbar { padding:8px 10px; gap:8px; }
  .tb-stats { gap:6px; font-size:11.5px; }
  .tb-chip { padding:3px 8px; }
  #layout { padding:10px; gap:10px; }
  #event-zone { padding:20px 16px 22px; min-height:0; }
  .ev-text { font-size:14.5px; line-height:1.95; }
  #left-panel .panel { flex:1 1 100%; }
  #modal-layer { padding:10px; }
  .modal { padding:20px 16px; }
}
