/* ===== 诗语堂 · 青绿绢本视觉系统 =====
   绢黄底 #ece3cd / 青 #1f4a3c / 绿 #2c5d4d / 描金 #a8842c / 朱 #a03a2a */

:root {
  --silk: #ece3cd;        /* 绢黄底 */
  --silk-2: #e4d9bd;      /* 绢黄深 */
  --paper: #f6f0df;       /* 卡面 */
  --ink: #2b2a24;         /* 墨 */
  --ink-2: #5a564a;       /* 淡墨 */
  --green: #1f4a3c;       /* 青 */
  --green-2: #2c5d4d;     /* 绿 */
  --gold: #a8842c;        /* 描金 */
  --gold-2: #c9a75c;
  --cinnabar: #a03a2a;    /* 朱砂 */
  --line: #cfc3a2;
  --shadow: 0 2px 14px rgba(60, 50, 25, .12);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
}

* { box-sizing: border-box; margin: 0; }
html { --zoom: 1; scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  color: var(--ink);
  zoom: var(--zoom);
  background:
    radial-gradient(1200px 500px at 85% -5%, rgba(44, 93, 77, .10), transparent 60%),
    radial-gradient(900px 420px at 0% 30%, rgba(168, 132, 44, .07), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(120, 100, 60, .018) 3px 4px),
    var(--silk);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 30px;
  background: rgba(236, 227, 205, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-seal {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--cinnabar); color: #f6ecd8; font-size: 22px;
  border-radius: 8px; box-shadow: inset 0 0 0 2px rgba(246, 236, 216, .5), var(--shadow);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt b { font-size: 19px; letter-spacing: 4px; }
.brand-txt i { font-style: normal; font-size: 9px; letter-spacing: 3px; color: var(--ink-2); }
#topNav { display: flex; gap: 4px; flex: 1; }
#topNav a {
  padding: 8px 16px; border-radius: 20px; font-size: 15px; color: var(--ink-2);
  letter-spacing: 2px; transition: .2s;
}
#topNav a:hover { color: var(--green); background: rgba(44, 93, 77, .08); }
#topNav a.on { color: #f2ecdb; background: var(--green); }
.api-badge {
  font-size: 12px; padding: 5px 12px; border-radius: 14px;
  border: 1px solid var(--line); color: var(--ink-2); letter-spacing: 1px;
}
.api-badge.ok { border-color: var(--green); color: var(--green); background: rgba(44, 93, 77, .08); }

/* 字号调节 */
.font-ctrl { display: flex; align-items: center; gap: 6px; }
.font-ctrl input[type="range"] { width: 90px; accent-color: var(--green); }
.fc-a { font-size: 12px; color: var(--ink-2); }
.fc-a.big { font-size: 18px; color: var(--green); }

#app { max-width: 1240px; margin: 0 auto; padding: 26px 26px 60px; }
.foot { text-align: center; color: var(--ink-2); font-size: 12px; padding: 24px; border-top: 1px solid var(--line); letter-spacing: 1px; }

/* ---------- 通用 ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.pt { font-size: 30px; letter-spacing: 6px; color: var(--green); }
.pt::after { content: ""; display: block; width: 52px; height: 3px; margin-top: 8px; background: linear-gradient(90deg, var(--gold), transparent); }
.ps { color: var(--ink-2); font-size: 14px; margin-top: 10px; max-width: 640px; line-height: 1.7; }
.ph-tags { display: flex; gap: 10px; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
}
.panel::before {
  content: ""; position: absolute; inset: 5px; border: 1px solid rgba(168, 132, 44, .22);
  border-radius: 10px; pointer-events: none;
}
.panel > * { position: relative; }

.ph { font-size: 13px; letter-spacing: 3px; color: var(--green-2); margin: 16px 0 10px; font-weight: 700; }
.ph:first-child { margin-top: 0; }
.ph::before { content: "◈ "; color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 10px 22px; border-radius: 24px; font-size: 14px; letter-spacing: 2px;
  transition: .18s; box-shadow: 0 1px 4px rgba(60,50,25,.08);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(60,50,25,.14); }
.btn.primary { background: var(--green); border-color: var(--green); color: #f2ecdb; }
.btn.primary:hover { background: var(--green-2); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 14px; font-size: 12.5px; }
.btn.lg { padding: 13px 30px; font-size: 15.5px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--cinnabar); border-color: rgba(160, 58, 42, .4); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.empty { color: var(--ink-2); font-size: 13.5px; padding: 14px; text-align: center; letter-spacing: 1px; }
.empty.big { padding: 50px; font-size: 15px; }
.empty.sm { padding: 8px; }
.note { font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.note.sm { font-size: 12px; }

/* ---------- toast ---------- */
#toasts { position: fixed; top: 70px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--green); color: #f2ecdb; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: var(--shadow); animation: tin .25s; max-width: 320px;
}
.toast.warn { background: var(--gold); color: #fff; }
.toast.err { background: var(--cinnabar); }
.toast.out { opacity: 0; transform: translateX(20px); transition: .35s; }
@keyframes tin { from { opacity: 0; transform: translateX(24px); } }

/* ---------- 头像 / 印章 ---------- */
.ava {
  width: 44px; height: 44px; border-radius: 10px; background-size: cover; background-position: top center;
  background-color: var(--silk-2); flex: none; box-shadow: inset 0 0 0 1px rgba(168,132,44,.4);
}
.ava.sm { width: 36px; height: 36px; border-radius: 8px; }
.ava.lg { width: 62px; height: 62px; border-radius: 12px; }
.ava.seal {
  display: grid; place-items: center; background: var(--sealc, var(--green));
  color: #f2ecdb; font-size: 20px; font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(242, 236, 219, .35), 0 2px 6px rgba(50,40,20,.18);
}
.ava.sm.seal { font-size: 16px; }
.ava.lg.seal { font-size: 28px; }

.np b { font-size: 17px; letter-spacing: 2px; }
.np i { font-style: normal; font-size: 12px; color: var(--ink-2); display: block; margin-top: 2px; }

.portrait {
  width: 100%; aspect-ratio: 3/4; border-radius: 12px; background-size: cover; background-position: top center;
}
.portrait.ghost {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: repeating-linear-gradient(45deg, var(--silk-2) 0 12px, #dfd3b2 12px 24px);
  border: 1px dashed var(--gold-2);
}
.pg-seal {
  width: 74px; height: 74px; display: grid; place-items: center; border-radius: 10px;
  background: var(--green); color: #f2ecdb; font-size: 34px; font-weight: 700;
  box-shadow: inset 0 0 0 2.5px rgba(242,236,219,.4);
}
.pg-tip { font-size: 12px; color: var(--ink-2); letter-spacing: 1px; }

/* ---------- 首页 ---------- */
.hero {
  position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 26px;
  background: linear-gradient(180deg, #e9dfc4 0%, #e0d3b0 100%);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  min-height: 460px;
}
.scenery { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 78%; pointer-events: none; }
.hero-inner { position: relative; padding: 64px 56px 130px; text-align: center; }
.hero-seal {
  width: 86px; height: 86px; margin: 0 auto 22px; display: grid; place-items: center;
  background: var(--cinnabar); color: #f6ecd8; font-size: 26px; letter-spacing: 2px;
  border-radius: 14px; box-shadow: inset 0 0 0 2.5px rgba(246,236,216,.45), 0 6px 20px rgba(120, 50, 30, .3);
  writing-mode: vertical-rl;
}
.hero h1 { font-size: 42px; letter-spacing: 10px; color: var(--green); text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.hero p { margin: 18px auto 28px; color: var(--ink-2); font-size: 15.5px; line-height: 1.9; letter-spacing: 1px; }
.hero-acts { display: flex; gap: 14px; justify-content: center; }
.hero-status { margin-top: 20px; font-size: 12.5px; color: var(--gold); letter-spacing: 1px; }
.hero-status.ok { color: var(--green); }
.hero-strip {
  position: absolute; bottom: 18px; left: 0; right: 0; display: flex; gap: 10px;
  justify-content: center; flex-wrap: wrap; z-index: 2;
}
.hs-item .ava { border: 2px solid rgba(242,236,219,.85); transition: .2s; }
.hs-item:hover .ava { transform: translateY(-5px); border-color: var(--gold-2); }

.feat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.feat-card { display: block; transition: .2s; }
.feat-card:hover { transform: translateY(-4px); box-shadow: 0 8px 26px rgba(60,50,25,.18); }
.fc-mark {
  width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px;
  background: rgba(44, 93, 77, .1); color: var(--green); font-size: 22px; margin-bottom: 14px;
  border: 1px solid rgba(44, 93, 77, .25);
}
.feat-card h3 { font-size: 17px; letter-spacing: 3px; margin-bottom: 8px; color: var(--ink); }
.feat-card p { font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.fc-go { display: inline-block; margin-top: 12px; font-size: 12.5px; color: var(--gold); letter-spacing: 2px; }

/* 课文关联 */
.tb-mini .tb-group { margin-bottom: 12px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tb-mini .tb-group > b { font-size: 13px; color: var(--green); letter-spacing: 1px; flex: none; }
.tb-lesson {
  border: 1px solid var(--line); background: transparent; border-radius: 16px;
  padding: 4px 12px; font-size: 12.5px; color: var(--ink-2); transition: .15s;
}
.tb-lesson:hover { border-color: var(--green); color: var(--green); background: rgba(44,93,77,.06); }
.tb-lesson[data-invite=""] { opacity: .55; }
.home-tb { margin-top: 4px; }

/* ---------- 对话页 ---------- */
.chat-layout { display: grid; grid-template-columns: 250px 1fr 240px; gap: 16px; align-items: start; }
.seat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.seat-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--silk);
  cursor: pointer; transition: .15s;
}
.seat-item:hover { border-color: var(--green-2); }
.seat-item.focus { border-color: var(--gold); background: rgba(168,132,44,.1); box-shadow: 0 0 0 1px var(--gold-2); }
.seat-info { flex: 1; min-width: 0; }
.seat-info b { font-size: 14px; display: block; }
.seat-info i { font-style: normal; font-size: 11px; color: var(--ink-2); }
.seat-x { border: 0; background: transparent; color: var(--ink-2); font-size: 17px; padding: 2px 6px; }
.seat-x:hover { color: var(--cinnabar); }

.invite-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.inv {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px;
  border: 1px solid var(--line); border-radius: 10px; background: transparent;
  font-size: 11.5px; color: var(--ink-2); transition: .15s;
}
.inv:hover { border-color: var(--green); color: var(--green); background: rgba(44,93,77,.06); }
.inv .ava { width: 32px; height: 32px; }

.seg.col { display: flex; flex-direction: column; gap: 6px; }
.seg button {
  border: 1px solid var(--line); background: transparent; border-radius: 9px;
  padding: 8px 10px; font-size: 13px; text-align: left; color: var(--ink-2); transition: .15s;
}
.seg button:hover { border-color: var(--green-2); }
.seg button.on { background: var(--green); color: #f2ecdb; border-color: var(--green); }

.quick-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 15px;
  padding: 4px 12px; font-size: 12px; color: var(--ink-2); transition: .15s;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.quick-tags .chip { font-size: 12px; }

.chat-main { display: flex; flex-direction: column; min-height: 560px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 16px; max-height: 58vh; display: flex; flex-direction: column; gap: 14px; }
.chat-empty { margin: auto; text-align: center; color: var(--ink-2); font-size: 13.5px; line-height: 2; }
.ce-art {
  width: 90px; height: 90px; margin: 0 auto 16px; display: grid; place-items: center;
  font-size: 44px; color: rgba(44,93,77,.35); border: 2px solid rgba(44,93,77,.25);
  border-radius: 50%;
}
.msg { display: flex; gap: 10px; animation: mup .25s; }
@keyframes mup { from { opacity: 0; transform: translateY(8px); } }
.msg .ava.seal { background: var(--sealc, var(--green)); }
.bub-wrap { max-width: 76%; }
.m-name { font-size: 11.5px; color: var(--ink-2); margin-bottom: 4px; letter-spacing: 1px; }
.m-name.right { text-align: right; }
.bub {
  background: #fffdf4; border: 1px solid var(--line); border-radius: 2px 12px 12px 12px;
  padding: 10px 14px; font-size: 14.5px; line-height: 1.8; white-space: pre-wrap;
  box-shadow: 0 1px 5px rgba(60,50,25,.07);
}
.msg.me { flex-direction: row-reverse; }
.msg.me .bub-wrap { display: flex; flex-direction: column; align-items: flex-end; }
.bub.me-b { background: var(--green); color: #f2ecdb; border-color: var(--green); border-radius: 12px 2px 12px 12px; }
.me-a { background: var(--gold) !important; }

.thinking { display: flex; align-items: center; gap: 6px; padding: 6px 18px; color: var(--ink-2); font-size: 12.5px; }
.thinking i { font-style: normal; margin-left: 4px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-2); animation: bounce 1s infinite; }
.dot:nth-child(2) { animation-delay: .15s; } .dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,100% { transform: translateY(0); opacity: .4; } 50% { transform: translateY(-5px); opacity: 1; } }

.chat-input-row { display: flex; gap: 10px; padding: 14px 16px 4px; border-top: 1px dashed var(--line); margin-top: 8px; }
#chatInput {
  flex: 1; border: 1px solid var(--line); border-radius: 24px; padding: 11px 18px;
  background: #fffdf4; font-size: 14.5px; outline: none;
}
#chatInput:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(44,93,77,.12); }

.switch { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.switch input { display: none; }
.switch span { width: 34px; height: 18px; background: var(--line); border-radius: 10px; position: relative; transition: .2s; flex: none; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { left: 18px; }

/* 投屏 */
body.projecting .chat-layout { grid-template-columns: 1fr; }
body.projecting .seat-panel, body.projecting .side-panel { display: none; }
body.projecting .bub, body.projecting #chatInput { font-size: 19px; }
body.projecting .m-name { font-size: 13px; }
.exit-proj {
  display: none; position: fixed; bottom: 26px; right: 26px; z-index: 60;
  border: 1px solid var(--gold); background: rgba(236,227,205,.95); color: var(--gold);
  border-radius: 22px; padding: 9px 18px; font-size: 13px; letter-spacing: 2px;
  box-shadow: var(--shadow);
}
.exit-proj:hover { background: var(--gold); color: #fff; }
body.projecting .exit-proj { display: block; }

/* ---------- 角色库 ---------- */
.lib-filter { margin-bottom: 18px; }
.lf-row { display: flex; align-items: baseline; gap: 14px; margin: 8px 0; flex-wrap: wrap; }
.lf-k { font-size: 13px; color: var(--green-2); letter-spacing: 2px; flex: none; width: 36px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip.on { background: var(--green); color: #f2ecdb; border-color: var(--green); }
.kw-input {
  border: 1px solid var(--line); border-radius: 18px; padding: 6px 16px; font-size: 13.5px;
  background: #fffdf4; outline: none; min-width: 260px;
}
.kw-input:focus { border-color: var(--green-2); }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.fig-card {
  display: flex; gap: 14px; align-items: center; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper);
  padding: 14px; transition: .18s; box-shadow: 0 1px 5px rgba(60,50,25,.06);
}
.fig-card:hover { transform: translateY(-3px); border-color: var(--gold-2); box-shadow: 0 6px 18px rgba(60,50,25,.14); }
.fig-card.on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green), 0 6px 18px rgba(44,93,77,.18); }
.fc-info { min-width: 0; }
.fc-info b { font-size: 16px; display: block; letter-spacing: 1px; }
.fc-info .own { font-style: normal; font-size: 10px; color: #fff; background: var(--gold); border-radius: 8px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
.fc-info i { font-style: normal; font-size: 11.5px; color: var(--ink-2); display: block; margin: 3px 0; }
.fc-info span { font-size: 11.5px; color: var(--ink-2); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200; background: rgba(43, 42, 36, .45);
  display: grid; place-items: center; padding: 20px; animation: mup .2s;
}
.modal {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 60px rgba(30, 25, 10, .35); position: relative;
  width: min(560px, 94vw); max-height: 90vh; overflow-y: auto; padding: 26px;
}
.modal::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(168,132,44,.28); border-radius: 12px; pointer-events: none; }
.modal.detail { width: min(860px, 96vw); }
.modal.create.wide { width: min(700px, 96vw); }
.modal-x {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 30px; height: 30px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--silk); font-size: 16px; color: var(--ink-2);
}
.modal-x:hover { color: var(--cinnabar); border-color: var(--cinnabar); }

.modal.detail .d-left { position: relative; }
.d-head { margin-bottom: 10px; }
.d-intro { font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }
.d-lines { display: flex; flex-direction: column; gap: 6px; }
.d-line { font-size: 13.5px; color: var(--green-2); letter-spacing: 1px; }
.d-rel { display: flex; flex-wrap: wrap; gap: 7px; }
.rel-tag {
  border: 1px solid rgba(168,132,44,.5); color: var(--gold); font-size: 12px;
  border-radius: 14px; padding: 3px 11px; cursor: pointer; background: rgba(168,132,44,.07);
}
.rel-tag:hover { background: var(--gold); color: #fff; }
.persona-ro {
  background: var(--silk); border: 1px dashed var(--line); border-radius: 8px;
  padding: 12px; font-size: 12.5px; line-height: 1.9; color: var(--ink-2); white-space: pre-wrap;
}
.persona-ed, .modal textarea, .modal input, .modal select {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-size: 13.5px; background: #fffdf4; outline: none; resize: vertical;
}
.modal textarea:focus, .modal input:focus { border-color: var(--green-2); }
.d-pic-acts { display: flex; gap: 8px; margin: 10px 0; }
.d-pic-acts label.btn { flex: 1; }
.d-acts { display: flex; gap: 10px; margin-top: 10px; }

/* 新建 */
.c-title { font-size: 19px; letter-spacing: 4px; color: var(--green); margin-bottom: 8px; }
.c-sub { font-size: 12.5px; color: var(--ink-2); line-height: 1.8; margin-bottom: 16px; }
.c-form { display: flex; flex-direction: column; gap: 6px; }
.c-form.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.c-form label { font-size: 12px; color: var(--green-2); letter-spacing: 1px; }
.full-l { display: block; font-size: 12px; color: var(--green-2); margin: 10px 0 5px; letter-spacing: 1px; }
.c-acts { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.gen-anim { display: flex; gap: 10px; justify-content: center; padding: 34px 0; }
.gen-anim span { width: 12px; height: 12px; border-radius: 50%; background: var(--green-2); animation: bounce 1.1s infinite; }
.gen-anim span:nth-child(2) { animation-delay: .18s; background: var(--gold); }
.gen-anim span:nth-child(3) { animation-delay: .36s; background: var(--cinnabar); }

/* modal 内 detail 两栏 */
.modal.detail { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
@media (max-width: 760px) { .modal.detail { grid-template-columns: 1fr; } }

/* ---------- 关系网 ---------- */
.net-panel { padding: 14px; }
.net-legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 6px 10px 10px; font-size: 12px; color: var(--ink-2); align-items: center; }
.lg-item { display: flex; align-items: center; gap: 5px; }
.lg-item i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg-tip { color: var(--gold); }
.net-svg { width: 100%; height: auto; display: block; background: radial-gradient(700px 380px at 50% 55%, rgba(44,93,77,.05), transparent 70%); border-radius: 10px; }
.edge { stroke: rgba(90, 86, 74, .28); stroke-width: 1.2; stroke-dasharray: 4 4; transition: .25s; }
.edge.hl { stroke: var(--gold); stroke-width: 2.4; stroke-dasharray: none; }
.edge.dim { opacity: .12; }
.edge-label { font-size: 10.5px; fill: rgba(90,86,74,.55); text-anchor: middle; pointer-events: none; }
.edge-label.hl { fill: var(--gold); font-weight: 700; }
.node { cursor: pointer; transition: .25s; }
.node:hover { transform-box: fill-box; }
.node circle { transition: .25s; }
.node:hover .n-body { filter: brightness(1.2); }
.n-ring { fill: rgba(246, 240, 223, .7); stroke: rgba(168,132,44,.35); }
.n-body { fill: var(--sealc, var(--green)); }
.n-char { fill: #f2ecdb; font-size: 20px; font-weight: 700; text-anchor: middle; }
.n-name { fill: var(--ink); font-size: 12.5px; text-anchor: middle; font-weight: 700; }
.n-dyn { fill: var(--ink-2); font-size: 10px; text-anchor: middle; }
.node.focus .n-ring { stroke: var(--gold); stroke-width: 2.5; fill: rgba(201,167,92,.15); }
.node.dim { opacity: .22; }
.lonely-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 设置 ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col label { display: block; font-size: 12px; color: var(--green-2); margin-bottom: 6px; }
.two-col b { color: var(--gold); }
input[type="range"] { width: 100%; accent-color: var(--green); }
.hint-row { display: flex; justify-content: space-between; align-items: center; margin: 6px 0; }
.hint-link { font-size: 12px; color: var(--gold); }
.hint-link:hover { text-decoration: underline; }
.api-status { margin-top: 14px; font-size: 13px; color: var(--gold); letter-spacing: 1px; }
.api-status.ok { color: var(--green); }
.test-result { margin-top: 8px; }
.tr { font-size: 13px; padding: 10px 14px; border-radius: 8px; line-height: 1.7; word-break: break-all; }
.tr.ok { background: rgba(44,93,77,.09); color: var(--green); }
.tr.err { background: rgba(160,58,42,.09); color: var(--cinnabar); }
.tr.busy { color: var(--ink-2); }
.data-row { display: flex; justify-content: space-between; padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 13.5px; color: var(--ink-2); }
.data-row b { color: var(--ink); }

/* ---------- 规范页 ---------- */
.spec-why { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.sw-mark {
  flex: none; width: 54px; height: 54px; display: grid; place-items: center;
  background: var(--cinnabar); color: #f6ecd8; font-size: 24px; border-radius: 10px;
  box-shadow: inset 0 0 0 2px rgba(246,236,216,.4);
}
.spec-why p { font-size: 14.5px; line-height: 2; color: var(--ink); }
.spec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 18px; }
.spec-card h3 { font-size: 16px; letter-spacing: 3px; color: var(--green); margin: 8px 0 6px; }
.sc-no { position: absolute; top: 14px; right: 18px; font-size: 30px; color: rgba(168,132,44,.25); font-weight: 700; }
.sc-d { font-size: 13px; color: var(--ink-2); line-height: 1.8; margin-bottom: 12px; }
.sc-pair { display: flex; flex-direction: column; gap: 8px; }
.sc-bad, .sc-good { border-radius: 8px; padding: 8px 12px; font-size: 12.5px; line-height: 1.7; }
.sc-bad { background: rgba(160,58,42,.07); border: 1px solid rgba(160,58,42,.2); }
.sc-good { background: rgba(44,93,77,.07); border: 1px solid rgba(44,93,77,.25); }
.sc-bad b { color: var(--cinnabar); margin-right: 8px; }
.sc-good b { color: var(--green); margin-right: 8px; }
.sc-bad span, .sc-good span { color: var(--ink); }
.tmpl-panel { margin-bottom: 18px; }
.tmpl-pre {
  background: var(--silk); border: 1px dashed var(--gold-2); border-radius: 10px;
  padding: 16px; font-family: inherit; font-size: 13.5px; line-height: 2.1;
  white-space: pre-wrap; color: var(--ink);
}
.tmpl-pre.dim { color: var(--ink-2); }
.tips-list { display: flex; flex-direction: column; gap: 10px; }
.tip-row { display: flex; gap: 12px; font-size: 13.5px; line-height: 1.8; }
.tip-row b {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  background: rgba(168,132,44,.14); color: var(--gold); border-radius: 50%; font-size: 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .chat-layout { grid-template-columns: 210px 1fr; }
  .side-panel { display: none; }
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .chat-layout { grid-template-columns: 1fr; }
  #topNav { overflow-x: auto; }
  .hero h1 { font-size: 30px; }
  .hero-inner { padding: 40px 20px 120px; }
}

/* ---------- 背景卡页 ---------- */
.card-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.card-tabs .chip { display: inline-flex; align-items: center; gap: 6px; }
.card-tabs .chip.on { background: var(--green); color: #f2ecdb; border-color: var(--green); }
.tab-x {
  border: 0; background: rgba(255,255,255,.2); color: inherit; border-radius: 50%;
  width: 18px; height: 18px; font-size: 12px; line-height: 1; padding: 0;
}
.tab-x:hover { background: var(--cinnabar); color: #fff; }

.bgcard {
  position: relative; border-radius: 18px; overflow: hidden; margin-bottom: 22px;
  box-shadow: 0 10px 40px rgba(20, 30, 30, .35);
  min-height: 560px; border: 1px solid rgba(255,255,255,.15);
}
.cbg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cbg-custom { position: absolute; inset: 0; background-size: cover; background-position: center; }
.cbg-custom::after, .cbg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,20,25,.25) 0%, rgba(10,20,25,.55) 60%, rgba(10,20,25,.75) 100%);
}
.cb-body { position: relative; z-index: 2; padding: 40px 56px 30px; color: #eef4f2; }
.cb-head { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.cb-seal {
  flex: none; width: 62px; height: 62px; display: grid; place-items: center;
  background: var(--cinnabar); color: #f6ecd8; font-size: 15px; letter-spacing: 2px;
  border-radius: 12px; writing-mode: vertical-rl;
  box-shadow: inset 0 0 0 2px rgba(246,236,216,.4), 0 4px 16px rgba(0,0,0,.4);
}
.cb-title-wrap h1 { font-size: 34px; letter-spacing: 8px; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.cb-title-wrap p { margin-top: 6px; font-size: 13.5px; opacity: .85; letter-spacing: 2px; }
.cb-fields { display: flex; flex-direction: column; gap: 14px; }
.cb-field {
  background: rgba(255, 253, 244, .1); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.18); border-radius: 12px;
  padding: 14px 20px; display: grid; grid-template-columns: 210px 1fr; gap: 16px;
}
.cb-fn b { display: block; font-size: 15px; letter-spacing: 2px; color: var(--cacc, #7fc4c9); }
.cb-fn span { font-size: 11.5px; opacity: .65; display: block; margin-top: 3px; }
.cb-ft { font-size: 13.5px; line-height: 1.95; white-space: pre-wrap; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.cb-foot {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.2);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 11.5px; opacity: .8; letter-spacing: 1px;
}
.cb-review { color: var(--gold-2); }

.card-gen-guide { margin-top: 4px; }
.bgf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.bgf-item { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; }
.bgf-item > b {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center;
  background: rgba(44,93,77,.1); color: var(--green); border-radius: 50%; font-size: 11.5px;
}
.bgf-item b { color: var(--ink); }
.bgf-item div b { display: block; letter-spacing: 1px; }
.bgf-item div span { color: var(--ink-2); font-size: 11.5px; }
.cb-principles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12.5px; color: var(--green-2); }
.cb-principles .warm { color: var(--cinnabar); }

@media (max-width: 860px) {
  .cb-field { grid-template-columns: 1fr; }
  .cb-body { padding: 26px 20px 22px; }
  .bgf-grid, .cb-principles { grid-template-columns: 1fr; }
}

/* 规范页编辑 */
.spec-why-ed, .sc-ed, .sc-ed-t {
  width: 100%; border: 1px solid var(--gold-2); border-radius: 8px; padding: 10px 12px;
  font-family: inherit; font-size: 13.5px; background: #fffdf4; resize: vertical; line-height: 1.8;
}
.sc-ed-t { font-size: 16px; letter-spacing: 2px; font-weight: 700; }
.spec-why.panel { align-items: stretch; }

/* 说话人标识：印章头像 + 名字（不写在正文里） */
.msg .who { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; width: 44px; }
.who-n { font-size: 11px; color: var(--ink-2); letter-spacing: 1px; white-space: nowrap; }
.msg .ava.seal { background: var(--sealc, var(--green)); }
