/* 1. Cobp frame */
.container-ia-chat {
  --ia-size: 300px;
  --u: calc(var(--ia-size) / 300);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: end;
  width: var(--ia-size);
}

.container-upload-files {
  position: absolute;
  left: -8px;
  display: flex;
  color: #aaaaaa;
  transition:
    opacity 0.5s,
    visibility 0.5s,
    filter 0.5s;
}

.container-upload-files .upload-file {
  margin: calc(5 * var(--u));
  padding: calc(2 * var(--u));
  width: calc(24 * var(--u));
  height: calc(24 * var(--u));
  cursor: pointer;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* SVG rotates around its own box, not the top-left corner. */
  transform-box: fill-box;
  transform-origin: center;
  transition: color 0.28s ease;
}

/* Folder stroke sits near viewBox edges — keep room so sides don’t clip. */
.container-upload-files .upload-file--docs {
  overflow: visible;
}

.container-upload-files .upload-file:hover,
.container-upload-files .upload-file:focus-visible {
  color: #f2f2f2;
  background: transparent;
  outline: none;
}

.container-upload-files .upload-file:active {
  background: transparent;
}

/* Active: soft blue web, red analysis — no square flash behind. */
.container-upload-files .upload-file--web.is-active {
  color: #5b9dff;
}

.container-upload-files .upload-file--web.is-active:hover,
.container-upload-files .upload-file--web.is-active:focus-visible {
  color: #7eb4ff;
  background: transparent;
}

.container-upload-files .upload-file--web.is-active:active {
  color: #7eb4ff;
  background: transparent;
}

/* Idle = same #aaaaaa as siblings. On = brighter red (wins sticky :hover). */
.container-upload-files .upload-file--analysis.is-active,
.container-upload-files .upload-file--analysis.is-active:hover,
.container-upload-files .upload-file--analysis.is-active:focus,
.container-upload-files .upload-file--analysis.is-active:focus-visible,
.container-upload-files .upload-file--analysis.is-active:active {
  color: #ff5252;
  background: transparent;
}

.container-upload-files .upload-file--docs:active {
  color: #f2f2f2;
}

/* Pure rotation. Scale in the same transform made the spin hitch. */
@keyframes console-web-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes console-analysis-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.88);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes console-docs-nudge {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

.container-upload-files .upload-file--web.is-press-anim {
  animation: console-web-spin 0.22s linear;
}

/* Plus menu: same window as the voice orb, grown from the left. */
.chat-tools-sheet {
  position: absolute;
  z-index: 1004;
  left: 0;
  top: 50%;
  width: calc(40 * var(--u));
  height: calc(40 * var(--u));
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: calc(50 * var(--u));
  background: #3a3a3a;
  color: #f2f2f2;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%);
  transition:
    width 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    height 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    top 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    border-radius 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    transform 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    opacity 0.28s ease,
    visibility 0s linear 0.52s,
    box-shadow 0.4s ease;
}

.container-ia-chat.is-tools-open .chat-tools-sheet {
  top: 100%;
  width: var(--ia-size);
  /* Empty docs: shorter shell. Grows when doc slots are present. */
  height: calc(var(--ia-size) + 36px);
  border-radius: calc(48 * var(--u));
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-100%);
  box-shadow:
    0 calc(10 * var(--u)) calc(40 * var(--u)) rgba(0, 0, 0, 0.45),
    inset 0 0 calc(10 * var(--u)) rgba(255, 255, 255, 0.06);
  transition:
    width 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    height 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    top 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    border-radius 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    transform 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    opacity 0.28s ease,
    visibility 0s linear 0s,
    box-shadow 0.4s ease;
}

.container-ia-chat.is-tools-open .chat-tools-sheet:has(.chat-tools-sheet__doc-slot) {
  height: calc(var(--ia-size) + 120px);
}

.chat-tools-sheet__head,
.chat-tools-sheet__body {
  opacity: 0;
  transition: opacity 0.28s ease 0.12s;
}

.container-ia-chat.is-tools-open .chat-tools-sheet__head,
.container-ia-chat.is-tools-open .chat-tools-sheet__body {
  opacity: 1;
}

body:not(.is-mobile) .chat-tools-sheet {
  display: none !important;
}

.chat-tools-sheet__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  box-sizing: border-box;
  /* Narrow only the title band — sheet silhouette stays full-width. */
  width: calc(100% - 112px);
  max-width: calc(100% - 112px);
  min-height: 34px;
  margin: 14px auto 0;
  padding: 0 0 10px;
  overflow: hidden;
  /* Default: no edge mask (short titles stay crisp). */
  -webkit-mask-image: none;
  mask-image: none;
}

.chat-tools-sheet__head:has(.chat-tools-sheet__chat-title.is-marquee) {
  justify-content: flex-start;
  /* Wider side fades — title rides deeper into L/R edges. */
  -webkit-mask-image: linear-gradient(
    90deg,
    #0000 0,
    #000 40px,
    #000 calc(100% - 40px),
    #0000 100%
  );
  mask-image: linear-gradient(
    90deg,
    #0000 0,
    #000 40px,
    #000 calc(100% - 40px),
    #0000 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

.chat-tools-sheet__chat-title {
  position: relative;
  z-index: 0;
  margin: 0;
  display: inline-block;
  width: max-content;
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.9);
}

.chat-tools-sheet__chat-title.is-marquee {
  animation: chat-tools-title-marquee var(--tools-title-dur, 4.8s) ease-in-out infinite alternate;
}

/* Overshoot both edges: start inset right, end past left fade. */
@keyframes chat-tools-title-marquee {
  from {
    transform: translateX(var(--tools-title-edge, 36px));
  }
  to {
    transform: translateX(
      calc(var(--tools-title-edge, 36px) - var(--tools-title-shift, 0px))
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-tools-sheet__chat-title.is-marquee {
    animation: none;
  }
}

.chat-tools-sheet__body {
  display: flex;
  flex-direction: column;
  gap: 22px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 16px 22px;
}

.chat-tools-sheet__section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-tools-sheet__label {
  margin: 0 2px 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.94);
}

.chat-tools-sheet__meta {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: 48px;
  padding: 0 16px;
  border-radius: calc(48 * var(--u));
  background: rgba(255, 255, 255, 0.05);
}

.chat-tools-sheet__meta-val {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.82);
  text-align: center;
}

.chat-tools-sheet__docs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 128px;
  overflow-y: auto;
}

.chat-tools-sheet__doc-slot {
  display: grid;
  grid-template-rows: 1fr;
  margin: 0 0 5px;
  opacity: 1;
  transition:
    grid-template-rows 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    margin-bottom 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}

.chat-tools-sheet__doc-slot:last-child {
  margin-bottom: 0;
}

.chat-tools-sheet__doc-slot.is-busy {
  pointer-events: none;
}

.chat-tools-sheet__doc-slot.is-leaving {
  grid-template-rows: 0fr;
  margin-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

/* Last doc → empty: fade in place, keep the row height (no collapse snap). */
.chat-tools-sheet__doc-slot.is-morph-out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-tools-sheet__doc-slot-clip {
  min-height: 0;
  overflow: hidden;
}

.chat-tools-sheet__doc {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  height: 48px;
  padding: 0 8px 0 16px;
  border-radius: calc(48 * var(--u));
  background: rgba(255, 255, 255, 0.05);
}

.chat-tools-sheet__doc-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.88);
}

.chat-tools-sheet__doc-delete {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.chat-tools-sheet__doc-delete svg {
  display: block;
}

.chat-tools-sheet__doc-delete:active {
  color: rgba(255, 170, 170, 0.95);
}

.chat-tools-sheet__doc-delete:disabled {
  opacity: 0.45;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .chat-tools-sheet__doc-slot {
    transition: none;
  }
}

.chat-tools-sheet__empty {
  box-sizing: border-box;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: 48px;
  padding: 0 16px;
  border-radius: calc(48 * var(--u));
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-tools-sheet__empty.is-enter {
  opacity: 0;
  transform: translate3d(0, 5px, 0);
  transition: none;
}

.chat-tools-sheet__empty.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  .chat-tools-sheet__doc-slot.is-morph-out,
  .chat-tools-sheet__empty,
  .chat-tools-sheet__empty.is-enter,
  .chat-tools-sheet__empty.is-in {
    transition: none;
    transform: none;
  }
}

.chat-tools-sheet__row {
  box-sizing: border-box;
  appearance: none;
  border: 0;
  border-radius: calc(48 * var(--u));
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  min-height: 48px;
  height: 48px;
  padding: 0 12px;
  text-align: center;
  font: inherit;
  font-size: 15px;
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.chat-tools-sheet__row--action {
  text-align: center;
  color: rgba(210, 224, 255, 0.92);
  background: rgba(122, 167, 232, 0.14);
}

.chat-tools-sheet__row[aria-pressed="true"] {
  background: rgba(122, 167, 232, 0.22);
  color: #d6e6ff;
}

.chat-tools-sheet__row--danger {
  color: #ffffff;
  background: #e23b3b;
}

.chat-tools-sheet__row--danger:active {
  background: #e23b3b;
  filter: brightness(0.94);
}

.container-upload-files .upload-file--analysis.is-press-anim {
  animation: console-analysis-pop 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

.container-upload-files .upload-file--docs.is-press-anim {
  animation: console-docs-nudge 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.input-text {
  max-width: calc(200 * var(--u));
  width: 100%;
  margin-left: calc(72 * var(--u));
  box-sizing: border-box;
  height: calc(42 * var(--u));
  min-height: calc(42 * var(--u));
  max-height: calc(114 * var(--u));
  padding: calc(12 * var(--u)) calc(16 * var(--u));
  padding-right: calc(46 * var(--u));
  /* 21u is the one-line cap. A larger radius would swell once the field is taller. */
  border-radius: calc(21 * var(--u));
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: calc(14 * var(--u));
  line-height: calc(18 * var(--u));
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 500;
  /* Radius stays out of this list: the upload rise must not morph the corners. */
  transition:
    height 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    max-width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    margin-left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05);
  z-index: 999;
}

.container-ia-chat.is-multiline .input-text.is-max {
  overflow-y: auto;
}

.input-text::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Keep the mic, send, and plus on the bottom line while the field rises. */
.container-ia-chat.is-multiline:not(:has(.input-voice:checked)) .label-voice,
.container-ia-chat.is-multiline:not(:has(.input-voice:checked)) .label-text,
.container-ia-chat.is-multiline .label-files,
.container-ia-chat.is-multiline .container-upload-files {
  top: calc(100% - 21 * var(--u));
}

.input-text:focus-within,
.input-text:valid {
  max-width: calc(250 * var(--u));
  margin-left: calc(42 * var(--u));
}

.input-text:focus-within ~ .container-upload-files,
.input-text:valid ~ .container-upload-files {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  filter: blur(calc(5 * var(--u)));
}

.input-text:focus-within ~ .label-files,
.input-text:valid ~ .label-files {
  transform: translateX(0) translateY(-50%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transition:
    transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    visibility 0s;
}

.input-text:valid ~ .label-text {
  transform: translateX(0) translateY(-50%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.input-text:valid ~ .label-voice {
  transform: translateX(0) translateY(-50%) scale(0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Keep the wide field after the plus window closes, if it was opened from that state. */
.container-ia-chat.is-field-held:not(.is-tools-open):not(:has(.input-voice:checked)) .input-text {
  max-width: calc(250 * var(--u));
  margin-left: calc(42 * var(--u));
}

.container-ia-chat.is-field-held:not(.is-tools-open):not(:has(.input-voice:checked)) .container-upload-files {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  filter: blur(calc(5 * var(--u)));
}

.container-ia-chat.is-field-held:not(.is-tools-open):not(:has(.input-voice:checked)) .label-files {
  transform: translateX(0) translateY(-50%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.container-ia-chat.is-field-held:not(.is-tools-open):not(:has(.input-voice:checked)) .ia-chat-ph,
.container-ia-chat.is-field-held:not(.is-tools-open):not(:has(.input-voice:checked)) .ia-upload-status {
  width: calc(250 * var(--u));
}

.input-voice,
.input-files {
  display: none;
}

.container-ia-chat .input-voice:checked ~ .input-text,
.container-ia-chat .input-voice:checked ~ .ia-chat-ph,
.container-ia-chat .input-voice:checked ~ .ia-upload-status,
.container-ia-chat .input-voice:checked ~ .label-files,
.container-ia-chat .input-voice:checked ~ .label-text,
.container-ia-chat .input-voice:checked ~ .container-upload-files {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.22s;
}

.container-ia-chat.is-voice-hold .input-voice:checked ~ .input-text {
  max-width: calc(250 * var(--u));
  margin-left: calc(42 * var(--u));
}

.container-ia-chat.is-voice-hold .input-voice:checked ~ .label-files {
  transform: translateX(0) translateY(-50%) scale(1);
}

.container-ia-chat.is-voice-hold .input-voice:checked ~ .ia-chat-ph,
.container-ia-chat.is-voice-hold .input-voice:checked ~ .ia-upload-status {
  width: calc(250 * var(--u));
}

.label-files {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateX(calc(-20 * var(--u))) translateY(-50%) scale(1);
  display: flex;
  padding: calc(8 * var(--u));
  color: #f2f2f2;
  border-radius: calc(50 * var(--u));
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.label-files svg {
  width: calc(24 * var(--u));
  height: calc(24 * var(--u));
}

.label-files:focus-visible,
.label-files:hover {
  color: #ffffff;
}

.label-voice,
.label-text {
  position: absolute;
  top: 50%;
  right: calc(4 * var(--u));
  transform: translateX(0) translateY(-50%) scale(1);
  width: calc(36 * var(--u));
  height: calc(36 * var(--u));
  display: flex;
  padding: calc(6 * var(--u));
  border: none;
  outline: none;
  cursor: pointer;
  z-index: 999;
}

.label-text {
  transition:
    opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    visibility 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05);
}

.label-voice svg,
.label-text svg {
  width: calc(24 * var(--u));
  height: calc(24 * var(--u));
}

.input-voice:checked ~ .label-voice {
  right: 0;
  width: var(--ia-size);
  height: var(--ia-size);
  border-radius: calc(48 * var(--u));
}

.input-voice:checked ~ .label-voice .icon-voice {
  opacity: 0;
}

.input-voice:checked ~ .label-voice .text-voice p {
  opacity: 1;
}

.label-voice {
  color: #959595;
  overflow: hidden;
}

.label-voice:hover,
.label-voice:focus-visible {
  color: #f2f2f2;
}

.label-voice:active svg {
  scale: 1.1;
}

.label-voice .icon-voice {
  position: absolute;
  transition: opacity 0.3s ease;
}

.label-voice .text-voice {
  position: absolute;
  inset: calc(20 * var(--u));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: calc(8 * var(--u));
  overflow: hidden;
  z-index: 2;
}

.label-voice .text-voice p {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100% - 52 * var(--u));
  margin: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: normal;
  text-align: center;
  max-width: 86%;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.ai {
  --z: 0;
  --s: var(--ia-size);
  --p: calc(var(--s) / 4);
  --orb-level: 1;
  width: var(--s);
  aspect-ratio: 1;
  padding: var(--p);
  display: grid;
  place-items: center;
  position: relative;
  scale: var(--orb-level);
  transform-origin: center center;
  animation: circle1 5s ease-in-out infinite;
  will-change: auto;
}

.input-voice:checked ~ .label-voice .ai {
  will-change: scale;
}

@keyframes ai1 {
  0% {
    transform: rotate(0deg) translate(50%) scale(0.9);
    opacity: 0;
  }

  25% {
    transform: rotate(90deg) translate(50%) scale(1.8);
    opacity: 1;
  }

  50% {
    transform: rotate(180deg) translate(50%) scale(0.7);
    opacity: 0.4;
  }

  75% {
    transform: rotate(270deg) translate(50%) scale(1.2);
    opacity: 1;
  }

  100% {
    transform: rotate(360deg) translate(50%) scale(0.9);
    opacity: 0;
  }
}

@keyframes ai2 {
  0% {
    transform: rotate(90deg) translate(50%) scale(0.5);
  }

  25% {
    transform: rotate(180deg) translate(50%) scale(1.7);
    opacity: 0;
  }

  50% {
    transform: rotate(270deg) translate(50%) scale(1);
    opacity: 0;
  }

  75% {
    transform: rotate(360deg) translate(50%) scale(0.8);
    opacity: 0;
  }

  100% {
    transform: rotate(450deg) translate(50%) scale(0.5);
    opacity: 1;
  }
}

@keyframes ai3 {
  0% {
    transform: rotate(180deg) translate(50%) scale(0.8);
    opacity: 0.8;
  }

  25% {
    transform: rotate(270deg) translate(50%) scale(1.5);
  }

  50% {
    transform: rotate(360deg) translate(50%) scale(0.6);
    opacity: 0.4;
  }

  75% {
    transform: rotate(450deg) translate(50%) scale(1.3);
    opacity: 0.7;
  }

  100% {
    transform: rotate(540deg) translate(50%) scale(0.8);
    opacity: 0.8;
  }
}

@keyframes ai4 {
  0% {
    transform: rotate(270deg) translate(50%) scale(1);
    opacity: 1;
  }

  25% {
    transform: rotate(360deg) translate(50%) scale(0.7);
  }

  50% {
    transform: rotate(450deg) translate(50%) scale(1.6);
    opacity: 0.5;
  }

  75% {
    transform: rotate(540deg) translate(50%) scale(0.9);
    opacity: 0.8;
  }

  100% {
    transform: rotate(630deg) translate(50%) scale(1);
    opacity: 1;
  }
}

.c {
  position: absolute;
  width: var(--ia-size);
  aspect-ratio: 1;
  border-radius: 50%;
}

.c1 {
  background: radial-gradient(50% 50% at center, #f2c4ff, #b7f0ff);
  width: calc(200 * var(--u));
  animation: ai1 5.5s linear infinite;
}

.c2 {
  background: radial-gradient(50% 50% at center, #ffb0c4, #ffffff);
  width: calc(100 * var(--u));
  animation: ai2 6s linear infinite;
}

.c3 {
  background: radial-gradient(50% 50% at center, #ffb6ea, transparent);
  width: calc(150 * var(--u));
  opacity: 1;
  animation: ai3 4.8s linear infinite;
}

.c4 {
  background: #b7b0ff;
  animation: ai4 5.2s linear infinite;
}

.ai .container {
  overflow: hidden;
  background: #efe7ff;
  width: 100%;
  border-radius: 50%;
  aspect-ratio: 1;
  position: relative;
  display: grid;
  place-items: center;
}

.glass {
  overflow: hidden;
  position: absolute;
  inset: calc(var(--p) - (4 * var(--u)));
  border-radius: 50%;
  backdrop-filter: blur(calc(8 * var(--u)));
  box-shadow: inset 0 0 calc(24 * var(--u)) rgba(255, 255, 255, 0.55);
  background: radial-gradient(
    calc(80 * var(--u)) at 68% 28%,
    rgba(255, 255, 255, 0.82),
    transparent 70%
  );
}

@keyframes circle1 {
  0% {
    transform: scale(0.97);
  }

  15% {
    transform: scale(1);
  }

  30% {
    transform: scale(0.98);
  }

  45% {
    transform: scale(1);
  }

  60% {
    transform: scale(0.97);
  }

  85% {
    transform: scale(1);
  }

  100% {
    transform: scale(0.97);
  }
}

/* 2. Our patches: field, plus, orb, send, gradient */

.container-upload-files {
  z-index: 1000;
}

.label-voice,
.label-text {
  z-index: 1001;
}

.input-text {
  background-color: #3a3a3a;
  color: #f2f2f2;
  caret-color: #f2f2f2;
}

.input-text::placeholder {
  color: transparent;
}

.input-text::selection {
  background-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.ia-chat-ph {
  --composer-ph-ms: 380ms;
  --composer-ease: cubic-bezier(0.22, 1, 0.36, 1);
  position: absolute;
  top: 0;
  bottom: 0;
  left: auto;
  right: 0;
  width: calc(200 * var(--u));
  display: block;
  padding: 0 calc(16 * var(--u));
  padding-right: calc(46 * var(--u));
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: none;
  z-index: 1000;
  color: rgba(255, 255, 255, 0.45);
  font-size: calc(14 * var(--u));
  line-height: calc(18 * var(--u));
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 500;
  white-space: nowrap;
  transition:
    width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    opacity 0.24s ease,
    visibility 0.24s ease;
}

/* Same vertical roll as desktop .composer-ph */
.ia-chat-ph .composer-ph__line {
  position: absolute;
  left: calc(16 * var(--u));
  right: calc(46 * var(--u));
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  max-width: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition:
    transform var(--composer-ph-ms) var(--composer-ease),
    opacity var(--composer-ph-ms) var(--composer-ease);
}

.ia-chat-ph .composer-ph__line.is-current {
  transform: translateY(0);
  opacity: 1;
}

.ia-chat-ph .composer-ph__line.is-enter {
  transform: translateY(100%);
  opacity: 0;
}

.ia-chat-ph .composer-ph__line.is-exit {
  transform: translateY(-100%);
  opacity: 0;
}

.ia-chat-ph .composer-ph__dots {
  display: inline-flex;
  align-items: flex-end;
  margin-left: calc(0.06em + 2px);
  letter-spacing: 0;
  vertical-align: baseline;
  gap: 0.1em;
  flex-shrink: 0;
  color: inherit;
  /* Drop to the word baseline, like «вот так...» */
  transform: translateY(calc(0.4em - 1px));
}

.ia-chat-ph .composer-ph__dot {
  position: relative;
  display: inline-block;
  width: 0.16em;
  height: 0.16em;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  font-size: inherit;
  line-height: 1;
  overflow: visible;
  opacity: 0;
  vertical-align: baseline;
  animation: composer-ph-dot 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: opacity;
}

.ia-chat-ph .composer-ph__dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.14em;
  height: 0.14em;
  border-radius: 50%;
  background-color: currentColor;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.ia-chat-ph .composer-ph__dot:nth-child(1) {
  animation-delay: 0s;
}

.ia-chat-ph .composer-ph__dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ia-chat-ph .composer-ph__dot:nth-child(3) {
  animation-delay: 0.4s;
}

.input-text:focus-within ~ .ia-chat-ph,
.input-text:valid ~ .ia-chat-ph {
  width: calc(250 * var(--u));
  opacity: 0;
  visibility: hidden;
}

.input-text:focus-within ~ .ia-chat-ph .composer-ph__dot,
.input-text:valid ~ .ia-chat-ph .composer-ph__dot,
.container-ia-chat.is-field-held .ia-chat-ph .composer-ph__dot {
  animation-play-state: paused;
}

.label-files {
  background-color: #3a3a3a;
  transition:
    transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05),
    opacity 0s,
    visibility 0s;
}

/* Hide in place. Later than the focus rules so width and the plus do not slide. */
.container-ia-chat.is-tools-open .input-text {
  max-width: calc(250 * var(--u));
  margin-left: calc(42 * var(--u));
}

.container-ia-chat.is-tools-open .ia-chat-ph,
.container-ia-chat.is-tools-open .ia-upload-status {
  width: calc(250 * var(--u));
}

.container-ia-chat.is-tools-open .label-files {
  transform: translateX(0) translateY(-50%) scale(1);
}

.container-ia-chat.is-tools-open .input-text,
.container-ia-chat.is-tools-open .ia-chat-ph,
.container-ia-chat.is-tools-open .ia-upload-status,
.container-ia-chat.is-tools-open .label-files,
.container-ia-chat.is-tools-open .label-text,
.container-ia-chat.is-tools-open .label-voice,
.container-ia-chat.is-tools-open .container-upload-files {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  filter: none;
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.22s;
}

.label-voice {
  transition:
    width 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    height 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    transform 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    top 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    right 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    border-radius 0.52s cubic-bezier(0.175, 0.885, 0.32, 1),
    background-color 0.4s ease,
    box-shadow 0.4s ease,
    padding 0.52s cubic-bezier(0.175, 0.885, 0.32, 1);
}

/* Send closes the orb in one ease-out, without the open overshoot. */
.container-ia-chat.is-orb-closing .label-voice {
  transition:
    width 0.3s cubic-bezier(0.33, 0, 0.2, 1),
    height 0.3s cubic-bezier(0.33, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.33, 0, 0.2, 1),
    top 0.3s cubic-bezier(0.33, 0, 0.2, 1),
    right 0.3s cubic-bezier(0.33, 0, 0.2, 1),
    border-radius 0.3s cubic-bezier(0.33, 0, 0.2, 1),
    background-color 0.24s ease,
    box-shadow 0.24s ease,
    padding 0.3s cubic-bezier(0.33, 0, 0.2, 1);
}

.container-ia-chat.is-orb-closing .input-voice:not(:checked) ~ .label-voice .ai {
  display: grid;
}

.input-voice:checked ~ .label-voice {
  background-color: #3a3a3a;
  top: 100%;
  transform: translateX(0) translateY(-100%);
  box-shadow:
    0 calc(10 * var(--u)) calc(40 * var(--u)) rgba(0, 0, 0, 0.45),
    inset 0 0 calc(10 * var(--u)) rgba(255, 255, 255, 0.06);
}

.input-voice:not(:checked) ~ .label-voice .ai {
  display: none;
}

.label-voice .text-voice p:first-child {
  margin-top: calc(6 * var(--u));
  font-size: calc(20 * var(--u));
  font-weight: 500;
  color: transparent;
}

.label-voice .text-voice p:first-child .orb-title__base {
  color: transparent;
  background-image: linear-gradient(
    90deg,
    rgba(150, 156, 168, 0.55) 0%,
    rgba(150, 156, 168, 0.55) 28%,
    rgba(200, 206, 216, 0.85) 40%,
    rgba(236, 240, 246, 0.98) 50%,
    rgba(200, 206, 216, 0.85) 60%,
    rgba(150, 156, 168, 0.55) 72%,
    rgba(150, 156, 168, 0.55) 100%
  );
  background-size: 200% 100%;
  background-repeat: repeat-x;
  background-position: 0% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: orb-text-shimmer 2.1s linear infinite;
}

.label-voice .text-voice p:first-child .orb-title__dots {
  display: inline-flex;
  align-items: center;
  margin-left: 0.14em;
  letter-spacing: 0;
  vertical-align: baseline;
  gap: 0.2em;
}

.label-voice .text-voice p:first-child .orb-title__dot {
  position: relative;
  display: inline-block;
  width: 0.3em;
  height: 0.3em;
  margin: 0;
  padding: 0;
  border: 0;
  line-height: 1;
  overflow: visible;
  color: transparent;
  -webkit-text-fill-color: transparent;
  vertical-align: middle;
  opacity: 0;
  animation: orb-title-dot 2.1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.label-voice .text-voice p:first-child .orb-title__dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.28em;
  height: 0.28em;
  border-radius: 50%;
  background-image: linear-gradient(
    90deg,
    rgba(150, 156, 168, 0.55) 0%,
    rgba(150, 156, 168, 0.55) 28%,
    rgba(200, 206, 216, 0.85) 40%,
    rgba(236, 240, 246, 0.98) 50%,
    rgba(200, 206, 216, 0.85) 60%,
    rgba(150, 156, 168, 0.55) 72%,
    rgba(150, 156, 168, 0.55) 100%
  );
  background-size: 200% 100%;
  background-repeat: repeat-x;
  background-position: 0% 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: orb-text-shimmer 2.1s linear infinite;
}

.label-voice .text-voice p:first-child .orb-title__dot:nth-child(1) {
  animation-delay: 0s, 0s;
}

.label-voice .text-voice p:first-child .orb-title__dot:nth-child(2) {
  animation-delay: 0s, 0.14s;
}

.label-voice .text-voice p:first-child .orb-title__dot:nth-child(3) {
  animation-delay: 0s, 0.28s;
}

@keyframes orb-text-shimmer {
  from {
    background-position: 0% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* Dots rise near the end of the shimmer pass, then hold a beat. */
@keyframes orb-title-dot {
  0%,
  72% {
    opacity: 0;
  }
  80%,
  92% {
    opacity: 0.9;
  }
  98%,
  100% {
    opacity: 0;
  }
}

.voice-exit-hint {
  position: absolute;
  left: 50%;
  top: calc(100% - var(--ia-size));
  z-index: 1003;
  transform: translate(-50%, calc(-100% - 8px));
  margin: 0;
  max-width: calc(220 * var(--u));
  padding: calc(5 * var(--u)) calc(11 * var(--u));
  border-radius: calc(48 * var(--u));
  background: #4a4a4a;
  color: #dcdcdc;
  font-size: calc(12 * var(--u));
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

.input-voice:checked ~ .voice-exit-hint {
  visibility: visible;
  animation: voice-exit-hint 4.4s linear 1.7s both;
}

@keyframes voice-exit-hint {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 16px));
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 8px));
    animation-timing-function: linear;
  }
  82% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 8px));
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 4px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .input-voice:checked ~ .voice-exit-hint {
    animation: none;
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, calc(-100% - 8px));
  }
}

.label-voice .voice-up {
  flex: 0 0 auto;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(156 * var(--u));
  height: calc(44 * var(--u));
  border: 0;
  border-radius: calc(48 * var(--u));
  background: #4a4a4a;
  color: #f2f2f2;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.input-voice:checked ~ .label-voice .voice-up {
  opacity: 1;
  pointer-events: auto;
}

.label-voice .voice-up svg {
  width: calc(18 * var(--u));
  height: calc(18 * var(--u));
}

.label-text {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) scale(0.25);
  color: #f2f2f2;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 50%;
  overflow: visible;
  -webkit-tap-highlight-color: transparent;
}

.label-text svg {
  position: relative;
  z-index: 1;
}

.label-text::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  background: #4a4a4a;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition:
    transform 0.32s cubic-bezier(0.175, 0.885, 0.32, 1),
    opacity 0.2s ease;
}

.label-text:hover,
.label-text:focus-visible {
  transform-origin: top center;
  background: transparent;
  box-shadow: none;
}

.label-text:active::before {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.ai::before,
.ai::after {
  content: none;
  display: none;
  animation: none;
}

.rings {
  display: none;
}

body.is-mobile .composer::before {
  background: linear-gradient(
    to top,
    var(--sw-bg-main, #191919) 0%,
    rgba(25, 25, 25, 0.97) 16%,
    rgba(25, 25, 25, 0.82) 38%,
    rgba(25, 25, 25, 0.48) 64%,
    rgba(25, 25, 25, 0.16) 84%,
    rgba(25, 25, 25, 0) 100%
  );
}

.container-ia-chat .input-text {
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
}

.container-ia-chat .input-text:focus {
  box-shadow: none;
  border: none;
}

.container-ia-chat .input-voice,
.container-ia-chat .input-files {
  display: none;
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  position: absolute;
}

.container-ia-chat label {
  margin-bottom: 0;
}

/* 3. Mobile layout */
/* Boundary. Mobile paints .container-ia-chat. Desktop paints .composer-card.
   Shared nodes stay in the page: #message-input, #send-btn, attach sheet, voice stage. */
body:not(.is-mobile) .container-ia-chat {
  display: none !important;
}

body.is-mobile .composer > .composer-card,
body.is-mobile .composer > .composer-mode-hint {
  display: none !important;
}

body.is-mobile #composer-ph {
  display: none !important;
}

body.is-mobile .composer-card.is-attach-open {
  display: flex !important;
  flex-direction: column;
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: calc(100% - 8px);
  z-index: 4;
  width: auto;
  margin: 0;
  padding: 0;
  background: #2a2a2a;
  border-radius: 16px;
  pointer-events: auto;
  overflow: hidden;
}

body.is-mobile .composer-card.is-attach-open > :not(.composer-attach-sheet):not(.composer-upload-banner) {
  display: none !important;
}

/* Legacy upload banner stays off on mobile. */
body.is-mobile .composer-upload-banner {
  display: none !important;
}

/* One pill. Height grows and shrinks; the cap radius never changes on its own. */
.ia-upload-status {
  --upload-ms: 0.26s;
  --upload-ease: cubic-bezier(0.33, 0, 0.2, 1);
  position: absolute;
  z-index: 998;
  right: 0;
  bottom: 0;
  width: calc(200 * var(--u));
  height: calc(42 * var(--u));
  box-sizing: border-box;
  margin: 0;
  overflow: hidden;
  border-radius: calc(21 * var(--u));
  background: #3a3a3a;
  opacity: 0;
  pointer-events: none;
  transition:
    height var(--upload-ms) var(--upload-ease),
    width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.05);
}

.ia-upload-status.is-open,
.container-ia-chat.is-upload-closing .ia-upload-status {
  opacity: 1;
}

.ia-upload-status.is-open {
  height: calc(88 * var(--u));
}

.container-ia-chat.is-upload-closing .ia-upload-status {
  height: calc(42 * var(--u));
}

.container-ia-chat.is-multiline .ia-upload-status,
.container-ia-chat.is-multiline.is-upload-closing .ia-upload-status {
  height: 100%;
}

.container-ia-chat.is-multiline .ia-upload-status.is-open {
  height: calc(100% + 46 * var(--u));
}

.container-ia-chat.is-multiline .ia-upload-status__clip {
  top: 0;
  bottom: auto;
}

.input-text:focus ~ .ia-upload-status,
.input-text:focus-within ~ .ia-upload-status,
.input-text:valid ~ .ia-upload-status {
  width: calc(250 * var(--u));
}

.ia-upload-status__clip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(42 * var(--u));
}

.ia-upload-status__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: calc(8 * var(--u));
  align-items: center;
  min-height: calc(36 * var(--u));
  padding: calc(9 * var(--u)) calc(16 * var(--u)) calc(7 * var(--u));
  box-sizing: border-box;
  background: transparent;
  border-radius: 0;
}

body.is-mobile .container-ia-chat.is-upload-grow .input-text {
  background-color: transparent;
}

.ia-upload-status__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(12.5 * var(--u));
  font-weight: 500;
  color: rgba(242, 242, 242, 0.9);
}

.ia-upload-status__pct {
  font-size: calc(11 * var(--u));
  font-variant-numeric: tabular-nums;
  color: rgba(242, 242, 242, 0.55);
}

.ia-upload-status__track {
  grid-column: 1 / -1;
  height: calc(3 * var(--u));
  margin-top: calc(8 * var(--u));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.ia-upload-status__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.92);
  transition: width 0.28s cubic-bezier(0.33, 0, 0.2, 1);
}

.ia-upload-status.is-error .ia-upload-status__name {
  color: #ef9a9a;
}

.ia-upload-status.is-error .ia-upload-status__fill {
  background: #e07070;
}

.ia-upload-status.is-success .ia-upload-status__pct {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .ia-upload-status,
  .ia-upload-status__fill {
    transition: none;
  }
}

body.is-mobile .composer-card.is-attach-open .composer-attach-sheet {
  display: block !important;
  position: relative;
  height: var(--attach-h, 272px);
  overflow: hidden;
}

body.is-mobile #win-chat > .window-body {
  position: relative;
}

body.is-mobile .composer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 32px;
  padding-right: 32px;
  padding-bottom: calc(
    16px + max(
      0px,
      var(--mobile-safe-bottom) - min(var(--mobile-safe-bottom), var(--mobile-keyboard-inset))
    )
  );
  background: transparent !important;
}

body.is-mobile .composer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  /* Drop the fade 2px lower. */
  bottom: -2px;
  height: calc((100vw - 64px) * 170 / 300 + 8px);
  pointer-events: none;
  z-index: 0;
}

body.is-mobile .container-ia-chat {
  --ia-size: calc(100vw - 64px);
  width: var(--ia-size);
  flex-shrink: 0;
  z-index: 1;
  transition:
    width 0.52s cubic-bezier(0.16, 1, 0.3, 1),
    max-width 0.52s cubic-bezier(0.16, 1, 0.3, 1);
}

/* iOS: inputs <16px trigger page zoom on focus (MDN/Safari). */
body.is-mobile .container-ia-chat .input-text {
  font-size: max(16px, calc(14 * var(--u)));
}

@property --ia-field-extra {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

/* Instant: do not tween messages padding while the field height animates. */

body.is-mobile #messages.messages-area {
  padding-bottom: calc(
    100px + var(--ia-field-extra, 0px) + max(
      0px,
      var(--mobile-safe-bottom) - min(var(--mobile-safe-bottom), var(--mobile-keyboard-inset))
    )
  );
}

body.is-mobile .chat-space .window-body.is-welcome #messages.messages-area,
body.is-mobile .chat-space .window-body.is-welcome #messages,
body.is-mobile .chat-space .window-body.is-welcome .messages-area {
  padding-bottom: calc(
    100px + var(--ia-field-extra, 0px) + max(
      0px,
      var(--mobile-safe-bottom) - min(var(--mobile-safe-bottom), var(--mobile-keyboard-inset))
    )
  ) !important;
}

