.tc-chat-window {
  width: min(390px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 120px));
}

.tc-header {
  min-height: 72px;
}

.tc-body {
  overscroll-behavior: contain;
}

.tc-msg-bubble {
  overflow-wrap: anywhere;
}

.tc-footer {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.tc-input {
  min-height: 40px;
}

.tc-attach,
.tc-send,
.tc-minimize {
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 480px) {
  .tc-chat-widget {
    right: 12px !important;
    bottom: 12px !important;
  }

  .tc-chat-window {
    position: fixed;
    inset: 8px 8px 84px !important;
    width: auto !important;
    height: auto !important;
    max-height: none;
    border-radius: 16px;
    transform-origin: bottom center;
  }

  .tc-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tc-chip {
    flex: 0 0 auto;
  }

  .tc-msg {
    max-width: 92%;
  }
}

/* Mobile and tablet chat viewport hardening. */
.tc-chat-widget {
  z-index: 1200;
  right: max(16px, env(safe-area-inset-right)) !important;
  bottom: max(16px, env(safe-area-inset-bottom)) !important;
}

.tc-chat-window {
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 110px);
}

.tc-fab-menu {
  width: min(290px, calc(100vw - 24px));
}

.tc-input {
  font-size: 16px;
}

@media (min-width: 481px) and (max-width: 820px) {
  .tc-chat-window {
    width: min(430px, calc(100vw - 28px)) !important;
    height: min(640px, calc(100dvh - 118px)) !important;
    right: 0 !important;
  }
}

@media (max-width: 600px) {
  .tc-chat-window {
    position: fixed;
    inset: max(8px, env(safe-area-inset-top)) 8px calc(82px + env(safe-area-inset-bottom)) 8px !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
  }

  .tc-fab-menu {
    right: 0 !important;
    left: auto !important;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .tc-chat-window {
    position: fixed;
    inset: 8px 78px 8px 8px !important;
    width: auto !important;
    height: auto !important;
    max-height: none !important;
  }
}
/* Draggable support bubble: saved position is applied by chat-widget.js. */
.tc-chat-widget.tc-widget-positioned {
  left: var(--tc-widget-left) !important;
  top: var(--tc-widget-top) !important;
  right: auto !important;
  bottom: auto !important;
}

.tc-bubble {
  touch-action: none;
  user-select: none;
  animation: tc-bubble-pulse 2s infinite, tc-bubble-blink 1.8s ease-in-out infinite;
}

.tc-bubble.dragging {
  animation: none;
  opacity: 0.92;
  cursor: grabbing;
}

@keyframes tc-bubble-blink {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2) drop-shadow(0 0 12px rgba(96, 165, 250, 0.75)); }
}

@media (max-width: 600px) {
  .tc-chat-widget.tc-widget-positioned .tc-chat-window {
    position: fixed;
    inset: max(8px, env(safe-area-inset-top)) 8px calc(82px + env(safe-area-inset-bottom)) 8px !important;
  }
  .tc-chat-widget.tc-widget-positioned .tc-fab-menu {
    position: fixed;
    right: 12px !important;
    bottom: calc(84px + env(safe-area-inset-bottom)) !important;
  }
}
