.tqai-chat,
.tqai-chat * {
  box-sizing: border-box;
}

.tqai-chat [hidden] {
  display: none !important;
}

.tqai-chat {
  --tqai-accent: #6757e8;
  --tqai-accent-2: #1d8cf8;
  --tqai-ink: #151626;
  --tqai-muted: #6b6f82;
  --tqai-line: #e7e8ef;
  --tqai-soft: #f7f7fb;
  --tqai-soft-2: #f1f4ff;
  --tqai-danger: #c43d4e;
  width: min(100%, var(--tqai-max-width, 1120px));
  min-height: var(--tqai-min-height, 720px);
  margin: 24px auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--tqai-ink);
  background:
    radial-gradient(circle at 88% -5%, color-mix(in srgb, var(--tqai-accent-2) 13%, transparent), transparent 27%),
    radial-gradient(circle at 7% 1%, color-mix(in srgb, var(--tqai-accent) 12%, transparent), transparent 26%),
    #fff;
  border: 1px solid rgba(32, 35, 58, 0.12);
  border-radius: 26px;
  box-shadow: 0 24px 80px rgba(27, 28, 51, 0.12), 0 3px 14px rgba(27, 28, 51, 0.06);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  isolation: isolate;
}

.tqai-chat button,
.tqai-chat textarea {
  font: inherit;
}

.tqai-chat button {
  margin: 0;
  border: 0;
  cursor: pointer;
}

.tqai-chat button:focus-visible,
.tqai-chat textarea:focus-visible,
.tqai-chat a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--tqai-accent) 28%, transparent);
  outline-offset: 2px;
}

.tqai-chat__header {
  min-height: 84px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(31, 34, 55, 0.09);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 3;
}

.tqai-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.tqai-brand__mark {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--tqai-accent), var(--tqai-accent-2));
  border-radius: 16px;
  box-shadow: 0 10px 28px color-mix(in srgb, var(--tqai-accent) 28%, transparent);
}

.tqai-brand__mark svg {
  width: 37px;
  height: 37px;
}

.tqai-brand__copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tqai-brand__copy strong {
  color: var(--tqai-ink);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.tqai-brand__copy small {
  max-width: 580px;
  overflow: hidden;
  color: var(--tqai-muted);
  font-size: 12.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tqai-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.tqai-remaining {
  padding: 7px 10px;
  color: #4f5266;
  background: #f4f4f8;
  border: 1px solid #e7e7ee;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.tqai-remaining.is-low {
  color: #8c3b47;
  background: #fff1f3;
  border-color: #f4cdd3;
}

.tqai-icon-button {
  min-height: 42px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #3d4052;
  background: #fff;
  border: 1px solid #dedfe8 !important;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 680;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.tqai-icon-button:hover {
  color: var(--tqai-accent);
  border-color: color-mix(in srgb, var(--tqai-accent) 42%, #dedfe8) !important;
  box-shadow: 0 7px 18px rgba(32, 34, 58, 0.08);
  transform: translateY(-1px);
}

.tqai-icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.tqai-chat__main {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
}

.tqai-messages {
  width: 100%;
  min-height: 0;
  max-height: calc(var(--tqai-min-height, 720px) - 244px);
  padding: 34px clamp(20px, 5vw, 72px) 44px;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #c8cad5 transparent;
}

.tqai-messages::-webkit-scrollbar {
  width: 9px;
}

.tqai-messages::-webkit-scrollbar-thumb {
  background: #c8cad5;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.tqai-welcome {
  width: min(100%, 760px);
  margin: auto;
  padding: clamp(34px, 7vh, 72px) 0 30px;
  text-align: center;
}

.tqai-welcome__orb {
  width: 82px;
  height: 82px;
  margin: 0 auto 21px;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.48), transparent 26%),
    linear-gradient(145deg, var(--tqai-accent), var(--tqai-accent-2));
  border: 8px solid rgba(255, 255, 255, 0.88);
  border-radius: 28px;
  box-shadow: 0 18px 48px color-mix(in srgb, var(--tqai-accent) 30%, transparent), 0 0 0 1px rgba(44, 46, 70, 0.08);
  transform: rotate(-5deg);
}

.tqai-welcome__orb span {
  font-size: 35px;
  font-weight: 820;
  transform: rotate(5deg);
}

.tqai-welcome h2 {
  margin: 0;
  color: #171827;
  font-size: clamp(27px, 4vw, 40px);
  font-weight: 780;
  letter-spacing: -0.04em;
  line-height: 1.14;
}

.tqai-welcome > p {
  width: min(100%, 560px);
  margin: 13px auto 0;
  color: var(--tqai-muted);
  font-size: 15px;
}

.tqai-suggestions {
  margin-top: 30px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  text-align: start;
}

.tqai-suggestion {
  min-height: 88px;
  padding: 15px 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  color: #343647;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e4e5ed !important;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(30, 32, 52, 0.045);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.4;
  text-align: start;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease, color 170ms ease;
}

.tqai-suggestion:hover {
  color: var(--tqai-accent);
  border-color: color-mix(in srgb, var(--tqai-accent) 34%, #e4e5ed) !important;
  box-shadow: 0 13px 30px rgba(30, 32, 52, 0.09);
  transform: translateY(-2px);
}

.tqai-suggestion svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tqai-message {
  width: 100%;
  margin: 0 auto 25px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 260ms ease, transform 260ms ease;
}

.tqai-message.is-entering {
  opacity: 0;
  transform: translateY(8px);
}

.tqai-message--user {
  flex-direction: row-reverse;
}

.tqai-message__avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--tqai-accent), var(--tqai-accent-2));
  border-radius: 11px;
  box-shadow: 0 7px 18px color-mix(in srgb, var(--tqai-accent) 22%, transparent);
  font-size: 13px;
  font-weight: 800;
}

.tqai-message--user .tqai-message__avatar {
  color: #4d5062;
  background: #eceef4;
  box-shadow: none;
}

.tqai-message__card {
  max-width: min(82%, 790px);
  min-width: 0;
}

.tqai-message--user .tqai-message__card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.tqai-message__meta {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #777a8d;
  font-size: 11.5px;
}

.tqai-message__meta strong {
  color: #46495b;
  font-weight: 720;
}

.tqai-message__body {
  min-width: 44px;
  color: #262839;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.tqai-message--user .tqai-message__body {
  padding: 12px 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--tqai-accent), color-mix(in srgb, var(--tqai-accent) 64%, var(--tqai-accent-2)));
  border-radius: 17px 5px 17px 17px;
  box-shadow: 0 9px 25px color-mix(in srgb, var(--tqai-accent) 20%, transparent);
  white-space: pre-wrap;
}

.tqai-message__body > :first-child {
  margin-top: 0 !important;
}

.tqai-message__body > :last-child {
  margin-bottom: 0 !important;
}

.tqai-message__body p {
  margin: 0 0 12px;
}

.tqai-message__body h3,
.tqai-message__body h4,
.tqai-message__body h5,
.tqai-message__body h6 {
  margin: 21px 0 9px;
  color: #171827;
  font-weight: 760;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.tqai-message__body h3 { font-size: 20px; }
.tqai-message__body h4 { font-size: 17px; }
.tqai-message__body h5,
.tqai-message__body h6 { font-size: 15px; }

.tqai-message__body ul,
.tqai-message__body ol {
  margin: 8px 0 14px;
  padding-inline-start: 23px;
}

.tqai-message__body li {
  margin: 5px 0;
}

.tqai-message__body blockquote {
  margin: 14px 0;
  padding: 11px 14px;
  color: #505366;
  background: #f6f6fa;
  border-inline-start: 3px solid var(--tqai-accent);
  border-radius: 0 10px 10px 0;
}

.tqai-message__body hr {
  height: 1px;
  margin: 20px 0;
  background: #e3e4eb;
  border: 0;
}

.tqai-message__body a {
  color: var(--tqai-accent);
  font-weight: 620;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.tqai-message__body :not(pre) > code {
  padding: 2px 6px;
  color: #5a3fc5;
  background: #f0edff;
  border: 1px solid #e3ddff;
  border-radius: 6px;
  font: 0.9em/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tqai-message--user .tqai-message__body p,
.tqai-message--user .tqai-message__body ul,
.tqai-message--user .tqai-message__body ol {
  margin-block: 0;
}

.tqai-message__actions {
  min-height: 27px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tqai-message-action {
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #777a8c;
  background: transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 650;
  transition: color 150ms ease, background 150ms ease;
}

.tqai-message-action:hover,
.tqai-message-action.is-copied {
  color: var(--tqai-accent);
  background: #f1efff;
}

.tqai-message-action svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tqai-message__status {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12px;
}

.tqai-message__status.is-error {
  color: #9d3443;
  background: #fff1f3;
  border: 1px solid #f3ccd2;
}

.tqai-message__status.is-stopped {
  color: #5d6174;
  background: #f5f5f8;
  border: 1px solid #e3e4e9;
}

.tqai-typing {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tqai-typing i {
  width: 7px;
  height: 7px;
  display: block;
  background: color-mix(in srgb, var(--tqai-accent) 65%, #a6a8b8);
  border-radius: 50%;
  animation: tqai-pulse 1.15s ease-in-out infinite;
}

.tqai-typing i:nth-child(2) { animation-delay: 130ms; }
.tqai-typing i:nth-child(3) { animation-delay: 260ms; }

@keyframes tqai-pulse {
  0%, 70%, 100% { opacity: 0.38; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-4px); }
}

.tqai-code {
  margin: 14px 0;
  overflow: hidden;
  color: #e6e8f0;
  background: #171822;
  border: 1px solid #2a2c39;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(13, 14, 24, 0.16);
}

.tqai-code__header {
  min-height: 40px;
  padding: 7px 11px 7px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #aeb2c4;
  background: #20222d;
  border-bottom: 1px solid #2d3040;
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-transform: lowercase;
}

.tqai-code__header button {
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #c7cad7;
  background: transparent;
  border-radius: 7px;
  font: 11px/1.3 ui-sans-serif, system-ui, sans-serif;
}

.tqai-code__header button:hover,
.tqai-code__header button.is-copied {
  color: #fff;
  background: #303341;
}

.tqai-code__header svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.tqai-code pre {
  max-width: 100%;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: inherit;
  background: transparent;
  border: 0;
  white-space: pre;
}

.tqai-code code {
  color: inherit;
  background: transparent;
  border: 0;
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.tqai-verification {
  margin: 0 clamp(16px, 4vw, 48px) 12px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #3d4052;
  background: #f7f5ff;
  border: 1px solid #ded8ff;
  border-radius: 14px;
}

.tqai-verification > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tqai-verification strong {
  font-size: 13px;
}

.tqai-verification span {
  color: #727589;
  font-size: 11.5px;
}

.tqai-turnstile {
  min-width: 300px;
}

.tqai-composer {
  padding: 12px clamp(16px, 4vw, 48px) 10px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), #fff 22%);
}

.tqai-composer__box {
  position: relative;
  padding: 11px 11px 9px 15px;
  background: #fff;
  border: 1px solid #dfe0e8;
  border-radius: 18px;
  box-shadow: 0 11px 34px rgba(26, 28, 48, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 170ms ease, box-shadow 170ms ease;
}

.tqai-composer__box:focus-within {
  border-color: color-mix(in srgb, var(--tqai-accent) 55%, #dfe0e8);
  box-shadow: 0 13px 38px rgba(26, 28, 48, 0.11), 0 0 0 4px color-mix(in srgb, var(--tqai-accent) 9%, transparent);
}

.tqai-composer textarea {
  width: 100%;
  min-height: 31px;
  max-height: 190px;
  margin: 0;
  padding: 2px 4px 7px 0;
  resize: none;
  overflow-y: auto;
  color: #222433;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 15px;
  line-height: 1.55;
}

.tqai-composer textarea::placeholder {
  color: #9a9cac;
}

.tqai-composer textarea:focus {
  outline: 0;
  box-shadow: none;
}

.tqai-composer textarea:disabled {
  opacity: 0.7;
  cursor: wait;
}

.tqai-composer__footer {
  min-height: 39px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.tqai-char-count {
  padding: 0 3px 4px;
  color: #9699aa;
  font-size: 10.5px;
}

.tqai-char-count.is-near-limit {
  color: var(--tqai-danger);
  font-weight: 700;
}

.tqai-composer__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tqai-send,
.tqai-stop {
  min-height: 39px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 720;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.tqai-send {
  color: #fff;
  background: linear-gradient(135deg, var(--tqai-accent), var(--tqai-accent-2));
  box-shadow: 0 8px 20px color-mix(in srgb, var(--tqai-accent) 24%, transparent);
}

.tqai-send:hover:not(:disabled) {
  box-shadow: 0 11px 25px color-mix(in srgb, var(--tqai-accent) 32%, transparent);
  transform: translateY(-1px);
}

.tqai-send:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.tqai-send svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tqai-stop {
  color: #5c5f71;
  background: #f1f2f6;
  border: 1px solid #e2e3e9 !important;
}

.tqai-stop:hover {
  color: #303243;
  background: #e8e9ef;
}

.tqai-stop__square {
  width: 9px;
  height: 9px;
  background: currentColor;
  border-radius: 2px;
}

.tqai-chat__privacy {
  padding: 0 clamp(18px, 4vw, 50px) 15px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  color: #858899;
  font-size: 10.5px;
  line-height: 1.45;
  text-align: center;
}

.tqai-chat__privacy svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tqai-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tqai-unavailable {
  padding: 16px;
  color: #70520d;
  background: #fff8e6;
  border: 1px solid #f0dda6;
  border-radius: 10px;
}

@media (max-width: 820px) {
  .tqai-chat {
    min-height: min(var(--tqai-min-height, 720px), 82vh);
    margin: 14px auto;
    border-radius: 20px;
  }

  .tqai-chat__header {
    min-height: 74px;
    padding: 12px 14px;
  }

  .tqai-brand__mark {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 14px;
  }

  .tqai-brand__mark svg {
    width: 33px;
    height: 33px;
  }

  .tqai-brand__copy small,
  .tqai-remaining {
    display: none;
  }

  .tqai-icon-button span {
    display: none;
  }

  .tqai-icon-button {
    width: 41px;
    padding: 9px;
  }

  .tqai-messages {
    max-height: calc(min(var(--tqai-min-height, 720px), 82vh) - 220px);
    padding: 25px 15px 34px;
  }

  .tqai-welcome {
    padding-top: 34px;
  }

  .tqai-suggestions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tqai-suggestion {
    min-height: 64px;
  }

  .tqai-message__card {
    max-width: calc(100% - 42px);
  }

  .tqai-verification {
    margin-inline: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .tqai-turnstile {
    min-width: 0;
    width: 100%;
  }

  .tqai-composer {
    padding: 9px 11px 8px;
  }

  .tqai-chat__privacy {
    padding-inline: 14px;
  }
}

@media (max-width: 480px) {
  .tqai-chat {
    min-height: 78vh;
    border-radius: 16px;
  }

  .tqai-welcome__orb {
    width: 70px;
    height: 70px;
    border-radius: 23px;
  }

  .tqai-welcome h2 {
    font-size: 28px;
  }

  .tqai-message__avatar {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
    border-radius: 9px;
  }

  .tqai-message {
    gap: 8px;
  }

  .tqai-message__body {
    font-size: 14px;
  }

  .tqai-send span,
  .tqai-stop:not(:hover) {
    font-size: 0;
  }

  .tqai-send,
  .tqai-stop {
    min-width: 39px;
    padding: 9px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tqai-chat *,
  .tqai-chat *::before,
  .tqai-chat *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
