:root {
  --bg: #f9f9fb;
  --border: #e0e0e0;
  --user: #d1f3ff;
  --bot: #f0eaff;
  --link: #7e57c2;
  --accent: #26c6da;
  --font-main: 'Inter', sans-serif !important;
  --font-head: 'Poppins', sans-serif !important;
}

/* 🔥 ДОБАВЛЕНО/ИЗМЕНЕНО: Общие правила для box-sizing для всех элементов */
html {
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  margin: 0;
  padding: 40px 20px;
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  overflow-x: hidden; /* 🔥 Запрещаем горизонтальный скролл для body */  
}
html, body {
  height: 100%;
  margin: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg);
    overflow-x: hidden;
}

/* 🔥 НОВЫЕ СТИЛИ ДЛЯ НУЛЕВОГО ЭКРАНА (ZERO SCREEN) */
.zero-screen-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 720px;
    height: 100%; /* Занимаем всю высоту вьюпорта */
    /*padding: 20px;*/
    box-sizing: border-box;
   /* background-color: var(--bg); /* Используем фоновый цвет из переменных */
    color: #333;
    text-align: center;
}

.question-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 8px;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}


.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.option-button {
    background-color: #f0eaff; /* Цвет, похожий на bot-bubble */
    color: #333;
    border: 1px solid #d1c4e9;
    padding: 15px 20px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-align: center;
    font-family: var(--font-main);
}

.zero-screen-section .question-text {
    font-family: var(--font-head);
    font-size: clamp(18px, 1.2rem + 1vw, 24px);
    color: var(--link);
    margin-bottom: 15px;
}

.zero-screen-section .question-text span {
    font-family: var(--font-main);
    font-size: clamp(14px, 1rem + 1vw, 20px);
    font-weight: 400;
    color: #333;
}
.option-button.start {
    background-color: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}
.option-button.skip {
    background-color: var(--link);
    color: #fff;
    border: 1px solid var(--link);
}
@media (hover:hover) {
    .option-button:hover {
    background-color: #e0d8f7;
    border-color: #b39ddb;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
    .option-button.start:hover {
    background-color: #26c6da30;
    color: var(--accent);
    border: 1px solid #26c6da;
}
    .option-button.skip:hover {
    background-color: #7e57c230;
    color: var(--link);
    border: 1px solid #7e57c2;
}
}

/* Скрываем/показываем chat-wrapper через JS */
#main-chat-interface {
    display: none; /* Изначально скрыт, если используется zero-screen */
    flex-direction: column;
}

.chat-wrapper {
  width: 100%;
  max-width: 720px;
  /*height: 100%; /* Занимает 100% доступной высоты родителя (body) */
  max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 10px /* или ваш внешний padding body */);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  overflow-x: hidden; /* Обрезаем содержимое, которое выходит за границы */
  /*overflow-y: scroll;*/
}
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2%;
}
.menu i {
    font-size: 24px;
    color: var(--link);
}
.sos-btn i {
    font-size: 24px;
    color: #cc5151;
}
.top div {
    cursor: pointer;
    position: relative;
}
.top div:after {
    content: attr(data-tooltip);
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg);
    color: var(--link);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10;
}
.top div:before {
    content: '';
    position: absolute;
    top: 115%;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background-color: var(--bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9;
}
@media (hover:hover) {
    .top div:hover:after,
    .top div:hover:before {
        opacity: 1;
        visibility: visible;
    }
}
.chat-logo {
  text-align: center;
  /*margin-bottom: 12px;*/
}

.chat-logo img {
  height: 48px;
}

.chat-header {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 600;
  background: linear-gradient(to right, #26c6da, #7e57c2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
  margin-bottom: 24px;
}

.chat {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: calc(100vh / 3 * 2 - 60px);
}
.chat:has(.chat-row.bot) {
    min-height: calc(100vh / 3 * 2 - 60px);
}

/* Стили для скроллбара (только для Webkit браузеров) */
.chat::-webkit-scrollbar {
  width: 8px;
}

.chat::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

.chat::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.chat-row.user {
  justify-content: flex-end;
}
.chat-row.bot {
    scroll-margin-top: 10px; 
}

.chat-content {
  display: flex;
  flex-direction: column;
  /*gap: 8px;*/
}

.chat-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-icon .fa-user {
  font-size: 24px;
  color: var(--accent);
}

.chat-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chat-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.6; /* Увеличил line-height для лучшего соответствия высоте текста */
  white-space: normal;
  word-wrap: break-word;
  max-width: calc(100% - 10px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.chat-bubble.user {
  background-color: var(--user);
}

.chat-bubble.bot {
  background-color: var(--bot);
  padding-bottom: 32px;
}

/* Стили для Markdown-разметки внутри пузыря */
.chat-bubble p {
  margin: 0 0 10px;
}

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

.chat-bubble ul,
.chat-bubble ol {
  margin: 10px 0 10px 20px;
  padding-left: 20px;
}

.chat-bubble li {
  margin-bottom: 6px;
}

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

.chat-bubble a {
  color: var(--link);
  text-decoration: underline;
}

.chat-bubble strong {
  font-weight: bold;
}

/* Футер чата */
.chat-footer {
  display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    flex-shrink: 0;
    gap: 12px;
}

.chat-footer input,
.chat-footer textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  resize: none;
  /* 🔥 ИЗМЕНЕНИЕ: min-height для 3 строк */
  min-height: calc((16px * 1.6 * 3) + (12px * 2));
  /* 🔥 ИЗМЕНЕНИЕ: max-height для 7 строк */
  max-height: calc((16px * 1.6 * 7) + (12px * 2));
  line-height: 1.6;
  font-family: var(--font-main);
  
  display: block;
  width: 100%;
  /* 🔥 УДАЛЕНИЕ: overflow-y: hidden; - теперь JS будет управлять */
}

.chat-footer button {
  background: linear-gradient(to right, var(--accent), var(--link));
  border: none;
  padding: 12px 20px;
  color: #fff;
  font-weight: 600;
  font-family: var(--font-head);
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}

.chat-footer button:hover {
  opacity: 0.9;
}

/* Спиннер для загрузки */
.spinner {
  display: inline-block;
  animation: spin 1.2s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

.error {
  color: #d32f2f;
  font-weight: 600;
}

/* Медиа-запросы для мобильных устройств */
@media (max-width: 600px) {
    body {
        /*padding: env(safe-area-inset-top) 10px env(safe-area-inset-bottom) 10px;*/
        padding: 10px;
        overflow: hidden;
        align-items: baseline;
    }
    .chat-wrapper {
        padding: 10px;
        overflow-x: hidden;
    }
    .chat-header {
        font-size: 20px;
        margin-bottom: 15px;
    }
    .chat {
      overflow-x: hidden;
    }
    .chat-bubble {
        font-size: 15px;
        line-height: 1.5;
    }
    .chat-footer {
        display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    flex-shrink: 0;
    gap: 12px;
    }
    .chat-footer button {
        width: 100%;
        padding: 10px 15px;
    }
    .chat-footer input,
    .chat-footer textarea {
        font-size: 15px;
        line-height: 1.5;
        /* 🔥 ИЗМЕНЕНИЕ: min-height для 3 строк на мобильных */
        min-height: calc((15px * 1.5 * 3) + (10px * 2));
        /* 🔥 ИЗМЕНЕНИЕ: max-height для 7 строк на мобильных */
        max-height: calc((15px * 1.5 * 7) + (10px * 2));
    }
}
.error {
  color: #d32f2f;
  font-weight: 600;
}

/* ======================= */
/*     СТИЛИ ONBOARDING     */
/* ======================= */

/* Контейнер для блока onboarding */
#onboarding-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px; /* Отступ снизу, чтобы чат под блоком не прилипал */
}

/* Вступительный текст */
.onboarding-intro,
.onboarding-custom {
  font-size: 18px;
  margin: 12px auto;
  color: #333;
  text-align: center;
}

/* Контейнер для вопросов-кнопок */
.onboarding-questions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: space-evenly;
}

/* Сам вопрос в виде кнопки */
.onboarding-question {
  background-color: var(--user);
    color: #333;
    border: none;
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: opacity 0.2s ease-in-out;
    flex: calc(100% / 2 - 20px);
}

.onboarding-question:hover {
  opacity: 0.9;
}

/* Медиазапросы для мобильных, если нужно */
@media (max-width: 600px) {
  .onboarding-intro,
  .onboarding-custom {
    font-size: 16px;
  }
  .onboarding-question {
    font-size: 15px;
    padding: 8px 14px;
  }
}

/* ======================= */
/*  Конец стилей Onboarding */
/* ======================= */
/* ======================= */
/*      ДИСКЛЕЙМЕРЫ        */
/* ======================= */
.disclaimers {
  margin-top: 8px;
  padding: 0 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  color: #666;
}

.disclaimers p {
  margin: 4px 0;
}
/* Контейнер для кнопок переформулирования */
.rephrase-buttons {
    display: flex;
    gap: 8px; /* Небольшой отступ между кнопками */
    margin-top: -35px; /* Отступ сверху от пузыря сообщения */
    justify-content: flex-end; /* Выравнивание кнопок по правому краю */
    padding-right: 20px; /* Отступ от правого края контейнера сообщения */
}

/* Стилизация кнопок переформулирования */
.rephrase-button {
    background-color: transparent;
    border: none;
    /*border-radius: 50%;*/
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    position: relative;
   /*box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);*/
}

i.fa-regular.fa-circle-down {
    color: var(--link);
}
i.fa-regular.fa-circle-up {
    color: var(--accent);
}
.fa-regular {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    border-radius: 100%;
}

/* Стилизация всплывающей подсказки (tooltip) */
.rephrase-button::before {
    content: attr(data-tooltip); /* Используем значение атрибута data-tooltip */
    position: absolute;
    bottom: 120%; /* Позиционирование над кнопкой */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333; /* Темный фон подсказки */
    color: #fff; /* Белый текст подсказки */
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap; /* Запрет переноса текста */
    opacity: 0; /* Изначально скрыта */
    visibility: hidden; /* Изначально скрыта */
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 10; /* Убедимся, что подсказка поверх других элементов */
}



/* Маленький треугольник-указатель для тултипа */
.rephrase-button::after {
    content: '';
    position: absolute;
    bottom: 115%; /* Корректируем позицию для стрелки */
    left: 50%;
    transform: translateX(-50%) rotate(45deg); /* Поворачиваем для создания треугольника */
    width: 8px;
    height: 8px;
    background-color: #333; /* Цвет совпадает с фоном подсказки */
    opacity: 0; /* Изначально скрыта */
    visibility: hidden; /* Изначально скрыта */
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 9; /* Ниже, чем сама подсказка */
}

@media (hover:hover) {
.rephrase-button:hover {
    background-color: #d0d0d0; /* Темнее при наведении */
    color: #333; /* Чуть темнее текст при наведении */
    border-radius: 50%;
}
.rephrase-button:hover::before {
    opacity: 1; /* Показываем при наведении */
    visibility: visible; /* Показываем при наведении */
}
.rephrase-button:hover::after {
    opacity: 1; /* Показываем при наведении */
    visibility: visible; /* Показываем при наведении */
}
}
/* style.css */

/* Общие стили для модальных окон */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); /* Полупрозрачный фон */
    display: flex; /* Для центрирования контента */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Чтобы модальное окно было поверх всего */
    padding: 20px; /* Отступ от краев экрана на мобильных */
    box-sizing: border-box; /* Для корректного padding */
}
@media screen and (max-width:600px) {
  .modal-overlay {
    align-items: baseline;
  }
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px; /* Скругленные углы */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 450px; /* Максимальная ширина */
    width: 100%; /* Занимает всю доступную ширину до max-width */
    text-align: center;
    font-family: 'Inter', sans-serif;
    color: #333;
    display: flex; /* Для компоновки элементов внутри модального окна */
    flex-direction: column;
    gap: 10px; /* Отступ между элементами */
    overflow-y: scroll;
   /* margin: 2% auto;*/
    max-height: 98%;
}

.modal-content h3 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(20px, 1.5rem + 0.5vw, 28px); /* Гибкий размер для заголовка */
    color: #1a1a1a;
    margin: 10px;
}

.modal-content p {
    font-size: clamp(16px, 1rem + 0.2vw, 18px); /* Гибкий размер для текста */
    line-height: 1.5;
    margin: 10px 0;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px; /* Отступ между кнопками */
    margin-top: 15px;
}

.modal-actions button {
    background-color: #007bff; /* Примерный цвет кнопки */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px; /* Скругленные углы */
    cursor: pointer;
    font-size: clamp(15px, 0.9rem + 0.2vw, 17px);
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-grow: 1; /* Кнопки занимают доступное пространство */
    max-width: 150px; /* Максимальная ширина для кнопок */
}

.modal-actions button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* Стиль для кнопки "Отмена" */
#confirm-reset-cancel,
#settings-cancel-btn {
    background-color: #6c757d;
}

#confirm-reset-cancel:hover,
#settings-cancel-btn:hover {
    background-color: #5a6268;
}
/* style.css */

/* ... (существующие стили, включая .modal-overlay, .modal-content и т.д.) */

/* Стили для SOS-экрана */
.sos-screen-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Используем rgba для возможности регулировки прозрачности, если нужно */
    background-color: rgba(204, 81, 81, 0.95); /* Чуть более прозрачный красный */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    color: white;
    font-family: 'Inter', sans-serif;
    /* Уменьшаем padding на маленьких экранах, используя clamp */
    padding: clamp(10px, 2vw, 40px); /* Мин 10px, масштабируется с шириной вьюпорта, макс 40px */
    box-sizing: border-box;
    text-align: center;
    /* Разрешаем прокрутку всей секции, если контент все же не помещается (на всякий случай) */
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; /* Для плавной прокрутки на iOS */
}

.sos-screen-content {
    background-color: rgba(255, 255, 255, 0.95);
    /* Адаптивный padding внутри контентного блока */
    padding: clamp(20px, 3vw, 50px); /* Мин 20px, масштабируется, макс 50px */
    border-radius: 15px; /* Немного уменьшил, чтобы лучше смотрелось */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); /* Немного уменьшил тень */
    max-width: 500px; /* Немного уменьшил max-width для более плотной компоновки на мобильных */
    width: 90%; /* Занимает 90% ширины, чтобы был отступ от краев */
    /* Используем max-height и overflow-y для скроллинга внутри контента, если он не помещается */
    max-height: 90vh; /* Максимальная высота 90% от высоты вьюпорта */
    overflow-y: auto; /* Показываем полосу прокрутки, если контент не помещается */
    -webkit-overflow-scrolling: touch; /* Для плавной прокрутки на iOS */

    color: #333;
    display: flex;
    flex-direction: column;
    /* Используем vmin для gap, чтобы он масштабировался относительно наименьшей стороны вьюпорта */
    gap: clamp(10px, 2vmin, 25px); /* Отступ между элементами */
    animation: fadeInScale 0.3s ease-out forwards;
    /* Убираем justify-content: space-evenly и align-items: center для более предсказуемого потока */
    /* Элементы будут центрироваться из-за align-items: center на родительском .sos-screen-section */
    /* justify-content: flex-start; /* Начинаем контент сверху */
    /* align-items: stretch; /* Элементы растягиваются по ширине, если нужно */
}

/* Пересмотренные стили для текста внутри SOS-экрана */
.sos-screen-content h3 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(22px, 1.6rem + 0.5vw, 32px); /* Адаптивный размер шрифта */
    color: #cc0000;
    margin-bottom: 0; /* Убираем margin-bottom, так как gap уже дает отступ */
}

.sos-screen-content p {
    font-size: clamp(16px, 1rem + 0.2vw, 19px); /* Адаптивный размер шрифта */
    line-height: 1.5;
    margin-bottom: 0; /* Убираем margin-bottom */
    color: #555;
}

.sos-screen-content .quiz-question {
    font-size: clamp(17px, 1.1rem + 0.3vw, 20px); /* Адаптивный размер шрифта */
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0; /* Убираем margin-bottom */
}

/* Стили для кнопок в SOS-экране */
.sos-screen-actions {
    display: flex;
    flex-direction: column; /* Кнопки всегда в столбец на мобильных для лучшей читаемости */
    gap: clamp(10px, 2vmin, 20px); /* Адаптивный отступ между кнопками */
    width: 100%;
    margin-top: clamp(15px, 2vw, 30px); /* Адаптивный верхний отступ */
}

.sos-screen-actions button {
    background-color: #dc3545;
    color: white;
    border: none;
    /* Адаптивный padding для кнопок */
    padding: clamp(12px, 2.5vw, 18px) clamp(20px, 4vw, 35px);
    border-radius: 12px;
    cursor: pointer;
    font-size: clamp(15px, 0.9rem + 0.2vw, 19px); /* Адаптивный размер шрифта */
    font-weight: 700;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 100%; /* Занимает всю доступную ширину */
    max-width: 350px; /* Максимальная ширина для кнопок */
    margin: 0 auto; /* Центрируем кнопки */
}

.sos-screen-actions button:hover {
    background-color: #c82333;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.sos-screen-actions button#sos-hide-btn {
    background-color: #6c757d; /* Серая кнопка "Скрыть" */
}

.sos-screen-actions button#sos-hide-btn:hover {
    background-color: #5a6268;
}

/* Стили для экстренного сообщения (например, "Call 911!") */
.emergency-alert {
    background-color: #ffcccc; /* Светло-красный фон */
    color: #cc0000; /* Темно-красный текст */
    padding: 20px;
    border-radius: 10px;
    font-size: clamp(20px, 1.4rem + 0.5vw, 28px);
    font-weight: 700;
    margin-top: 20px;
    animation: pulse 1s infinite alternate; /* Пульсирующий эффект */
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

/* Медиа-запросы для адаптивности */
@media (min-width: 768px) {
    .sos-screen-actions {
        flex-direction: row; /* Кнопки в ряд на больших экранах */
        justify-content: center;
        /* Увеличим gap на больших экранах, если нужно */
        gap: 25px;
    }
}
.emergency-alert.contacts {
    animation: none;
    padding: 2%;
}
.emergency-alert.contacts ul {
    margin: 3% auto;
}
.emergency-alert.contacts ul li {
    font-size: clamp(14px, 1rem + 0.5vw, 20px);
    text-align: left;
    margin-bottom: 3%;
}
.sos-screen-content h3,
.sos-screen-content p,
.sos-screen-content div {
    margin-top: 0;
}

/* Стили для меню настроек */
.modal-content select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: clamp(16px, 1rem + 0.2vw, 18px);
    font-family: 'Inter', sans-serif;
    color: #333;
    background-color: #f8f8f8;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* 🔥 ИЗМЕНЕНО: Новое SVG-изображение для стрелки вниз */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='%23333' d='M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-content select:hover {
    border-color: #007bff;
}

.modal-content select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Кнопки внутри модального окна настроек */
.modal-actions button#settings-save-btn {
    background-color: #28a745; /* Зеленая кнопка "Сохранить" */
}

.modal-actions button#settings-save-btn:hover {
    background-color: #218838;
}

.modal-actions button#settings-cancel-btn {
    background-color: #6c757d; /* Серая кнопка "Отмена" */
}

.modal-actions button#settings-cancel-btn:hover {
    background-color: #5a6268;
}
#settings-menu-modal .modal-content p span {
    font-weight: 600;
    color: var(--link);
}

/* Стили для Welcome Disclaimer */
.welcome-disclaimer {
    background-color: var(--border)!important; /* Более темный полупрозрачный фон */
    z-index: 1200; /* Выше всех остальных модальных окон */
    animation: fadeIn 0.3s ease-out forwards;
}

.welcome-disclaimer-content {
    background-color: var(--bg)!important; 
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromTop {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.welcome-disclaimer-content h3 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(24px, 1.8rem + 0.8vw, 32px)!important;
    color: var(--link)!important; /* Фиолетовый цвет, как у заголовка */
    margin-bottom: 0;
}

.welcome-disclaimer-content p {
    font-size: clamp(16px, 1rem + 0.2vw, 18px);
    line-height: 1.6;
    margin-bottom: 0;
    color: #555;
}

.disclaimer-options {
    display: flex;
    flex-direction: column; /* Элементы в столбец на мобильных */
    align-items: center;
    gap: 15px;
    margin-top: 10px;
}

.disclaimer-options label {
    display: flex;
    align-items: center;
    font-size: clamp(15px, 0.9rem + 0.2vw, 17px);
    color: #665!important;
    cursor: pointer;
}

.disclaimer-options input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--link); /* Цвет чекбокса */
}

.disclaimer-options button {
    background-color: var(--link); /* Фиолетовая кнопка */
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-size: clamp(16px, 1rem + 0.2vw, 18px);
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: 100%;
    max-width: 200px; /* Ограничение ширины кнопки */
}

@media (hover:hover) {
.disclaimer-options button:hover {
    background-color: #a03ce0;
    transform: translateY(-2px);
 }
}

.modal-content button.got-it-btn {
    background: linear-gradient(to right, var(--accent), var(--link));
    border: none;
    padding: 12px 20px;
    color: #fff;
    font-weight: 600;
    font-family: var(--font-head);
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.hint {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 1%;
    text-align: left;
    
}

.hint-img {
    width: 48%;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* 🔥 НОВЫЙ КЛАСС: для текста статуса загрузки */
.loading-status-text {
    white-space: nowrap; /* Жестко в одну строку, без переносов */
    /* overflow: hidden;    /* Удалено, чтобы текст не обрезался */
    /* text-overflow: ellipsis; /* Удалено, чтобы не было многоточия */
    display: inline-block; /* Для корректной работы white-space и max-width */
    font-size: 14px; /* Немного уменьшим шрифт, чтобы увеличить вероятность умещения */
    /* max-width: 100%; - это свойство здесь не нужно, т.к. мы управляем шириной родителя */
}

/* 🔥 НОВОЕ ПРАВИЛО: Если внутри .chat-bubble.bot есть .loading-status-text */
/* Это правило расширит пузырь, чтобы текст статуса помещался целиком */
.chat-bubble.bot:has(.loading-status-text) {
    max-width: 95%; /* Увеличиваем максимальную ширину пузыря, чтобы вместить длинный статус */
    /* Это переопределит общую max-width для .chat-bubble.bot, когда внутри есть .loading-status-text.
       Значение 95% даст достаточно места, но оставит небольшой отступ от края.
       Если 95% все еще недостаточно, можно увеличить до 98% или даже 100%, но будьте осторожны,
       чтобы не вызвать горизонтальный скролл на очень маленьких экранах. */
}

/* Feedback */
.survey-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 2%;
}

.survey-actions button {
    border: none;
  padding: 12px 20px;
  color: #fff;
  font-weight: 600;
  font-family: var(--font-head);
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.3s ease;
  flex-shrink: 0;
}

button#survey-start-btn {
    background: linear-gradient(to right, var(--accent), var(--link));
}
button#survey-dismiss-btn {
    background: #6c757d;
}

@media (hover:hover) {
    .survey-actions button:hover {
        opacity: 0.9;
    }
}
div#survey-question-container > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.survey-optional-text {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
div#survey-question-container textarea {
    border-radius: 4px;
    border: 1px solid #333;
    width: 100%;
}

.survey-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2% 2% 0;
}
.survey-navigation button {
    border: none;
  padding: 12px 20px;
  color: #fff;
  font-weight: 600;
  font-family: var(--font-head);
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}


button#survey-next-btn {
    float: right;
  background: linear-gradient(to right, var(--accent), var(--link));
}
button#survey-back-btn {
  float: left;
  background: #6c757d;
}

@media (hover:hover) {
    .survey-navigation button:hover {
        opacity: 0.9;
    }
}

/* Star rating styles */
.star-rating {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
    unicode-bidi: bidi-override;
    margin: 10px 0;
  line-height: 1;
  cursor: pointer;
}

.star-rating > input {
  display: none;
}

.star {
  color: #ccc; /* Цвет по умолчанию */
  font-size: 2rem;
  transition: color .2s;
}

.star.gold {
  color: gold;
}

/* Other survey specific styles */
.survey-content textarea {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.survey-content form {
    display: flex;
    flex-direction: column;
}
/* Кнопка перезагрузки */
.error-reset-button {
  background: linear-gradient(to right, var(--accent), var(--link));
  border: none;
  padding: 12px 20px;
  color: #fff;
  font-weight: 600;
  font-family: var(--font-head);
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.3s ease;
  margin-left: 50%;
  transform: translateX(-50%);
  
}

.error-reset-button:hover {
  opacity: 0.9;
}

/* Общие правила для RTL-языков */
.rtl {
  direction: rtl;
  text-align: right;
}

/* Выравнивание пузырька сообщений справа для RTL */
.chat-row.rtl,
.chat-row.rtl .rephrase-buttons{
  flex-direction: row-reverse;
}