.bc-chat {
  --chat-gutter: clamp(18px, 3.3%, 44px);
  display: flex;
  flex-direction: column;
  container: brickChat / inline-size;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--ground);
}
.bc-chat [hidden] {
  display: none !important;
}
.bc-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
}
.bc-chat :is(button, a):focus-visible {
  outline-color: var(--brick-ice);
}
.bc-scroll:focus-visible {
  outline: 2px solid var(--brick-blue);
  outline-offset: -2px;
}
.bc-flow {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 100%;
  padding: 24px var(--chat-gutter) 10px;
}
.bc-welcome {
  padding: 20px 0 22px;
}
.bc-welcome-mark {
  display: grid;
  place-items: center;
  width: 61px;
  height: 61px;
  margin-bottom: 18px;
  border-radius: 19px;
  color: var(--brick-bright);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--brick-shadow) 25%, var(--panel)),
    var(--panel)
  );
}
.bc-welcome h2 {
  font-size: clamp(22px, 2.1vw, 32px);
  line-height: 1.3;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}
.bc-welcome p {
  margin: 7px 0 0;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.bc-earlier {
  align-self: center;
  margin: 2px 0 18px;
  color: var(--soft);
  font-size: 12px;
  padding: 7px 13px;
  background: var(--panel);
}
.bc-history-status {
  padding: 12px 0;
  color: var(--muted);
  font-size: 13px;
}
.bc-date {
  margin: 17px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.bc-date::before,
.bc-date::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line);
}
.bc-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0 1px;
}
.bc-avatar .avatar {
  display: block;
  height: 38px;
  width: 38px;
}
.bc-body {
  min-width: 0;
}
.bc-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.bc-author {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 680;
  overflow-wrap: anywhere;
}
.bc-time {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.bc-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.62;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bc-link {
  color: var(--brick-ice);
  text-decoration: underline;
  text-decoration-color: var(--brick-blue);
  text-underline-offset: 3px;
}
.bc-link:hover {
  text-decoration-color: currentColor;
}
.bc-follow {
  padding-top: 1px;
}
.bc-follow > .bc-time {
  opacity: 0;
  align-self: start;
  line-height: 22px;
}
.bc-follow:hover > .bc-time {
  opacity: 1;
}
.bc-dock {
  position: relative;
  flex: none;
  padding: 6px var(--chat-gutter) max(19px, env(safe-area-inset-bottom));
}
.bc-composer {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 8px;
  border: 1px solid #ffffff12;
  border-radius: 13px;
  background: var(--raised);
  transition: border-color 150ms ease;
}
.bc-composer:focus-within {
  border-color: var(--brick-blue);
}
.bc-input {
  display: block;
  flex: 1;
  align-self: center;
  min-width: 0;
  min-height: 24px;
  max-height: 140px;
  padding: 0 4px 0 7px;
  margin: 0;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  caret-color: var(--brick-base);
  font: inherit;
  font-size: 14px;
  line-height: 24px;
}
.bc-input:focus-visible {
  outline: none;
}
.bc-input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.bc-tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  color: var(--soft);
  border-radius: 8px;
}
.bc-tool:hover,
.bc-earlier:hover {
  color: var(--ink);
  background: #ffffff12;
}
.bc-send {
  color: var(--rail);
  background: var(--brick-base);
}
.bc-send:hover {
  color: var(--rail);
  background: var(--brick-bright);
}
.bc-send:active:not(:disabled) {
  background: var(--brick-shadow);
}
.bc-send:disabled {
  opacity: 1;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 88%, var(--soft));
  cursor: default;
}
.bc-feedback {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  padding: 6px 3px 0;
}
.bc-error,
.bc-counter.is-over {
  color: var(--danger);
}
.bc-retry {
  color: var(--brick-ice);
  padding: 2px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bc-counter {
  margin-inline-start: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bc-newer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: calc(100% + 4px);
  translate: -50% 0;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 650;
  color: var(--rail);
  background: var(--brick-ice);
}
.bc-newer:hover {
  color: var(--rail);
  background: color-mix(in srgb, var(--brick-ice) 80%, white);
}
.bc-emoji-picker {
  position: absolute;
  z-index: 3;
  bottom: calc(100% + 4px);
  right: var(--chat-gutter);
  max-width: calc(100% - 2 * var(--chat-gutter));
  padding: 14px;
  border-radius: 14px;
  background: var(--raised);
  box-shadow: 0 10px 26px #090b0e66;
  transform-origin: bottom right;
  animation: bc-picker-in 140ms var(--ease) both;
}
.bc-picker-title {
  display: block;
  margin: 0 0 8px 3px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 650;
}
.bc-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 32px));
  gap: 3px;
}
.bc-emoji {
  font:
    20px/1 'Segoe UI Emoji',
    'Apple Color Emoji',
    sans-serif;
  aspect-ratio: 1;
}
.bc-emoji:hover,
.bc-emoji:focus-visible {
  background: #ffffff14;
}
@keyframes bc-picker-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@container brickChat (max-width: 420px) {
  .bc-flow {
    padding: 12px 15px 8px;
  }
  .bc-dock {
    padding: 5px 12px max(12px, env(safe-area-inset-bottom));
  }
  .bc-welcome {
    padding: 10px 0 16px;
  }
  .bc-welcome h2 {
    font-size: 22px;
  }
  .bc-welcome-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    margin-bottom: 12px;
  }
  .bc-welcome-mark .icon {
    width: 24px;
    height: 24px;
  }
  .bc-message {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
  }
  .bc-avatar .avatar {
    width: 30px;
    height: 30px;
  }
  .bc-text {
    font-size: 13px;
  }
  .bc-byline {
    gap: 6px;
  }
  .bc-emoji-picker {
    right: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bc-emoji-picker {
    animation: none;
  }
}
