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

[hidden] {
    display: none !important;
}

.docs-demos-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-top: 1rem;
    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-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-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-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-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;
    }
}
