/* Movable AI chat panel (js/ui/ai-chat-modal.js) */
.ai-chat {
  position: fixed; z-index: 40; width: min(380px, calc(100vw - 16px));
  height: min(540px, calc(100vh - 80px)); display: flex; flex-direction: column;
  background: rgba(14, 19, 32, 0.96); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); color: var(--text); font-size: 12px;
}
.ai-chat[hidden] { display: none; }
.ai-chat-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-bottom: 1px solid var(--line); cursor: move; user-select: none; touch-action: none;
}
.ai-chat-head strong { font-size: 13px; }
.ai-chat-status { margin-left: auto; color: var(--muted); font-size: 11px; }
.ai-chat-close {
  background: none; border: 0; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.ai-chat-close:hover { color: var(--text); }
.ai-chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: grid; gap: 8px; align-content: start; }
.ai-chat-hint { margin: 0; color: var(--muted); }
.ai-msg { padding: 7px 9px; border-radius: 8px; max-width: 92%; }
.ai-msg p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.ai-msg-user { justify-self: end; background: rgba(78, 163, 255, 0.18); }
.ai-msg-assistant { justify-self: start; background: rgba(255, 255, 255, 0.06); }
.ai-msg-error { justify-self: start; color: var(--bad); background: rgba(255, 106, 106, 0.08); }
.ai-cmds { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.ai-cmds li.running { color: var(--accent); }
.ai-cmds li.done { color: var(--ok); }
.ai-result { margin-top: 5px !important; color: var(--ok); font-size: 11px; }
.ai-result.err { color: var(--warn); }
.ai-chat-form { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-chat-form textarea {
  flex: 1; resize: none; padding: 7px 8px; border-radius: 6px; border: 1px solid var(--line);
  background: #0e1320; color: var(--text); font: inherit;
}
.ai-chat-form textarea:focus { outline: none; border-color: var(--accent); }
/* controls.css makes panel buttons full-width; the chat lays them out inline. */
.ai-chat .btn-primary, .ai-chat .btn-secondary { width: auto; margin-top: 0; flex: none; }
.ai-chat-form button { padding: 7px 12px; }
.logout-btn.active { color: var(--text); border-color: var(--accent); }
.ai-chat-status.err { color: var(--bad); }
/* World save/load bar (js/ui/world-toolbar.js) */
.world-bar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 11px;
}
.world-name { flex: 1 1 100%; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-bar select {
  flex: 1 1 120px; min-width: 0; padding: 3px 4px; border-radius: 5px; border: 1px solid var(--line);
  background: #0e1320; color: var(--text); font-size: 11px;
}
.world-bar button { padding: 3px 7px; font-size: 11px; font-weight: 600; }
.world-bar button:disabled { opacity: .5; cursor: not-allowed; }
