  :root {
    --bg: #0a0e1a;
    --bg2: #0f1528;
    --bg3: #141c35;
    --surface: #1a2340;
    --surface2: #1f2b4a;
    --border: #2a3a60;
    --accent: #4f9eff;
    --accent2: #7b6cff;
    --accent3: #ff6b9d;
    --accent4: #00e5c0;
    --text: #e8eeff;
    --text2: #a0aec0;
    --text3: #6b7a99;
    --gold: #ffd166;
    --sidebar-w: 300px;
    --header-h: 64px;
  }

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

  html { scroll-behavior: smooth; }

  body {
    font-family: 'Syne', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* ─── GRID BG ─── */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(rgba(79,158,255,0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(79,158,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
  }

  /* ─── HEADER ─── */
  header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: rgba(10,14,26,0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    z-index: 1000;
    gap: 1rem;
  }

  .menu-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent);
    width: 40px; height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 5px;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  .menu-btn:hover { background: var(--surface2); border-color: var(--accent); }
  .menu-btn span {
    display: block;
    width: 18px; height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: all 0.3s;
  }
  .menu-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-btn.open span:nth-child(2) { opacity: 0; }
  .menu-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .header-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.4rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.01em;
  }

  .header-badge {
    margin-left: auto;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: var(--accent4);
    background: rgba(0,229,192,0.08);
    border: 1px solid rgba(0,229,192,0.25);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  /* ─── LAYOUT ─── */
  .layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--header-h);
  }

  /* ─── SIDEBAR ─── */
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--bg2);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
  .sidebar.collapsed { transform: translateX(-100%); }

  .sidebar::-webkit-scrollbar { width: 4px; }
  .sidebar::-webkit-scrollbar-track { background: transparent; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

  .sidebar-inner { padding: 1.5rem 0; }

  .sidebar-section-title {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.15em;
    color: var(--text3);
    text-transform: uppercase;
    padding: 0.75rem 1.25rem 0.4rem;
    margin-top: 0.5rem;
  }

  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0.82rem;
    color: var(--text2);
    text-decoration: none;
    border-left: 2px solid transparent;
    position: relative;
  }
  .sidebar-item:hover {
    background: rgba(79,158,255,0.06);
    color: var(--text);
    border-left-color: var(--accent2);
  }
  .sidebar-item.active {
    background: rgba(79,158,255,0.1);
    color: var(--accent);
    border-left-color: var(--accent);
  }
  .sidebar-item .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.15s;
  }
  .sidebar-item:hover .dot,
  .sidebar-item.active .dot { background: var(--accent); }
  .sidebar-item .star {
    margin-left: auto;
    font-size: 0.6rem;
    color: var(--accent3);
  }

  /* ─── OVERLAY ─── */
  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 800;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }
  .overlay.show { display: block; }

  /* ─── MAIN CONTENT ─── */
  .main {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left 0.35s cubic-bezier(0.4,0,0.2,1);
    min-width: 0;
    position: relative;
    z-index: 1;
  }
  .main.expanded { margin-left: 0; }

  /* ─── HERO ─── */
  .hero {
    padding: 5rem 3rem 4rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
  }
  .hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(79,158,255,0.12), transparent 70%);
    pointer-events: none;
  }
  .hero::after {
    content: '';
    position: absolute;
    bottom: -80px; left: 30%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(123,108,255,0.1), transparent 70%);
    pointer-events: none;
  }

  .hero-eyebrow {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--accent4);
    text-transform: uppercase;
    margin-bottom: 1rem;
  }

  .hero-title {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.05;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #fff 30%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  .hero-sub {
    font-size: 1.05rem;
    color: var(--text2);
    max-width: 600px;
    line-height: 1.7;
    margin-bottom: 2rem;
  }

  .hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid;
    letter-spacing: 0.05em;
  }
  .tag-blue { color: var(--accent); border-color: rgba(79,158,255,0.3); background: rgba(79,158,255,0.08); }
  .tag-purple { color: var(--accent2); border-color: rgba(123,108,255,0.3); background: rgba(123,108,255,0.08); }
  .tag-pink { color: var(--accent3); border-color: rgba(255,107,157,0.3); background: rgba(255,107,157,0.08); }
  .tag-teal { color: var(--accent4); border-color: rgba(0,229,192,0.3); background: rgba(0,229,192,0.08); }

  /* ─── CONTENT AREA ─── */
  .content-area {
    padding: 2rem 3rem 4rem;
    max-width: 900px;
  }

  /* ─── SECTION ─── */
  .topic-section {
    margin-bottom: 4rem;
    scroll-margin-top: calc(var(--header-h) + 1.5rem);
  }

  .section-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .section-number {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--accent4);
    background: rgba(0,229,192,0.08);
    border: 1px solid rgba(0,229,192,0.2);
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 6px;
    flex-shrink: 0;
  }

  .section-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.8rem;
    color: var(--text);
    line-height: 1.2;
  }
  .section-title .highlight {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* ─── CONCEPT CARD ─── */
  .concept-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: border-color 0.2s, transform 0.2s;
    position: relative;
    overflow: hidden;
  }
  .concept-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: linear-gradient(to bottom, var(--accent), var(--accent2));
    border-radius: 3px 0 0 3px;
  }
  .concept-card:hover { border-color: rgba(79,158,255,0.4); transform: translateX(2px); }

  .concept-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
  }

  .concept-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.6rem;
  }

  .concept-desc {
    font-size: 0.88rem;
    color: var(--text2);
    line-height: 1.7;
  }

  /* ─── EXAMPLES ─── */
  .examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
  }

  .example-card {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
  }
  .example-card:hover { border-color: var(--accent2); }

  .example-header {
    padding: 0.7rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .example-num {
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    color: var(--gold);
    background: rgba(255,209,102,0.1);
    border: 1px solid rgba(255,209,102,0.2);
    padding: 2px 7px;
    border-radius: 4px;
  }

  .example-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
  }

  .example-body {
    padding: 1rem;
  }

  .example-body p {
    font-size: 0.82rem;
    color: var(--text2);
    line-height: 1.65;
    margin-bottom: 0.6rem;
  }

  .math-block {
    font-family: 'Space Mono', monospace;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    color: var(--accent4);
    line-height: 1.8;
    overflow-x: auto;
    white-space: pre;
    margin: 0.5rem 0;
  }

  .result-line {
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
  .result-line::before {
    content: '→';
    color: var(--accent3);
  }

  /* ─── CHAPTER DIVIDER ─── */
  .chapter-group {
    margin-bottom: 5rem;
  }

  .chapter-banner {
    background: linear-gradient(135deg, var(--surface), var(--bg3));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
  }
  .chapter-banner::after {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79,158,255,0.08), transparent 70%);
  }

  .chapter-icon {
    font-size: 2rem;
    flex-shrink: 0;
  }

  .chapter-name {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    color: var(--text);
  }
  .chapter-desc {
    font-size: 0.82rem;
    color: var(--text2);
    margin-top: 0.2rem;
  }

  /* ─── IMPORTANT BADGE ─── */
  .important-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: var(--accent3);
    background: rgba(255,107,157,0.1);
    border: 1px solid rgba(255,107,157,0.3);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
    letter-spacing: 0.05em;
  }

  /* ─── INFO BOX ─── */
  .info-box {
    background: rgba(79,158,255,0.06);
    border: 1px solid rgba(79,158,255,0.2);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    font-size: 0.84rem;
    color: var(--text2);
    line-height: 1.7;
  }
  .info-box strong { color: var(--accent); }

  /* ─── PROPERTY LIST ─── */
  .prop-list {
    list-style: none;
    margin: 0.75rem 0;
  }
  .prop-list li {
    font-size: 0.82rem;
    color: var(--text2);
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    line-height: 1.6;
  }
  .prop-list li::before {
    content: '◆';
    color: var(--accent4);
    font-size: 0.55rem;
    margin-top: 0.35rem;
    flex-shrink: 0;
  }

  /* ─── FORMULA HIGHLIGHT ─── */
  .formula {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    background: rgba(123,108,255,0.12);
    border: 1px solid rgba(123,108,255,0.25);
    color: var(--accent2);
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.82rem;
  }

  /* ─── DEFINITION BOX ─── */
  .def-box {
    background: rgba(0,229,192,0.05);
    border: 1px solid rgba(0,229,192,0.22);
    border-left: 3px solid var(--accent4);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    font-size: 0.86rem;
    color: var(--text2);
    line-height: 1.75;
  }
  .def-box .def-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    color: var(--accent4);
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    display: block;
  }
  .def-box strong { color: var(--text); }

  /* ─── FORMULA BOX ─── */
  .formula-box {
    background: rgba(123,108,255,0.07);
    border: 1px solid rgba(123,108,255,0.25);
    border-left: 3px solid var(--accent2);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
  }
  .formula-box .formula-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    color: var(--accent2);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
  }
  .formula-box .math-block {
    margin: 0;
    background: rgba(0,0,0,0.3);
  }
  .formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
  }
  .formula-item {
    background: rgba(123,108,255,0.07);
    border: 1px solid rgba(123,108,255,0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
  }
  .formula-item .fi-name {
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    color: var(--accent2);
    letter-spacing: 0.08em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
  }
  .formula-item .fi-eq {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: var(--accent4);
    line-height: 1.6;
  }

  /* ─── SPECIAL TOPIC ─── */
  .topic-subsection {
    margin-bottom: 2.5rem;
  }

  .subsec-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .subsec-title .arrow {
    color: var(--accent);
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
  }

  /* ─── FOOTER ─── */
  footer {
    border-top: 1px solid var(--border);
    padding: 2rem 3rem;
    text-align: center;
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    color: var(--text3);
    letter-spacing: 0.05em;
    margin-left: var(--sidebar-w);
    transition: margin-left 0.35s cubic-bezier(0.4,0,0.2,1);
  }
  footer.expanded { margin-left: 0; }

  /* ─── SCROLL TO TOP ─── */
  .scroll-top {
    position: fixed;
    bottom: 2rem; right: 2rem;
    width: 44px; height: 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s;
    font-size: 1.1rem;
  }
  .footer_link{
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
  }
  .scroll-top.visible { opacity: 1; transform: translateY(0); }
  .scroll-top:hover { background: var(--surface2); border-color: var(--accent); }

  /* ─── RESPONSIVE ─── */
  @media (max-width: 900px) {
    :root { --sidebar-w: 280px; }
    .content-area { padding: 1.5rem 1.5rem 3rem; }
    .hero { padding: 3rem 1.5rem 2.5rem; }
    .main { margin-left: 0 !important; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.collapsed { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    footer { margin-left: 0 !important; }
    .examples-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 480px) {
    .hero-title { font-size: 2rem; }
    .section-title { font-size: 1.4rem; }
    .content-area { padding: 1rem 1rem 3rem; }
    .hero { padding: 2rem 1rem 2rem; }
    .header-badge { display: none; }
  }

  /* ─── ANIMATIONS ─── */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .topic-section { animation: fadeUp 0.5s ease both; }
  .concept-card { animation: fadeUp 0.4s ease both; }
