#djchat-root {
  --dj-accent: #d9822b;
  --dj-bg: #ffffff;
  --dj-ink: #1d1d22;
  --dj-muted: #6b6b75;
  --dj-bubble-them: #f2efe9;
  --dj-line: rgba(0,0,0,.08);
  position: fixed; right: 20px; bottom: 20px; z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--dj-ink);
}
#djchat-root *, #djchat-root *::before, #djchat-root *::after { box-sizing: border-box; }

/* Launcher */
.djchat-launch {
  position: relative; width: 68px; height: 68px; border-radius: 50%;
  border: 3px solid var(--dj-accent); padding: 0; cursor: pointer; background: #111;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: transform .2s ease;
  animation: djchat-pop .5s ease-out both;
}
.djchat-launch:hover { transform: scale(1.06); }
.djchat-launch img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.djchat-launch .djchat-dot {
  position: absolute; right: 2px; bottom: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #34c759; border: 2px solid #fff;
}
.djchat-teaser {
  position: absolute; right: 80px; bottom: 14px; white-space: nowrap;
  background: var(--dj-bg); color: var(--dj-ink); padding: 9px 14px; border-radius: 18px 18px 4px 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 14px; font-weight: 500; cursor: pointer;
  animation: djchat-fade .4s ease-out 1.2s both, djchat-wiggle 6s ease-in-out 4s infinite;
}
.djchat-teaser:hover { box-shadow: 0 8px 26px rgba(0,0,0,.26); }
.djchat-teaser button {
  border: 0; background: none; color: var(--dj-muted); margin-left: 6px; cursor: pointer; font-size: 14px; padding: 0;
}

/* Panel */
.djchat-panel {
  position: absolute; right: 0; bottom: 84px; width: 370px; height: 560px; max-height: calc(100vh - 120px);
  background: var(--dj-bg); border-radius: 20px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 18px 50px rgba(0,0,0,.28); transform-origin: bottom right;
  animation: djchat-open .22s ease-out both;
}
.djchat-panel[hidden] { display: none; }
.djchat-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: linear-gradient(135deg, #17171b, #2b2b33); color: #fff;
}
.djchat-head img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--dj-accent); }
.djchat-head .djchat-who { flex: 1; min-width: 0; }
.djchat-head strong { display: block; font-size: 16px; }
.djchat-head span { display: block; font-size: 12.5px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.djchat-close { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; }
.djchat-close:hover { background: rgba(255,255,255,.22); }
.djchat-reset { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; padding: 0; }
.djchat-reset:hover { background: rgba(255,255,255,.22); }

.djchat-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; background: #faf8f4; }
.djchat-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.djchat-row img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.djchat-msg { padding: 9px 13px; border-radius: 18px; max-width: 80%; white-space: pre-wrap; word-wrap: break-word; }
.djchat-them .djchat-msg { background: var(--dj-bubble-them); border-bottom-left-radius: 5px; }
.djchat-me { justify-content: flex-end; }
.djchat-me .djchat-msg { background: var(--dj-accent); color: #fff; border-bottom-right-radius: 5px; }
.djchat-msg a { color: inherit; text-decoration: underline; }
.djchat-err .djchat-msg { background: #fdecea; color: #8a1c13; }

.djchat-typing .djchat-msg { display: flex; gap: 4px; padding: 13px 14px; }
.djchat-typing i { width: 7px; height: 7px; border-radius: 50%; background: #9a9aa3; animation: djchat-bounce 1.2s infinite; }
.djchat-typing i:nth-child(2) { animation-delay: .15s; }
.djchat-typing i:nth-child(3) { animation-delay: .3s; }
.djchat-typing img { animation: djchat-nod .9s ease-in-out infinite; }

.djchat-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; background: #faf8f4; }
.djchat-chips button {
  border: 1px solid var(--dj-accent); color: var(--dj-accent); background: #fff; border-radius: 999px;
  padding: 6px 11px; font-size: 13px; cursor: pointer;
}
.djchat-chips button:hover { background: var(--dj-accent); color: #fff; }

.djchat-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--dj-line); background: var(--dj-bg); }
.djchat-form textarea {
  flex: 1; resize: none; border: 1px solid var(--dj-line); border-radius: 20px; padding: 9px 14px;
  font: inherit; max-height: 110px; outline: none; background: #fff; color: var(--dj-ink);
}
.djchat-form textarea:focus { border-color: var(--dj-accent); }
.djchat-form button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--dj-accent); color: #fff;
  cursor: pointer; flex: none; align-self: flex-end; display: grid; place-items: center;
}
.djchat-form button:disabled { opacity: .5; cursor: default; }
.djchat-foot { text-align: center; font-size: 11px; color: var(--dj-muted); padding: 0 0 8px; background: var(--dj-bg); }

@keyframes djchat-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes djchat-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes djchat-open { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes djchat-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes djchat-wiggle { 0%, 88%, 100% { transform: none; } 91% { transform: translateY(-4px) rotate(-1.5deg); } 94% { transform: translateY(0) rotate(1.5deg); } 97% { transform: translateY(-2px); } }
@keyframes djchat-nod { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-6deg); } }

@media (max-width: 480px) {
  #djchat-root { right: 14px; bottom: 14px; }
  .djchat-panel { position: fixed; right: 8px; left: 8px; bottom: 92px; width: auto; height: auto; top: 12px; max-height: none; }
  .djchat-teaser { right: 76px; bottom: 16px; font-size: 13px; padding: 8px 12px; max-width: calc(100vw - 110px); white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  #djchat-root * { animation: none !important; transition: none !important; }
}
