*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #080c16; color: #e2e8f0; overflow-x: hidden; min-height: 100vh; }
a { color: #60a5fa; text-decoration: none; }
a:hover { color: #93c5fd; text-decoration: underline; }
code, pre { font-family: 'JetBrains Mono', monospace; }
::selection { background: rgba(59,130,246,0.3); }

#app { display: flex; min-height: 100vh; }

#sidebar { position: fixed; left: 0; top: 0; width: 240px; height: 100vh; background: #0d1321; border-right: 1px solid #1e293b; display: flex; flex-direction: column; z-index: 100; transition: transform 0.3s ease; }
.sidebar-header { padding: 20px 20px 12px; border-bottom: 1px solid #1e293b; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; color: #f1f5f9; }
.logo svg { flex-shrink: 0; }

.nav-links { list-style: none; padding: 8px; flex: 1; }
.nav-links li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 500; color: #94a3b8; transition: all 0.2s; margin-bottom: 2px; }
.nav-links li:hover { background: #1a2332; color: #e2e8f0; }
.nav-links li.active { background: rgba(59,130,246,0.12); color: #60a5fa; }
.nav-links li svg { flex-shrink: 0; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid #1e293b; display: flex; justify-content: space-between; align-items: center; }
.version { font-size: 0.75rem; color: #64748b; }
.gh-link { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #94a3b8; }
.gh-link:hover { color: #e2e8f0; text-decoration: none; }

#content { margin-left: 240px; flex: 1; min-height: 100vh; position: relative; }
.page { display: none; padding: 0; }
.page.active { display: block; }

/* Mobile */
#mobileToggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: #0d1321; border: 1px solid #1e293b; border-radius: 8px; padding: 8px; cursor: pointer; color: #e2e8f0; }
#mobileOverlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 99; }

@media (max-width: 768px) {
  #mobileToggle { display: block; }
  #sidebar { transform: translateX(-240px); }
  #sidebar.open { transform: translateX(0); }
  #mobileOverlay.open { display: block; }
  #content { margin-left: 0; }
}

/* ========== HERO ========== */
.hero { position: relative; height: 80vh; min-height: 500px; max-height: 700px; overflow: hidden; }
.hero-canvas-container { position: absolute; inset: 0; }
.hero-canvas-container canvas { width: 100%; height: 100%; display: block; }
.hero-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 40px; background: radial-gradient(ellipse at center, rgba(8,12,22,0.3) 0%, rgba(8,12,22,0.85) 100%); }
.hero-overlay h1 { font-size: 3rem; font-weight: 700; background: linear-gradient(135deg, #60a5fa, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 12px; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 1.15rem; color: #94a3b8; margin-bottom: 24px; }
.hero-subtitle em { color: #c4b5fd; font-style: italic; }
.hero-quote { max-width: 700px; font-size: 0.95rem; color: #64748b; font-style: italic; line-height: 1.7; margin-bottom: 8px; }
.hero-attribution { font-size: 0.8rem; color: #475569; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; }

.btn { padding: 10px 24px; border-radius: 8px; border: none; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: transparent; color: #94a3b8; border: 1px solid #334155; }
.btn-secondary:hover { background: #1a2332; color: #e2e8f0; border-color: #475569; }
.btn-small { padding: 6px 14px; font-size: 0.8rem; background: #1e293b; color: #94a3b8; border: 1px solid #334155; border-radius: 6px; cursor: pointer; font-family: inherit; transition: all 0.2s; }
.btn-small:hover { background: #334155; color: #e2e8f0; }

/* ========== SECTIONS ========== */
.section { padding: 60px 48px; }
.section h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 32px; color: #f1f5f9; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card { background: #111827; border: 1px solid #1e293b; border-radius: 12px; padding: 24px; transition: border-color 0.2s; }
.feature-card:hover { border-color: #334155; }
.feature-icon { font-size: 1.5rem; font-weight: 700; color: #60a5fa; margin-bottom: 12px; font-family: 'JetBrains Mono', monospace; }
.feature-card h3 { font-size: 1.05rem; font-weight: 600; color: #f1f5f9; margin-bottom: 8px; }
.feature-card p { font-size: 0.85rem; color: #94a3b8; line-height: 1.6; }

.code-preview { background: #0a0f1a; }
.code-tabs { display: flex; gap: 0; margin-bottom: 0; }
.code-tab { padding: 8px 20px; background: #111827; border: 1px solid #1e293b; border-bottom: none; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 0.8rem; color: #64748b; font-family: inherit; transition: all 0.2s; }
.code-tab.active { background: #1e293b; color: #e2e8f0; }
.code-block { background: #1e293b; border: 1px solid #334155; border-radius: 0 8px 8px 8px; padding: 20px; overflow-x: auto; }
.code-block pre { margin: 0; }
.code-block code { font-size: 0.85rem; line-height: 1.6; }

.impl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.impl-card { background: #111827; border: 1px solid #1e293b; border-radius: 12px; padding: 24px; }
.impl-card h3 { font-size: 1rem; font-weight: 600; color: #f1f5f9; margin-bottom: 8px; }
.impl-card p { font-size: 0.85rem; color: #94a3b8; line-height: 1.6; margin-bottom: 12px; }
.impl-card code { display: block; font-size: 0.8rem; color: #a78bfa; background: #1e293b; padding: 8px 12px; border-radius: 6px; }

/* ========== DOCS ========== */
.docs-layout { display: flex; min-height: calc(100vh - 0px); }
.docs-sidebar { width: 220px; flex-shrink: 0; background: #0d1321; border-right: 1px solid #1e293b; padding: 24px 16px; }
.docs-sidebar h3 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; margin-bottom: 16px; }
.docs-sidebar ul { list-style: none; }
.docs-sidebar li { padding: 8px 12px; border-radius: 6px; font-size: 0.82rem; color: #94a3b8; cursor: pointer; transition: all 0.15s; margin-bottom: 2px; }
.docs-sidebar li:hover { background: #1a2332; color: #e2e8f0; }
.docs-sidebar li.active { background: rgba(59,130,246,0.12); color: #60a5fa; }
.docs-content { flex: 1; padding: 32px 48px; overflow-y: auto; max-width: 900px; }
.docs-placeholder { text-align: center; padding: 80px 20px; }
.docs-placeholder h2 { font-size: 1.3rem; color: #64748b; margin-bottom: 8px; }
.docs-placeholder p { color: #475569; }

.doc-body h1 { font-size: 1.8rem; font-weight: 700; color: #f1f5f9; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #1e293b; }
.doc-body h2 { font-size: 1.3rem; font-weight: 600; color: #e2e8f0; margin-top: 32px; margin-bottom: 12px; }
.doc-body h3 { font-size: 1.1rem; font-weight: 600; color: #e2e8f0; margin-top: 24px; margin-bottom: 8px; }
.doc-body h4 { font-size: 1rem; font-weight: 600; color: #cbd5e1; margin-top: 20px; margin-bottom: 6px; }
.doc-body p { line-height: 1.7; color: #cbd5e1; margin-bottom: 16px; font-size: 0.92rem; }
.doc-body ul, .doc-body ol { margin-bottom: 16px; padding-left: 24px; }
.doc-body li { line-height: 1.7; color: #cbd5e1; font-size: 0.92rem; margin-bottom: 4px; }
.doc-body strong { color: #f1f5f9; }
.doc-body em { color: #a78bfa; }
.doc-body blockquote { border-left: 3px solid #3b82f6; padding: 8px 16px; margin: 16px 0; background: #111827; border-radius: 0 8px 8px 0; }
.doc-body blockquote p { color: #94a3b8; margin-bottom: 0; }
.doc-body code { font-size: 0.82rem; background: #1e293b; padding: 2px 6px; border-radius: 4px; color: #a78bfa; }
.doc-body pre { margin: 16px 0; border-radius: 8px; overflow-x: auto; }
.doc-body pre code { background: none; padding: 0; font-size: 0.82rem; }
.doc-body hr { border: none; border-top: 1px solid #1e293b; margin: 32px 0; }
.doc-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.85rem; }
.doc-body th, .doc-body td { padding: 10px 14px; border: 1px solid #1e293b; text-align: left; }
.doc-body th { background: #111827; color: #e2e8f0; font-weight: 600; }
.doc-body td { color: #cbd5e1; }
.doc-body img { max-width: 100%; border-radius: 8px; margin: 16px 0; }

/* ========== MONITOR ========== */
.monitor-header { padding: 24px 24px 0; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.monitor-header h2 { font-size: 1.3rem; font-weight: 600; }
.monitor-subtitle { font-size: 0.82rem; color: #64748b; flex: 1; }
.monitor-controls { display: flex; gap: 8px; }
.monitor-layout { display: flex; gap: 0; padding: 16px 24px 24px; }
.monitor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex: 1; max-width: 520px; }
.monitor-card { background: #111827; border: 1px solid #1e293b; border-radius: 10px; padding: 16px; transition: border-color 0.3s; }
.monitor-card.status-normal { border-color: #1e293b; }
.monitor-card.status-warning { border-color: #eab308; }
.monitor-card.status-critical { border-color: #ef4444; }
.monitor-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.monitor-card-name { font-size: 0.78rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.monitor-card-status { font-size: 0.65rem; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.status-normal .monitor-card-status { background: rgba(34,197,94,0.15); color: #22c55e; }
.status-warning .monitor-card-status { background: rgba(234,179,8,0.15); color: #eab308; }
.status-critical .monitor-card-status { background: rgba(239,68,68,0.15); color: #ef4444; }
.monitor-card-value { font-size: 1.6rem; font-weight: 700; color: #f1f5f9; margin-bottom: 4px; }
.monitor-card-unit { font-size: 0.75rem; color: #64748b; }
.monitor-card-bar { height: 3px; background: #1e293b; border-radius: 2px; margin: 8px 0; overflow: hidden; }
.monitor-card-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease, background 0.3s; }
.status-normal .monitor-card-fill { background: #22c55e; }
.status-warning .monitor-card-fill { background: #eab308; }
.status-critical .monitor-card-fill { background: #ef4444; }
.monitor-card-detail { display: flex; justify-content: space-between; font-size: 0.7rem; color: #64748b; }
.monitor-card-agent { font-size: 0.68rem; color: #475569; margin-top: 6px; padding-top: 6px; border-top: 1px solid #1a2332; display: flex; justify-content: space-between; }
.monitor-card-lock { display: flex; align-items: center; gap: 4px; }
.monitor-card-lock .dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; }
.monitor-card-lock .dot.locked { background: #22c55e; }
.monitor-card-lock .dot.unlocked { background: #ef4444; }

.monitor-canvas-panel { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 12px; margin-left: 16px; }
#particleBrain { width: 100%; aspect-ratio: 16/9; background: #080c16; border: 1px solid #1e293b; border-radius: 12px; display: block; min-height: 280px; }

.monitor-summary { display: flex; gap: 16px; flex-wrap: wrap; }
.summary-item { background: #111827; border: 1px solid #1e293b; border-radius: 8px; padding: 12px 16px; flex: 1; min-width: 100px; }
.summary-item .label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; }
.summary-item .value { font-size: 1.1rem; font-weight: 600; color: #f1f5f9; margin-top: 4px; }

/* ========== NETWORK ========== */
.network-header { padding: 24px 24px 0; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.network-header h2 { font-size: 1.3rem; font-weight: 600; }
.network-subtitle { font-size: 0.82rem; color: #64748b; flex: 1; }
.network-controls { display: flex; gap: 8px; }
.network-layout { position: relative; padding: 16px 24px 24px; }
#networkCanvas { width: 100%; height: 600px; background: #080c16; border: 1px solid #1e293b; border-radius: 12px; display: block; }
.network-stats { position: absolute; top: 32px; right: 40px; background: rgba(13,19,33,0.92); border: 1px solid #1e293b; border-radius: 10px; padding: 16px; min-width: 160px; backdrop-filter: blur(8px); }
.network-stats .stat-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.8rem; }
.network-stats .stat-label { color: #64748b; }
.network-stats .stat-value { color: #e2e8f0; font-weight: 500; }

/* ========== NETWORK INFO ========== */
.network-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0 24px 32px; margin-top: 4px; }
.info-card { background: #111827; border: 1px solid #1e293b; border-radius: 10px; padding: 20px; }
.info-card h3 { font-size: 0.85rem; font-weight: 600; color: #e2e8f0; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.info-card p { font-size: 0.82rem; color: #94a3b8; line-height: 1.6; margin-bottom: 10px; }
.info-card ul, .info-card ol { padding-left: 18px; margin-bottom: 8px; }
.info-card li { font-size: 0.8rem; color: #94a3b8; line-height: 1.6; margin-bottom: 6px; }
.info-card li strong { color: #cbd5e1; }
.info-pullquote { font-style: italic; color: #64748b !important; border-left: 2px solid #3b82f6; padding-left: 12px; margin-top: 12px !important; font-size: 0.8rem; }
.dot-green, .dot-gray, .dot-purple, .dot-red { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-green { background: #22c55e; }
.dot-gray { background: #475569; }
.dot-purple { background: #a78bfa; }
.dot-gold { background: #eab308; }
.dot-cyan { background: #22d3ee; }
.dot-white { background: #f8fafc; }
.dot-red { background: #ef4444; }

/* hljs overrides */
.hljs { background: #1e293b !important; }

@media (max-width: 1024px) {
  .monitor-layout { flex-direction: column; }
  .monitor-grid { max-width: 100%; }
  .monitor-canvas-panel { margin-left: 0; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .impl-grid { grid-template-columns: 1fr; }
  .section { padding: 40px 24px; }
  .docs-layout { flex-direction: column; }
  .docs-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #1e293b; padding: 16px; }
  .docs-content { padding: 24px 20px; }
  .network-info { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .feature-grid { grid-template-columns: 1fr; }
  .monitor-grid { grid-template-columns: 1fr; }
  .hero-overlay h1 { font-size: 2rem; }
  .hero-quote { font-size: 0.85rem; }
  .hero-actions { flex-direction: column; }
  .network-info { grid-template-columns: 1fr; }
}
