/* KoiAI 1.6 — large portrait in chat, chat actions in top bar.
   Loaded after character-portraits.css to override the old circular avatar.
   Character IDs and chat JavaScript are intentionally unchanged. */
.chat-layout {
  grid-template-columns: minmax(0, .86fr) minmax(0, 1.4fr);
  align-items: stretch;
}
.chat-info {
  position: relative;
  display: block;
  overflow: hidden;
  padding: 0;
  min-height: 390px;
  isolation: isolate;
  background: #102b3b;
  text-align: left;
}
.chat-info .chat-avatar {
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: radial-gradient(circle at 48% 35%, #327c90 0%, #0d2939 75%);
  font-size: clamp(110px, 16vw, 190px);
  overflow: hidden;
}
.chat-info .chat-avatar .character-avatar-picture {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  object-position: center 31%;
}
.chat-info::after {
  content: '';
  position: absolute;
  z-index: 1;
  pointer-events: none;
  inset: 0;
  background: linear-gradient(180deg, transparent 25%, rgba(5, 21, 32, .03) 45%, rgba(4, 18, 29, .92) 100%);
}
.chat-info-caption {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 34px 24px 23px;
  text-align: left;
}
.chat-info .chat-info-caption h3 {
  margin: 0 0 8px;
  font-size: clamp(22px, 2.3vw, 28px);
  line-height: 1.2;
  color: #f6fdff;
  text-shadow: 0 2px 8px rgba(0,0,0,.65);
}
.chat-info .chat-info-caption p {
  margin: 0;
  max-width: 33ch;
  font-size: 13px;
  line-height: 1.55;
  color: #e0f1f8;
  text-shadow: 0 1px 6px rgba(0,0,0,.8);
}
.chat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 13px 15px;
}
.chat-head-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}
.chat-head-identity strong { white-space: nowrap; }
.chat-head-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chat-head-actions .btn,
.chat-head-actions .clear-chat {
  margin: 0;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.15;
}
.chat-head-actions .btn:focus-visible { outline: 2px solid #63e8c3; outline-offset: 3px; }
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-info { min-height: 350px; }
}
@media (max-width: 560px) {
  .chat-info { min-height: 320px; }
  .chat-info-caption { padding: 26px 18px 17px; }
  .chat-head { padding: 12px; gap: 10px; }
  .chat-head-actions { width: 100%; justify-content: stretch; }
  .chat-head-actions .btn { flex: 1 1 0; white-space: normal; text-align: center; padding: 10px 9px; }
}
