/* 跟随浏览器及系统文字大小，关键聊天内容和按钮允许换行。 */
html { font-size: 100%; -webkit-text-size-adjust: auto; text-size-adjust: auto; }
body { font-size: .875rem; }
.msg .bubble { font-size: .9375rem; line-height: 1.7; max-height: none; height: auto; text-overflow: clip; -webkit-line-clamp: unset; }
.msg > :not(.avatar):not(.ava):not(.bubble) { flex: 0 1 auto; min-width: 0; }
.msg .lc-rich-text { display: block; max-height: none; overflow: visible; -webkit-line-clamp: unset; }
.msg .meta { font-size: .75rem; line-height: 1.5; flex-wrap: wrap; }
.btn, .q-btn, .conv-tag { height: auto; min-height: 1.875rem; line-height: 1.5; }
.conv-name, .conv-last { font-size: .8125rem; line-height: 1.5; }
.composer-toolbar { flex-wrap: nowrap; max-height: min(30dvh, 10rem); overflow-x: auto; overflow-y: auto; }
.composer-toolbar > * { flex-shrink: 0; }
.composer-toolbar > .btn, .composer-toolbar [data-file-trigger] { height: auto; min-height: 2.125rem; font-size: .8125rem; line-height: 1.5; }
.chat-input-row textarea { font-size: max(16px, 1rem); }
.chat-input-row > .btn-primary { height: auto !important; min-height: 2.5rem; font-size: .875rem; }
.field input, .field textarea, .field select { font-size: max(16px, 1rem); }
.field label, .tip, .muted { overflow-wrap: anywhere; }
.conv-unreplied { color: #9a4a08; border-color: #e8bc6c; background: #fff5da; }
.lc-file-picker { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; overflow: hidden; border-radius: 8px; }
.lc-file-picker [data-file-trigger] { pointer-events: none; }
.lc-file-picker input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; margin: 0; }
.lc-file-picker:focus-within { outline: 2px solid var(--accent, #4f6ef7); outline-offset: 2px; }
.lc-file-picker.disabled { opacity: .5; cursor: default; }
.lc-file-picker.disabled input { cursor: default; }
.lc-translation { margin-top: 8px; padding: 9px 12px; border: 1px solid var(--line-2, #b8c4d9); border-left: 3px solid var(--accent, #4f6ef7); border-radius: 10px; font-size: .875rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel-2, #f5f7fc); color: var(--text, #20304b); }
.lc-translation-progress { margin-top: 6px; font-size: .75rem; line-height: 1.6; color: var(--muted, #64748b); overflow-wrap: anywhere; }
.lc-translation-progress.is-error { color: var(--danger, #be4545); }
.lc-translation-progress button, .lc-translate-dialog [data-access] button { min-height: 32px; margin-left: 6px; padding: 4px 10px; border: 1px solid var(--line-2, #b8c4d9); border-radius: 7px; font: inherit; color: var(--accent, #4f6ef7); background: var(--panel, #fff); cursor: pointer; }
#translationBtn[data-access="plan"], #translationBtn[data-access="disabled"] { border-style: dashed; }
.lc-translation b { display: block; font-size: .75rem; color: var(--muted, #64748b); }
.lc-translation-state { flex: 0 0 auto; max-width: min(70vw, 28rem); font-size: .75rem; line-height: 1.6; color: var(--muted, #64748b); overflow-wrap: anywhere; }
.lc-translation-state[hidden] { display: none; }
.lc-translate-mask { position: fixed; inset: 0; z-index: 2147483001; padding: 20px; display: grid; place-items: center; background: rgba(10, 18, 36, .5); }
.lc-translate-dialog { width: min(100%, 480px); max-height: 85dvh; overflow: auto; padding: 20px; box-sizing: border-box; border-radius: 16px; background: var(--panel, #fff); color: var(--text, #20304b); font-size: .875rem; line-height: 1.7; }
.lc-translate-dialog h3 { margin: 0 0 12px; font-size: 1.125rem; }
.lc-translate-dialog label { display: block; font-weight: 600; }
.lc-translate-dialog select { display: block; width: 100%; margin-top: 8px; padding: 10px; font: inherit; background: var(--panel-2, #f5f7fc); color: inherit; border: 1px solid var(--line-2, #b8c4d9); border-radius: 8px; }
.lc-translate-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.lc-translate-actions button { padding: 8px 14px; font: inherit; cursor: pointer; color: inherit; background: var(--panel-2, #f5f7fc); border: 1px solid var(--line-2, #b8c4d9); border-radius: 8px; }
.lc-translate-actions [data-save] { background: var(--accent, #4f6ef7); color: #fff; }
.msg.welcome-message .bubble { position: relative; isolation: isolate; color: #69450b; background: #fff3ce; border: 1px solid #dfbc60; }
.msg.welcome-message .bubble::after { content: ""; position: absolute; inset: 0; border: 2px solid #e9b842; border-radius: inherit; pointer-events: none; opacity: .2; animation: lc-welcome-breathe 4s ease-in-out infinite alternate; }
[data-chat-style] .msg.welcome-message:not(.revoked) .bubble { background: #fff3ce; color: #69450b; border-color: #dfbc60; }
[data-theme="dark"] .msg.welcome-message .bubble, [data-theme="dark"] [data-chat-style] .msg.welcome-message:not(.revoked) .bubble { background: #3b2e15; color: #ffe5a3; border-color: #ac873d; }
@keyframes lc-welcome-breathe { to { opacity: .8; } }
@media (prefers-reduced-motion: reduce) { .msg.welcome-message .bubble::after { animation: none; opacity: .4; } }
@media (max-width: 860px) {
  .field-row { flex-wrap: wrap; }
  .field-row > .field { min-width: min(100%, 200px); flex: 1 1 200px; }
  .msg { max-width: 94%; }
}

/* 消息容器不保留 HTML 模板缩进，正文的真实空白仅交给富文本节点。 */
.msg .bubble, .sp-msg .sp-bubble { white-space: normal; }
/* 气泡宽度由正文决定，发送者/时间/操作按钮另行排版，不能把两字回复撑成长条。 */
.msg .bubble { width: fit-content; max-width: 100%; box-sizing: border-box; }
.msg:not(.me) .bubble { margin-right: auto; align-self: flex-start; }
.msg.me .bubble { margin-left: auto; align-self: flex-end; }
.msg.sys .bubble { margin-left: auto; margin-right: auto; align-self: center; }
.lc-rich-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.lc-rich-text a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.lc-rich-color {
  color: #5140ba; font-weight: 700;
  background: linear-gradient(100deg, #7040b7, #075eac, #006d67);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.lc-rich-alert { color: #873608; background: #fff0cf; border-radius: 4px; padding: 1px 4px; font-weight: 700; }
[data-theme="dark"] .lc-rich-color { color: #d4c5ff; background-image: linear-gradient(100deg, #e3b8ff, #a7d8ff, #88eddd); }
[data-theme="dark"] .lc-rich-alert { color: #ffe1a3; background: #51340f; }
.msg.me .lc-rich-color { background-image: linear-gradient(100deg, #fff2b2, #fff, #bffdf1); }
.msg.me .lc-rich-alert { color: #422403; background: #ffe7ab; }
.lc-rich-editor { margin-top: 8px; }
.lc-rich-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-rich-tools button { font: inherit; font-size: 12px; cursor: pointer; border: 1px solid var(--line, #d2d8e5); border-radius: 6px; padding: 5px 9px; background: var(--panel, #fff); color: var(--text, #20304b); }
.lc-rich-tools button:hover { border-color: var(--primary, #536ef7); }
.lc-rich-preview { margin-top: 10px; border: 1px dashed var(--line, #cbd5e1); border-radius: 8px; padding: 12px; color: var(--text, #20304b); background: var(--panel-2, #f7f9fc); line-height: 1.65; }
.lc-rich-preview[hidden] { display: none; }

.lc-ann-body { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.lc-ann-body a { color: var(--accent); text-decoration: underline; text-underline-offset: .16em; }
.lc-ann-body a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lc-theme-switch {
  display: inline-flex; align-items: stretch; gap: 3px; padding: 3px;
  max-width: 100%; box-sizing: border-box; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel-2); color: var(--muted);
}
.lc-theme-button {
  min-height: 32px; padding: 4px 8px; border: 1px solid transparent; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  color: inherit; background: none; cursor: pointer; font: inherit; font-size: .75rem; line-height: 1.3;
}
.lc-theme-button svg { width: 14px; height: 14px; flex: 0 0 auto; }
.lc-theme-button:hover { color: var(--text); background: var(--panel); }
.lc-theme-button[aria-pressed="true"] { color: var(--text); background: var(--panel); border-color: var(--accent); font-weight: 650; }
.lc-theme-button:focus-visible, .lc-theme-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lc-auth-theme { margin-bottom: 12px; }
.side-tools-theme.lc-theme-switch {
  display: flex; width: 100%; flex: 0 0 auto; min-height: 0; height: auto;
  align-self: stretch; align-items: center; gap: 2px; padding: 2px;
}
.side-tools-theme .lc-theme-button {
  flex: 1 1 0; min-width: 0; min-height: 28px; height: 28px;
  padding: 2px 3px; gap: 4px; font-size: 11px; white-space: nowrap;
}
.side-tools-theme .lc-theme-button svg { width: 13px; height: 13px; }
@media (pointer: coarse) {
  .side-tools-theme .lc-theme-button { min-height: 36px; height: 36px; }
}
@media (max-height: 600px) {
  .sidebar .side-tools { gap: 4px; margin-top: 4px; padding-top: 5px; padding-bottom: 4px; }
}
.lc-gate-theme { margin-top: 12px; }
.lc-theme-menu { position: relative; flex-shrink: 0; }
.lc-theme-menu > summary { list-style: none; }
.lc-theme-menu > summary::-webkit-details-marker { display: none; }
.lc-theme-menu[open] > summary { color: var(--accent); background: var(--accent-soft); }
.lc-theme-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 10; width: max-content; max-width: min(230px, 72vw); box-shadow: var(--shadow); }
@media (max-width: 600px) {
  .lc-nav-theme .lc-theme-button { min-width: 30px; padding-inline: 4px; }
  .lc-nav-theme .lc-theme-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.lc-reply-emoji { margin-top: 8px; }
.lc-reply-emoji b { display: block; margin-bottom: 5px; font-size: .75rem; font-weight: 600; color: var(--text-2, var(--text)); }
.lc-reply-emoji-row { display: flex; flex-wrap: wrap; gap: 4px; }
.lc-reply-emoji-row button { min-width: 34px; min-height: 34px; padding: 3px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 1.0625rem; line-height: 1; cursor: pointer; }
.lc-reply-emoji-row button:is(:hover, :focus-visible) { border-color: var(--accent); background: var(--accent-soft); outline-color: var(--accent); }
.lc-appearance-preview { display: grid; gap: 12px; padding: 14px; margin: 10px 0; border: 1px solid var(--line, #d2d8e5); border-radius: 12px; background: var(--panel-2, #f7f9fc); }
.lc-appearance-preview .msg { margin: 0; max-width: 100%; }
.lc-appearance-preview .bubble { padding: 10px 14px; }

/* 收发靠左右位置、气泡缺角与边界区分，颜色不是唯一提示。 */
:where(.chat-body, .h5-body, .site-panel-body, [data-chat-style]) {
  --lc-chat-in: #edf2fa; --lc-chat-ink: #1d2d45; --lc-chat-line: #8192ae;
  --lc-chat-out: #294a91; --lc-chat-out-line: #203a74; --lc-chat-meta: #485a73;
}
[data-theme="dark"] :where(.chat-body, .h5-body, .site-panel-body, [data-chat-style]) {
  --lc-chat-in: #1d2a3d; --lc-chat-ink: #eaf1fc; --lc-chat-line: #798aa5;
  --lc-chat-out: #335497; --lc-chat-out-line: #829cf0; --lc-chat-meta: #b4c5dd;
}
[data-chat-style="aurora"] { --lc-chat-in: #f0e9ff; --lc-chat-ink: #332451; --lc-chat-line: #8876b6; --lc-chat-out: #483881; --lc-chat-out-line: #8073b8; --lc-chat-accent: #b4b2ff; }
[data-chat-style="ocean"] { --lc-chat-in: #e3f3fc; --lc-chat-ink: #153a55; --lc-chat-line: #568eae; --lc-chat-out: #14547f; --lc-chat-out-line: #6a9dbe; --lc-chat-accent: #9cdef5; }
[data-chat-style="sunset"] { --lc-chat-in: #fff0e4; --lc-chat-ink: #5d321a; --lc-chat-line: #aa795c; --lc-chat-out: #84391e; --lc-chat-out-line: #bb8265; --lc-chat-accent: #ffd19a; }
[data-chat-style="forest"] { --lc-chat-in: #e6f4ed; --lc-chat-ink: #1f4635; --lc-chat-line: #60927c; --lc-chat-out: #205d46; --lc-chat-out-line: #679d86; --lc-chat-accent: #b1ead3; }
[data-chat-style="starlight"] { --lc-chat-in: #eceffc; --lc-chat-ink: #303d63; --lc-chat-line: #7586b3; --lc-chat-out: #3b497b; --lc-chat-out-line: #8090bd; --lc-chat-accent: #c8d2ff; }
[data-theme="dark"] [data-chat-style="aurora"] { --lc-chat-in: #2e2947; --lc-chat-ink: #f1eaff; --lc-chat-line: #9680c0; }
[data-theme="dark"] [data-chat-style="ocean"] { --lc-chat-in: #203847; --lc-chat-ink: #e6f6ff; --lc-chat-line: #74a7c6; }
[data-theme="dark"] [data-chat-style="sunset"] { --lc-chat-in: #453027; --lc-chat-ink: #ffecdb; --lc-chat-line: #c18f71; }
[data-theme="dark"] [data-chat-style="forest"] { --lc-chat-in: #263e34; --lc-chat-ink: #e4f8ee; --lc-chat-line: #7aad90; }
[data-theme="dark"] [data-chat-style="starlight"] { --lc-chat-in: #2b3047; --lc-chat-ink: #edf0ff; --lc-chat-line: #90a2cf; }
:is(.msg, .sp-msg):not(.sys, .revoked, .welcome-message) :is(.bubble, .sp-bubble) {
  background: var(--lc-chat-in, #edf2fa); color: var(--lc-chat-ink, #1d2d45);
  border: 1px solid var(--lc-chat-line, #8192ae); border-radius: 5px 14px 14px 14px;
  box-shadow: 0 1px 2px rgb(12 24 42 / .09);
}
:is(.msg, .sp-msg).me:not(.sys, .revoked, .welcome-message) :is(.bubble, .sp-bubble) {
  background: var(--lc-chat-out, #294a91); color: #fff;
  border-color: var(--lc-chat-out-line, #203a74); border-radius: 14px 5px 14px 14px;
}
.msg .meta, .msg .meta-name, .sp-msg .sp-time { color: var(--lc-chat-meta, var(--muted, #485a73)); opacity: 1; }
.msg:not(.sys, .revoked, .welcome-message) .bubble .quote-ref { color: inherit; border-inline-start-color: currentColor; }
.msg:not(.sys, .revoked, .welcome-message) .bubble .quote-ref :is(b, span) { color: inherit; }
[data-chat-style]:not([data-chat-style="default"]) .msg:not(.sys, .revoked, .welcome-message) .bubble {
  position: relative; isolation: isolate; overflow: hidden;
}
[data-chat-style]:not([data-chat-style="default"]) .msg:not(.sys, .revoked, .welcome-message) .bubble::before {
  content: ""; position: absolute; inset: -35%; z-index: -1; pointer-events: none;
  background: var(--lc-chat-pattern, radial-gradient(ellipse at 20% 35%, var(--lc-chat-accent), transparent 58%));
  opacity: .08; transform: translateX(-12%);
}
[data-chat-style="aurora"] .msg .bubble::before { animation: lc-aurora-glow 8s ease-in-out infinite alternate; }
[data-chat-style="ocean"] .msg .bubble::before { --lc-chat-pattern: repeating-linear-gradient(145deg, transparent 0 24px, var(--lc-chat-accent) 30px, transparent 38px); animation: lc-ocean-wave 9s ease-in-out infinite alternate; }
[data-chat-style="sunset"] .msg .bubble::before { --lc-chat-pattern: radial-gradient(ellipse at 75% 100%, var(--lc-chat-accent), transparent 65%); animation: lc-sunset-glow 7s ease-in-out infinite alternate; }
[data-chat-style="forest"] .msg .bubble::before { --lc-chat-pattern: linear-gradient(120deg, transparent 25%, var(--lc-chat-accent), transparent 70%); animation: lc-forest-breeze 10s ease-in-out infinite alternate; }
[data-chat-style="starlight"] .msg .bubble::before { --lc-chat-pattern: radial-gradient(circle at 25% 25%, var(--lc-chat-accent) 0 2px, transparent 3px), radial-gradient(circle at 75% 70%, var(--lc-chat-accent) 0 1px, transparent 2px); animation: lc-star-glow 5s ease-in-out infinite alternate; }
/* 仅可见消息启用动效；未支持观察器时保留静态配色。 */
[data-chat-style] .msg:not(.lc-motion-visible) .bubble::before,
[data-chat-style] .msg:not(.lc-motion-visible) .bubble::after { animation: none !important; }
[data-avatar-frame="bronze"] { --lc-frame: #ab633c; --lc-frame-light: #e9ae82; --lc-frame-period: 4.8s; }
[data-avatar-frame="silver"] { --lc-frame: #687fa9; --lc-frame-light: #bed3ed; --lc-frame-period: 4.6s; }
[data-avatar-frame="jade"] { --lc-frame: #1e806e; --lc-frame-light: #89dfc0; --lc-frame-period: 4.4s; }
[data-avatar-frame="violet"] { --lc-frame: #8250ba; --lc-frame-light: #d6acf2; --lc-frame-period: 4.2s; }
[data-avatar-frame="gold"] { --lc-frame: #a56f13; --lc-frame-light: #f8d477; --lc-frame-period: 4s; }
[data-avatar-frame]:not([data-avatar-frame="none"]) .msg > .lc-merchant-avatar {
  position: relative; flex-shrink: 0; overflow: visible; border-radius: 50%;
  box-shadow: 0 0 0 1px var(--lc-frame), 0 0 0 2px var(--lc-frame-light);
}
[data-avatar-frame]:not([data-avatar-frame="none"]) .msg > .lc-merchant-avatar img { border-radius: 50%; }
[data-avatar-frame]:not([data-avatar-frame="none"]) .msg > .lc-merchant-avatar::after {
  content: ""; position: absolute; inset: -3px; border: 1px solid var(--lc-frame-light);
  border-radius: 50%; box-shadow: 0 0 7px var(--lc-frame); opacity: .22; pointer-events: none;
}
[data-avatar-frame]:not([data-avatar-frame="none"]) .msg.lc-motion-visible:not(.revoked) > .lc-merchant-avatar::after {
  animation: lc-frame-glow var(--lc-frame-period) ease-in-out infinite;
}
@keyframes lc-frame-glow { 0%, 100% { opacity: .22; } 50% { opacity: .66; } }
@keyframes lc-aurora-glow { to { transform: translateX(15%) rotate(8deg); opacity: .16; } }
@keyframes lc-ocean-wave { to { transform: translate(14%, 7%); opacity: .14; } }
@keyframes lc-sunset-glow { to { transform: scale(1.12); opacity: .16; } }
@keyframes lc-forest-breeze { to { transform: translateX(20%) rotate(-5deg); opacity: .12; } }
@keyframes lc-star-glow { to { transform: translateY(-3%); opacity: .17; } }
@media (prefers-reduced-motion: reduce) {
  [data-chat-style] .msg .bubble::before { animation: none !important; transform: none !important; }
  [data-avatar-frame] .msg > .lc-merchant-avatar::after { animation: none !important; }
}
@media (forced-colors: active) {
  .lc-rich-color { background: none; -webkit-text-fill-color: currentColor; color: Highlight; }
  .lc-rich-alert { border: 1px solid currentColor; }
  [data-chat-style] .msg .bubble::before { display: none; }
  [data-avatar-frame]:not([data-avatar-frame="none"]) .msg > .lc-merchant-avatar { outline: 2px solid Highlight; }
}
