.neural-net-topic .mlp-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: .7rem; margin: 1rem 0 1.4rem; }
.neural-net-topic .mlp-overview > svg { display: block; width: 100%; height: auto; max-width: 360px; justify-self: center; }
.neural-net-topic .mlp-explanation > ul > li { margin-bottom: .9rem; }
.neural-net-topic .mlp-explanation li ul { margin-top: .35rem; }

.neural-net-topic .activation-intro { margin-bottom: 1.15rem; }
.neural-net-topic .activation-row { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 1.4rem; align-items: center; padding: 1.15rem 0; border-bottom: 1px solid var(--study-line); }
.neural-net-topic .activation-row:last-child { border-bottom: 0; }
.neural-net-topic .activation-copy { min-width: 0; }
.neural-net-topic .activation-copy h3 { margin: 0 0 .55rem; }
.neural-net-topic .activation-copy ul { margin: 0; padding-left: 1.15rem; }
.neural-net-topic .activation-copy li { margin: .45rem 0; }
.neural-net-topic .activation-visual { min-width: 0; margin: 0; }
.neural-net-topic .activation-visual img { display: block; width: 100%; height: auto; margin: 0; border: 0; border-radius: 8px; }
@media (max-width: 1050px) {
  .neural-net-topic .activation-row { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .neural-net-topic .activation-visual { width: 100%; max-width: 540px; justify-self: center; }
}

.neural-net-topic .backprop-example > h3 { margin-top: 1.4rem; }
.neural-net-topic .backprop-example li { margin: .5rem 0; }
.neural-net-topic .backprop-example li > ul > li { margin: .7rem 0; }
.neural-net-topic .bp-forward-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; padding: 0; margin: 1rem 0 1.3rem; list-style: none; }
.neural-net-topic .bp-forward-flow > li { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; position: relative; min-width: 0; margin: 0; padding: .8rem .35rem; border: 1px solid var(--study-line); border-radius: 8px; background: var(--study-panel); text-align: center; }
.neural-net-topic .bp-forward-flow > li + li::before { content: '→'; position: absolute; left: -.95rem; top: 45%; color: var(--study-accent); }
.neural-net-topic .bp-stage-label { color: var(--study-accent); font-size: .78rem; font-weight: 650; }
.neural-net-topic .bp-shape { color: var(--study-muted); font-size: .75rem; }
.neural-net-topic .bp-backward-flow { max-width: 580px; margin: 1.1rem auto; text-align: center; }
.neural-net-topic .bp-gradient-node { padding: .55rem; border: 1px solid var(--study-line); border-radius: 7px; background: var(--study-panel); }
.neural-net-topic .bp-gradient-arrow { padding: .3rem; color: var(--study-accent); }
.neural-net-topic .bp-gradient-branches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
@media (max-width: 900px) {
  .neural-net-topic .bp-forward-flow { grid-template-columns: minmax(0, 1fr); max-width: 360px; gap: 1.35rem; margin-left: auto; margin-right: auto; }
  .neural-net-topic .bp-forward-flow > li + li::before { content: '↓'; top: -1.35rem; left: 48%; }
}
@media (max-width: 500px) {
  .neural-net-topic .bp-gradient-branches { grid-template-columns: minmax(0, 1fr); }
}

.neural-net-topic .norm-comparison table { width: 100%; table-layout: fixed; }
.neural-net-topic .norm-comparison thead th:nth-child(1) { width: 13%; }
.neural-net-topic .norm-comparison thead th:nth-child(2) { width: 22%; }
.neural-net-topic .norm-comparison thead th:nth-child(3) { width: 30%; }
.neural-net-topic .norm-comparison thead th:nth-child(4) { width: 21%; }
.neural-net-topic .norm-comparison thead th:nth-child(5) { width: 14%; }
.neural-net-topic .norm-comparison th,
.neural-net-topic .norm-comparison td { padding: .55rem .5rem; vertical-align: top; overflow-wrap: anywhere; line-height: 1.6; }
.neural-net-topic .norm-example-arrow { display: block; margin: .2rem 0; color: var(--study-accent); }
.neural-net-topic .norm-example-vector { display: block; overflow-wrap: normal; }
.neural-net-topic .norm-example-note { font-size: .82rem; color: var(--study-muted); }
@media (max-width: 1050px) {
  .neural-net-topic .norm-comparison { overflow: visible; }
  .neural-net-topic .norm-comparison table,
  .neural-net-topic .norm-comparison tbody { display: block; }
  .neural-net-topic .norm-comparison thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .neural-net-topic .norm-comparison tr { display: block; margin-bottom: .9rem; border: 1px solid var(--study-line); border-radius: 8px; }
  .neural-net-topic .norm-comparison tbody th,
  .neural-net-topic .norm-comparison td { display: block; width: auto; border: 0; padding: .5rem .7rem; }
  .neural-net-topic .norm-comparison td::before { content: attr(data-label); display: block; margin-bottom: .2rem; font-weight: 650; color: var(--study-accent); }
}

.neural-net-topic .optimizer-notation { font-size: .85rem; color: var(--study-muted); }
.neural-net-topic .optimizer-table table { width: 100%; table-layout: fixed; }
.neural-net-topic .optimizer-table thead th:nth-child(1) { width: 12%; }
.neural-net-topic .optimizer-table thead th:nth-child(2) { width: 26%; }
.neural-net-topic .optimizer-table thead th:nth-child(3) { width: 22%; }
.neural-net-topic .optimizer-table th,
.neural-net-topic .optimizer-table td { padding: .55rem .6rem; vertical-align: top; overflow-wrap: anywhere; line-height: 1.6; }
@media (max-width: 1200px) {
  .neural-net-topic .optimizer-table { overflow: visible; }
  .neural-net-topic .optimizer-table table,
  .neural-net-topic .optimizer-table tbody { display: block; }
  .neural-net-topic .optimizer-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .neural-net-topic .optimizer-table tr { display: block; margin-bottom: .75rem; border: 1px solid var(--study-line); border-radius: 8px; }
  .neural-net-topic .optimizer-table tbody th,
  .neural-net-topic .optimizer-table td { display: block; width: auto; border: 0; padding: .5rem .7rem; }
  .neural-net-topic .optimizer-table td::before { content: attr(data-label); display: block; margin-bottom: .2rem; font-weight: 650; color: var(--study-accent); }
}

.neural-net-topic .optimizer-table thead th:nth-child(4),
.neural-net-topic .optimizer-table thead th:nth-child(5) { width: 20%; }
.neural-net-topic .optimizer-example-cell p { margin: 0 0 .4rem; font-size: inherit; line-height: inherit; }
.neural-net-topic .optimizer-example-cell p:last-child { margin-bottom: 0; }
.neural-net-topic .optimizer-example-vector { overflow-wrap: normal; }
.neural-net-topic .optimizer-example-cell .optimizer-example-note { color: var(--study-muted); font-size: .8rem; }
.neural-net-topic .optimizer-takeaways > li { margin: .65rem 0; }
.neural-net-topic .optimizer-section .optimizer-takeaways .math-inline-box { display: inline-block; max-width: 100%; box-sizing: border-box; padding: .35rem .45rem; vertical-align: middle; }
