#tgchat-btn{position:fixed;bottom:20px;width:56px;height:56px;border-radius:999px;background:#111;color:#fff;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:99999;box-shadow:0 8px 24px rgba(0,0,0,.2)}
#tgchat-box{position:fixed;bottom:90px;width:320px;height:420px;background:#fff;border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,.18);display:none;flex-direction:column;overflow:hidden;z-index:99999}
#tgchat-head{padding:10px 12px;background:#111;color:#fff;font-size:14px;display:flex;justify-content:space-between;align-items:center}
#tgchat-messages{flex:1;padding:10px;overflow:auto;font-size:13px;line-height:1.4}
.tgchat-m{margin:8px 0;max-width:85%;padding:8px 10px;border-radius:12px}
.tgchat-me{background:#111;color:#fff;margin-left:auto}
.tgchat-bot{background:#f2f2f2;color:#111}
#tgchat-form{display:flex;gap:8px;padding:10px;border-top:1px solid #eee}
#tgchat-input{flex:1;border:1px solid #ddd;border-radius:10px;padding:8px 10px;outline:none}
#tgchat-send{border:none;border-radius:10px;background:#111;color:#fff;padding:8px 12px;cursor:pointer}
#tgchat-note{font-size:12px;color:#777;padding:0 10px 10px}
#tgchat-transfer{padding:2px 6px;border:1px solid rgba(255,255,255,.35);border-radius:8px}
#tgchat-transfer.tgchat-transfer-disabled{opacity:.5;cursor:not-allowed}

/* Markdown rendering tweaks (bot side) */
.tgchat-bot p{margin:0.4em 0}
.tgchat-bot ul,.tgchat-bot ol{margin:0.5em 0;padding-left:1.2em}
.tgchat-bot li{margin:0.25em 0}
.tgchat-bot code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:12px;background:rgba(0,0,0,.05);padding:0 4px;border-radius:6px}
.tgchat-bot pre{overflow:auto;background:rgba(0,0,0,.05);padding:8px;border-radius:10px}


/* Screenshot mode */
#tgchat-shot-mask{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 99999;
  cursor: crosshair;
}
#tgchat-shot-box{
  position: absolute;
  border: 2px dashed #4da3ff;
  background: rgba(77,163,255,0.15);
  display: none;
  box-sizing: border-box;
}
.tgchat-shot-handle{
  position: absolute;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 1px solid #4da3ff;
  box-sizing: border-box;
}
.tgchat-shot-nw{ left:-6px; top:-6px; cursor:nwse-resize; }
.tgchat-shot-ne{ right:-6px; top:-6px; cursor:nesw-resize; }
.tgchat-shot-sw{ left:-6px; bottom:-6px; cursor:nesw-resize; }
.tgchat-shot-se{ right:-6px; bottom:-6px; cursor:nwse-resize; }
.tgchat-shot-n{ left:50%; top:-6px; transform:translateX(-50%); cursor:ns-resize; }
.tgchat-shot-s{ left:50%; bottom:-6px; transform:translateX(-50%); cursor:ns-resize; }
.tgchat-shot-w{ left:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }
.tgchat-shot-e{ right:-6px; top:50%; transform:translateY(-50%); cursor:ew-resize; }

#tgchat-shot-toolbar{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 100000;
  background: rgba(255,255,255,0.95);
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
#tgchat-shot-toolbar button{
  padding: 6px 10px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
}
#tgchat-shot-tip{
  color:#666;
  white-space: nowrap;
}

.tgchat-typing{
  display:inline-flex;
  align-items:center;
}
.tgchat-typing-dots{
  display:inline-flex;
  align-items:center;
  gap:4px;
  min-height:12px;
}
.tgchat-typing-dots i{
  width:6px;
  height:6px;
  border-radius:999px;
  background:#8f8f8f;
  display:inline-block;
  opacity:.25;
  animation:tgchatTypingPulse 1.2s infinite ease-in-out;
}
.tgchat-typing-dots i:nth-child(2){animation-delay:.2s}
.tgchat-typing-dots i:nth-child(3){animation-delay:.4s}
@keyframes tgchatTypingPulse{
  0%,80%,100%{opacity:.25;transform:translateY(0)}
  40%{opacity:.9;transform:translateY(-1px)}
}
