.fade-in-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, visibility;
}
.fade-in-section.is-visible {
    opacity: 1;
    transform: none;
}

.chat-scroll::-webkit-scrollbar {
    width: 8px;
}

.chat-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.chat-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 999px;
}

.chat-msg {
    display: flex;
    animation: chatFadeUp 180ms ease-out;
}

.chat-msg-user {
    justify-content: flex-end;
}

.chat-msg-assistant {
    justify-content: flex-start;
}

@keyframes chatFadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth theme color transition */
html, body, body * {
    transition-property: background-color, color, border-color, box-shadow;
    transition-duration: 250ms;
    transition-timing-function: ease-out;
}

@media (max-width: 640px) {
    main {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-top: 18px !important;
    }

    #hero-header {
        display: flex;
        align-items: start;
        border-radius: 0;
        padding: 10px 6px;
        gap: 8px;
        margin-bottom: 18px;
    }

    #hero-image-wrap {
        width: 160px;
        height: 160px;
        min-width: 160px;
        min-height: 160px;
        max-width: 160px;
        max-height: 160px;
        flex: 0 0 160px;
        align-self: start;
    }

    #hero-image-wrap #profile-image {
        border-radius: 0;
        object-fit: cover;
    }

    #hero-content {
        width: auto;
        max-width: none;
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        padding-top: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    #hero-top-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 6px;
        width: 100%;
        min-width: 0;
        align-items: flex-start;
    }

    #hero-top-row h1 {
        font-size: 13px !important;
        line-height: 1.15;
        flex: 1 1 auto;
        min-width: 0;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 3px;
        column-gap: 3px;
    }

    #hero-name-text {
        min-width: 0;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
        overflow-wrap: normal;
    }

    #hero-verified {
        width: 14px !important;
        height: 14px !important;
        flex: 0 0 auto;
        margin-top: 0 !important;
    }

    #hero-top-row svg {
        margin-top: 0;
    }

    #theme-toggle {
        width: 38px;
        height: 22px;
        padding: 2px;
        flex: 0 0 auto;
        justify-self: end;
    }

    #theme-toggle #switch-thumb {
        width: 12px;
        height: 12px;
    }

    #theme-toggle #sun-icon,
    #theme-toggle #moon-icon {
        font-size: 7px;
    }

    #hero-header p {
        font-size: 11px !important;
        margin-top: 2px;
    }

    #hero-role {
        font-size: 8px !important;
        margin-bottom: 10px;
        line-height: 1.15;
        gap: 3px;
        flex-wrap: nowrap;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #hero-role > span,
    #hero-role > span * {
        font-size: 8px !important;
    }

    #hero-role > span:first-of-type {
        display: none;
    }

    #hero-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
    }

    #hero-actions .hero-btn {
        min-width: 0 !important;
        width: 100%;
        border-radius: 0;
        padding: 8px 6px;
        font-size: 9px;
        box-shadow: none;
        transform: none !important;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }

    #hero-actions .hero-btn > div {
        min-width: 0;
        overflow: visible;
        white-space: nowrap;
    }

    #hero-actions .hero-btn > div {
        gap: 4px;
    }

    #hero-actions .hero-btn svg {
        width: 11px !important;
        height: 11px !important;
    }

    #hero-actions .hero-btn svg:last-child {
        opacity: 0.9;
    }

    #hero-actions .hero-btn-highlight {
        grid-column: 1 / -1;
        justify-content: space-between;
    }
}