:root{--bg:#ffffff;--text:#1a1a1a;--muted:#6b7280;--border:#e5e7eb;--accent:#2563eb;--footer-bg:#f3f4f6;--heart:#e11d48}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;background:var(--bg);color:var(--text)}
.app{display:grid;grid-template-columns:280px 1fr;min-height:100vh}
.app.nav-collapsed{grid-template-columns:280px 1fr}
.sidebar{position:sticky;top:0;height:100vh;overflow:auto;border-right:1px solid var(--border);background:var(--bg);display:flex;flex-direction:column;box-shadow:0 0 0 rgba(0,0,0,0);transition:transform .2s ease}
.app.nav-collapsed .sidebar{transform:translateX(-100%);position:fixed;left:0;width:280px;pointer-events:none}
.sidebar:hover{box-shadow:0 4px 20px rgba(0,0,0,0.06)}
.sidebar-header{padding:16px;font-weight:600}
.tabs{display:flex;flex-direction:column;gap:4px;padding:8px}
.tab{padding:8px 10px;border-radius:8px;text-decoration:none;color:inherit;border:1px solid transparent}
.tab:hover{background:rgba(37,99,235,0.12)}
.tab.active{border-color:#000000;background:transparent}
.tab.active:hover{background:rgba(37,99,235,0.12)}
.tab-title{display:block;font-weight:600}
.tab-updated{display:block;color:var(--muted);font-size:12px}
.content{position:relative}
.topbar{display:flex;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--bg);z-index:9}
.menu-toggle{display:inline-block;border:1px solid var(--border);background:var(--bg);border-radius:8px;padding:6px 10px;font-size:18px}
.menu-toggle,.theme-select{color:var(--text)}
.topbar-actions{margin-left:12px;display:flex;align-items:center;gap:8px}
.theme-select{border:1px solid var(--border);background:var(--bg);border-radius:8px;padding:6px 10px}
.topbar-title{font-weight:600}
.content-container{padding:24px;max-width:1000px}
.error{position:sticky;top:0;margin:0 24px 16px;padding:12px;border:1px solid #ef4444;background:#fee2e2;color:#991b1b;border-radius:8px}
.back-to-top{position:fixed;right:16px;bottom:16px;width:40px;height:40px;border:1px solid var(--border);border-radius:999px;background:#ffffff;color:#000000;font-weight:700;cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,0.15);opacity:0;pointer-events:none;transition:opacity .2s ease,transform .2s ease}
.back-to-top.show{opacity:1;pointer-events:auto}
.back-to-top:active{transform:scale(0.96)}
.toggle{display:none}
@media (max-width: 900px){
  .app{grid-template-columns:1fr}
  .menu-toggle{display:inline-block}
  .sidebar{position:fixed;top:0;left:0;height:100vh;width:80vw;max-width:320px;transform:translateX(-100%);transition:transform .2s ease;z-index:20}
  .sidebar.open{transform:translateX(0)}
  .scrim{position:fixed;inset:0;background:rgba(0,0,0,0.3);z-index:15}
}

[data-theme="dark"]{--bg:#0f1115;--text:#e5e7eb;--muted:#9aa0a6;--border:#2b2f36;--accent:#3b82f6}
[data-theme="dark"]{--footer-bg:#0b0e14;--heart:#f472b6}
article.lab-content pre{background:#0b1021;color:#e5e7eb}
/* Desktop minimizing disabled for stability */
[data-theme="dark"] .tab:hover{background:rgba(59,130,246,0.20)}
[data-theme="dark"] .tab.active{background:transparent;border-color:#000000}
[data-theme="dark"] .tab.active:hover{background:rgba(59,130,246,0.20)}
[data-theme="dark"] .back-to-top{background:#ffffff;color:#000000;border-color:#2b2f36;box-shadow:0 6px 20px rgba(0,0,0,0.35)}
article.lab-content h1,article.lab-content h2,article.lab-content h3{margin-top:1.2em}
/* Footer */
.site-footer{background:var(--footer-bg);border-top:1px solid var(--border);margin-top:24px}
.footer-inner{max-width:1000px;margin:0 auto;padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.footer-left,.footer-right{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.site-footer a{color:var(--text);text-decoration:none}
.site-footer a:hover{text-decoration:underline}
.gh-icon{display:inline-block;width:16px;height:16px;margin-right:6px}
.heart{color:var(--heart)}
article.lab-content pre{background:#0b1021;color:#e5e7eb;padding:12px;border-radius:8px;overflow:auto}
article.lab-content code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
article.lab-content table{border-collapse:collapse}
article.lab-content th,article.lab-content td{border:1px solid var(--border);padding:6px 8px}
article.lab-content p{white-space:pre-line}