:root {
  --ivchat-bg:      var(--bg-secondary, #0a0e1a);
  --ivchat-panel:   var(--card-hover, rgba(255,255,255,0.08));
  --ivchat-accent:  var(--accent, #5ef2c1);
  --ivchat-text:    var(--text, #e6e9f0);
  --ivchat-muted:   var(--muted, #9aa4bf);
  --ivchat-border:  var(--border, rgba(255,255,255,0.1));
}

#ivchat-launcher {
  position: fixed; bottom: 24px; right: 24px; z-index: 9998;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--ivchat-accent); border: none; cursor: pointer;
  box-shadow: 0 6px 24px rgba(94,242,193,.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease;
}
#ivchat-launcher:hover { transform: scale(1.06); }
#ivchat-launcher svg { width: 45px; height: 45px; color: var(--ivchat-bg); overflow: visible; }
#ivchat-antenna-dot { animation: ivchat-blip 2.4s ease-in-out infinite; transform-origin: 12px 2px; }
#ivchat-eye-l, #ivchat-eye-r { animation: ivchat-blink 4.5s ease-in-out infinite; transform-origin: center; }
#ivchat-eye-r { animation-delay: .06s; }
@keyframes ivchat-blip {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(1.3); }
}
@keyframes ivchat-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.15); }
}

#ivchat-panel {
  position: fixed; bottom: 94px; right: 24px; z-index: 9999;
  width: 370px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 130px);
  background: var(--ivchat-bg); border: 1px solid var(--ivchat-border);
  border-radius: 16px; box-shadow: 0 12px 48px rgba(0,0,0,.5);
  display: none; flex-direction: column; overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
#ivchat-panel.open { display: flex; }

body:has(#ivchat-panel.open) .lang { display: none; }

#ivchat-header {
  padding: 14px 16px; background: var(--ivchat-panel);
  border-bottom: 1px solid var(--ivchat-border);
  display: flex; align-items: center; gap: 10px;
}
#ivchat-header .dot { width: 9px; height: 9px; border-radius: 50%;
  background: #3ddc84; box-shadow: 0 0 8px #3ddc84; }
#ivchat-header .title { color: var(--ivchat-text); font-weight: 600; font-size: 14px; }
#ivchat-header .sub { color: var(--ivchat-muted); font-size: 11px; }
#ivchat-header .close { margin-left: auto; background: none; border: none;
  color: var(--ivchat-muted); font-size: 20px; cursor: pointer; line-height: 1; }

#ivchat-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 12px;
}
#ivchat-messages::-webkit-scrollbar { width: 6px; }
#ivchat-messages::-webkit-scrollbar-thumb { background: var(--ivchat-border); border-radius: 3px; }

.ivchat-msg { max-width: 82%; padding: 10px 13px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.ivchat-msg.user { align-self: flex-end; background: var(--ivchat-accent);
  color: var(--ivchat-bg); border-bottom-right-radius: 4px; }
.ivchat-msg.bot { align-self: flex-start; background: var(--ivchat-panel);
  color: var(--ivchat-text); border: 1px solid var(--ivchat-border);
  border-bottom-left-radius: 4px; }
.ivchat-msg.bot .cursor { display:inline-block; width:7px; height:14px;
  background: var(--ivchat-accent); margin-left:2px; animation: ivblink 1s steps(2) infinite;
  vertical-align: text-bottom; }
@keyframes ivblink { 0%,50%{opacity:1} 51%,100%{opacity:0} }

#ivchat-input-row {
  display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--ivchat-border);
  background: var(--ivchat-bg);
}
#ivchat-input {
  flex: 1; background: var(--ivchat-panel); border: 1px solid var(--ivchat-border);
  border-radius: 10px; padding: 10px 12px; color: var(--ivchat-text);
  font-size: 13.5px; resize: none; outline: none; font-family: inherit; max-height: 80px;
}
#ivchat-input:focus { border-color: var(--ivchat-accent); }
#ivchat-send {
  background: var(--ivchat-accent); border: none; border-radius: 10px;
  width: 42px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
#ivchat-send:disabled { opacity: .4; cursor: not-allowed; }
#ivchat-send svg { width: 18px; height: 18px; fill: var(--ivchat-bg); }
