:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --side: #efece4;
  --side-hover: #e5e0d5;
  --line: #e2ddd2;
  --line-strong: #cfc8ba;
  --ink: #1e1c19;
  --ink2: #5b554c;
  --ink3: #8a8275;
  --accent: #d97757;
  --accent-hover: #c56546;
  --accent-soft: #d977571a;
  --user-bg: #ebe6da;
  --think-bg: #f2efe7;
  --code-bg: #1e1d1b;
  --code-ink: #f2ede6;
  --danger: #c64336;
  --ok: #22c55e;
  --shadow: 0 8px 30px rgba(30, 26, 20, 0.08);
}

html.dark {
  --bg: #171614;
  --surface: #22201d;
  --side: #131210;
  --side-hover: #272420;
  --line: #312e29;
  --line-strong: #47423b;
  --ink: #efebe3;
  --ink2: #b5aea2;
  --ink3: #827b70;
  --accent: #e08363;
  --accent-hover: #eb9374;
  --accent-soft: #e0836326;
  --user-bg: #2c2823;
  --think-bg: #1e1c19;
  --code-bg: #11100f;
  --code-ink: #ece7df;
  --danger: #e46c5e;
  --ok: #46b57c;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ---- 登录页 ---- */
.auth-screen {
  position: fixed; inset: 0; z-index: 400;
  display: grid; place-items: center; padding: 20px;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 390px; padding: 30px 26px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow);
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 22px; font-weight: 700; color: var(--accent);
}
.auth-sub { margin: 8px 0 20px; font-size: 13px; color: var(--ink2); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; color: var(--ink2); margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg); outline: none;
}
.field input { height: 42px; padding: 0 12px; }
.field textarea { resize: vertical; line-height: 1.55; font-size: 13px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.auth-err { min-height: 20px; font-size: 12.5px; color: var(--danger); margin-bottom: 8px; }
.btn-primary {
  height: 40px; padding: 0 16px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary.full, .btn-ghost.full { width: 100%; }
.btn-ghost {
  height: 38px; padding: 0 14px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: transparent; color: var(--ink);
}
.btn-ghost:hover { background: var(--side-hover); }
.btn-danger-ghost {
  height: 30px; padding: 0 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: transparent; color: var(--danger); font-size: 12px;
}
.btn-danger-ghost:hover { background: rgba(198, 67, 54, 0.1); border-color: var(--danger); }

/* ---- 主布局 ---- */
.app { display: flex; height: 100dvh; overflow: hidden; }
.side-backdrop { display: none; }

.sidebar {
  width: 268px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--side); border-right: 1px solid var(--line);
  transition: width .2s ease, transform .2s ease;
}
body.side-collapsed .sidebar { width: 0; overflow: hidden; border-right: none; }

.side-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 8px 14px;
}
.brand-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; padding: 4px 6px; border-radius: 8px;
  font-size: 16px; font-weight: 700;
}
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: inline-block; }
.icon-btn {
  width: 34px; height: 34px; border: none; border-radius: 9px;
  background: transparent; color: var(--ink2);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { background: var(--side-hover); color: var(--ink); }

.side-actions { padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 8px; }
.new-chat-btn {
  height: 38px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: var(--surface); color: var(--ink);
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500;
}
.new-chat-btn:hover { border-color: var(--accent); color: var(--accent); }
.side-search {
  display: flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 10px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line); color: var(--ink3);
}
.side-search input { border: none; background: transparent; outline: none; width: 100%; font-size: 13px; color: var(--ink); }

.conv-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.conv-empty { padding: 20px 10px; font-size: 13px; color: var(--ink3); text-align: center; }
.conv-item {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  font-size: 13.5px; color: var(--ink2);
}
.conv-item:hover { background: var(--side-hover); color: var(--ink); }
.conv-item.active { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.conv-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item-acts { display: none; align-items: center; gap: 2px; }
.conv-item:hover .conv-item-acts, .conv-item.active .conv-item-acts { display: flex; }
.conv-act {
  width: 24px; height: 24px; border: none; border-radius: 6px;
  background: transparent; color: var(--ink3); font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.conv-act:hover { background: var(--side-hover); color: var(--ink); }
.conv-act.del:hover { color: var(--danger); }

.side-foot {
  padding: 10px 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.user-pill { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot-btns { display: flex; align-items: center; gap: 2px; }

/* ---- 主区顶栏与次级控制条 ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar {
  height: 50px; flex-shrink: 0; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.conv-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lib-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.lib-btn:hover { border-color: var(--accent); color: var(--ink); }
.lib-btn.has-docs {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600;
}

.voice-eng-group {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px; border-radius: 999px;
  background: var(--side); border: 1px solid var(--line-strong);
  flex-shrink: 0;
}
.voice-eng-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px; border: none; border-radius: 999px;
  background: transparent; color: var(--ink2); font-size: 11.5px; font-weight: 500;
  white-space: nowrap; transition: background .15s, color .15s;
}
.voice-eng-btn.active {
  background: var(--surface); color: var(--accent); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.eng-dot {
  width: 6.5px; height: 6.5px; border-radius: 50%; display: inline-block;
  background: var(--ink3); opacity: .55; flex-shrink: 0;
}
.voice-eng-btn.ready .eng-dot { background: #22c55e; opacity: 1; }
.voice-eng-btn.loading .eng-dot { background: #f59e0b; opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
.voice-eng-btn.offline .eng-dot { background: #9ca3af; opacity: .55; }

/* 次级条：模型 / 思考等级 / 口语回复模式 */
.subbar {
  flex-shrink: 0; padding: 7px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.subbar-left, .subbar-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.model-picker-wrap { position: relative; }
.model-btn {
  height: 30px; padding: 0 9px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--think-bg); color: var(--ink);
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500;
}
.model-btn:hover { border-color: var(--accent); }
.model-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 150;
  width: 330px; max-width: calc(100vw - 24px);
  max-height: min(65vh, 460px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 14px; padding: 6px; box-shadow: var(--shadow);
}
.model-opt {
  width: 100%; border: none; background: transparent; border-radius: 10px;
  padding: 9px 10px; text-align: left; display: flex; flex-direction: column; gap: 2px;
}
.model-opt:hover { background: var(--side-hover); }
.model-opt.active { background: var(--accent-soft); }
.model-opt-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.model-opt-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.model-opt-badge {
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: var(--think-bg); color: var(--ink2); border: 1px solid var(--line); white-space: nowrap;
}
.model-opt-note { font-size: 11px; color: var(--ink3); }

.effort-bar { display: inline-flex; align-items: center; }
.effort-locked {
  height: 28px; padding: 0 8px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center;
}
.effort-group, .reply-mode-group {
  display: inline-flex; align-items: center; padding: 2px;
  border-radius: 9px; background: var(--think-bg); border: 1px solid var(--line);
}
.effort-pill, .reply-mode-btn {
  height: 24px; padding: 0 8px; border: none; border-radius: 7px;
  background: transparent; color: var(--ink2); font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.effort-pill:hover, .reply-mode-btn:hover { color: var(--ink); }
.effort-pill.active, .reply-mode-btn.active { background: var(--accent); color: #fff; font-weight: 600; }

/* ---- 中间实时字幕对话流 ---- */
.messages-wrap { flex: 1; overflow-y: auto; padding: 18px 16px 20px; }
.messages-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

.welcome-empty {
  padding: 36px 10px 16px; text-align: center;
}
.welcome-empty h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.welcome-empty p { margin: 0 auto 18px; max-width: 480px; font-size: 14px; color: var(--ink2); }
.welcome-lib-bar {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 8px 14px; border-radius: 12px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink2);
}
.welcome-lib-bar button {
  border: none; border-radius: 8px; padding: 4px 10px;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600;
}
.welcome-tips {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 10px; max-width: 640px; margin: 0 auto; text-align: left;
}
.welcome-tip {
  padding: 12px 13px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--line);
}
.welcome-tip b { display: block; font-size: 13px; margin-bottom: 3px; color: var(--ink); }
.welcome-tip span { display: block; font-size: 12px; color: var(--ink3); line-height: 1.5; }

/* 消息项 */
.msg { display: flex; flex-direction: column; gap: 5px; }
.msg.user { align-items: flex-end; }
.msg.assistant { align-items: flex-start; }

.msg-user-bubble {
  max-width: min(88%, 580px); padding: 9px 14px;
  border-radius: 18px 18px 4px 18px;
  background: var(--user-bg); border: 1px solid var(--line); color: var(--ink);
  font-size: 14.5px; line-height: 1.65; letter-spacing: 0.01em;
  white-space: pre-wrap; word-break: break-word;
}
.msg-ai-wrap {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 17px 12px;
  box-shadow: 0 1px 4px rgba(30, 26, 20, 0.035);
}
html.dark .msg-ai-wrap {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

.msg-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.msg-images img {
  max-width: 200px; max-height: 200px; border-radius: 10px;
  border: 1px solid var(--line); cursor: zoom-in; object-fit: cover;
}
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; max-width: 100%; }
.msg-file-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 8px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.msg-file-chip small { color: var(--ink3); }

/* 思考过程卡片（纯语音站默认折叠紧凑显示，点开全展开不限高） */
.think-card {
  margin-bottom: 10px; border: 1px solid var(--line);
  border-radius: 11px; background: var(--think-bg); overflow: hidden;
}
.think-head {
  width: 100%; display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border: none; background: transparent;
  font-size: 12.5px; color: var(--ink2); text-align: left;
}
.think-head:hover { background: var(--side-hover); }
.think-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink3); flex-shrink: 0; }
.think-card.streaming .think-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.think-chevron { margin-left: auto; transition: transform .18s; color: var(--ink3); }
.think-card.open .think-chevron { transform: rotate(180deg); }
.think-body {
  display: none; padding: 0 13px 11px; border-top: 1px solid var(--line);
  font-size: 12.5px; line-height: 1.65; color: var(--ink2);
  white-space: pre-wrap; word-break: break-word;
}
.think-card.open .think-body { display: block; padding-top: 9px; }

/* AI 大字号清晰口语正文（纯前端视觉分层排版，一眼扫清） */
.md-body {
  font-size: 16px; line-height: 1.8; letter-spacing: 0.015em;
  color: var(--ink); word-break: break-word;
}
.md-body > :first-child { margin-top: 0; }
.md-body > :last-child { margin-bottom: 0; }
.md-body p { margin: 0 0 11px; }
.md-body .sp-lead {
  margin: 0 0 13px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--accent);
  font-size: 16.5px; font-weight: 600; line-height: 1.68;
  color: var(--ink);
}
.md-body .sp-subhead {
  margin: 12px 0 7px;
  font-weight: 600; line-height: 1.6; color: var(--ink);
}
.md-body ul.sp-points {
  list-style: none; margin: 4px 0 12px; padding: 2px 0;
  display: flex; flex-direction: column; gap: 8px;
}
.md-body ul.sp-points li {
  position: relative; margin: 0; padding-left: 16px;
  line-height: 1.74; color: var(--ink);
}
.md-body ul.sp-points li::before {
  content: "";
  position: absolute; left: 3px; top: 0.72em;
  width: 5.5px; height: 5.5px; border-radius: 50%;
  background: var(--accent); opacity: 0.85;
}
.md-body .sp-cue { font-weight: 600; color: var(--ink); }
.md-body .sp-follow {
  margin: 13px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--think-bg);
  border: 1px solid var(--line);
  color: var(--ink2);
  font-size: 14px; line-height: 1.62;
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 16px 0 6px; line-height: 1.35; font-weight: 650; }
.md-body ul, .md-body ol { margin: 0 0 10px; padding-left: 20px; }
.md-body li { margin: 3px 0; }
.md-body blockquote {
  margin: 10px 0; padding: 5px 12px;
  border-left: 3px solid var(--accent); background: var(--think-bg); border-radius: 0 8px 8px 0; color: var(--ink2);
}
.md-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em; padding: 1.5px 5px; border-radius: 5px;
  background: var(--think-bg); border: 1px solid var(--line);
}
.md-body pre.code-block {
  margin: 10px 0; border-radius: 11px; overflow: hidden;
  background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--line);
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 11px; font-size: 11.5px; color: #aaa39a;
  background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(255,255,255,0.08);
}
.code-copy {
  border: none; background: rgba(255,255,255,0.08); color: #e8e2da;
  font-size: 11px; padding: 2px 8px; border-radius: 5px;
}
.md-body pre.code-block code {
  display: block; padding: 10px 12px; overflow-x: auto;
  background: transparent; border: none; color: inherit; font-size: 12.5px; line-height: 1.55;
}
.md-body table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.md-body th, .md-body td { border: 1px solid var(--line-strong); padding: 6px 9px; text-align: left; }
.md-body th { background: var(--think-bg); }
.md-body a { color: var(--accent); text-decoration: underline; }

.msg-foot {
  margin-top: 13px; padding-top: 9px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px;
}
.msg-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg-act-btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink2);
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; line-height: 1.3;
}
.msg-act-btn:hover { border-color: var(--line-strong); background: var(--side-hover); color: var(--ink); }
.msg-act-btn.primary-act {
  border-color: var(--accent-soft); background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.msg-act-btn.speaking {
  border-color: var(--accent); color: #fff; background: var(--accent); font-weight: 600;
}
.msg-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-top: 0; font-size: 11px; color: var(--ink3); line-height: 1.45;
}
.msg-badge {
  padding: 1px 6px; border-radius: 999px;
  background: var(--think-bg); border: 1px solid var(--line); color: var(--ink2);
}
.msg-lib-tag {
  padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.msg-usage { color: var(--ink3); }
.msg-err {
  margin-top: 6px; padding: 8px 11px; border-radius: 10px;
  background: rgba(198, 67, 54, 0.1); color: var(--danger); font-size: 13px;
}

/* ---- 底部纯语音单手主控台 ---- */
.voice-dock {
  flex-shrink: 0;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}
.dock-inner { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; }

.attach-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.attach-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 9px; font-size: 12px;
  background: var(--think-bg); border: 1px solid var(--line); max-width: 240px;
}
.attach-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; }
.attach-chip button { border: none; background: transparent; color: var(--ink3); font-size: 15px; padding: 0 2px; }
.attach-chip button:hover { color: var(--danger); }

.text-tray {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 8px 6px 12px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--line-strong);
}
.text-tray:focus-within { border-color: var(--accent); }
#chatInput {
  flex: 1; min-height: 36px; max-height: 140px; resize: none;
  border: none; background: transparent; outline: none;
  padding: 6px 2px; font-size: 14.5px; line-height: 1.5;
}
.send-btn {
  width: 34px; height: 34px; border: none; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.send-btn.stopping { background: var(--ink); }

.dock-status { text-align: center; padding: 0 4px; }
.dock-state-label { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.dock-state-hint { font-size: 12px; color: var(--ink3); line-height: 1.4; margin-top: 2px; }

.dock-main {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px; padding: 2px 0;
}
.dock-side { display: flex; align-items: center; gap: 7px; }
.dock-left { justify-content: flex-start; }
.dock-right { justify-content: flex-end; }

.dock-circle-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink2);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dock-circle-btn:hover { color: var(--ink); border-color: var(--ink3); }
.dock-circle-btn[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.dock-circle-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.dock-circle-btn.danger:hover { opacity: .9; }

.dock-action-pill {
  height: 36px; padding: 0 13px; border-radius: 999px; border: none;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.dock-action-pill:hover { background: var(--accent-hover); }

/* 居中 72px 动态语音大圆球 */
.call-orb {
  position: relative; width: 72px; height: 72px; border-radius: 50%; border: none;
  background: radial-gradient(circle at 35% 28%, #f2a586, var(--accent) 62%, #b55436 100%);
  box-shadow: 0 8px 24px rgba(217, 119, 87, 0.36);
  display: grid; place-items: center; padding: 0;
  transform: scale(var(--orb-scale, 1));
  transition: transform .08s ease-out, box-shadow .2s, background .2s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; touch-action: none;
}
.orb-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.voice-bars { display: flex; align-items: center; gap: 3.5px; height: 28px; }
.voice-bars i {
  display: block; width: 3.5px; height: 8px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.95); transition: height .08s ease-out;
}
.voice-dock[data-state="idle"] .call-orb {
  background: linear-gradient(145deg, var(--ink), #3b3732);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
html.dark .voice-dock[data-state="idle"] .call-orb {
  background: radial-gradient(circle at 35% 28%, #f09e7e, var(--accent) 65%, #b55436 100%);
}
.voice-dock[data-state="listening"] .orb-ring { opacity: .35; animation: ripple 2.2s ease-out infinite; }
.voice-dock[data-state="hearing"] .call-orb {
  box-shadow: 0 0 0 8px var(--accent-soft), 0 8px 26px rgba(217, 119, 87, 0.5);
}
.voice-dock[data-state="transcribing"] .call-orb,
.voice-dock[data-state="thinking"] .call-orb {
  background: radial-gradient(circle at 35% 30%, #e4b589, #c48453 65%, #8e5932 100%);
  animation: breathe 1.5s ease-in-out infinite;
}
.voice-dock[data-state="speaking"] .call-orb {
  box-shadow: 0 0 0 8px var(--accent-soft), 0 8px 28px rgba(217, 119, 87, 0.52);
}
.voice-dock[data-state="muted"] .call-orb {
  background: radial-gradient(circle at 35% 30%, #8f8a82, #65605a 70%);
  box-shadow: none;
}

.dock-pills {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.dock-pill {
  height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink2);
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.dock-pill:hover { color: var(--ink); border-color: var(--ink3); }
.dock-pill.on, .dock-pill[aria-pressed="true"] {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600;
}

/* ---- 理论库与设置弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; z-index: 450;
  background: rgba(0,0,0,0.46); display: grid; place-items: center; padding: 14px;
}
.modal-card {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 16.5px; }

.lib-summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: 11px; margin-bottom: 12px;
  background: var(--think-bg); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink2);
}
.lib-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lib-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.lib-empty {
  padding: 24px 12px; text-align: center; font-size: 13px; color: var(--ink3);
  border: 1px dashed var(--line-strong); border-radius: 12px;
}
.lib-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.lib-row.enabled { border-color: var(--accent); background: var(--accent-soft); }
.lib-check { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.lib-info { flex: 1; min-width: 0; }
.lib-name { font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta { font-size: 11.5px; color: var(--ink3); }
.lib-row-acts { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.lib-mini-btn {
  height: 28px; padding: 0 8px; border-radius: 7px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink2); font-size: 11.5px;
}
.lib-mini-btn:hover { color: var(--ink); border-color: var(--ink3); }
.lib-mini-btn.del { color: var(--danger); }
.lib-preview-box {
  max-height: 52vh; overflow-y: auto; padding: 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}

.lightbox {
  position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,0.82);
  display: grid; place-items: center; padding: 20px; cursor: zoom-out;
}
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 10px; }

.toast-wrap {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
  max-width: calc(100vw - 24px); align-items: center;
}
.toast {
  padding: 9px 15px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--shadow);
  text-align: center; word-break: break-word; line-height: 1.45;
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(1.25); } }
@keyframes breathe { 0%, 100% { transform: scale(0.95); } 50% { transform: scale(1.05); } }
@keyframes ripple { 0% { transform: scale(1); opacity: .42; } 100% { transform: scale(1.28); opacity: 0; } }

@media (max-width: 820px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 220;
    width: 280px !important; transform: translateX(-100%);
  }
  body.side-open-mobile .sidebar { transform: translateX(0); }
  body.side-open-mobile .side-backdrop {
    display: block; position: fixed; inset: 0; z-index: 210; background: rgba(0,0,0,0.38);
  }
  .topbar { padding: 0 8px; gap: 6px; }
  .conv-title { font-size: 13.5px; }
  .lib-btn { padding: 0 8px; font-size: 11.5px; height: 28px; }
  .voice-eng-btn { padding: 0 7px; font-size: 11px; height: 24px; }
  .subbar { padding: 6px 10px; gap: 6px; }
  .model-btn { max-width: 158px; font-size: 12px; }
  .model-btn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .messages-wrap { padding: 12px 10px 16px; }
  .messages-inner { gap: 14px; }
  .msg-ai-wrap { padding: 13px 14px 11px; border-radius: 14px; }
  .md-body { font-size: 15.5px; line-height: 1.78; }
  .md-body .sp-lead { font-size: 16px; padding-left: 10px; margin-bottom: 11px; }
  .md-body .sp-follow { font-size: 13.5px; padding: 8px 10px; }
  .dock-circle-btn { width: 38px; height: 38px; }
  .call-orb { width: 68px; height: 68px; }
  .lib-row { flex-wrap: wrap; }
  .lib-row-acts { width: 100%; justify-content: flex-end; }
}
