/* Night — Futuristic Space */
        :root,
        [data-theme="dark"] {
            --bg: #0b1220;
            --surface: rgba(15, 23, 42, 0.92);
            --card: rgba(30, 41, 59, 0.85);
            --card-featured: linear-gradient(135deg, rgba(49, 46, 129, 0.35), rgba(30, 41, 59, 0.9));
            --border: rgba(102, 126, 234, 0.35);
            --border-subtle: rgba(102, 126, 234, 0.2);
            --accent: #667eea;
            --accent-soft: #a5b4fc;
            --accent-glow: rgba(102, 126, 234, 0.25);
            --accent-filter-bg: rgba(102, 126, 234, 0.2);
            --accent-badge-bg: rgba(99, 102, 241, 0.12);
            --text: #f8fafc;
            --muted: #94a3b8;
            --input-bg: rgba(15, 23, 42, 0.9);
            --input-placeholder: #64748b;
            --modal-overlay: rgba(2, 6, 23, 0.72);
            --bar-bg: rgba(15, 23, 42, 0.9);
            --status-border: rgba(15, 23, 42, 0.8);
            --analyze-btn-bg: linear-gradient(135deg, rgba(102, 126, 234, 0.35), rgba(79, 70, 229, 0.25));
            --analyze-btn-border: rgba(102, 126, 234, 0.5);
            --toggle-track: linear-gradient(135deg, #1e1b4b, #0f172a);
            --toggle-thumb: linear-gradient(135deg, #818cf8, #6366f1);
            --toggle-glow: rgba(129, 140, 248, 0.45);
            --theme-dur: 0.65s;
        }
        /* Day — Futuristic White Lofi */
        [data-theme="light"] {
            --bg: #FAFAF8;
            --surface: rgba(255, 255, 255, 0.88);
            --card: rgba(255, 255, 255, 0.72);
            --card-featured: linear-gradient(135deg, rgba(196, 181, 232, 0.22), rgba(255, 255, 255, 0.92));
            --border: rgba(123, 159, 212, 0.28);
            --border-subtle: rgba(155, 181, 206, 0.18);
            --accent: #7B9FD4;
            --accent-soft: #5A7FAD;
            --accent-glow: rgba(123, 159, 212, 0.18);
            --accent-filter-bg: rgba(196, 181, 232, 0.25);
            --accent-badge-bg: rgba(168, 197, 181, 0.2);
            --text: #1A1A1E;
            --muted: #8E8E93;
            --input-bg: rgba(255, 255, 255, 0.95);
            --input-placeholder: #aeaeb2;
            --modal-overlay: rgba(250, 250, 248, 0.72);
            --bar-bg: rgba(244, 243, 240, 0.95);
            --status-border: rgba(255, 255, 255, 0.9);
            --analyze-btn-bg: linear-gradient(135deg, rgba(196, 181, 232, 0.45), rgba(155, 181, 206, 0.3));
            --analyze-btn-border: rgba(123, 159, 212, 0.45);
            --toggle-track: linear-gradient(135deg, #e8e4f8, #d4e8df);
            --toggle-thumb: linear-gradient(135deg, #f5d0a8, #f0b87a);
            --toggle-glow: rgba(245, 208, 165, 0.55);
            --theme-dur: 0.65s;
        }
        * { box-sizing: border-box; margin: 0; padding: 0; }
        html { scroll-behavior: smooth; }
        body {
            font-family: 'Inter', system-ui, sans-serif;
            background: var(--bg);
            color: var(--text);
            min-height: 100vh;
            line-height: 1.5;
            transition: background var(--theme-dur) ease, color var(--theme-dur) ease;
        }
        /* Space nebula — night */
        .cosmic-bg {
            position: fixed;
            inset: 0;
            pointer-events: none;
            z-index: 0;
            overflow: hidden;
        }
        .cosmic-nebula {
            position: absolute;
            inset: 0;
            background:
                radial-gradient(ellipse 60% 40% at 10% 0%, rgba(102, 126, 234, 0.18), transparent 55%),
                radial-gradient(ellipse 50% 35% at 90% 10%, rgba(129, 140, 248, 0.12), transparent 50%),
                radial-gradient(ellipse 40% 30% at 50% 80%, rgba(79, 70, 229, 0.08), transparent 50%);
            opacity: 1;
            transition: opacity var(--theme-dur) ease;
        }
        [data-theme="light"] .cosmic-nebula { opacity: 0; }
        .cosmic-stars-layer {
            position: absolute;
            inset: 0;
            opacity: 1;
            transition: opacity var(--theme-dur) ease;
        }
        [data-theme="light"] .cosmic-stars-layer { opacity: 0; }
        .cosmic-star {
            position: absolute;
            border-radius: 50%;
            background: #fff;
            animation: starTwinkle var(--tw-dur, 3s) ease-in-out infinite;
            animation-delay: var(--tw-delay, 0s);
        }
        @keyframes starTwinkle {
            0%, 100% { opacity: var(--tw-min, 0.25); transform: scale(1); }
            50% { opacity: 1; transform: scale(1.4); }
        }
        /* Lofi grid — day */
        .cosmic-lofi {
            position: absolute;
            inset: 0;
            opacity: 0;
            transition: opacity var(--theme-dur) ease;
            background:
                radial-gradient(ellipse 70% 50% at 15% 20%, rgba(196, 181, 232, 0.18) 0%, transparent 55%),
                radial-gradient(ellipse 60% 45% at 85% 75%, rgba(155, 181, 206, 0.14) 0%, transparent 55%),
                radial-gradient(ellipse 50% 40% at 50% 50%, rgba(168, 197, 181, 0.08) 0%, transparent 60%);
        }
        [data-theme="light"] .cosmic-lofi { opacity: 1; }
        .cosmic-lofi::before {
            content: '';
            position: absolute;
            inset: 0;
            background-image:
                linear-gradient(rgba(155, 181, 206, 0.07) 1px, transparent 1px),
                linear-gradient(90deg, rgba(155, 181, 206, 0.07) 1px, transparent 1px);
            background-size: 48px 48px;
            mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, black 20%, transparent 75%);
        }
        .demo-hub {
            position: relative;
            z-index: 1;
            max-width: 1180px;
            margin: 0 auto;
            padding: 48px 20px 120px;
        }
        .demo-hero {
            text-align: center;
            margin-bottom: 36px;
        }
        .demo-hero-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: var(--accent-badge-bg);
            color: var(--accent-soft);
            font-size: 12px;
            font-weight: 600;
            margin-bottom: 16px;
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease, color var(--theme-dur) ease;
        }
        .demo-hero h1 {
            font-size: clamp(1.75rem, 4vw, 2.5rem);
            font-weight: 700;
            letter-spacing: -0.02em;
            margin-bottom: 10px;
        }
        .demo-hero p {
            color: var(--muted);
            font-size: 15px;
            max-width: 560px;
            margin: 0 auto 24px;
        }
        .demo-stats {
            display: flex;
            justify-content: center;
            gap: 12px;
            flex-wrap: wrap;
        }
        .demo-stat {
            padding: 10px 16px;
            border-radius: 10px;
            background: var(--card);
            border: 1px solid var(--border);
            font-size: 13px;
            color: var(--muted);
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease, color var(--theme-dur) ease;
        }
        .demo-stat strong { color: var(--text); font-weight: 700; }
        .demo-toolbar {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-bottom: 28px;
            position: sticky;
            top: 12px;
            z-index: 10;
            padding: 14px;
            border-radius: 14px;
            background: var(--surface);
            border: 1px solid var(--border);
            backdrop-filter: blur(12px);
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease;
        }
        .demo-search input {
            width: 100%;
            padding: 12px 14px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--input-bg);
            color: var(--text);
            font-size: 14px;
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease, color var(--theme-dur) ease;
        }
        .demo-search input:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--accent-glow);
        }
        .demo-search input::placeholder { color: var(--input-placeholder); }
        .demo-filters {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        .demo-filter {
            padding: 7px 12px;
            border-radius: 999px;
            border: 1px solid var(--border);
            background: transparent;
            color: var(--muted);
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .demo-filter:hover,
        .demo-filter.active {
            color: var(--text);
            border-color: var(--accent);
            background: var(--accent-filter-bg);
        }
        .demo-section { margin-bottom: 36px; }
        .demo-section-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border-subtle);
        }
        .demo-section-title {
            font-size: 15px;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .demo-section-count {
            font-size: 11px;
            color: var(--muted);
            font-weight: 500;
        }
        .demo-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 12px;
        }
        .demo-card {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 16px;
            border-radius: 10px;
            background: var(--card);
            border: 1px solid var(--border);
            text-decoration: none;
            color: inherit;
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease, transform 0.25s ease, box-shadow 0.25s ease;
            position: relative;
        }
        .demo-card:hover {
            border-color: var(--accent);
            transform: translateY(-2px);
            box-shadow: 0 8px 28px var(--accent-glow);
        }
        .demo-card--featured {
            border-color: rgba(245, 158, 11, 0.45);
            background: var(--card-featured);
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease, transform 0.25s ease, box-shadow 0.25s ease;
        }
        .demo-card-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            padding: 2px 6px;
            border-radius: 4px;
            color: #fff7ed;
            background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(234, 88, 12, 0.9));
        }
        .demo-card-icon {
            width: 32px;
            height: 32px;
            fill: var(--accent);
        }
        .demo-card-name {
            font-size: 14px;
            font-weight: 600;
            padding-right: 48px;
        }
        .demo-card-desc {
            font-size: 12px;
            color: var(--muted);
            line-height: 1.45;
        }
        .demo-empty {
            text-align: center;
            padding: 48px 20px;
            color: var(--muted);
            display: none;
        }
        .demo-empty.visible { display: block; }
        .demo-analyze-row {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 10px;
            padding-top: 4px;
            border-top: 1px solid var(--border-subtle);
        }
        .demo-analyze-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 14px;
            border-radius: 8px;
            border: 1px solid var(--analyze-btn-border);
            background: var(--analyze-btn-bg);
            color: var(--text);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        .demo-analyze-btn:hover:not(:disabled) {
            border-color: var(--accent);
            box-shadow: 0 4px 16px var(--accent-glow);
        }
        .demo-analyze-btn:disabled { opacity: 0.55; cursor: not-allowed; }
        .demo-analyze-stop {
            display: none;
            align-items: center;
            gap: 6px;
            padding: 8px 14px;
            border-radius: 8px;
            border: 1px solid rgba(239, 68, 68, 0.5);
            background: rgba(239, 68, 68, 0.15);
            color: #fca5a5;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
        }
        .demo-analyze-stop.visible { display: inline-flex; }
        .demo-analyze-stop:hover { background: rgba(239, 68, 68, 0.28); }
        .demo-analyze-status {
            flex: 1;
            min-width: 200px;
            font-size: 12px;
            color: var(--muted);
        }
        .demo-analyze-status strong { color: var(--text); }
        .demo-analyze-bar {
            width: 100%;
            height: 4px;
            border-radius: 99px;
            background: var(--bar-bg);
            overflow: hidden;
            display: none;
            transition: background var(--theme-dur) ease;
        }
        .demo-analyze-bar.visible { display: block; }
        .demo-analyze-bar-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, var(--accent), #818cf8);
            transition: width 0.4s ease;
        }
        .demo-stat--pass strong { color: #4ade80; }
        .demo-stat--fail strong { color: #f87171; }
        .demo-card-status {
            position: absolute;
            top: 10px;
            left: 10px;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            border: 2px solid var(--status-border);
            display: none;
        }
        .demo-card-status.visible { display: block; }
        .demo-card-status.pass { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
        .demo-card-status.fail { background: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
        .demo-card-status.running { background: #fbbf24; animation: demo-pulse 1s ease infinite; }
        .demo-card-test-note {
            font-size: 10px;
            font-weight: 600;
            margin-top: 2px;
            display: none;
        }
        .demo-card-test-note.visible { display: block; }
        .demo-card-test-note.pass { color: #4ade80; }
        .demo-card-test-note.fail { color: #f87171; }
        .demo-card-xref {
            display: inline-block;
            margin-top: 0.5rem;
            font-size: 0.72rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            color: #22d3ee;
            background: rgba(34, 211, 238, 0.08);
            border: 1px solid rgba(34, 211, 238, 0.3);
            border-radius: 6px;
            padding: 0.25rem 0.55rem;
            text-decoration: none;
            transition: background 0.15s ease, border-color 0.15s ease;
        }
        .demo-card-xref:hover {
            background: rgba(34, 211, 238, 0.16);
            border-color: rgba(34, 211, 238, 0.6);
        }
        @keyframes demo-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.45; }
        }
        .demo-modal-overlay {
            position: fixed;
            inset: 0;
            background: var(--modal-overlay);
            backdrop-filter: blur(4px);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            transition: background var(--theme-dur) ease;
        }
        .demo-modal-overlay.open { display: flex; }
        .demo-modal {
            width: 100%;
            max-width: 380px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 22px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
        }
        .demo-modal h3 { font-size: 16px; margin-bottom: 6px; }
        .demo-modal p { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
        .demo-modal input {
            width: 100%;
            padding: 11px 12px;
            border-radius: 8px;
            border: 1px solid var(--border);
            background: var(--input-bg);
            color: var(--text);
            font-size: 14px;
            margin-bottom: 12px;
            transition: background var(--theme-dur) ease, border-color var(--theme-dur) ease, color var(--theme-dur) ease;
        }
        .demo-modal input:focus {
            outline: none;
            border-color: var(--accent);
        }
        .demo-modal-error {
            font-size: 12px;
            color: #f87171;
            min-height: 18px;
            margin-bottom: 8px;
        }
        .demo-modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
        .demo-modal-actions button {
            padding: 8px 14px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            border: 1px solid var(--border);
        }
        .demo-modal-cancel { background: transparent; color: var(--muted); }
        .demo-modal-submit {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }
        @media (max-width: 640px) {
            .demo-hub { padding-top: 72px; }
            .demo-toolbar { top: 8px; }
        }
