#chatBoard {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
  container-type: size;
}



#chatLog {
  position: relative;
  z-index: 1;

  min-height: 0;

  min-width: 0;

  height: 100%;
  max-width: 850px;
  margin: auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 14px;
  overscroll-behavior: contain;
  overflow-anchor: none;
  touch-action: pan-y;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}
.message-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 23px;
  gap: 6px;
}
.message-row.user {
  align-items: flex-end;
}
.message-row time {
  font-size: 10px;
  color: #8393ad;
  padding-inline: 8px;
}
.chat-bubble {
  font-size: 17px;
  line-height: 1.65;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.chat-bubble.user {
  max-width: 90%;
  padding: 12px 16px;
  border: 1px solid
    color-mix(in srgb, var(--message-color, var(--accent)) 40%, transparent);
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--message-color, var(--accent)) 12%, #0d1120),
    #080d18
  );
  border-radius: 20px 20px 6px 20px;
  white-space: pre-wrap;
  cursor: pointer;
  -webkit-touch-callout: none;
}
.chat-bubble.bot {
  width: 100%;
  padding: 8px 3px;
}
.chat-bubble p {
  margin: 0 0 14px;
}
.chat-bubble h1,
.chat-bubble h2,
.chat-bubble h3 {
  line-height: 1.25;
  font-size: 1.25em;
  margin: 20px 0 10px;
}
.chat-bubble pre {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0005;
  overflow: auto;
  font-size: 13px;
  white-space: pre;
}
.chat-bubble code {
  font-family: ui-monospace, monospace;
}
.chat-bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
.chat-bubble td,
.chat-bubble th {
  border: 1px solid var(--line);
  padding: 8px;
}
.markdown-table-wrap {
  overflow: auto;
}
.chat-bubble blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  color: var(--muted);
}
.response-actions {
  display: flex;
  gap: 7px;
}
.response-actions button {
  font-size: 11px;
  padding: 5px 9px;
  color: var(--muted);
}
.thinking {
  color: var(--muted);
  animation: breathe 1.5s ease-in-out infinite;
}
.message-error {
  color: #edc0a8;
}
@keyframes breathe {
  50% {
    opacity: 0.5;
  }
}
@container (max-height:220px) {
  .welcome .eyebrow,
  .welcome > p:not(.eyebrow) {
    display: none;
  }
  .welcome h1 {
    font-size: 26px;
  }
  .welcome-newsletter {
    margin-top: 12px;
  }
  .welcome {
    padding: 3px;
  }
}

/* Ambient rings live behind messages and never intercept scrolling or taps. */
.chat-ambient {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: .34;
  background: radial-gradient(ellipse at 50% 90%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 72%);
  transition: opacity .45s ease;
}
.composer-focused .chat-ambient { opacity: .72; }
.chat-ambient .ripple {
  position: absolute;
  left: 50%; bottom: 32px;
  width: 70px; height: 70px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 50%;
  opacity: 0;
  box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 12%, transparent);
  animation: chat-ripple 6s cubic-bezier(.2,.65,.25,1) infinite;
}
.chat-ambient .r2 { animation-delay: -1.5s; }
.chat-ambient .r3 { animation-delay: -3s; }
.chat-ambient .r4 { animation-delay: -4.5s; }
@keyframes chat-ripple {
  0% { opacity: 0; transform: translate(-50%,50%) scale(.3); }
  12% { opacity: .5; }
  75% { opacity: .08; }
  100% { opacity: 0; transform: translate(-50%,50%) scale(13); }
}
@media (prefers-reduced-motion: reduce) {
  .chat-ambient .ripple { display: none; }
}

/* User message controls stay in the message row, without a modal or reflow. */
.user-actions { display: flex; gap: 6px; opacity: 0; transition: opacity .16s ease; }
.user-actions button { padding: 5px 9px; font-size: 12px; color: var(--muted); }
.message-row.user:hover .user-actions, .message-row.user:focus-within .user-actions { opacity: 1; }
@media (hover: none) { .user-actions { opacity: 1; } }
.bubble-editor { display: block; width: min(620px, 70vw); max-width: 100%; min-height: 100px; max-height: 35dvh; resize: vertical; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-size: 17px; }
.edit-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; white-space: normal; margin-top: 12px; }
.edit-controls small { flex-basis: 100%; color: var(--muted); font-size: 11px; }
.edit-controls button { padding: 6px 12px; font-size: 13px; }
