/* Overlays: the generic dialog shell, and the chat window. */

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; z-index: 20; padding: 16px; }
.overlay.show { display: flex; }
.dialog { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: min(560px, 94vw); display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }

/* Add / edit character — taller than a plain dialog, so it scrolls itself. */
.char-dialog { max-height: 92vh; overflow-y: auto; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; min-width: 0; }

/* --- Chat --- */
.chat-modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: min(780px, 96vw); height: min(84vh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-head .spacer { flex: 1; }
#chatMessages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 3px; }
.msg.assistant { align-self: flex-start; background: var(--assistant); border-bottom-left-radius: 3px; }
.msg .who { font-size: 11px; color: var(--muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .5px; }
.msg em { color: #c9a9ff; font-style: italic; }
.chat-empty { margin: auto; color: var(--muted); }
#chatComposer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
#prompt { flex: 1; resize: none; height: 44px; max-height: 160px; }
