.container {
    width: 98%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media screen and (max-width: 768px) {
    #textareaCode {
        height: 300px;
    }

    .CodeMirror {
        height: 300px;
        font-family: Menlo, Monaco, Consolas, "Andale Mono", "lucida console", "Courier New", monospace;
    }

    #iframeResult,
    #iframeResultShow {
        height: 300px;
    }

    .form-inline {
        padding: 6px 0 2px 0;
    }
}

#iframeResult,
#iframeResultShow {
    display: block;
    overflow: hidden;
    border: 0 !important;
    min-width: 100px;
    width: 100%;
    min-height: 300px;
    background-color: #fff;
}

.footer {
    text-align: center;
}

/* —— 首页实例目录 —— */
.catalog-page {
    padding-top: 1.25rem;
    padding-bottom: 2.5rem;
}

.catalog-header {
    margin-bottom: 1rem;
}

.catalog-title {
    margin: 0 0 0.35rem;
    font-size: 1.75rem;
    font-weight: 650;
    color: #1a2332;
    letter-spacing: -0.02em;
}

.catalog-desc {
    margin: 0 0 1rem;
    max-width: 42rem;
    color: #5b6777;
    font-size: 0.95rem;
    line-height: 1.55;
}

.catalog-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}

.catalog-search-wrap {
    flex: 1 1 16rem;
    max-width: 28rem;
    margin: 0;
}

.catalog-search {
    border-color: #c9d2de;
    box-shadow: none;
}

.catalog-search:focus {
    border-color: #2f6fed;
    box-shadow: 0 0 0 0.2rem rgba(47, 111, 237, 0.15);
}

.catalog-meta {
    margin: 0;
    color: #6a7686;
    font-size: 0.875rem;
}

.catalog-meta strong {
    color: #1a2332;
    font-weight: 600;
}

.catalog-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 1.5rem;
    padding: 0.65rem 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #e6ebf2;
}

.catalog-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border: 1px solid #d7dee8;
    border-radius: 0.3rem;
    background: #f7f9fc;
    color: #334155;
    font-size: 0.8125rem;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.catalog-nav-item:hover {
    background: #eef4ff;
    border-color: #9db7f0;
    color: #1d4ed8;
    text-decoration: none;
}

.catalog-nav-count {
    min-width: 1.4rem;
    padding: 0.05rem 0.3rem;
    border-radius: 0.2rem;
    background: #e8edf5;
    color: #64748b;
    font-size: 0.75rem;
    text-align: center;
}

.catalog-nav-item:hover .catalog-nav-count {
    background: #dbe7ff;
    color: #1d4ed8;
}

.catalog-section {
    margin-bottom: 1.75rem;
    scroll-margin-top: 4.5rem;
}

.catalog-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #e6ebf2;
}

.catalog-section-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 650;
    color: #1a2332;
}

.catalog-section-count {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 0.2rem;
    background: #eef2f7;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
}

.catalog-section-top {
    flex-shrink: 0;
    color: #64748b;
    font-size: 0.8125rem;
    text-decoration: none;
}

.catalog-section-top:hover {
    color: #1d4ed8;
}

.catalog-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
    gap: 0.35rem 0.5rem;
}

.catalog-link {
    display: block;
    overflow: hidden;
    padding: 0.35rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    color: #1d4ed8;
    font-size: 0.875rem;
    line-height: 1.35;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalog-link:hover {
    border-color: #c9d7f5;
    background: #f3f7ff;
    color: #1e40af;
    text-decoration: none;
}

.catalog-link.is-hidden,
.catalog-section.is-hidden,
.catalog-nav-item.is-hidden {
    display: none !important;
}

.catalog-empty {
    margin: 1.5rem 0;
    padding: 1rem 1.1rem;
    border: 1px dashed #c9d2de;
    border-radius: 0.35rem;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
}

@media screen and (max-width: 768px) {
    .catalog-title {
        font-size: 1.4rem;
    }

    .catalog-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .catalog-nav-item {
        flex: 0 0 auto;
    }

    .catalog-links {
        grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    }
}
