* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    }

img {
    max-width: 100%;
    height: auto;
}
    
    body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #667eea 50%, #764ba2 75%, #667eea 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    }
    
    body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
    radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(135, 206, 250, 0.2) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    }
    
    @keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
    }
    
    @keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
    }
    
    @keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
    }
    
    @keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.02); }
    }
    
    @keyframes fadeIn {
    from {
    opacity: 0;
    transform: translateY(10px);
    }
    to {
    opacity: 1;
    transform: translateY(0);
    }
    }
    
    .app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Динамическая высота viewport для мобильных */
    position: relative;
    z-index: 1;
    }
    
    /* Боковая панель */
    .sidebar {
    width: 280px;
    background: rgba(20, 20, 40, 0.9);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
    position: relative;
    }
    
    .sidebar.hidden {
    transform: translateX(-100%);
    }
    
    .sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    align-items: center;
    }
    
    .new-chat-btn {
    flex: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    }
    
    .new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
    }
    
    .sidebar-toggle {
    display: none;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    }
    
    .chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    }
    
    .chat-history::-webkit-scrollbar {
    width: 6px;
    }
    
    .chat-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    }
    
    .chat-history::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6), rgba(118, 75, 162, 0.6));
    border-radius: 10px;
    }
    
    .chat-item {
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    }
    
    .chat-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    }
    
    .chat-item.active {
    background: rgba(102, 126, 234, 0.3);
    color: white;
    }
    
    .chat-item-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    }
    
    .chat-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    }
    
    .chat-item-delete {
    opacity: 0;
    padding: 4px;
    background: rgba(255, 0, 0, 0.2);
    border: none;
    border-radius: 6px;
    color: #ff6b6b;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1003 !important; /* Выше чем overlay (99) и sidebar (101) */
    pointer-events: auto !important;
    flex-shrink: 0;
    -webkit-tap-highlight-color: rgba(255, 107, 107, 0.3);
    touch-action: manipulation;
    font-size: 20px;
    line-height: 1;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    }
    
    .chat-item:hover .chat-item-delete {
    opacity: 1;
    }
    
    /* На мобильных кнопка удаления всегда видна и больше */
    @media (max-width: 768px) {
    .chat-item-delete {
        opacity: 0.9 !important;
        width: 32px !important;
        height: 32px !important;
        padding: 8px !important;
        font-size: 24px !important;
        z-index: 1004 !important; /* Максимальный приоритет на мобильных */
        background: rgba(255, 0, 0, 0.4) !important;
        pointer-events: auto !important;
        position: relative !important;
    }
    
    .chat-item-delete:active {
        opacity: 1 !important;
        transform: scale(0.85) !important;
        background: rgba(255, 0, 0, 0.6) !important;
    }
    
    /* Увеличиваем область нажатия для Safari */
    .chat-item-delete::before {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        z-index: -1;
        pointer-events: none;
    }
    }
    
    .chat-item-delete:hover {
    background: rgba(255, 0, 0, 0.4);
    }
    
    .sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    }
    
    .donate-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    }
    
    .donate-sidebar-btn:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.5), rgba(118, 75, 162, 0.5));
    transform: translateY(-1px);
    }
    
    .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    }
    
    .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    }
    
    /* Основной контент */
    .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    min-height: 0; /* Позволяет flex-элементам сжиматься */
    }
    
    /* На мобильных разрешаем прокрутку */
    @media (max-width: 768px) {
    .main-content {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    }
    }
    
    .chat-header {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    }
    
    .chat-header h1 {
    font-size: 20px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    
    .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    }
    
    /* Базовые стили для user-block (для desktop) */
    .user-info-container {
    position: relative;
    }
    
    .user-info-desktop {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 10px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    backdrop-filter: blur(6px);
    }
    
    .user-info-mobile {
    display: none;
    }
    
    .user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 8px;
    min-width: 160px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .user-menu-dropdown.active {
    display: block;
    }
    
    .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    border-radius: 8px;
    transition: background 0.2s ease;
    }
    
    .dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    }
    
    .dropdown-item.logout-item {
    color: #ff9a9a;
    }
    
    .dropdown-item svg {
    flex-shrink: 0;
    }
    
    .login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
    0 2px 10px rgba(102, 126, 234, 0.3),
    0 0 20px rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
    }
    
    .login-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    }
    
    .login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
    0 4px 20px rgba(102, 126, 234, 0.5),
    0 0 30px rgba(102, 126, 234, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
    }
    
    .login-btn:active {
    transform: translateY(0);
    }
    
    .login-btn:hover::before {
    width: 300px;
    height: 300px;
    }
    
    .login-btn svg {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    }
    
    .login-btn:hover svg {
    transform: scale(1.1);
    }
    
    .login-btn span {
    position: relative;
    z-index: 1;
    }
    
    .menu-toggle {
    display: none;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    }
    
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: none !important;
}
    
    .welcome-content {
    text-align: center;
    max-width: 600px;
    animation: fadeIn 0.5s ease;
    }
    
    .welcome-content h2 {
    font-size: 36px;
    color: white;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
    
    .welcome-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 32px;
    }
    
    .suggestions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 24px;
    }
    
    .suggestion-btn {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    }
    
    .suggestion-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }
    
    /* Окно чата */
    .chat-window {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 16px;
    -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
    min-height: 0; /* Позволяет flex-элементам сжиматься */
    }
    
    .chat-window::-webkit-scrollbar {
    width: 8px;
    }
    
    .chat-window::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    }
    
    .chat-window::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6), rgba(118, 75, 162, 0.6));
    border-radius: 10px;
    }
    
    .chat-window::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
    }
    
.message {
display: flex;
margin-bottom: 16px;
animation: fadeIn 0.3s ease-in;
max-width: 100%;
align-items: flex-start;
gap: 12px;
}

.message .bubble img {
max-width: 100% !important;
height: auto !important;
object-fit: contain !important;
}
    
    .message.user {
    justify-content: flex-end;
    }
    
.message-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    box-shadow:
        0 4px 15px rgba(102, 126, 234, 0.4),
        0 0 25px rgba(135, 206, 250, 0.35);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
    
    
    .message.user .bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    margin-left: auto;
    box-shadow: 
    0 4px 15px rgba(102, 126, 234, 0.4),
    0 0 20px rgba(102, 126, 234, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    
    .message.bot {
    justify-content: flex-start;
    }
    
    .message.bot .bubble {
    background: linear-gradient(135deg, rgba(135, 206, 250, 0.9), rgba(102, 126, 234, 0.9));
    color: #1a1a2e;
    box-shadow: 
    0 4px 15px rgba(135, 206, 250, 0.4),
    0 0 20px rgba(135, 206, 250, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    
    .bubble {
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 75%;
    line-height: 1.6em;
    word-wrap: break-word;
    position: relative;
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: pre-wrap;
    }
    
    /* Анимация печатания для сообщений бота */
    .typewriter-container {
    position: relative;
    }
    
    .typewriter-active::after {
    content: '▊';
    color: #1a1a2e;
    font-weight: bold;
    animation: typewriterBlink 0.8s ease-in-out infinite;
    margin-left: 3px;
    display: inline-block;
    vertical-align: baseline;
    opacity: 0.8;
    }
    
    @keyframes typewriterBlink {
    0%, 100% { 
        opacity: 0.8; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.3; 
        transform: scale(0.9);
    }
    }
    
    .typewriter-char {
    opacity: 0;
    animation: fadeInChar 0.15s ease-out forwards;
    }
    
    @keyframes fadeInChar {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
    }
    
    .bubble:hover {
    transform: translateY(-2px);
    }
    
    .bubble.typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(135, 206, 250, 0.9), rgba(102, 126, 234, 0.9));
    }
    
    .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1a1a2e;
    animation: typingDot 1.4s ease-in-out infinite;
    }
    
    .typing-dot:nth-child(1) {
    animation-delay: 0s;
    }
    
    .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
    }
    
    .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
    }
    
    @keyframes typingDot {
    0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
    }
    30% {
    transform: translateY(-10px);
    opacity: 1;
    }
    }
    
    /* Область ввода */
    .input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .input-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 4px;
    transition: all 0.3s ease;
    }
    
    .input-container:focus-within {
    border-color: rgba(102, 126, 234, 0.8);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    }
    
    .input-container input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    outline: none;
    background: transparent;
    color: white;
    font-size: 16px;
    }
    
    .input-container input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    }
    
    .input-container button {
    padding: 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
    }
    
    .input-container button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.6);
    }
    
    .input-container button:active {
    transform: scale(0.95);
    }
    
    .input-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    }
    
    .input-container input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    }
    
    /* Оверлей для мобильной версии */
    .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    transition: opacity 0.3s ease;
    pointer-events: none; /* По умолчанию не перехватываем события */
    }
    
    /* Overlay активен только для закрытия сайдбара */
    .sidebar-overlay.active {
    display: block;
    pointer-events: auto;
    }
    
    /* НО! На мобильных отключаем pointer-events у overlay, чтобы он не мешал сайдбару */
    @media (max-width: 768px) {
    .sidebar-overlay.active {
        pointer-events: none; /* Отключаем на мобильных */
    }
    
    /* Вместо этого делаем overlay только справа от сайдбара */
    .sidebar-overlay.active::before {
        content: '';
        position: absolute;
        left: 280px; /* Ширина сайдбара */
        top: 0;
        right: 0;
        bottom: 0;
        pointer-events: auto; /* Только правая часть активна */
    }
    }
    
    /* Сайдбар должен перехватывать все события */
    .sidebar:not(.hidden) {
    pointer-events: auto;
    z-index: 101; /* Выше overlay */
    }
    
    /* Адаптивность */
    @media (max-width: 768px) {
    html, body {
    height: 100%;
    height: 100dvh; /* Динамическая высота viewport для мобильных */
    overflow-x: hidden; /* Только горизонтальная прокрутка заблокирована */
    overflow-y: auto; /* Вертикальная прокрутка разрешена */
    padding: 0;
    margin: 0;
    padding-bottom: env(safe-area-inset-bottom);
    }
    
    body.sidebar-open {
    overflow: hidden;
    }
    
    /* Позволяем прокрутку основного контента на мобильных */
    .app-container {
    height: 100dvh;
    overflow: hidden;
    width: 100%;
    position: relative;
    }
    
    .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 280px;
    z-index: 101;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
    transform: translateX(0);
    transition: transform 0.3s ease;
    }
    
    .sidebar.hidden {
    transform: translateX(-100%);
    }
    
    .sidebar-overlay.active {
    display: block;
    z-index: 100;
    }
    
    /* На мобильных сайдбар должен быть поверх overlay */
    @media (max-width: 768px) {
    .sidebar:not(.hidden) {
    pointer-events: auto;
    z-index: 101;
    position: relative;
    }
    }
    
    .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    }
    
    .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    }
    
    .sidebar-header {
    padding: 12px;
    }
    
    .new-chat-btn {
    padding: 10px 14px;
    font-size: 13px;
    }
    
    .chat-header {
    padding: 12px 16px;
    }
    
    .chat-header h1 {
    font-size: 18px;
    }
    
    .login-btn {
    padding: 8px 14px;
    font-size: 13px;
    }
    
    .login-btn span {
    display: none;
    }
    
    .login-btn svg {
    width: 20px;
    height: 20px;
    }
    
    .header-actions {
    gap: 8px;
    flex-wrap: nowrap;
    overflow: visible;
    }
    
    .user-block {
    flex-shrink: 0;
    }
    
    .menu-toggle {
    flex-shrink: 0;
    min-width: 40px;
    }
    
    /* Мобильные стили для user-block */
    @media (max-width: 768px) {
    .user-info-desktop {
        display: none !important;
    }
    
    .user-info-mobile {
        display: block !important;
    }
    
    .user-avatar-mobile {
        display: block;
        border: 2px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    }
    
    /* Стили для main-content уже определены выше в общем медиа-запросе */
    
    .chat-window {
    padding: 16px 12px;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Плавная прокрутка на iOS */
    flex: 1;
    min-height: 0; /* Позволяет flex-элементам сжиматься */
    }
    
    .message {
    margin-bottom: 12px;
    gap: 8px;
    }
    
    .message-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    aspect-ratio: 1 / 1 !important;
    }
    
    .bubble {
    padding: 12px 16px;
    max-width: 85%;
    font-size: 15px;
    line-height: 1.5em;
    }
    
    .message.user .bubble {
    max-width: 85%;
    }
    
    .welcome-screen {
    padding: 20px 16px;
    }
    
    .welcome-content {
    max-width: 100%;
    }
    
    .welcome-content h2 {
    font-size: 24px;
    margin-bottom: 12px;
    }
    
    .welcome-content p {
    font-size: 15px;
    margin-bottom: 24px;
    }
    
    .suggestions {
    grid-template-columns: 1fr;
    gap: 10px;
    }
    
    .suggestion-btn {
    padding: 14px 18px;
    font-size: 14px;
    }
    
    .input-area {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom) + 12px);
    }
    
    .input-container {
    padding: 3px;
    border-radius: 20px;
    }
    
    .input-container input {
    padding: 12px 16px;
    font-size: 15px;
    }
    
    .input-container button {
    width: 36px;
    height: 36px;
    padding: 8px;
    }
    
    .chat-history {
    padding: 8px 4px;
    }
    
    .chat-item {
    padding: 10px 12px;
    font-size: 13px;
    }
    
    .chat-item-delete {
    opacity: 1 !important;
    }
    
    .chat-item-title {
    font-size: 13px;
    }
    
    .sidebar-footer {
    padding: 12px;
    }
    
    .user-info {
    font-size: 13px;
    }
    
    .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 14px;
    }
    }
    
    @media (max-width: 480px) {
    .sidebar {
    width: 260px;
    }
    
    .chat-header {
    padding: 10px 12px;
    }
    
    .chat-header h1 {
    font-size: 16px;
    }
    
    .login-btn {
    padding: 8px 12px;
    font-size: 12px;
    }
    
    .chat-item-delete {
    opacity: 1 !important;
    }
    
    .welcome-content h2 {
    font-size: 22px;
    }
    
    .welcome-content p {
    font-size: 14px;
    }
    
    .suggestion-btn {
    padding: 12px 16px;
    font-size: 13px;
    }
    
    .bubble {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 14px;
    }
    
    .message-avatar {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    aspect-ratio: 1 / 1 !important;
    }
    
    .input-area {
    padding: 10px;
    padding-bottom: max(20px, env(safe-area-inset-bottom) + 20px);
    }
    
    .input-container input {
    padding: 10px 14px;
    font-size: 14px;
    }
    
    .chat-window {
    padding: 12px 10px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    body {
    -webkit-tap-highlight-color: transparent;
    }
    
    button, .chat-item {
    -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    }
    }
    
    /* Стили для аватарки бота */
    .bot-avatar {
        width: 38px !important;
        height: 38px !important;
        max-width: 38px !important;
        max-height: 38px !important;
        display: block !important;
        border-radius: 50% !important;
        object-fit: cover !important;
        margin-right: 12px !important;
        flex-shrink: 0 !important;
        overflow: hidden !important;
    }
    
    .bot-avatar img {
        width: 100% !important;
        height: 100% !important;
        max-width: 38px !important;
        max-height: 38px !important;
        object-fit: cover !important;
        display: block !important;
    }
    
.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots .dot {
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: 0s;
}
.typing-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-4px); }
    100% { opacity: 0.3; transform: translateY(0); }
}

/* ==============================================
   СТИЛИ ДЛЯ ЗАГРУЗКИ ИЗОБРАЖЕНИЙ
   ============================================== */
.image-upload-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    flex-shrink: 0;
}

.image-upload-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
}

.image-upload-btn:active {
    transform: scale(0.95);
}

.image-upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    pointer-events: none;
}

.image-preview {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.image-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: white;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.remove-image-btn:hover {
    background: rgba(255, 0, 0, 0.9);
    transform: scale(1.1);
}

.remove-image-btn:active {
    transform: scale(0.9);
}

/* Стили для изображений в сообщениях */
.message .bubble img {
    display: block;
    margin-bottom: 8px;
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .image-preview img {
        max-width: 150px;
        max-height: 150px;
    }
    
    .image-upload-btn {
        padding: 8px;
    }
}