@media (max-width: 1280px) {
    header,
    .main-container {
        width: 100%;
        max-width: 100%;
    }

    header {
        margin: 12px 0 10px;
    }

    .main-container {
        gap: 14px;
    }

    .content {
        padding: 36px 32px;
    }
}

@media (max-width: 980px) {
    html, body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    header {
        width: 100%;
        max-width: 100%;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: space-between;
        row-gap: 12px;
        padding: 14px 18px;
        height: auto;
        margin: 12px 0 10px;
        border-radius: 12px;
    }

    .logo {
        order: 1;
        width: auto;
        flex: 0 1 auto;
        justify-content: flex-start;
        gap: 10px;
    }

    .logo-text {
        display: none;
    }

    .menu-toggle {
        order: 2;
        display: inline-flex;
        flex: 0 0 auto;
        margin-left: auto;
    }

    .nav {
        order: 3;
        display: none;
        width: 100%;
    }

    .nav.open {
        display: block;
    }

    .search {
        order: 4;
        width: 100%;
        max-width: 100%;
        margin: 0;
        flex: 1 1 100%;
        min-width: 0;
    }

    .nav-list-header {
        width: 100%;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
        padding: 10px 0;
    }

    .nav-list-header li {
        width: 100%;
    }

    .nav-list-header .separator {
        display: none;
    }

    .nav-list-header a {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .main-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 0 12px 16px;
        height: auto;
        overflow: visible;
    }

    .sidebar, 
    .content {
        height: auto;
        max-height: none;
        overflow: visible;
        border-radius: 14px;
    }

    .sidebar {
        width: 100%;
        order: 2;
        padding: 20px 16px;
    }

    .content {
        order: 1;
        width: 100%;
        max-width: 100%;
        padding: 28px 22px;
        min-height: auto;
    }

    .page-title {
        font-size: 26px;
    }

    .description {
        margin-bottom: 28px;
    }

    .next-page-card,
    .page-navigation {
        margin-top: 24px;
    }
}

@media (max-width: 720px) {
    header {
        padding: 12px 14px;
    }

    .nav-list-header {
        gap: 10px;
    }

    .search {
        padding: 0 12px;
    }

    .search-shortcut {
        display: none;
    }

    .sidebar {
        padding: 16px 12px;
    }

    .nav-title {
        padding-left: 8px;
    }

    .nav-link,
    .sub-link {
        padding: 10px 12px;
        font-size: 14px;
    }

    .content {
        padding: 22px 16px;
    }

    .breadcrumb {
        flex-wrap: wrap;
        gap: 6px;
        font-size: 12px;
    }

    .page-title {
        gap: 10px;
    }

    .title-icon {
        width: 28px;
        height: 28px;
    }

    .content-section h2 { font-size: 18px; }
    .content-section h3 { font-size: 16px; }

    .content-section p,
    .content-section ul li,
    .rule-text,
    .rule-punishment,
    .next-label,
    .next-title,
    .nav-page-title {
        font-size: 13px;
    }

    /* ФИКС НАВИГАЦИИ: Жесткий Grid 50%/50% в 1 строку */
    .page-navigation {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
        width: 100% !important;
        align-items: stretch !important;
    }

    /* Сбрасываем ограничения для потомков контейнера */
    .page-navigation > *,
    .nav-page-btn,
    .next-page-link,
    .next-page-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        padding: 12px 14px !important;
    }

    /* Выравнивание левой кнопки */
    .prev-page,
    .prev-page-card,
    .prev-page-link,
    .page-navigation > *:first-child {
        grid-column: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: flex-start !important;
        text-align: left !important;
    }

    /* Выравнивание правой кнопки */
    .next-page,
    .next-page-card,
    .next-page-link,
    .page-navigation > *:last-child {
        grid-column: 2 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: flex-end !important;
        text-align: right !important;
    }

    .related-cards {
        gap: 12px;
        flex-wrap: wrap;
        overflow-x: hidden;
        flex-direction: column;
    }

    .related-card {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 520px) {
    header {
        padding: 10px;
    }

    .nav-list-header {
        gap: 6px;
    }

    .nav-header-link {
        font-size: 12px;
    }

    .search {
        width: 100%;
    }

    .search input {
        font-size: 12px;
    }

    .content {
        padding: 18px 12px;
    }

    .page-title {
        font-size: 20px;
    }

    .description,
    .content-section p,
    .content-section ul li,
    .rule-text,
    .rule-punishment {
        font-size: 13px;
    }

    .nav-link,
    .sub-link {
        font-size: 13px;
    }

    .breadcrumb {
        font-size: 11px;
    }

    .title-icon {
        width: 24px;
        height: 24px;
    }

    /* Адаптируем шрифты меток под маленькие экраны */
    .next-label,
    .next-title,
    .nav-page-title,
    .nav-page-label,
    .prev-label,
    .prev-title {
        font-size: 12px !important;
        word-break: break-word;
    }
}