/* A paint boundary contains combining glyphs and long unbroken text. Original messages remain intact. */
:root #msgs .m{min-width:0;box-sizing:border-box;max-width:min(82%,620px)}
.m>.chat-text{max-width:100%;min-width:0;white-space:normal!important}
.message-copy{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal;min-width:0;max-width:100%;contain:paint;overflow:hidden;padding:3px 1px;line-height:1.5;box-sizing:border-box}
.message-copy.is-long{max-height:18em;position:relative}.message-copy.is-long:not(.is-expanded){mask-image:linear-gradient(#000 85%,transparent)}
.message-copy.is-expanded{max-height:60dvh;overflow:auto;overscroll-behavior:contain;mask-image:none;scrollbar-width:thin;scrollbar-color:#a17bb6 transparent}
.message-expand{font:500 12px system-ui;border:0;background:transparent;color:var(--chat-accent);padding:8px 0;min-height:36px;cursor:pointer}
.m .chat-text a{overflow-wrap:anywhere}.chat-mention{font-weight:600;background:var(--chat-soft);padding:0 3px;border-radius:4px;text-decoration:none}
.comp{position:relative;min-width:0}.comp textarea{min-width:0;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere;contain:paint;overflow:auto!important}
.chat-reply-quote{display:block;width:100%;max-width:100%;min-width:0;text-align:left;border:0;border-left:3px solid var(--chat-accent);border-radius:7px;padding:6px 9px;margin:2px 0 8px;background:var(--chat-soft);color:var(--chat-ink);cursor:pointer;overflow:hidden;contain:paint;white-space:normal;box-sizing:border-box}
.chat-reply-quote strong,.chat-reply-quote span{display:block;overflow:hidden;max-width:100%;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:1.6}.chat-reply-quote strong{color:var(--chat-accent)}.chat-reply-quote:disabled{cursor:default;opacity:.7}
.chat-reply-draft{display:flex;align-items:center;gap:9px;width:100%;min-width:0;border-left:3px solid var(--chat-accent);padding:5px 8px;background:var(--chat-soft);border-radius:9px;box-sizing:border-box;contain:paint}.chat-reply-draft>span{flex:1;min-width:0}.chat-reply-draft strong,.chat-reply-draft small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:1.6}.chat-reply-draft small{color:var(--chat-muted)}.chat-reply-draft>svg{flex:none;width:20px}.chat-reply-draft button{flex:none;min-width:44px;min-height:44px}.chat-edit-bar:has(.chat-reply-draft){display:flex;padding:6px 10px}
.chat-mentions{position:absolute;bottom:calc(100% + 6px);left:8px;right:8px;z-index:30;max-height:min(240px,35dvh);overflow:auto;background:var(--chat-paper);color:var(--chat-ink);border:1px solid var(--chat-line);border-radius:12px;box-shadow:0 8px 24px #1b10252b;padding:5px;scrollbar-width:thin;scrollbar-color:#a17bb6 transparent}.chat-mentions button{display:flex;flex-wrap:wrap;gap:4px 10px;width:100%;min-height:44px;align-items:center;text-align:left;border:0;border-radius:8px;background:transparent;color:inherit;padding:9px;font:400 13px system-ui;cursor:pointer}.chat-mentions button[aria-selected=true]{background:var(--chat-soft)}.chat-mentions span{color:var(--chat-muted);overflow-wrap:anywhere;min-width:0}.chat-readers{display:grid;gap:8px}.chat-readers>a{padding:8px;border-radius:8px;background:var(--chat-soft);overflow-wrap:anywhere}.chat-readers small{color:var(--chat-muted)}.reply-original .message-copy{max-height:60dvh;overflow:auto}.reply-highlight{outline:2px solid var(--chat-accent);outline-offset:3px}
.chat-mute-control{display:grid;gap:8px;font-size:14px}.chat-mute-control select{min-height:44px;font:400 14px system-ui}.chat-mute-control small{font-size:12px;color:var(--chat-muted);font-weight:400;line-height:1.5}
/* Reactions form a quiet strip; no new card, gradient or inflated message padding. */
:root #msgs .chat-reactions{display:flex;flex-wrap:wrap;gap:4px;margin:5px 0 1px;max-width:100%;width:fit-content;min-width:0;white-space:normal;line-height:1}
:root #msgs .chat-reactions:empty{display:none}
:root #msgs .chat-reactions button{display:inline-flex;align-items:center;justify-content:center;gap:4px;width:auto;min-width:42px;min-height:30px;height:30px;padding:4px 8px;border:1px solid var(--chat-line);border-radius:14px;background:var(--chat-soft);color:var(--chat-ink);box-shadow:none;line-height:1;font:400 15px system-ui;cursor:pointer}
:root #msgs .chat-reactions button[aria-pressed=true]{border-color:var(--chat-accent);background:color-mix(in srgb,var(--chat-accent) 12%,var(--chat-paper))}
:root #msgs .chat-reactions small{display:inline;margin:0;opacity:1;text-align:inherit;font-size:11px;line-height:1;color:var(--chat-muted)}
:root #msgs .m:not(.is-video-message):has(>.chat-reactions:not(:empty)){display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'author author' 'body body' 'reactions footer';column-gap:8px}
:root #msgs .m:not(.is-video-message):has(>.chat-reactions:not(:empty))>.who{grid-area:author}
:root #msgs .m:not(.is-video-message):has(>.chat-reactions:not(:empty))>.chat-text{grid-area:body}
:root #msgs .m:not(.is-video-message):has(>.chat-reactions:not(:empty))>.chat-reactions{grid-area:reactions;align-self:end;margin:3px 0 0}
:root #msgs .m:not(.is-video-message):has(>.chat-reactions:not(:empty))>.message-footer{grid-area:footer;align-self:end}
.chat-emoji{display:inline-block!important;width:1.2em!important;height:1.2em!important;max-width:none!important;max-height:none!important;margin:0 .05em!important;vertical-align:-.2em;object-fit:contain;pointer-events:none;box-shadow:none!important;border:0!important;border-radius:0!important}
.design-emoji-grid .chat-emoji,.reaction-picker .chat-emoji{width:26px!important;height:26px!important;vertical-align:middle}
.chat-reactions .chat-emoji{width:19px!important;height:19px!important}
.chat-popover button{flex:none}.chat-popover:not(.reaction-picker){max-width:calc(100vw - 16px);flex-wrap:wrap}
.clipboard-fallback{position:fixed;left:-10000px;top:0}
.chat-icon-button:focus-visible,.message-expand:focus-visible,.chat-reply-quote:focus-visible,.chat-reactions button:focus-visible{outline:2px solid var(--chat-accent);outline-offset:2px}
@media(max-width:820px){:root #msgs .m{max-width:92%}:root #msgs .chat-reactions button{min-height:44px;height:44px;min-width:44px}.message-expand{min-height:44px}.message-footer [data-chat=message_menu]{width:44px;min-width:44px;height:44px;min-height:44px}.chat-popover:not(.reaction-picker){max-width:calc(100vw - 16px)}.chat-dialog:has(#chatMuteFor){max-height:80dvh}}
@media(prefers-reduced-motion:reduce){.reply-highlight{transition:none}}
