.network-figure {
  --nf-teal: #44AA99;
  --nf-indigo: #332288;
  margin: 2rem 0;
  padding: 1.25rem 0;
  color: #333333;
  font-family: 'DejaVu Sans', sans-serif;
  font-size: 14px;
  background: white;
}
.network-figure [hidden] { display: none !important; }
.network-figure button {
  min-height: 44px;
  padding: .5rem .9rem;
  border: 1px solid #DDDDDD;
  border-radius: 5px;
  background: white;
  color: #333333;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.network-figure button:hover:not(:disabled) { border-color: var(--nf-teal); }
.network-figure button:focus-visible, .network-figure input:focus-visible {
  outline: 2px solid var(--nf-indigo);
  outline-offset: 4px;
}
.network-figure .nf-feature-panels svg { display: block; width: 100%; max-width: 460px; margin: .5rem auto 0; overflow: visible; }
.network-figure svg text { font-family: 'DejaVu Sans', sans-serif; font-size: 14px; fill: #333333; }
.network-figure .nf-tick { fill: #777777; font-size: 12px; }
.nf-point text { paint-order: stroke; stroke: white; stroke-width: 4px; stroke-linejoin: round; }
.nf-legend { display: flex; justify-content: center; gap: 1.5rem; font-size: 13px; }
.nf-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.nf-legend i { width: 10px; height: 10px; display: inline-block; }
.nf-circle { border-radius: 50%; background: var(--nf-teal); }
.nf-square { background: var(--nf-indigo); }
.nf-controls { display: flex; align-items: center; justify-content: center; gap: .8rem; flex-wrap: wrap; }
.nf-controls label { margin: 0; }
.nf-controls input { accent-color: var(--nf-teal); width: 150px; min-height: 44px; }
.network-figure button:disabled { color: #999999; background: #F4F4F4; border-color: #E5E5E5; cursor: default; }
.nf-step-buttons { display: flex; gap: .5rem; }
.network-figure .nf-reset { border-color: transparent; background: transparent; }
.nf-chain { display: grid; grid-template-columns: 1fr .55fr 1fr .55fr 1fr .55fr 1fr .55fr 1fr; align-items: stretch; margin: 2rem 0 1rem; }
.nf-node { text-align: center; min-width: 0; padding: .65rem .3rem; border: 1.5px solid #DDDDDD; border-radius: 8px; background: white; }
.nf-node[data-forward-ready="true"] { background: #FAFAFA; border-color: #AAAAAA; }
.nf-node[data-backward-ready="true"] { border-color: #44AA99; background: #44AA990C; }
.nf-symbol { font-size: 17px; font-style: italic; line-height: 26px; }
.nf-value { font-size: 20px; line-height: 30px; min-height: 30px; font-variant-numeric: tabular-nums; }
.nf-derivative { color: #777777; margin-top: 1rem; font-size: 12px; line-height: 18px; white-space: nowrap; }
.nf-node[data-backward-ready="true"] .nf-derivative { color: #267D6F; }
.nf-derivative strong { display: block; font-size: 17px; line-height: 26px; min-height: 26px; font-weight: normal; font-variant-numeric: tabular-nums; }
.nf-edge { display: grid; grid-template-rows: 26px 30px 34px 26px; padding-top: .65rem; text-align: center; color: #777777; font-size: 12px; }
.nf-operation { grid-row: 1; align-self: end; }
.nf-back-operation { grid-row: 3; align-self: center; color: #999999; }
.nf-backward-done .nf-back-operation { color: #267D6F; }
.nf-edge mjx-container { margin: 0; }
.nf-edge .nf-arrow { display: block; font-size: 27px; line-height: 26px; color: #CCCCCC; }
.nf-forward-arrow { grid-row: 2; }
.nf-back-arrow { grid-row: 4; }
.nf-forward-done .nf-forward-arrow { color: #777777; }
.nf-backward-done .nf-back-arrow { color: #44AA99; }
@media (max-width: 540px) {
  .nf-chain { grid-template-columns: 1fr; max-width: 290px; margin-inline: auto; }
  .nf-node { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: .45rem .7rem; }
  .nf-derivative { margin: 0; }
  .nf-edge { grid-template-rows: 38px 26px; grid-template-columns: 1fr 1fr; align-items: center; padding: 2px 0; }
  .nf-operation { grid-row: 1; grid-column: 1; align-self: center; }
  .nf-back-operation { grid-row: 1; grid-column: 2; }
  .nf-edge .nf-arrow { width: 26px; justify-self: center; transform: rotate(90deg); grid-row: 2; }
  .nf-forward-arrow { grid-column: 1; }
  .nf-back-arrow { grid-column: 2; }
  .nf-controls { gap: .5rem; }
  .nf-controls input { width: 150px; }
  .nf-step-buttons { flex-basis: 100%; justify-content: center; }
}
@media print { .nf-controls { display: none; } }

.network-dimensions { margin: 1.5rem auto; max-width: 600px; }
.network-dimensions img { display: block; width: 100%; height: auto; }
.nf-feature-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.nf-feature-panels > div { min-width: 0; }
.nf-feature-panels .nf-legend { grid-column: 1 / -1; }
.nf-panel-label { text-align: center; font-size: 15px; }
.nf-feature-panels svg { touch-action: none; user-select: none; -webkit-user-select: none; }
.nf-feature-panels .nf-point { pointer-events: none; }
.nf-line-control { cursor: grab; outline: none; }
.is-dragging .nf-line-control { cursor: grabbing; }
.nf-line-control:focus-visible [data-line], .nf-line-control:focus-visible circle:last-child { stroke: #332288; stroke-width: 3px; }
svg[data-pointer-focus] .nf-line-control:focus-visible [data-line], svg[data-pointer-focus] .nf-line-control:focus-visible circle:last-child { stroke: #333333; stroke-width: 1.5px; }
@media (max-width: 600px) { .nf-feature-panels { grid-template-columns: 1fr; } }

.network-local { max-width: 800px; margin: 1.5rem auto; }
.network-local-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.network-local img { display: block; width: 100%; height: auto; }
@media (max-width: 600px) {
  .network-local { max-width: 400px; }
  .network-local-panels { grid-template-columns: 1fr; }
}

.nn-equation-row > p { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem 1.5rem; margin: 1.5rem 0; }
.nn-equation-row .math { flex: 0 0 auto; }
