/* ═══════════════════════════════════════════════
   角色扮演 · 完整样式表
   ═══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

/* ── 主题 ── */
body.theme-dark {
  --bg: #15161a; --bg-2: #1b1d23; --bg-3: #22252c; --bg-4: #2a2e37;
  --line: #31353f; --line-2: #3d424e;
  --fg: #e3e5ea; --fg-2: #a8adb8; --fg-3: #6f7480;
  --accent: #7c9cf5; --accent-2: #5a7de0;
  --user: #2f4a86; --npc: #23262e;
  --warn: #e0a34a; --danger: #d9635a; --ok: #5fb98a;
}
body.theme-light {
  --bg: #f4f5f7; --bg-2: #fff; --bg-3: #eef0f4; --bg-4: #e4e7ed;
  --line: #dde1e8; --line-2: #c8cdd6;
  --fg: #2a2d34; --fg-2: #5c626d; --fg-3: #9aa0ab;
  --accent: #4a6fd8; --accent-2: #3a5cc0;
  --user: #dce6ff; --npc: #fff;
  --warn: #c98a1e; --danger: #c05048; --ok: #3d9b6d;
}

body {
  background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
  display: flex; flex-direction: column;
}

button {
  font: inherit; color: inherit; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 12px;
  transition: all .14s;
}
button:hover:not(:disabled) { background: var(--bg-4); border-color: var(--line-2); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--accent-2); }
button.ghost { background: transparent; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
button.mini { padding: 3px 9px; font-size: 12px; border-radius: 6px; }

input, textarea, select {
  font: inherit; color: inherit; width: 100%;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.65; }
.scroll { overflow-y: auto; }
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.grow { flex: 1; }
.empty { color: var(--fg-3); text-align: center; padding: 40px 20px; font-style: italic; font-size: 13px; }
code { background: var(--bg-3); padding: 1px 6px; border-radius: 4px; font-family: Consolas, Monaco, monospace; font-size: 12px; }

/* ══════════ 顶栏 ══════════ */
#topbar {
  flex: 0 0 auto; height: 48px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  z-index: 20; overflow-x: auto;
}
#topbar::-webkit-scrollbar { display: none; }
#topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 600; flex: 0 0 auto; }
#topbar .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
#topbar .brand em { font-style: normal; font-size: 11px; color: var(--fg-3); opacity: .7; }
#topbar nav { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }
#topbar nav button { padding: 5px 11px; font-size: 13px; white-space: nowrap; }

/* ══════════ 主布局 ══════════ */
#main {
  flex: 1; min-height: 0;
  display: flex; overflow: hidden;
}
#chatPane {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
#chatList {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 20px 0 8px;
}

/* ══════════ 楼层 ══════════ */
.msg {
  max-width: 820px; margin: 0 auto 16px;
  padding: 0 20px; display: flex; gap: 12px;
}
.msg .avatar {
  flex: 0 0 34px; height: 34px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--bg-4); color: var(--fg-2);
  user-select: none;
}
.msg .body { flex: 1; min-width: 0; }
.msg .meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--fg-3); margin-bottom: 4px;
}
.msg .meta .name { font-weight: 600; color: var(--fg-2); }
.msg .meta .floor {
  font-size: 11px; padding: 0 5px; border-radius: 4px;
  background: var(--bg-3); color: var(--fg-3);
}
.msg .content {
  background: var(--npc); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 15px;
  word-break: break-word; line-height: 1.75;
}
.msg.user .avatar { background: var(--user); color: #fff; }
.msg.user .content { background: var(--user); border-color: transparent; }
body.theme-light .msg.user .content { color: #1a2740; }
.msg.sys .content { background: transparent; border-style: dashed; color: var(--fg-3); font-size: 13px; }
.msg.streaming .content::after {
  content: '▍'; animation: blink 1s steps(2) infinite;
  color: var(--accent); margin-left: 2px;
}
@keyframes blink { 0%,50% { opacity: 1 } 51%,100% { opacity: 0 } }
.msg .tools { display: flex; gap: 4px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .tools { opacity: 1; }
.msg .tools button {
  padding: 3px 9px; font-size: 11.5px;
  background: transparent; border-color: transparent; color: var(--fg-3);
}
.msg .tools button:hover { background: var(--bg-3); color: var(--fg); border-color: var(--line); }
.msg .tools button.ok { background: var(--ok); color: #fff; border-color: var(--ok); }

/* ══════════ 输入区 ══════════ */
#composer { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--bg-2); padding: 8px 20px 14px; }
.composer-tools {
  max-width: 820px; margin: 0 auto 8px;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--fg-3);
}
.composer-tools button {
  padding: 3px 9px; font-size: 12px;
  background: transparent; border-color: transparent; color: var(--fg-3);
}
.composer-tools button:hover:not(:disabled) { background: var(--bg-3); color: var(--fg); border-color: var(--line); }
.composer-row { max-width: 820px; margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.composer-row textarea { flex: 1; min-height: 52px; max-height: 240px; }
.composer-btns { display: flex; flex-direction: column; gap: 6px; }
.composer-btns button { min-width: 76px; }

/* ── 快捷输入栏 ── */
.rp-quick-bar {
  max-width: 820px; margin: 0 auto 8px;
  display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 0;
}
.rp-quick-btn {
  padding: 4px 11px; font-size: 11.5px; font-weight: 600;
  border-radius: 14px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--fg-2); white-space: nowrap;
  transition: all .14s;
}
.rp-quick-btn:hover {
  background: var(--accent); border-color: var(--accent); color: #fff;
  transform: translateY(-1px); box-shadow: 0 3px 10px rgba(124,156,245,.35);
}
.rp-quick-btn:active { transform: translateY(0) scale(.96); }

/* ══════════ 状态栏侧栏 ══════════ */
#rpSidebar {
  flex: 0 0 300px; max-width: 300px; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg-2); border-left: 1px solid var(--line);
  min-height: 0;
}
.rp-side-head {
  flex: 0 0 auto; height: 44px; padding: 0 12px 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--fg-2);
}
.rp-side-head-btns { display: flex; gap: 3px; }
.rp-side-head-btns .mini {
  padding: 3px 8px; font-size: 11px; border-radius: 6px;
  background: transparent; border-color: transparent; color: var(--fg-3);
}
.rp-side-head-btns .mini:hover { background: var(--bg-4); color: var(--fg); border-color: var(--line); }
.rp-side-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 6px;
}
.rp-side-empty {
  color: var(--fg-3); font-size: 12px; line-height: 1.85;
  padding: 36px 14px; text-align: center;
}
.rp-side-empty-icon {
  font-size: 36px; opacity: .35; margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
.rp-side-foot {
  flex: 0 0 auto; padding: 8px 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--fg-3);
}
.rp-side-foot b { color: var(--fg-2); }

/* ── 角色卡片 ── */
.rp-char-card {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 8px; overflow: hidden;
  transition: border-color .2s, box-shadow .25s;
  animation: cardIn .3s ease-out;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(6px) scale(.98) } to { opacity: 1; transform: none } }
.rp-char-card:hover { border-color: var(--line-2); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.rp-char-card.expanded {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 6px 20px rgba(124,156,245,.15);
}
.rp-char-card.flash { animation: cardFlash 1.2s ease-out; }
@keyframes cardFlash {
  0% { box-shadow: 0 0 0 0 rgba(124,156,245,.8) }
  40% { box-shadow: 0 0 0 8px rgba(124,156,245,0), 0 0 24px rgba(124,156,245,.5) }
  100% { box-shadow: 0 0 0 0 rgba(124,156,245,0) }
}
.rp-char-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; user-select: none;
  transition: background .15s;
}
.rp-char-head:hover { background: var(--bg-4); }
.rp-char-card.expanded .rp-char-head {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-4), transparent);
}
.rp-char-avatar {
  flex: 0 0 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #7c9cf5, #5a7de0);
  box-shadow: 0 2px 6px rgba(90,125,224,.35);
  transition: transform .2s;
}
.rp-char-card:hover .rp-char-avatar { transform: scale(1.08) rotate(-3deg); }
.rp-char-info { flex: 1; min-width: 0; }
.rp-char-name {
  font-weight: 600; font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rp-char-summary {
  font-size: 11px; color: var(--fg-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rp-char-count {
  flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700;
  background: var(--bg-4); color: var(--fg-3);
  border: 1px solid var(--line); transition: all .2s;
}
.rp-char-card.expanded .rp-char-count { background: var(--accent); color: #fff; border-color: var(--accent); }
.rp-char-del {
  flex: 0 0 auto; width: 22px; height: 22px; padding: 0;
  background: transparent; border: none; color: var(--fg-3);
  font-size: 12px; border-radius: 6px; opacity: 0; transition: all .18s;
}
.rp-char-head:hover .rp-char-del { opacity: .6; }
.rp-char-del:hover { background: var(--danger); color: #fff; opacity: 1 !important; }

/* ── 展开动画 ── */
.rp-char-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .32s cubic-bezier(.4,0,.2,1);
}
.rp-char-card.expanded .rp-char-body { grid-template-rows: 1fr; }
.rp-char-body-inner { overflow: hidden; min-height: 0; }
.rp-char-body-inner > * {
  opacity: 0; transform: translateY(-6px);
  transition: opacity .25s .08s, transform .25s .08s;
}
.rp-char-card.expanded .rp-char-body-inner > * { opacity: 1; transform: none; }

.rp-char-group { padding: 8px 12px 6px; border-bottom: 1px dashed rgba(255,255,255,.05); }
.rp-char-group:last-child { border-bottom: none; padding-bottom: 10px; }
.rp-char-group-name {
  font-size: 10.5px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.rp-char-group-name::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent); opacity: .35;
}
.rp-char-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.7; padding: 3px 0; align-items: baseline; }
.rp-char-k {
  flex: 0 0 68px; color: var(--fg-3); font-size: 11.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rp-char-v { flex: 1; color: var(--fg); word-break: break-word; font-size: 12.5px; }

/* ══════════ 模态框 ══════════ */
.rp-modal-mask {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.rp-modal {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  display: flex; flex-direction: column; overflow: hidden; max-height: 92vh;
}
.rp-modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.rp-modal-title { font-weight: 600; font-size: 15px; }
.rp-modal-close {
  background: transparent; border: none; color: var(--fg-3);
  font-size: 16px; padding: 4px 8px; border-radius: 6px;
}
.rp-modal-close:hover { background: var(--bg-3); color: var(--fg); }
.rp-modal-body { padding: 16px 18px; overflow-y: auto; min-height: 0; flex: 1; }

.tabs { display: flex; gap: 4px; padding: 0 18px; background: var(--bg-2); flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.tabs button {
  background: transparent; border: none;
  border-bottom: 2px solid transparent; border-radius: 0;
  padding: 10px 14px; font-size: 13px; color: var(--fg-3);
}
.tabs button:hover { background: transparent; color: var(--fg-2); border-bottom-color: var(--line-2); }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-2); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--fg-3); margin-top: 4px; line-height: 1.6; }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; margin-bottom: 0; }

/* ══════════ 世界 / 预设 / 世界书 / 记忆 / 插件 ══════════ */
.rp-world-cat { margin-bottom: 20px; }
.rp-world-cat-head { font-size: 12px; font-weight: 700; color: var(--fg-3); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; }
.rp-world-cat-head em { font-style: normal; font-weight: 400; opacity: .6; }
.rp-world-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.rp-world-card {
  position: relative; background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px 32px; cursor: pointer; transition: all .14s;
}
.rp-world-card:hover { border-color: var(--accent); background: var(--bg-4); transform: translateY(-2px); }
.rp-world-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.rp-world-icon { font-size: 24px; line-height: 1; margin-bottom: 7px; }
.rp-world-name { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.rp-world-tag { font-size: 11px; color: var(--fg-3); line-height: 1.5; }
.rp-world-current { position: absolute; top: 8px; right: 8px; font-size: 10px; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 6px; }
.rp-world-acts { position: absolute; bottom: 6px; right: 6px; display: flex; gap: 2px; opacity: 0; transition: opacity .14s; }
.rp-world-card:hover .rp-world-acts { opacity: 1; }
.rp-world-acts button { padding: 2px 7px; font-size: 11px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 5px; color: var(--fg-3); }
.rp-world-acts button:hover { background: var(--bg-4); color: var(--fg); }
.rp-world-acts button[data-act="del"]:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.rp-rule-item { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 10px; border-left: 3px solid var(--accent); }
.rp-rule-item.off { border-left-color: var(--fg-3); opacity: .55; }
.rp-rule-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.rp-switch { display: flex; align-items: center; cursor: pointer; }
.rp-switch input { width: auto; accent-color: var(--accent); }
.rp-rule-title { flex: 1; font-size: 13px; padding: 5px 9px; }
.rp-rule-btn { padding: 3px 8px; font-size: 11.5px; background: var(--bg-4); border: 1px solid var(--line); border-radius: 6px; color: var(--fg-3); min-width: 26px; }
.rp-rule-btn:hover:not(:disabled) { background: var(--bg-2); color: var(--fg); }
.rp-rule-btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.rp-rule-content { width: 100%; font-size: 12.5px; line-height: 1.65; padding: 8px 10px; }

.rp-field-group { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 10px; }
.rp-field-group-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.rp-field-group-name { flex: 1; font-size: 13px; font-weight: 600; padding: 5px 9px; }
.rp-field-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.rp-field-chip { display: inline-flex; align-items: center; gap: 3px; padding: 3px 4px 3px 9px; background: var(--bg-4); border: 1px solid var(--line); border-radius: 14px; font-size: 11.5px; color: var(--fg-2); cursor: pointer; }
.rp-field-chip:hover { border-color: var(--accent); }
.rp-chip-del { background: transparent; border: none; color: var(--fg-3); font-size: 12px; padding: 0 4px; border-radius: 50%; cursor: pointer; line-height: 1; }
.rp-chip-del:hover { background: var(--danger); color: #fff; }
.rp-field-add { display: inline-flex; align-items: center; justify-content: center; padding: 3px 10px; background: transparent; border: 1px dashed var(--line-2); border-radius: 14px; font-size: 11.5px; color: var(--fg-3); cursor: pointer; min-width: 30px; }
.rp-field-add:hover { border-color: var(--accent); color: var(--accent); }

.rp-preview {
  background: #0d1117; color: #c9d1d9; padding: 14px 16px; border-radius: 10px;
  font-size: 12px; line-height: 1.7; font-family: Consolas, Monaco, monospace;
  white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow-y: auto;
  border: 1px solid var(--line);
}

.rp-preset-item { display: flex; gap: 10px; align-items: center; background: var(--bg-3); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.rp-preset-item.active { border-left-color: var(--accent); background: var(--bg-4); }
.rp-preset-entry { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid var(--accent); }
.rp-preset-entry.off { opacity: .55; border-left-color: var(--fg-3); }
.rp-preset-entry-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }

.rp-wb-book { background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; transition: all .2s; }
.rp-wb-book.on { border-left: 3px solid var(--accent); }
.rp-wb-head { display: flex; gap: 6px; align-items: center; padding: 10px 12px; background: var(--bg-4); border-bottom: 1px solid var(--line); }
.rp-wb-name { flex: 1; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-wb-head .mini { padding: 2px 8px; font-size: 11px; border-radius: 5px; background: transparent; border-color: transparent; color: var(--fg-3); }
.rp-wb-head .mini:hover { background: var(--bg-2); color: var(--fg); border-color: var(--line); }
.rp-wb-head .mini.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.rp-wb-entries { padding: 6px; animation: slideDown .3s cubic-bezier(.4,0,.2,1); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }
.rp-wb-entry { background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 9px; margin-bottom: 5px; transition: all .18s; }
.rp-wb-entry:hover { border-left-color: var(--accent); transform: translateX(2px); }
.rp-wb-entry.off { opacity: .45; }
.rp-wb-entry-head { display: flex; gap: 6px; align-items: center; padding: 7px 10px; }
.rp-wb-entry-head .rp-rule-btn { opacity: 0; transition: opacity .15s; }
.rp-wb-entry:hover .rp-rule-btn { opacity: 1; }

.rp-mem-cat { background: var(--bg-3); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.rp-mem-cat-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--bg-4); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.rp-mem-cat-head span { flex: 1; }
.rp-mem-cat-head em { font-style: normal; font-size: 11px; color: var(--fg-3); font-weight: 400; }
.rp-mem-cat-head button { padding: 2px 8px; font-size: 11px; border-radius: 5px; }
.rp-mem-cat-head button.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.rp-mem-items { padding: 6px 10px; }
.rp-mem-item { padding: 7px 8px; border-radius: 7px; margin-bottom: 3px; transition: background .15s; }
.rp-mem-item:hover { background: var(--bg-2); }
.rp-mem-name { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.rp-mem-content { font-size: 12.5px; line-height: 1.65; color: var(--fg-2); word-break: break-word; }
.rp-mem-acts { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.rp-mem-item:hover .rp-mem-acts { opacity: 1; }
.rp-mem-acts button { padding: 1px 8px; font-size: 11px; border-radius: 5px; background: transparent; border-color: transparent; color: var(--fg-3); }
.rp-mem-acts button:hover { background: var(--bg-3); color: var(--fg); border-color: var(--line); }

.rp-plugin-item { background: var(--bg-3); border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 11px; padding: 11px 13px; margin-bottom: 9px; }
.rp-plugin-item.on { border-left-color: var(--ok); }
.rp-plugin-item.off { opacity: .6; border-left-color: var(--fg-3); }
.rp-plugin-item.err { border-left-color: var(--danger); }
.rp-plugin-head { display: flex; align-items: center; gap: 8px; }
.rp-plugin-name { font-weight: 600; font-size: 13.5px; }
.rp-plugin-meta { font-size: 11px; color: var(--fg-3); }
.rp-plugin-status.on { color: var(--ok); }
.rp-plugin-status.off { color: var(--fg-3); }
.rp-plugin-status.err { color: var(--danger); }
.rp-plugin-desc { font-size: 12px; color: var(--fg-2); margin-top: 7px; line-height: 1.6; }
.rp-plugin-error { margin-top: 7px; padding: 6px 9px; border-radius: 6px; background: rgba(217,99,90,.1); color: var(--danger); font-size: 11.5px; font-family: Consolas, monospace; word-break: break-word; }
.rp-plugin-head .mini { padding: 2px 8px; font-size: 11px; border-radius: 5px; background: transparent; border-color: transparent; color: var(--fg-3); }
.rp-plugin-head .mini:hover { background: var(--bg-2); color: var(--fg); border-color: var(--line); }
.rp-plugin-head .mini.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ══════════ Markdown 渲染 ══════════ */
.msg .content p { margin: 0 0 .7em; }
.msg .content p:last-child { margin-bottom: 0; }
.msg .content h1, .msg .content h2, .msg .content h3,
.msg .content h4, .msg .content h5, .msg .content h6 {
  margin: .9em 0 .5em; font-weight: 700; line-height: 1.35; color: var(--fg);
}
.msg .content h1 { font-size: 18px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.msg .content h2 { font-size: 16px; }
.msg .content h3 { font-size: 15px; color: var(--accent); }
.msg .content h4, .msg .content h5, .msg .content h6 { font-size: 14px; }
.msg .content strong { color: var(--fg); font-weight: 700; }
.msg .content em { font-style: italic; color: var(--fg-2); }
.msg .content del { opacity: .55; }
.msg .content .md-hr { border: none; height: 1px; margin: 1em 0; background: linear-gradient(90deg, transparent, var(--line-2), transparent); }
.msg .content .md-quote {
  margin: .7em 0; padding: .5em .9em;
  border-left: 3px solid var(--accent); background: rgba(124,156,245,.08);
  border-radius: 0 6px 6px 0; color: var(--fg-2); font-style: italic;
}
.msg .content .md-ul, .msg .content .md-ol { margin: .5em 0 .7em; padding-left: 1.6em; }
.msg .content .md-ul li, .msg .content .md-ol li { margin: .2em 0; line-height: 1.7; }
.msg .content .md-inline {
  background: var(--bg-4); padding: 1px 6px; border-radius: 4px;
  font-family: Consolas, Monaco, monospace; font-size: .9em;
  color: var(--accent); border: 1px solid var(--line);
}
.msg .content .md-code {
  background: #0d1117; color: #c9d1d9; padding: 11px 14px; border-radius: 8px;
  font-family: Consolas, Monaco, monospace; font-size: 12.5px;
  line-height: 1.6; margin: .7em 0; overflow-x: auto; white-space: pre;
  border: 1px solid rgba(255,255,255,.06);
}
.msg .content .md-table {
  border-collapse: collapse; margin: .7em 0; font-size: 12.5px;
  width: 100%; background: var(--bg-2); border-radius: 6px; overflow: hidden;
}
.msg .content .md-table th, .msg .content .md-table td {
  padding: 6px 10px; border: 1px solid var(--line); text-align: left;
}
.msg .content .md-table th { background: var(--bg-4); font-weight: 700; color: var(--fg); }
.msg .content .md-table tr:hover td { background: rgba(255,255,255,.02); }

/* ══════════ toast ══════════ */
#toastRoot {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  background: rgba(30,30,40,.92); color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  animation: toastIn .22s ease-out; max-width: 80vw;
}
.toast.err { background: rgba(160,50,40,.94); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ══════════ 响应式 ══════════ */
@media (max-width: 900px) {
  #rpSidebar { flex: 0 0 240px; max-width: 240px; }
}
@media (max-width: 720px) {
  #rpSidebar { display: none; }
}
@media (max-width: 768px) {
  #topbar { height: 44px; padding: 0 10px; gap: 8px; }
  #topbar .brand em { display: none; }
  #topbar nav button { padding: 4px 8px; font-size: 12px; }
  .msg { padding: 0 12px; }
  #composer { padding: 6px 12px 10px; }
  .composer-row { flex-direction: column; }
  .composer-btns { flex-direction: row; width: 100%; }
  .composer-btns button { flex: 1; min-width: 0; }
}

/* ══════════ 系统自改 ══════════ */
.sm-err-badge{
  display:inline-flex;align-items:center;justify-content:center;
  min-width:18px;height:18px;padding:0 5px;margin-left:4px;
  border-radius:9px;
  background:var(--danger);color:#fff;
  font-size:10.5px;font-weight:700;
  animation:smPulse 2s ease-in-out infinite;
}
@keyframes smPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(217,99,90,.6)}
  50%{box-shadow:0 0 0 4px rgba(217,99,90,0)}
}

/* AI 对话 */
.sm-chat-wrap{display:flex;flex-direction:column;height:100%;min-height:0}
.sm-chat{flex:1;min-height:0;overflow-y:auto;padding:16px 20px;background:var(--bg-3)}
.sm-empty{
  color:var(--fg-3);font-size:13px;line-height:1.9;
  text-align:center;padding:40px 20px;
}
.sm-empty-icon{
  font-size:48px;opacity:.35;margin-bottom:14px;
  animation:float 3s ease-in-out infinite;
}
.sm-msg{margin-bottom:16px;max-width:820px;margin-left:auto;margin-right:auto}
.sm-role{
  font-size:11px;color:var(--fg-3);font-weight:600;
  text-transform:uppercase;letter-spacing:1px;margin-bottom:4px;
}
.sm-msg.user .sm-role{color:var(--accent)}
.sm-text{
  background:var(--bg-2);border:1px solid var(--line);
  border-radius:10px;padding:10px 13px;line-height:1.7;
  word-break:break-word;font-size:13px;
}
.sm-msg.user .sm-text{background:var(--user);border-color:transparent}
.sm-code{
  margin-top:8px;padding:12px 14px;background:#0d1117;color:#c9d1d9;
  border-radius:8px;font-size:12px;font-family:Consolas,Monaco,monospace;
  overflow-x:auto;line-height:1.6;white-space:pre;
  border:1px solid rgba(255,255,255,.06);
}
.sm-code-actions{display:flex;gap:6px;margin-top:6px}
.sm-code-actions .mini{padding:3px 10px;font-size:11.5px;border-radius:6px}
.sm-code-actions .mini.primary{background:var(--accent);border-color:var(--accent);color:#fff}

.sm-input-bar{
  flex:0 0 auto;border-top:1px solid var(--line);
  padding:10px 20px;background:var(--bg-2);
  display:flex;gap:10px;align-items:flex-end;
}
.sm-input-bar textarea{flex:1;min-height:44px;max-height:120px}
.sm-input-btns{display:flex;flex-direction:column;gap:5px}
.sm-input-btns button{min-width:72px}

/* Mod 列表 */
.sm-mod-item{
  background:var(--bg-3);border:1px solid var(--line);
  border-left:3px solid var(--accent);
  border-radius:11px;padding:11px 13px;margin-bottom:9px;
}
.sm-mod-item.off{opacity:.55;border-left-color:var(--fg-3)}
.sm-mod-head{display:flex;align-items:center;gap:8px}
.sm-mod-err{
  margin-top:7px;padding:6px 9px;border-radius:6px;
  background:rgba(217,99,90,.1);color:var(--danger);
  font-size:11.5px;font-family:Consolas,monospace;
}
.sm-code-mini{
  margin-top:7px;padding:7px 10px;border-radius:6px;
  background:var(--bg-2);font-family:Consolas,monospace;
  font-size:11px;line-height:1.5;color:var(--fg-3);
  overflow-x:auto;white-space:pre;max-height:120px;
}

/* 报错列表 */
.sm-err-item{
  background:var(--bg-3);border:1px solid var(--line);
  border-left:3px solid var(--danger);
  border-radius:9px;padding:9px 12px;margin-bottom:7px;
}
.sm-err-item.window{border-left-color:#e0a34a}
.sm-err-item.promise{border-left-color:#b06ad4}

/* ══════════ 源码编辑 & 补丁预览 ══════════ */
.sm-src-wrap{display:flex;height:100%;min-height:0}
.sm-src-side{
  flex:0 0 200px;border-right:1px solid var(--line);
  display:flex;flex-direction:column;background:var(--bg-3);
}
.sm-src-side-head{
  padding:9px 12px;font-size:11px;font-weight:700;
  color:var(--fg-3);text-transform:uppercase;letter-spacing:1px;
  border-bottom:1px solid var(--line);
}
.sm-src-list{flex:1;overflow-y:auto;padding:6px}
.sm-src-item{
  padding:6px 10px;border-radius:7px;cursor:pointer;
  display:flex;align-items:center;justify-content:space-between;gap:6px;
  font-size:12px;font-family:Consolas,monospace;
  color:var(--fg-2);transition:background .12s;
}
.sm-src-item:hover{background:var(--bg-4);color:var(--fg)}
.sm-src-item.active{background:var(--accent);color:#fff}
.sm-src-item em{font-style:normal;font-size:10.5px;opacity:.55}
.sm-src-main{flex:1;min-width:0;display:flex;flex-direction:column}
.sm-src-bar{
  flex:0 0 auto;display:flex;align-items:center;gap:6px;
  padding:9px 12px;background:var(--bg-2);border-bottom:1px solid var(--line);
}
.sm-src-bar button{padding:3px 10px;font-size:11.5px;border-radius:6px}
#smSrcEditor{
  flex:1;min-height:0;width:100%;
  border:none;border-radius:0;
  font-family:Consolas,Monaco,monospace;
  font-size:12.5px;line-height:1.65;
  padding:14px 16px;background:var(--bg);
  resize:none;
}

.sm-patches{margin-top:8px}
.sm-patch{
  background:var(--bg-2);border:1px solid var(--line);
  border-radius:8px;padding:8px 10px;margin-bottom:6px;
}
.sm-patch-head{font-size:11.5px;font-weight:700;color:var(--accent);margin-bottom:5px}
.sm-patch-find,.sm-patch-repl{
  font-family:Consolas,monospace;font-size:11px;line-height:1.55;
  padding:6px 9px;border-radius:5px;margin:3px 0;
  white-space:pre-wrap;word-break:break-word;max-height:110px;overflow-y:auto;
}
.sm-patch-find{background:rgba(217,99,90,.08);color:#d9635a}
.sm-patch-repl{background:rgba(95,185,138,.08);color:#5fb98a}

/* ══════════ 玩家角色卡 ══════════ */
.us-wb-item{
  background:var(--bg-3);border:1px solid var(--line);
  border-radius:9px;padding:9px 11px;margin-bottom:7px;
}
.us-wb-item input,.us-wb-item textarea{font-size:12.5px}

/* ══════════ 存档 ══════════ */
.sv-card{
  background:var(--bg-3);border:1px solid var(--line);
  border-radius:11px;padding:14px 16px;margin-bottom:12px;
}
.sv-card-title{font-size:13.5px;font-weight:700;color:var(--fg);margin-bottom:8px}
.sv-card-danger{border-color:rgba(217,99,90,.4);background:rgba(217,99,90,.05)}
.sv-card-danger .sv-card-title{color:var(--danger)}
.sv-hint{font-size:12px;color:var(--fg-3);line-height:1.7;margin-bottom:10px}
.sv-info{font-size:12.5px;color:var(--fg-2);line-height:1.8}
.sv-info b{color:var(--fg)}
.sv-btns{display:flex;gap:8px;flex-wrap:wrap}
.sv-btns button{padding:7px 14px;font-size:12.5px;border-radius:8px}
.sv-drop{
  border:2px dashed var(--line-2);border-radius:10px;
  padding:22px 16px;text-align:center;
  color:var(--fg-3);font-size:13px;cursor:pointer;
  transition:all .15s;
}
.sv-drop:hover,.sv-drop.hot{
  border-color:var(--accent);background:rgba(124,156,245,.06);color:var(--accent);
}

/* ══════════ 分支 ══════════ */
.br-item{
  background:var(--bg-3);border:1px solid var(--line);
  border-left:3px solid var(--line-2);
  border-radius:11px;padding:12px 14px;margin-bottom:9px;
  transition:all .15s;
}
.br-item.active{
  border-left-color:var(--accent);
  background:linear-gradient(90deg,rgba(124,156,245,.08),transparent);
  box-shadow:0 0 0 1px rgba(124,156,245,.3) inset;
}
.br-item-head{display:flex;align-items:center;gap:8px;margin-bottom:5px;flex-wrap:wrap}
.br-item-name{font-weight:600;font-size:13.5px;flex:1;min-width:0}
.br-item-meta{font-size:11px;color:var(--fg-3)}
.br-badge{
  font-size:10px;padding:1px 7px;border-radius:6px;
  background:var(--accent);color:#fff;font-weight:700;
}
.br-item-preview{
  font-size:12px;color:var(--fg-3);line-height:1.6;
  margin-bottom:6px;overflow:hidden;text-overflow:ellipsis;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
}
.br-item-parent{
  font-size:11px;color:var(--accent);opacity:.75;margin-bottom:6px;
}
.br-item-acts{display:flex;gap:6px;flex-wrap:wrap}
.br-item-acts button{padding:3px 10px;font-size:11.5px;border-radius:6px}

/* ══════════ 消息折叠 ══════════ */
.msg-collapse-bar{
  margin-top:6px;
  display:flex;justify-content:center;
}
.msg-collapse-bar .mini{
  padding:3px 14px;font-size:11.5px;border-radius:14px;
  background:var(--bg-3);border:1px solid var(--line);
  color:var(--fg-2);
}
.msg-collapse-bar .mini:hover{
  background:var(--accent);border-color:var(--accent);color:#fff;
}

/* ══════════ 手机适配 ══════════ */
@media (max-width: 768px) {
  /* 顶栏：横向滚动，按钮不换行 */
  #topbar {
    height: 46px;
    padding: 0 8px;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #topbar::-webkit-scrollbar { display: none; }
  #topbar .brand {
    font-size: 12px;
    flex: 0 0 auto;
  }
  #topbar .brand em { display: none; }
  #topbar nav {
    margin-left: 6px;
    gap: 4px;
    flex: 0 0 auto;
  }
  #topbar nav button {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 7px;
    white-space: nowrap;
    min-height: 32px;
  }
  #topbar nav button .sm-err-badge {
    min-width: 15px;
    height: 15px;
    font-size: 9px;
    padding: 0 3px;
  }

  /* 隐藏徽章上的文字，只显示图标 */
  #topbar nav button br { display: none; }

  /* 侧栏：手机时默认隐藏，可从底部面板访问 */
  #rpSidebar {
    position: fixed;
    right: 0;
    top: 46px;
    bottom: 0;
    z-index: 500;
    width: 88vw;
    max-width: 360px;
    flex: none;
    box-shadow: -8px 0 32px rgba(0,0,0,.5);
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    display: flex !important;
  }
  #rpSidebar.mobile-open { transform: translateX(0); }

  /* 侧栏开关按钮 */
  #rpSidebarToggle {
    position: fixed;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    z-index: 400;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 6px 24px rgba(124,156,245,.5);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  #rpSidebarToggle:active { transform: scale(.92); }

  /* 侧栏被打开时的遮罩 */
  #rpSidebarMask {
    position: fixed;
    inset: 46px 0 0 0;
    z-index: 450;
    background: rgba(0,0,0,.5);
    display: none;
  }
  #rpSidebarMask.show { display: block; }

  /* 消息气泡占满宽度，头像小一点 */
  .msg {
    max-width: 100%;
    padding: 0 10px;
    margin-bottom: 12px;
    gap: 8px;
  }
  .msg .avatar {
    flex: 0 0 28px;
    height: 28px;
    font-size: 11px;
    border-radius: 8px;
  }
  .msg .content {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.7;
  }
  .msg .meta { font-size: 11px; }
  .msg .tools {
    opacity: 1;    /* 手机上没 hover，工具条常显 */
    gap: 2px;
    flex-wrap: wrap;
  }
  .msg .tools button {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-3);
    border-color: var(--line);
    color: var(--fg-3);
  }

  /* 输入区 */
  #composer {
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0));
  }
  .composer-tools {
    max-width: 100%;
    font-size: 11px;
    margin-bottom: 5px;
  }
  .composer-tools button {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* 快捷按钮栏：横向滚动 */
  .rp-quick-bar {
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 5px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
  }
  .rp-quick-bar::-webkit-scrollbar { display: none; }
  .rp-quick-btn {
    flex: 0 0 auto;
    padding: 5px 10px;
    font-size: 11.5px;
  }

  /* 输入框 + 按钮 */
  .composer-row {
    max-width: 100%;
    flex-direction: row;
    gap: 6px;
    align-items: flex-end;
  }
  .composer-row textarea {
    font-size: 15px;    /* iOS 上 < 16px 会触发页面缩放 */
    padding: 9px 11px;
    min-height: 44px;
    max-height: 140px;
  }
  .composer-btns {
    flex-direction: column;
    gap: 4px;
  }
  .composer-btns button {
    min-width: 60px;
    padding: 9px 10px;
    font-size: 13px;
    min-height: 44px;
  }

  /* 模态框几乎全屏 */
  .rp-modal-mask { padding: 6px; }
  .rp-modal {
    width: 100% !important;
    height: 92vh !important;
    max-height: 92vh !important;
    border-radius: 14px;
  }
  .rp-modal-head {
    padding: 11px 14px;
  }
  .rp-modal-title { font-size: 14px; }
  .rp-modal-body { padding: 12px 14px; }

  /* 世界卡片单列 */
  .rp-world-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }
  .rp-world-card { padding: 10px 11px 28px; }
  .rp-world-icon { font-size: 20px; }
  .rp-world-name { font-size: 12.5px; }
  .rp-world-tag { font-size: 10.5px; }

  /* 状态栏卡片 */
  .rp-char-card { font-size: 12px; }
  .rp-side-head { height: 40px; padding: 0 10px; }
  .rp-side-list { padding: 8px; }

  /* 快捷输入栏、状态栏在手机上更好点 */
  .field input, .field select, .field textarea {
    font-size: 15px;    /* 防 iOS 自动缩放 */
    padding: 9px 11px;
  }

  /* 输入区聚焦时不要被键盘顶下去 */
  body.keyboard-open #composer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
  }

  /* 顶栏按钮太挤时的省略 */
  #topbar nav button { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
}

@media (max-width: 480px) {
  #topbar nav button { padding: 5px 8px; font-size: 11px; min-height: 30px; }
  #topbar nav { gap: 3px; }
  #topbar .brand { font-size: 11px; }
  .msg .content { font-size: 13px; padding: 9px 11px; }
}

/* ══════════ 自改 · 方案 ══════════ */
.sm-preset-backup{
  display:flex;align-items:center;gap:10px;
  background:rgba(124,156,245,.08);
  border:1px solid rgba(124,156,245,.35);
  border-left:3px solid var(--accent);
  border-radius:9px;padding:9px 12px;margin-bottom:12px;
}
.sm-preset-item{
  background:var(--bg-3);border:1px solid var(--line);
  border-left:3px solid var(--accent);
  border-radius:11px;padding:11px 14px;margin-bottom:9px;
}
.sm-preset-head{display:flex;align-items:flex-start;gap:10px;margin-bottom:8px}
.sm-preset-acts{display:flex;gap:6px;flex-wrap:wrap}
.sm-preset-acts .mini{padding:4px 10px;font-size:11.5px;border-radius:6px}

/* ══════════ 手机适配 ══════════ */
#rpSidebarToggle {
  position: fixed;
  right: 12px;
  bottom: calc(220px + env(safe-area-inset-bottom, 0));
  z-index: 400;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px rgba(124,156,245,.55);
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#rpSidebarToggle:active { transform: scale(.9); }

#rpSidebarMask {
  position: fixed;
  inset: 44px 0 0 0;
  z-index: 450;
  background: rgba(0,0,0,.5);
  display: none;
}
#rpSidebarMask.show { display: block; }

@media (max-width: 768px) {
  #topbar {
    height: 44px;
    padding: 0 6px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #topbar::-webkit-scrollbar { display: none; }
  #topbar .brand {
    flex: 0 0 auto;
    gap: 4px;
    margin-right: 2px;
  }
  #topbar nav {
    margin-left: 2px;
    gap: 4px;
    flex: 0 0 auto;
  }
  #topbar nav button {
    position: relative;
    padding: 0 !important;
    font-size: 18px !important;
    line-height: 1;
    min-width: 38px;
    min-height: 36px;
    border-radius: 8px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  #topbar nav button .sm-err-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 14px;
    height: 14px;
    font-size: 9px;
    padding: 0 3px;
    margin: 0;
  }

  #composer {
    padding: 6px 10px calc(10px + env(safe-area-inset-bottom, 0));
  }
  .composer-tools {
    font-size: 11px;
    margin-bottom: 4px;
  }
  .composer-tools button {
    padding: 3px 8px;
    font-size: 11px;
  }

  .rp-quick-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    padding: 4px 0;
    margin-bottom: 6px;
  }
  .rp-quick-bar::-webkit-scrollbar { display: none; }
  .rp-quick-btn {
    flex: 0 0 auto;
    padding: 6px 11px;
    font-size: 12px;
  }

  .composer-row {
    flex-direction: column !important;
    gap: 6px !important;
    align-items: stretch !important;
  }
  .composer-row textarea {
    width: 100% !important;
    font-size: 15px;
    padding: 10px 12px;
    min-height: 48px;
    max-height: 120px;
  }
  .composer-btns {
    flex-direction: row !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .composer-btns button {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 11px !important;
    font-size: 14px !important;
    min-height: 44px;
  }

  /* 侧栏变抽屉 */
  #rpSidebar {
    position: fixed !important;
    top: 44px;
    right: 0;
    bottom: 0;
    width: 88vw;
    max-width: 360px;
    flex: none !important;
    z-index: 500;
    box-shadow: -8px 0 32px rgba(0,0,0,.55);
    transform: translateX(100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    display: flex !important;
    flex-direction: column;
  }
  #rpSidebar.mobile-open { transform: translateX(0); }
  #rpSidebarToggle { display: flex; }

  .msg {
    max-width: 100%;
    padding: 0 10px;
    margin-bottom: 12px;
    gap: 8px;
  }
  .msg .avatar {
    flex: 0 0 28px;
    height: 28px;
    font-size: 11px;
    border-radius: 8px;
  }
  .msg .content {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.7;
  }
  .msg .meta { font-size: 11px; }
  .msg .tools {
    opacity: 1;
    gap: 2px;
    flex-wrap: wrap;
  }
  .msg .tools button {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--bg-3);
    border-color: var(--line);
    color: var(--fg-3);
  }

  .rp-modal-mask { padding: 4px; }
  .rp-modal {
    width: 100% !important;
    height: 94vh !important;
    max-height: 94vh !important;
    border-radius: 12px;
  }
  .rp-modal-head { padding: 10px 12px; }
  .rp-modal-title { font-size: 14px; }
  .rp-modal-body { padding: 10px 12px; }

  .rp-world-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .rp-world-card { padding: 10px 11px 28px; }
  .rp-world-icon { font-size: 20px; margin-bottom: 5px; }
  .rp-world-name { font-size: 12.5px; }
  .rp-world-tag { font-size: 10.5px; }

  .field input, .field select, .field textarea,
  .ai-field input, .ai-field select, .ai-field textarea {
    font-size: 15px;
  }
}

@media (min-width: 769px) {
  #rpSidebarToggle { display: none !important; }
  #rpSidebarMask { display: none !important; }
}