/* DeepTalk — 暖纸·朱砂·墨 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --paper: #f6f3ec; --paper2: #f1ece0; --panel: #fdfcf8; --line: #e3ddd0; --line2: #ece7db;
  --ink: #28251f; --ink2: #57523f; --dim: #968f7d; --cin: #b3402a; --cin-soft: #f6e3dc;
  --chip: #f1ede3; --ok: #4a7350; --warn: #b3402a; --rel: #38618f;
  --serif: "Noto Serif SC", "Songti SC", Georgia, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, sans-serif;
}
html, body { height: 100%; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 14px; }
.hidden { display: none !important; }
.err { color: #9c3030; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8d1c0; border-radius: 8px; }

#app { display: flex; height: 100vh; }

/* ---------- 话题侧栏 ---------- */
#sidebar {
  width: 210px; flex-shrink: 0; display: flex; flex-direction: column; padding: 18px 12px 12px;
  background: linear-gradient(180deg, #efe9dd, #ebe4d5); border-right: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: .02em; padding: 2px 6px 14px; }
.brand-dot { display: inline-block; width: 7px; height: 7px; background: var(--cin); border-radius: 2px; transform: rotate(45deg); margin-left: 6px; vertical-align: 2px; }
#btn-new { border: 1px dashed #c9c0aa; background: none; color: var(--ink2); border-radius: 9px; padding: 8px; cursor: pointer; font-size: 13px; margin-bottom: 12px; transition: all .15s; }
#btn-new:hover { border-color: var(--cin); color: var(--cin); }
#topic-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.topic { border-radius: 9px; padding: 9px 11px; cursor: pointer; position: relative; border: 1px solid transparent; transition: all .15s; }
.topic:hover { background: rgba(253,252,248,.6); }
.topic.active { background: var(--panel); border-color: var(--line); }
.topic .t { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 14px; }
.topic .del { position: absolute; top: 8px; right: 7px; border: none; background: none; color: var(--dim); cursor: pointer; font-size: 11px; display: none; }
.topic:hover .del { display: block; }
.topic .del:hover { color: var(--cin); }
.account { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 6px 8px; margin-top: 6px; border-top: 1px solid var(--line); font-size: 12px; }
.acc-name { color: var(--ink2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-links { color: var(--dim); white-space: nowrap; flex-shrink: 0; }
.acc-links a { color: var(--dim); }
.acc-links a:hover { color: var(--cin); }
.sb-foot { font-size: 11px; color: #a59d88; padding: 8px 6px 0; line-height: 1.6; }

/* ---------- 深潭 ---------- */
#pool { flex: 1; position: relative; min-width: 0; overflow: hidden; background:
  radial-gradient(1200px 700px at 50% 20%, #fbf8f1, var(--paper)); }
#ink { position: absolute; inset: 0; width: 100%; height: 100%; filter: blur(14px); opacity: .9; transition: opacity .6s; }
#pool.thinking #ink { opacity: 1; }
#stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 18px; }
.pool-hint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; transition: opacity .5s; pointer-events: none; }
.pool-hint.gone { opacity: 0; }
.ph-title { font-family: var(--serif); font-size: 26px; color: var(--ink2); letter-spacing: .1em; }
.ph-title::after { content: ""; display: block; width: 30px; height: 2px; background: var(--cin); margin: 12px auto 0; }
.ph-sub { color: var(--dim); font-size: 13px; }
.pool-legend { position: absolute; bottom: 14px; left: 16px; display: flex; flex-wrap: wrap; gap: 13px; font-size: 11.5px; color: var(--dim); opacity: 0; transition: opacity .4s; z-index: 6; pointer-events: none; }
.pool-legend.show { opacity: 1; }
.pool-legend span { display: flex; align-items: center; gap: 5px; }
.lg { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.lg.claim { background: radial-gradient(circle, rgba(120,72,40,.75), transparent 72%); }
.lg.concept { background: radial-gradient(circle, rgba(179,76,50,.65), transparent 72%); }
.lg.question { background: radial-gradient(circle, rgba(166,132,78,.5), transparent 72%); box-shadow: 0 0 0 1px rgba(166,132,78,.5) inset; }
.lg.tension { background: #b3402a; }

/* 视觉动画样式由 visuals.js 自注入（app/落地页通用） */
/* 节点详情抽屉 */
.node-detail {
  position: absolute; top: 0; right: 0; bottom: 0; width: 340px; max-width: 80%;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -16px 0 40px -30px rgba(60,45,15,.5);
  transform: translateX(100%); transition: transform .32s cubic-bezier(.2,.8,.3,1); z-index: 8;
  display: flex; flex-direction: column; padding: 0;
}
.node-detail.open { transform: none; }
.nd-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.nd-title { font-family: var(--serif); font-weight: 700; font-size: 18px; }
#nd-close { border: none; background: none; cursor: pointer; color: var(--dim); font-size: 15px; }
#nd-close:hover { color: var(--cin); }
.nd-essence { padding: 0 18px 10px; color: var(--ink2); font-size: 13.5px; line-height: 1.6; }
.nd-ann { padding: 0 18px; }
.nd-body { padding: 12px 18px 24px; overflow-y: auto; font-size: 14px; line-height: 1.75; }
.actnote { font-size: 12px; color: var(--dim); margin-top: 6px; letter-spacing: .02em; }
/* 管理员只读查看 */
body.view-only #composer { display: none; }
body.view-only #chat::after { content: "只读 · 管理员查看模式"; display: block; text-align: center; font-size: 11px; color: var(--dim); padding: 10px; border-top: 1px solid var(--line2); letter-spacing: .1em; }
body.view-only .account .acc-name { color: var(--cin); }

/* ---------- 对话 ---------- */
#chat { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -12px 0 30px -26px rgba(60,45,15,.4); }
#chat-log { flex: 1; overflow-y: auto; padding: 22px 18px 8px; }
.turn { margin-bottom: 20px; }
.msg.user { margin-left: auto; background: var(--ink); color: #f3f0e8; border-radius: 14px 14px 4px 14px;
  padding: 9px 14px; width: fit-content; max-width: 86%; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }
.msg.ai { line-height: 1.72; }
.msg.ai .fast { animation: vrise .3s ease; }
.msg.ai .fast > :first-child { margin-top: 0; }
.deep { margin-top: 11px; padding: 10px 13px; border-left: 2px solid var(--cin); background: linear-gradient(100deg, #fbf5ee, #faf3ea);
  border-radius: 3px 10px 10px 3px; font-size: 13.5px; }
.deep.landed { animation: deepunfurl .55s cubic-bezier(.2,.8,.3,1); }
@keyframes deepunfurl { from { opacity: 0; transform: translateY(-4px); max-height: 0; } to { opacity: 1; transform: none; } }
.deep.pending { background: none; border-left-color: var(--line); padding: 4px 13px; }
.deepening { color: var(--dim); font-size: 12.5px; }
.deepening::after { content: "···"; animation: dots 1.3s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "·"; } 50% { content: "··"; } 75% { content: "···"; } }
.dl { padding: 5px 0; display: block; color: var(--ink2); line-height: 1.65; }
.dtag { display: inline-block; font-size: 11px; padding: 1.5px 8px; border-radius: 6px; margin-right: 8px; font-weight: 600; vertical-align: 1.5px; letter-spacing: .02em; }
.dl.warn .dtag { background: #f7e0d8; color: #a33f22; }
.dl.ok .dtag { background: #e6efe6; color: #4a7350; }
.dl.rel .dtag { background: #e3ebf4; color: #38618f; }
.dl.eg .dtag { background: #f0ebde; color: #7a6a4a; }
.deep code { background: var(--chip); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.msg.ai p { margin: 0 0 8px; } .msg.ai ul, .msg.ai ol { margin: 0 0 8px; padding-left: 20px; }
.msg.ai strong { color: var(--ink); } .msg.ai code { background: var(--chip); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.typing { color: var(--dim); font-size: 12px; }
.typing::after { content: "···"; animation: dots 1.3s steps(4) infinite; }

#composer { display: flex; gap: 8px; align-items: flex-end; padding: 12px 14px 16px; border-top: 1px solid var(--line2); }
#chat-input { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; font: inherit; line-height: 1.5; outline: none; background: #fff; max-height: 140px; transition: border-color .15s; }
#chat-input:focus { border-color: #c4ab9d; }
#btn-voice, #btn-send { flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; cursor: pointer; border: 1px solid var(--line); background: #fff; font-size: 16px; transition: all .15s; display: flex; align-items: center; justify-content: center; }
#btn-voice { color: var(--ink2); }
#btn-voice:hover { border-color: var(--cin); color: var(--cin); }
#btn-voice.on { background: var(--cin); border-color: var(--cin); color: #fff; animation: pulse 1s ease infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(179,64,42,.15); } }
#btn-send { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }
#btn-send:hover { background: var(--cin); border-color: var(--cin); }
#btn-send:disabled { opacity: .4; cursor: default; }
.voice-hint { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); font-size: 12px; padding: 6px 14px; border-radius: 10px; }

/* ---------- setup ---------- */
.modal { position: fixed; inset: 0; background: rgba(44,39,28,.45); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--panel); border-radius: 14px; padding: 26px; width: min(440px, 92vw); display: flex; flex-direction: column; gap: 12px; }
.modal-box h3 { font-family: var(--serif); }
.modal-box p { color: var(--ink2); font-size: 13px; line-height: 1.6; }
.modal-box input { border: 1px solid var(--line); border-radius: 9px; padding: 11px; font: inherit; }
.modal-box button { background: var(--ink); color: var(--paper); border: none; border-radius: 9px; padding: 11px; cursor: pointer; font-size: 14px; }
.modal-box button:hover { background: var(--cin); }

@media (max-width: 960px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; flex-direction: row; align-items: center; gap: 8px; padding: 10px; }
  #topic-list { flex-direction: row; } .sb-foot { display: none; }
  #pool { min-height: 38vh; } #chat { width: 100%; height: 50vh; }
}
