.ai-chat { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 120; font-size: .95rem; }
.ai-chat-toggle, .ai-chat-form button { border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.ai-chat-toggle { display:flex; align-items:center; justify-content:center; gap:.55rem; padding: .7rem 1.15rem .7rem .8rem; border:1px solid var(--accent) !important; background:#030509; box-shadow:0 12px 28px rgba(0,0,0,.3), 0 0 0 1px rgba(77,134,255,.08); }
.ai-chat-toggle img { width: 1.9rem; height: 1.9rem; object-fit: contain; animation: ai-chat-logo-pulse 5.8s ease-in-out infinite; }
@keyframes ai-chat-logo-pulse { 0%, 100% { transform: rotate(0deg) scale(1); } 45% { transform: rotate(4deg) scale(1.06); } 55% { transform: rotate(-3deg) scale(1.03); } }
@media (prefers-reduced-motion: reduce) { .ai-chat-toggle img { animation: none; } }
.ai-chat-panel { width: min(25rem, calc(100vw - 2rem)); height: min(38rem, calc(100dvh - 6rem)); margin-bottom: .7rem; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 1.1rem; background: rgba(9,13,22,.98); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.ai-chat-panel[hidden] { display: none; }
.ai-chat-head { display:flex; flex:0 0 auto; justify-content:space-between; align-items:center; padding: 1rem; border-bottom:1px solid var(--border); }
.ai-chat-close { border:0; background:none; color:var(--muted); font-size:1.5rem; cursor:pointer; }
.ai-chat-messages { flex:1 1 auto; min-height:0; overflow:auto; overscroll-behavior:contain; padding:1rem; }
.ai-chat-message { max-width: 88%; margin: 0 0 .75rem; padding: .7rem .85rem; border-radius: .8rem; white-space: pre-wrap; line-height:1.45; }
.ai-chat-message.user { margin-left:auto; background:var(--accent); color:#fff; }
.ai-chat-message.assistant { background:var(--surface-2); color:var(--text); }
.ai-chat-message p { margin: 0 0 .65rem; }
.ai-chat-message p:last-child { margin-bottom: 0; }
.ai-chat-message ul { margin: .45rem 0 .7rem 1.2rem; padding: 0; }
.ai-chat-message li { margin: .25rem 0; }
.ai-chat-message a { color: var(--accent-bright); text-decoration: underline; }
.ai-chat-message.error { color:#ffb0b0; }
.ai-chat-form { display:grid; grid-template-columns:minmax(0, 1fr) auto; flex:0 0 auto; gap:.5rem; padding:.75rem; padding-bottom:max(.75rem, env(safe-area-inset-bottom)); border-top:1px solid var(--border); background:rgba(9,13,22,.98); }
.ai-chat-form input { min-width:0; flex:1; border:1px solid var(--border-strong); border-radius:999px; padding:.7rem .85rem; background:var(--surface); color:var(--text); font:inherit; }
.ai-chat-form button { padding:.7rem 1rem; }
@media (max-width:700px) {
  body.chat-is-open { overflow:hidden; }
  .ai-chat { right:.75rem; bottom:max(.75rem, env(safe-area-inset-bottom)); left:.75rem; }
  .ai-chat-toggle { width:100%; }
  .ai-chat:has(.ai-chat-panel:not([hidden])) .ai-chat-toggle { display:none; }
  .ai-chat-panel { width:100%; height:calc(100dvh - 1.5rem - env(safe-area-inset-bottom)); max-height:none; margin-bottom:0; }
  .ai-chat-head { padding:.75rem .9rem; }
  .ai-chat-messages { padding:.8rem; }
  .ai-chat-form { padding:.65rem; padding-bottom:max(.65rem, env(safe-area-inset-bottom)); }
  .ai-chat-form input { width:100%; }
  .ai-chat-form button { white-space:nowrap; }
}
@media (max-width:700px) and (max-height:520px) {
  .ai-chat-head { padding:.45rem .75rem; }
  .ai-chat-messages { padding:.55rem .7rem; }
  .ai-chat-form { padding:.45rem; }
}
