.chat {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}

.chat::-webkit-scrollbar {
  width: 6px;
}

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

.chat::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.chat::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #bbb;
  text-align: center;
  gap: 8px;
}

.emptyIcon {
  color: #ddd;
}

.empty p {
  font-size: 13px;
}

.emptyHint {
  font-size: 11px;
  color: #ccc;
}

.msg {
  padding: 8px 10px;
  line-height: 1.4;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.user {
  max-width: min(700px, 85%);
  background: linear-gradient(180deg, #f0f7ff 0%, #eaf2ff 100%);
  border: 1px solid #dbeafe;
  border-radius: 14px 14px 4px 14px;
  margin: 0;
  color: #1a1a1a;
}

.userRow {
  align-self: flex-end;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  max-width: min(700px, 85%);
  margin: 0 0 2px;
}

.userAvatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: 8px;
  object-fit: cover;
  border-radius: 999px;
}

.userImages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.userImages:first-child {
  margin-top: 0;
}

.userImage {
  max-width: min(280px, 100%);
  max-height: 240px;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid #dbeafe;
  background: #fff;
}

.assistantRow {
  align-self: flex-start;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.assistantAvatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: 8px;
  object-fit: cover;
  border-radius: 999px;
}

.assistantAvatarSlot {
  width: 32px;
  flex-shrink: 0;
}

.assistantAvatarSpacer {
  width: 32px;
  flex-shrink: 0;
}

.assistant {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: #1a1a1a;
  line-height: 1.4;
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.assistantToolbar {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin: 0 0 1px;
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.assistant:hover .assistantToolbar,
.assistant:focus-within .assistantToolbar {
  opacity: 1;
}

.msgActionBtn {
  height: 22px;
  padding: 0 7px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: #6b7280;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.msgActionBtn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.msgActionBtnCopied {
  color: #15803d;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.assistantBody {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.system {
  align-self: center;
  color: #aaa;
  font-size: 11px;
  text-align: center;
  padding: 6px 10px;
}

.toolCall {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.4;
  white-space: normal;
}

.toolCallRow {
  margin: 0;
}

.toolCallRow + .toolCallRow {
  margin-top: -3px;
}

.toolCallRow:has(+ .toolCallRow) :global(.tool-call-block) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: none;
}

.toolCallRow + .toolCallRow :global(.tool-call-block) {
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: none;
}

.assistantRow:not(.toolCallRow) + .toolCallRow,
.toolCallRow + .assistantRow:not(.toolCallRow) {
  margin-top: -2px;
}

.thinking {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.46;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #faf8fc;
  border: 1px solid #ece6f5;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.bash {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
  line-height: 1.46;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e8ecf0;
  border-radius: 14px 14px 14px 4px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.streaming::after {
  content: "▊";
  animation: blink 0.8s step-end infinite;
  color: #2563eb;
  margin-left: 1px;
}

.assistantRow + .assistantRow:not(.toolCallRow) {
  margin-top: 0;
}

.assistant :global(.markdown-body) {
  min-width: 0;
}

@media (min-width: 769px) {
  .assistantRow {
    max-width: 66.6667%;
    box-sizing: border-box;
  }
}

@media (max-width: 768px) {
  .chat {
    padding: 6px 10px 4px;
    gap: 3px;
  }

  .msg {
    padding: 8px 10px;
    font-size: 14px;
  }

  .userRow {
    max-width: 88%;
  }

  .user {
    max-width: 100%;
  }

  .assistantAvatarSpacer,
  .assistantAvatarSlot,
  .assistantAvatar,
  .userAvatar {
    display: none;
  }

  .assistantToolbar {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .userRow {
    max-width: 92%;
  }
}
