[data-vae] .statistics-figure__plots,
[data-vae-explain] .statistics-figure__plots {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
}

.vae-concept {
  container-type: inline-size;
  margin: 1.5em 0;
  padding: 12px;
  border: 1px solid rgba(159, 176, 188, 0.45);
  border-radius: 4px;
  color: inherit;
  background: rgba(111, 156, 167, 0.04);
}

.vae-concept > figcaption {
  margin: 0 0 14px;
  color: inherit;
  font-size: 1em;
  font-weight: 600;
}

.vae-concept__panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.vae-concept__panels--pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vae-concept__panel {
  min-width: 0;
}

.vae-concept .vae-concept__panel > p {
  margin: 0;
  font-size: 0.92em;
}

.vae-concept .vae-concept__step {
  min-height: 2.8em;
  font-weight: 600;
}

.vae-concept svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  margin: 6px 0;
  font-family: inherit;
  font-size: 18px;
}

.vae-concept svg text { fill: currentColor; }
.vae-concept__axis { fill: none; stroke: currentColor; stroke-width: 1.4; opacity: 0.7; }
.vae-concept__curve { fill: none; stroke: currentColor; stroke-width: 2.5; }
.vae-concept__curve--faint { opacity: 0.35; stroke-dasharray: 5 4; }
.vae-concept__cloud { fill: currentColor; opacity: 0.28; }
.vae-concept__blue { fill: #648ed9; }
.vae-concept__green { fill: #499b84; }
.vae-concept__orange { fill: #c58649; }
.vae-concept svg .vae-concept__blue-text { fill: #648ed9; }
.vae-concept svg .vae-concept__green-text { fill: #499b84; }
.vae-concept svg .vae-concept__orange-text { fill: #c58649; }
.vae-concept__center { fill: none; stroke: #c58649; stroke-width: 3; }
.vae-concept__noise { fill: none; stroke: #c58649; stroke-width: 2; }
.vae-concept__mean { fill: none; stroke: #c58649; stroke-width: 1.5; stroke-dasharray: 4 4; }
.vae-concept__density { fill: rgba(197, 134, 73, 0.18); stroke: #c58649; stroke-width: 2.5; }

.vae-concept .vae-concept__caption {
  margin: 14px 0 0;
  font-size: 0.9em;
  opacity: 0.85;
}

@media (max-width: 1050px) {
  .vae-concept__panels { grid-template-columns: minmax(0, 1fr); }
  .vae-concept__panel { max-width: 440px; width: 100%; margin-inline: auto; }
  .vae-concept .vae-concept__step { min-height: 0; }
  .vae-concept__panel + .vae-concept__panel { border-top: 1px solid rgba(159, 176, 188, 0.3); padding-top: 16px; }
}

@container (max-width: 660px) {
  .vae-concept__panels { grid-template-columns: minmax(0, 1fr); }
  .vae-concept__panel { max-width: 440px; width: 100%; margin-inline: auto; }
  .vae-concept .vae-concept__step { min-height: 0; }
  .vae-concept__panel + .vae-concept__panel { border-top: 1px solid rgba(159, 176, 188, 0.3); padding-top: 16px; }
}

.vae-plot {
  min-width: 0;
}

.pgm-reading-guide {
  margin: 1em 0;
  color: inherit;
}

.pgm-section-intro,
.pgm-section-summary {
  margin: 0.9em 0 1.2em;
  padding: 0.6em 0.9em;
  border-left: 3px solid #6f9ca7;
  background: rgba(127, 209, 185, 0.05);
}

.pgm-section-summary {
  border-left-color: #b49a72;
  background: rgba(180, 154, 114, 0.05);
}

.pgm-section-intro > p:last-child,
.pgm-section-summary > p:last-child {
  margin-bottom: 0;
}

.pgm-section-wrapup {
  margin: 1em 0 1.5em;
}

.pgm-derivation {
  min-width: 0;
  margin: 1em 0 1.2em;
  padding: 0.5em 0.8em;
  border: 1px solid rgba(159, 176, 188, 0.4);
  border-radius: 4px;
}

.pgm-derivation > summary {
  font-weight: 600;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.pgm-derivation > summary:focus-visible {
  outline: 2px solid #6f9ca7;
  outline-offset: 4px;
}

.pgm-derivation[open] > summary {
  margin-bottom: 1em;
}

.pgm-derivation > :last-child:not(summary) {
  margin-bottom: 0.5em;
}

.mnist-display {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  align-items: start;
}

[data-mnist="generation"] .mnist-display {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.mnist-panel {
  min-width: 0;
  text-align: center;
}

.statistics-figure .mnist-panel p {
  margin: 0 0 0.5rem;
  color: var(--plot-ink);
  min-height: 2.6em;
  font-size: 12px;
  line-height: 1.3;
}

.mnist-display canvas {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #000;
}

.mnist-digit {
  width: 140px;
}

.mnist-grid {
  width: min(100%, 280px);
}

.mnist-strip {
  grid-column: 1 / -1;
}

@media (max-width: 480px) {
  .mnist-digit {
    width: 110px;
  }
}
