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

html.dark {
  --bg: #1a1917;
  --surface: #24221f;
  --side: #151412;
  --side-hover: #262420;
  --line: #33302b;
  --line-strong: #49443d;
  --ink: #ede9e1;
  --ink2: #b5aea2;
  --ink3: #7f796f;
  --accent: #e08363;
  --accent-hover: #eb9374;
  --accent-soft: #e0836324;
  --user-bg: #2c2924;
  --think-bg: #201e1b;
  --code-bg: #121110;
  --code-ink: #ece7df;
  --danger: #e46c5e;
  --ok: #46b57c;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.36);
}

* { 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; }

/* ---- 登录页 ---- */
.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: 20px; box-shadow: var(--shadow);
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 21px; 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 {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg); outline: none;
}
.field input:focus { border-color: var(--accent); }
.auth-err { min-height: 20px; font-size: 12.5px; color: var(--danger); margin-bottom: 8px; }
.btn-primary {
  height: 42px; padding: 0 18px; 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: 40px; padding: 0 16px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: transparent; color: var(--ink);
}
.btn-ghost:hover { background: var(--side-hover); }

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

.sidebar {
  width: 272px; 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; letter-spacing: -0.01em;
}
.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;
}
.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: 52px; flex-shrink: 0; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.conv-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.direct-pill {
  font-size: 11.5px; color: var(--ink3); padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  white-space: nowrap;
}

.messages-wrap { flex: 1; overflow-y: auto; padding: 20px 16px 24px; }
.messages-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

/* 空欢迎屏 */
.welcome-empty {
  padding: 56px 12px 24px; text-align: center;
}
.welcome-empty h1 {
  margin: 0 0 10px; font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
}
.welcome-empty p {
  margin: 0 auto 24px; max-width: 520px; font-size: 14px; color: var(--ink2);
}
.welcome-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px; max-width: 700px; margin: 0 auto; text-align: left;
}
.welcome-card {
  padding: 13px 14px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s;
}
.welcome-card:hover { border-color: var(--accent); }
.welcome-card b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.welcome-card span { display: block; font-size: 12px; color: var(--ink3); }

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

.msg-user-bubble {
  max-width: min(86%, 640px); padding: 11px 16px;
  border-radius: 18px 18px 4px 18px;
  background: var(--user-bg); color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}
.msg-ai-wrap { width: 100%; }

.msg-images {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.msg-images img {
  max-width: 220px; max-height: 220px; 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: 8px; max-width: 100%;
}
.msg-file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 9px; font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.msg-file-chip small { color: var(--ink3); }

/* 思考链折叠卡片 */
.think-card {
  margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--think-bg); overflow: hidden;
}
.think-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; border: none; background: transparent;
  font-size: 13px; 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 14px 12px; border-top: 1px solid var(--line);
  font-size: 13px; line-height: 1.65; color: var(--ink2);
  white-space: pre-wrap; word-break: break-word;
  max-height: 360px; overflow-y: auto;
}
.think-card.open .think-body { display: block; padding-top: 10px; }

/* AI 正文 Markdown */
.md-body { font-size: 15.5px; line-height: 1.75; 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 12px; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 20px 0 8px; line-height: 1.35; font-weight: 650; }
.md-body h1 { font-size: 1.38em; }
.md-body h2 { font-size: 1.2em; }
.md-body h3 { font-size: 1.08em; }
.md-body ul, .md-body ol { margin: 0 0 12px; padding-left: 22px; }
.md-body li { margin: 4px 0; }
.md-body blockquote {
  margin: 12px 0; padding: 6px 14px;
  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.88em; padding: 1.5px 5px; border-radius: 5px;
  background: var(--think-bg); border: 1px solid var(--line);
}
.md-body pre.code-block {
  margin: 12px 0; border-radius: 12px; 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: 6px 12px; font-size: 12px; 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: 11.5px; padding: 2px 9px; border-radius: 6px;
}
.code-copy:hover { background: rgba(255,255,255,0.18); }
.md-body pre.code-block code {
  display: block; padding: 12px 14px; overflow-x: auto;
  background: transparent; border: none; color: inherit; font-size: 13px; line-height: 1.6;
}
.md-body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px; }
.md-body th, .md-body td { border: 1px solid var(--line-strong); padding: 7px 10px; text-align: left; }
.md-body th { background: var(--think-bg); font-weight: 600; }
.md-body hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.md-body a { color: var(--accent); text-decoration: underline; }

.msg-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 8px; font-size: 12px; color: var(--ink3);
}
.msg-badge {
  padding: 2px 8px; border-radius: 999px;
  background: var(--think-bg); border: 1px solid var(--line); color: var(--ink2);
}
.msg-actions { display: inline-flex; align-items: center; gap: 4px; }
.msg-act-btn {
  border: none; background: transparent; color: var(--ink3);
  padding: 3px 8px; border-radius: 7px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
}
.msg-act-btn:hover { background: var(--side-hover); color: var(--ink); }
.msg-act-btn.speaking { color: var(--accent); background: var(--accent-soft); }
.msg-err {
  margin-top: 6px; padding: 8px 12px; border-radius: 10px;
  background: rgba(198, 67, 54, 0.1); color: var(--danger); font-size: 13px;
}

/* ---- 输入区 ---- */
.composer-wrap {
  flex-shrink: 0; padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
}
.composer-box {
  max-width: 780px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 20px; padding: 10px 12px 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
  transition: border-color .15s;
}
.composer-box:focus-within { border-color: var(--accent); }
.composer-box.drag-over { border-color: var(--accent); background: var(--accent-soft); }

.attach-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 2px 2px 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px;
}
.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: 34px; height: 34px; border-radius: 6px; object-fit: cover; }
.attach-chip button {
  border: none; background: transparent; color: var(--ink3);
  font-size: 15px; line-height: 1; padding: 0 2px;
}
.attach-chip button:hover { color: var(--danger); }

#chatInput {
  width: 100%; min-height: 44px; max-height: 220px; resize: none;
  border: none; background: transparent; outline: none;
  padding: 4px 6px; font-size: 15px; line-height: 1.55;
}

.composer-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px; flex-wrap: wrap;
}
.composer-left, .composer-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.tool-btn {
  height: 34px; min-width: 34px; padding: 0 8px;
  border: none; border-radius: 9px; background: transparent; color: var(--ink2);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
}
.tool-btn:hover { background: var(--side-hover); color: var(--ink); }
.dictate-btn.recording {
  background: rgba(217, 119, 87, 0.16); color: var(--accent);
}
.dictate-time { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* 模型选择器 */
.model-picker-wrap { position: relative; }
.model-btn {
  height: 32px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--think-bg); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
}
.model-btn:hover { border-color: var(--accent); }
.model-menu {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 120;
  width: 330px; max-width: calc(100vw - 32px);
  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: 13.5px; font-weight: 600; color: var(--ink); }
.model-opt-badge {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--think-bg); color: var(--ink2); border: 1px solid var(--line);
}
.model-opt-note { font-size: 11.5px; color: var(--ink3); }

/* 官方思考等级栏 */
.effort-bar { display: inline-flex; align-items: center; gap: 3px; }
.effort-locked {
  height: 30px; padding: 0 9px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
.effort-group {
  display: inline-flex; align-items: center; padding: 2px;
  border-radius: 9px; background: var(--think-bg); border: 1px solid var(--line);
}
.effort-pill {
  height: 26px; padding: 0 8px; border: none; border-radius: 7px;
  background: transparent; color: var(--ink2); font-size: 12px; font-weight: 500;
}
.effort-pill:hover { color: var(--ink); }
.effort-pill.active { background: var(--accent); color: #fff; font-weight: 600; }

/* 语音模式与发送按钮 */
.voice-mode-btn {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s, opacity .15s;
}
.voice-mode-btn:hover { transform: scale(1.04); opacity: .92; }
.send-btn {
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn.stopping { background: var(--ink); }

/* ---- Claude 风格全屏语音模式 ---- */
.voice-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
}
.voice-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.voice-top-left, .voice-top-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.voice-model-select {
  height: 34px; padding: 0 10px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500;
}
.voice-effort-pills { display: inline-flex; gap: 4px; align-items: center; }
.voice-chip-btn {
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 12.5px; color: var(--ink2);
}
.voice-chip-btn[aria-pressed="true"] {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600;
}

.voice-body {
  flex: 1; min-height: 0; display: flex; overflow: hidden;
}
.voice-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px; position: relative; overflow-y: auto;
}

/* 核心声波呼吸球体 */
.voice-orb-wrap {
  position: relative; width: 184px; height: 184px;
  border: none; background: transparent; padding: 0;
  display: grid; place-items: center;
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.voice-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid var(--accent); opacity: 0;
  transform: scale(0.82); transition: transform .12s ease-out, opacity .2s;
  pointer-events: none;
}
.voice-orb {
  width: 128px; height: 128px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f09e7e, var(--accent) 62%, #b55436 100%);
  box-shadow: 0 14px 40px rgba(217, 119, 87, 0.34);
  display: grid; place-items: center;
  transform: scale(var(--orb-scale, 1));
  transition: transform .08s ease-out, box-shadow .2s, background .3s;
}
.voice-bars {
  display: flex; align-items: center; gap: 5px; height: 36px;
}
.voice-bars i {
  display: block; width: 4px; height: 12px; border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  transition: height .08s ease-out;
}
.voice-overlay[data-state="listening"] .voice-ring.r1 { opacity: .35; transform: scale(calc(0.92 + var(--lvl, 0) * 0.35)); }
.voice-overlay[data-state="listening"] .voice-ring.r2 { opacity: .2; transform: scale(calc(1.06 + var(--lvl, 0) * 0.55)); }
.voice-overlay[data-state="hearing"] .voice-ring.r1 { opacity: .55; transform: scale(calc(0.98 + var(--lvl, 0) * 0.45)); }
.voice-overlay[data-state="hearing"] .voice-ring.r2 { opacity: .32; transform: scale(calc(1.14 + var(--lvl, 0) * 0.65)); }
.voice-overlay[data-state="thinking"] .voice-orb {
  background: radial-gradient(circle at 35% 30%, #e4b589, #c48453 62%, #8e5932 100%);
  animation: breathe 1.8s ease-in-out infinite;
}
.voice-overlay[data-state="thinking"] .voice-ring.r3 {
  opacity: .55; border-style: dashed; transform: scale(1.05);
  animation: spin 6s linear infinite;
}
.voice-overlay[data-state="speaking"] .voice-orb {
  box-shadow: 0 16px 48px rgba(217, 119, 87, 0.5);
}
.voice-overlay[data-state="speaking"] .voice-ring.r1 { opacity: .48; transform: scale(calc(0.96 + var(--lvl, 0) * 0.42)); }
.voice-overlay[data-state="speaking"] .voice-ring.r2 { opacity: .26; transform: scale(calc(1.12 + var(--lvl, 0) * 0.65)); }
.voice-overlay[data-state="muted"] .voice-orb {
  background: radial-gradient(circle at 35% 30%, #8f8a82, #65605a 70%);
  box-shadow: none;
}

.voice-state-label { margin-top: 20px; font-size: 18px; font-weight: 600; }
.voice-sub-hint { margin-top: 6px; font-size: 13px; color: var(--ink3); text-align: center; max-width: 400px; }
.voice-send-now {
  margin-top: 14px; height: 34px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600;
}
.voice-live-card {
  margin-top: 22px; width: 100%; max-width: 560px; max-height: 210px; overflow-y: auto;
  padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line);
}
.voice-live-think {
  font-size: 12px; color: var(--ink3); margin-bottom: 8px;
  padding-bottom: 8px; border-bottom: 1px dashed var(--line);
  white-space: pre-wrap; max-height: 74px; overflow-y: auto;
}
.voice-live-text { font-size: 14.5px; line-height: 1.65; white-space: pre-wrap; }

.voice-transcript-pane {
  width: 340px; flex-shrink: 0; border-left: 1px solid var(--line);
  background: var(--side); display: flex; flex-direction: column;
}
.voice-transcript-head {
  padding: 12px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink2);
  border-bottom: 1px solid var(--line);
}
.voice-transcript-list {
  flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.vt-row {
  padding: 9px 11px; border-radius: 11px; font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.vt-row.user { background: var(--user-bg); align-self: flex-end; max-width: 92%; }
.vt-row.assistant { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; max-width: 96%; }
.vt-row .vt-think { font-size: 11.5px; color: var(--ink3); margin-bottom: 5px; }

.voice-dock {
  flex-shrink: 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
}
.voice-dock-pill {
  height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 13.5px; font-weight: 500;
}
.voice-dock-pill.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.voice-dock-circle {
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.voice-dock-circle[aria-pressed="true"] {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.voice-dock-end {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--danger); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}

/* 弹窗 & Lightbox & Toast */
.modal-mask {
  position: fixed; inset: 0; z-index: 450;
  background: rgba(0,0,0,0.45); display: grid; place-items: center; padding: 16px;
}
.modal-card {
  width: 100%; max-width: 440px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.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: 18px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  padding: 9px 16px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--shadow);
}

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(1.25); } }
@keyframes breathe { 0%, 100% { transform: scale(0.96); } 50% { transform: scale(1.05); } }
@keyframes spin { from { transform: scale(1.05) rotate(0deg); } to { transform: scale(1.05) rotate(360deg); } }

@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);
  }
  .direct-pill { display: none; }
  .voice-transcript-pane { display: none; }
  .voice-overlay.show-transcript-mobile .voice-transcript-pane {
    display: flex; position: fixed; inset: 60px 10px 88px 10px; z-index: 320;
    width: auto; border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: var(--shadow);
  }
  .model-btn { max-width: 165px; }
  .model-btn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
