:root {
  --ts-bot-shell: #D0D0D0;
  --ts-bot-shell-hi: #E0E0E0;
  --ts-bot-visor: #101018;
  --ts-bot-eye: #62DAEB;
  --ts-bot-glow: rgba(98, 218, 235, 0.45);
  --ts-bot-glow-intense: rgba(98, 218, 235, 0.75);
}

#ts-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-body, system-ui, sans-serif);
  pointer-events: none;
}

/* ── BOT SPRITE & ANIMATIONS ── */
.ts-bot-container {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 75px;
  height: 90px;
  pointer-events: auto;
  cursor: pointer;
  z-index: 10001;
  transform-origin: top left;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ts-bot-glow-layer {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 0 18px var(--ts-bot-glow));
  animation: ts-glow-pulse 3s infinite ease-in-out;
}

.ts-bot-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  animation: ts-float-body 4.5s infinite ease-in-out;
  pointer-events: none;
}

.ts-bot-head {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  animation: ts-float-head 4.5s infinite ease-in-out -0.35s, ts-head-rotate 6s infinite ease-in-out;
  pointer-events: none;
  transform-origin: bottom center;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

/* Hover effects */
.ts-bot-container:hover {
  transform: scale(1.08);
}
.ts-bot-container:hover .ts-bot-glow-layer {
  filter: drop-shadow(0 0 24px var(--ts-bot-glow-intense));
}
.ts-bot-container:hover .ts-bot-head {
  transform: rotate(-6deg);
  animation: ts-float-head 4.5s infinite ease-in-out -0.35s;
}

/* Thinking & Speaking states */
.ts-thinking .ts-bot-glow-layer {
  animation: ts-glow-pulse-fast 0.9s infinite ease-in-out;
}

.ts-speaking .ts-bot-glow-layer {
  animation: ts-glow-speaking 0.6s infinite ease-in-out;
  filter: drop-shadow(0 0 24px var(--ts-bot-glow-intense));
}

/* Nudge Tooltip */
.ts-nudge-tooltip {
  position: absolute;
  right: 100px;
  bottom: 40px;
  background: rgba(16, 16, 24, 0.92);
  color: var(--ts-bot-shell);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#ts-chat-widget.ts-nudge-active .ts-nudge-tooltip {
  opacity: 1;
  transform: translateX(0);
}

#ts-chat-widget.ts-nudge-active .ts-bot-head {
  transform: rotate(-10deg);
  transition: transform 0.6s ease;
}

/* ── CHAT PANEL ── */
.ts-chat-panel {
  position: fixed;
  top: 50%;
  right: 24px;
  width: 440px;
  height: calc(100vh - 100px);
  max-height: 900px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(-45%) scale(0.95);
  transform-origin: right center;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  overflow: hidden;
  z-index: 10000;
}

.ts-chat-panel.is-open {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}

/* Universal button reset inside chat panel to guarantee NO browser default buttonface leaks */
#ts-chat-panel button,
#ts-chat-widget button {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  box-sizing: border-box;
}

/* ── CHAT HEADER ── */
.ts-chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
}

.ts-header-text h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.ts-header-text p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.ts-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Header Buttons */
.ts-chat-header-btn {
  background: var(--bg-root);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.ts-chat-header-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--bg-card-raised);
}

/* Voice Button Specifics */
.ts-chat-voice-btn .ts-voice-icon-active {
  display: none;
}

.ts-chat-voice-btn.is-active {
  color: var(--accent);
  background: rgba(98, 218, 235, 0.12);
  border-color: var(--accent);
}

.ts-chat-voice-btn.is-active .ts-voice-icon-muted {
  display: none;
}

.ts-chat-voice-btn.is-active .ts-voice-icon-active {
  display: block;
}

/* Animated Voice Waves */
.ts-voice-waves {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.ts-chat-voice-btn.is-speaking .ts-voice-waves {
  display: inline-flex;
}

.ts-wave-bar {
  width: 2.5px;
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  animation: ts-wave-jump 0.8s infinite ease-in-out;
}

.ts-wave-bar:nth-child(1) { animation-delay: 0s; height: 60%; }
.ts-wave-bar:nth-child(2) { animation-delay: 0.2s; height: 100%; }
.ts-wave-bar:nth-child(3) { animation-delay: 0.4s; height: 75%; }

@keyframes ts-wave-jump {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.ts-chat-close:hover {
  transform: scale(1.08);
}

/* ── CHAT BODY ── */
.ts-chat-body {
  flex: 1;
  padding: 16px 14px 16px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: var(--font-body);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(98, 218, 235, 0.45) rgba(0, 0, 0, 0.15);
}

/* Custom Sleek Scrollbar */
.ts-chat-body::-webkit-scrollbar {
  width: 5px;
}

.ts-chat-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
  margin: 6px 0;
}

.ts-chat-body::-webkit-scrollbar-thumb {
  background: rgba(98, 218, 235, 0.35);
  border-radius: 10px;
  transition: background 0.2s ease;
}

.ts-chat-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent, #62daeb);
  box-shadow: 0 0 8px rgba(98, 218, 235, 0.5);
}

.ts-msg-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ts-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  padding: 2px;
  flex-shrink: 0;
}

.ts-msg-container {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ts-msg {
  max-width: 100%;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 16px;
  border-radius: 12px;
  word-wrap: break-word;
}

.ts-msg p {
  margin: 0 0 8px 0;
  line-height: 1.6;
}
.ts-msg p:last-child {
  margin-bottom: 0;
}

.ts-msg strong {
  font-weight: 600;
  color: var(--text-primary);
}

.ts-msg em {
  font-style: italic;
}

.ts-inline-code {
  background: var(--bg-root);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  color: var(--accent);
}

.ts-msg-list {
  margin: 6px 0 8px 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ts-msg-list li {
  line-height: 1.55;
}

.ts-msg-ai {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ts-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg-root);
  border-bottom-right-radius: 4px;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ts-msg-system {
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  padding: 4px;
  align-self: center;
}

/* ── MESSAGE TOOLBAR & COPY BUTTON ── */
.ts-msg-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ts-msg-container:hover .ts-msg-tools,
.ts-msg-tools:focus-within {
  opacity: 1;
}

.ts-msg-copy-btn {
  background: var(--bg-root);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.ts-msg-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--bg-card-raised);
  transform: translateY(-1px);
}

.ts-msg-copy-btn.is-copied {
  color: #00ff88;
  border-color: #00ff88;
  background: rgba(0, 255, 136, 0.08);
}

/* ── ACTIONABLE TOOL / DEEP-LINK CARDS ── */
.ts-action-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  width: 100%;
}

.ts-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-root);
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.ts-action-card:hover {
  background: var(--bg-card-raised, var(--bg-card));
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), 0 0 12px var(--ts-bot-glow);
}

.ts-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ts-card-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ts-card-text {
  display: flex;
  flex-direction: column;
}

.ts-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-body);
}

.ts-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.ts-card-arrow {
  color: var(--accent);
  font-size: 14px;
  font-weight: bold;
  transition: transform 0.2s ease;
}

.ts-action-card:hover .ts-card-arrow {
  transform: translateX(3px);
}

/* ── CONTEXTUAL FOLLOW-UP CHIPS ── */
.ts-followup-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 2px;
}

.ts-followup-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--bg-root);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  text-align: left;
}

.ts-followup-chip:hover {
  background: var(--bg-card-raised, var(--bg-card));
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.ts-followup-chip-sparkle {
  color: var(--accent);
  font-size: 11px;
}

/* ── LUXURY STARTER PROMPT CARDS ── */
#ts-chat-panel .ts-starter-chips,
.ts-starter-chips {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  margin-top: auto !important;
  padding: 16px 0 4px 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#ts-chat-panel .ts-starter-chip,
.ts-starter-chip {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 10px 14px !important;
  background: var(--bg-card) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  color: var(--text-primary) !important;
  font-family: var(--font-body, system-ui, sans-serif) !important;
  font-size: 13px !important;
  cursor: pointer !important;
  text-align: left !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.05)) !important;
  position: relative !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  width: 100% !important;
  outline: none !important;
}

#ts-chat-panel .ts-starter-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--accent-light), transparent 75%);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#ts-chat-panel .ts-starter-chip:hover {
  background: var(--bg-card-raised) !important;
  border-color: var(--accent) !important;
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-md), 0 0 14px var(--accent-light) !important;
}

#ts-chat-panel .ts-starter-chip:hover::before {
  opacity: 1;
}

#ts-chat-panel .ts-chip-content {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex: 1 !important;
  min-width: 0 !important;
}

#ts-chat-panel .ts-chip-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 3px 8px !important;
  background: var(--accent-light) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  color: var(--accent) !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease !important;
}

#ts-chat-panel .ts-starter-chip:hover .ts-chip-badge {
  background: var(--accent-medium) !important;
  border-color: var(--accent) !important;
  color: var(--accent-hover, var(--accent)) !important;
}

#ts-chat-panel .ts-chip-text {
  color: var(--text-primary) !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  transition: color 0.2s ease !important;
}

#ts-chat-panel .ts-starter-chip:hover .ts-chip-text {
  color: var(--accent) !important;
}

#ts-chat-panel .ts-chip-arrow {
  color: var(--text-muted) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  margin-left: 10px !important;
  flex-shrink: 0 !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#ts-chat-panel .ts-starter-chip:hover .ts-chip-arrow {
  color: var(--accent) !important;
  transform: translateX(4px) !important;
}

/* ── CHAT FOOTER ── */
.ts-chat-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.ts-chat-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-root);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 4px 4px 14px;
  transition: border-color 0.2s;
}

.ts-chat-input-wrapper:focus-within {
  border-color: var(--accent);
}

.ts-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: var(--font-body);
}
.ts-chat-input::placeholder {
  color: var(--text-muted);
}

.ts-chat-send {
  background: var(--accent);
  color: var(--bg-root);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}
.ts-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ts-chat-send:not(:disabled):hover {
  transform: scale(1.05);
}

/* ── PERSONALITY MODE BAR (Segmented Pill Switch) ── */
#ts-chat-panel .ts-mode-bar,
.ts-mode-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 8px 14px 4px 14px !important;
  background: var(--bg-card) !important;
  border-bottom: 1px solid var(--border) !important;
  box-sizing: border-box !important;
}

#ts-chat-panel .ts-mode-pill-group,
.ts-mode-pill-group {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  width: 100% !important;
  background: var(--bg-root) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 3px !important;
  gap: 3px !important;
  box-sizing: border-box !important;
}

#ts-chat-panel .ts-mode-pill,
.ts-mode-pill {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: var(--text-muted) !important;
  border-radius: 7px !important;
  padding: 6px 8px !important;
  font-size: 11.5px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  font-family: var(--font-body, system-ui, sans-serif) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  text-align: center !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}

#ts-chat-panel .ts-mode-pill:hover,
.ts-mode-pill:hover {
  color: var(--text-primary) !important;
  background: var(--accent-light) !important;
}

#ts-chat-panel .ts-mode-pill.is-active,
.ts-mode-pill.is-active {
  background: var(--accent) !important;
  color: var(--bg-root) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 10px var(--accent-light) !important;
}

/* ── SOUND TOGGLE BUTTON ── */
.ts-chat-header-btn.is-muted svg.ts-sound-icon-on {
  display: none !important;
}
.ts-chat-header-btn.is-muted svg.ts-sound-icon-off {
  display: block !important;
}

/* ── SPEECH-TO-TEXT MIC BUTTON ── */
#ts-chat-panel .ts-chat-mic,
.ts-chat-mic {
  appearance: none !important;
  -webkit-appearance: none !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: var(--text-muted) !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  margin: 0 4px 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
}

#ts-chat-panel .ts-chat-mic:hover,
.ts-chat-mic:hover {
  color: var(--accent) !important;
  background: var(--accent-light) !important;
  transform: scale(1.05) !important;
}

#ts-chat-panel .ts-chat-mic.is-listening,
.ts-chat-mic.is-listening {
  color: #ff3366 !important;
  background: rgba(255, 51, 102, 0.18) !important;
  box-shadow: 0 0 14px rgba(255, 51, 102, 0.5) !important;
}

.ts-mic-pulse {
  display: none;
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #ff3366;
  animation: ts-mic-ping 1.2s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

.ts-chat-mic.is-listening .ts-mic-pulse {
  display: block;
}

@keyframes ts-mic-ping {
  0% { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ── VISOR MOOD DYNAMICS ── */
.ts-bot-container.ts-mood-thinking .ts-bot-glow-layer {
  filter: drop-shadow(0 0 22px rgba(168, 85, 247, 0.9)) !important;
  animation: ts-glow-pulse-fast 0.8s infinite ease-in-out;
}

.ts-bot-container.ts-mood-casual .ts-bot-glow-layer {
  filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.85)) !important;
  transition: filter 0.4s ease;
}

.ts-bot-container.ts-mood-tech .ts-bot-glow-layer {
  filter: drop-shadow(0 0 24px rgba(98, 218, 235, 0.95)) !important;
  transition: filter 0.4s ease;
}

.ts-bot-container.ts-mood-success .ts-bot-glow-layer {
  filter: drop-shadow(0 0 22px rgba(16, 185, 129, 0.85)) !important;
  transition: filter 0.4s ease;
}

/* ── KEYFRAMES ── */
@keyframes ts-float-body {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes ts-float-head {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes ts-head-rotate {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

@keyframes ts-glow-pulse {
  0%, 100% { filter: drop-shadow(0 0 14px var(--ts-bot-glow)); }
  50% { filter: drop-shadow(0 0 22px var(--ts-bot-glow)); }
}

@keyframes ts-glow-pulse-fast {
  0%, 100% { filter: drop-shadow(0 0 14px var(--ts-bot-glow)); }
  50% { filter: drop-shadow(0 0 28px var(--ts-bot-glow-intense)); }
}

@keyframes ts-glow-speaking {
  0%, 100% { filter: drop-shadow(0 0 18px var(--ts-bot-glow)); }
  50% { filter: drop-shadow(0 0 32px var(--ts-bot-glow-intense)); }
}

/* ── TYPING INDICATOR ── */
.ts-typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  min-height: 24px;
}
.ts-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
  animation: ts-typing 1.4s infinite ease-in-out both;
}
.ts-dot:nth-child(1) { animation-delay: -0.32s; }
.ts-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ts-typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  .ts-bot-body, .ts-bot-head, .ts-bot-glow-layer {
    animation: none !important;
  }
  .ts-bot-container:hover .ts-bot-head {
    transform: none;
  }
  .ts-bot-container:hover {
    transform: none;
  }
  #ts-chat-widget.ts-nudge-active .ts-nudge-tooltip {
    display: none;
  }
}

/* ── RESPONSIVE & MOBILE POLISH ── */
@media (max-width: 768px) {
  #ts-chat-widget {
    bottom: 12px;
    right: 12px;
  }

  .ts-bot-container {
    z-index: 100001 !important;
  }

  .ts-chat-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    transform: translateY(100%) !important;
    transform-origin: bottom center !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    z-index: 100000 !important;
  }

  .ts-chat-panel.is-open {
    transform: translateY(0) !important;
    opacity: 1 !important;
  }

  /* Compact Header on Mobile */
  .ts-chat-header {
    padding: 10px 12px !important;
    min-height: 52px !important;
  }

  #ts-avatar-target {
    width: 38px !important;
    height: 38px !important;
    margin-right: 10px !important;
  }

  .ts-header-text h3 {
    font-size: 14.5px !important;
    line-height: 1.2 !important;
  }

  .ts-header-text p {
    font-size: 11px !important;
    margin-top: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
  }

  .ts-header-actions {
    gap: 3px !important;
  }

  .ts-chat-header-btn {
    padding: 6px 6px !important;
    border-radius: 7px !important;
  }

  /* Compact Mode Bar on Mobile */
  #ts-chat-panel .ts-mode-bar,
  .ts-mode-bar {
    padding: 6px 12px 3px 12px !important;
  }

  #ts-chat-panel .ts-mode-pill,
  .ts-mode-pill {
    padding: 5px 4px !important;
    font-size: 11px !important;
    gap: 3px !important;
  }

  /* Chat Body on Mobile */
  .ts-chat-body {
    padding: 10px 12px !important;
    gap: 10px !important;
  }

  .ts-msg {
    font-size: 13.5px !important;
    padding: 10px 13px !important;
    line-height: 1.55 !important;
  }

  /* Compact Starter Cards on Mobile */
  #ts-chat-panel .ts-starter-chips,
  .ts-starter-chips {
    gap: 6px !important;
    padding: 8px 0 2px 0 !important;
  }

  #ts-chat-panel .ts-starter-chip,
  .ts-starter-chip {
    padding: 9px 12px !important;
    border-radius: 9px !important;
  }

  #ts-chat-panel .ts-chip-badge {
    font-size: 9px !important;
    padding: 2px 6px !important;
  }

  #ts-chat-panel .ts-chip-text {
    font-size: 12px !important;
  }

  /* Mobile Footer with Safe Area Support */
  .ts-chat-footer {
    padding: 8px 12px max(10px, env(safe-area-inset-bottom, 10px)) 12px !important;
  }

  .ts-chat-input-wrapper {
    padding: 3px 4px 3px 12px !important;
  }

  .ts-chat-input {
    font-size: 14px !important;
  }

  .ts-chat-mic {
    width: 30px !important;
    height: 30px !important;
  }

  .ts-chat-send {
    width: 30px !important;
    height: 30px !important;
  }
}