[data-component="session-turn"] {
  /* flex: 1; */
  --scroll-y: 0px;
  height: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;

  [data-slot="session-turn-content"] {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    overflow-y: auto;
    scrollbar-width: none;
  }

  [data-slot="session-turn-content"]::-webkit-scrollbar {
    display: none;
  }

  [data-slot="session-turn-message-container"] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    align-self: stretch;
    min-width: 0;
    gap: 42px;
    /* gap: clamp(8px, calc(42px - var(--scroll-y) * 0.48), 42px); */
    overflow-anchor: none;
  }

  [data-slot="session-turn-sticky-title"] {
    width: 100%;
    position: sticky;
    top: 0;
    background-color: var(--background-stronger);
    z-index: 21;
  }

  [data-slot="session-turn-response-trigger"] {
    position: sticky;
    top: 32px;
    background-color: var(--background-stronger);
    z-index: 20;
    width: calc(100% + 9px);
    margin-left: -9px;
    padding-left: 9px;
    padding-bottom: 8px;
  }

  [data-slot="session-turn-message-header"] {
    display: flex;
    align-items: center;
    gap: 8px;
    align-self: stretch;
    height: 32px;
  }

  [data-slot="session-turn-message-content"] {
    margin-top: -18px;
  }

  [data-slot="session-turn-message-title"] {
    width: 100%;
    font-size: var(--font-size-large);
    font-weight: 500;
    color: var(--text-strong);
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    white-space: nowrap;
  }

  [data-slot="session-turn-message-title"] h1 {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    white-space: nowrap;
    font-size: inherit;
    font-weight: inherit;
  }

  [data-slot="session-turn-typewriter"] {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    white-space: nowrap;
  }

  [data-slot="session-turn-summary-section"] {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: flex-start;
    align-self: stretch;
  }

  [data-slot="session-turn-summary-header"] {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    align-self: stretch;

    p {
      font-size: var(--font-size-base);
      line-height: var(--line-height-x-large);
    }
  }

  [data-slot="session-turn-summary-title"] {
    font-size: 13px; /* text-12-medium */
    font-weight: 500;
    color: var(--text-weak);
  }

  [data-slot="session-turn-markdown"] {
    &[data-diffs="true"] {
      font-size: 15px;
    }

    &[data-fade="true"] > * {
      animation: fadeUp 0.4s ease-out forwards;
      opacity: 0;

      &:nth-child(1) {
        animation-delay: 0.1s;
      }
      &:nth-child(2) {
        animation-delay: 0.2s;
      }
      &:nth-child(3) {
        animation-delay: 0.3s;
      }
      &:nth-child(4) {
        animation-delay: 0.4s;
      }
      &:nth-child(5) {
        animation-delay: 0.5s;
      }
      &:nth-child(6) {
        animation-delay: 0.6s;
      }
      &:nth-child(7) {
        animation-delay: 0.7s;
      }
      &:nth-child(8) {
        animation-delay: 0.8s;
      }
      &:nth-child(9) {
        animation-delay: 0.9s;
      }
      &:nth-child(10) {
        animation-delay: 1s;
      }
      &:nth-child(11) {
        animation-delay: 1.1s;
      }
      &:nth-child(12) {
        animation-delay: 1.2s;
      }
      &:nth-child(13) {
        animation-delay: 1.3s;
      }
      &:nth-child(14) {
        animation-delay: 1.4s;
      }
      &:nth-child(15) {
        animation-delay: 1.5s;
      }
      &:nth-child(16) {
        animation-delay: 1.6s;
      }
      &:nth-child(17) {
        animation-delay: 1.7s;
      }
      &:nth-child(18) {
        animation-delay: 1.8s;
      }
      &:nth-child(19) {
        animation-delay: 1.9s;
      }
      &:nth-child(20) {
        animation-delay: 2s;
      }
      &:nth-child(21) {
        animation-delay: 2.1s;
      }
      &:nth-child(22) {
        animation-delay: 2.2s;
      }
      &:nth-child(23) {
        animation-delay: 2.3s;
      }
      &:nth-child(24) {
        animation-delay: 2.4s;
      }
      &:nth-child(25) {
        animation-delay: 2.5s;
      }
      &:nth-child(26) {
        animation-delay: 2.6s;
      }
      &:nth-child(27) {
        animation-delay: 2.7s;
      }
      &:nth-child(28) {
        animation-delay: 2.8s;
      }
      &:nth-child(29) {
        animation-delay: 2.9s;
      }
      &:nth-child(30) {
        animation-delay: 3s;
      }
    }
  }

  [data-slot="session-turn-accordion"] {
    width: 100%;
  }

  [data-component="sticky-accordion-header"] {
    top: var(--sticky-header-height, 40px);

    &[data-expanded]::before {
      top: calc(-1 * var(--sticky-header-height, 40px));
    }
  }

  [data-slot="session-turn-accordion-trigger-content"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 20px;

    [data-expandable="false"] {
      pointer-events: none;
    }
  }

  [data-slot="session-turn-file-info"] {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
  }

  [data-slot="session-turn-file-icon"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
  }

  [data-slot="session-turn-file-path"] {
    display: flex;
    flex-grow: 1;
    min-width: 0;
  }

  [data-slot="session-turn-directory"] {
    color: var(--text-base);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
  }

  [data-slot="session-turn-filename"] {
    color: var(--text-strong);
    flex-shrink: 0;
  }

  [data-slot="session-turn-accordion-actions"] {
    flex-shrink: 0;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: flex-end;
  }

  [data-slot="session-turn-accordion-content"] {
    max-height: 240px; /* max-h-60 */
    overflow-y: auto;
    scrollbar-width: none;
  }

  [data-slot="session-turn-accordion-content"]::-webkit-scrollbar {
    display: none;
  }

  [data-slot="session-turn-response-section"] {
    width: calc(100% + 9px);
    min-width: 0;
    margin-left: -9px;
    padding-left: 9px;
  }

  [data-slot="session-turn-collapsible"] {
    gap: 32px;
    overflow: visible;
  }

  [data-slot="session-turn-collapsible-trigger-content"] {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-weak);
    margin-left: -9px;

    [data-component="spinner"] {
      width: 12px;
      height: 12px;
      margin-right: 4px;
    }

    [data-component="icon"] {
      width: 14px;
      height: 14px;
    }
  }
  [data-slot="session-turn-retry-message"] {
    font-weight: 500;
    color: var(--syntax-critical);
  }
  [data-slot="session-turn-retry-seconds"] {
    color: var(--text-weak);
  }
  [data-slot="session-turn-retry-attempt"] {
    color: var(--text-weak);
  }

  [data-slot="session-turn-details-text"] {
    font-size: 13px; /* text-12-medium */
    font-weight: 500;
  }

  .error-card {
    color: var(--text-on-critical-base);
  }

  [data-slot="session-turn-collapsible-content-inner"] {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 12px;

    > :first-child > [data-component="markdown"]:first-child {
      margin-top: 0;
    }
  }
}
