/* ===== AI ASSISTANT: Panel, Lounge ===== */

/* ===== AI ASSISTANT ===== */
#ai-assistant.active { display:flex; flex-direction:column; height:calc(100dvh - 3rem); max-height:calc(100dvh - 3rem); overflow:hidden; position:relative; }
#ai-assistant .panel-select-screen { overflow-y:auto; -webkit-overflow-scrolling:touch; max-height:100%; padding-bottom:2rem; }
#ai-assistant .section-header { display:flex; justify-content:space-between; align-items:center; padding:0.8rem 1rem; border-bottom:1px solid var(--border,#2a2a3e); flex-shrink:0; color:var(--text,#f0f0f0); }
.ai-chat-messages { flex:1; overflow-y:auto; padding:1rem; display:flex; flex-direction:column; gap:0.8rem; min-height:0; }
.ai-input-bar { display:flex; gap:0.5rem; padding:0.8rem 1rem; border-top:1px solid var(--border,#2a2a3e); flex-shrink:0; background:var(--bg-card,#1a1a2e); z-index:10; padding-bottom:max(0.8rem, env(safe-area-inset-bottom)); }
.ai-input-bar input { flex:1; border:1px solid var(--border,#2a2a3e); border-radius:20px; padding:0.6rem 1rem; font-size:0.9rem; outline:none; background:var(--bg,#0a0a1a); color:var(--text,#f0f0f0); }
.ai-input-bar input:focus { border-color:#6c5ce7; }
.ai-input-bar input::placeholder { color:var(--text-muted,#888); }
.ai-input-bar button { flex-shrink:0; }
.ai-send-btn { width:40px; height:40px; border-radius:50%; border:none; background:#6c5ce7; color:#fff; font-size:1.2rem; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.ai-send-btn:hover { background:#5a4bd1; }

.ai-msg { display:flex; gap:0.5rem; align-items:flex-end; }
.ai-msg-user { flex-direction:row-reverse; }
.ai-avatar { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg,#ffd700,#ff8c00); display:flex; align-items:center; justify-content:center; font-size:1rem; flex-shrink:0; }
.panel-avatar-img { width:40px; height:40px; border-radius:50%; object-fit:cover; }
.ai-bubble { max-width:80%; padding:0.7rem 1rem; border-radius:16px; font-size:0.9rem; line-height:1.5; word-break:break-word; }
.ai-bubble-user { background:#6c5ce7; color:#fff; border-bottom-right-radius:4px; }
.ai-bubble-bot { background:var(--bg-card-alt,#1e1e3a); color:var(--text,#f0f0f0); border-bottom-left-radius:4px; }
.ai-bubble-bot ul { margin:0.3rem 0; padding-left:1.2rem; }
.ai-bubble-bot code { background:rgba(255,255,255,0.1); padding:0.1rem 0.3rem; border-radius:3px; font-size:0.85em; }

.ai-typing span { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--text-muted,#888); margin:0 2px; animation:ai-dot 1.4s infinite ease-in-out; }
.ai-typing span:nth-child(2) { animation-delay:0.2s; }
.ai-typing span:nth-child(3) { animation-delay:0.4s; }
@keyframes ai-dot { 0%,80%,100%{transform:scale(0.4);opacity:0.3} 40%{transform:scale(1);opacity:1} }

.ai-welcome { text-align:center; padding:2rem 1rem; margin:auto; }
.ai-welcome-icon { font-size:3rem; margin-bottom:0.5rem; }
.ai-welcome h3 { font-size:1.1rem; margin-bottom:0.3rem; color:var(--text,#f0f0f0); }
.ai-welcome p { color:var(--text-muted,#aaa); font-size:0.9rem; margin-bottom:1.5rem; }
.ai-quick-cards { display:flex; flex-wrap:wrap; gap:0.5rem; justify-content:center; }
.ai-quick-card { background:var(--bg-card-alt,#1e1e3a); border:1px solid var(--border,#2a2a3e); border-radius:12px; padding:0.6rem 1rem; font-size:0.85rem; cursor:pointer; transition:all 0.2s; color:var(--text,#f0f0f0); }
.ai-quick-card:hover { background:var(--bg-card,#1a1a2e); border-color:var(--gold,#D4AF37); transform:translateY(-1px); }

/* ── Crowny Panel: Character Select ── */
.panel-select-screen { text-align:center; padding:1.5rem 1rem; margin:auto; width:100%; max-width:420px; overflow-y:auto; }
.panel-select-title { margin-bottom:1.5rem; }
.panel-select-icon { font-size:3rem; margin-bottom:0.3rem; }
.panel-select-title h3 { font-size:1.15rem; color:var(--text,#fff); margin-bottom:0.2rem; }
.panel-select-title p { color:var(--text-muted,#aaa); font-size:0.85rem; }
.panel-char-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:0.7rem; }
.panel-char-grid > :nth-child(4),
.panel-char-grid > :nth-child(5) { grid-column:span 1; }
@media(max-width:360px){ .panel-char-grid { grid-template-columns:repeat(2,1fr); } }

.panel-char-card { background:var(--bg-card-alt,#1e1e3a); border:2px solid var(--border,#333); border-radius:14px; padding:1rem 0.5rem; cursor:pointer; transition:all 0.2s; text-align:center; color:var(--text,#fff); }
.panel-char-card:hover { border-color:var(--char-color); transform:translateY(-2px); box-shadow:0 4px 16px rgba(0,0,0,0.3); }
.panel-char-avatar { width:48px; height:48px; border-radius:50%; margin:0 auto 0.4rem; display:flex; align-items:center; justify-content:center; font-size:1.5rem; color:#fff; }
.panel-char-name { font-weight:700; font-size:0.9rem; color:var(--text,#f0f0f0); }
.panel-char-role { font-size:0.7rem; color:var(--text-muted,#aaa); margin-top:0.15rem; line-height:1.3; }

/* ── Crowny Panel: Chat Header ── */
.panel-chat-header-left { display:flex; align-items:center; gap:0.5rem; }
.panel-back-btn { background:none; border:none; font-size:1.3rem; cursor:pointer; padding:0.2rem 0.4rem; color:var(--text-muted,#aaa); }
.panel-back-btn:hover { color:var(--text,#f0f0f0); }
.panel-chat-avatar { width:34px; height:34px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1rem; flex-shrink:0; }
.panel-chat-name { font-weight:700; font-size:0.9rem; line-height:1.2; color:var(--text,#f0f0f0); }
.panel-chat-role { font-size:0.7rem; color:var(--text-muted,#aaa); line-height:1.2; }

/* ── Lounge Styles ── */
.lounge-enter-btn { display:flex; align-items:center; gap:0.7rem; width:100%; padding:0.8rem 1rem; margin-bottom:1.2rem; background:linear-gradient(135deg,#1a1a2e,#2d2d44); border:2px solid #D4AF3744; border-radius:14px; cursor:pointer; transition:all 0.2s; text-align:left; color:#fff; }
.lounge-enter-btn:hover { border-color:#D4AF37; transform:translateY(-2px); box-shadow:0 4px 20px rgba(212,175,55,0.2); }
.lounge-enter-icon { font-size:1.8rem; }
.lounge-enter-text { flex:1; }
.lounge-enter-text strong { display:block; font-size:0.95rem; color:#D4AF37; }
.lounge-enter-text span { font-size:0.75rem; color:#aaa; }
.lounge-enter-avatars { display:flex; gap:-4px; }
.lounge-mini-avatar { width:24px; height:24px; border-radius:50%; object-fit:cover; margin-left:-6px; border:2px solid #1a1a2e; }
.lounge-mini-avatar:first-child { margin-left:0; }
.lounge-mini-avatar-emoji { width:24px; height:24px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:0.7rem; margin-left:-6px; border:2px solid #1a1a2e; color:#fff; }
.lounge-mini-avatar-emoji:first-child { margin-left:0; }

.lounge-header-avatars { display:flex; margin-right:0.2rem; }
.lounge-header-avatar-img { width:26px; height:26px; border-radius:50%; object-fit:cover; margin-left:-8px; border:2px solid #1a1a2e; }
.lounge-header-avatar-img:first-child { margin-left:0; }
.lounge-header-avatar-emoji { width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:0.75rem; margin-left:-8px; border:2px solid #1a1a2e; color:#fff; }
.lounge-header-avatar-emoji:first-child { margin-left:0; }

.lounge-welcome-avatars { display:flex; justify-content:center; gap:0.3rem; margin-bottom:0.8rem; }
.lounge-welcome-avatar { width:42px; height:42px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1.2rem; color:#fff; }
.lounge-welcome-avatar img { width:42px; height:42px; border-radius:50%; object-fit:cover; }

.lounge-msg { align-items:flex-start !important; }
.lounge-avatar { width:30px; height:30px; font-size:0.85rem; }
.lounge-avatar img { width:30px; height:30px; }
.lounge-msg-content { display:flex; flex-direction:column; gap:0.15rem; max-width:80%; }
.lounge-char-label { font-size:0.7rem; font-weight:700; padding-left:0.2rem; }
.lounge-bubble { border-radius:12px !important; }
.lounge-typing-bubble { display:flex; flex-direction:column; gap:0.15rem; }

.lounge-msg-enter { opacity:0; transform:translateY(8px); transition:all 0.3s ease; }
.lounge-msg-visible { opacity:1; transform:translateY(0); }


