/* The glass bubble is also a room choice. The global Liquid Glass theme sets
   data-bubble-style=glass without writing over the room's saved choice. */
html[data-bubble-style="glass"] {
  --bubble-glass-text:#242424;
  --bubble-glass-user-top:rgb(255 255 255 / .38);
  --bubble-glass-user-mid:rgb(255 255 255 / .17);
  --bubble-glass-user-bottom:rgb(255 255 255 / .22);
  --bubble-glass-ai-top:rgb(255 255 255 / .34);
  --bubble-glass-ai-mid:rgb(255 255 255 / .14);
  --bubble-glass-ai-bottom:rgb(255 255 255 / .19);
  --bubble-glass-specular:rgb(255 255 255 / .36);
  --bubble-glass-bottom:rgb(255 255 255 / .15);
  --bubble-glass-rim:rgb(255 255 255 / .46);
  --bubble-glass-inner-rim:rgb(255 255 255 / .28);
  --bubble-glass-shadow:rgb(0 0 0 / .16);
}
html[data-bubble-style="glass"][data-appearance="dark"] {
  --bubble-glass-text:#f6f6f6;
  --bubble-glass-user-top:rgb(35 35 35 / .46);
  --bubble-glass-user-mid:rgb(22 22 22 / .28);
  --bubble-glass-user-bottom:rgb(28 28 28 / .34);
  --bubble-glass-ai-top:rgb(32 32 32 / .43);
  --bubble-glass-ai-mid:rgb(20 20 20 / .26);
  --bubble-glass-ai-bottom:rgb(26 26 26 / .32);
  --bubble-glass-specular:rgb(255 255 255 / .18);
  --bubble-glass-bottom:rgb(255 255 255 / .09);
  --bubble-glass-rim:rgb(255 255 255 / .34);
  --bubble-glass-inner-rim:rgb(255 255 255 / .18);
  --bubble-glass-shadow:rgb(0 0 0 / .34);
}
html[data-bubble-style="glass"] body.chat-room[data-room-wallpaper-tone="dark"] {
  --bubble-glass-user-top:rgb(35 35 35 / .44);
  --bubble-glass-user-mid:rgb(22 22 22 / .25);
  --bubble-glass-user-bottom:rgb(28 28 28 / .31);
  --bubble-glass-ai-top:rgb(32 32 32 / .41);
  --bubble-glass-ai-mid:rgb(20 20 20 / .23);
  --bubble-glass-ai-bottom:rgb(26 26 26 / .29);
  --bubble-glass-specular:rgb(255 255 255 / .14);
  --bubble-glass-bottom:rgb(255 255 255 / .07);
  --bubble-glass-rim:rgb(255 255 255 / .34);
  --bubble-glass-inner-rim:rgb(255 255 255 / .18);
  --bubble-glass-shadow:rgb(0 0 0 / .30);
}
html[data-bubble-style="glass"] body.chat-room[data-room-wallpaper-tone="light"] {
  --bubble-glass-user-top:rgb(255 255 255 / .38);
  --bubble-glass-user-mid:rgb(255 255 255 / .17);
  --bubble-glass-user-bottom:rgb(255 255 255 / .22);
  --bubble-glass-ai-top:rgb(255 255 255 / .34);
  --bubble-glass-ai-mid:rgb(255 255 255 / .14);
  --bubble-glass-ai-bottom:rgb(255 255 255 / .19);
  --bubble-glass-specular:rgb(255 255 255 / .32);
  --bubble-glass-rim:rgb(255 255 255 / .46);
  --bubble-glass-inner-rim:rgb(255 255 255 / .28);
  --bubble-glass-shadow:rgb(0 0 0 / .16);
}

html[data-bubble-style="glass"] :is(#messages,#bubblePreviewV102) .message-group:not(.typing-group) .chat-message-item:not(.bubble-style-exempt-v102) .message-bubble-row > .bubble {
  position:relative;
  isolation:isolate;
  overflow:visible;
  border:1px solid var(--bubble-glass-rim) !important;
  border-radius:20px !important;
  color:var(--chat-text) !important;
  box-shadow:inset 0 1px 0 var(--bubble-glass-inner-rim),0 5px 14px var(--bubble-glass-shadow) !important;
  -webkit-backdrop-filter:blur(var(--liquid-material-blur,4px)) saturate(108%);
  backdrop-filter:blur(var(--liquid-material-blur,4px)) saturate(108%);
}
html[data-bubble-style="glass"] :is(#messages,#bubblePreviewV102) .message-group.user .chat-message-item:not(.bubble-style-exempt-v102) .message-bubble-row > .bubble {
  border-bottom-right-radius:8px !important;
  color:var(--chat-user-bubble-text) !important;
  background:
    radial-gradient(ellipse 95% 115% at 23% -20%,var(--bubble-glass-specular),transparent 64%),
    linear-gradient(0deg,var(--bubble-glass-bottom),transparent 40%),
    linear-gradient(180deg,var(--bubble-glass-user-top),var(--bubble-glass-user-mid) 54%,var(--bubble-glass-user-bottom)) !important;
}
html[data-bubble-style="glass"] :is(#messages,#bubblePreviewV102) .message-group.assistant .chat-message-item:not(.bubble-style-exempt-v102) .message-bubble-row > .bubble {
  border-bottom-left-radius:8px !important;
  color:var(--chat-ai-bubble-text) !important;
  background:
    radial-gradient(ellipse 95% 115% at 23% -20%,var(--bubble-glass-specular),transparent 64%),
    linear-gradient(0deg,var(--bubble-glass-bottom),transparent 40%),
    linear-gradient(180deg,var(--bubble-glass-ai-top),var(--bubble-glass-ai-mid) 54%,var(--bubble-glass-ai-bottom)) !important;
}
html[data-bubble-style="glass"] :is(#messages,#bubblePreviewV102) .message-group .chat-message-item .message-bubble-row > .bubble::before,
html[data-bubble-style="glass"] :is(#messages,#bubblePreviewV102) .message-group .chat-message-item .message-bubble-row > .bubble::after {
  content:none !important;
}
html[data-bubble-style="glass"] #messages .pending-bubble-v1 {
  border:1px solid var(--bubble-glass-rim) !important;
  border-radius:20px 20px 20px 8px !important;
  background:linear-gradient(180deg,var(--bubble-glass-ai-top),var(--bubble-glass-ai-mid) 55%,var(--bubble-glass-ai-bottom)) !important;
  color:var(--chat-ai-bubble-text) !important;
  box-shadow:inset 0 1px 0 var(--bubble-glass-inner-rim),0 5px 14px var(--bubble-glass-shadow) !important;
  -webkit-backdrop-filter:blur(var(--liquid-material-blur,4px)) saturate(108%);
  backdrop-filter:blur(var(--liquid-material-blur,4px)) saturate(108%);
}
@media (prefers-reduced-transparency: reduce) {
  html[data-bubble-style="glass"] :is(#messages,#bubblePreviewV102) .message-group .chat-message-item .message-bubble-row > .bubble,
  html[data-bubble-style="glass"] #messages .pending-bubble-v1 {
    background:var(--chat-surface) !important;
    -webkit-backdrop-filter:none;
    backdrop-filter:none;
  }
}
