:root {
  --knowledge-post-card: rgba(255, 255, 255, 0.82);
  --knowledge-post-card-hover: rgba(255, 255, 255, 0.95);
  --knowledge-post-text: #0b1a33;
  --knowledge-post-muted: #7a8aa3;
  --knowledge-post-accent: #2563eb;
  --knowledge-post-accent-light: rgba(59, 130, 246, 0.1);
  --knowledge-post-border: rgba(148, 163, 184, 0.22);
  --knowledge-post-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --knowledge-post-shadow-lg: 0 20px 48px -8px rgba(0, 0, 0, 0.1);
}

body.knowledge-post-page {
  min-height: 100vh;
  background: #fff !important;
  color: var(--knowledge-post-text);
}

.knowledge-post-wrapper {
  min-height: 100vh;
  max-width: 1350px;
  margin-right: auto;
  margin-left: max(
    calc(var(--sidebar-width) + 40px),
    calc((100% - 1350px + var(--sidebar-width) + 40px) / 2)
  );
  padding: 0 0 28px;
}

.knowledge-post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.knowledge-post-main {
  min-width: 0;
  padding: 28px 34px 30px;
}

.knowledge-post-pagebar {
  position: sticky;
  top: 28px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin: 0 0 22px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
}

.knowledge-post-wrapper::before {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: calc(var(--sidebar-width) + 40px);
  height: 64px;
  background: #fff;
  content: '';
  pointer-events: none;
}

.knowledge-post-breadcrumb {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
  overflow: visible;
  color: var(--knowledge-post-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: normal;
}

.knowledge-post-breadcrumb a {
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
}

.knowledge-post-breadcrumb a:hover {
  color: var(--knowledge-post-accent);
}

.knowledge-post-breadcrumb__current {
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--knowledge-post-accent);
  font-weight: 700;
  font-size: 1.04em;
  white-space: normal;
}

.knowledge-post-breadcrumb i {
  flex: 0 0 auto;
  color: #b4c0ce;
  font-size: 0.62rem;
}

.knowledge-post-mobile-controls,
.knowledge-post-mobile-button,
.post-knowledge-toggle {
  display: none;
}

.knowledge-post-cover {
  margin: 0 0 28px;
  overflow: hidden;
  border-radius: 18px;
}

.knowledge-post-cover img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: cover;
}

.knowledge-post-content {
  color: #26354b;
  font-size: 0.95rem;
  line-height: 1.85;
}

.knowledge-post-content > :first-child {
  margin-top: 0;
}

.knowledge-post-content h2,
.knowledge-post-content h3,
.knowledge-post-content h4 {
  color: var(--knowledge-post-text);
  scroll-margin-top: 120px;
}

.knowledge-post-content h2 {
  margin: 2rem 0 0.6rem;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--knowledge-post-accent-light);
  font-size: 1.4rem;
  line-height: 1.35;
}

.knowledge-post-content h3 {
  margin: 1.6rem 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.45;
}

.knowledge-post-content p {
  margin: 0 0 0.8rem;
}

.knowledge-post-content img {
  max-width: 100%;
  height: auto;
  margin: 1rem 0;
  border-radius: 12px;
}

.knowledge-post-content a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.knowledge-post-content ul,
.knowledge-post-content ol {
  margin: 0 0 0.8rem;
  padding-left: 1.4rem;
}

.knowledge-post-content blockquote {
  margin: 0.8rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--knowledge-post-accent);
  border-radius: 0 12px 12px 0;
  background: var(--knowledge-post-accent-light);
  color: #52617a;
}

.knowledge-post-content pre {
  margin: 1rem 0;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  border: 1px solid var(--knowledge-post-border);
  border-radius: 12px;
  background: var(--knowledge-post-card);
}

.knowledge-post-content code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--knowledge-post-accent-light);
  font-size: 0.9em;
}

.knowledge-post-content pre code {
  padding: 0;
  background: transparent;
}

.knowledge-post-content .knowledge-heading-highlight {
  margin-left: -12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.18);
  color: #2563eb;
  transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.knowledge-post-content .search-highlight {
  padding: 0 3px;
  border-radius: 4px;
  background: #fde68a;
  color: #172033;
  box-shadow: 0 1px 0 rgba(180, 83, 9, 0.28);
}

.knowledge-post-aside {
  position: sticky;
  top: 80px;
  display: grid;
  gap: 18px;
  align-self: start;
  max-height: calc(100vh - 104px);
  margin-top: 94px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.knowledge-post-panel {
  padding: 16px 18px;
  border: 1px solid var(--knowledge-post-border);
  border-radius: 16px;
  background: var(--knowledge-post-card);
  box-shadow: var(--knowledge-post-shadow);
}

.knowledge-post-panel h2 {
  margin: 0 0 11px;
  color: var(--knowledge-post-text);
  font-size: 0.92rem;
  line-height: 1.4;
}

.knowledge-post-documents__list {
  display: flex;
  flex-direction: column;
}

.knowledge-post-documents__list a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 34px;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--knowledge-post-border);
  color: #52617a;
  font-size: 0.8rem;
  line-height: 1.45;
  overflow: hidden;
  text-decoration: none;
  transition: padding 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.knowledge-post-documents__list a::before {
  color: var(--knowledge-post-muted);
  content: '›';
  font-size: 1rem;
  line-height: 1;
}

.knowledge-post-documents__list a:last-child {
  border-bottom: 0;
}

.knowledge-post-documents__list a span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-post-documents__list time {
  min-width: 0;
  color: #9aa8bd;
  font-size: 0.68rem;
  text-align: right;
  white-space: nowrap;
}

.knowledge-post-documents__list a:hover {
  padding-left: 6px;
  background: var(--knowledge-post-accent-light);
  color: var(--knowledge-post-accent);
}

.knowledge-post-documents__list a.is-current {
  color: var(--knowledge-post-accent);
  font-weight: 700;
}

.knowledge-post-points {
  border: 0;
  background: #fafafa;
  box-shadow: none;
}

.knowledge-post-points__list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}

.knowledge-point {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid;
  border-radius: 10px;
  background: #fff;
  font-size: 0.81rem;
  line-height: 1.35;
  text-decoration: none;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.knowledge-point:hover {
  transform: translateY(-2px);
}

.knowledge-point.blue { border-color: #93c5fd; color: #2563eb; }
.knowledge-point.green { border-color: #86efac; color: #16a34a; }
.knowledge-point.purple { border-color: #c4b5fd; color: #7c3aed; }
.knowledge-point.orange { border-color: #fdba74; color: #ea580c; }
.knowledge-point.cyan { border-color: #67e8f9; color: #0891b2; }
.knowledge-point.pink { border-color: #f9a8d4; color: #db2777; }
.knowledge-point.blue.is-active { background: #2563eb; color: #fff; }
.knowledge-point.green.is-active { background: #16a34a; color: #fff; }
.knowledge-point.purple.is-active { background: #7c3aed; color: #fff; }
.knowledge-point.orange.is-active { background: #ea580c; color: #fff; }
.knowledge-point.cyan.is-active { background: #0891b2; color: #fff; }
.knowledge-point.pink.is-active { background: #db2777; color: #fff; }

.knowledge-post-backdrop {
  display: none;
}

.post-share {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
  padding: 16px 0;
  border-top: 1px solid var(--knowledge-post-border);
}

.knowledge-post-reward {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--knowledge-post-border);
  border-radius: 16px;
  background: var(--knowledge-post-card);
  box-shadow: var(--knowledge-post-shadow);
}

.knowledge-post-reward img {
  width: 96px;
  height: 96px;
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: contain;
}

.knowledge-post-reward h2,
.knowledge-post-comments h2 {
  margin: 0 0 5px;
  color: var(--knowledge-post-text);
  font-size: 0.95rem;
}

.knowledge-post-reward p {
  margin: 0;
  color: var(--knowledge-post-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.knowledge-post-comments {
  margin: 32px 0 16px;
  padding: 22px;
  border-top: 1px solid var(--knowledge-post-border);
}

.knowledge-post-comments header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.knowledge-post-comments header i {
  color: var(--knowledge-post-accent);
}

body.dark.knowledge-post-page {
  background: #0b1120 !important;
}

.dark .knowledge-post-wrapper::before,
.dark .knowledge-post-pagebar {
  background: rgba(11, 17, 32, 0.94);
}

.dark .knowledge-post-content h2,
.dark .knowledge-post-content h3,
.dark .knowledge-post-content h4,
.dark .knowledge-post-panel h2,
.dark .knowledge-post-reward h2,
.dark .knowledge-post-comments h2 {
  color: #f1f5f9;
}

.dark .knowledge-post-content {
  color: #cbd5e1;
}

.dark .knowledge-post-breadcrumb,
.dark .knowledge-post-reward p {
  color: #7f8ea3;
}

.dark .knowledge-post-content blockquote,
.dark .knowledge-post-documents__list a {
  color: #cbd5e1;
}

.dark .knowledge-post-content pre,
.dark .knowledge-post-panel,
.dark .knowledge-post-reward {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.8);
}

.dark .knowledge-post-content code {
  background: rgba(96, 165, 250, 0.16);
}

.dark .knowledge-post-content .knowledge-heading-highlight {
  background: rgba(59, 130, 246, 0.18);
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.22);
  color: #93c5fd;
}

.dark .knowledge-post-content .search-highlight {
  background: #f59e0b;
  color: #111827;
}

.dark .knowledge-post-points {
  background: rgba(30, 41, 59, 0.8);
}

.dark .knowledge-point {
  background: #1e293b;
}

.dark .knowledge-post-documents__list a:hover {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
}

@media (min-width: 1001px) and (max-width: 1280px) {
  .knowledge-post-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .knowledge-post-aside {
    display: none;
  }

  .post-knowledge-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 0;
    border-radius: 22px;
    background: var(--knowledge-post-accent-light);
    color: var(--knowledge-post-accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .knowledge-post-aside.is-compact-open {
    position: fixed;
    z-index: 201;
    top: 82px;
    right: 24px;
    display: block;
    width: min(360px, calc(100vw - 48px));
    max-height: calc(100vh - 106px);
    margin: 0;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid var(--knowledge-post-border);
    border-radius: 18px;
    background: var(--knowledge-post-card);
    box-shadow: var(--knowledge-post-shadow-lg);
  }

  .knowledge-post-aside.is-compact-open .knowledge-post-documents {
    display: none;
  }

  .knowledge-post-aside.is-compact-open .knowledge-post-points {
    display: block;
    padding: 0;
    background: transparent;
  }

  .knowledge-post-backdrop.is-compact-visible {
    position: fixed;
    z-index: 200;
    inset: 0;
    display: block;
    background: rgba(15, 23, 42, 0.28);
  }
}

@media (max-width: 1000px) {
  .knowledge-post-wrapper {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .knowledge-post-wrapper::before {
    display: none;
  }

  .knowledge-post-layout {
    display: block;
  }

  .knowledge-post-main {
    padding: 28px 12px 36px;
  }

  .knowledge-post-pagebar {
    position: static;
    min-height: 0;
    margin-bottom: 16px;
    padding: 4px 10px;
    border-radius: 0;
    background: transparent;
  }

  .knowledge-post-breadcrumb {
    flex: 1 1 auto;
    gap: 0;
    font-size: 0.84rem;
    line-height: 1.4;
  }

  .knowledge-post-breadcrumb a {
    padding: 1px 3px;
  }

  .knowledge-post-breadcrumb__current {
    padding: 1px 3px;
    background: transparent;
    color: inherit;
    font-size: inherit;
    font-weight: 600;
  }

  .knowledge-post-breadcrumb i {
    margin: 0 2px;
  }

  .knowledge-post-mobile-controls {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
  }

  .knowledge-post-mobile-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 82px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.88);
    color: #334155;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
  }

  .knowledge-post-mobile-button i {
    display: none;
  }

  .knowledge-post-mobile-button::before {
    color: #2563eb;
    font-size: 14px;
    line-height: 1;
  }

  .knowledge-post-mobile-button[data-article-panel='documents']::before {
    content: '☰';
  }

  .knowledge-post-mobile-button[data-article-panel='points']::before {
    content: '✦';
  }

  .knowledge-post-aside {
    position: fixed;
    z-index: 1200;
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    display: none;
    width: auto;
    max-height: min(50vh, 620px);
    margin: 0;
    padding: 14px;
    overflow-y: auto;
    border: 1px solid var(--knowledge-post-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.2);
  }

  .knowledge-post-aside[data-mobile-panel='documents'] {
    z-index: 1201;
    max-height: min(58vh, 620px);
    padding: 14px;
  }

  .knowledge-post-aside[data-mobile-panel='points'] {
    z-index: 1200;
    max-height: min(50vh, 620px);
    padding: 20px 18px;
  }

  .knowledge-post-aside.is-open {
    display: block;
  }

  .knowledge-post-aside .knowledge-post-panel {
    display: none;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .knowledge-post-aside[data-mobile-panel='documents'] .knowledge-post-documents,
  .knowledge-post-aside[data-mobile-panel='points'] .knowledge-post-points {
    display: block;
  }

  .knowledge-post-backdrop {
    position: fixed;
    z-index: 1190;
    inset: 0;
    display: block;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .knowledge-post-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .knowledge-post-content {
    font-size: 0.95rem;
    line-height: 1.82;
  }

  .knowledge-post-content h2 {
    margin-top: 1.8rem;
    font-size: 1.25rem;
  }

  .knowledge-post-content h3 {
    font-size: 1.08rem;
  }

  .knowledge-post-cover {
    margin-bottom: 22px;
    border-radius: 14px;
  }

  .knowledge-post-reward {
    align-items: flex-start;
    padding: 14px;
  }

  .knowledge-post-reward img {
    width: 76px;
    height: 76px;
  }

  .knowledge-post-comments {
    padding: 16px 0 0;
  }

  .knowledge-post-documents__list a {
    padding: 9px 2px;
    font-size: 0.88rem;
  }

  .knowledge-post-points__list {
    gap: 10px;
  }

  .dark .knowledge-post-aside {
    border-color: rgba(148, 163, 184, 0.2);
    background: #0f172a;
  }

  .dark .knowledge-post-mobile-button {
    border-color: rgba(96, 165, 250, 0.25);
    background: rgba(30, 41, 59, 0.9);
    color: #e2e8f0;
  }

  .dark .knowledge-post-mobile-button::before {
    color: #93c5fd;
  }

  .mobile-header {
    background: #fff !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16) !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06) !important;
  }

  .mobile-header::after {
    position: absolute;
    right: 0;
    bottom: -16px;
    left: 0;
    height: 16px;
    background: linear-gradient(to bottom, #fff, rgba(255, 255, 255, 0));
    content: '';
    pointer-events: none;
  }

  .dark .mobile-header {
    background: #0b1120 !important;
    border-bottom-color: rgba(148, 163, 184, 0.18) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
  }

  .dark .mobile-header::after {
    background: linear-gradient(to bottom, #0b1120, rgba(11, 17, 32, 0));
  }
}
