/* 在线样例 — 双栏目录 + 预览布局（兼容移动端与主流桌面浏览器） */

[hidden] {
    display: none !important;
}

.docs-demos-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-top: 0;
    min-width: 0;
}

.docs-demos-layout > * {
    min-width: 0;
}

.demo-compat-banner {
    display: none;
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #fffaf0;
    border: 1px solid #fbd38d;
    color: #c05621;
    font-size: 0.9rem;
    line-height: 1.55;
}

.demo-update-notice {
    margin: 0.75rem 0 0;
    padding: 0.9rem 1.15rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #ebf8ff 0%, #fffbeb 100%);
    border: 2px solid #005AAC;
    box-shadow: 0 2px 8px rgba(0, 90, 172, 0.12);
    color: #1a365d;
    font-size: 0.95rem;
    line-height: 1.65;
}

/* 在线样例页顶栏：主说明 + 双列提示 */
.docs-header--demos {
    margin-bottom: 1.5rem;
    max-width: none;
}

.docs-header--demos h1 {
    margin-bottom: 0.75rem;
}

.demo-intro-panel {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding: 1.15rem 1.25rem 1.25rem;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.demo-intro-panel--full {
    grid-column: 1 / -1;
}

.demo-intro-lead {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
    color: #4a5568;
}

.demo-intro-lead a {
    font-weight: 600;
    color: #005AAC;
    text-decoration: none;
}

.demo-intro-lead a:hover {
    text-decoration: underline;
}

.demo-intro-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #edf2f7;
}

.demo-intro-note {
    padding: 0.75rem 0.85rem 0.8rem;
    border-radius: 8px;
    background: #f8fafc;
    border-left: 3px solid #cbd5e0;
}

.demo-intro-note--warn {
    background: #fffaf0;
    border-left-color: #ed8936;
}

.demo-intro-note--info {
    background: #ebf8ff;
    border-left-color: #005AAC;
}

.demo-intro-note-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #718096;
}

.demo-intro-note--warn .demo-intro-note-label {
    color: #c05621;
}

.demo-intro-note--info .demo-intro-note-label {
    color: #005AAC;
}

.demo-intro-note p {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #2d3748;
}

.demo-intro-note strong {
    font-weight: 600;
    color: #1a202c;
}

.demo-intro-note--warn strong {
    color: #c05621;
}

.demo-update-notice strong {
    color: #c53030;
    font-weight: 700;
}

.demo-update-notice a {
    font-weight: 700;
    color: #005AAC;
    white-space: nowrap;
}

.demo-update-notice a:hover {
    text-decoration: underline;
}

.demo-no-module .demo-compat-banner--nomodule,
.demo-no-script .demo-compat-banner--noscript {
    display: block;
}

.demo-sidebar {
    position: -webkit-sticky;
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.demo-nav-cat {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #718096;
    margin: 0.75rem 1rem 0.35rem;
    padding: 0;
}

.demo-nav-list {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}

.demo-nav-list a {
    display: block;
    padding: 0.45rem 1rem;
    font-size: 0.88rem;
    color: #4a5568;
    text-decoration: none;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.demo-nav-list a:hover {
    background: #f7fafc;
    color: #005AAC;
}

.demo-nav-list a.is-active {
    background: #eff6ff;
    color: #005AAC;
    border-left-color: #005AAC;
    font-weight: 600;
}

.demo-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    min-width: 0;
    max-width: 100%;
}

.demo-panel h2#demo-title {
    font-size: 1.25rem;
    margin: 0 0 0.35rem;
    border: none;
    padding: 0;
    color: #2d3748;
}

.demo-panel-desc {
    color: #718096;
    font-size: 0.92rem;
    margin: 0 0 1rem;
    line-height: 1.6;
}

.demo-status {
    font-size: 0.88rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.demo-status--ok {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #276749;
}

.demo-status--warn {
    background: #fffaf0;
    border: 1px solid #fbd38d;
    color: #c05621;
}

.demo-status--error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
}

.demo-status--info {
    background: #ebf8ff;
    border: 1px solid #90cdf4;
    color: #2b6cb0;
}

.demo-toolbar {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.demo-toolbar .btn {
    display: -webkit-inline-box;
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    font-size: 0.88rem;
    padding: 0.45rem 1rem;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.demo-toolbar .btn-secondary {
    background: #edf2f7;
    color: #2d3748;
    border: 1px solid #e2e8f0;
}

.demo-toolbar .btn-secondary:hover {
    background: #e2e8f0;
}

.demo-toolbar .btn:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.demo-btn-spinner {
    display: inline-block;
    width: 0.95em;
    height: 0.95em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: demo-btn-spin 0.65s linear infinite;
    flex-shrink: 0;
}

.demo-btn-spinner[hidden] {
    display: none;
}

.btn.is-loading .demo-btn-label {
    opacity: 0.88;
}

@keyframes demo-btn-spin {
    to { transform: rotate(360deg); }
}

.demo-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.demo-split--code-only {
    grid-template-columns: 1fr;
}

.demo-split h3 {
    font-size: 0.85rem;
    color: #718096;
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.demo-preview-frame {
    width: 100%;
    min-height: 220px;
    height: 280px;
    max-width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    display: block;
}

.demo-preview-frame--fit {
    background: #e2e8f0;
    min-height: 320px;
    height: 420px;
    overflow-x: hidden;
}

.demo-preview-frame--paged {
    background: #e2e8f0;
    min-height: 320px;
    height: 420px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.demo-preview-frame--scroll {
    background: #e2e8f0;
    min-height: 320px;
    height: 420px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.demo-code-wrap {
    position: relative;
    min-width: 0;
}

.demo-code-wrap pre {
    margin: 0;
    max-height: 320px;
    overflow: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.78rem;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.demo-code-wrap .docs-code-block {
    margin: 0;
}

.demo-code-wrap .docs-code-block > .docs-code {
    max-height: 320px;
}

.demo-result {
    background: #0f172a;
    color: #e2e8f0;
    padding: 1rem;
    border-radius: 8px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-height: 200px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.demo-note-list {
    margin: 1.25rem 0 0;
    padding-left: 1.2rem;
    color: #718096;
    font-size: 0.88rem;
    line-height: 1.65;
}

@media (prefers-reduced-motion: reduce) {
    .demo-btn-spinner {
        animation: none;
        border-right-color: currentColor;
        opacity: 0.65;
    }
}

@media (max-width: 960px) {
    .docs-demos-layout {
        grid-template-columns: 1fr;
    }

    .demo-sidebar {
        position: static;
        max-height: 280px;
    }

    .demo-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .demo-intro-notes {
        grid-template-columns: 1fr;
    }

    .demo-intro-panel {
        padding: 1rem;
    }

    .demo-panel {
        padding: 1rem;
    }

    .demo-toolbar .btn {
        -webkit-box-flex: 1;
        -webkit-flex: 1 1 auto;
        flex: 1 1 auto;
        text-align: center;
        min-width: calc(50% - 0.25rem);
    }

    .demo-preview-frame {
        height: 240px;
        min-height: 180px;
    }

    .demo-preview-frame--fit {
        height: 360px;
        min-height: 280px;
    }

    .demo-preview-frame--paged {
        height: 360px;
        min-height: 280px;
    }
}
