/* Split from website/static/css/pages.css. Keep selector order compatible with the original cascade. */

.input-container {
  flex: 1;
  display: block;
  background: #262832;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
  position: relative;
}

.attachments {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 160px;
  overflow-y: auto;
}

.attachments.has-items {
  display: flex;
}

.attachment-card {
  display: flex;
  align-items: center;
  padding: 4px;
  gap: 8px;
  background: rgba(52, 49, 110, 0.5);
  border-radius: 8px;
  max-width: 218px;
  width: fit-content;
  cursor: pointer;
}

.attachment-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.attachment-thumb img,
.attachment-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-doc-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.attachment-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 144px;
}

.attachment-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-subtitle {
  font-size: 12px;
  font-weight: 300;
  line-height: 18px;
  color: #b6b6b6;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-remove {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  align-self: flex-start;
}

.attachment-remove svg {
  width: 8px;
  height: 8px;
  stroke: #b6b6b6;
  stroke-width: 1.5;
}

.message-attachments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.message-attachment-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(205, 221, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  text-decoration: none;
  width: 100%;
  border-style: solid;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.message-attachment-card--uploading {
  opacity: 0.72;
}

.message-attachment-card--failed {
  border-color: rgba(255, 112, 112, 0.5);
  background: rgba(255, 76, 76, 0.08);
}

.message-attachment-thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}

.message-attachment-thumb img,
.message-attachment-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message-attachment-thumb--video,
.image-preview-thumb--video,
.attachment-card--video .attachment-thumb {
  position: relative;
  background: rgba(5, 7, 13, 0.55);
}

.message-attachment-play {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(7, 9, 14, 0.6);
}

.message-attachment-play::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 5px;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid #ffffff;
}

.message-attachment-thumb--file svg {
  width: 30px;
  height: 30px;
}

.attachment-file-icon {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.attachment-file-icon svg {
  width: 100%;
  height: 100%;
}

.attachment-file-icon-label {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 3px;
  border-radius: 4px;
  background: rgba(6, 10, 20, 0.52);
  color: #ffffff;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
}

.message-attachment-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.message-attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.message-attachment-meta {
  color: rgba(236, 242, 255, 0.62);
  font-size: 12px;
}

.input-inner {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  align-items: center;
  gap: 8px;
}

.chat-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-role-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
}

.chat-role-pill.is-visible {
  display: inline-flex;
}

.chat-role-pill-remove {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #7d808d;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.chat-role-pill-remove svg {
  width: 10px;
  height: 10px;
}

.chat-role-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 100%;
  max-width: 260px;
  padding: 8px;
  border-radius: 8px;
  background: #2b2d35;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: none;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  z-index: 12;
}

.chat-role-menu.is-open {
  display: flex;
}

.chat-role-option {
  border: none;
  background: transparent;
  color: #ffffff;
  text-align: left;
  font-size: 12px;
  line-height: 18px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.chat-role-option:hover,
.chat-role-option.is-active {
  background: rgba(255, 255, 255, 0.08);
}

.chat-role-empty {
  font-size: 12px;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 8px;
}

.input-container .clip {
  width: 24px;
  height: 24px;
  stroke: #7d808d;
}

.clip-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #7d808d;
}

.clip-menu {
  position: absolute;
  left: 6px;
  bottom: 55px;
  display: none;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px;
  gap: 8px;
  background: #434550;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  animation: menuFade 0.18s ease forwards;
  z-index: 25;
}

.clip-menu.open {
  display: flex;
}

.clip-menu button {
  border: none;
  background: transparent;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.clip-menu svg {
  width: 28px;
  height: 28px;
}

.chat-input {
  background: transparent;
  border: none;
  resize: none;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
  padding: 0;
  border-radius: 0;
  height: 23px;
  flex: 1;
  min-width: 0;
}

.chat-input:focus {
  outline: none;
}

.send-message {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: #434550;
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 5px;
}

.input-toolbar.chat-composer {
  --chat-composer-progress: 0;
  --chat-composer-shell-feedback: rgba(124, 92, 255, 0.12);
  --chat-composer-scale: 1;
  --chat-composer-translate-y: 0px;
  --chat-composer-inner-gap: 10px;
  --composer-compact-height: 56px;
  --composer-compact-control: 38px;
  --composer-compact-radius: 20px;
  --composer-transition: 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  bottom: calc(var(--footer-toolbar-bottom) + env(safe-area-inset-bottom));
  width: calc(100% - 24px);
  max-width: var(--chat-shell-content-max-width, 560px);
  padding: 0;
  gap: 0;
  justify-content: center;
  background: transparent;
  overflow: visible;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
  touch-action: manipulation;
  scrollbar-width: none;
  isolation: isolate;
  transition:
    transform var(--composer-transition),
    width var(--composer-transition);
}

.input-toolbar.chat-composer::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.input-toolbar.chat-composer.is-resting {
  width: clamp(296px, calc(100vw - 24px), 432px);
}

.input-toolbar.chat-composer[data-composer-state="recording"] {
  width: clamp(296px, calc(100vw - 24px), 432px);
}

.input-toolbar.chat-composer::before {
  display: block;
  top: 0;
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: calc(100% + env(safe-area-inset-bottom) + 52px);
  background: linear-gradient(
    180deg,
    rgba(19, 23, 31, 0.64) 0%,
    rgba(19, 23, 31, 0.96) 44%,
    #13171f 100%
  );
  backdrop-filter: blur(10px) saturate(1.02);
  -webkit-backdrop-filter: blur(10px) saturate(1.02);
  pointer-events: none;
  z-index: -1;
  transition:
    height 0.24s var(--motion-ease-soft),
    background 0.24s ease,
    backdrop-filter 0.24s ease,
    -webkit-backdrop-filter 0.24s ease;
}

.chat-composer-container {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: var(--chat-composer-shell-max-height);
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #21232f;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
  overflow: visible;
  transition:
    transform 0.26s var(--motion-ease-soft),
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease,
    min-height 0.3s var(--motion-ease-soft),
    padding 0.3s var(--motion-ease-soft),
    width 0.3s var(--motion-ease-soft);
  will-change: transform;
  transform-origin: center bottom;
  transform: translateY(var(--chat-composer-translate-y)) scale(var(--chat-composer-scale));
}

.chat-share-preview {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 30px);
  z-index: 1;
  width: calc(100% - 10px);
  max-height: 74px;
  color: #f4f5ff;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, 8px, 0);
  transition:
    opacity 0.18s ease,
    transform 0.22s var(--motion-ease-soft),
    width 0.24s var(--motion-ease-soft);
}

.chat-share-preview:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
  transform: translate3d(-50%, 0, 0);
}

.chat-share-preview.is-preview-entering {
  opacity: 0;
  transform: translate3d(-50%, 8px, 0);
}

.chat-share-preview.is-expanded {
  width: 100%;
  max-height: min(60dvh, 520px);
}

.chat-share-preview.is-preview-resizing {
  max-height: min(60dvh, 520px);
}

.chat-share-preview-shell {
  position: relative;
  display: block;
  max-height: inherit;
  min-height: 67px;
  padding: 12px 92px 30px 14px;
  border: 0;
  border-radius: 14px 14px 12px 12px;
  background: #1f212c;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.chat-share-preview-shell.is-height-animating {
  overflow: hidden;
  min-height: 0;
  transition: height 0.28s var(--motion-ease-soft);
  will-change: height;
}

.chat-share-preview.is-expanded .chat-share-preview-shell {
  padding: 20px 92px 42px 14px;
  overflow: hidden;
}

.chat-share-preview-body {
  min-width: 0;
}

.chat-share-preview.is-expanded .chat-share-preview-body {
  box-sizing: border-box;
  max-height: calc(min(60dvh, 520px) - 62px);
  padding-bottom: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-share-preview-text {
  display: -webkit-box;
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  transform: translateY(0);
  transition:
    opacity 0.16s ease,
    transform 0.18s var(--motion-ease-soft),
    color 0.18s ease;
}

.chat-share-preview.is-preview-content-morphing .chat-share-preview-text {
  opacity: 0;
  transform: translateY(4px);
  transition: none;
}

.chat-share-preview-text > * {
  margin-top: 0;
  margin-bottom: 0;
}

.chat-share-preview-text > * + * {
  margin-block-start: 7px;
}

.chat-share-preview-text h1,
.chat-share-preview-text h2,
.chat-share-preview-text h3,
.chat-share-preview-text h4,
.chat-share-preview-text h5,
.chat-share-preview-text h6 {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
}

.chat-share-preview-text ul,
.chat-share-preview-text ol {
  margin: 0 0 0 16px;
  padding: 0;
}

.chat-share-preview-text li {
  margin: 2px 0;
}

.chat-share-preview-text a {
  color: rgba(206, 194, 255, 0.96);
  text-decoration: underline;
  text-decoration-color: rgba(206, 194, 255, 0.5);
}

.chat-share-preview-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.055);
  padding: 1px 4px;
  border-radius: 4px;
}

.chat-share-preview-text blockquote {
  margin: 0;
  padding: 5px 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.018);
  border-radius: 6px;
}

.chat-share-preview.is-expanded .chat-share-preview-text {
  display: block;
  color: rgba(255, 255, 255, 0.9);
  -webkit-line-clamp: unset;
}

.chat-share-preview-image {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
}

.chat-share-preview-image img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

.chat-share-preview.is-expanded .chat-share-preview-image img {
  max-height: 180px;
}

.chat-share-preview-controls {
  position: absolute;
  right: 12px;
  bottom: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 0;
  z-index: 2;
}

.chat-share-preview-clear,
.chat-share-preview-toggle {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.68);
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chat-share-preview-clear svg,
.chat-share-preview-toggle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-share-preview-clear:hover,
.chat-share-preview-toggle:hover {
  color: #ffffff;
  background: transparent;
}

.chat-share-preview-toggle .chat-share-preview-collapse-icon {
  display: none;
}

.chat-share-preview.is-expanded .chat-share-preview-expand-icon {
  display: none;
}

.chat-share-preview.is-expanded .chat-share-preview-collapse-icon {
  display: block;
}

.chat-composer-container::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: 0;
  padding: 6px;
  border-radius: inherit;
  background:
    conic-gradient(
      from var(--image-generation-edge-angle, 0deg),
      transparent 0deg 22deg,
      rgba(124, 92, 255, var(--chat-composer-glow-high, 0.18)) 38deg,
      rgba(95, 135, 255, var(--chat-composer-glow-low, 0.14)) 54deg,
      transparent 82deg 148deg,
      rgba(95, 135, 255, var(--chat-composer-glow-low, 0.15)) 168deg,
      rgba(124, 92, 255, var(--chat-composer-glow-high, 0.18)) 188deg,
      transparent 210deg 264deg,
      rgba(190, 177, 255, var(--chat-composer-glow-low, 0.13)) 282deg,
      rgba(141, 47, 243, var(--chat-composer-glow-high, 0.16)) 300deg,
      transparent 320deg 360deg
    );
  filter: blur(8px);
  --image-generation-edge-glow-opacity-low: var(--chat-composer-glow-opacity-low, 0.72);
  --image-generation-edge-glow-opacity-high: var(--chat-composer-glow-opacity-high, 0.94);
  opacity: 1;
  pointer-events: none;
  animation: imageGenerationEdgeOrbit 16s linear infinite reverse, imageGenerationEdgeGlowBreath 5.8s ease-in-out infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.chat-composer-container::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 0;
  padding: 1px;
  border-radius: inherit;
  background:
    conic-gradient(
      from var(--image-generation-edge-angle, 0deg),
      transparent 0deg 24deg,
      rgba(124, 92, 255, 0.36) 40deg,
      rgba(95, 135, 255, 0.26) 58deg,
      rgba(190, 177, 255, 0.14) 70deg,
      transparent 88deg 150deg,
      rgba(95, 135, 255, 0.24) 170deg,
      rgba(124, 92, 255, 0.32) 190deg,
      transparent 214deg 270deg,
      rgba(190, 177, 255, 0.16) 288deg,
      rgba(141, 47, 243, 0.28) 306deg,
      transparent 326deg 360deg
    );
  opacity: 0.68;
  pointer-events: none;
  animation: imageGenerationEdgeOrbit 15.8s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.chat-composer-container:focus-within::after,
.chat-composer.is-active .chat-composer-container::after {
  opacity: 0.38;
}

.chat-composer-container:focus-within,
.chat-composer.is-active .chat-composer-container {
  --chat-composer-glow-low: 0.075;
  --chat-composer-glow-high: 0.095;
  --chat-composer-glow-opacity-low: 0.48;
  --chat-composer-glow-opacity-high: 0.62;
}

.chat-composer.composer-layout-flipping .chat-composer-container {
  overflow: hidden;
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    background-color 0.22s ease;
  will-change: height;
}

.chat-composer.composer-layout-flipping .chat-input-wrapper {
  will-change: transform;
  backface-visibility: hidden;
}

.chat-composer.composer-layout-flipping:not(.composer-layout-measuring) .chat-composer-inner {
  position: static;
}

.chat-composer.composer-layout-flipping:not(.composer-layout-measuring) .chat-composer-rail {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 9px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
}

.chat-composer.composer-layout-flipping:not(.composer-layout-measuring).is-resting .chat-composer-rail,
.chat-composer.composer-layout-flipping:not(.composer-layout-measuring)[data-composer-state="recording"] .chat-composer-rail {
  left: 10px;
  right: 10px;
  gap: 8px;
}

.chat-composer[data-composer-state="synthesizing"] .chat-composer-container {
  position: relative;
  border-color: rgba(124, 92, 255, 0.16);
  box-shadow: 0 9px 20px rgba(0, 0, 0, 0.16);
}

.chat-composer[data-composer-state="synthesizing"] .chat-composer-container::before,
.chat-composer[data-composer-state="default"] .chat-composer-container::before,
.chat-composer[data-composer-state="recording"] .chat-composer-container::before {
  opacity: 0.64;
}

.chat-composer[data-composer-state="synthesizing"] .chat-composer-container::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    115deg,
    rgba(124, 92, 255, 0.05) 0%,
    rgba(124, 92, 255, 0.2) 24%,
    rgba(124, 92, 255, 0.06) 48%,
    rgba(124, 92, 255, 0.18) 72%,
    rgba(124, 92, 255, 0.05) 100%
  );
  background-size: 180% 100%;
  animation: chatComposerBorderRun 2.4s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.chat-composer-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  transition:
    gap var(--composer-transition),
    grid-template-columns var(--composer-transition);
}

.chat-composer.is-multiline .chat-composer-inner {
  align-items: stretch;
}

.chat-composer.is-resting .chat-composer-container {
  --chat-composer-scale: 1;
  display: grid;
  min-height: var(--composer-compact-height);
  padding: 6px 10px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
  align-content: center;
}

.chat-composer[data-composer-state="recording"] .chat-composer-container {
  --chat-composer-scale: 1;
  --chat-composer-glow-low: 0.12;
  --chat-composer-glow-high: 0.16;
  min-height: var(--composer-compact-height);
  padding: 6px 10px;
  border-color: rgba(124, 92, 255, 0.14);
  box-shadow: 0 7px 15px rgba(0, 0, 0, 0.14);
}

.chat-composer.is-resting .chat-composer-inner {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.chat-composer[data-composer-state="recording"] .chat-composer-inner {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.chat-composer.composer-transitioning .chat-composer-plus,
.chat-composer.composer-transitioning .chat-composer-actions,
.chat-composer[data-composer-animating="true"] .chat-composer-plus,
.chat-composer[data-composer-animating="true"] .chat-composer-actions {
  transition-duration: 0.24s;
}

.chat-composer-plus {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(245, 246, 251, 0.92);
  position: relative;
  flex-shrink: 0;
  transition: opacity 0.2s ease, transform 0.16s ease, color 0.2s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.chat-composer-plus,
.chat-composer-voice-btn,
.chat-composer .send-message,
.chat-composer-plus-menu .clip-option {
  touch-action: manipulation;
}

.chat-composer-plus:active,
.chat-composer-voice-btn:active,
.chat-composer .send-message:active {
  transform: scale(0.96);
  opacity: 0.88;
}

.chat-composer-plus:active {
  background: rgba(41, 43, 56, 0.94);
}

.chat-composer-plus-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-composer-plus-icon--close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.72);
}

.chat-composer[data-composer-state="recording"] .chat-composer-plus {
  color: rgba(245, 246, 251, 0.96);
  background: transparent;
  box-shadow: none;
  transform: none;
  width: 38px;
  height: 38px;
  min-width: 38px;
}

.chat-composer-plus.is-menu-open {
  background: rgba(41, 43, 56, 0.94);
  color: rgba(242, 244, 250, 0.9);
}

.chat-composer-plus.is-menu-open .chat-composer-plus-icon--plus {
  opacity: 0;
  transform: rotate(90deg) scale(0.7);
}

.chat-composer-plus.is-menu-open .chat-composer-plus-icon--close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.chat-composer[data-composer-state="recording"] .chat-composer-plus-icon--plus {
  opacity: 0;
  transform: rotate(90deg) scale(0.7);
}

.chat-composer[data-composer-state="recording"] .chat-composer-plus-icon--close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.chat-composer-plus-menu {
  left: 10px;
  right: auto;
  bottom: calc(100% + 8px);
  width: max-content;
  min-width: 146px;
  max-width: min(220px, calc(100vw - 32px));
  max-height: min(180px, calc(100dvh - var(--chat-composer-live-height, 56px) - 72px));
  padding: 5px;
  gap: 2px;
  border-radius: 8px;
  background: rgba(25, 27, 36, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform-origin: left bottom;
  z-index: 36;
}

.chat-composer-plus-menu .clip-option {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 7px;
  color: rgba(243, 245, 250, 0.92);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  font-size: 13px;
  line-height: 1.1;
  transition: background 0.18s ease, color 0.18s ease;
}

.chat-composer-plus-menu .clip-option:hover {
  background: rgba(124, 92, 255, 0.12);
}

.chat-composer-plus-menu-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.chat-composer-plus-menu-icon svg {
  width: 18px;
  height: 18px;
}

.chat-composer-plus-menu-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-composer-main {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 24px;
  max-height: var(--chat-composer-shell-max-height);
  display: grid;
  align-items: start;
  transition: min-height 0.28s var(--motion-ease-soft), max-height 0.28s var(--motion-ease-soft);
}

.chat-composer.is-resting .chat-composer-main {
  grid-column: 2;
  grid-row: 1;
  min-height: 22px;
  max-height: 38px;
  align-items: center;
}

.chat-composer[data-composer-state="recording"] .chat-composer-main {
  grid-column: 2;
  grid-row: 1;
  min-height: 42px;
  max-height: 42px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
}

.chat-composer-recording-shell,
.chat-composer-synth-shell {
  grid-area: 1 / 1;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 2;
  width: 100%;
  min-height: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.24s ease, visibility 0s linear 0.16s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  overflow: visible;
}

.chat-composer .chat-input-wrapper {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  min-height: 38px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.24s ease, visibility 0s linear 0.16s;
}

.chat-composer.is-resting .chat-input-wrapper {
  align-items: center;
  min-height: 38px;
}

.chat-composer[data-composer-state="recording"] .chat-input-wrapper {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px) scale(0.98);
}

.chat-composer[data-composer-state="recording"] .chat-composer-recording-shell {
  position: relative;
  inset: auto;
  grid-column: 1 / -1;
  grid-row: 1;
  z-index: 2;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 42px;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
  overflow: hidden;
}

.chat-composer-waveform {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.chat-composer-waveform.chat-composer-waveform--living {
  height: 42px;
  gap: clamp(2px, 1.2vw, 6px);
  padding: 0;
  min-inline-size: 0;
  max-inline-size: 100%;
  background: transparent;
  border-radius: 0;
  overflow: hidden;
}

.chat-composer-waveform--living .chat-composer-waveform-bar {
  --wave-level: 0.12;
  --wave-width: 0.34;
  --wave-opacity: 0.84;
  flex: 1 1 0;
  min-width: 0;
  min-height: 7px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(190, 177, 255, 0.94) 0%,
    rgba(141, 47, 243, 0.92) 42%,
    rgba(95, 135, 255, 0.9) 100%
  );
  box-shadow: 0 0 10px rgba(124, 92, 255, 0.34);
  transform: scaleX(calc(0.6 + var(--wave-width) * 0.4)) scaleY(calc(0.2 + var(--wave-level) * 0.8));
  transform-origin: center center;
  opacity: var(--wave-opacity);
  transition: transform 0.08s linear, opacity 0.1s linear, filter 0.14s ease;
  animation: none;
}

.chat-composer.recording-paused .chat-composer-waveform--living {
  opacity: 0.82;
}

.chat-composer.recording-paused .chat-composer-waveform--living .chat-composer-waveform-bar {
  animation: none;
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  max-inline-size: 7px;
  height: 10px;
  opacity: 0.6;
  filter: saturate(0.85) brightness(0.92);
  box-shadow: 0 0 6px rgba(124, 92, 255, 0.22);
  transform: scaleX(0.72);
}

.chat-composer[data-composer-state="synthesizing"] .chat-composer-synth-shell {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px 0 8px;
  bottom: 0;
}

.chat-composer-status {
  color: #f5f6fb;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 600;
}

.chat-composer-progress {
  color: rgba(245, 246, 251, 0.76);
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
  min-width: 44px;
  text-align: right;
}

.chat-composer.is-multiline .chat-input-wrapper {
  align-items: flex-start;
}

.chat-composer[data-composer-state="default"] .chat-input-wrapper {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.chat-composer .chat-input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  max-height: var(--chat-composer-input-max-height);
  height: 38px;
  padding: 8px 0;
  box-sizing: border-box;
  overflow-y: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
  font-size: 15px;
  line-height: 20px;
  color: #f5f6fb;
  align-self: center;
  transition: font-size 0.24s ease, line-height 0.24s ease;
}

.chat-composer.is-multiline .chat-input {
  align-self: flex-start;
}

.chat-composer.is-resting .chat-input {
  font-size: 14px;
  line-height: 20px;
}

.chat-composer .chat-input::placeholder {
  color: rgba(243, 245, 250, 0.44);
}

.chat-composer .chat-role-pill {
  margin-bottom: 6px;
}

.chat-composer-rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  transition: gap 0.24s ease, min-height 0.24s ease;
}

.chat-composer-rail-start {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.chat-composer.is-resting .chat-composer-rail {
  display: contents;
}

.chat-composer[data-composer-state="recording"] .chat-composer-rail {
  display: contents;
}

.chat-composer.is-resting .chat-composer-rail-start {
  grid-column: 1;
  grid-row: 1;
}

.chat-composer[data-composer-state="recording"] .chat-composer-rail-start {
  grid-column: 1;
  grid-row: 1;
}

.chat-composer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: stretch;
  min-width: 0;
  justify-content: flex-end;
  transition: gap 0.2s ease, transform 0.2s ease;
}

.chat-composer.is-resting .chat-composer-actions {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  gap: 8px;
}

.chat-composer[data-composer-state="recording"] .chat-composer-actions {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  gap: 8px;
}

.chat-composer.is-multiline .chat-composer-actions {
  align-self: stretch;
  padding-bottom: 0;
}

.chat-composer-action-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex: 0 0 38px;
  min-inline-size: 38px;
  inline-size: 38px;
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  transition:
    inline-size var(--composer-transition),
    opacity 0.16s ease,
    transform var(--composer-transition),
    min-inline-size var(--composer-transition);
}

.chat-composer-voice-slot,
.chat-composer-send-slot {
  inline-size: 38px;
  min-inline-size: 38px;
}

.chat-composer-voice-btn,
.chat-composer .send-message {
  --composer-control-glyph-scale: 1;
  --composer-send-control-scale: 1;
  --composer-send-control-opacity: 1;
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex: 0 0 38px;
  border-radius: 8px;
  padding: 0;
  border: none;
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  transition: opacity 0.18s ease, transform 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.chat-composer-plus svg {
  width: 18px;
  height: 18px;
}

.chat-composer-voice-btn svg {
  width: 16px;
  height: 16px;
  opacity: 1;
  transform: scale(var(--composer-control-glyph-scale, 1));
  transition: opacity 0.14s var(--motion-ease-soft), transform 0.16s var(--motion-ease-soft);
}

.chat-composer .send-message svg {
  display: block;
  width: 14px;
  height: 14px;
  transform: rotate(0deg);
  transform-box: fill-box;
  transform-origin: center center;
  transition: none;
}

.chat-composer-voice-btn {
  color: rgba(245, 246, 251, 0.92);
}

.chat-composer-voice-btn::before,
.chat-composer-voice-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0;
  transform: translateY(-50%) scaleY(0.65);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-composer-voice-btn::before {
  left: calc(50% - 5px);
}

.chat-composer-voice-btn::after {
  right: calc(50% - 5px);
}

.chat-composer-voice-btn .chat-composer-voice-resume-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
  transform: translate(-42%, -50%) scale(0.7);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.chat-composer .send-message {
  color: rgba(245, 246, 251, 0.92);
  opacity: var(--composer-send-control-opacity, 1);
  transform: scale(var(--composer-send-control-scale, 1));
}

.chat-composer[data-composer-state="recording"] .send-message {
  background: transparent;
  box-shadow: none;
  color: rgba(245, 247, 255, 0.96);
}

.chat-composer[data-composer-icon-state="recording"] .send-message svg {
  transform: rotate(-62deg);
  transform-box: fill-box;
  transform-origin: center center;
}

.chat-composer .send-message:disabled {
  opacity: 0.34;
  pointer-events: none;
}

.chat-composer[data-composer-state="synthesizing"] .chat-composer-voice-slot,
.chat-composer[data-composer-state="synthesizing"] .chat-composer-send-slot {
  inline-size: 0;
  min-inline-size: 0;
  opacity: 0;
  transform: translateX(6px) scale(0.86);
  pointer-events: none;
}

.chat-composer[data-composer-icon-state="recording"] .chat-composer-voice-btn svg {
  opacity: 0;
  transform: scale(0.58);
}

.chat-composer[data-composer-icon-state="recording"].recording-paused .chat-composer-voice-btn svg {
  opacity: 0;
}

.chat-composer[data-composer-icon-state="recording"] .chat-composer-voice-btn::before,
.chat-composer[data-composer-icon-state="recording"] .chat-composer-voice-btn::after {
  opacity: 1;
  transform: translateY(-50%) scaleX(var(--composer-control-glyph-scale, 1)) scaleY(1);
}

.chat-composer.recording-paused .chat-composer-voice-btn::before,
.chat-composer.recording-paused .chat-composer-voice-btn::after {
  opacity: 0;
  transform: translateY(-50%) scaleY(0.72);
}

.chat-composer.recording-paused .chat-composer-voice-btn .chat-composer-voice-resume-icon {
  opacity: 1;
  transform: translate(-42%, -50%) scale(var(--composer-control-glyph-scale, 1));
}

.chat-composer.composer-icon-swapping[data-composer-icon-phase="out"] .send-message {
  --composer-send-control-scale: 0.58;
  --composer-send-control-opacity: 0;
}

.chat-composer.composer-icon-swapping[data-composer-icon-phase="out"] .chat-composer-voice-btn,
.chat-composer.composer-voice-icon-swapping[data-composer-voice-icon-phase="out"] .chat-composer-voice-btn {
  --composer-control-glyph-scale: 0.58;
}

.chat-composer.composer-icon-swapping[data-composer-icon-phase="out"] .chat-composer-voice-btn svg,
.chat-composer.composer-icon-swapping[data-composer-icon-phase="out"] .chat-composer-voice-btn::before,
.chat-composer.composer-icon-swapping[data-composer-icon-phase="out"] .chat-composer-voice-btn::after,
.chat-composer.composer-icon-swapping[data-composer-icon-phase="out"] .chat-composer-voice-btn .chat-composer-voice-resume-icon,
.chat-composer.composer-voice-icon-swapping[data-composer-voice-icon-phase="out"] .chat-composer-voice-btn svg,
.chat-composer.composer-voice-icon-swapping[data-composer-voice-icon-phase="out"] .chat-composer-voice-btn::before,
.chat-composer.composer-voice-icon-swapping[data-composer-voice-icon-phase="out"] .chat-composer-voice-btn::after,
.chat-composer.composer-voice-icon-swapping[data-composer-voice-icon-phase="out"] .chat-composer-voice-btn .chat-composer-voice-resume-icon {
  opacity: 0;
}

.chat-composer-synth-tapzone {
  display: none;
}

.chat-composer[data-composer-state="synthesizing"] .chat-composer-synth-tapzone {
  position: absolute;
  inset: 0;
  display: block;
  border: none;
  background: transparent;
  pointer-events: none;
}

.chat-composer .attachments {
  margin-bottom: 10px;
}

/* Transient hint above the composer (e.g. image concurrency cap); auto-dismisses. */
.chat-composer-flash {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  right: auto;
  bottom: auto;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  box-sizing: border-box;
  z-index: 360;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  text-align: left;
  letter-spacing: 0;
  color: rgba(245, 246, 251, 0.92);
  background: linear-gradient(180deg, rgba(34, 37, 49, 0.96), rgba(20, 23, 33, 0.96));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translate(-50%, -14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: auto;
}

.chat-composer-flash.chat-composer-flash--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.chat-composer-flash.chat-composer-flash--dismissing {
  opacity: 0;
  transform: translate(-50%, 12px);
}

.chat-composer-flash-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.chat-composer-flash-close {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.74);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.chat-composer-flash-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.94);
}

.chat-composer-flash-close:active {
  transform: scale(0.94);
}

.chat-composer-flash--warning {
  border-color: rgba(255, 184, 95, 0.18);
}

body.chat-footer-docked .chat-composer-flash {
  top: calc(12px + env(safe-area-inset-top));
  bottom: auto;
}

body.chat-footer-docked.chat-footer-manual-open .chat-composer-flash {
  top: calc(12px + env(safe-area-inset-top));
  bottom: auto;
}

body.chat-footer-docked .input-toolbar.chat-composer {
  bottom: calc(12px + env(safe-area-inset-bottom));
}

body.chat-footer-docked.chat-footer-manual-open .input-toolbar.chat-composer {
  bottom: calc(var(--footer-toolbar-bottom) + env(safe-area-inset-bottom));
}

body.chat-footer-docked .input-toolbar.chat-composer::before {
  height: calc(100% + env(safe-area-inset-bottom) + 72px);
}

body.chat-footer-visible .footer.tap-bar.bottom-bar {
  z-index: 24;
}

body.chat-footer-visible .input-toolbar.chat-composer {
  z-index: 11;
}

body.chat-footer-manual-open .footer.tap-bar.bottom-bar {
  z-index: 24;
}

body.chat-footer-manual-open .input-toolbar.chat-composer {
  z-index: 11;
}

body.chat-footer-visible .input-toolbar.chat-composer::before {
  height: calc(100% + 4px);
}

body.chat-footer-manual-open .input-toolbar.chat-composer::before {
  height: calc(100% + var(--footer-toolbar-bottom) + env(safe-area-inset-bottom));
}

body.chat-footer-visible.chat-footer-keyboard-active .footer.tap-bar.bottom-bar {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

body.chat-footer-visible.chat-footer-keyboard-active .input-toolbar.chat-composer {
  bottom: calc(12px + env(safe-area-inset-bottom));
}

/* Chat shell owns keyboard/footer interaction state. User footer preference is restored after focus. */
body.chat-shell-footer-suppressed .footer.tap-bar.bottom-bar,
body.chat-shell-footer-suppressed.chat-footer-manual-open .footer.tap-bar.bottom-bar,
body.chat-shell-footer-suppressed.chat-footer-visible .footer.tap-bar.bottom-bar {
  transform: translateY(120%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.chat-shell .input-toolbar.chat-composer {
  bottom: var(--chat-composer-bottom-offset, calc(12px + env(safe-area-inset-bottom, 0px)));
  overflow: visible;
}

body.chat-shell.chat-footer-visible .input-toolbar.chat-composer,
body.chat-shell.chat-footer-manual-open .input-toolbar.chat-composer {
  bottom: calc(var(--footer-toolbar-bottom) + env(safe-area-inset-bottom));
}

body.chat-shell.chat-shell-keyboard-open .input-toolbar.chat-composer,
body.chat-shell.chat-shell-keyboard-open .input-toolbar.chat-composer.is-resting {
  width: calc(100% - 24px);
  max-width: var(--chat-shell-content-max-width, 560px);
  transition: transform var(--composer-transition);
}

body.chat-shell .input-toolbar.chat-composer::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  padding: 2px;
  border-radius: 14px;
  pointer-events: none;
  background:
    conic-gradient(
      from var(--image-generation-edge-angle, 0deg),
      transparent 0deg 24deg,
      rgba(124, 92, 255, 0.34) 42deg,
      rgba(95, 135, 255, 0.24) 60deg,
      transparent 92deg 150deg,
      rgba(95, 135, 255, 0.22) 170deg,
      rgba(124, 92, 255, 0.3) 190deg,
      transparent 214deg 270deg,
      rgba(190, 177, 255, 0.14) 288deg,
      rgba(141, 47, 243, 0.26) 306deg,
      transparent 326deg 360deg
    );
  animation: imageGenerationEdgeOrbit 15.8s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

body.chat-shell .chat-composer-container {
  overflow: hidden;
}

body.chat-shell .input-toolbar.chat-composer.composer-menu-open {
  z-index: 13;
}

body.chat-shell .chat-composer-container::before,
body.chat-shell .chat-composer-container::after {
  opacity: 0;
  animation-play-state: paused;
}

body.chat-shell .chat-composer .chat-input {
  font-size: 16px;
}

body.app-keyboard-open:not(.chat-shell) .input-toolbar.chat-composer,
body:not(.chat-shell):has(.input-toolbar.chat-composer:focus-within) .input-toolbar.chat-composer {
  bottom: env(safe-area-inset-bottom);
}

body.app-keyboard-open:not(.chat-shell) .input-toolbar.chat-composer {
  --app-keyboard-fixed-raise: var(--app-keyboard-inset, 0px);
}

body.app-keyboard-open:not(.chat-shell) .input-toolbar.chat-composer::before,
body:not(.chat-shell).chat-keyboard-focus-active .input-toolbar.chat-composer::before,
body:not(.chat-shell):has(.input-toolbar.chat-composer:focus-within) .input-toolbar.chat-composer::before {
  height: calc(100% + var(--app-keyboard-inset, 0px) + env(safe-area-inset-bottom) + 118px);
  background: linear-gradient(
    180deg,
    rgba(19, 23, 31, 0) 0%,
    rgba(19, 23, 31, 0.86) 16%,
    rgba(19, 23, 31, 0.98) 54%,
    #13171f 100%
  );
  backdrop-filter: blur(18px) saturate(1.06);
  -webkit-backdrop-filter: blur(18px) saturate(1.06);
}

body.chat-shell.chat-shell-keyboard-open .input-toolbar.chat-composer {
  bottom: var(--chat-composer-bottom-offset, calc(12px + env(safe-area-inset-bottom, 0px)));
  --app-keyboard-fixed-raise: var(--chat-composer-raise, 0px);
}

body.chat-shell.chat-shell-keyboard-open .input-toolbar.chat-composer::before {
  height: calc(100% + env(safe-area-inset-bottom) + var(--chat-composer-browser-gap, 0px) + 18px);
  background: linear-gradient(
    180deg,
    rgba(19, 23, 31, 0) 0%,
    rgba(19, 23, 31, 0.48) 42%,
    rgba(19, 23, 31, 0.82) 100%
  );
  backdrop-filter: blur(4px) saturate(1.02);
  -webkit-backdrop-filter: blur(4px) saturate(1.02);
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text .input-toolbar.chat-composer,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-footer-visible .input-toolbar.chat-composer,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-footer-manual-open .input-toolbar.chat-composer,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer.is-resting {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  grid-area: 2 / 1;
  flex: 0 0 auto;
  box-sizing: border-box;
  align-self: end;
  justify-self: center;
  width: calc(100% - (2 * var(--chat-shell-edge-gutter, 16px)));
  max-width: var(--chat-shell-content-max-width, 560px);
  margin: 0 auto var(--chat-composer-rest-gap, 10px);
  --app-keyboard-fixed-raise: 0px;
  --app-motion-fixed-transform: none;
  transform: none;
  transition: none;
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-footer-visible:not(.chat-shell-footer-suppressed) .input-toolbar.chat-composer,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-footer-manual-open:not(.chat-shell-footer-suppressed) .input-toolbar.chat-composer {
  margin-bottom: calc(var(--footer-toolbar-bottom) + env(safe-area-inset-bottom));
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-footer-pull-open:not(.chat-shell-footer-suppressed) .input-toolbar.chat-composer {
  margin-bottom: var(--chat-composer-rest-gap, 10px);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-footer-pull-open:not(.chat-shell-footer-suppressed) .input-toolbar.chat-composer::before {
  opacity: 0;
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer {
  margin-bottom: var(--chat-composer-keyboard-gap, 8px);
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-layout-settling .input-toolbar.chat-composer,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-thread-scrolling .input-toolbar.chat-composer {
  transition: none;
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-layout-settling .input-toolbar.chat-composer .chat-composer-container,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-thread-scrolling .input-toolbar.chat-composer .chat-composer-container {
  transition-property: border-color, box-shadow, background-color;
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text .input-toolbar.chat-composer.is-resting,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text .input-toolbar.chat-composer[data-composer-state="recording"] {
  width: calc(100% - (2 * var(--chat-shell-edge-gutter, 16px)));
  max-width: var(--chat-shell-content-max-width, 560px);
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer.is-resting,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer[data-composer-state="recording"] {
  width: calc(100% - (2 * var(--chat-shell-edge-gutter, 16px)));
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text .input-toolbar.chat-composer::before,
body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer::before {
  height: calc(100% + var(--chat-composer-rest-gap, 10px) + 14px);
  background: linear-gradient(
    180deg,
    rgba(19, 23, 31, 0) 0%,
    rgba(19, 23, 31, 0.5) 40%,
    rgba(19, 23, 31, 0.86) 100%
  );
  backdrop-filter: blur(5px) saturate(1.02);
  -webkit-backdrop-filter: blur(5px) saturate(1.02);
}

body.chat-shell-telegram.chat-shell-mobile.chat-shell-text.chat-shell-keyboard-open .input-toolbar.chat-composer::before {
  height: calc(100% + var(--chat-composer-keyboard-gap, 8px) + 14px);
}

body:not(.chat-shell-telegram).chat-footer-visible.chat-footer-keyboard-active .input-toolbar.chat-composer::before {
  height: calc(100% + var(--app-keyboard-inset, 0px) + env(safe-area-inset-bottom) + 118px);
}

body.chat-footer-prehidden .footer.tap-bar.bottom-bar,
body.chat-footer-docked .footer.tap-bar.bottom-bar {
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

body.chat-footer-prehidden .footer.tap-bar.bottom-bar {
  transition: none;
}

body.chat-footer-docked .chat-scroll-bottom {
  bottom: calc(var(--chat-composer-live-height, 56px) + env(safe-area-inset-bottom) + 30px);
}

body.app-keyboard-open .chat-scroll-bottom,
body.chat-footer-keyboard-active .chat-scroll-bottom {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
}

body.chat-footer-docked .chat-opened-limit {
  bottom: calc(var(--chat-composer-live-height, 56px) + env(safe-area-inset-bottom) + 26px);
}

body.chat-footer-manual-open .footer.tap-bar.bottom-bar {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

body.chat-footer-manual-open .footer.tap-bar.bottom-bar.hidden {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

body.chat-footer-visible .footer.tap-bar.bottom-bar.hidden {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

body.chat-footer-manual-open.chat-footer-prehidden .footer.tap-bar.bottom-bar,
body.chat-footer-visible.chat-footer-prehidden .footer.tap-bar.bottom-bar {
  transform: translateY(0) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transition: transform 0.28s var(--motion-ease-soft), opacity 0.2s ease !important;
}

.chat-footer-pull-hint {
  --chat-footer-pull-progress: 0;
  --chat-footer-pull-offset: 0px;
  --chat-footer-pull-marker-y: 0px;
  --chat-footer-pull-ring-rotation: -128deg;
  --chat-footer-pull-ring-opacity: 0.72;
  position: fixed;
  left: 50%;
  bottom: calc(var(--chat-composer-live-height, 56px) + 22px + env(safe-area-inset-bottom));
  width: min(calc(100vw - (2 * var(--chat-shell-edge-gutter, 16px))), var(--chat-shell-content-max-width, 560px));
  z-index: 23;
  display: grid;
  justify-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(14px - (var(--chat-footer-pull-progress) * 10px)));
  transition: opacity 0.16s ease, transform 0.18s var(--motion-ease-soft);
}

.chat-footer-pull-hint.is-visible {
  opacity: 1;
}

.chat-footer-pull-marker {
  width: clamp(48px, 13vw, 64px);
  height: clamp(60px, 17vw, 82px);
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
  transform: translateY(var(--chat-footer-pull-marker-y));
  transition: background 0.16s ease, transform 0.16s var(--motion-ease-soft);
}

.chat-footer-pull-hint.is-release .chat-footer-pull-marker {
  background: rgba(124, 92, 255, 0.24);
}

.chat-footer-pull-ring {
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.86);
  border-right-color: rgba(255, 255, 255, 0.68);
  opacity: var(--chat-footer-pull-ring-opacity);
  transform: rotate(var(--chat-footer-pull-ring-rotation));
}

.chat-footer-pull-arrow {
  position: relative;
  width: 18px;
  height: 18px;
  border-left: 3px solid currentColor;
  border-top: 3px solid currentColor;
  transform: translateY(4px) rotate(45deg);
}

.chat-footer-pull-arrow::after {
  content: "";
  position: absolute;
  left: 5px;
  top: -3px;
  width: 3px;
  height: 23px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-45deg);
  transform-origin: top center;
}

.chat-footer-pull-panel {
  min-height: 42px;
  width: 100%;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  padding: 9px 18px;
  border-radius: 18px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(28, 29, 36, 0.94);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px) saturate(1.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  font-size: clamp(14px, 3.5vw, 16px);
  line-height: 1.25;
  text-align: center;
}

.chat-footer-pull-hint.is-release .chat-footer-pull-panel {
  color: rgba(255, 255, 255, 0.94);
}

body.chat-footer-pull-open .chat-footer-pull-hint {
  opacity: 0;
  transform: translate(-50%, 12px);
}

body.message-inline-edit-active .input-toolbar.chat-composer,
body.message-inline-edit-active.chat-footer-docked .input-toolbar.chat-composer,
body.message-inline-edit-active.chat-footer-visible .input-toolbar.chat-composer,
body.message-inline-edit-active.chat-footer-manual-open .input-toolbar.chat-composer,
body.message-inline-edit-active.chat-footer-visible.chat-footer-keyboard-active .input-toolbar.chat-composer {
  transform: translateY(18px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.message-inline-edit-active .footer.tap-bar.bottom-bar,
body.message-inline-edit-active.chat-footer-prehidden .footer.tap-bar.bottom-bar,
body.message-inline-edit-active.chat-footer-docked .footer.tap-bar.bottom-bar,
body.message-inline-edit-active.chat-footer-visible .footer.tap-bar.bottom-bar,
body.message-inline-edit-active.chat-footer-manual-open .footer.tap-bar.bottom-bar,
body.message-inline-edit-active.chat-footer-manual-open.chat-footer-prehidden .footer.tap-bar.bottom-bar,
body.message-inline-edit-active.chat-footer-visible.chat-footer-prehidden .footer.tap-bar.bottom-bar {
  transform: translateY(120%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.chat-footer-manual-open .chat-scroll-bottom {
  bottom: calc(var(--chat-composer-live-height, 56px) + var(--footer-dock-nav-min-height) + env(safe-area-inset-bottom) + 30px);
}

body.chat-footer-manual-open .chat-opened-limit {
  bottom: calc(var(--chat-composer-live-height, 56px) + var(--footer-dock-nav-min-height) + env(safe-area-inset-bottom) + 26px);
}

body.model-modal-open .footer.tap-bar.bottom-bar,
body.model-modal-open.chat-footer-manual-open .footer.tap-bar.bottom-bar {
  opacity: 0.06;
  pointer-events: none;
  filter: blur(10px) saturate(0.78);
}

body.chat-footer-manual-open #chat-main.hello-active:not(.has-messages) .hello-message,
body.chat-footer-manual-open #support-chat-main.hello-active:not(.has-messages) .support-chat-empty-state {
  transform: translateY(calc(12px - var(--footer-toolbar-bottom)));
  will-change: transform;
}

.page.page-chat-single-scroll #chat.section.active .chat-head-wrap {
  z-index: 20;
}

@keyframes chatComposerBorderRun {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 200% 50%;
  }
}

@media (max-width: 720px) {
  .input-toolbar.chat-composer {
    max-width: calc(100vw - 24px);
  }

  .chat-composer-container {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-composer[data-composer-state="synthesizing"] .chat-composer-container::after {
    animation: none;
  }

  .chat-composer-waveform--living .chat-composer-waveform-bar {
    animation: none;
  }
}
