.community-chat{--chat-accent:var(--accent,#743ce6);position:fixed;right:24px;bottom:24px;z-index:35;font-size:14px;line-height:1.45;color:var(--ink)}
.community-chat [hidden]{display:none!important}
.chat-backdrop{display:none}
@media(max-width:599px){.chat-backdrop{display:block;position:fixed;inset:0;z-index:0;background:color-mix(in srgb,var(--surface) 18%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);opacity:0;pointer-events:none;touch-action:none;transition:opacity 280ms ease}.chat-open .chat-backdrop{opacity:1;pointer-events:auto}.chat-panel,.chat-launcher{position:relative;z-index:1}}
@media(prefers-reduced-motion:reduce){.chat-backdrop{transition:none}}
@media(prefers-reduced-transparency:reduce){.chat-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none;background:color-mix(in srgb,var(--surface) 65%,transparent)}}
.chat-launcher{display:flex;align-items:center;gap:9px;border:1px solid #9566ee55;border-radius:16px;background:linear-gradient(135deg,#7742d8,#5832a1);color:#fff;padding:13px 18px;box-shadow:0 8px 28px #25143b24;transition:transform 380ms ease,box-shadow 480ms ease;font-weight:650;font-size:14px}
.chat-launcher svg{width:21px;height:21px}.chat-launcher-dot{width:6px;height:6px;border-radius:50%;background:#d0bde9;opacity:.6}.chat-connected .chat-launcher-dot{background:#b9efce;opacity:1}.chat-unread{background:#fff;color:#6333ba;font-family:inherit;font-weight:700;font-size:11px;line-height:1.5;min-width:20px;height:20px;border-radius:8px;padding:2px 5px}
.chat-panel{display:flex;flex-direction:column;width:390px;height:610px;max-height:calc(100dvh - 110px);border:1px solid var(--line);border-radius:20px;background:var(--surface);background:color-mix(in srgb,var(--surface) 96%,transparent);box-shadow:0 18px 80px #10051f40;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);overflow:hidden}
.chat-head{display:flex;align-items:center;gap:11px;padding:19px 18px 15px;border-bottom:1px solid var(--line);flex-shrink:0}.chat-heading-icon{display:grid;place-items:center;width:38px;height:38px;border-radius:12px;background:var(--soft);color:var(--accent);flex-shrink:0}.chat-heading-icon svg{width:21px;height:21px}.chat-head h2{margin:0;font-size:17px;font-weight:700;letter-spacing:-.025em;line-height:1.3}.chat-head p{margin:4px 0 0;color:var(--muted);font-size:11px}.chat-head .chat-close{margin-left:auto;flex-shrink:0;min-width:32px;width:32px;height:32px;display:grid;place-items:center;padding:6px;border-radius:10px}.chat-close svg{width:18px;height:18px}
.chat-info{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:11px 18px 5px;font-size:10px;color:var(--muted);flex-shrink:0}.chat-online-label{display:flex;align-items:center;gap:5px}.chat-online-label>span{width:6px;height:6px;background:var(--muted);border-radius:50%}.chat-connected .chat-online-label>span{background:#7fb895}.chat-online-count{font-weight:600;color:var(--ink)}.chat-expiry{font-variant-numeric:tabular-nums}.chat-people{padding:2px 18px 10px;color:var(--muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:0;border-bottom:1px solid var(--line)}
.chat-history{overflow:auto;overscroll-behavior:contain;flex:1;min-height:80px;padding:15px 16px;scrollbar-width:thin;scrollbar-color:var(--line) transparent}.chat-messages{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}.chat-message{align-self:flex-start;max-width:90%;min-width:120px;background:var(--surface-soft);border:1px solid var(--line);border-radius:13px 13px 13px 4px;padding:9px 11px}.chat-own{align-self:flex-end;background:var(--soft);border-color:color-mix(in srgb,var(--accent) 18%,var(--line));border-radius:13px 13px 4px 13px}.chat-message-meta{display:flex;justify-content:space-between;gap:16px;color:var(--muted);font-size:10px;line-height:1.4}.chat-message-meta strong{color:var(--accent);font-weight:650;overflow-wrap:anywhere}.chat-message time{flex-shrink:0;font-variant-numeric:tabular-nums}.chat-message p{margin:5px 0 0;font-size:13px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--ink)}.chat-empty{display:grid;place-items:center;text-align:center;height:100%;min-height:140px;color:var(--muted);align-content:center;gap:9px}.chat-empty>span{display:grid;place-items:center;width:52px;height:52px;border-radius:17px;background:var(--soft);color:var(--accent);margin-bottom:5px}.chat-empty svg{width:26px;height:26px}.chat-empty strong{color:var(--ink);font-size:13px}.chat-empty p{font-size:11px;line-height:1.65;margin:0}
.chat-jump{align-self:center;margin:0 0 7px;padding:5px 12px;border:1px solid var(--line);border-radius:9px;background:var(--soft);color:var(--accent);font-size:11px}.chat-error{padding:8px 17px;background:var(--soft);color:var(--accent);font-size:11px;border-top:1px solid var(--line);flex-shrink:0;overflow-wrap:anywhere}.chat-profile{display:flex;align-items:center;gap:8px;padding:11px 17px 8px;flex-shrink:0;border-top:1px solid var(--line)}.chat-profile label{font-size:10px;color:var(--muted);white-space:nowrap}.chat-profile input{min-width:0;flex:1;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:3px 1px;background:transparent;color:var(--ink);font-family:inherit;font-size:12px;line-height:1.5;outline-offset:3px}.chat-name-save{padding:4px 0;background:transparent;border:0;color:var(--accent);font-size:10px}.chat-name-save:disabled{opacity:.45}
.chat-composer{display:flex;align-items:flex-end;gap:8px;margin:0 13px;padding:9px 10px;background:var(--surface-soft);border:1px solid var(--line);border-radius:12px;flex-shrink:0}.chat-composer:focus-within{border-color:color-mix(in srgb,var(--accent) 50%,var(--line))}.chat-composer textarea{width:100%;min-width:0;resize:none;border:0;background:transparent;color:var(--ink);padding:2px;outline:none;font:13px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;max-height:85px}.chat-composer textarea::placeholder{color:var(--muted)}.chat-send{display:grid;place-items:center;flex-shrink:0;width:34px;height:34px;padding:7px;border:1px solid #9566ee55;border-radius:10px;background:#743ce6;color:#fff;transition:background 380ms ease,opacity 300ms ease}.chat-send svg{width:19px;height:19px}.chat-send:disabled{opacity:.35;cursor:default}.chat-foot{display:flex;justify-content:flex-end;gap:8px;padding:7px 16px 12px;color:var(--muted);font-size:8px;flex-shrink:0}.chat-length{white-space:nowrap;font-variant-numeric:tabular-nums}.chat-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(hover:hover){.chat-launcher:hover{transform:translateY(-2px);box-shadow:0 12px 32px #25143b32}.chat-send:not(:disabled):hover{background:#8a53e5}}
@media(prefers-reduced-motion:no-preference){.chat-panel:not([hidden]){animation:chat-arrive 420ms cubic-bezier(.22,.8,.25,1) both}.chat-message{animation:chat-message-arrive 320ms ease both}}
@keyframes chat-arrive{from{opacity:0;transform:translateY(12px) scale(.985)}to{opacity:1;transform:none}}
@keyframes chat-message-arrive{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
@media(max-width:599px){.community-chat{left:12px;right:12px;bottom:max(12px,env(safe-area-inset-bottom))}.chat-launcher{padding:11px 14px;border-radius:13px;margin-left:auto;width:max-content}.chat-panel{width:100%;height:580px;max-height:calc(100dvh - var(--header) - 28px);border-radius:16px}.chat-head{padding:13px 14px 11px}.chat-head h2{font-size:16px}.chat-info{padding-left:14px;padding-right:14px}.chat-people{padding-left:14px;padding-right:14px}.chat-profile{padding-top:9px;padding-bottom:7px}.chat-profile input,.chat-composer textarea{font-size:16px}.chat-length{font-size:9px}}
@media(prefers-reduced-transparency:reduce){.chat-panel{background:var(--surface);backdrop-filter:none;-webkit-backdrop-filter:none}}
.chat-name-hint{margin:0;padding:0 17px 8px;color:var(--accent);font-size:11px;line-height:1.4;flex-shrink:0}.chat-name-pending .chat-profile input{border-bottom-color:var(--accent)}.chat-name-pending .chat-name-save:not(:disabled){font-weight:700}.chat-name-pending .chat-composer{opacity:.55}
@media(max-height:540px){.chat-panel{max-height:calc(100dvh - 24px)}.chat-history{min-height:0}.chat-people,.chat-profile,.chat-foot,.chat-name-pending .chat-profile{display:flex}.chat-composer{margin-bottom:12px}.chat-head{padding-top:10px;padding-bottom:10px}}
@media(forced-colors:active){.chat-panel,.chat-launcher,.chat-message,.chat-send{background:Canvas;color:CanvasText;border:1px solid CanvasText}.chat-composer:focus-within{border-color:Highlight}}
@media print{.community-chat{display:none!important}}
/* Chat tools use the same quiet purple palette as the manual. */
.chat-head .chat-close{margin-left:0}.chat-settings-button{margin-left:auto;flex-shrink:0;width:32px;height:32px;min-width:32px;padding:6px;border-radius:10px;color:var(--muted)}.chat-settings-button svg{width:18px;height:18px}.chat-settings-button[aria-expanded=true]{color:var(--accent);background:var(--soft);border-color:var(--accent)}
.chat-message{display:flex;align-items:flex-end;gap:7px;min-width:0;max-width:100%;padding:0;border:0;background:none;border-radius:0}.chat-own{flex-direction:row-reverse;border:0;background:none;border-radius:0}.chat-avatar{display:grid;place-items:center;flex-shrink:0;width:27px;height:27px;border-radius:9px;background:hsl(var(--avatar-hue) 38% 42% / .18);color:hsl(var(--avatar-hue) 40% 62%);border:1px solid hsl(var(--avatar-hue) 35% 55% / .25);font-size:10px;font-weight:700}html:not([data-theme=dark]) .chat-avatar{color:hsl(var(--avatar-hue) 40% 34%)}.chat-bubble{min-width:120px;max-width:calc(100% - 34px);padding:9px 10px;background:var(--surface-soft);border:1px solid var(--line);border-radius:13px 13px 13px 4px;transition:border-color 400ms ease,background-color 400ms ease}.chat-own .chat-bubble{background:var(--soft);border-color:color-mix(in srgb,var(--accent) 18%,var(--line));border-radius:13px 13px 4px 13px}.chat-quoted-target .chat-bubble{border-color:var(--accent)}
.chat-message-actions{display:flex;align-items:center;flex-wrap:wrap;gap:3px;margin-top:7px}.chat-reaction,.chat-reply-button{display:inline-flex;align-items:center;justify-content:center;gap:3px;min-width:28px;min-height:27px;padding:3px 5px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--muted);font-family:inherit;font-size:10px;line-height:1.2;transition:background-color 250ms ease,border-color 250ms ease,color 250ms ease}.chat-reaction b{font-size:13px;font-weight:400}.chat-reaction[aria-pressed=true]{border-color:color-mix(in srgb,var(--accent) 32%,transparent);background:color-mix(in srgb,var(--accent) 13%,transparent);color:var(--accent)}.chat-reply-button{margin-left:auto;font-size:18px}.chat-reaction:disabled{opacity:.5}
.chat-quote{display:block;width:100%;margin-top:7px;padding:5px 7px;text-align:left;border:0;border-left:2px solid var(--accent);border-radius:3px 6px 6px 3px;background:color-mix(in srgb,var(--accent) 7%,transparent);color:var(--muted);font-family:inherit}.chat-quote strong,.chat-quote span{display:block;font-size:10px;line-height:1.4;overflow-wrap:anywhere}.chat-quote strong{color:var(--accent);margin-bottom:2px}.chat-quote span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.chat-reply-draft{display:flex;align-items:center;gap:7px;margin:0 13px 7px;padding:7px 9px;border-left:2px solid var(--accent);border-radius:4px 8px 8px 4px;background:var(--soft);flex-shrink:0}.chat-reply-draft>div{flex:1;min-width:0}.chat-reply-draft strong,.chat-reply-draft span{display:block;font-size:10px;line-height:1.45;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chat-reply-draft strong{color:var(--accent)}.chat-reply-draft span{color:var(--muted)}.chat-reply-draft button{width:28px;height:28px;border:0;border-radius:7px;color:var(--muted);background:transparent;font-size:20px}
.chat-new-divider{display:flex;align-items:center;gap:8px;padding:4px 0;font-size:10px;color:var(--accent);flex-shrink:0}.chat-new-divider::before,.chat-new-divider::after{content:'';height:1px;background:var(--line);flex:1}.chat-foot{justify-content:space-between;align-items:center;min-height:28px}.chat-typing{display:flex;align-items:center;gap:5px;min-width:0;font-size:10px}.chat-typing-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.chat-typing-dots{display:inline-flex;gap:3px;flex-shrink:0}.chat-typing-dots i{width:3px;height:3px;border-radius:50%;background:var(--accent);opacity:.45}
@media(hover:hover){.chat-reaction:hover,.chat-reply-button:hover,.chat-reply-draft button:hover{background:color-mix(in srgb,var(--accent) 10%,transparent);color:var(--accent)}}
@media(prefers-reduced-motion:no-preference){.chat-message{animation:none}.chat-message-new{animation:chat-message-arrive 360ms cubic-bezier(.22,.8,.25,1) both}.chat-typing-dots i{animation:chat-dot 1100ms ease-in-out infinite}.chat-typing-dots i:nth-child(2){animation-delay:150ms}.chat-typing-dots i:nth-child(3){animation-delay:300ms}.chat-reply-draft:not([hidden]){animation:chat-message-arrive 250ms ease both}}
@keyframes chat-dot{0%,70%,100%{transform:translateY(0);opacity:.4}35%{transform:translateY(-3px);opacity:.9}}
@media(max-width:599px){.chat-reaction,.chat-reply-button{min-width:32px;min-height:32px}.chat-avatar{width:25px;height:25px;font-size:9px}.chat-bubble{max-width:calc(100% - 32px)}.chat-foot{min-height:29px}.chat-typing{font-size:9px}}
@media(max-height:540px){.chat-people{display:none}.chat-foot{display:flex;padding:4px 16px 7px}.chat-composer{margin-bottom:0}}
@media(forced-colors:active){.chat-bubble,.chat-avatar,.chat-reaction[aria-pressed=true]{background:Canvas;color:CanvasText;border:1px solid CanvasText}}

/* Only selected reactions stay on the message; the palette floats on hover/tap. */
.chat-message-actions{gap:4px;margin-top:7px}.chat-message-meta{align-items:center;gap:8px}.chat-message-meta time{margin-left:auto}.chat-message-meta .chat-reply-button{margin-left:0;min-width:22px;min-height:22px;padding:0;font-size:16px}.chat-reaction{border-color:var(--line);background:color-mix(in srgb,var(--accent) 5%,transparent)}
.chat-bubble:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.chat-reply-button svg{display:block;width:16px;height:16px;flex-shrink:0;pointer-events:none}
.chat-reaction-picker{position:fixed;z-index:3;width:max-content;display:flex;align-items:center;gap:3px;padding:5px;border:1px solid color-mix(in srgb,var(--accent) 22%,var(--line));border-radius:15px;background:var(--surface);box-shadow:0 6px 24px #10051f25;opacity:0;transform:translateY(4px) scale(.97);pointer-events:none;transition:opacity 180ms ease,transform 220ms cubic-bezier(.22,.8,.25,1)}.chat-reaction-picker.is-visible{opacity:1;transform:none;pointer-events:auto}.chat-picker-reaction{display:grid;place-items:center;width:34px;height:34px;border:1px solid transparent;border-radius:10px;background:transparent;font-size:20px;line-height:1;transition:background-color 180ms ease,transform 220ms ease,border-color 180ms ease}.chat-picker-reaction[aria-pressed=true]{border-color:color-mix(in srgb,var(--accent) 30%,transparent);background:var(--soft)}.chat-picker-reaction:disabled{opacity:.5}.chat-picker-reaction:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
@media(hover:hover){.chat-picker-reaction:hover{background:var(--soft);transform:translateY(-2px)}}
@media(max-width:599px){.chat-picker-reaction{width:39px;height:39px}.chat-reaction-picker{border-radius:16px}.chat-message-meta .chat-reply-button{min-width:28px;min-height:28px}}
@media(prefers-reduced-motion:reduce){.chat-reaction-picker,.chat-picker-reaction{transition:none;transform:none}}
@media(forced-colors:active){.chat-reaction-picker,.chat-reaction{background:Canvas;color:CanvasText;border:1px solid CanvasText}}

/* Notifications use the spare space above the launcher, newest first. */
.chat-notifications{position:absolute;right:0;bottom:calc(100% + 12px);width:320px;max-width:calc(100vw - 24px);display:flex;flex-direction:column;gap:9px;pointer-events:none}
.chat-toast{position:relative;flex-shrink:0;display:flex;align-items:flex-start;border:1px solid var(--line);border-radius:15px 15px 4px 15px;background:var(--surface);box-shadow:0 7px 24px #10051f20;pointer-events:auto;overflow:hidden}
.chat-toast-open{flex:1;min-width:0;display:block;padding:12px 11px 12px 14px;border:0;border-radius:inherit;background:transparent;color:var(--ink);font-family:inherit;text-align:left;transition:background-color 350ms ease}
.chat-toast-meta{display:flex;align-items:baseline;justify-content:space-between;gap:12px;font-size:11px;line-height:1.4}.chat-toast-meta strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--accent);font-weight:650}.chat-toast-meta time{flex-shrink:0;color:var(--muted);font-size:10px;font-variant-numeric:tabular-nums}
.chat-toast-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;margin-top:5px;font-size:13px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.chat-toast-dismiss{flex-shrink:0;width:28px;height:28px;padding:0;margin:6px 6px 0 0;border:0;border-radius:8px;background:transparent;color:var(--muted);font-family:inherit;font-size:20px;line-height:1;display:grid;place-items:center;transition:background-color 250ms ease,color 250ms ease}
.chat-toast-open:focus-visible,.chat-toast-dismiss:focus-visible{outline:2px solid var(--accent);outline-offset:-3px}
.chat-panel{position:relative}.chat-settings{position:absolute;z-index:2;top:70px;right:17px;width:285px;max-width:calc(100% - 28px);padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:0 8px 32px #10051f30}
.chat-settings h3{margin:0 0 10px;color:var(--ink);font-size:13px;font-weight:650}.chat-setting{position:relative;display:flex;align-items:center;gap:12px;padding:10px 0;cursor:pointer}.chat-setting+.chat-setting{border-top:1px solid var(--line)}.chat-setting>span:first-child{flex:1;min-width:0}.chat-setting strong,.chat-setting small{display:block}.chat-setting strong{font-size:12px;line-height:1.4;font-weight:550;color:var(--ink)}.chat-setting small{margin-top:3px;font-size:10px;line-height:1.45;color:var(--muted)}
.chat-setting input{position:absolute;right:0;width:38px;height:24px;margin:0;opacity:0;cursor:pointer}.chat-switch{flex-shrink:0;width:36px;height:22px;border:1px solid var(--line);border-radius:12px;background:var(--surface-soft);pointer-events:none;transition:background-color 250ms ease,border-color 250ms ease}.chat-switch::after{content:'';display:block;width:14px;height:14px;margin:3px;border-radius:50%;background:var(--muted);transition:transform 250ms ease,background-color 250ms ease}.chat-setting input:checked+.chat-switch{border-color:var(--accent);background:var(--accent)}.chat-setting input:checked+.chat-switch::after{transform:translateX(14px);background:#fff}.chat-setting input:focus-visible+.chat-switch{outline:2px solid var(--accent);outline-offset:3px}
@media(hover:hover){.chat-toast-open:hover,.chat-toast-dismiss:hover{background:var(--soft)}}
@media(max-width:599px){.chat-notifications{width:min(310px,calc(100vw - 24px));bottom:calc(100% + 10px);gap:8px}.chat-settings{top:62px;right:13px}.chat-toast-dismiss{width:32px;height:32px}.chat-toast-open{padding:11px 9px 11px 13px}}
@media(prefers-reduced-motion:no-preference){.chat-toast{animation:chat-toast-arrive 360ms cubic-bezier(.22,.8,.25,1) both}.chat-toast-leaving{animation:chat-toast-leave 230ms ease both;pointer-events:none}.chat-settings:not([hidden]){animation:chat-message-arrive 220ms ease both}}
@keyframes chat-toast-arrive{from{opacity:0;transform:translate(8px,6px) scale(.98)}to{opacity:1;transform:none}}
@keyframes chat-toast-leave{from{opacity:1;transform:none}to{opacity:0;transform:translateX(8px)}}
@media(prefers-reduced-motion:reduce){.chat-switch,.chat-switch::after{transition:none}}
@media(forced-colors:active){.chat-toast,.chat-settings,.chat-switch{background:Canvas;color:CanvasText;border-color:CanvasText}.chat-setting input:checked+.chat-switch{background:Highlight;border-color:Highlight}.chat-switch::after{background:CanvasText}.chat-setting input:checked+.chat-switch::after{background:HighlightText}}

/* Empty space beside the closed launcher must not intercept footer links. */
.community-chat{pointer-events:none}
.community-chat>.chat-launcher,.community-chat>.chat-panel{pointer-events:auto}
