/* ========== БАЗОВЫЕ НАСТРОЙКИ ========== */
html {
    overflow-y: scroll;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

:root {
    --bg: #0f172a;
    --bg-card: rgba(36, 105, 100, 0.95);
    --accent: #30D5C8;
    --accent-soft: rgba(78, 166, 204, 0.12);
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #1f2937;
    --radius-lg: 16px;
    --radius-md: 10px;
    --shadow-soft: 0 5px 10px rgba(66, 70, 78, 0.65);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif, Cassandra;
    background: radial-gradient(circle at top left, #1f4e50, #296769);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    /* Финальная страховка от горизонтального скролла */
}
.icon-link {
  display: inline-block;
  width: 14px;
  height: 14px;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M8.197 5.87c1.012 1.03 1.013 2.683 0 3.713l-1.308 1.308c-1.031 1.012-2.683 1.012-3.714 0l-.067-.067c-1.012-1.031-1.012-2.683 0-3.714l1.26-1.259a2.6 2.6 0 00.432 1.48l-.548.547c-.592.603-.592 1.57 0 2.173l.053.053c.603.592 1.57.592 2.172 0l1.295-1.294c.592-.603.592-1.57 0-2.173l-.054-.053a2.6 2.6 0 00-.523-.378l.81-.81c.152.097.296.21.43.342l.068.067z" fill="%2330D5C8"/><path d="M5.809 8.126c-1.013-1.03-1.013-2.684 0-3.715l.032-.033.014-.014 1.237-1.237.014-.014.014-.014c1.031-1.013 2.684-1.013 3.715 0l.064.064c1.013 1.031 1.013 2.684 0 3.715l-1.259 1.258a2.6 2.6 0 01-.367-1.456l.572-.572c.592-.603.593-1.57 0-2.173l-.051-.05c-.603-.592-1.57-.592-2.173 0L6.594 5.182c-.593.603-.593 1.57 0 2.174l.05.051c.136.135.292.239.458.312l-.809.809a2.6 2.6 0 01-.42-.337l-.064-.065z" fill="%2330D5C8"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
  margin-right: 4px;
}

.app {
    max-width: 1400px;
    margin: 0 auto 22px;
    padding: 0 16px 10px;
    width: 100%;
}

/* ========== ОСНОВНЫЕ СТИЛИ ========== */
.page-card {
    background: rgba(57, 155, 147, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-soft);
    padding: 20px;
    width: 100%;
}

.section-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 400;
    color: var(--text);
}

.children-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.children-list li {
    margin-bottom: 8px;
}

.link-title {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.link-title:hover {
    text-decoration: underline;
}

.col-description {
    color: var(--text-muted);
    font-size: 14px;
}

/* ========== СТАТЬИ ========== */
.articles-feed {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 10px;
}

.articles-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.article-card {
    width: 100%;
    background: rgba(57, 155, 147, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.article-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.article-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    cursor: pointer;
}

.article-audio-placeholder,
.article-file-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
}

.article-content {
    padding: 5px 15px;
}

.article-title {
    margin: 0 0 4px;
    font-weight: 700;
    line-height: 1.2;
    font-size: 24px;
    margin-top: 0.5rem;
    color: var(--text);
}

.article-title-link {
    text-decoration: none;
    color: inherit;
}

.article-title-link:hover,
.article-title-link:visited,
.article-title-link:active {
    text-decoration: none;
    color: inherit;
}

.article-excerpt a,
.article-full a {
    color: #30D5C8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-excerpt a:hover,
.article-full a:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.article-excerpt a:visited,
.article-full a:visited {
    color: #30D5C8;
}

.article-excerpt a:visited:hover,
.article-full a:visited:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.article-excerpt a:active,
.article-full a:active {
    color: #e74c3c;
}

.article-full,
.article-excerpt,
.page-description {
    font-size: 16px;
    font-weight: 400;
    color: var(--text);
    font-family: inherit;
}

.article-excerpt {
    display: block;
    overflow: hidden;
    margin-bottom: 5px;
}

.article-full {
    line-height: 1.3;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    padding-top: 12px;
    margin-top: 8px;
}

.article-date {
    margin-left: 10px;
    color: var(--text-muted);
}

.article-read-more {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    color: var(--accent);
    display: inline;
    margin-left: 5px;
    position: relative;
    z-index: 10;
}

.article-read-more:hover {
    text-decoration: underline;
}

.article-full .article-read-more {
    display: inline-block;
    margin-top: 10px;
    margin-left: 0;
}

.no-articles {
    text-align: center;
    color: var(--text-muted);
    padding: 48px;
    background: rgba(15, 23, 42, 0.45);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.18);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

/* ========== РАЗДЕЛЫ (СЕКЦИИ) ========== */
.sections-block {
    width: 100%;
    margin-bottom: 10px;
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
    padding: 5px 0;
}

.section-card {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 16px;
    padding: 1px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(4px);
}

.section-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(56, 189, 248, 0.15);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.95));
    text-decoration: none;
}

.section-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.2;
    margin-top: 7px;
}

.section-card-description {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
    margin-bottom: 5px;
}

.search-category {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.badge-soft {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    display: inline-block;
}

/* Центрированный контент для статей */
.content-narrow {
    width: 100%;
    max-width: min(95%, 800px);
    margin: 0 auto;
}

.article-media-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0 5px;
}

.media-caption {
    margin: 8px 0 0;
    padding: 0 10px 10px;
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

.article-audio {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
}

.file-link {
    display: block;
    padding: 15px;
    color: var(--accent);
    text-decoration: none;
}

.file-link:hover {
    text-decoration: underline;
}

.article-text {
    width: 100%;
    overflow-x: hidden;
    margin-top: 2px;
}

.article-text a {
    color: #30D5C8;
    text-decoration: none;
    transition: color 0.2s ease;
    overflow-wrap: break-word;
}

.article-text a:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.article-text a:visited {
    color: #30D5C8;
}

.article-text a:visited:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.article-text a:active {
    color: #e74c3c;
}

.article-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text);
    max-width: 100%;
}

.article-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(229, 231, 235, 0.3);
    font-size: 0.9rem;
    color: var(--text-muted);
    gap: 1rem;
    flex-wrap: wrap;
}

.article-source,
.article-editor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-label {
    font-weight: 500;
    color: var(--text);
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
}

.footer-link:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.footer-text {
    color: var(--text-muted);
}

/* ========== СТРАНИЦЫ ========== */
.breadcrumbs {
    margin: 10px;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
}

.page-layout {
    width: 100%;
    margin-top: 10px;
}

.page-header {
    width: 100%;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0;
    line-height: 1.3;
}

.page-columns {
    display: flex;
    gap: 2px;
}

.page-left {
    flex: 0 0 20%;
    min-width: 200px;
}

.page-right {
    flex: 0 0 55%;
    margin-left: 10px;
}

.page-right a {
    color: #30D5C8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.page-right a:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.page-right a:visited {
    color: #30D5C8;
}

.page-right a:visited:hover {
    color: #a4f3ec;
    text-decoration: underline;
}

.page-right a:active {
    color: #e74c3c;
}

.subsections-list {
    background: rgba(57, 155, 147, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    padding: 1px;
}

.subsections-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.subsection-link {
    display: block;
    padding: 10px 12px;
    color: #30D5C8;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.subsection-link:hover {
    background: rgba(129, 211, 247, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    color: #a4f3ec;
}

.page-description-block,
.page-content-block {
    background: rgba(57, 155, 147, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    padding: 5px 15px;
    margin-bottom: 20px;
}

.page-description-text,
.page-content-text {
    font-size: 16px;
    line-height: 1.3;
    color: var(--text);
    margin: 0;
}

.page-media-block {
    background: rgba(57, 155, 147, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.15);
    text-align: center;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
}

.media-gallery {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.media-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 4px;
}

.media-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
}

.media-audio {
    width: 100%;
}

/* ========== БЛОКИРОВКА СКРОЛЛА (БЕЗ РЫВКОВ) ========== */
body.modal-open {
    overflow: hidden !important;
    padding-right: var(--scrollbar-width, 0px) !important;
}

/* ========== МОДАЛЬНОЕ ОКНО ВИДЕО ========== */
.video-modal.hidden {
    display: none;
}

.video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(4px);
}

.video-modal-dialog {
    position: relative;
    width: min(900px, calc(100vw - 40px));
    max-height: calc(100vh - 80px);
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.video-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(2, 6, 23, 0.75);
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.video-modal-close:hover {
    border-color: rgba(56, 189, 248, 0.6);
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent);
    transform: scale(1.1);
}

.video-modal-player {
    width: 100%;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    background: #000;
    display: block;
    object-fit: contain;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.video-modal-hint {
    margin-top: 12px;
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
}

/* ========== АДМИНКА ========== */
.actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.6);
    color: var(--text);
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.edit-btn:hover {
    border-color: var(--accent);
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    transform: translateY(-2px);
}

.delete-btn:hover {
    color: #ef4444;
    transform: translateY(-2px);
}

.table-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    margin-bottom: 30px;
}

.table-header {
    display: grid;
    grid-template-columns: 60px 2fr 120px 100px 120px;
    padding: 14px 20px;
    background: rgba(56, 189, 248, 0.08);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.table-body {
    max-height: 520px;
    overflow: auto;
}

.row {
    display: grid;
    grid-template-columns: 60px 2fr 120px 100px 120px;
    gap: 12px;
    padding: 12px 20px;
    align-items: center;
    border-top: 1px solid rgba(31, 41, 55, 0.9);
}

.row:nth-child(odd) {
    background: rgba(15, 23, 42, 0.4);
}

.row:hover {
    background: rgba(56, 189, 248, 0.05);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--accent);
    color: #0f172a;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.edit-form {
    max-width: 800px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: var(--radius-lg);
    padding: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(27, 92, 129, 0.55);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
}

.form-control:focus {
    border-color: rgba(56, 189, 248, 0.7);
    outline: none;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
}

.video-container {
    border: none;
    outline: none;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.pagination {
    margin-top: 10px;
}

.pagination-next {
    background: transparent;
    border: none;
    color: #30D5C8;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
    font-size: 18px;
}

.pagination-next:hover {
    color: #a4f3ec;
}

/* ========== СВЕТЛАЯ ТЕМА ========== */
body.light-theme {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --accent: #0891b2;
    --accent-soft: rgba(8, 145, 178, 0.1);
    --text: #272829;
    --text-muted: #475569;
    --border: #e2e8f0;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.06);
    background: radial-gradient(circle at top left, #f1f5f9, #e2e8f0);
    color: var(--text);
}

body.light-theme .page-card,
body.light-theme .article-card,
body.light-theme .table-card,
body.light-theme .edit-form,
body.light-theme .article-modal-content {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

body.light-theme .subsections-list,
body.light-theme .page-description-block,
body.light-theme .page-content-block,
body.light-theme .page-media-block,
body.light-theme .no-articles {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--border);
    color: var(--text);
}

body.light-theme .form-control {
    background: #ffffff;
    border-color: var(--border);
    color: var(--text);
}

body.light-theme .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

body.light-theme .row:nth-child(odd) {
    background: rgba(241, 245, 249, 0.5);
}

body.light-theme .row:hover {
    background: rgba(8, 145, 178, 0.05);
}

body.light-theme .table-header {
    background: rgba(8, 145, 178, 0.06);
    color: var(--text-muted);
    border-bottom-color: var(--border);
}

body.light-theme .section-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border-color: var(--border);
    color: var(--text);
}

body.light-theme .section-card:hover {
    border-color: var(--accent);
    background: linear-gradient(135deg, #f0f9ff, #ffffff);
    box-shadow: 0 8px 20px rgba(8, 145, 178, 0.12);
}

body.light-theme .article-title,
body.light-theme .section-title,
body.light-theme .page-title {
    color: var(--text);
}

body.light-theme .link-title,
body.light-theme .article-read-more,
body.light-theme .section-card-title,
body.light-theme .footer-link {
    color: var(--accent);
}

body.light-theme .article-full,
body.light-theme .article-excerpt,
body.light-theme .page-description,
body.light-theme .article-text pre {
    color: #58585a;
}

body.light-theme .col-description,
body.light-theme .subtitle,
body.light-theme .breadcrumb-link,
body.light-theme .pagination-current {
    color: var(--text-muted);
}

body.light-theme .breadcrumb-current {
    color: var(--text);
}

body.light-theme .video-modal-backdrop {
    background: rgba(119, 118, 118, 0.85);
}

body.light-theme .pagination-prev,
body.light-theme .pagination-next {
    background: rgba(8, 145, 178, 0.1);
    border-color: rgba(8, 145, 178, 0.3);
    color: var(--accent);
}

body.light-theme .pagination-prev:hover,
body.light-theme .pagination-next:hover {
    background: rgba(8, 145, 178, 0.2);
}

body.light-theme .badge-soft {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-muted);
}

body.light-theme .badge {
    background: var(--accent);
    color: #fff;
}

body.light-theme .search-input {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

body.light-theme .search-button {
    text-align: center;
}

/* ========== ФИКС МОДАЛОК (ВИДЕО И СТАТЬИ) ========== */
.video-modal,
.article-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-modal:not(.hidden),
.article-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.video-modal-backdrop,
.article-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1;
    cursor: pointer;
}

.article-modal-scroll-area {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 800px;
    height: 97%;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin: 10px 2px;
}

.article-modal-body {
    padding: 5px;
}

.article-modal-header-fixed {
    flex-shrink: 0;
    padding: 1px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: var(--bg-card);
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.article-modal-content-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 15px;
    overscroll-behavior: contain;
}

.article-modal-content {
    width: 100%;
    color: var(--text);
}

.article-modal-close {
    background: rgba(13, 110, 106, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 24px;
    width: 36px;
    height: 36px;
    margin: 5px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    pointer-events: auto;
}

.article-modal-close:hover {
    background: rgba(29, 226, 220, 0.6);
    border-color: rgba(29, 226, 220, 0.6);
    transform: scale(1.1);
}

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

.article-modal-content-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.article-modal-content-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.article-modal-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

body.light-theme .video-modal-backdrop,
body.light-theme .article-modal-backdrop {
    background: rgba(56, 55, 55, 0.9);
}

body.light-theme .article-modal-scroll-area {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .article-modal-header-fixed {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .article-modal-content-wrapper {
    background: #ffffff;
    color: #0f172a;
}

body.light-theme .video-modal-close,
body.light-theme .article-modal-close {
    background: rgba(241, 238, 238, 0.95);
    border-color: rgba(200, 200, 200, 0.3);
    color: #334155;
}

body.light-theme .video-modal-close:hover,
body.light-theme .article-modal-close:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ========== ТИПОГРАФИКА ВНУТРИ КОНТЕНТА ========== */
.article-content h1,
.article-content h2,
.article-content h3,
.page-content-text h1,
.page-content-text h2,
.page-content-text h3,
.page-description h1,
.page-description h2,
.page-description h3 {
    margin-top: 6px;
    margin-bottom: 6px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
}

.page-description p {
    margin: 10px 5px;
    color: var(--text);
}

.article-content h2,
.page-content-text h2 {
    font-size: 1.4rem;
    padding-bottom: 0.3em;
}

.article-content h3,
.page-content-text h3 {
    font-size: 1.2rem;
}

strong,
b {
    font-weight: 600;
    color: inherit;
}

body.light-theme strong,
body.light-theme b {
    color: var(--text);
}

.text-break-word {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

/* --- Похожие статьи --- */
.related-posts-section {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(238, 238, 238, 0.3);
}

.related-posts-section h3 {
    margin-top: 5px;
}

.related-title {
    margin-bottom: 10px;
    color: #fff;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.related-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(224, 224, 224, 0.3);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    background: rgba(255, 255, 255, 0.05);
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.related-thumb {
    height: 120px;
    overflow: hidden;
    background: rgba(245, 245, 245, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-thumb {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.related-info {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.related-card-title {
    font-size: 1.1rem;
    margin: 0 0 5px 0;
    line-height: 1.3;
    color: var(--text);
}

.related-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-muted);
    margin: 5px;
}
  .hidden-block {
      display: none;
  }

