.chat-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  touch-action: none;
  isolation: isolate;
}

.chat-orb {
  position: relative;
  width: 84px;
  height: 84px;
  border: 1px solid rgba(167, 255, 47, 0.38);
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(167, 255, 47, 0.3), rgba(4, 10, 7, 0.96) 62%);
  box-shadow: 0 0 34px rgba(167, 255, 47, 0.22), inset 0 0 24px rgba(167, 255, 47, 0.09);
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  display: grid;
  place-items: center;
  animation: chatPlay 5.2s ease-in-out infinite;
}

.chat-widget.dragging .chat-orb {
  cursor: grabbing;
}

.chat-widget.open .chat-orb {
  animation: none;
  transform: scale(0.88);
}

.chat-pulse {
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  border: 1px solid rgba(167, 255, 47, 0.24);
  animation: chatPulse 2.4s ease-out infinite;
}

.chat-orb-video,
.chat-orb-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.chat-orb-video {
  transform: scale(1.16);
  transform-origin: center;
}

.chat-orb-fallback {
  display: none;
  object-fit: contain;
  padding: 6px;
  transform: scale(1.12);
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 102px;
  width: min(360px, calc(100vw - 28px));
  padding: 16px;
  border: 1px solid rgba(167, 255, 47, 0.34);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(10, 14, 12, 0.98), rgba(5, 8, 6, 0.98));
  box-shadow: 0 0 34px rgba(167, 255, 47, 0.1), 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
  transition: opacity 0.24s ease, transform 0.24s ease;
  touch-action: auto;
  overscroll-behavior: contain;
}

.chat-widget.open .chat-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(167, 255, 47, 0.34);
  background: rgba(167, 255, 47, 0.06);
  flex: 0 0 48px;
}

.chat-avatar video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-header strong {
  display: block;
  color: #fff;
  font-size: 15px;
}

.chat-header span {
  color: #a7ff2f;
  font-size: 13px;
}

.chat-header button {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  cursor: pointer;
}

.chat-messages {
  display: grid;
  gap: 10px;
  max-height: 250px;
  overflow: auto;
  padding-right: 4px;
}

.chat-messages article {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 14px;
}

.chat-messages .bot-message {
  background: rgba(167, 255, 47, 0.08);
  border: 1px solid rgba(167, 255, 47, 0.18);
  color: #eef4ea;
}

.chat-messages .user-message {
  margin-left: auto;
  background: #a7ff2f;
  color: #071004;
  font-weight: 600;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
}

.chat-form input {
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: #fff;
  padding: 0 14px;
  outline: 0;
}

.chat-form button {
  height: 46px;
  min-width: 46px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #a7ff2f, #8fec20);
  color: #071004;
  font-weight: 900;
  cursor: pointer;
}

@keyframes chatPlay {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-4px) rotate(-2deg); }
  55% { transform: translateY(2px) rotate(2deg); }
  75% { transform: translateY(-2px); }
}

@keyframes chatPulse {
  0% { opacity: 0.85; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.18); }
}

@media (max-width: 760px) {
  .chat-widget {
    right: 14px;
    bottom: 14px;
  }

  .chat-orb {
    width: 76px;
    height: 76px;
  }

  .chat-panel {
    bottom: 92px;
  }
}

@media (hover: none) and (pointer: coarse) and (orientation: landscape) {
  .chat-widget {
    right: 10px;
    bottom: 58px;
  }

  .chat-orb {
    width: 64px;
    height: 64px;
  }

  .chat-panel {
    bottom: 74px;
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100dvh - 96px);
    overflow: auto;
  }
}
