/* ===========================================================
   style.css —— 面板优先。正文是窄的一列，数据是主屏。
   上一版的教训：180 段正文对 9 个决定，读与做 20:1。
   这一版反过来 —— 数字必须一直在眼前，而且一直在动。
   =========================================================== */

:root {
  --bg:        #0e0f12;
  --bg-2:      #16181d;
  --bg-3:      #1d2027;
  --line:      #2a2e37;
  --text:      #d8d4cc;
  --text-dim:  #7d828c;
  --money:     #d9a441;
  --good:      #5fa87a;
  --bad:       #c25b4e;
  --accent:    #8a9bb8;
  --prose:     #cfc9bd;
}

* { box-sizing: border-box; }

/* hidden 属性会被 display:flex 盖掉 —— 加这一条，否则开场画面一直挂在上面 */
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit; cursor: pointer; color: inherit;
  background: var(--bg-3); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 3px;
  transition: background .12s, border-color .12s;
}
button:hover { background: #262a33; border-color: #3a404b; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--money); color: #17181c; border-color: var(--money); font-weight: 600; }
button.primary:hover { background: #e8b551; }
button.ghost { background: transparent; color: var(--text-dim); }
button.ghost:hover { color: var(--text); }
.dim { color: var(--text-dim); }

input, textarea {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px;
  outline: none; resize: vertical;
}
input:focus, textarea:focus { border-color: #3f4653; }

/* ===================== 开局 ===================== */
#chargen {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.cg-box { width: 100%; max-width: 620px; }
.cg-box h1 {
  font-size: 30px; letter-spacing: .22em; margin: 0 0 18px;
  font-weight: 500; color: #e6e1d6;
}
.cg-lead { margin: 0 0 10px; color: var(--text); }
.cg-lead.dim { color: var(--text-dim); font-size: 13px; }
.cg-row { display: flex; gap: 18px; margin: 22px 0 14px; }
.cg-row label { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 13px; }
.cg-row input { width: 100px; }
.cg-label { display: block; margin: 18px 0 8px; color: var(--text-dim); font-size: 13px; }
#cg-bg { width: 100%; line-height: 1.7; }
.cg-presets { margin: 12px 0 22px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.cg-presets-label { color: var(--text-dim); font-size: 12px; width: 100%; margin-bottom: 2px; }
.chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: transparent; color: var(--text-dim); border-color: var(--line);
}
.chip:hover { color: var(--text); border-color: #3f4653; background: transparent; }
.cg-actions { display: flex; align-items: center; gap: 14px; }
.cg-note { font-size: 12px; margin-top: 16px; }

/* ===================== 游戏 ===================== */
#game { height: 100%; display: flex; flex-direction: column; }

#hud {
  display: flex; align-items: center; gap: 26px;
  padding: 10px 18px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); flex: 0 0 auto;
}
.hud-clock { display: flex; flex-direction: column; line-height: 1.25; min-width: 110px; }
#hud-date { font-size: 16px; letter-spacing: .04em; }
.hud-money { display: flex; align-items: baseline; gap: 8px; }
.hud-money .label { color: var(--text-dim); font-size: 12px; }
#hud-cash {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 21px; font-weight: 600; color: var(--money);
  font-variant-numeric: tabular-nums;
}
#hud-cash.up { animation: flash-good .9s ease-out; }
#hud-cash.down { animation: flash-bad .9s ease-out; }
@keyframes flash-good { 0% { color: #9ee0b4; transform: scale(1.13); } 100% { color: var(--money); } }
@keyframes flash-bad  { 0% { color: #ff8b78; transform: scale(1.13); } 100% { color: var(--money); } }

.hud-stats { display: flex; gap: 16px; }
.stat { display: flex; align-items: baseline; gap: 5px; }
.stat i { font-style: normal; color: var(--text-dim); font-size: 12px; }
.stat b {
  font-family: ui-monospace, Menlo, monospace; font-weight: 500;
  font-variant-numeric: tabular-nums; font-size: 14px;
}
.hud-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
#model-status { font-size: 12px; }
#model-status.on { color: var(--good); }
#model-status.off { color: var(--bad); }

#cols { flex: 1 1 auto; display: flex; min-height: 0; }

/* ---------- 正文 ---------- */
#stream { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
#prose {
  flex: 1 1 auto; overflow-y: auto; padding: 30px clamp(20px, 7vw, 90px) 10px;
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 16.5px; line-height: 2.0; color: var(--prose);
}
#prose p { margin: 0 0 1.15em; }
#prose p.echo {
  font-family: -apple-system, "PingFang SC", sans-serif;
  font-size: 13.5px; color: var(--accent); line-height: 1.6;
  border-left: 2px solid #2f3644; padding-left: 12px; margin-bottom: 1.4em;
}
#prose p.sys {
  font-family: -apple-system, "PingFang SC", sans-serif;
  font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
#prose p.sys.bad { color: var(--bad); }
#prose p.rule { border: 0; border-top: 1px solid var(--line); height: 0; margin: 1.6em 0; }
#prose strong { color: #f0e9da; font-weight: 600; }
#prose .cursor::after {
  content: "▍"; color: var(--accent); animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 输入 ---------- */
#composer {
  flex: 0 0 auto; padding: 12px clamp(20px, 7vw, 90px) 20px;
  border-top: 1px solid var(--line); background: var(--bg-2);
}
#input { width: 100%; line-height: 1.6; }
#composer-actions { display: flex; gap: 8px; margin-top: 9px; }
#btn-send { margin-left: auto; min-width: 88px; }
#hints { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
#hints .hint-label { font-size: 12px; color: #565c66; }
#hints .chip { font-size: 12px; }

/* ---------- 面板 ---------- */
#panels {
  flex: 0 0 400px; border-left: 1px solid var(--line);
  background: var(--bg-2); display: flex; flex-direction: column; min-height: 0;
}
#tabs { display: flex; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
#tabs button {
  flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; color: var(--text-dim); font-size: 13px; padding: 11px 4px;
}
#tabs button:hover { background: #1a1d23; color: var(--text); }
#tabs button.on { color: var(--text); border-bottom-color: var(--money); }
#tabs em {
  font-style: normal; font-size: 11px; color: var(--text-dim);
  font-family: ui-monospace, Menlo, monospace; margin-left: 3px;
}
#tab-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 30px; }

.row {
  border: 1px solid var(--line); border-radius: 4px;
  padding: 10px 12px; margin-bottom: 9px; background: var(--bg-3);
}
.row-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.row-name { font-weight: 600; color: #e4dfd4; }
.row-sub { font-size: 12px; color: var(--text-dim); margin-left: auto; text-align: right; }
.row-meta { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.row-meta b { color: #b9c2d0; font-weight: 500; }

.bar { height: 3px; background: #262a33; border-radius: 2px; margin: 7px 0 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.bar.favor > i { background: var(--money); }
.bar.danger > i { background: var(--bad); }

.favor-pos { color: var(--good); font-family: ui-monospace, Menlo, monospace; }
.favor-neg { color: var(--bad); font-family: ui-monospace, Menlo, monospace; }
.favor-zero { color: var(--text-dim); font-family: ui-monospace, Menlo, monospace; }

.num { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

.empty { color: var(--text-dim); font-size: 13px; padding: 22px 4px; text-align: center; line-height: 1.8; }

.mem-item { padding: 8px 0; border-bottom: 1px solid #20232a; font-size: 13px; line-height: 1.6; }
.mem-item:last-child { border-bottom: 0; }
.mem-at { color: var(--text-dim); font-size: 11.5px; font-family: ui-monospace, Menlo, monospace; margin-right: 7px; }
.mem-kind {
  font-size: 10.5px; padding: 1px 5px; border-radius: 2px; margin-right: 6px;
  background: #262a33; color: #98a0ad; vertical-align: 1px;
}
.mem-kind.deal { background: #2b3529; color: #8fc08a; }
.mem-kind.loss { background: #3a2a28; color: #d68b7d; }
.mem-kind.gain { background: #2b3529; color: #8fc08a; }
.mem-kind.threat { background: #3a2a28; color: #d68b7d; }
.mem-kind.person { background: #2c3140; color: #9aa8c4; }
.mem-kind.promise { background: #38322a; color: #d0b078; }

section-title { display: block; }
.panel-title {
  font-size: 12px; color: var(--text-dim); letter-spacing: .1em;
  margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.panel-title:first-child { margin-top: 0; }
.iou { border-left: 2px solid var(--money); padding-left: 10px; margin-bottom: 10px; font-size: 13px; line-height: 1.6; }
.debt { border-left: 2px solid var(--bad); padding-left: 10px; margin-bottom: 10px; font-size: 13px; line-height: 1.6; }
.iou .why, .debt .why { color: var(--text-dim); font-size: 12px; display: block; margin-top: 3px; }

.asset-value { font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.asset-value.up { color: var(--good); }
.asset-value.down { color: var(--bad); }
.liquid { font-size: 11.5px; color: var(--text-dim); }

#toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #24272f; border: 1px solid var(--line); color: var(--text);
  padding: 9px 18px; border-radius: 4px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 70vw;
}
#toast.show { opacity: 1; }

@media (max-width: 980px) {
  #cols { flex-direction: column; }
  #panels { flex: 0 0 46vh; border-left: 0; border-top: 1px solid var(--line); }
  #hud { flex-wrap: wrap; gap: 14px 20px; }
}

/* 卡住了的提示：导航上顶一个点，否则玩家不会去翻那一栏 */
#tabs button.alert::after {
  content: ''; display: inline-block; width: 5px; height: 5px;
  border-radius: 50%; background: var(--bad); margin-left: 5px; vertical-align: 2px;
}


/* ===================== 登录 ===================== */
.login-box input { width: 100%; }
.login-box .cg-actions { margin-top: 22px; }
#login-status.bad { color: var(--bad); }

.hud-user {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  color: var(--text-dim); max-width: 14ch; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ===================== 账号管理 ===================== */
.admin-form { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.admin-form input { flex: 1 1 110px; min-width: 0; font-size: 13px; }
.admin-form select { font: inherit; font-size: 13px; padding: 6px 8px;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line); border-radius: 3px; }
.admin-row { display: flex; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 1px solid #20232a; font-size: 13px; }
.admin-row:last-child { border-bottom: 0; }
.admin-row .who { flex: 1 1 auto; min-width: 0; }
.admin-row .who b { color: #e4dfd4; }
.admin-row .who span { display: block; color: var(--text-dim); font-size: 11.5px;
  font-family: ui-monospace, Menlo, monospace; }
.admin-row .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 2px;
  background: #2c3140; color: #9aa8c4; }
.admin-row .tag.admin { background: #38322a; color: var(--money); }
.admin-row .tag.off { background: #3a2a28; color: #d68b7d; }
.admin-row button { padding: 3px 9px; font-size: 12px; }
