.shell {
  --conversation-content-width: min(760px, 86%);

  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--conversation-bg);
}

.scroll {
  --conversation-scrollbar-offset: 10px;
  --conversation-scroll-fade-size: 14px;

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-bottom: var(--composer-reserve);
  scrollbar-color: color-mix(in srgb, var(--line-strong) 70%, transparent)
    transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      var(--text-primary) var(--conversation-scroll-fade-size),
      var(--text-primary) calc(100% - var(--conversation-scroll-fade-size)),
      transparent 100%
    ),
    linear-gradient(var(--text-primary), var(--text-primary));
  -webkit-mask-position:
    0 0,
    right top;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size:
    calc(100% - var(--conversation-scrollbar-offset)) 100%,
    var(--conversation-scrollbar-offset) 100%;
  mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      var(--text-primary) var(--conversation-scroll-fade-size),
      var(--text-primary) calc(100% - var(--conversation-scroll-fade-size)),
      transparent 100%
    ),
    linear-gradient(var(--text-primary), var(--text-primary));
  mask-position:
    0 0,
    right top;
  mask-repeat: no-repeat;
  mask-size:
    calc(100% - var(--conversation-scrollbar-offset)) 100%,
    var(--conversation-scrollbar-offset) 100%;
}

.virtualScroll {
  display: block;
  overflow-anchor: none;
  padding-bottom: 0;
}

.unmaskedScroll {
  -webkit-mask-image: none;
  mask-image: none;
}

.lockedScroll {
  overflow: hidden;
  scrollbar-gutter: auto;
}

.scroll::-webkit-scrollbar {
  width: 8px;
}

.scroll::-webkit-scrollbar-track {
  background: transparent;
}

.scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--line-strong) 70%, transparent);
  background-clip: content-box;
}

.messageList {
  display: grid;
  flex: 1 0 auto;
  width: var(--conversation-content-width);
  align-content: end;
  gap: 22px;
  margin: 0 auto;
  padding: var(--titlebar-height) 0 0;
}

.virtualizedMessageList {
  position: relative;
  flex: 0 0 auto;
  align-content: stretch;
}

.virtualizedMessageList > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.scrollToBottomButton {
  position: absolute;
  z-index: 11;
  right: 50%;
  bottom: max(96px, calc(var(--composer-reserve) - 12px));
  min-height: 32px;
  max-width: calc(100% - 32px);
  border: 1px solid var(--composer-glass-border);
  background: var(--composer-glass-bg);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
  font-size: var(--font-size-2);
  transform: translateX(50%);
  backdrop-filter: var(--composer-glass-filter);
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    transform 120ms ease;
}

.scrollToBottomButton:hover {
  border-color: var(--line-strong);
  background: var(--composer-glass-control-bg);
  transform: translateX(50%) translateY(-1px);
}

.scrollToBottomButton:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px var(--ring),
    var(--shadow-card);
}

.scrollToBottomButton[data-unread-messages="true"] {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  color: var(--accent);
}

.scrollToBottomButton [data-slot="button-icon"] {
  flex: 0 0 auto;
}

.scrollToBottomButton [data-slot="button-text"] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (width <=720px) {
  .scrollToBottomButton {
    bottom: max(88px, calc(var(--composer-reserve) - 10px));
    max-width: calc(100% - var(--space-6));
  }
}

@media (prefers-reduced-motion: reduce) {
  .scrollToBottomButton {
    transition: none;
  }
}
