*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117; --surface: #1a1d27; --surface-2: #21253a; --border: #2a2d3e;
  --accent: #6366f1; --accent-light: #818cf8; --green: #22c55e;
  --yellow: #eab308; --red: #ef4444; --cyan: #06b6d4;
  --text: #e2e8f0; --text-2: #94a3b8; --muted: #64748b;
  --radius: 10px;
}

body { font-family: -apple-system, BlinkMacSystemFont,'Segoe UI',sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; padding-bottom: 80px; }

/* Nav */
.demo-nav { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.demo-nav .back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border); transition: color .15s, border-color .15s; }
.demo-nav .back:hover { color: var(--text); border-color: #475569; }
.demo-nav .nav-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.demo-nav .nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-light); background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.25); border-radius: 100px; padding: 3px 10px; }

/* Container */
.container { max-width: 900px; margin: 0 auto; padding: 36px 24px 80px; }

header { margin-bottom: 32px; }
header h1 { font-size: clamp(22px,4vw,34px); font-weight: 800; letter-spacing: -.02em; color: #f1f5f9; margin-bottom: 6px; }
.subtitle { font-size: 15px; color: var(--muted); }

/* nav-back kept for sub-pages */
nav { margin-bottom: 24px; }
.nav-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border); transition: all .15s; }
.nav-back:hover { color: var(--text); border-color: #475569; }

/* Intro */
.intro { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 14px; }
.intro h2 { font-size: 11px; font-weight: 700; color: var(--accent-light); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.intro p { font-size: 14px; color: var(--text-2); margin-bottom: 10px; }
.intro ul { list-style: none; display: flex; flex-direction: column; gap: 6px; padding: 0; }
.intro li { display: flex; gap: 10px; font-size: 14px; color: var(--text-2); }
.intro li::before { content: '→'; color: var(--accent-light); font-weight: 700; flex-shrink: 0; }

/* Demos cards */
.demos { margin-bottom: 24px; }
.demos h2 { font-size: 11px; font-weight: 700; color: var(--accent-light); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.demo-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 14px; }
.demo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; transition: border-color .2s, transform .2s; }
.demo-card:hover { border-color: rgba(99,102,241,.45); transform: translateY(-2px); }
.demo-icon { font-size: 2rem; }
.demo-card h3 { font-size: 17px; font-weight: 700; color: #f1f5f9; }
.demo-card > p { font-size: 14px; color: var(--muted); }
.features { flex: 1; }
.features h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; margin-top: 10px; }
.features h4:first-child { margin-top: 0; }
.features ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.features li { font-size: 13px; color: var(--text-2); }
.demo-btn { display: block; background: var(--accent); color: #fff; text-decoration: none; padding: 10px 16px; border-radius: 7px; text-align: center; font-weight: 600; font-size: 13px; transition: background .15s; }
.demo-btn:hover { background: var(--accent-light); }

/* Comparison */
.comparison { margin-bottom: 24px; }
.comparison h2 { font-size: 11px; font-weight: 700; color: var(--accent-light); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.comparison-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 14px; background: rgba(255,255,255,.04); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--text-2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* Browser info */
.browser-info { background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.2); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; font-size: 14px; color: var(--text-2); }
.browser-info h3 { font-size: 12px; font-weight: 700; color: var(--accent-light); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }

/* Controls */
.controls { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.controls h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; transition: all .15s; text-decoration: none; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-secondary:hover { color: var(--text); border-color: #475569; background: rgba(255,255,255,.04); }
.btn-success { background: rgba(34,197,94,.12); color: var(--green); border-color: rgba(34,197,94,.3); }
.btn-success:hover { background: rgba(34,197,94,.22); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; margin-bottom: 14px; }
.stat-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-number { font-size: 26px; font-weight: 700; color: var(--accent-light); display: block; line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* Demo info */
.demo-info { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.demo-info h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-light); margin-bottom: 14px; }
.demo-info ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.demo-info li { font-size: 14px; color: var(--text-2); }

/* Observer config */
.observer-config { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.observer-config h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--cyan); margin-bottom: 14px; }
.config-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.config-row label { font-size: 13px; color: var(--text-2); font-weight: 500; min-width: 110px; }
.config-row select { background: var(--surface-2, #21253a); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; outline: none; flex: 1; min-width: 200px; }
.config-row select:focus { border-color: var(--accent); }

/* Image Gallery */
.image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 14px; margin-top: 16px; }
.image-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .2s, transform .2s; }
.image-item:hover { border-color: rgba(99,102,241,.4); transform: translateY(-2px); }
.image-item img { width: 100%; height: 180px; object-fit: cover; display: block; transition: opacity .4s, filter .4s; }
.image-item .placeholder { width: 100%; height: 180px; background: var(--surface-2,#21253a); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; position: relative; overflow: hidden; }
.image-item .placeholder::after { content:''; position:absolute; inset:0; background: linear-gradient(90deg,transparent,rgba(255,255,255,.06),transparent); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.image-item .image-info { padding: 12px; }
.image-item .image-title { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.image-item .image-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 100px; display: inline-flex; }
.status-loading { background: rgba(234,179,8,.12); color: var(--yellow); }
.status-loaded { background: rgba(34,197,94,.12); color: var(--green); }
.status-error { background: rgba(239,68,68,.12); color: var(--red); }

/* Footer */
footer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-top: 24px; font-size: 14px; color: var(--muted); }

code { font-family: 'Cascadia Code','Fira Code',Consolas,monospace; font-size: .85em; background: rgba(255,255,255,.08); border-radius: 4px; padding: 2px 6px; color: var(--accent-light); }

@media (max-width: 640px) {
  .container { padding: 20px 14px; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .demo-cards { grid-template-columns: 1fr; }
}
