.bubble-css-subdrawer-v1{border-top:1px solid var(--chat-border)}
.bubble-css-subdrawer-v1>summary{display:flex;align-items:center;justify-content:space-between;min-height:43px;padding:0 8px;color:var(--chat-text);font:13px var(--font-b);cursor:pointer;list-style:none}
.bubble-css-subdrawer-v1>summary::-webkit-details-marker{display:none}
.bubble-css-subdrawer-v1>summary::after{content:'⌄';color:var(--chat-muted);font-size:17px;transition:transform .18s}
.bubble-css-subdrawer-v1[open]>summary::after{transform:rotate(180deg)}
.bubble-css-subdrawer-content-v1{padding:0 4px 12px}
.bubble-css-subdrawer-content-v1>p{margin:2px 4px 10px;color:var(--chat-muted);font:12px/1.5 var(--font-b)}
.bubble-css-open-v1{width:100%;min-height:39px;border:1px solid var(--chat-border);border-radius:10px;background:var(--chat-surface);color:var(--chat-text);font:13px var(--font-b);cursor:pointer}
.bubble-css-open-v1:hover{border-color:var(--chat-accent)}
.bubble-css-overlay-v1{position:fixed;inset:0;z-index:530;display:grid;place-items:center;padding:12px;background:rgba(0,0,0,.58)}
.bubble-css-overlay-v1[hidden]{display:none}
.bubble-css-dialog-v1{box-sizing:border-box;width:min(650px,100%);max-height:min(850px,calc(100dvh - 24px));display:flex;flex-direction:column;overflow:hidden;border:1px solid var(--chat-border);border-radius:18px;background:var(--chat-surface);color:var(--chat-text);box-shadow:0 20px 60px rgba(0,0,0,.28);font-family:var(--font-b)}
.bubble-css-dialog-v1>header,.bubble-css-dialog-v1>footer{display:flex;align-items:center;gap:8px;padding:13px 16px;background:var(--chat-surface)}
.bubble-css-dialog-v1>header{border-bottom:1px solid var(--chat-border);justify-content:space-between}
.bubble-css-dialog-v1>header h2{margin:0;font:500 19px var(--font-d);color:var(--chat-text)}
.bubble-css-close-v1{width:32px;height:32px;border:0;border-radius:50%;background:transparent;color:var(--chat-muted);font-size:24px;cursor:pointer}
.bubble-css-dialog-scroll-v1{overflow-y:auto;min-height:0;padding:15px 16px 10px}
.bubble-css-help-v1{margin:0 0 12px;color:var(--chat-muted);font:12px/1.5 var(--font-b)}
.bubble-css-guide-v1{margin:0 0 12px;color:var(--chat-muted);font:11px/1.5 var(--font-b)}
.bubble-css-guide-v1 summary{width:fit-content;cursor:pointer;color:var(--chat-accent)}
.bubble-css-guide-v1 p{margin:7px 0 0;line-height:1.7}
.bubble-css-guide-v1 code{font:11px ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--chat-text)}
.bubble-css-enabled-v1{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px;font-size:13px}
.bubble-css-editor-label-v1{display:block;margin-bottom:7px;font-size:13px;font-weight:600}
#bubbleCssInputV1{box-sizing:border-box;display:block;width:100%;min-height:180px;max-height:42dvh;resize:vertical;border:1px solid var(--chat-border);border-radius:11px;padding:11px 12px;outline:none;background:var(--chat-bg);color:var(--chat-text);font:12px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:2}
#bubbleCssInputV1:focus{border-color:var(--chat-accent);box-shadow:0 0 0 2px color-mix(in srgb,var(--chat-accent) 20%,transparent)}
.bubble-css-toolbar-v1{display:flex;align-items:center;gap:10px;margin:9px 0 12px;color:var(--chat-muted);font-size:11px}
.bubble-css-toolbar-v1 button{flex:none;border:1px solid var(--chat-border);border-radius:8px;padding:6px 10px;background:var(--chat-surface);color:var(--chat-text);font:12px var(--font-b);cursor:pointer}
.bubble-css-error-v1{margin:0 0 11px;padding:8px 10px;border-radius:8px;background:color-mix(in srgb,#c93c45 14%,var(--chat-surface));color:#c63c45;font-size:12px;line-height:1.4}
.bubble-css-error-v1[hidden]{display:none}
.bubble-css-preview-v1{padding:11px;border:1px solid var(--chat-border);border-radius:12px;background:var(--chat-bg);overflow:hidden}
.bubble-css-preview-v1 h3{margin:0 0 11px;color:var(--chat-muted);font:12px var(--font-b)}
.bubble-css-preview-thread-v1{display:grid;gap:12px;max-width:100%;min-width:0}
.bubble-css-preview-thread-v1 .message-group{min-height:0;max-width:100%}
.bubble-css-preview-thread-v1 .bubble-stack{min-width:0;max-width:min(75%,calc(100% - 50px))!important;gap:0}
.bubble-css-preview-thread-v1 .chat-message-item{min-width:0}
.bubble-css-preview-thread-v1 .bubble{font-size:13px!important;line-height:1.5}
.bubble-css-preview-thread-v1 .pending-bubble-v1{white-space:nowrap}
.pending-status-dots-v1.whisper-pending-dots{align-items:center;gap:3px;min-width:0;margin-left:2px}
.pending-status-dots-v1 i.whisper-pending-dot{box-sizing:border-box;width:5px;height:5px;border-radius:50%;background:currentColor;font-size:0;line-height:0;flex:none}
/* The older chat bubble tail also uses ::before. Custom bubble stickers must
   not inherit its diagonal border, rotation, or negative stacking order. */
#messages .whisper-bubble::before,#bubbleCssPreviewV1 .whisper-bubble::before{top:auto;right:auto;bottom:auto;left:auto;border:0;box-shadow:none;transform:none;z-index:1}
/* Photo controls keep their own click behavior; only their visible frame joins
   the room's bubble surface when custom CSS is enabled. */
#messages .chat-photo-single-v2.whisper-image-bubble{box-sizing:border-box;max-width:min(228px,calc(60vw + 8px));padding:4px!important;overflow:visible}
#messages .chat-photo-single-v2.whisper-image-bubble img{width:100%;max-width:100%;box-sizing:border-box}
#messages .chat-photo-stack-shell.whisper-image-bubble{box-sizing:border-box;width:fit-content;max-width:100%;padding:4px!important;overflow:visible}
#messages .chat-photo-expanded-item.whisper-image-bubble{box-sizing:border-box;padding:4px!important;overflow:visible}
/* Each Rei turn reserves only the space occupied by a decoration directly
   below its insight controls. Moving the sticker to the far edge restores the
   normal small gap above the bubble. */
#messages .message-group.assistant:has(.turn-insights-v23):has(.whisper-bubble--rei){margin-top:calc(12px + var(--whisper-insight-clearance,0px))!important}
#messages .message-group.assistant:has(.whisper-bubble--rei) .turn-insights-v23{top:calc(-25px - var(--whisper-insight-clearance,0px))!important}
@media(max-width:699px){#messages .message-group.assistant:has(.whisper-bubble--rei) .turn-insights-v23{top:calc(-24px - var(--whisper-insight-clearance,0px))!important}}
.bubble-css-dialog-v1>footer{border-top:1px solid var(--chat-border)}
.bubble-css-dialog-v1>footer span{flex:1}
.bubble-css-dialog-v1>footer button{min-height:36px;padding:7px 12px;border:1px solid var(--chat-border);border-radius:9px;background:var(--chat-bg);color:var(--chat-text);font:12px var(--font-b);cursor:pointer}
.bubble-css-dialog-v1>footer .bubble-css-save-v1{border-color:var(--chat-accent);background:var(--chat-accent);color:#fff}
.bubble-css-dialog-v1>footer button:disabled{opacity:.5;cursor:default}
@media(max-width:540px){.bubble-css-overlay-v1{padding:0;align-items:end}.bubble-css-dialog-v1{width:100%;max-height:calc(100dvh - env(safe-area-inset-top) - 12px);border-radius:18px 18px 0 0;border-bottom:0}.bubble-css-dialog-v1>footer{padding-bottom:calc(12px + env(safe-area-inset-bottom))}.bubble-css-dialog-scroll-v1{padding:13px 13px 10px}#bubbleCssInputV1{min-height:150px;max-height:33dvh}.bubble-css-toolbar-v1 span{line-height:1.3}}
