:root{
  --bg: #0b0c0f;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --stroke: rgba(255,255,255,0.12);
  --accent: #66f2c3;
  --shadow: 0 16px 40px rgba(0,0,0,0.35);
  --radius: 16px;
  --radius2: 22px;
  --max: 1100px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

:root[data-theme="light"]{
  --bg: #f5f7fb;
  --panel: rgba(0,0,0,0.04);
  --panel2: rgba(0,0,0,0.06);
  --text: rgba(0,0,0,0.88);
  --muted: rgba(0,0,0,0.55);
  --stroke: rgba(0,0,0,0.12);
  --accent: #1677ff;
  --shadow: 0 16px 40px rgba(0,0,0,0.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1200px 900px at 15% 10%, rgba(102,242,195,0.08), transparent 55%),
              radial-gradient(1200px 900px at 90% 20%, rgba(22,119,255,0.10), transparent 60%),
              var(--bg);
  color:var(--text);
}

a{color:inherit; text-decoration:none}
code{font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:0.95em}

.app{
  display:grid;
  grid-template-columns: 320px 1fr;
  min-height:100vh;
}

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:18px;
  border-right:1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 45%);
  backdrop-filter: blur(10px);
}

.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px;
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand__mark{
  width:44px; height:44px;
  display:grid; place-items:center;
  border-radius:14px;
  background: rgba(102,242,195,0.14);
  border:1px solid rgba(102,242,195,0.25);
  font-weight:800;
  letter-spacing:0.4px;
}

.brand__title{font-weight:800; line-height:1.1}
.brand__sub{font-size:12px; color:var(--muted); margin-top:2px}
.brand__text{flex:1}

.search{margin:14px 0 10px}
.search input{
  width:100%;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: var(--panel);
  color:var(--text);
  outline:none;
}
.search input:focus{border-color: rgba(102,242,195,0.40)}

.nav{display:flex; flex-direction:column; gap:6px; padding:6px 0; overflow:auto; max-height: calc(100vh - 210px)}

.nav__item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid transparent;
  color: var(--muted);
}
.nav__item:hover{background: var(--panel); border-color: var(--stroke); color: var(--text)}
.nav__item.is-active{background: var(--panel2); border-color: var(--stroke); color: var(--text)}

.nav__dot{width:10px;height:10px;border-radius:999px;background: var(--stroke)}
.nav__item.is-active .nav__dot{background: var(--accent)}
.nav__label{font-size:14px; font-weight:650}

.sidebar__bottom{margin-top:12px; padding:10px 6px}
.muted{color:var(--muted)}
.small{font-size:12px}

.main{padding:0}

.topbar{
  position:sticky;
  top:0;
  z-index:5;
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 18px;
  border-bottom:1px solid var(--stroke);
  background: rgba(0,0,0,0.12);
  backdrop-filter: blur(12px);
}
:root[data-theme="light"] .topbar{background: rgba(255,255,255,0.70)}

.topbar__title{font-weight:800}
.topbar__spacer{flex:1}

.contentWrap{
  display:grid;
  grid-template-columns: 1fr 280px;
  gap:20px;
  padding: 18px;
}

.content{
  max-width: var(--max);
  width:100%;
  margin:0 auto;
  padding: 26px 26px 40px;
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.content h1{font-size:30px; margin:0 0 14px}
.content h2{font-size:20px; margin:22px 0 10px}
.content h3{font-size:16px; margin:18px 0 6px}
.content p{line-height:1.6; margin:10px 0; color: var(--text)}
.content ul{margin:10px 0 10px 18px; line-height:1.6}
.content li{margin:6px 0}
.content hr{border:0; border-top:1px solid var(--stroke); margin:22px 0}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background: var(--panel2);
  font-size:12px;
  color: var(--muted);
}

.callout{
  margin:14px 0;
  padding:14px 14px;
  border-radius: var(--radius);
  border:1px solid rgba(102,242,195,0.25);
  background: rgba(102,242,195,0.08);
}

.kv{
  display:grid;
  grid-template-columns: 180px 1fr;
  gap:12px;
  padding:12px;
  border-radius: var(--radius);
  border:1px solid var(--stroke);
  background: var(--panel2);
  margin: 12px 0;
}
.kv b{font-weight:800}

.toc{
  position:sticky;
  top:72px;
  height: calc(100vh - 90px);
  padding:14px;
  border:1px solid var(--stroke);
  border-radius: var(--radius2);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow:auto;
}
.toc__title{font-weight:800; margin-bottom:10px}
.toc__list a{display:block; padding:8px 10px; border-radius:12px; color:var(--muted); border:1px solid transparent}
.toc__list a:hover{background: var(--panel2); border-color: var(--stroke); color: var(--text)}
.toc__list a.is-active{background: var(--panel2); border-color: var(--stroke); color: var(--text)}
.toc__list a[data-level="3"]{padding-left:18px; font-size:13px}

.btn{
  padding:10px 12px;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: var(--panel);
  color: var(--text);
  cursor:pointer;
}
.btn:hover{background: var(--panel2)}

.iconbtn{
  width:36px;height:36px;
  border-radius: 12px;
  border:1px solid var(--stroke);
  background: var(--panel);
  display:grid; place-items:center;
  cursor:pointer;
}
.iconbtn svg{width:18px;height:18px; fill:none; stroke: currentColor; stroke-width:2; stroke-linecap:round}
.iconbtn:hover{background: var(--panel2)}

.footer{padding: 0 18px 18px}
.footer__inner{
  max-width: calc(var(--max) + 52px);
  margin: 0 auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 16px;
  border-radius: var(--radius2);
  border:1px solid var(--stroke);
  background: var(--panel);
}

.show-mobile{display:none}

@media (max-width: 980px){
  .app{grid-template-columns: 1fr}
  .sidebar{
    position:fixed;
    left:0; top:0;
    transform: translateX(-102%);
    width: 88vw;
    max-width: 360px;
    z-index: 50;
    transition: transform .22s ease;
    background: var(--bg);
  }
  .sidebar.is-open{transform: translateX(0)}
  .contentWrap{grid-template-columns: 1fr}
  .toc{display:none}
  .show-mobile{display:inline-grid}
}

@media print{
  .sidebar, .topbar, .toc, .footer{display:none !important}
  .contentWrap{padding:0}
  .content{border:none; box-shadow:none; background:transparent; padding:0}
  body{background:#fff}
}
