.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(233, 250, 240, 0.92) 100%);
  overflow-y: auto;
  position: relative;
}

.content-area.with-sidebar {
  border-left: 1px solid rgba(47, 177, 112, 0.12);
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 4vw, 2.5rem) clamp(0.75rem, 2vw, 1.25rem);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(47, 177, 112, 0.12);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.breadcrumb-separator {
  color: rgba(47, 177, 112, 0.35);
}

.breadcrumb-text {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(51, 197, 122, 0.12);
  transition: background 0.2s ease, color 0.2s ease;
}

.breadcrumb-text:hover {
  background: rgba(51, 197, 122, 0.22);
  color: var(--color-text);
}

.content-title {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.01em;
}

.content-body {
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 6vw, 3.5rem) clamp(2.5rem, 6vw, 4rem);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: clamp(2rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr);
}

.content-body.with-toc {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
}

.markdown-pane {
  min-width: 0;
}

.content-toc {
  position: sticky;
  top: clamp(6rem, 12vw, 7rem);
  align-self: start;
  padding: 1.25rem 1.1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(47, 177, 112, 0.14);
  box-shadow: 0 16px 32px rgba(31, 58, 44, 0.12);
  max-height: calc(100vh - clamp(8rem, 14vw, 10rem));
  overflow-y: auto;
}

.content-toc h3 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toc-item {
  display: block;
}

.toc-link {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  color: var(--color-muted);
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.toc-link.level-2 {
  padding-left: 1.15rem;
  font-size: 0.85rem;
}

.toc-link.level-3 {
  padding-left: 1.85rem;
  font-size: 0.82rem;
}

.toc-link:hover,
.toc-link.active {
  background: rgba(51, 197, 122, 0.18);
  color: var(--color-text);
  transform: translateX(2px);
}

.loading-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 4rem;
  color: var(--color-muted);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(51, 197, 122, 0.2);
  border-top: 2px solid var(--color-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.markdown-content {
  color: var(--color-text);
  line-height: 1.75;
  font-size: 1rem;
}

.markdown-content > *:first-child {
  margin-top: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  margin: 2.2rem 0 1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  position: relative;
}

.markdown-content h1 {
  font-size: clamp(2rem, 3vw, 2.6rem);
  border-bottom: 2px solid rgba(47, 177, 112, 0.14);
  padding-bottom: 0.75rem;
}

.markdown-content h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  border-bottom: 1px solid rgba(47, 177, 112, 0.16);
  padding-bottom: 0.5rem;
}

.markdown-content h3 {
  font-size: clamp(1.35rem, 2vw, 1.6rem);
}

.markdown-content h4 {
  font-size: 1.2rem;
}

.heading-anchor {
  position: absolute;
  left: -1.5rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  font-size: 0.9rem;
  color: rgba(47, 177, 112, 0.8);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.markdown-content h2:hover .heading-anchor,
.markdown-content h3:hover .heading-anchor,
.markdown-content h4:hover .heading-anchor,
.markdown-content h1:hover .heading-anchor {
  opacity: 1;
  transform: translate(-4px, -50%);
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content table,
.markdown-content pre {
  margin-top: 0;
  margin-bottom: 1.35rem;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.5rem;
}

.markdown-content li + li {
  margin-top: 0.4rem;
}

.markdown-content a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.markdown-content a:hover {
  color: var(--color-link-hover);
}

.inline-code {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: rgba(33, 169, 102, 0.12);
  border: 1px solid rgba(33, 169, 102, 0.18);
  color: var(--color-text);
  font-size: 0.95em;
}

.code-block-wrapper {
  position: relative;
  background: #0f2c1f;
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(12, 52, 34, 0.45);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #bcf8d9;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.code-language {
  letter-spacing: 0.1em;
}

.code-copy-button {
  background: rgba(188, 248, 217, 0.14);
  color: #bcf8d9;
  border: 1px solid rgba(188, 248, 217, 0.25);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.code-copy-button:hover {
  background: rgba(188, 248, 217, 0.24);
  transform: translateY(-1px);
}

.code-copy-button.copied {
  background: rgba(188, 248, 217, 0.4);
  color: #0f2c1f;
}

pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
}

pre code {
  background: transparent !important;
  color: #e9fff2;
  font-size: 0.95rem;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(47, 177, 112, 0.14);
  box-shadow: 0 14px 28px rgba(31, 58, 44, 0.12);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrapper th,
.table-wrapper td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(47, 177, 112, 0.12);
  text-align: left;
}

.table-wrapper th {
  background: rgba(51, 197, 122, 0.12);
  color: var(--color-text);
  font-weight: 600;
}

.table-wrapper tr:last-child td {
  border-bottom: none;
}

.table-wrapper tr:hover td {
  background: rgba(51, 197, 122, 0.08);
}

.custom-blockquote {
  margin: 1.75rem 0;
  padding: 1.1rem 1.4rem 1.1rem 1.2rem;
  border-left: 5px solid rgba(47, 177, 112, 0.6);
  border-radius: 0 16px 16px 0;
  background: rgba(51, 197, 122, 0.12);
  color: var(--color-text);
  box-shadow: 0 12px 24px rgba(31, 58, 44, 0.1);
}

.custom-blockquote strong:first-child {
  display: block;
  margin-bottom: 0.4rem;
}

.markdown-content hr {
  border: none;
  border-top: 1px dashed rgba(47, 177, 112, 0.35);
  margin: 2.5rem 0;
}

.markdown-content img {
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(31, 58, 44, 0.18);
  margin: 1.5rem auto;
}

.markdown-image {
  margin: 1.5rem 0;
  text-align: center;
}

.markdown-image figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.custom-blockquote.callout-info {
  border-left-color: rgba(70, 199, 150, 0.7);
  background: rgba(70, 199, 150, 0.18);
}

.custom-blockquote.callout-warning {
  border-left-color: rgba(255, 187, 92, 0.85);
  background: rgba(255, 187, 92, 0.2);
}

.custom-blockquote.callout-danger {
  border-left-color: rgba(255, 107, 107, 0.85);
  background: rgba(255, 107, 107, 0.18);
}

.custom-blockquote.callout-success {
  border-left-color: rgba(62, 201, 133, 0.85);
  background: rgba(62, 201, 133, 0.2);
}

.external-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.external-link-icon {
  font-size: 0.8rem;
}

.welcome-message {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4rem);
  min-height: calc(100vh - clamp(10rem, 16vw, 12rem));
}

.welcome-content {
  text-align: center;
  max-width: 640px;
  padding: clamp(2rem, 6vw, 3rem);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 48px rgba(31, 58, 44, 0.16);
}

.welcome-content h1 {
  font-size: clamp(2.4rem, 4vw, 3rem);
  color: var(--color-text);
  margin-bottom: 1rem;
}

.welcome-content p {
  font-size: 1.1rem;
  color: var(--color-muted);
  margin-bottom: 2rem;
}

.welcome-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.1rem;
}

.feature-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(51, 197, 122, 0.12);
  border-radius: 16px;
  border: 1px solid rgba(47, 177, 112, 0.14);
  color: var(--color-text);
}

.feature-icon {
  font-size: 1.5rem;
}

.katex-display {
  padding: 1.25rem;
  border-radius: 14px;
  background: rgba(51, 197, 122, 0.1);
  overflow-x: auto;
}

.markdown-content .task-list-item {
  list-style: none;
}

.markdown-content .task-list-item input[type='checkbox'] {
  margin-right: 0.6rem;
  transform: scale(1.1);
  accent-color: var(--color-accent);
}

@media (max-width: 1200px) {
  .content-body.with-toc {
    grid-template-columns: minmax(0, 1fr);
  }

  .content-toc {
    position: relative;
    top: auto;
    max-height: none;
    order: -1;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 768px) {
  .content-header {
    padding: 1rem 1.25rem;
  }

  .content-body {
    padding: 1.25rem;
  }

  .content-title {
    font-size: clamp(1.6rem, 6vw, 2rem);
  }

  .markdown-content {
    font-size: 0.98rem;
  }

  .heading-anchor {
    display: none;
  }

  .welcome-content {
    padding: 2rem;
  }

  .welcome-features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .content-header {
    padding: 0.85rem 1rem;
  }

  .content-body {
    padding: 1rem;
  }

  .breadcrumbs {
    font-size: 0.8rem;
  }

  .feature-item {
    flex-direction: column;
    text-align: center;
  }
}
