.conversation {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 540px;
  overflow: auto;
  padding: 18px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,253,247,.92), rgba(248,244,234,.92));
  scroll-behavior: smooth;
  scroll-snap-type: none;
}

.conversation .message {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  max-width: 82%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  scroll-snap-align: none;
}

.conversation .message.user { align-self: flex-end; flex-direction: row-reverse; }
.message > div:last-child {
  border: 1px solid var(--line);
  border-radius: 4px 15px 15px 15px;
  background: var(--card);
  padding: 12px 15px;
  box-shadow: 0 5px 14px rgba(55,48,34,.04);
}
.message.user > div:last-child { background: var(--forest); color: white; border-color: var(--forest); border-radius: 15px 4px 15px 15px; }
.message .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #e7ddc8; border: 1px solid #ccb27e; color: var(--gold); font: 700 9px var(--sans); }
.message.user .avatar { background: var(--forest); border-color: var(--forest); color: white; }
.conversation .message small { font-size: 8px; letter-spacing: .12em; color: var(--gold); font-weight: 800; }
.conversation .message.user small { color: #d8bc83; }
.conversation .message p { font-size: 13px; line-height: 1.65; margin: 4px 0 0; color: #41463f; white-space: pre-wrap; }
.conversation .message.user p { color: white; }
.conversation .message.welcome { max-width: 88%; }
.search-card textarea { min-height: 100px; }

@media (max-width: 590px) {
  .conversation { max-height: 470px; padding: 12px; }
  .conversation .message { max-width: 92%; }
  .conversation .message.welcome { max-width: 100%; }
  .message .avatar { width: 29px; height: 29px; }
  .conversation .message p { font-size: 12px; }
}

/* Book-like transcript cards */
.hit-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.hit {
  display: flex;
  flex-direction: column;
  min-height: 330px;
  padding: 27px;
  border-radius: 9px;
  box-shadow: 0 5px 18px rgba(54,50,40,.035);
}

.source-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.source-meta span { text-align: right; }
.hit .hit-title { margin-top: 9px; }
.hit h3 { font: 400 25px/1.08 var(--serif); letter-spacing: -.02em; margin: 0 0 5px; }
.hit .citation { font-size: 10px; }

.hit .quote {
  flex: 1;
  max-height: 300px;
  margin: 20px 0;
  padding: 0 0 0 20px;
  font: 400 15px/1.72 var(--serif);
  white-space: normal;
  overflow-wrap: anywhere;
  border-left: 2px solid #c78729;
}

.source-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid #eee7d9;
}

.source-footer > span { color: var(--muted); font-size: 10px; }
.source-footer .hit-actions { justify-content: flex-end; border: 0; padding: 0; }
.source-footer .hit-actions button { background: #eef2ed; border-color: transparent; color: var(--forest); }

@media (max-width: 820px) {
  .hit-list { grid-template-columns: 1fr; }
  .hit { min-height: 0; }
}

@media (max-width: 590px) {
  .hit { padding: 21px; }
  .hit h3 { font-size: 22px; }
  .hit .quote { max-height: 390px; padding-left: 16px; }
  .source-footer { align-items: flex-start; flex-direction: column; }
  .source-footer .hit-actions { justify-content: flex-start; }
}
