:root {
  --bg-color: #f8f9fa;
  --text-color: #212529;
  --sidebar-bg: #ffffff;
  --sidebar-border: #e9ecef;
  --link-color: #0d6efd;
  --link-hover: #0a58ca;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background: linear-gradient(135deg, #f0f4fd 0%, #e4ecfe 100%);
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.6;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 300px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  padding: 2rem 1rem;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.sidebar li {
  margin-bottom: 0.5rem;
}

.sidebar li.level-1 {
  font-weight: 600;
  margin-top: 1.2rem;
}

.sidebar li.level-2 {
  padding-left: 1rem;
  font-size: 0.95em;
}

.sidebar a {
  text-decoration: none;
  color: var(--text-color);
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar a:hover {
  background-color: var(--bg-color);
  color: var(--link-color);
}

.content {
  flex: 1;
  padding: 3rem 4rem;
  max-width: 900px;
  background-color: #ffffff;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
  margin: 2rem auto;
  border-radius: 8px;
}

.content h1 {
  margin-top: 2rem;
  font-size: 2.5em;
  font-weight: 800;
  background: linear-gradient(120deg, #0d6efd, #d63384);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.content h2, .content h3, .content h4 {
  margin-top: 2rem;
  color: #111;
}

.content a {
  color: var(--link-color);
  text-decoration: none;
}

.content a:hover {
  text-decoration: underline;
}

.content pre {
  background-color: #f1f3f5;
  padding: 1.2rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.9em;
}

.content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #f1f3f5;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

.content pre code {
  background-color: transparent;
  padding: 0;
  font-size: 1em;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.content table th, .content table td {
  border: 1px solid #dee2e6;
  padding: 0.75rem;
  text-align: left;
}

.content table th {
  background-color: #f8f9fa;
}

.content blockquote {
  border-left: 4px solid var(--sidebar-border);
  margin-left: 0;
  padding-left: 1rem;
  color: #555;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: 35vh; /* Limit sidebar size on mobile so content is visible */
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    z-index: 10;
  }
  .content {
    margin: 0;
    padding: 1.5rem 1rem;
    border-radius: 0;
    box-shadow: none;
  }
  .content h1 {
    font-size: 2rem;
  }
  .content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .content img {
    max-width: 100%;
    height: auto;
  }
  .content pre {
    padding: 1rem;
    font-size: 0.85em;
  }
}
