:root {
  --bg: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-card: rgba(20, 20, 30, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #ffffff;
  --text-secondary: #b0b0c0;
  --text-tertiary: #7a7a90;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-tertiary: #a855f7;
  --accent-green: #10b981;
  --accent-cyan: #06b6d4;
  --accent-pink: #ec4899;
  --accent-orange: #f97316;
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --gradient-text: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
  --code-bg: rgba(99, 102, 241, 0.15);
  --header-bg: rgba(12, 12, 18, 0.8);
  --sidebar-bg: rgba(12, 12, 18, 0.6);
  --orb-opacity: 0.4;
}

/* Light Mode */
[data-theme="light"] {
  --bg: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef0f5;
  --bg-card: rgba(255, 255, 255, 0.8);
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --text-primary: #0f0f1a;
  --text-secondary: #3d3d50;
  --text-tertiary: #606075;
  --accent-primary: #5b5fc7;
  --accent-secondary: #7c3aed;
  --accent-tertiary: #9333ea;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.1);
  --code-bg: rgba(99, 102, 241, 0.1);
  --header-bg: rgba(255, 255, 255, 0.9);
  --sidebar-bg: rgba(255, 255, 255, 0.7);
  --orb-opacity: 0.25;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f9fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef0f5;
    --bg-card: rgba(255, 255, 255, 0.8);
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --text-primary: #0f0f1a;
    --text-secondary: #3d3d50;
    --text-tertiary: #606075;
    --accent-primary: #5b5fc7;
    --accent-secondary: #7c3aed;
    --accent-tertiary: #9333ea;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.1);
    --code-bg: rgba(99, 102, 241, 0.1);
    --header-bg: rgba(255, 255, 255, 0.9);
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --orb-opacity: 0.25;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  background: var(--bg);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.7;
  font-weight: 400;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Background Effects */
.background-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: var(--orb-opacity);
  animation: float 20s ease-in-out infinite;
  transition: opacity var(--transition-slow);
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
  top: -200px;
  right: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
  animation-delay: -7s;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.2) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -30px) scale(1.05); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(20px, 10px) scale(1.02); }
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 20px 40px;
  background: var(--header-bg);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  min-height: 80px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1300px) {
  .site-header {
    padding: 18px 32px;
  }
}

@media (max-width: 1150px) {
  .site-header {
    padding: 16px 28px;
    gap: 0.8rem;
  }
}

.site-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.site-header:hover::before {
  opacity: 0.5;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 24px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.logo:hover {
  transform: translateY(-1px);
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--gradient-primary);
  border-radius: var(--radius-md);
  font-size: 18px;
  color: white;
  box-shadow: var(--shadow-glow);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.logo-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.logo:hover .logo-icon::before {
  left: 100%;
}

.logo:hover .logo-icon {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.3);
}

.logo-text {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-weight: 700;
}

.logo-accent {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-left: 20px;
  border-left: 2px solid var(--accent-primary);
  position: relative;
  opacity: 0.9;
  transition: all var(--transition-normal);
}

.tagline::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--gradient-primary);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--transition-normal);
}

.site-brand:hover .tagline::before {
  transform: scaleY(1);
}

.site-brand:hover .tagline {
  color: var(--text-secondary);
  opacity: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  transition: all var(--transition-normal);
}

.search-wrapper:hover {
  transform: translateY(-1px);
}

.search-icon {
  position: absolute;
  left: 18px;
  color: var(--text-tertiary);
  font-size: 16px;
  pointer-events: none;
  transition: all var(--transition-fast);
  z-index: 1;
}

.search-wrapper:focus-within .search-icon {
  color: var(--accent-primary);
  transform: scale(1.15) rotate(15deg);
}

.header-actions input {
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  color: var(--text-primary);
  padding: 14px 20px 14px 50px;
  border-radius: var(--radius-lg);
  width: 320px;
  min-width: 200px;
  max-width: 100%;
  outline: none;
  font-size: 15px;
  font-weight: 400;
  font-family: inherit;
  transition: all var(--transition-normal);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}

@media (max-width: 1300px) {
  .header-actions input {
    width: 300px;
  }
}

@media (max-width: 1150px) {
  .header-actions input {
    width: 260px;
    padding: 13px 18px 13px 46px;
  }
}

.header-actions input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

.header-actions input:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.header-actions input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15), 0 4px 20px rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

.header-actions input:focus::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.search-shortcut {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  z-index: 3;
  pointer-events: none;
}

.search-wrapper:focus-within .search-shortcut {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 18px;
  text-decoration: none;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.social-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 0;
}

.social-link i {
  position: relative;
  z-index: 1;
  transition: all var(--transition-normal);
}

.social-link:hover {
  border-color: var(--accent-primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.social-link:hover::before {
  opacity: 1;
}

.social-link:hover i {
  transform: scale(1.1);
}

.social-link:active {
  transform: translateY(-1px);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 0;
}

.theme-toggle i {
  position: relative;
  z-index: 1;
  transition: all var(--transition-normal);
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.theme-toggle:hover::before {
  opacity: 1;
}

.theme-toggle:hover i {
  transform: scale(1.1) rotate(15deg);
}

.theme-toggle:active {
  transform: translateY(-1px);
}

.theme-toggle .fa-sun {
  display: none;
}

.theme-toggle .fa-moon {
  display: block;
}

[data-theme="light"] .theme-toggle .fa-sun {
  display: block;
}

[data-theme="light"] .theme-toggle .fa-moon {
  display: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .fa-sun {
    display: block;
  }
  :root:not([data-theme="dark"]) .theme-toggle .fa-moon {
    display: none;
  }
}

.mobile-menu-toggle {
  display: none;
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 22px;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.mobile-menu-toggle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.mobile-menu-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.5);
}

.mobile-menu-toggle:hover::before {
  opacity: 1;
}

.mobile-menu-toggle:active {
  transform: scale(1.05);
}

/* Topic Navbar */
.topic-navbar {
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 73px;
  z-index: 90;
  transition: background var(--transition-normal), border-color var(--transition-normal);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.topic-nav-inner {
  display: flex;
  justify-content: center;
  padding: 0 32px;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.topic-nav-inner::-webkit-scrollbar {
  display: none;
}

.topic-nav-list {
  display: flex;
  gap: 32px;
  list-style: none;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  justify-content: center;
}

.topic-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  color: var(--text-tertiary);
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  user-select: none;
  position: relative;
}

.topic-nav-item:hover {
  color: var(--text-secondary);
}

.topic-nav-item.active {
  color: var(--accent-primary);
  font-weight: 600;
}

/* Layout */
.layout {
  display: flex;
  flex: 1;
  gap: 32px;
  align-items: stretch;
  min-height: 0;
  position: relative;
  z-index: 1;
  max-width: 1700px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

.layout.sidebar-hidden .sidebar {
  display: none;
}

.layout.sidebar-visible .sidebar {
  display: block;
}

.layout.toc-visible .right-toc {
  display: block;
}

.layout.toc-hidden .right-toc {
  display: none;
}

/* Sidebar */
.sidebar {
  width: 300px;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  height: calc(100vh - 73px - 69px);
  overflow-y: auto;
  position: sticky;
  top: calc(73px + 69px);
  align-self: flex-start;
  flex-shrink: 0;
  transition: background var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-inner {
  padding: 20px 0;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-section {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 16px;
  padding: 16px 20px;
  margin: 0 0 20px 0;
  text-align: left;
}

.sidebar-section i.section-icon {
  font-size: 18px;
  color: var(--accent-primary);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.subtopics {
  max-height: none;
  overflow: visible;
}

.subtopics.expanded {
  max-height: none;
}

.topic-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 450;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  line-height: 1.4;
  margin: 2px 0;
}

.subtopic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.subtopic-list li {
  margin: 0;
}

.subtopic-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 450;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
  line-height: 1.4;
  margin: 1px 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.subtopic-list a:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
  border-left-color: rgba(99, 102, 241, 0.5);
  transform: translateX(2px);
}

.subtopic-list a.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--text-primary);
  font-weight: 500;
  border-left-color: var(--accent-primary);
}

.subtopic-list a i {
  font-size: 14px;
  width: 20px;
  text-align: center;
  opacity: 0.8;
  color: var(--accent-secondary);
  flex-shrink: 0;
}

/* Content Table of Contents */
.content-toc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 24px 0 32px 0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none; /* Hidden by default */
}

/* Show TOC only on tablet/desktop, hide on mobile */
@media (min-width: 901px) and (max-width: 1200px) {
  .content-toc {
    display: block;
  }
}

/* Right Side Table of Contents */
.right-toc {
  width: 280px;
  background: transparent;
  height: calc(100vh - 73px - 69px);
  overflow-y: auto;
  position: sticky;
  top: calc(73px + 69px);
  align-self: flex-start;
  flex-shrink: 0;
  padding: 20px;
  display: none; /* Hidden by default */
}

.right-toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.right-toc-card::-webkit-scrollbar {
  width: 4px;
}

.right-toc-card::-webkit-scrollbar-track {
  background: transparent;
}

.right-toc-card::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.right-toc-card::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.right-toc::-webkit-scrollbar {
  width: 6px;
}

.right-toc::-webkit-scrollbar-track {
  background: transparent;
}

.right-toc::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.right-toc::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.content-toc-header {
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.content-toc-header h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.content-toc-header i {
  color: var(--accent-primary);
  font-size: 14px;
}

.content-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  /* Remove columns for right sidebar */
}

.right-toc .content-toc-list {
  columns: 1;
  column-gap: 0;
}

.content-toc-item {
  margin: 0 0 8px 0;
  break-inside: avoid;
  page-break-inside: avoid;
}

.content-toc-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 400;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.content-toc-link:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
  transform: translateX(2px);
}

.content-toc-link.active {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
  font-weight: 500;
}

.content-toc-link i {
  font-size: 12px;
  width: 16px;
  text-align: center;
  opacity: 0.8;
  color: var(--accent-secondary);
  flex-shrink: 0;
}

.content-toc-link[data-level="1"] {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
}

.content-toc-link[data-level="1"] i {
  color: var(--accent-primary);
  font-size: 14px;
}

.content-toc-link[data-level="2"] {
  font-weight: 500;
  padding-left: 20px;
}

.content-toc-link[data-level="3"] {
  font-size: 13px;
  opacity: 0.9;
  padding-left: 28px;
}

.content-toc-link[data-level="4"],
.content-toc-link[data-level="5"],
.content-toc-link[data-level="6"] {
  font-size: 12px;
  opacity: 0.8;
  padding-left: 36px;
}

/* Content Area */
.content {
  flex: 1;
  padding: 40px 60px;
  background: transparent;
  height: calc(100vh - 73px - 69px);
  overflow-y: auto;
  min-width: 0;
  align-self: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1300px) {
  .content {
    padding: 36px 48px;
  }
}

@media (max-width: 1150px) {
  .content {
    padding: 32px 40px;
  }
}

.content::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* Welcome Hero */
.welcome-hero {
  max-width: 700px;
  padding: 60px 0;
}

.hero-badge {
  display: inline-block;
  background: var(--code-bg);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-primary);
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
  transition: background var(--transition-normal);
}

.hero-title {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 56px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 24px 0;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 20px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 40px 0;
  max-width: 560px;
}

.hero-stats {
  display: flex;
  gap: 40px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-number {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 14px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* Content Typography */
.content h1 {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 42px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 28px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.content h2 {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 48px 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.content h3 {
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 36px 0 16px 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.content h4 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 28px 0 14px 0;
  line-height: 1.4;
}

.content p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 17px;
  margin: 0 0 20px 0;
  font-weight: 400;
}

.content a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.content a:hover {
  color: var(--accent-secondary);
  text-decoration: underline;
}

.content ul,
.content ol {
  padding-left: 28px;
  margin: 0 0 20px 0;
}

.content li {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 10px 0;
  font-size: 17px;
}

.content li::marker {
  color: var(--accent-primary);
}

.content blockquote {
  padding: 16px 20px;
  margin: 24px 0;
  border-left: 4px solid var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}

.content blockquote p {
  margin: 0;
}

.content code {
  background: var(--code-bg);
  color: var(--accent-secondary);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 15px;
  font-weight: 500;
}

/* Code Blocks */
pre {
  position: relative;
  background: #0d1117;
  border: 1px solid #30363d;
  padding: 0;
  margin: 28px 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: none;
}

pre .code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

pre .window-controls {
  display: flex;
  gap: 8px;
}

pre .window-controls span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

pre .window-controls .close { background: #ff5f57; }
pre .window-controls .minimize { background: #febc2e; }
pre .window-controls .maximize { background: #28c840; }

pre code {
  display: block;
  font-family: 'Liberation Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.75;
  color: #e6edf3;
  white-space: pre;
  background: transparent;
  padding: 20px 24px;
  border-radius: 0;
  font-weight: 400;
  overflow-x: auto;
  tab-size: 4;
}

pre code::-webkit-scrollbar {
  height: 6px;
}

pre code::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  margin: 0 12px;
}

pre code::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 3px;
}

pre code::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.6);
}

.copy-btn {
  position: absolute;
  right: 12px;
  top: 8px;
  background: rgba(99, 102, 241, 0.15);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-fast);
  opacity: 0;
}

pre:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.copy-btn:active {
  transform: scale(0.95);
}

/* Share post button */
.share-post-btn {
  position: absolute;
  top: 50px;
  right: 10px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  z-index: 10;
  min-width: 60px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.share-post-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.share-post-btn:active {
  transform: translateY(0);
}

.share-post-btn.success {
  background: linear-gradient(135deg, var(--accent-green), #059669);
}

/* Position content container relatively for absolute positioning */
.content {
  position: relative;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .share-post-btn {
    top: 8px;
    right: 8px;
    padding: 6px 12px;
    font-size: 11px;
    min-width: 50px;
  }
}

/* Light mode code block */
[data-theme="light"] pre {
  background: #f6f8fa;
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: 
    0 4px 24px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(99, 102, 241, 0.08);
}

[data-theme="light"] pre code {
  color: #24292f;
}

[data-theme="light"] pre .code-header {
  background: rgba(99, 102, 241, 0.05);
  border-bottom-color: rgba(99, 102, 241, 0.1);
}

[data-theme="light"] .copy-btn {
  color: rgba(0, 0, 0, 0.6);
}

[data-theme="light"] .share-post-btn {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .share-post-btn:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.2);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) pre {
    background: #f6f8fa;
    border-color: rgba(99, 102, 241, 0.15);
    box-shadow: 
      0 4px 24px rgba(0, 0, 0, 0.08),
      0 0 0 1px rgba(99, 102, 241, 0.08);
  }
  
  :root:not([data-theme="dark"]) pre code {
    color: #24292f;
  }
  
  :root:not([data-theme="dark"]) pre .code-header {
    background: rgba(99, 102, 241, 0.05);
    border-bottom-color: rgba(99, 102, 241, 0.1);
  }
  
  :root:not([data-theme="dark"]) .copy-btn {
    color: rgba(0, 0, 0, 0.6);
  }
  
  :root:not([data-theme="dark"]) .share-post-btn {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
  }

  :root:not([data-theme="dark"]) .share-post-btn:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.2);
  }
}

.welcome h1 {
  margin-top: 0;
}

/* Topic Overview - Hidden */
.topic-overview {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: none; /* Hide the topic overview cards */
}

.topic-header {
  display: none; /* Hide the topic header */
}

.topic-grid {
  display: none; /* Hide the topic cards grid */
}

/* Topic Cards - Hidden/Removed */
.topic-card {
  display: none; /* Hide all topic cards */
}

.topic-card-content {
  display: none;
}

.topic-card-title {
  display: none;
}

.topic-card-description {
  display: none;
}

.topic-card-arrow {
  display: none;
}

/* Images */
.content img {
  max-width: 100%;
  height: auto;
  display: block;        
  margin: 24px 0;   
  border-radius: var(--radius-md);
  border: 3px solid var(--accent-secondary);
  box-shadow: var(--shadow-md);
  cursor: zoom-in;
  transition: all var(--transition-normal);
}

.content img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

/* Image Overlay */
.image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.image-overlay img {
  max-width: 90%;
  max-height: 90%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 15px;
}

.content th,
.content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.content th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
}

.content td {
  color: var(--text-secondary);
}

.content tr:hover td {
  background: rgba(99, 102, 241, 0.05);
}

/* Horizontal Rule */
.content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 40px 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
  .layout {
    max-width: 1400px;
    padding: 0 16px;
  }
}

@media (max-width: 1200px) {
  .right-toc {
    display: none;
  }
  
  .content {
    max-width: none;
    margin: 0;
  }
  
  .layout {
    gap: 24px;
  }
  
  .sidebar {
    width: 280px;
  }
  
  .header-actions input {
    width: 280px;
  }
}

@media (max-width: 1100px) {
  .site-header {
    padding: 18px 32px;
  }
  
  .content {
    padding: 32px 40px;
  }
  
  .hero-title {
    font-size: 44px;
  }
  
  .layout {
    gap: 20px;
    padding: 0 12px;
  }
  
  .sidebar {
    width: 260px;
  }
  
  .header-actions input {
    width: 240px;
    padding: 12px 16px 12px 44px;
  }
}

@media (max-width: 1000px) {
  .site-header {
    padding: 16px 28px;
  }
  
  .header-actions input {
    width: 220px;
  }
  
  .sidebar {
    width: 240px;
  }
}

@media (max-width: 900px) {
  .topic-navbar {
    top: 73px;
  }
  
  .topic-nav-inner {
    padding: 0 20px;
    justify-content: flex-start;
  }
  
  .topic-nav-list {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 20px;
  }
  
  .topic-nav-item {
    font-size: 15px;
    padding: 12px 0;
    gap: 6px;
  }
  
  .layout {
    padding: 0;
    gap: 0;
  }
  
  .sidebar {
    position: fixed;
    left: -320px;
    top: calc(73px + 69px);
    height: calc(100vh - 73px - 69px);
    z-index: 150;
    transition: left var(--transition-normal);
    box-shadow: var(--shadow-lg);
    width: 300px;
  }
  
  .sidebar.active {
    left: 0;
  }
  
  .right-toc {
    display: none;
  }
  
  .content {
    max-width: none;
    margin: 0;
    padding: 28px 24px;
  }

  .subtopic-list a {
    padding: 10px 20px;
    font-size: 14px;
  }

  .site-header {
    padding: 16px 24px;
    min-height: 70px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  }
  
  .site-brand {
    gap: 16px;
  }
  
  .logo {
    font-size: 20px;
    gap: 10px;
  }
  
  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .header-actions {
    gap: 12px;
  }
  
  .header-actions input {
    width: 180px;
    padding: 12px 14px 12px 40px;
    font-size: 14px;
  }
  
  .search-icon {
    left: 12px;
    font-size: 14px;
  }
  
  .social-link,
  .theme-toggle {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  
  .tagline {
    display: none;
  }

  .content {
    height: calc(100vh - 73px - 69px);
  }
  
  .hero-title {
    font-size: 36px;
  }
  
  .hero-description {
    font-size: 16px;
  }
  
  .hero-stats {
    gap: 24px;
  }
  
  .stat-number {
    font-size: 28px;
  }

  .search-shortcut {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 750px) {
  .site-header {
    padding: 14px 20px;
    min-height: 66px;
  }
  
  .site-brand {
    gap: 14px;
  }
  
  .logo {
    font-size: 19px;
    gap: 9px;
  }
  
  .logo-icon {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }
  
  .header-actions {
    gap: 10px;
  }
  
  .header-actions input {
    width: 160px;
    padding: 11px 13px 11px 38px;
    font-size: 13px;
  }
  
  .search-icon {
    left: 11px;
    font-size: 13px;
  }
  
  .social-link,
  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 15px;
  }

  .topic-nav-list {
    gap: 18px;
  }

  .topic-nav-item {
    font-size: 14px;
    padding: 11px 0;
    gap: 5px;
  }
  
  .content {
    padding: 26px 22px;
  }
  
  .content h1 {
    font-size: 32px;
  }
  
  .content h2 {
    font-size: 26px;
  }
  
  .content h3 {
    font-size: 22px;
  }
  
  .hero-title {
    font-size: 32px;
  }
  
  .welcome-hero {
    padding: 40px 0;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 12px 20px;
    min-height: 64px;
  }
  
  .site-brand {
    gap: 12px;
  }
  
  .logo {
    font-size: 18px;
    gap: 8px;
  }
  
  .logo-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  .header-actions {
    gap: 10px;
  }
  
  .header-actions input {
    width: 140px;
    padding: 10px 12px 10px 36px;
    font-size: 13px;
  }
  
  .search-icon {
    left: 10px;
    font-size: 13px;
  }
  
  .search-shortcut {
    display: none;
  }
  
  .social-link {
    display: none;
  }
  
  .theme-toggle {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .topic-nav-list {
    gap: 16px;
  }

  .topic-nav-item {
    font-size: 13px;
    padding: 10px 0;
    gap: 4px;
  }
  
  .subtopic-list a {
    padding: 8px 16px;
    font-size: 13px;
  }

  .subtopic-list a i {
    font-size: 12px;
    width: 16px;
  }

  .content h1 {
    font-size: 28px;
  }
  
  .content h2 {
    font-size: 24px;
  }
  
  .content h3 {
    font-size: 20px;
  }
  
  .hero-title {
    font-size: 28px;
  }
  
  .welcome-hero {
    padding: 30px 0;
  }
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-tertiary);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Error State */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.error-state i {
  font-size: 48px;
  color: var(--accent-orange);
  margin-bottom: 20px;
}

.error-state h3 {
  color: var(--text-primary);
  margin: 0 0 8px 0;
  font-size: 20px;
}

.error-state p {
  color: var(--text-secondary);
  margin: 0;
}

/* Selection */
::selection {
  background: rgba(99, 102, 241, 0.3);
  color: var(--text-primary);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.logo:focus-visible,
.social-link:focus-visible,
.theme-toggle:focus-visible {
  outline: 3px solid var(--accent-primary);
  outline-offset: 3px;
  border-radius: var(--radius-md);
}

.header-actions input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), 0 4px 20px rgba(99, 102, 241, 0.15);
}

/* Smooth scrollbar for Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
