*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0d1117; --surface: #161b22; --surface2: #1c2333;
  --border: #30363d; --text: #e6edf3; --text2: #8b949e;
  --accent: #d97706; --accent2: #f59e0b; --green: #3fb950;
  --blue: #58a6ff; --red: #f85149; --purple: #bc8cff; --orange: #f0883e;
  --font: 'Segoe UI', system-ui, sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;
}
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.7; }
a { color: var(--blue); text-decoration: none; }
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 270px; position: fixed; top: 0; left: 0; bottom: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100; transition: transform .3s;
}
.sb-head { padding: 20px 16px 14px; border-bottom: 1px solid var(--border); }
.sb-head h2 { font-size: 14px; font-weight: 700; color: var(--accent2); letter-spacing: .5px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.nav-sec { padding: 10px 16px 4px; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 16px;
  color: var(--text2); font-size: 13px; cursor: pointer; transition: all .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav-item.active { color: var(--accent2); background: rgba(217,119,6,.08); border-left-color: var(--accent); font-weight: 600; }
.nav-ic { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

/* Main content */
.main { margin-left: 270px; flex: 1; max-width: 900px; }
.hero {
  padding: 50px 40px 36px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(217,119,6,.06) 0%, transparent 100%);
  position: relative;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  background: rgba(217,119,6,.12); border: 1px solid rgba(217,119,6,.25);
  border-radius: 20px; font-size: 12px; color: var(--accent2); font-weight: 600; margin-bottom: 16px;
}
.hero h1 { font-size: 32px; font-weight: 800; margin-bottom: 10px; background: linear-gradient(135deg, var(--accent2), var(--orange)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 16px; color: var(--text2); max-width: 600px; }
.content { padding: 32px 40px 80px; }

/* Section */
.section { margin-bottom: 48px; }
.section-title {
  font-size: 22px; font-weight: 700; margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px;
}
.section-title .badge {
  font-size: 11px; padding: 2px 10px; border-radius: 12px; font-weight: 700;
}
.badge-beginner { background: rgba(63,185,80,.15); color: var(--green); }
.badge-intermediate { background: rgba(88,166,255,.15); color: var(--blue); }
.badge-advanced { background: rgba(188,140,255,.15); color: var(--purple); }

/* Subsection */
.sub { margin-bottom: 28px; }
.sub h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.sub p { color: var(--text2); font-size: 14px; margin-bottom: 10px; }

/* Info cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 18px 20px; margin-bottom: 14px; transition: border-color .2s;
}
.card:hover { border-color: var(--accent); }
.card h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--accent2); }
.card p, .card li { font-size: 13px; color: var(--text2); line-height: 1.6; }
.card ul { padding-left: 18px; margin-top: 6px; }
.card li { margin-bottom: 4px; }

/* Code blocks */
.code-block {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  margin: 12px 0; overflow: hidden;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: rgba(255,255,255,.03); border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text2);
}
.code-header .lang { font-weight: 600; color: var(--accent2); text-transform: uppercase; font-size: 11px; }
.code-header .copy-btn {
  background: none; border: 1px solid var(--border); color: var(--text2);
  padding: 2px 10px; border-radius: 4px; cursor: pointer; font-size: 11px;
  transition: all .2s;
}
.code-header .copy-btn:hover { border-color: var(--accent); color: var(--accent2); }
.code-header .copy-btn.copied { border-color: var(--green); color: var(--green); }
.code-body {
  padding: 14px 16px; overflow-x: auto; font-family: var(--mono); font-size: 13px;
  line-height: 1.6; color: #c9d1d9; white-space: pre;
}
.code-body::-webkit-scrollbar { height: 4px; }
.code-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Inline code */
code {
  font-family: var(--mono); background: rgba(217,119,6,.1); color: var(--accent2);
  padding: 2px 7px; border-radius: 4px; font-size: 13px;
}

/* Tabs */
.tabs { margin: 14px 0; }
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab-btn {
  padding: 8px 18px; background: none; border: none; color: var(--text2);
  font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent;
  transition: all .15s; font-family: var(--font);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent2); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; padding: 16px 0; }
.tab-panel.active { display: block; }

/* Accordion */
.accordion { margin: 14px 0; }
.acc-item { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; overflow: hidden; }
.acc-head {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600;
  transition: background .15s; user-select: none;
}
.acc-head:hover { background: var(--surface2); }
.acc-head .arrow { transition: transform .2s; color: var(--text2); font-size: 12px; }
.acc-item.open .acc-head .arrow { transform: rotate(90deg); }
.acc-body { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.acc-item.open .acc-body { max-height: 2000px; }
.acc-inner { padding: 14px 16px; }

/* SVG container */
.svg-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 24px; margin: 16px 0; text-align: center; overflow-x: auto;
}
.svg-wrap svg { max-width: 100%; height: auto; }
.svg-caption { font-size: 12px; color: var(--text2); margin-top: 10px; font-style: italic; }

/* Table */
.tbl-wrap { overflow-x: auto; margin: 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--surface); text-align: left; padding: 10px 14px; border: 1px solid var(--border); font-weight: 700; font-size: 12px; color: var(--accent2); text-transform: uppercase; letter-spacing: .5px; }
td { padding: 10px 14px; border: 1px solid var(--border); color: var(--text2); }
tr:hover td { background: rgba(255,255,255,.02); }
td code { background: rgba(255,255,255,.06); }

/* Tip/Warning */
.tip {
  border-left: 3px solid var(--accent); background: rgba(217,119,6,.06);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 14px 0;
  font-size: 13px; color: var(--text2);
}
.tip strong { color: var(--accent2); }
.warn {
  border-left: 3px solid var(--red); background: rgba(248,81,73,.06);
  padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 14px 0;
  font-size: 13px; color: var(--text2);
}
.warn strong { color: var(--red); }

/* Progress tracker */
.progress-bar {
  position: fixed; top: 0; left: 270px; right: 0; height: 3px;
  background: var(--border); z-index: 200;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0%; transition: width .3s; }

/* Mobile sidebar toggle */
.sb-toggle {
  display: none; position: fixed; bottom: 20px; right: 20px; z-index: 150;
  width: 48px; height: 48px; border-radius: 50%; background: var(--accent);
  color: #fff; border: none; font-size: 20px; cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,.4);
}

/* Scroll to top */
.scroll-top {
  position: fixed; bottom: 20px; right: 20px; z-index: 90;
  width: 40px; height: 40px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--border); color: var(--text2); font-size: 18px;
  cursor: pointer; opacity: 0; transition: all .3s; display: flex; align-items: center; justify-content: center;
}
.scroll-top.visible { opacity: 1; }
.scroll-top:hover { border-color: var(--accent); color: var(--accent2); }

/* Search */
.search-wrap { padding: 8px 16px; border-bottom: 1px solid var(--border); }
.search-input {
  width: 100%; padding: 7px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px; outline: none;
  transition: border-color .2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text2); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.section { animation: fadeIn .4s ease; }

/* Footer */
.footer { padding: 30px 40px; border-top: 1px solid var(--border); text-align: center; font-size: 12px; color: var(--text2); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .sb-toggle { display: flex; align-items: center; justify-content: center; }
  .hero { padding: 30px 20px; }
  .hero h1 { font-size: 24px; }
  .content { padding: 20px; }
  .progress-bar { left: 0; }
}
