* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
	background: #f2f0f5;
    overflow-x: clip;
    width: 100%;
}

html {
    overflow-x: clip;
    width: 100%;
}

/* Стили для страниц входа и регистрации */
body.register-page .site-header .main-nav,
body.login-page .site-header .main-nav,
body.register-page .site-header .login-nav,
body.login-page .site-header .login-nav,
body.register-page .site-header .header-subject-dropdown-wrapper,
body.login-page .site-header .header-subject-dropdown-wrapper {
    display: none !important;
}

body.register-page .site-header .feedback-header-btn,
body.login-page .site-header .feedback-header-btn {
    display: flex !important;
}

@media screen and (max-width: 1230px) {
    body.register-page .auth-container,
    body.login-page .auth-container {
        padding-top: 100px !important;
        align-items: flex-start !important;
    }
}



body.chat-page .header-new-chat,
body.chat-page .header-chats-btn,
body.chat-page .header-book-btn,
.header-subject-btn {
    display: flex !important;
}

body.chat-page .go-to-learning-link {
    display: none !important;
}

body:not(.chat-page) .header-new-chat,
body:not(.chat-page) .header-chats-btn,
body:not(.chat-page) .header-book-btn {
    display: none !important;
}

body.chat-page {
    background-color: #e9e5eb !important;
}

body.welcome-page {
    background-color: #f2f0f5 !important;
}

.site-header {
    position: sticky;
    top: 5px;
    margin: 5px 20px 0;
    padding: 0 2rem;
    background: rgba(87, 63, 95, 0.95);
    height: 80px;
    z-index: 1100;
    border-radius: 20px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.header-container {
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
    height: 100%;
    position: relative;
}

    .logo-group {
        display: flex;
        align-items: center;
        gap: 20px;
    }

.feedback-header-btn {
    font-size: 13px !important;
    padding: 8px 18px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50px !important;
    height: 40px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: white !important;
    transition: all 0.3s ease !important;
    backdrop-filter: blur(5px);
}

.feedback-header-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.feedback-header-btn i {
    font-size: 14px;
    opacity: 0.9;
}

/* Стили для центрирования навигации в ПК версии */
.main-nav.desktop-subjects {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 530px; /* Принудительно 6 и 5 кнопок */
    z-index: 1000;
}

.main-nav.desktop-subjects ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 8px 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.main-nav.desktop-subjects .nav-btn {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 80px;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    font-style: italic;
}

.logo-link {
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.main-nav ul,
.login-nav ul {
    list-style: none;
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-btn {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Выделение активного предмета */
.nav-btn.active-subject {
    background: #ff4d94 !important;
    color: white !important;
    opacity: 1 !important;
    box-shadow: 0 4px 12px rgba(255, 77, 148, 0.3);
    border-color: #ff4d94;
}

/* Специальные стили для кнопок предметов в десктопной версии */
.main-nav.desktop-subjects .nav-btn {
    padding: 6px 12px;
    font-size: 13px;
}

/* Адаптивные стили для кнопок предметов */
@media screen and (min-width: 1400px) {
    .main-nav.desktop-subjects {
        max-width: min(calc(100vw - 550px), 750px); /* На больших экранах с увеличенным защитным отступом */
    }
}

@media screen and (max-width: 1399px) and (min-width: 1201px) {
    .main-nav.desktop-subjects {
        max-width: calc(100vw - 600px); /* Промежуточный размер с увеличенной защитой */
    }
}

@media screen and (max-width: 1200px) and (min-width: 951px) {
    .main-nav.desktop-subjects {
        max-width: calc(100vw - 650px); /* На средних экранах максимальный защитный отступ */
    }
}

.nav-btn:hover {
	background: rgba(255, 255, 255, 0.25);
}

a.nav-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 1);
    font-weight: 600;
}

a.nav-btn.disabled {
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    cursor: not-allowed;
}

.register {
	background: rgba(255, 255, 255, 0.15);
}

.register:hover {
	background: rgba(255, 255, 255, 0.35);
}

.user-menu {
	position: relative;
	z-index: 1050; /* Поверх всех других элементов */
}

.user-menu-trigger {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-menu-trigger:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05) translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-menu-trigger svg {
    width: 32px;
    height: 32px;
    /* Добавь vertical-align: middle; */
    vertical-align: middle;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: -20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 8px 0;
    min-width: 150px;
    z-index: 1050;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: #333;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background-color: #f5f5f5;
}

.user-menu:hover .dropdown-menu {
    display: block;
}

.variant-label {
	background: #fff;
	padding: 1rem;
	color: #333;
	font-weight: 500;
}

.main-container {
    display: flex;
    height: calc(100vh - 105px); /* Учитываем зазоры сверху */
    width: 100%;
    position: relative;
    gap: 0;
    padding: 0;
    margin: 10px 0 0 0;
    border-radius: 24px 24px 0 0;
    background: #ffffff;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.05);
    overflow: hidden;
}

.chat-and-saved-container {
    flex: 1;
    display: flex;
    overflow-y: auto;
    height: calc(100vh - 105px);
    position: relative;
    margin: 0;
    padding: 0;
    width: 100%;
}

.contents-container {
    width: 330px;
    background: white;
    overflow-y: auto;
    padding: 30px 20px 20px 20px;
    height: calc(100vh - 105px);
    position: sticky;
    top: 0;
    left: 0;
    flex-shrink: 0;
    margin: 0;
}

.main-container::-webkit-scrollbar {
    width: 8px;
    position: fixed;
    right: 0;
}

.main-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.main-container::-webkit-scrollbar-thumb {
    background: #c4adc5;
    border-radius: 4px;
}

.main-container::-webkit-scrollbar-thumb:hover {
    background: #647697;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 105px); /* Учитываем высоту заголовка */
    width: 100%;
    position: relative;
    margin: 0;
    overflow: hidden;
}

.saved-chats-container {
    display: none; /* Hide the side panel */
}

.saved-chats-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1100;
    backdrop-filter: blur(5px);
}

.saved-chats-modal-content {
    background: #faf9ff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    padding: 0;
    position: relative;
    overflow: hidden;
    box-shadow: none; /* Полностью убираем тень */
}

.saved-chats-modal-header {
    position: sticky;
    top: 0;
    background: #faf9ff;
    padding: 20px 30px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    z-index: 2;
}

.saved-chats-list-container {
    padding: 0 30px 30px 30px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.saved-chats-list-container::-webkit-scrollbar {
    width: 8px;
}

.saved-chats-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
    margin: 4px;
}

.saved-chats-list-container::-webkit-scrollbar-thumb {
    background: #adb6c5;
    border-radius: 4px;
}

.saved-chats-list-container::-webkit-scrollbar-thumb:hover {
    background: #647697;
}

.saved-chats-modal-inner {
    height: 100%;
    max-height: calc(90vh - 90px); /* Adjust based on header height and padding */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px; /* Add some padding for the scrollbar */
    margin-right: -5px; /* Offset the padding */
}

.saved-chats-modal-content::-webkit-scrollbar {
    width: 8px;
}

.saved-chats-modal-content::-webkit-scrollbar-track {
    margin: 16px 0;
    background: #f1f1f1;
    border-radius: 4px;
}

.saved-chats-modal-content::-webkit-scrollbar-thumb {
    background: #adb6c5;
    border-radius: 4px;
}

.saved-chats-modal-content::-webkit-scrollbar-thumb:hover {
    background: #647697;
}

.saved-chats-list-container {
    padding: 25px;
}

#saved-chats-list {
    list-style: none;
    padding: 0;
}

#saved-chats-list li {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

#saved-chats-list li:hover {
    background-color: #f5eef5;
}

.saved-chats-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: #573f5f;
    margin-bottom: 15px;
}

.saved-chats-container ul {
    list-style: none;
    padding: 0;
}

.saved-chats-container li {
    padding: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.saved-chats-container li:hover {
    background-color: #f5eef5;
}

.saved-chats-container .new-chat-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 20px;
    background: #33583d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.saved-chats-container .new-chat-btn:hover {
    background: #2a4832;
    transform: translateY(-1px);
}

.chat-options button {
    padding: 5px 10px;
    margin-left: 5px;
    background: #573f5f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.chat-options button:hover {
    background: #4a344c;
}

.select-textbook-btn {
    border-radius: 6px;
    background: #33583d;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: fit-content;
    margin: -12px auto 10px auto;
    display: block;
    font-weight: 500;
    padding: 10px 20px;
    font-size: 15px;
    box-shadow: none;
}

.select-textbook-btn:hover {
    background: #2a4832;
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
}

.send-btn {
    margin: 0;
    display: inline-flex;
}

.textbook-dropdown {
    position: relative;
    padding: 0;
    margin-top: 10px;
    width: 100%;
    display: flex;
    align-items: center;
}

.collapse-btn {
    display: none;
}

.collapse-btn:hover {
    display: none;
}

.collapse-btn svg {
    display: none;
}

.selected-textbook {
    padding: 10px;
    background-color: #f5eef5;
    border-radius: 8px;
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    width: calc(100% + 3px);
    max-width: calc(100% + 3px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.selected-book-cover {
    flex: 0 0 50px;
    width: 50px;
    height: 70px;
    min-width: 50px;
}

.selected-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin-bottom: 0;
}

.selected-book-info {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    flex: 0 1 auto;
    text-align: left;
    padding: 0;
    white-space: normal;
    overflow: hidden;
    line-height: 1.3;
    max-height: 70px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.textbook-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#contents-list {
    list-style: none;
}

.chapter-title {
    font-size: 15px;
    font-weight: 600;
    color: #573f5f;
    padding: 12px 8px;
    margin: 10px 0 5px 0;
    background: #f5eef5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chapter-title:hover {
    background: #ebe0eb;
}

.paragraph-item {
    font-size: 14px;
    padding: 8px 8px 8px 20px;
    margin: 2px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    color: #573f5f;
}

.paragraph-item:hover {
    background: #f5eef5;
    color: #573f5f;
}

#contents-list ul {
    list-style: none;
}

.chat-box {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Занимает оставшееся пространство */
    background: #e9e5eb;;
    width: 100%;
    position: relative;
    max-width: none;
    box-sizing: border-box;
    overflow-y: auto; /* Добавляем прокрутку */
}

.messages-area {
    height: auto;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-grow: 1;
    background-color: #e9e5eb;
}

.message {
    max-width: 800px;
    padding: 15px 20px;
    border-radius: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    width: fit-content;
    min-width: 50px;
    word-wrap: break-word; /* Ensure long tokens do not overflow */
    overflow-wrap: anywhere; /* Prefer wrapping anywhere to avoid overflow */
    word-break: break-word;
}

.chatgpt-message {
    margin-right: auto;
    margin-left: 0;
    background: white;
    max-width: 720px;
    width: fit-content;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chatgpt-message ul {
    margin-left: 40px;
    margin-bottom: 20px;
}

.chatgpt-message h1, .chatgpt-message h2, .chatgpt-message h3, .chatgpt-message h4, .chatgpt-message h5, .chatgpt-message h6 {
    margin-bottom: 15px;
    font-size: 18px;
}

.user-message {
    position: relative;
    left: min(800px, 100%);
    transform: translateX(-100%);
    background: #f4f7fc;
    color: #333;
    max-width: 720px;
    width: fit-content;
    align-self: flex-start;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.system-message {
    max-width: 90%;
    background: #d9e4d9;
    
}

.message p {
    margin-bottom: 10px;
    white-space: pre-wrap; /* Preserve newlines and wrap long text */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message p:last-child {
    margin-bottom: 0;
}

.message ol {
    padding-left: 20px;
    margin: 10px 0;
}

.message li {
    margin-bottom: 8px;
}

.message li:last-child {
    margin-bottom: 0;
}

.message .image-message {
    margin: 5px;
    max-width: 100%;
    display: inline-block;
}

.message .image-message img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

/* Добавляем новые стили для контейнера изображений */
.message .images-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
    max-width: 100%;
}

/* Текст сообщения должен быть ниже изображений */
.message .message-text {
    margin-top: 8px;
    display: block;
    width: 100%;
    clear: both;
}

.input-area {
    position: relative;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 5px 70px 5px 70px;
    background: #e9e5eb;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    padding-left: 17%;
    min-height: 60px; /* Минимальная высота */
    flex-shrink: 0; /* Не позволяет уменьшаться */
}

.message-input-container {
    display: flex;
    gap: 8px;
    width: 800px;
    background: transparent;
    padding: 2px;
    border-radius: 20px;
    position: relative;
}

.input-section {
    flex: 1;
    background: #ffffff;
    border-radius: 20px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
    min-height: 48px;
    position: relative;
    height: auto;
    max-height: 230px; /* Увеличиваем максимальную высоту контейнера, чтобы вместить textarea */
    overflow: visible;
}

#message-input {
    width: 100%;
    overflow-y: auto;
    padding: 0;
    border: none;
    resize: none;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
    background: transparent;
    min-height: 24px;
    max-height: 180px; /* Меняем максимальную высоту до 180px */
    height: auto;
    box-sizing: border-box;
    white-space: pre-wrap; /* Keep newline characters and wrap long words */
    overflow-wrap: anywhere;
    word-break: break-word;
}

#message-input::-webkit-scrollbar {
    width: 6px;
}

#message-input::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#message-input::-webkit-scrollbar-thumb {
    background: #c7c7c7;
    border-radius: 3px;
}

#message-input::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

#message-input:focus {
    outline: none;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: none;
}

.send-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
}

.send-btn svg {
    width: 36px;
    height: 36px;
}

.send-btn svg path {
    stroke: #33583d;
    stroke-width: 3;
}

.switch-button {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.message-actions {
    display: flex;
    flex-wrap: wrap; /* Позволяет создавать ряды */
    align-items: flex-start; /* Выравниваем по левому краю */
    gap: 8px;
    margin-top: 0px; /* Добавляем отступ сверху */
    position: relative;
    padding-left: 0;
    margin-bottom: 15px; /* Отступ снизу */
}

/* Кнопка "Продолжай объяснение" занимает всю ширину в своем ряду */
.start-explanation-btn {
    width: fit-content; /* Ширина по содержимому */
    margin-top: 8px; /* Отступ от верхнего ряда кнопок */
    flex-basis: 100%; /* Заставляет элемент начинаться с новой строки */
}

.example-btn, .explain-btn, .start-explanation-btn, .suggestion-btn, .action-btn {
    padding: 8px 18px;
    background: #ff4d94;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(255, 77, 148, 0.2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    border: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: none;
}

.suggestion-btn {
    display: inline-block; /* Dynamic buttons should be visible when added */
}

.example-btn:hover, .explain-btn:hover, .start-explanation-btn:hover, .suggestion-btn:hover, .action-btn:hover {
    background: #e64082;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 77, 148, 0.3);
}

.btn-icon {
    font-size: 14px;
}

.chat-options {
    position: relative;
}

.options-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.options-menu {
    position: absolute;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    display: none;
}

.chat-options:hover .options-menu {
    display: block;
}

.options-menu button {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
}

.options-menu button:hover {
    background: #f0f0f0;
}

.switch-button input {
    display: none;
}

.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: #ccc;
    border-radius: 20px;
    cursor: pointer;
}

.slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

.switch-button input:checked + .slider {
    background: #01d80c;
}

.switch-button input:checked + .slider:before {
    transform: translateX(20px);
}

.contents-container h3 {
    font-size: 16px;
    font-weight: 600;
    color: #556686;
    padding: 15px;
    margin: 0;
    border-bottom: 1px solid #eee;
}

.chat-and-saved-container::-webkit-scrollbar {
    width: 8px;
    position: absolute;
    right: 0;
}

.chat-and-saved-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-and-saved-container::-webkit-scrollbar-thumb {
    background: #adb6c5;
    border-radius: 4px;
}

.chat-and-saved-container::-webkit-scrollbar-thumb:hover {
    background: #647697;
}

.welcome-bg-animated {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: #f2f0f5; /* Еще более бледный и светлый фон */
}

.welcome-container {
    background: transparent; /* Убираем фон у контейнера, так как он теперь сзади */
    min-height: calc(100vh - 80px);
    position: relative;
}

.welcome-hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 40px 0;
    position: relative;
    /* Убрали min-height, чтобы не было огромного отступа вниз */
}

.welcome-text-side {
    width: 100%;
    text-align: center;
    max-width: 900px;
    z-index: 2;
}

.welcome-phone-side {
    position: absolute;
    right: 180px; /* Еще чуть левее */
    top: 20%; /* Подняли еще выше (было 40%) */
    transform: translateY(-160%); /* Оставили трансформацию для сохранения баланса */
    z-index: 1;
}

.hero-phone .phone-frame {
    transform: rotateY(-8deg) rotateX(5deg) rotateZ(-2deg); /* Уменьшили наклон для лучшей читаемости */
    width: 260px;
    height: 540px;
}

.hero-phone:hover .phone-frame {
    transform: rotateY(-5deg) rotateX(5deg) translateY(-10px);
}

.phone-input-area {
    padding: 10px 15px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.fake-input-field {
    flex: 1;
    background: #f0f0f0;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 12px;
    color: #999;
}

.fake-send-circle {
    width: 30px;
    height: 30px;
    background: #573f5f;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Адаптивность для первого экрана */
@media (max-width: 1200px) {
    .welcome-phone-side {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        margin-top: 40px;
    }
    
    .welcome-hero-content {
        padding-top: 40px;
        min-height: auto;
    }
}

.welcome-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

.main-title {
    font-size: 3rem; 
    color: #4a3550;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-shadow: 0 3px 6px rgba(87, 63, 95, 0.1);
}

.subtitle {
    font-size: 1.8rem;
    color: #4a3550;
    text-align: center;
    margin-bottom: 40px;
    font-weight: 500;
    line-height: 1.4;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    text-shadow: 0 2px 4px rgba(87, 63, 95, 0.08);
}

.features-list-fun {
    list-style: none;
    padding: 0;
    margin: 0 auto 50px;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.features-list-fun li {
    background: #ffffff;
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 15px 35px rgba(87, 63, 95, 0.15); /* Еще усилили тень */
    font-size: 1.2rem;
    color: #3d2b42;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
    width: fit-content;
}

/* Эффект "вразнобой" */
.features-list-fun li:nth-child(1) { transform: rotate(-1.5deg) translateX(-20px); }
.features-list-fun li:nth-child(2) { transform: rotate(1deg) translateX(25px); }
.features-list-fun li:nth-child(3) { transform: rotate(-0.5deg) translateX(-15px); }
.features-list-fun li:nth-child(4) { transform: rotate(1.2deg) translateX(10px); }

.features-list-fun li:hover {
    transform: scale(1.08) rotate(0deg) translateX(0) !important;
    border-color: #ff4d94;
    box-shadow: 0 15px 35px rgba(255, 77, 148, 0.2);
}

.features-list-fun li svg.ai-sparkle-icon {
    width: 24px;
    height: 24px;
    color: #ff4d94;
    filter: drop-shadow(0 2px 4px rgba(255, 77, 148, 0.3));
    flex-shrink: 0;
}

.use-cases-section {
    margin: 60px 0 80px; /* Уменьшили на 20% по просьбе пользователя */
    text-align: center;
}

.use-cases-title {
    font-size: 2.5rem;
    color: #4a3550;
    margin-bottom: 40px;
    font-weight: 700;
    text-shadow: 0 3px 6px rgba(87, 63, 95, 0.1); /* Еще усилили тень */
}

.use-cases-bento {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: 20px;
    max-width: 1100px;
    margin: 50px auto 0;
    padding: 0 20px;
}

.use-case-card {
    background: #ffffff;
    border-radius: 28px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 20px 45px rgba(87, 63, 95, 0.15); /* Еще усилили тень */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Цветовые вариации для Bento Grid */
.bento-purple { background: linear-gradient(135deg, #f3e5f5 0%, #ffffff 100%); }
.bento-red    { background: linear-gradient(135deg, #ffebee 0%, #ffffff 100%); }
.bento-yellow { background: linear-gradient(135deg, #fffde7 0%, #ffffff 100%); }
.bento-blue   { background: linear-gradient(135deg, #e3f2fd 0%, #ffffff 100%); }
.bento-pink   { background: linear-gradient(135deg, #fce4ec 0%, #ffffff 100%); }
.bento-cyan   { background: linear-gradient(135deg, #e0f7fa 0%, #ffffff 100%); }
.bento-orange { background: linear-gradient(135deg, #fff3e0 0%, #ffffff 100%); }
.bento-green  { background: linear-gradient(135deg, #e8f5e9 0%, #ffffff 100%); }
.bento-indigo { background: linear-gradient(135deg, #e8eaf6 0%, #ffffff 100%); }

/* Размеры карточек в Bento Grid */
.bento-wide { grid-column: span 2; }
.bento-tall { grid-row: span 2; }

.use-case-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-color: rgba(255, 77, 148, 0.2);
}

.use-case-emoji {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.use-case-card:hover .use-case-emoji {
    transform: scale(1.1) rotate(5deg);
}

.use-case-emoji img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.use-case-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #3d2b42;
    line-height: 1.4;
}

/* Адаптивность для Bento */
@media (max-width: 992px) {
    .use-cases-bento {
        grid-template-columns: repeat(2, 1fr);
    }
    .bento-wide { grid-column: span 2; }
}

@media (max-width: 600px) {
    .use-cases-bento {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: auto;
        gap: 10px; /* Smaller gap */
    }
    .bento-wide, .bento-tall {
        grid-column: span 1;
        grid-row: span 1;
    }
    .use-case-card {
        padding: 15px; /* Reduced padding */
        border-radius: 18px; /* Slightly smaller radius */
    }
    .use-case-emoji {
        width: 45px; /* Smaller icons */
        height: 45px;
        margin-bottom: 10px;
    }
    .use-case-text {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    .main-title {
        font-size: 1.8rem; /* Smaller title for tiny screens */
        margin-top: 20px;
        margin-bottom: 20px;
        padding: 0 10px;
    }
}

/* Стили для Развилки "Как это работает" */
.how-it-works-section {
    margin: 100px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.common-step {
    max-width: 400px;
    margin: 0 auto 60px;
    background: #ffffff;
    padding: 20px;
    border-radius: 30px;
    box-shadow: 0 10px 30px rgba(87, 63, 95, 0.08);
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 2;
    border: 3px solid #f0edf2;
}

.step-num-big {
    background: #ff4d94;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(255, 77, 148, 0.3);
}

.paths-wrapper {
    display: flex;
    gap: 40px;
    justify-content: center;
    position: relative;
    width: 100%;
}

/* Пунктирные линии-пути */
.paths-wrapper::before {
    content: '';
    position: absolute;
    top: -50px;
    left: 50%;
    width: 2px;
    height: 50px;
    border-left: 3px dashed #ff4d94;
    transform: translateX(-50%);
    opacity: 0.5;
}

.path-column {
    flex: 1;
    max-width: 450px;
    background: rgba(255, 255, 255, 0.6);
    padding: 30px;
    border-radius: 40px;
    border: 2px dashed #d1c5d6;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.3s ease;
}

.path-column:hover {
    background: #ffffff;
    border-color: #ff4d94;
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(87, 63, 95, 0.08);
}

.path-title {
    font-size: 1.5rem;
    color: #573f5f; /* Темно-фиолетовый */
    font-weight: 800;
    margin-bottom: 10px;
    text-align: center;
}

.path-step {
    display: flex;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(87, 63, 95, 0.03);
    border: 1px solid #f0edf2;
}

.step-num-small {
    background: #ff4d94;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    flex-shrink: 0;
}

.path-step span {
    font-size: 1.15rem;
    color: #573f5f;
    font-weight: 600;
    line-height: 1.4;
}

/* Стили для блока "Решение задач" */
.solving-tasks-section {
    margin: 100px 0;
    text-align: center;
}

.solving-tasks-content {
    position: relative;
    max-width: 1800px; /* Увеличили еще больше, чтобы дать простор для маневра */
    margin: 50px auto 0;
    padding: 0 40px;
    min-height: 650px;
}

.solving-tasks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    max-width: 900px;
    margin: 0 auto; /* Карточки ровно по центру */
}

/* Мокап телефона */
.phone-mockup-wrapper {
    position: absolute;
    right: -360px; /* Сместили еще на 340 пикселей вправо (было -20px) */
    top: -20px;
    width: 320px;
    perspective: 1200px;
    filter: drop-shadow(0 30px 60px rgba(87, 63, 95, 0.2));
    z-index: 5;
}

@media (max-width: 1300px) {
    .phone-mockup-wrapper {
        position: relative;
        right: auto;
        top: 0;
        margin: 40px auto 0;
        display: flex;
        justify-content: center;
    }
    
    .solving-tasks-content {
        min-height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

.phone-frame {
    width: 300px;
    height: 620px;
    background: #1a1a1a;
    border-radius: 36px; /* Еще немного уменьшили радиус */
    padding: 4px; /* Ультратонкая рамка (было 8px) */
    position: relative;
    transform: rotateY(-12deg) rotateX(5deg) rotateZ(1deg);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    /* Максимальная детализация для тонкой рамки */
    box-shadow: 
        0 0 0 1px #333,
        0 15px 40px rgba(0, 0, 0, 0.2);
}

.phone-mockup-wrapper:hover .phone-frame {
    transform: rotateY(-2deg) rotateX(2deg) translateY(-10px);
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: #f2f0f5;
    border-radius: 32px; /* Подправили под ультратонкую рамку */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid #000;
}

/* Телефонный хедер */
.phone-header {
    background: #573f5f;
    color: white;
    padding: 8px 15px 12px;
}

.phone-status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 10px;
    opacity: 0.8;
}

.status-icons {
    display: flex;
    gap: 5px;
}

.phone-app-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-logo-mini {
    font-weight: 800;
    font-size: 15px;
    font-style: italic;
    letter-spacing: -0.5px;
}

.app-subject-badge {
    background: #ff4d94;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 77, 148, 0.3);
}

/* Область чата в телефоне */
.phone-chat-area {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: hidden;
    background: #f2f0f5;
}

.phone-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
    animation: phoneMsgPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes phoneMsgPop {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.user-msg { align-self: flex-end; }
.ai-msg { align-self: flex-start; animation-delay: 0.8s; }

.msg-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 13px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

.user-msg .msg-bubble {
    background: #007aff; /* Голубой цвет как в примере */
    color: white;
    border-bottom-right-radius: 4px;
    padding: 8px 12px; /* Уменьшили высоту сообщения пользователя */
}

.ai-msg .msg-bubble {
    background: white;
    color: #000000; /* Чистый черный цвет текста */
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Вложение (фото) */
.msg-attachment {
    margin-top: 8px;
}

.task-photo-placeholder {
    background: rgba(255, 255, 255, 0.2); /* Светлее на голубом фоне */
    border: 1px dashed rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    padding: 6px 10px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}

.task-photo-placeholder i { font-size: 1rem; }

/* Оформление решения в телефоне */
.solution-content {
    background: #fcfaff;
    border-radius: 14px;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid #573f5f;
    text-align: left;
}

.sol-tag {
    font-weight: 700; /* Уменьшили жирность с 800 */
    color: #000000;
    font-size: 12px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 6px;
}

.sol-item p { 
    margin: 0 0 10px 0; 
    color: #000000; /* Черный текст */
}

.formula {
    font-family: "Times New Roman", Times, serif;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Сдвинули левее */
    gap: 5px;
    margin: 10px 0;
    font-size: 14px;
    color: #000000; /* Черный цвет */
}

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    font-size: 12px;
}

.fraction .num { border-bottom: 1.5px solid #000; padding: 0 4px; }
.fraction .den { padding: 0 4px; }

.intro-text, .outro-text { font-size: 12px; font-weight: 600; color: #333; }
.intro-text { font-size: 12px; font-weight: 600; color: #7d6a82; }

/* Кнопка действия ИИ в телефоне */
.ai-action-btn {
    align-self: flex-start;
    margin-top: 10px;
    background: #ff4d94;
    color: white;
    padding: 8px 20px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(255, 77, 148, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: phoneMsgPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    animation-delay: 1.2s; /* Появляется после основного баббла */
}

.ai-action-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Поле ввода в телефоне */
.phone-input-area {
    padding: 12px 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fake-input-field {
    flex: 1;
    background: #f5f5f7;
    border-radius: 22px;
    padding: 10px 18px;
    font-size: 12px;
    color: #a1a1a6;
}

.fake-send-circle {
    width: 34px;
    height: 34px;
    background: #573f5f;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

@media (max-width: 1100px) {
    .solving-tasks-content {
        gap: 30px;
    }
}

@media (max-width: 950px) {
    .solving-tasks-content {
        flex-direction: column;
        padding: 0 15px; /* Уменьшили боковые отступы контейнера */
    }
    
    .solving-tasks-grid {
        grid-template-columns: 1fr;
        width: 100%; /* Занимаем всю доступную ширину */
        max-width: 600px; /* Но не делаем карточки слишком огромными на планшетах */
        padding: 0;
    }
    
    .solving-task-card {
        padding: 25px 20px; /* Немного компактнее отступы внутри карточки */
        border-radius: 30px;
    }
    
    .phone-mockup-wrapper {
        margin-top: 40px;
        flex: none;
        transform: scale(0.9);
    }
}

.solving-task-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 40px;
    box-shadow: 0 25px 55px rgba(87, 63, 95, 0.18); /* Еще усилили тень */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid transparent;
}

.solving-task-card:hover {
    transform: translateY(-15px);
    border-color: #ff4d94;
    box-shadow: 0 25px 50px rgba(255, 77, 148, 0.12);
}

.solving-task-icon {
    font-size: 2.5rem;
    color: #ff4d94;
    background: #fff0f6;
    width: 90px;
    height: 90px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}

.solving-task-card:hover .solving-task-icon {
    transform: scale(1.1) rotate(5deg);
}

.solving-task-card h3 {
    font-size: 1.5rem;
    color: #4a3550;
    margin: 0;
    font-weight: 700;
}

.solving-task-card p {
    font-size: 1.1rem;
    color: #5d4d62;
    line-height: 1.5;
    margin: 0;
}

/* Стили для Облака навыков (Floating Cloud) */
.skills-cloud-section {
    margin: 100px 0;
    text-align: center;
    overflow: hidden;
    padding: 40px 0;
}

.skills-cloud-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px; /* Увеличил отступ между баблами */
    max-width: 1100px;
    margin: 0 auto;
    perspective: 1000px;
}

.skill-bubble {
    background: #ffffff;
    padding: 15px 30px;
    border-radius: 100px;
    box-shadow: 0 15px 35px rgba(87, 63, 95, 0.15); /* Еще усилили тень */
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #3d2b42;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
    border: 2px solid transparent;
    animation: float-bubble 12s ease-in-out infinite;
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
    will-change: transform;
    transform: translateZ(0);
    text-decoration: none; /* Убираем подчеркивание, если это ссылка */
}

.skill-bubble-link {
    cursor: pointer !important;
}

.skill-bubble-link:hover {
    border-color: #0088cc !important;
    box-shadow: 0 20px 40px rgba(0, 136, 204, 0.2) !important;
}

.skill-bubble-link span.tg-link-text {
    color: #0088cc;
    text-decoration: underline;
    text-decoration-color: rgba(0, 136, 204, 0.4);
    text-underline-offset: 4px;
    font-weight: 800;
}

.skill-bubble-link:hover span.tg-link-text {
    text-decoration-color: #0088cc;
}

.skill-bubble i {
    color: #ff4d94;
    font-size: 1.3rem;
}

.skill-bubble:hover {
    animation-play-state: paused;
    transform: translateY(-5px) translateZ(0) !important;
    border-color: rgba(255, 77, 148, 0.3);
    box-shadow: 0 15px 30px rgba(87, 63, 95, 0.08);
    z-index: 10;
}

.skill-bubble-link:hover {
    transform: scale(1.05) translateY(-8px) rotate(2deg) translateZ(0) !important;
    border-color: #0088cc !important;
    box-shadow: 0 20px 40px rgba(0, 136, 204, 0.2) !important;
}

/* Настройка рандомности без сильных перекосов */
.skill-bubble:nth-child(2n) { animation-duration: 14s; animation-delay: 1.5s; margin-top: 5px; }
.skill-bubble:nth-child(3n) { animation-duration: 10s; animation-delay: 0.8s; margin-top: -5px; }
.skill-bubble:nth-child(4n) { animation-duration: 16s; animation-delay: 3s; margin-top: 8px; }
.skill-bubble:nth-child(5n) { animation-duration: 13s; animation-delay: 2s; margin-top: -8px; }

@keyframes float-bubble {
    0%, 100% { transform: translateY(0) rotate(0) translateZ(0); }
    33% { transform: translateY(-12px) rotate(-0.5deg) translateX(5px) translateZ(0); }
    66% { transform: translateY(-6px) rotate(0.5deg) translateX(-5px) translateZ(0); }
}

/* Стили для Демо-чата на главной */
.demo-chat-section {
    margin: 80px auto; /* Добавили auto для центровки */
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.demo-chat-widget {
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(87, 63, 95, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 500px;
    border: 1px solid #f0edf2;
    text-align: left;
}

.demo-chat-header {
    background: #573f5f;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.demo-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.demo-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.demo-new-chat-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.demo-new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    box-shadow: 0 0 10px #2ecc71;
}

.demo-subject-dropdown {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.demo-subject-dropdown option {
    color: #333;
}

.demo-messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdfbff;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.demo-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #f0edf2;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.demo-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.demo-input-section {
    flex: 1;
    position: relative;
    background: #ffffff;
    border: 1px solid #e0ddee;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 10px 15px;
    transition: border-color 0.3s;
}

.demo-input-section:focus-within {
    border-color: #ff4d94;
}

#demo-message-input {
    width: 100%;
    border: none !important;
    padding: 0 !important;
    font-size: 0.95rem;
    resize: none;
    max-height: 100px;
    outline: none;
    background: transparent;
    margin-right: 35px; /* Space for the paperclip */
}

.demo-upload-btn {
    position: absolute;
    right: 10px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    background: #f4e7f7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 5px;
}

.demo-upload-btn:hover {
    background: #ebd5f2;
    transform: scale(1.05);
}

.demo-upload-btn svg {
    width: 20px;
    height: 20px;
}

.demo-image-preview-container {
    position: relative;
    width: fit-content;
    padding: 5px;
    border: 1px solid #e0ddee;
    border-radius: 8px;
    background: #fdfbff;
    margin-bottom: 5px;
}

#demo-message-input:focus {
    border-color: #ff4d94;
}

.demo-send-btn {
    width: 40px;
    height: 40px;
    background: #ff4d94;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.demo-send-btn:hover {
    transform: scale(1.05);
    background: #ff2d80;
}

.demo-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Адаптивность для виджета */
@media (max-width: 768px) {
    .demo-chat-widget {
        height: 400px;
    }
    .demo-chat-header {
        padding: 12px 15px;
    }
    .demo-status {
        font-size: 0.8rem;
    }
    .demo-subject-dropdown {
        max-width: 120px;
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

.comparison-container {
    max-width: 1000px;
    margin: 50px auto 0;
    background: #ffffff;
    border-radius: 40px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(87, 63, 95, 0.08);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    padding: 30px 20px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #4a3550;
    background: #fdfbff;
    border-bottom: 2px solid #f0edf2;
}

.comparison-table td {
    padding: 22px 20px;
    border-bottom: 1px solid #f0edf2;
    font-size: 1.1rem;
    color: #4a3550;
    font-weight: 600;
    transition: background 0.2s ease;
}

.comparison-table tr:hover td {
    background: #fdfbff;
}

.comparison-feature {
    text-align: left;
    padding-left: 40px !important;
    width: 50%;
}

.comparison-others {
    color: #a094a8 !important;
    background: #fcfcfc;
    text-align: center; /* Центрируем иконки */
}

.comparison-classgpt {
    background: rgba(255, 77, 148, 0.04);
    color: #ff4d94 !important;
    font-weight: 800 !important;
    position: relative;
    text-align: center; /* Центрируем иконки */
}

/* Эффект "сияния" для колонки ClassGPT */
.comparison-classgpt::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-left: 1px solid rgba(255, 77, 148, 0.1);
    border-right: 1px solid rgba(255, 77, 148, 0.1);
    pointer-events: none;
}

.comparison-table th.comparison-classgpt {
    background: #fff0f6;
    border-radius: 20px 20px 0 0;
}

.comparison-table tr:last-child .comparison-classgpt {
    border-radius: 0 0 20px 20px;
}

.check-icon { 
    color: #2ecc71; 
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(46, 204, 113, 0.2));
}

/* Стили для FAQ (Чат-аккордеон) */
.faq-section {
    margin: 80px 0 40px; /* Еще уменьшили отступ снизу в 1.5 раза */
    text-align: center;
}

.faq-container {
    max-width: 800px;
    margin: 50px auto 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.faq-item {
    background: #ffffff;
    border-radius: 30px;
    box-shadow: 0 15px 40px rgba(87, 63, 95, 0.12); /* Еще усилили тень */
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.faq-question-wrapper {
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Выравнивание вопроса вправо */
    cursor: pointer;
    gap: 15px;
}

.faq-question-bubble {
    background: #f0f0f0;
    padding: 12px 20px;
    border-radius: 20px 20px 4px 20px;
    font-weight: 600;
    color: #4a3550;
    font-size: 1.1rem;
    max-width: 80%;
    text-align: left;
}

.faq-toggle-btn {
    width: 40px;
    height: 40px;
    background: #ff4d94;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.faq-item.active .faq-toggle-btn {
    background: #573f5f;
    transform: rotate(45deg);
}

.faq-answer-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fafafa;
}

.faq-item.active .faq-answer-wrapper {
    max-height: 500px;
}

.faq-answer-content {
    padding: 25px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.faq-ai-avatar {
    width: 40px;
    height: 40px;
    background: #ff4d94;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.faq-answer-bubble {
    background: #ffffff;
    padding: 15px 20px;
    border-radius: 4px 20px 20px 20px;
    color: #4a3550;
    font-size: 1.05rem;
    line-height: 1.6;
    text-align: left;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    border: 1px solid #f0edf2;
}

@media (max-width: 600px) {
    .faq-question-bubble {
        max-width: 75%;
        font-size: 1rem;
    }
}

.check-icon { 
    color: #2ecc71; 
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(46, 204, 113, 0.2));
}

.cross-icon { 
    color: #e74c3c; 
    font-size: 1.6rem; 
    opacity: 0.6;
}

.question-icon { 
    color: #f1c40f; 
    font-size: 1.6rem;
}

.comparison-badge {
    display: inline-block;
    padding: 8px 20px;
    background: #ff4d94;
    color: white;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: 1px;
    white-space: nowrap; /* Чтобы не переносилось */
}

@media (max-width: 768px) {
    .comparison-badge {
        font-size: 0.8rem;
        padding: 6px 14px;
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .comparison-feature {
        padding-left: 20px !important;
    }
    .comparison-table th {
        font-size: 1rem;
        padding: 20px 10px;
    }
    .comparison-table td {
        padding: 15px 10px;
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .skill-bubble {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

@media (max-width: 900px) {
    .paths-wrapper {
        flex-direction: column;
        align-items: center;
    }
    .paths-wrapper::before {
        display: none;
    }
}

.section {
    margin-bottom: 100px;
    background: #ffffff;
    padding: 50px;
    border-radius: 30px;
    box-shadow: 0 20px 40px rgba(87, 63, 95, 0.05);
    transform: translateY(0);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: #573f5f;
    border-radius: 5px 5px 0 0;
}

.section:hover {
    transform: translateY(-10px);
    box-shadow: 0 30px 60px rgba(87, 63, 95, 0.12);
}

.section h2 {
    font-size: 2.5rem;
    color: #3d2b42;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.section h3 {
    font-size: 1.8rem;
    color: #3d2b42;
    margin-bottom: 20px;
    font-weight: 600;
    line-height: 1.4;
}

.lead-text {
    font-size: 1.3rem;
    color: #2a2a2a;
    line-height: 1.8;
    margin-bottom: 30px;
    max-width: 900px;

}

.section.fade-in ul li {
    font-size: 1.6rem;
    color: #3d2b42;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 20px;
}

.section.fade-in p {
    font-size: 1.6rem;
    color: #3d2b42;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 20px;
}

.welcome-cta {
    margin-top: 60px;
    margin-bottom: 60px;
    text-align: center;
}

/* Скрываем элементы по умолчанию для эффектов появления */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Добавляем стиль для отступа верхней кнопки */
.welcome-cta.top-cta {
    margin-top: 0px; /* Убрали отступ сверху */
    margin-bottom: 20px; /* Уменьшили отступ снизу */
    position: sticky;
    top: 95px;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}

@media (max-width: 1024px) {
    .welcome-cta.top-cta {
        justify-content: center;
    }
}

.welcome-cta.top-cta .cta-button {
    pointer-events: auto;
    box-shadow: 0 10px 30px rgba(87, 63, 95, 0.3);
}

.welcome-cta.top-cta .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(87, 63, 95, 0.4);
}
/* Конец добавленного стиля */

.cta-button.primary {
    display: inline-block;
    padding: 18px 50px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
    background: #33583d;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 12px 35px rgba(87, 63, 95, 0.25); /* Еще усилили тень кнопки */
}

.cta-button.primary:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(87, 63, 95, 0.3);
}

.site-footer {
    background: #573f5f;
    color: #fff;
    padding: 40px 0 20px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section ul li a:hover {
    color: #fff;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.new-chat-btn {
    display: none;
}

.profile-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-left: 10px;
}

.profile-icon:hover {
    background: rgba(255, 255, 255, 0.35);
}

.profile-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.login-nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Стили для кнопок-инструментов */
.header-chats-btn, 
.header-new-chat {
    border-radius: 50px !important; /* Пилюлеобразная форма */
    height: 40px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    padding: 0 20px !important;
    align-items: center;
    gap: 8px !important;
    border: none !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    z-index: 1001;
}

.header-chats-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.header-chats-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-1px);
}

.header-new-chat {
    background: linear-gradient(135deg, #ff4d94 0%, #ff71ac 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(255, 77, 148, 0.3) !important;
}

.header-new-chat:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 77, 148, 0.4) !important;
    filter: brightness(1.1);
}

.header-new-chat i {
    font-size: 16px;
}

.header-chats-btn i {
    font-size: 14px;
    opacity: 0.8;
}

.header-textbook-btn {
    display: none;
}

.textbook-icon {
    width: 32px;
    height: 32px;
    transition: transform 0.2s ease;
}

.header-textbook-btn:hover .textbook-icon {
    transform: scale(1.1);
}

.button-text {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.contents-toggle {
    display: none;
}


/* Создаём защитную "стену" слева от кнопки "Чаты" */
.header-chats-btn::before {
    content: '';
    position: absolute;
    left: -30px; /* Защитная зона слева */
    top: -10px;
    bottom: -10px;
    width: 30px;
    background: transparent;
    z-index: 1001;
    pointer-events: none; /* Не блокируем клики */
}

.header-new-chat:hover .new-chat-icon {
    transform: scale(1.1);
}

.header-book-btn {
    display: none;
}

.mobile-only {
    display: none;
}

.welcome-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1100;
    backdrop-filter: blur(5px);
}

.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.textbook-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1100;
    backdrop-filter: blur(5px);
}

.paragraph-messages {
    padding: 40px 70px 0px 70px;
    padding-left: 17%;
    padding-right: 15%;
    padding-bottom: 75px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 0;
    max-height: none;
    background-color: #e9e5eb;
    overflow-y: auto;
    overflow-x: hidden;
}

.paragraph-info {
    display: flex;
    width: 800px;
    margin: 4px;
    padding: 16px 20px 0px 0px;
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    text-align: center;
    z-index: 1;
    background: #e9e5eb;
    border: none;
    box-shadow: none;
}

.textbook-modal-content {
    background: #faf9ff;
    border-radius: 16px;
    width: 90%;
    min-height: 400px;
    max-width: 1200px;
    max-height: 90vh;
    padding: 0 30px 30px 30px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: none;
}

.textbook-modal-header {
    position: sticky;
    top: 0;
    background: #faf9ff;
    padding: 20px 30px;
    margin: 0 -30px 20px -30px;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    z-index: 1;
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    color: #573f5f;
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.textbook-modal-content::-webkit-scrollbar {
    width: 8px;
}

.textbook-modal-content::-webkit-scrollbar-track {
    margin: 16px 0;
    background: #f1f1f1;
    border-radius: 4px;
}

.textbook-modal-content::-webkit-scrollbar-thumb {
    background: #adb6c5;
    border-radius: 4px;
}

.textbook-modal-content::-webkit-scrollbar-thumb:hover {
    background: #647697;
}

.textbook-modal h2 {
    color: #573f5f;
    font-size: 24px;
    margin-bottom: 25px;
    text-align: center;
}

.grade-selector {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 20px 0;
}

.grade-select {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #d8d0e7;
    font-size: 16px;
    background: #f5f2ff;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #4b3f72;
    width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b3f72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

.grade-select:hover {
    border-color: #6a5acd;
    background-color: #f3f0ff;
}

.textbooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

.textbook-card {
    background: #e8e6f1;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(87, 63, 95, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid #d8d2e8;
    position: relative; /* Добавлено для корректного позиционирования возможных дочерних элементов */
}

/* Применяем hover-эффекты только если у карточки НЕТ класса .disabled */
.textbook-card:not(.disabled):hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(87, 63, 95, 0.15);
    background: #e0ddee;
}

/* Стили для карточки с классом disabled (по желанию можно добавить доп. стили) */
.textbook-card.disabled {
     opacity: 0.7; /* Например, делаем ее полупрозрачной */
     cursor: not-allowed; /* Показываем курсор "не разрешено" */
}

.textbook-cover-container {
    width: 150px;
    height: 200px;
    margin-bottom: 20px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(87, 63, 95, 0.1);
    background: #e8e6f1;
}

.textbook-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.textbook-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #e8e6f1;
    padding: 15px;
    border-radius: 16px;
    width: 100%;
    margin-top: 15px;
}

.textbook-name {
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    margin-bottom: 10px;
}

.textbook-details {
    font-size: 14px;
    color: #000000;
    margin-bottom: 20px;
}

.select-btn {
    padding: 10px 20px;
    background: #573f5f;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    width: 100%;
}

.select-btn:hover {
    background: #4a344c;
    transform: translateY(-2px);
}

/* Добавляем стили для неактивной кнопки */
.select-btn:disabled {
    background-color: #cccccc; /* Серый фон */
    color: #666666; /* Темно-серый текст */
    cursor: not-allowed; /* Курсор "не разрешено" */
    transform: none; /* Убираем эффект поднятия */
    box-shadow: none; /* Убираем тень */
}

.close-modal-btn:hover {
    color: #33583d;
    transform: scale(1.1);
}

.grade-title {
    display: none;
}

.auth-container {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: white;
}

.auth-container form {
    background: #e8e4eb;
    padding: 50px;
    border-radius: 24px;
    width: 100%;
    max-width: 700px;
    box-shadow: 0 10px 40px rgba(87, 63, 95, 0.15);
}

.auth-container h1 {
    color: #573f5f;
    font-size: 28px;
    margin-bottom: 30px;
    text-align: center;
    font-weight: 700;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #573f5f;
    font-weight: 500;
    font-size: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(87, 63, 95, 0.1);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    color: #333;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #573f5f;
    background: white;
    box-shadow: 0 0 0 4px rgba(87, 63, 95, 0.1);
}

.auth-container .btn {
    width: 100%;
    padding: 14px;
    background: #33583d;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.auth-container .btn:hover {
    background: #2a4832;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 88, 61, 0.2);
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0px;
    background: white;
    border: 2px solid rgba(87, 63, 95, 0.1);
    border-radius: 12px;
    color: #333;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.google-btn:hover {
    background: white;
    border-color: #573f5f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.google-btn img {
    width: 60px;
   
}

.divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: calc(50% - 30px);
    height: 1px;
    background: rgba(87, 63, 95, 0.2);
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.divider span {
    background: #e8e4eb;
    padding: 0 15px;
    color: #573f5f;
    font-size: 14px;
}

.links {
    text-align: center;
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.links a {
    color: #573f5f;
    text-decoration: none;
    font-size: 14px;
    position: relative;
}

.links a:first-child:after {
    position: absolute;
    right: -12px;
    color: rgba(87, 63, 95, 0.4);
}

.links a:hover {
    color: #33583d;
    text-decoration: underline;
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 17px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Добавляем стили для alert-danger */
.alert-danger {
    color: #721c24; /* Темно-красный цвет текста */
    background-color: #f8d7da; /* Светло-розовый фон */
    border-color: #f5c6cb; /* Розовая рамка */
    border: 1px solid transparent; /* Убедимся, что рамка есть */
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.form-error {
    color: red;
    font-size: 17px;
    margin-top: 10px;
}

.welcome-modal-content {
    background: #faf9ff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    position: relative;
    text-align: center;
    box-shadow: 0 10px 40px rgba(87, 63, 95, 0.15);
}

.welcome-message {
    margin-bottom: 30px;
}

.welcome-message p {
    color: #573f5f;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.welcome-message p:first-child {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
}

.welcome-btn {
    padding: 12px 40px;
    background: #33583d;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.welcome-btn:hover {
    background: #2a4832;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(51, 88, 61, 0.2);
}

.upload-btn {
    width: 28px;
    height: 28px;
    background: #f4e7f7;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    display: none; /* Скрываем кнопку по умолчанию */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: none;
    padding: 6px;
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 1;
}

/* Tooltip for upload button: white background, rounded, appears above without shifting layout */
.upload-btn[data-tooltip] {
    position: absolute; /* keep absolute to not shift layout */
}
.upload-btn[data-tooltip-line1][data-tooltip-line2]:hover::after,
.upload-btn[data-tooltip-line1][data-tooltip-line2]:focus::after {
    content: attr(data-tooltip-line1) "\A" attr(data-tooltip-line2); /* enforce line break */
    position: absolute;
    bottom: calc(100% + 8px); /* show above the button */
    right: 0; /* anchor to the right edge so it grows leftwards */
    left: auto;
    transform: none;
    white-space: pre; /* keep explicit line break, no extra wrapping */
    background: #ffffff;
    color: #333333;
    padding: 8px 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    font-size: 12px;
    line-height: 1.3;
    width: max-content; /* exactly as wide as the longest line */
    max-width: 90vw; /* prevent overflow near edges */
    word-break: normal; /* avoid breaking every character */
    overflow-wrap: normal;
    text-align: left;
    z-index: 10;
}
.upload-btn[data-tooltip-line1][data-tooltip-line2]:hover::before,
.upload-btn[data-tooltip-line1][data-tooltip-line2]:focus::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 2px); /* small gap to tooltip box */
    right: 10px; /* arrow near the button on the right */
    left: auto;
    transform: none;
    border-width: 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent; /* little arrow pointing down */
    z-index: 11;
}

/* Hide desktop tooltips on mobile devices */
@media (max-width: 768px) {
    .upload-btn[data-tooltip-line1][data-tooltip-line2]::after,
    .upload-btn[data-tooltip-line1][data-tooltip-line2]::before {
        display: none !important;
    }
}

/* On very small screens allow wrapping to avoid overflow */
@media (max-width: 480px) {
    .upload-btn[data-tooltip-line1][data-tooltip-line2]:hover::after,
    .upload-btn[data-tooltip-line1][data-tooltip-line2]:focus::after {
        width: 260px; /* constrain on small screens */
        max-width: 90vw;
        white-space: pre-wrap; /* allow wrapping inside the two lines if needed */
        word-break: break-word;
        overflow-wrap: anywhere;
    }
}

/* removed custom mobile upload menu — now using native iOS chooser */

/* iOS Safari quirk: file input must be in DOM and visible-ish to allow programmatic click */
.visually-hidden-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.term {
    border-bottom: 1px dotted #573f5f; /* Пунктирное подчеркивание */
    cursor: pointer; /* Курсор-указатель для наглядности */
    position: relative; /* Для правильного позиционирования tooltip (хотя сам tooltip теперь в body) */
    display: inline-block; /* Чтобы подчеркивание было только под текстом */
    color: #573f5f; /* Цвет в стиле сайта */
    font-weight: 500; /* Выделение текста */
}

.definition {
    display: none; /* Скрываем сам элемент определения */
}

.tooltip {
    position: absolute; /* Абсолютное позиционирование относительно body */
    background-color: #f5eef5;
    color: #333;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(87, 63, 95, 0.2);
    width: max-content;
    max-width: 300px;
    z-index: 100; /* Поверх других элементов */
    font-size: 14px;
    line-height: 1.4;

}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%; /* Стрелка внизу подсказки */
    left: 50%;
    transform: translateX(-50%); /* Центрируем стрелку */
    margin-left: 0; /* Сбрасываем старый margin */
    border-width: 8px;
    border-style: solid;
    border-color: #f5eef5 transparent transparent transparent; /* Треугольник, указывающий вниз */
}

.quote-icon {
    margin-right: 5px;
    color: #573f5f;
    font-size: 16px;
}

/* Стили для страницы обратной связи */
.feedback-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid rgba(87, 63, 95, 0.1);
    border-radius: 12px; /* Убедимся, что скругление соответствует другим полям */
    font-size: 15px;
    transition: all 0.3s ease;
    color: #333;
    background: white;
    height: 200px; /* Устанавливаем фиксированную высоту, например 200px */
    resize: none; /* Запрещаем изменение размера */
    font-family: inherit; /* Наследуем шрифт */
    min-height: 100px; /* Добавим минимальную высоту на всякий случай */
}

.feedback-form textarea:focus {
    outline: none;
    border-color: #573f5f;
    background: white;
    box-shadow: 0 0 0 4px rgba(87, 63, 95, 0.1);
}

.contents-header {
    position: relative; /* Добавляем для абсолютного позиционирования крестика */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 10px;
}

.close-contents-btn {
    position: absolute;
    top: -5px;
    right: 0;
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-contents-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.close-contents-btn svg {
    width: 20px;
    height: 20px;
}

/* Обновляем стиль для кнопки "Начать объяснение" с таким же закруглением */
.start-explanation-btn {
    background-color: #005c1f; /* Тот же яркий темно-зеленый цвет */
    border-radius: 9px; /* Единый радиус закругления */
}

.start-explanation-btn:hover {
    background-color: #005c1f; /* Более темный оттенок для hover */
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin: 3px;
    max-width: 60px;
    max-height: 60px;
    vertical-align: middle;
    overflow: hidden;
    border-radius: 4px;
}

.image-preview {
    max-width: 100%;
    max-height: 60px;
    height: auto;
    border-radius: 4px;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: rgba(100, 100, 100, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(80, 80, 80, 0.9);
}

.send-btn.stop-btn {
    background-color: white;
    border: 2px solid #33583d;
}

.send-btn.stop-btn:hover {
    background-color: #f5f5f5;
}

/* Стили для отключенного текстового поля */
#message-input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* Добавляем новые стили для контейнера превью изображений */
.message-input-container {
    position: relative;
}

/* Создаем горизонтальный контейнер для превью изображений */
.image-previews-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 5px;
    max-width: 320px; /* Ограничиваем максимальную ширину */
    gap: 2px; /* Добавляем немного пространства между изображениями */
}

/* --- Кастомные стили для мобильного меню предметов --- */
.desktop-subjects { display: flex; }
.mobile-subjects { display: none; }

@media screen and (max-width: 1230px) {
    .welcome-content {
        padding: 30px 15px;
    }

    .main-title {
        font-size: 2.5rem;
        margin-bottom: 40px;
        margin-top: 40px;
    }

    .subtitle {
        font-size: 1.6rem;
    }

    .section {
        padding: 25px 15px;
        margin-bottom: 50px;
    }

    .section h2 {
        font-size: 2rem;
    }

    .section h3 {
        font-size: 1.5rem;
    }

    .cta-button.primary {
        padding: 12px 35px;
        font-size: 1.1rem;
    }

    .section p {
        font-size: 1.25rem;
    }

    .grade-select {
        width: 180px;
    }

    .auth-container {
        padding: 20px;
    }

    .auth-container form {
        padding: 40px 25px;
    }

    .auth-container h1 {
        font-size: 24px;
    }

    .form-group input,
    .google-btn {
        padding: 10px 14px;
    }

    .auth-container .btn {
        padding: 12px;
    }

    .welcome-modal-content {
        padding: 30px 20px;
        width: 95%;
    }

    .welcome-message p {
        font-size: 16px;
    }

    .welcome-message p:first-child {
        font-size: 20px;
    }

    .welcome-btn {
        padding: 10px 30px;
        font-size: 15px;
    }

    .upload-btn {
        width: 24px;
        height: 24px;
        padding: 5px;
    }

    .upload-btn svg {
        width: 14px;
        height: 14px;
    }

    .paragraph-messages {
        padding: 20px 0 0 0;
        padding-bottom: 175px;
    }

    .messages-area {
        padding-left: 27px;
        padding-right: 27px;
        padding-top: 20px;
        padding-bottom: 0px;
        margin-top: 0;
        position: relative;
    }

    .input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        padding: 10px 15px;
        background: #e9e5eb;
        z-index: 100;
    }

    .message-input-container {
        width: 100%;
        margin: 0 auto;
        max-width: 100%;
    }

    .main-container {
        margin-top: 60px;
        height: calc(100vh - 60px);
        padding-top: 0;
    }

    .chat-container {
        height: calc(100vh - 60px);
        margin-top: 0;
        position: relative;
    }

    .site-header {
        position: fixed;
        top: 10px; /* Floating from top */
        left: 10px; /* Floating from left */
        right: 10px; /* Floating from right */
        z-index: 1100;
        height: 60px;
        padding: 0 10px;
        margin: 0;
        border-radius: 15px;
        background: rgba(87, 63, 95, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    }
    
    .header-container {
        display: flex;
        align-items: center;
        justify-content: space-between; /* Changed from flex-start to use full width */
        flex-wrap: nowrap;
        gap: 5px;
        width: 100%;
        position: relative;
        height: 100%;
    }
    
    .logo {
        flex-shrink: 0;
        margin-right: 4px;
        order: 0;
        flex: 0 0 auto;
    }
    
    .logo h1 {
        font-size: 1.3rem;
        line-height: 1.1;
        text-align: left;
        margin: 0;
    }
    
    .header-subject-dropdown-wrapper {
        position: relative;
        display: inline-block !important;
        margin: 0 5px; /* Added margin instead of absolute positioning */
        order: 1; /* Place it between logo and login */
        z-index: 100;
    }
    
    .header-subject-btn,
    .nav-btn.register {
        display: flex !important;
        /* min-width: 90px;
           This will be handled by specific rules or inherited if not overridden for .header-subject-btn */
        background: rgba(255,255,255,0.15);
        border: none;
        border-radius: 6px;
        /* padding: 8px 12px;
           This will be handled by specific rules or inherited */
        cursor: pointer;
        align-items: center;
        justify-content: center;
        height: 41px;
        color: #ffffff;
        font-size: 14px;
        font-weight: 500;
        box-sizing: border-box;
        margin-right: 8px; /* Общий правый отступ */
        /* margin-left: 8px;  УДАЛЕНО отсюда, будет задано специфично */
    }
    
    .header-subject-btn { /* Специфичное правило для кнопки "Предмет" на мобильных */
        min-width: 75px;
        padding: 8px 10px;
        margin-left: 0; /* ДОБАВЛЕНО: убираем нежелательный левый отступ для кнопки "Предмет" */
    }
    
    .nav-btn.register { /* Специфичные стили для кнопки "Регистрация/Вход" */
        min-width: 90px; /* Ширина для кнопки "Регистрация/Вход" */
        padding: 8px 12px; /* Отступы для кнопки "Регистрация/Вход" */
        margin-left: 8px; /* ДОБАВЛЕНО: левый отступ для кнопки "Регистрация/Вход" */
    }
    
    .login-nav {
        order: 2;
        margin-left: auto;
        flex: 0 0 auto;
    }
    
    .login-nav ul {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0;
        padding: 0;
    }
    
    .header-nav ul {
        display: flex;
        align-items: center;
        gap: 15px;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .icon-btn {
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.3s;
    }
    .icon-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .profile-icon {
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.3s;
    }
    .profile-icon:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .contents-toggle:not(.icon-btn),
    .new-chat-btn:not(.icon-btn) {
        display: none;
    }

    .contents-container {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: white;
        transition: left 0.3s ease;
        z-index: 990;
        overflow-y: auto;
    }

    .contents-container.active {
        left: 0;
    }

    .message-actions {
        position: relative;
        bottom: auto;
        left: auto;
        right: auto;
        padding-left: 27px; /* Добавляем отступ слева, соответствующий отступу сообщений */
        flex-direction: column; 
        align-items: flex-start;
        margin-top: 0px;
        margin-bottom: 15px; 
    }

    .header-new-chat {
        width: 41px;
        height: 41px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .new-chat-icon {
        font-size: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
        line-height: 1;
    }

    .send-btn {
        width: 36px;
        height: 36px;
    }

    .send-btn svg {
        width: 32px;
        height: 32px;
    }

    .nav-btn {
        padding: 8px 7px;
        font-size: 15px;
    }

    .login-nav ul {
        gap: 10px;
        display: flex;
        align-items: center;
    }

    .button-text {
        display: none;
    }

    .header-textbook-btn {
        width: 41px;
        height: 41px;
        padding: 7px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .chat-and-saved-container {
        height: calc(100vh - 60px);
    }

    .message {
        max-width: 98%;
    }

    .chatgpt-message {
        max-width: 98%;
    }
    .system-message {
        max-width: 98%;
        background: #d9e4d9;
    }
    .user-message {
        position: static;
        left: auto;
        transform: none;
        margin-left: auto;
        margin-right: 0;
        align-self: flex-end;
        max-width: 98%;
    }

    .header-book-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 41px;
        height: 41px;
        padding: 7px;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .header-book-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .book-icon {
        width: 27px;
        height: 27px;
    }

    .mobile-only {
        display: block;
    }

    .saved-chats-container {
        display: none !important;
    }

    .feedback-form {
        padding: 40px 25px;
    }

    .feedback-form h1 {
        font-size: 24px;
    }

    .feedback-form textarea,
    .feedback-form input {
        padding: 10px 14px;
    }

    .feedback-form .btn {
        padding: 12px;
    }

    .close-contents-btn {
        display: flex;
    }

    .section.fade-in ul li {
        font-size: 18px;
        margin-left: 30px;
    }
    .section.fade-in p {
        font-size: 18px;
        
    }

    .logo-icon {
        width: 20px;
        height: 20px;
    }

    .desktop-subjects { display: none !important; }
    .mobile-subjects { display: block !important; position: relative; }
    .mobile-subjects .subjects-menu-btn {
        width: auto;
        min-width: 90px;
        margin: 0 4px 0 0;
        background: #573f5f;
        color: #fff;
        border: none;
        border-radius: 6px;
        font-size: 13px;
        font-weight: 500;
        padding: 4px 10px;
        height: 32px;
        line-height: 1;
        box-shadow: none;
        cursor: pointer;
        transition: background 0.2s;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .mobile-subjects .subjects-menu-btn:active,
    .mobile-subjects .subjects-menu-btn:focus {
        background: #4a344c;
    }

    .logo {
        flex-shrink: 0;
        margin-right: 4px;
        order: 0;
        flex: 0 0 auto;
    }
    
    .logo h1 {
        font-size: 1.3rem;
        line-height: 1.1;
        text-align: left;
    }

    .user-menu-trigger.mobile-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 41px;
        height: 41px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 6px;
        padding: 8px;
    }
}

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

.user-menu-trigger.desktop-icon { display: inline-flex; }
.user-menu-trigger.mobile-icon { display: none; }

@media screen and (max-width: 1230px) {
  .user-menu-trigger.desktop-icon { display: none !important; }
  .user-menu-trigger.mobile-icon { display: inline-flex !important; }
}

.desktop-only { display: flex; }
@media screen and (max-width: 1230px) {
  .desktop-only { display: none !important; }
}

@media screen and (max-width: 1230px) {
    .main-nav .subjects-menu-btn { display: none !important; }
}

.user-menu-trigger.mobile-icon {
    width: 44px;
    height: 44px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.user-menu-trigger.mobile-icon {
    display: none !important;
}
@media screen and (max-width: 1230px) {
    .user-menu-trigger.mobile-icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        vertical-align: middle;
    }
}

/* Скрыть крестик на ПК */
.close-contents-btn {
    display: none !important;
}

/* Показать крестик только на мобильных устройствах */
@media screen and (max-width: 1230px) {
    .close-contents-btn {
        display: flex !important;
    }
}

/* Активная кнопка предмета — выделяем розовым */
.active-subject {
    background: #ff4d94 !important;
    color: white !important;
    opacity: 1 !important;
    box-shadow: 0 4px 12px rgba(255, 77, 148, 0.3);
    border-color: #ff4d94;
    font-weight: 700;
}

/* Скрываем кнопки "Выбрать учебник" и "Сохранённые чаты" в мобильной версии 
   на всех страницах, кроме страницы чата */
@media (max-width: 1230px) {
    body:not(.chat-page) .mobile-only .dropdown-textbook-link,
    body:not(.chat-page) .mobile-only .dropdown-saved-chats-link {
        display: none !important;
    }

    /* Также скрываем горизонтальную линию, если обе кнопки скрыты */
    body:not(.chat-page) .mobile-only hr {
        display: none !important;
    }
}

.desktop-subjects { display: flex; }
.mobile-subjects { display: none; }

@media screen and (max-width: 1230px) {
    .welcome-content {
        padding: 30px 15px;
    }

    .main-title {
        font-size: 2.5rem;
        margin-bottom: 40px;
        margin-top: 40px;
    }

    .subtitle {
        font-size: 1.6rem;
    }

    /* ... existing code ... */

    .desktop-subjects { display: none !important; }
    .mobile-subjects { display: block !important; position: relative; }
    
    /* ... existing code ... */
}

.subjects-dropdown-menu {
    display: none;
    position: absolute;
    left: auto;
    right: 0;
    top: 110%;
    width: max-content;
    min-width: 160px;
    max-width: 220px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(87, 63, 95, 0.15);
    z-index: 2000;
    padding: 6px 0;
    flex-direction: column;
    gap: 2px;
    animation: fadeInSubjects 0.18s;
    border: 1px solid rgba(87, 63, 95, 0.05);
}
.subjects-dropdown-menu.show {
    display: flex;
}
.subjects-dropdown-menu .nav-btn,
.subjects-dropdown-menu .dropdown-textbook-link,
.subjects-dropdown-menu .dropdown-saved-chats-link {
    color: #573f5f;
    background: none;
    border-radius: 8px;
    width: calc(100% - 12px);
    margin: 0 6px;
    justify-content: flex-start;
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.subjects-dropdown-menu .nav-btn:hover,
.subjects-dropdown-menu .dropdown-textbook-link:hover,
.subjects-dropdown-menu .dropdown-saved-chats-link:hover {
    background: #f8f6f9;
    color: #ff4d94;
    transform: translateX(3px);
}

.mobile-subjects .subjects-menu-btn {
    min-width: 90px; /* Минимальная ширина для размещения названия предмета */
    justify-content: center; /* Центрирование текста */
}

.header-subject-btn {
    display: none; /* Скрываем кнопку в ПК версии по умолчанию */
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    margin-left: auto;
    margin-right: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    height: 41px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
}
.header-subject-btn .subject-icon {
    width: 24px;
    height: 24px;
}

.header-subject-dropdown-wrapper {
    display: none; /* Скрываем на ПК версии по умолчанию */
    position: relative;
}

@media (max-width: 1230px) {
    .logo-group {
        gap: 8px;
    }
    
    .header-subject-dropdown-wrapper {
        position: relative;
        display: inline-block !important; /* Включаем отображение на мобильных */
        margin-right: 0;
        margin-left: 0;
        order: 0;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
    }
    
    .header-subject-btn,
    .nav-btn.register {
        display: flex !important;
        min-width: 80px;
        background: rgba(255,255,255,0.15);
        border: none;
        border-radius: 6px;
        padding: 8px 10px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        height: 41px;
        color: #ffffff;
        font-size: 14px;
        font-weight: 500;
        box-sizing: border-box;
        margin-right: 4px;
        margin-left: 4px;
    }
    
    .header-subject-btn { /* Специфичное правило для кнопки "Предмет" на мобильных, чтобы сделать ее короче */
        min-width: 60px;
        max-width: 130px; /* Ограничиваем максимальную ширину */
        padding: 4px 6px; /* Минимальные отступы для экстремально маленьких экранов */
        margin-left: 2px;
        margin-right: 2px;
        font-size: 13px; /* Немного уменьшили шрифт для экономии места */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block !important; /* Для корректной работы ellipsis */
        line-height: 33px; /* Центрирование текста по вертикали при блочном отображении */
        text-align: center;
    }
    
    .header-subjects-dropdown {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
        min-width: 160px;
        max-width: 240px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        z-index: 2000;
        flex-direction: column;
        gap: 2px;
        padding: 6px 0;
        animation: fadeInSubjects 0.18s;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .header-subjects-dropdown.show {
        display: flex;
    }
    
    .header-subjects-dropdown .nav-btn {
        color: #573f5f;
        background: none;
        border-radius: 8px;
        width: calc(100% - 12px);
        margin: 0 6px;
        justify-content: flex-start;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
        transition: all 0.2s ease;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .header-subjects-dropdown .nav-btn:hover {
        background: #f8f6f9;
        color: #ff4d94;
    }
    
    .login-nav {
        order: 2;
        margin-left: auto;
    }
    
    .header-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
    }
    
    .logo {
        flex-shrink: 0;
        margin-right: 4px;
        order: 0;
    }
}

/* Стили для блока "Уже доступные предметы" (Sticky Notes) */
.subjects-stickers-section {
    margin: 40px 0; /* Еще уменьшили в 1.5 раза по просьбе пользователя */
    text-align: center;
    padding: 0 20px;
}

.subjects-stickers-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
    max-width: 1100px;
    margin: 50px auto 0;
}

/* Цвета для стикеров */
.sticker-yellow { background-color: #fff9c4 !important; }
.sticker-pink   { background-color: #fce4ec !important; }
.sticker-blue   { background-color: #e3f2fd !important; }
.sticker-green  { background-color: #e8f5e9 !important; }
.sticker-orange { background-color: #fff3e0 !important; }
.sticker-purple { background-color: #f3e5f5 !important; }

.subject-sticker {
    width: 190px;
    height: 190px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none; /* Убираем подчеркивание */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    border: none;
    /* Текстура бумаги */
    background-image: linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px), 
                      linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    box-shadow: 4px 4px 12px rgba(0,0,0,0.12),
                3px 15px 25px rgba(0,0,0,0.12); /* Еще усилили тени для стикеров */
}

/* Более аккуратный загнутый уголок */
.subject-sticker::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 30px 30px; /* Уменьшили размер с 45px до 30px */
    border-color: transparent transparent #ffffff transparent; 
    z-index: 2;
    transition: all 0.4s ease;
}

.subject-sticker::before {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px; /* Уменьшили размер */
    height: 30px;
    background: linear-gradient(135deg, 
                rgba(0,0,0,0) 0%, 
                rgba(0,0,0,0.02) 20%, 
                rgba(0,0,0,0.15) 100%);
    box-shadow: -2px -2px 5px rgba(0,0,0,0.08);
    z-index: 3;
    transition: all 0.4s ease;
}

.subject-sticker:hover::before {
    width: 15px;
    height: 15px;
}

.subject-sticker:hover::after {
    border-width: 0 0 15px 15px;
}

/* Создаем эффект "липкой полоски" сверху */
.subject-sticker .sticker-glue {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 35px;
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    z-index: 1;
}

/* Рандомное расположение и наклон (имитация ручной расклейки) */
.subject-sticker:nth-child(odd) { transform: rotate(-3deg) translateY(5px); margin-top: 10px; }
.subject-sticker:nth-child(even) { transform: rotate(2deg) translateY(-5px); margin-top: -5px; }
.subject-sticker:nth-child(3n) { transform: rotate(4deg) translateX(10px); }
.subject-sticker:nth-child(4n) { transform: rotate(-2.5deg) translateY(8px); }
.subject-sticker:nth-child(5n) { transform: rotate(1.5deg) translateX(-5px); }

/* Интерактив при наведении */
.subject-sticker:hover {
    transform: scale(1.1) rotate(0deg) translateY(-10px) !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
    z-index: 100;
}

.subject-sticker:hover::before {
    width: 25px;
    height: 25px;
}

.subject-sticker:hover::after {
    border-width: 0 0 25px 25px;
}

/* Оформление контента */
.subject-sticker i {
    font-size: 3.2rem;
    margin-bottom: 15px;
    color: #ff4d94;
    filter: drop-shadow(0 3px 6px rgba(255, 77, 148, 0.25));
    position: relative;
    z-index: 2;
}

.subject-sticker .sticker-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: #3d2b42;
    line-height: 1.2;
    position: relative;
    z-index: 2;
}

/* Адаптивность */
@media (max-width: 768px) {
    .subject-sticker {
        width: 150px;
        height: 150px;
        padding: 15px;
    }
    .subject-sticker i { font-size: 2.5rem; }
    .subject-sticker .sticker-name { font-size: 1rem; }
}

@media (max-width: 600px) {
    .subject-sticker {
        width: 140px;
        height: 140px;
        padding: 15px;
    }
    .subject-sticker .sticker-emoji {
        font-size: 2.2rem;
    }
    .subject-sticker .sticker-name {
        font-size: 0.95rem;
    }
}



.term {
}

#yandex-one-tap-container {
    margin-top: 20px; /* Add margin to separate from VK button */
}

/* ---------------- KaTeX readability tweaks in chat ---------------- */
/* Make inline formulas slightly larger for readability */
.message .katex, .msg-bubble .katex {
    font-size: 1.15em;
    line-height: 1.4;
}

/* Make display formulas larger and add vertical spacing */
.message .katex-display, .msg-bubble .katex-display {
    margin-top: 16px;
    margin-bottom: 16px;
    line-height: 1.6;
}
.message .katex-display .katex, .msg-bubble .katex-display .katex {
    font-size: 1.28em;
}

/* Add a bit of horizontal breathing room around fractions */
.message .katex .mfrac, .msg-bubble .katex .mfrac {
    margin-left: 0.14em;
    margin-right: 0.14em;
}

/* Slightly thicken the fraction bar for clarity */
.message .katex .frac-line, .msg-bubble .katex .frac-line {
    border-top-width: 2px;
}
/* ------------------------------------------------------------------ */

/* ---------------- Streamdown typography utility mappings ----------- */
/* Ensure bold/strong emitted by Streamdown are actually bold */
.message .font-semibold,
.message [data-streamdown="strong"],
.msg-bubble .font-semibold,
.msg-bubble [data-streamdown="strong"] {
    font-weight: 600;
}

/* Optional: if Streamdown ever emits .font-bold */
.message .font-bold, .msg-bubble .font-bold {
    font-weight: 700;
}

/* Italic/emphasis */
.message .italic,
.message [data-streamdown="em"],
.msg-bubble .italic,
.msg-bubble [data-streamdown="em"] {
	font-style: italic;
}

/* Underline and strikethrough */
.message .underline, .msg-bubble .underline {
	text-decoration: underline;
	text-underline-offset: 2px;
}
.message del,
.message .line-through,
.message [data-streamdown="del"],
.msg-bubble del,
.msg-bubble .line-through,
.msg-bubble [data-streamdown="del"] {
	text-decoration: line-through;
}

/* Inline code and code blocks */
.message code,
.message [data-streamdown="code"],
.msg-bubble code,
.msg-bubble [data-streamdown="code"] {
	font-family: inherit;
	background-color: transparent;
	padding: 0;
	border-radius: 0;
	font-size: inherit;
}
.message pre, .msg-bubble pre {
	background-color: #f6f8fa;
	padding: 12px;
	border-radius: 8px;
	overflow-x: auto;
	line-height: 1.5;
}
.message pre code, .msg-bubble pre code {
	background: transparent;
	padding: 0;
	font-size: 0.95em;
}

/* Blockquotes */
.message blockquote,
.message [data-streamdown="blockquote"],
.msg-bubble blockquote,
.msg-bubble [data-streamdown="blockquote"] {
	margin: 12px 0;
	padding: 8px 12px;
	border-left: 4px solid #cbb7cf;
	background: #f7f2f9;
	color: #4a3b57;
	border-radius: 6px;
}

/* Links */
.message a, .msg-bubble a {
	color: #33583d;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Tables */
.message table, .msg-bubble table {
	width: 100%;
	border-collapse: collapse;
	margin: 12px 0;
}
.message th,
.message td,
.msg-bubble th,
.msg-bubble td {
	border: 1px solid #e5e7eb;
	padding: 6px 10px;
	text-align: left;
}
.msg-bubble th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.msg-bubble tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Paragraph spacing inside messag */

.message p, .msg-bubble p {
    margin: 8px 0;
}
.message p:first-child, .msg-bubble p:first-child {
    margin-top: 0;
}
.message p:last-child, .msg-bubble p:last-child {
    margin-bottom: 0;
}

/* Lists */
.message ul, .message ol, .msg-bubble ul, .msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message li, .msg-bubble li {
    margin: 4px 0;
}

.message ul, .msg-bubble ul {
    list-style-type: disc;
}

.message ol, .msg-bubble ol {
    list-style-type: decimal;
}
.message thead th {
	background: #f5eef5;
}

/* Horizontal rule */
.message hr {
	border: none;
	border-top: 1px solid #e5e7eb;
	margin: 16px 0;
}
/* ------------------------------------------------------------------ */
@media screen and (max-width: 600px) {
    .main-title {
        font-size: 1.8rem !important;
        margin-top: 60px !important;
        margin-bottom: 20px !important;
        padding: 0 10px !important;
    }

    .subtitle {
        font-size: 1.1rem !important;
        margin-bottom: 25px !important;
        padding: 0 15px !important;
    }

    .use-cases-title, .section h2 {
        font-size: 1.6rem !important;
        margin-bottom: 20px !important;
    }

    .features-list-fun {
        margin-bottom: 0px !important; /* Еще сильнее прижали к телефону */
        gap: 8px !important; /* Уменьшили расстояние между карточками */
    }

    .features-list-fun li {
        font-size: 0.85rem !important; /* Уменьшили шрифт */
        padding: 8px 16px !important; /* Сделали карточки компактнее */
        gap: 8px !important; /* Уменьшили отступ от иконки до текста */
        border-radius: 25px !important; /* Вернули сильное закругление углов */
        box-shadow: 0 8px 20px rgba(87, 63, 95, 0.1) !important; /* Облегчили тень */
    }

    .features-list-fun li svg.ai-sparkle-icon {
        width: 18px !important; /* Уменьшили иконку */
        height: 18px !important;
    }

    /* Уменьшаем разброс карточек, чтобы они не вылезали за края и выглядели аккуратнее */
    .features-list-fun li:nth-child(1) { transform: rotate(-1deg) translateX(-10px) !important; }
    .features-list-fun li:nth-child(2) { transform: rotate(0.5deg) translateX(12px) !important; }
    .features-list-fun li:nth-child(3) { transform: rotate(-0.3deg) translateX(-8px) !important; }
    .features-list-fun li:nth-child(4) { transform: rotate(0.8deg) translateX(5px) !important; }

    /* Убираем лишний отступ перед телефоном */
    .welcome-phone-side {
        margin-top: -10px !important;
    }

    /* Возвращаем прилипание кнопки под шапкой на мобильных */
    .welcome-cta.top-cta {
        position: sticky !important;
        top: 75px !important; /* Уменьшаем отступ под мобильную шапку (10px top + 60px height + 5px gap) */
        z-index: 1000 !important;
    }
}
