To use it only in view topic pages you can wrap your code in
Code: Select all
<!-- IF SCRIPT_NAME = viewtopic -->
Your code here
<!-- ENDIF -->
A media query would take care of only showing at certain screen sizes.
I know you said no external scripts, but making it sticky would be difficult without. I can highly recomend "Sticky-Kit", a jQuery plugin that weighs in at just just over 3kb minified, and phpBB loads jQuery already. I use this in one of my styles and found it really easy to use. More info here:
http://leafo.net/sticky-kit/