:root {
  --article-base: 15px;
  --sidebar-w: 280px;
}

/* ===== 双栏布局（参考小林面试笔记） ===== */
.note-layout {
  width: min(1280px, 96vw);
  margin: 0 auto;
  padding: 20px 0 64px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 16px;
  align-items: start;
}

.note-sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 12px);
  max-height: calc(100vh - var(--topbar-h) - 24px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.sidebar-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  margin: 0 0 10px;
  letter-spacing: 0.04em;
}

.sidebar-group { margin-bottom: 14px; }

.sidebar-group-label {
  font-size: 11px;
  font-weight: 900;
  color: var(--accent);
  margin: 0 0 6px;
  padding-left: 4px;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.sidebar-link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  text-decoration: none;
  line-height: 1.45;
  transition: background 120ms ease, color 120ms ease;
}

.sidebar-link:hover {
  background: rgba(139, 92, 246, 0.08);
  color: #111827;
}

.sidebar-link--active {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.95));
  color: #f8fafc;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.sidebar-link--intro {
  font-weight: 800;
  color: #111827;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-link--intro.sidebar-link--active {
  border-color: transparent;
}

.note-main { min-width: 0; }

.wrap {
  width: min(820px, 92vw);
  margin: 0 auto;
  padding: 24px 0 64px;
}

.breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.breadcrumb a { color: #111827; text-decoration: none; font-weight: 700; }
.breadcrumb a:hover { text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb span { margin: 0 6px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.article-head h1 {
  margin: 0;
  font-size: clamp(24px, 3.2vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* 文内目录 */
.article-toc {
  margin: 16px 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(10px);
}

.article-toc-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted);
  margin: 0 0 8px;
}

.article-toc-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.8;
}

.article-toc-list a {
  color: #111827;
  text-decoration: none;
  font-weight: 700;
}

.article-toc-list a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.md h2 {
  margin: 28px 0 12px;
  font-size: calc(var(--article-base) + 3px);
  color: #111827;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.md h3 {
  margin: 20px 0 10px;
  font-size: calc(var(--article-base) + 1px);
  color: #111827;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}

.md p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.9;
  font-size: var(--article-base);
}

.md ul, .md ol {
  margin: 0 0 14px;
  padding-left: 20px;
  line-height: 1.9;
  font-size: var(--article-base);
  color: #111827;
}

.md li { margin: 6px 0; }

.md a {
  color: #111827;
  text-decoration: underline;
  text-decoration-color: rgba(17, 24, 39, 0.25);
  text-underline-offset: 3px;
}

.dialogue { margin: 16px 0; display: grid; gap: 10px; }

.dialogue-line {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: var(--article-base);
  line-height: 1.8;
  color: #374151;
}

.dialogue-line--interviewer {
  background: rgba(17, 24, 39, 0.06);
  border-left: 3px solid #111827;
}

.dialogue-line--candidate {
  background: rgba(139, 92, 246, 0.08);
  border-left: 3px solid var(--accent);
}

.dialogue-role { font-weight: 900; margin-right: 6px; }

.callout {
  border-radius: 14px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: var(--article-base);
  line-height: 1.85;
}

.callout--brief {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.callout--brief h2 {
  margin: 0 0 8px;
  font-size: calc(var(--article-base) + 2px);
}

.callout--brief p:last-child { margin-bottom: 0; }

.callout--tip {
  background: rgba(139, 92, 246, 0.06);
  border: 1px solid rgba(139, 92, 246, 0.15);
}

.figure {
  margin: 20px 0;
  padding: 0;
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 18px;
  background: linear-gradient(160deg, #fafbff 0%, #f0f4ff 50%, #eef2ff 100%);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(79, 70, 229, 0.08);
}

.figure--ai .figure-frame {
  padding: 8px 8px 0;
  background: rgba(255, 255, 255, 0.5);
}

.figure--ai img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
}

.figure-caption {
  margin: 0;
  padding: 14px 18px 16px;
  font-size: 13px;
  font-weight: 700;
  color: #4b5563;
  line-height: 1.65;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  border-top: 1px solid rgba(139, 92, 246, 0.1);
}

/* ===== 概念信息图（HTML/CSS） ===== */
.ig { width: 100%; }

.ig-card {
  position: relative;
  border-radius: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  text-align: left;
}

.ig-card__title {
  display: block;
  font-size: 14px;
  font-weight: 900;
  color: #111827;
  margin-bottom: 4px;
}

.ig-card__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: #4b5563;
}

.ig-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  opacity: 0.9;
}

.ig-card--dark {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: transparent;
  color: #f8fafc;
}
.ig-card--dark .ig-card__title { color: #fff; }
.ig-card--dark .ig-card__desc { color: #cbd5e1; }

.ig-card--gradient {
  background: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  border-color: transparent;
}
.ig-card--gradient .ig-card__title,
.ig-card--gradient .ig-card__desc { color: #fff; }

.ig-card--purple { background: linear-gradient(160deg, #f5f3ff, #ede9fe); border-color: #c4b5fd; }
.ig-card--blue { background: linear-gradient(160deg, #eff6ff, #dbeafe); border-color: #93c5fd; }
.ig-card--green { background: linear-gradient(160deg, #ecfdf5, #d1fae5); border-color: #6ee7b7; }
.ig-card--amber { background: linear-gradient(160deg, #fffbeb, #fef3c7); border-color: #fcd34d; }
.ig-card--cyan { background: linear-gradient(160deg, #ecfeff, #cffafe); border-color: #67e8f9; }
.ig-card--violet { background: linear-gradient(160deg, #f5f3ff, #e9d5ff); border-color: #c084fc; }
.ig-card--slate { background: linear-gradient(160deg, #f8fafc, #e2e8f0); border-color: #94a3b8; }
.ig-card--neutral { background: #fff; }
.ig-card--muted { background: #f3f4f6; }
.ig-card--accent { background: linear-gradient(160deg, #111827, #374151); border-color: transparent; }
.ig-card--accent .ig-card__title,
.ig-card--accent .ig-card__desc { color: #f9fafb; }

.ig-card--wide { text-align: center; }
.ig-card--center { text-align: center; }

.ig-split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
}

.ig-split > .ig-footnote,
.ig-split > .ig-footnote--full {
  grid-column: 1 / -1;
}

.ig-col__label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
}

.ig-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  color: #9ca3af;
  padding: 0 4px;
}

.ig-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ig-flow--col {
  flex-direction: column;
  gap: 0;
}

.ig-flow--row {
  flex-direction: row;
  flex-wrap: wrap;
}

.ig-arrow {
  flex-shrink: 0;
  opacity: 0.45;
}

.ig-arrow--down {
  width: 2px;
  height: 18px;
  background: linear-gradient(#94a3b8, #cbd5e1);
  position: relative;
  margin: 4px auto;
}
.ig-arrow--down::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #94a3b8;
}

.ig-arrow--right {
  width: 24px;
  height: 2px;
  background: linear-gradient(90deg, #94a3b8, #cbd5e1);
  position: relative;
}
.ig-arrow--right::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #94a3b8;
}

.ig-compare3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ig-compare4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ig-footnote {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.04);
  font-size: 12px;
  color: #374151;
  text-align: center;
  line-height: 1.55;
}

.ig-footnote--full { margin-top: 14px; }

.ig-hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.ig-hub {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 6px 0;
}

.ig-hub-caption {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #6b7280;
  padding-top: 4px;
}

.ig-stack {
  display: grid;
  gap: 8px;
}

.ig-stack .ig-card { padding: 12px 16px; }

.ig-dag-row,
.ig-tree-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.ig-loop-hint,
.ig-cycle-back {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
  color: #6b7280;
  font-weight: 700;
}

.ig-cycle-back {
  padding: 8px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.08);
  color: #6d28d9;
}

.ig-timeline .ig-flow--row {
  flex-wrap: nowrap;
}

@media (max-width: 720px) {
  .ig-split,
  .ig-compare3,
  .ig-dag-row,
  .ig-tree-row {
    grid-template-columns: 1fr;
  }
  .ig-vs { padding: 8px 0; }
  .ig-timeline .ig-flow--row {
    flex-direction: column;
  }
  .ig-arrow--right {
    width: 2px;
    height: 16px;
    margin: 4px auto;
  }
  .ig-arrow--right::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -1px;
    transform: translateX(-50%);
    border-left-color: transparent;
    border-top-color: #94a3b8;
  }
}

.md pre {
  background: #111827;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
  margin: 12px 0;
}

.md code { font-family: Consolas, "Courier New", monospace; }

.md p code, .md li code {
  background: rgba(17, 24, 39, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.92em;
}

.question-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.question-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
}

.question-list a {
  font-weight: 800;
  color: #111827;
  text-decoration: none;
}

.question-list a:hover { text-decoration: underline; text-underline-offset: 3px; }

.q-status {
  font-size: 11px;
  font-weight: 800;
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.nav-btn--primary {
  background: #111827;
  color: #f9fafb;
  border-color: transparent;
}

.nav-btn:hover { opacity: 0.92; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 12px 0;
}

.compare-table th,
.compare-table td {
  border: 1px solid rgba(17, 24, 39, 0.1);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.compare-table th {
  background: rgba(17, 24, 39, 0.05);
  font-weight: 900;
}

@media (max-width: 960px) {
  .note-layout {
    grid-template-columns: 1fr;
    width: min(1280px, 94vw);
    padding: 16px 0 48px;
  }
  .note-sidebar {
    position: static;
    max-height: none;
  }
  .article-head h1 {
    font-size: clamp(22px, 6vw, 28px);
  }
  .article-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-btn {
    justify-content: center;
    text-align: center;
  }
  .card {
    padding: 16px;
  }
  .breadcrumb {
    font-size: 12px;
    line-height: 1.6;
  }
}

@media (max-width: 520px) {
  .note-layout {
    padding: 12px 0 40px;
  }
  .sidebar-link {
    padding: 10px 12px;
    font-size: 14px;
  }
  .dialogue-line {
    padding: 10px 12px;
  }
  .md pre {
    font-size: 12px;
    padding: 12px;
  }
  .question-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
