.advice {
  margin: 32px 0 24px;
  padding: 16px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.advice-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.advice-title > div {
  flex: 1 1 auto;
  min-width: 0;
}

.advice h2 {
  margin: 0;
}

.secondary-chip {
  width: 100%;
  background-color: var(--surface-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  font-size: 0.88rem;
  min-height: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secondary-chip:hover {
  background-color: var(--surface-hover);
}

#chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 14px;
}

.bubble {
  max-width: 92%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}

.bubble p {
  margin: 0 0 8px 0;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble ul,
.bubble ol {
  margin: 4px 0 8px 18px;
  padding: 0;
}

.bubble li {
  margin-bottom: 4px;
}

.bubble li:last-child {
  margin-bottom: 0;
}

.bubble code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85em;
  word-break: break-all;
}

.bubble.user code {
  background: rgba(255, 255, 255, 0.2);
}

.bubble.user {
  align-self: flex-end;
  background-color: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.bubble.assistant {
  align-self: flex-start;
  background-color: var(--surface-card);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.chat-input textarea {
  flex: 1;
  min-height: 48px;
  max-height: 120px;
  resize: vertical;
  border-radius: var(--radius-sm);
  min-width: 0;
}

.chat-input button {
  width: 100%;
  min-height: 44px;
}

@media (min-width: 480px) {
  .advice {
    padding: 20px;
  }

  .bubble {
    max-width: 85%;
  }

  .chat-input {
    flex-direction: row;
    align-items: flex-end;
  }

  .chat-input button {
    width: auto;
    height: 48px;
  }
}
