/*==================================================
    1. ПЕРЕМЕННЫЕ И ТЕМЫ (Light & Dark)
==================================================*/
:root {
    --bg: #EAECE8;
    --dark: #2D4C3B;
    --accent: #C58B74;
    --accent-rgb: 197, 139, 116; /* Для эффектов прозрачности */
    --link-color: #A64D32;
    --white: #FFFFFF;
    --text-main: #1A3326;
    --card-bg: rgba(255, 255, 255, 0.5);
    --error: #e74c3c;
    --success: #2ecc71;
}

body.dark-mode {
    --bg: #1A2E24;
    --dark: #EAECE8;
    --accent: #D9A18C;
    --accent-rgb: 217, 161, 140;
    --link-color: #D9A18C; /* Мягкий оттенок для читабельности в темноте */
    --white: #2D4C3B;
    --text-main: #EAECE8;
    --card-bg: rgba(45, 76, 59, 0.4);
}

/* Глобальный сброс для предотвращения вылетов и горизонтального скролла */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    width: 100%;
    overflow-x: hidden; /* Жесткая блокировка горизонтального скролла на уровне окна */
}

/*==================================================
    2. БАЗОВЫЕ НАСТРОЙКИ СТРАНИЦЫ
==================================================*/
body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Manrope', sans-serif;
    margin: 0;
    padding: 0 0 60px 0; /* Мягкое завершение страницы вместо футера */
    transition: background-color 0.4s ease, color 0.4s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: -0.01em;
}

/* Универсальные правила переноса длинных слов для текстовых элементов */
h1, h2, h3, p, li {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

h1 {
    font-family: 'Lora', serif;
    color: var(--dark);
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 20px;
}

p {
    line-height: 1.6;
    opacity: 0.9;
    margin-bottom: 30px;
}

/*==================================================
    3. ШАПКА САЙТА (Header)
==================================================*/
header {
    padding: 30px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    gap: 10px; /* Слегка уменьшили зазор, чтобы элементы помещались в ряд на узких экранах */
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px; /* Управляем расстоянием между кнопками через gap вместо margin-right */
}

.btn-lang {
    text-decoration: none;
    color: var(--dark);
    font-weight: bold;
    font-size: 0.9rem;
    border: 1px solid var(--dark);
    padding: 6px 14px;
    border-radius: 10px;
    transition: opacity 0.2s;
    font-family: 'Manrope', sans-serif;
    white-space: nowrap; /* Чтобы текст кнопки переключателя не переносился */
}

.btn-theme {
    background: var(--dark);
    color: var(--bg);
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    white-space: nowrap;
}

/* ЛОГОТИПНОЕ РЕШЕНИЕ */
.em-connected-logo {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    transition: transform 0.2s ease;
    text-decoration: none;
    vertical-align: middle;
}

.em-connected-logo:hover { 
    transform: translateY(-1px); 
}

/* Общий стиль для всех половинок лого */
.em-connected-logo span {
    font-size: 14px;
    padding: 6px 12px;
    display: inline-block;
    transition: all 0.3s ease;
    letter-spacing: 1px; /* По умолчанию для всех */
}

.em-logo-empat {
    background: var(--dark);
    color: var(--bg) !important;
    font-family: 'Lora', serif;
    font-weight: 500;
    border: 1px solid var(--dark);
    border-radius: 8px 0 0 8px;
}

.em-logo-help {
    background: transparent;
    color: var(--dark);
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    border: 1px solid var(--dark);
    border-left: none;
    border-radius: 0 8px 8px 0;
    text-transform: none;
    letter-spacing: 2px !important; 
    padding-right: 14px; 
}

body.dark-mode .em-logo-help {
    background: rgba(255, 255, 255, 0.05);
}

/*==================================================
    4. КОНТЕНТ И КАРТОЧКА (Hero Section) — ВЫРАВНЕНО
==================================================*/
.container {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1000px; /* Ограничиваем контентную область сайта глобально */
    margin: 0 auto;
}

/* Динамическое приветствие */
.greeting-text {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 500;
    line-height: 1.4;
}

/* Вопрос "Желаете выговориться?" */
.hero-question {
    font-family: 'Lora', serif;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8rem;
    color: var(--dark);
    font-weight: bold;
    letter-spacing: -0.02em;
    text-align: center;
}

/* Описание сервиса */
.hero-desc {
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    color: var(--dark);
    margin-bottom: 15px;
    line-height: 1.3;
}

/* Базовый класс для карточек */
.hero-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 35px;
    padding: 40px 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    margin-bottom: 30px;
}

/* Принудительно выравниваем обычные карточки и инлайн-форму под один размер на стандартных страницах */
body:not(.article-page) .hero-card,
body:not(.article-page) .inline-form-box,
body:not(.article-page) #formContainer {
    max-width: 650px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center;
}

.hero-card p {
    line-height: 1.6;
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/*==================================================
    5. КНОПКИ ДЕЙСТВИЯ И ОТПРАВКИ ФОРМЫ
==================================================*/
.btn-main {
    font-family: 'Manrope', sans-serif;
    background-color: var(--dark);
    color: var(--bg); 
    border: none;
    padding: 20px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    width: 100%;
    max-width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(45, 76, 59, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-main:hover {
    transform: translateY(-2px);
    background-color: #365d48; 
    box-shadow: 0 8px 25px rgba(45, 76, 59, 0.3);
}

body.dark-mode .btn-main {
    background-color: var(--accent);
    color: #1A3326; 
    filter: saturate(0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .btn-main:hover {
    filter: saturate(1) brightness(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.btn-main:active {
    transform: scale(0.96);
}

/*==================================================
    6. СЕКЦИЯ ТЕГОВ ЭМОЦИЙ
==================================================*/
.emotion-section {
    margin-bottom: 15px;
    width: 100%;
}

.emotion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 5px;
    justify-content: center;
    width: 100%;
}

.tag {
    font-family: 'Manrope', sans-serif;
    background: var(--white);
    border: 1px solid var(--dark);
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    font-weight: 500;
}

.tag.active {
    background: var(--dark);
    border-color: var(--dark);
    color: var(--bg);
}

.emotion-hint {
    font-size: 0.9rem;
    margin-bottom: 10px;
    opacity: 0.8;
}

body.dark-mode .emotion-hint {
    opacity: 0.6; 
}

/*==================================================
    7. ПОЛЯ ВВОДА И ТЕКСТ
==================================================*/
.input-group {
    position: relative;
    margin-bottom: 10px;
    width: 100%;
}

textarea {
    width: 100%;
    max-width: 100%;
    height: 150px;
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 20px;
    padding: 15px;
    font-family: 'Manrope', sans-serif;
    font-size: 1rem;
    margin-bottom: 5px;
    resize: none;
    transition: border 0.3s, box-shadow 0.3s;
    display: block;
    color: var(--text-main);
}

textarea:focus, input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(197, 139, 116, 0.1);
    outline: none;
}

.dark-mode textarea {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.char-count {
    font-size: 11px;
    text-align: right;
    color: #888;
    margin-top: 2px;
    padding-right: 5px;
}

/*==================================================
    8. ОПЦИИ КОНТАКТОВ И EMAIL
==================================================*/
.contact-options {
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Manrope', sans-serif;
}

#userEmail {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border-radius: 15px;
    border: 1px solid rgba(0,0,0,0.1);
    background: var(--white);
    color: var(--text-main);
    transition: all 0.3s ease;
    font-family: 'Manrope', sans-serif;
}

.dark-mode #userEmail {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.inline-form-box {
    margin-top: 30px;
    margin-bottom: 40px;
}

/*==================================================
    9. ОШИБКИ И ВАЛИДАЦИЯ
==================================================*/
.error-text {
    color: var(--error);
    font-size: 12px;
    margin-top: 2px;
    margin-bottom: 10px;
    display: none;
    text-align: left;
    padding-left: 5px;
    animation: fadeInError 0.3s ease;
    width: 100%;
}

@keyframes fadeInError {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/*==================================================
    10. КОНТЕЙНЕР ОТВЕТА И ЛОАДЕР
==================================================*/
#formContainer {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    width: 100%;
}

#formContainer span {
    display: inline-block;
    max-width: 100%;
    word-break: break-all; /* Гарантия того, что сверхдлинный email не растянет контейнер */
}

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
}

.ai-response-container {
    text-align: left;
    padding: 10px 5px;
    animation: fadeInError 0.5s ease;
    width: 100%;
}

.loader-text {
    font-family: 'Lora', serif;
    font-size: 24px;
    font-weight: bold;
    color: var(--accent);
}

.dot-anim {
    animation: dotFade 1.5s infinite;
    opacity: 0;
    display: inline-block;
    width: 10px;
    text-align: center;
}

.dot-anim:nth-child(1) { animation-delay: 0s; }
.dot-anim:nth-child(2) { animation-delay: 0.3s; }
.dot-anim:nth-child(3) { animation-delay: 0.6s; }

@keyframes dotFade {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/*========================
    FAQ (БАЯН)
========================*/
.faq-container {
    width: 100%;
    max-width: 650px;
    margin: 0 auto 40px auto;
    text-align: left;
    padding: 0;
}

.faq-title {
    font-family: 'Lora', serif;
    text-align: center;
    margin-bottom: 25px;
    opacity: 0.8;
    font-size: 1.5rem;
}

.faq-item {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 25px;
    margin-bottom: 15px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s ease;
    width: 100%;
}

.faq-question {
    padding: 18px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    transition: background 0.3s;
    font-family: 'Manrope', sans-serif;
}

.faq-question:hover { 
    background: rgba(var(--accent-rgb), 0.05); 
}

.faq-answer {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    font-family: 'Manrope', sans-serif;
}

/* Стилизация ссылок внутри ответов */
.faq-answer a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed rgba(var(--accent-rgb), 0.4);
    padding-bottom: 1px;
    transition: color 0.25s ease, border-bottom-color 0.25s ease;
}

.faq-answer a:hover {
    color: var(--dark);
    border-bottom: 1px solid var(--dark);
}

.faq-item.active {
    transform: scale(1.02);
    border-color: var(--accent);
}

.faq-item.active .faq-answer {
    padding: 10px 25px 25px;
    max-height: 500px;
    opacity: 1;
}

.faq-item.active .faq-icon { 
    transform: rotate(45deg); 
}

.faq-icon { 
    transition: transform 0.3s; 
    color: var(--accent); 
    font-size: 1.2rem; 
}

/*==================================================
    11. СТИЛИ ДЛЯ СТРАНИЦЫ СТАТЬИ (WIKI & SIDEBAR)
==================================================*/
.wiki-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    width: 100%;
}

@media (min-width: 900px) {
    .wiki-main-grid {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
}

.wiki-content-body {
    text-align: left !important;
    margin-bottom: 0;
    width: 100%; 
    max-width: 800px; /* Удерживает идеальную ширину текстовой карточки на больших экранах */
}

.article-text-content {
    font-family: 'Manrope', sans-serif;
    font-size: 1.05rem;
    line-height: 1.7;
    width: 100%;
}

/* Применяем глобальный перенос для всех дочерних элементов статьи */
.article-text-content * {
    max-width: 100%;
}

.article-text-content h1,
.article-text-content h2,
.article-text-content h3 {
    font-family: 'Lora', serif;
    color: var(--dark);
    margin-top: 30px;
    margin-bottom: 15px;
    font-weight: 700;
}

.article-text-content h1 { font-size: 1.8rem; }
.article-text-content h2 { font-size: 1.5rem; border-bottom: 1px solid rgba(var(--accent-rgb), 0.2); padding-bottom: 8px; }
.article-text-content h3 { font-size: 1.25rem; }

.article-text-content p {
    margin-bottom: 20px;
    opacity: 0.95;
}

/* СТИЛИЗАЦИЯ ССЫЛОК ВНУТРИ ТЕКСТА СТАТЬИ */
.article-text-content a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dashed rgba(var(--accent-rgb), 0.4);
    padding-bottom: 1px;
    transition: color 0.25s ease, border-bottom-color 0.25s ease;
}

.article-text-content a:hover {
    color: var(--dark);
    border-bottom: 1px solid var(--dark);
}

.article-text-content ul, 
.article-text-content ol {
    margin-bottom: 25px;
    padding-left: 20px;
}

.article-text-content li {
    margin-bottom: 10px;
}

.article-cta {
    margin-top: 40px; 
    width: 100%;
}

/* Блок фидбека */
.article-feedback {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.feedback-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feedback-label {
    opacity: 0.8;
    font-size: 0.95rem;
}

.btn-vote, .btn-share {
    background: none;
    border: 1px solid rgba(0,0,0,0.1);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-vote:hover, .btn-share:hover {
    background: rgba(var(--accent-rgb), 0.15);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* Сайдбар */
.wiki-sidebar {
    width: 100%;
    max-width: 340px; /* Сайдбар больше не разносит по ширине */
}

@media (max-width: 899px) {
    .wiki-sidebar {
        max-width: 100%; /* На мобильных занимает всю доступную ширину */
    }
}

.sidebar-box {
    padding: 25px; 
    text-align: left;
    width: 100%;
}

.sidebar-title {
    margin-top: 0;
    margin-bottom: 20px; 
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    color: var(--dark);
}

.related-list {
    list-style: none; 
    padding: 0; 
    margin: 0;
    width: 100%;
}

.related-list li {
    margin-bottom: 15px;
    width: 100%;
}

.related-list li a {
    text-decoration: none; 
    color: var(--accent); 
    font-weight: 600; 
    font-size: 0.95rem; 
    line-height: 1.4; 
    display: block;
    transition: color 0.2s ease, transform 0.2s ease;
    width: 100%;
}

.related-list li a:hover {
    color: var(--link-color) !important;
    transform: translateX(3px);
}

.no-articles {
    opacity: 0.7; 
    font-size: 0.9rem;
}

/* Интеграция темной темы для статьи */
body.dark-mode .article-text-content h1,
body.dark-mode .article-text-content h2,
body.dark-mode .article-text-content h3 {
    color: var(--dark); 
}

body.dark-mode .article-feedback {
    border-top-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .btn-vote, 
body.dark-mode .btn-share {
    border-color: rgba(255, 255, 255, 0.1);
}

/*==================================================
    12. ТАБЛИЦЫ (Адаптивные и читабельные)
==================================================*/
.table-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 25px 0;
    clear: both;
    border-radius: 20px; /* Красивое скругление всей таблицы */
    overflow: hidden;    /* Обрезает острые углы внутренних ячеек */
    border: 1px solid rgba(var(--accent-rgb), 0.15); /* Внешняя рамка */
}

table {
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0;
    background: var(--card-bg); 
}

table td, table th {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.15);
    border-right: 1px solid rgba(var(--accent-rgb), 0.15);
    font-size: 0.95rem;
    white-space: normal;      
}

/* Убираем лишние правые границы у последней колонки и нижние у последнего ряда */
table td:last-child, table th:last-child {
    border-right: none;
}
table tr:last-child td {
    border-bottom: none;
}

table th {
    background: rgba(var(--accent-rgb), 0.12);
    font-weight: 700;
    text-align: left;
    color: var(--dark);
}

body.dark-mode table {
    color: var(--text-main);
}

/* Трансформация таблицы в карточки на мобильных устройствах */
@media screen and (max-width: 768px) {
    .table-wrapper {
        border: none !important;
        margin: 15px 0 !important;
        background: transparent !important; /* Убираем общий фон обертки */
        overflow: visible !important;        /* Чтобы тени карточек не резались */
    }

    .table-wrapper table {
        background: transparent !important; /* Убираем фон таблицы, чтобы углы tr не артефактили */
        border: none !important;
    }

    .table-wrapper table, 
    .table-wrapper tbody, 
    .table-wrapper tr, 
    .table-wrapper td {
        display: block;
        width: 100% !important;
    }

    /* Полностью скрываем строку заголовков */
    .table-wrapper thead {
        display: none !important;
    }

    /* Стилизация каждого ряда как отдельной карточки */
    .table-wrapper tr {
        background: var(--card-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(var(--accent-rgb), 0.2) !important;
        border-radius: 25px !important; /* Теперь углы гарантировано круглые в любой теме */
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.02);
        overflow: hidden; /* Защищает от вылетов фона внутренних ячеек */
    }

    body.dark-mode .table-wrapper tr {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); /* Приятная тень для темной темы */
    }

    /* Первая ячейка (Название метода) становится заголовком карточки */
    .table-wrapper tr td:first-child {
        font-family: 'Lora', serif;
        font-size: 1.2rem;
        font-weight: bold;
        color: var(--dark);
        padding: 0 0 12px 0 !important;
        border: none !important;
        border-bottom: 1px solid rgba(var(--accent-rgb), 0.2) !important;
        margin-bottom: 12px;
    }

    /* Вторая ячейка (Что делать) становится основным текстом */
    .table-wrapper tr td:last-child {
        font-family: 'Manrope', sans-serif;
        font-size: 1rem;
        line-height: 1.6;
        color: var(--text-main);
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        opacity: 0.95;
    }
}

/*==================================================
    13. СУЧАСНЕ TOAST-УВЕДОМЛЕННЯ (Toast)
==================================================*/
#toast-notification {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--accent);
    color: var(--bg);
    padding: 16px 28px;
    border-radius: 16px;
    font-family: 'Manrope', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s ease, opacity 0.4s ease, visibility 0.4s ease;
    z-index: 2000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    max-width: 90%; 
    text-align: center;
}

#toast-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/*==================================================
    14. ДОПОЛНИТЕЛЬНЫЕ ЭЛЕМЕНТЫ СТАТЬИ
==================================================*/
/* СКРОМНЫЙ ДИСКЛЕЙМЕР (СНОСКА) */
.article-disclaimer {
    margin: 30px 0;
    padding-left: 15px;
    border-left: 2px solid var(--text-main); /* Тонкая линия в цвет текста */
    opacity: 0.6; /* Делает блок неброским */
    font-size: 0.85rem;
    font-style: italic;
    line-height: 1.5;
    color: var(--text-main);
    width: 100%;
}

/* КРУПНЫЙ АКЦЕНТНЫЙ БЛОК CTA В КОНЦЕ СТАТЬИ */
.cta-section {
    margin: 40px 0;
    padding: 25px 30px;
    background: rgba(197, 139, 116, 0.1); /* Тёплый полупрозрачный фон */
    border-radius: 15px;
    font-family: 'Manrope', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-main);
    text-align: center; 
    width: 100%;
}

.article-header {
    text-align: center;
    margin-bottom: 20px; /* Убран негативный маргин (-30px), который наползал на контент */
    display: block;
    width: 100%;
}

.article-header h1 {
    display: block;
    width: 100%;
    margin-bottom: 30px;
    font-size: 2rem;
    line-height: 1.2;
}

.article-header .subtitle {
    display: block; 
    width: 100%;
    font-size: 1.1rem;
    color: var(--text-main);
    opacity: 0.8;
    font-style: italic;
    margin-top: 15px;  /* Уменьшен гигантский отступ */
    line-height: 1.4;
}

.article section {
    margin-bottom: 30px;
    display: block;
    width: 100%;
}

/*==================================================
    15. ГЛОБАЛЬНЫЕ И МОБИЛЬНЫЕ ИСПРАВЛЕНИЯ
==================================================*/
@media (max-width: 900px) {
    .wiki-main-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .container {
        padding: 15px;
    }
    
    .wiki-content-body {
        padding: 30px 15px !important;
        border-radius: 25px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Оптимизация шапки на смартфонах */
@media (max-width: 480px) {
    header {
        flex-direction: row !important; /* Принудительно держим в одну линию */
        justify-content: space-between !important;
        align-items: center !important;
        padding: 30px 10px !important; /* Чуть сжали паддинги, чтобы выиграть место */
    }
    
    .em-connected-logo span {
        font-size: 12px !important; /* Логотип деликатно уменьшается на экранах вроде iPhone SE */
        padding: 5px 8px !important;
    }
    
    .btn-lang {
        padding: 5px 10px !important;
        font-size: 0.8rem !important;
    }
    
    .btn-theme {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
    }
}

@media (max-width: 600px) {
    .hero-card, .inline-form-box, #formContainer {
        padding: 25px 15px !important;
        border-radius: 25px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Дополнительная подстраховка для страницы самой статьи */
    body.article-page .hero-card {
        padding: 25px 12px !important;
    }

    .article-header h1 {
        font-size: 1.6rem;
    }

    .article-text-content h1 { font-size: 1.5rem; }
    .article-text-content h2 { font-size: 1.35rem; }
    .article-text-content h3 { font-size: 1.2rem; }
    .article-text-content p { font-size: 1rem; }

    /* На маленьких телефонах разворачиваем кнопки фидбека друг под друга */
    .article-feedback {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: center;
        gap: 15px !important;
    }

    .feedback-group {
        justify-content: center;
        width: 100%;
    }
    
    #toast-notification {
        font-size: 0.85rem;
        padding: 12px 20px;
        top: 20px;
    }
    
    .cta-section {
        padding: 20px 15px !important; /* Делаем отступы компактнее на мобилках */
        font-size: 1rem; 
    }
}

/* Робот-ловушка (Единый селектор) */
.robot-trap {
    visibility: hidden;
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    z-index: -100;
}

/* Скрытие honeypot-полей, маскирующее их под доступные элементы */
.trap-hidden {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
}