/* Demo-kit surfaces and colors are inherited from the host page. */
.network-graph {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: var(--text);
}
.network-graph[hidden] { display: none; }
.network-graph__overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 142px), 1fr));
  gap: 7px;
  min-width: 0;
}
.network-graph__layer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  grid-template-rows: auto auto;
  gap: 4px 7px;
  min-width: 0;
  min-height: 70px;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--demo-surface-2) 82%, transparent);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.network-graph__layer:hover { border-color: var(--line-strong); }
.network-graph__layer.is-selected {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px var(--cyan);
}
.network-graph__layer:focus-visible,
.network-graph__connection:focus-visible,
.network-graph__pager button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.network-graph__layer-title {
  grid-column: 1;
  overflow: hidden;
  color: var(--text);
  font: 600 12px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.network-graph__layer-detail { grid-column: 1; color: var(--muted); font: 10px var(--mono); }
.network-graph__mini {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 68px;
  height: 30px;
  overflow: visible;
}
.network-graph__mini-edge { fill: none; stroke: var(--line-strong); stroke-width: .7; }
.network-graph__mini-node { fill: var(--cyan); stroke: var(--panel-solid); stroke-width: 1; }
.network-graph__meter {
  position: absolute;
  right: 8px;
  bottom: 3px;
  left: 8px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}
.network-graph__meter::after {
  display: block;
  width: var(--network-strength, 0%);
  height: 100%;
  background: var(--cyan);
  content: "";
  transition: width 100ms linear;
}
.network-graph__selectors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.network-graph__pager { grid-template-columns: repeat(2, max-content); }
.network-graph__pager .policy-editor__page { grid-column: 1 / -1; }
.network-graph__instructions {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.network-graph__diagram {
  display: block;
  width: 100%;
  height: auto;
  max-height: 540px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--demo-surface-2) 65%, transparent);
  touch-action: pan-y;
}
.network-graph__connection { cursor: ns-resize; outline: none; touch-action: none; }
.network-graph__connection.is-positive { --connection-color: var(--cyan); }
.network-graph__connection.is-negative { --connection-color: var(--orange); }
.network-graph__connection.is-zero { --connection-color: var(--muted); }
.network-graph__edge-line {
  fill: none;
  stroke: var(--connection-color, var(--muted));
  stroke-linecap: round;
  pointer-events: none;
}
.network-graph__connection.is-positive .network-graph__edge-line { stroke-dasharray: none; }
.network-graph__connection.is-negative .network-graph__edge-line { stroke-dasharray: 6 4; }
.network-graph__connection.is-zero .network-graph__edge-line { stroke-dasharray: 2 4; }
.network-graph__edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14px;
  pointer-events: stroke;
  touch-action: none;
}
.network-graph__edge-value {
  fill: var(--connection-color, var(--muted));
  stroke: var(--demo-surface-2);
  stroke-width: 4px;
  stroke-linejoin: round;
  paint-order: stroke;
  font: 11px var(--mono);
  pointer-events: none;
}
.network-graph__connection:focus-visible .network-graph__edge-line {
  filter: drop-shadow(0 0 2px var(--cyan));
}
.network-graph__node circle { fill: var(--panel-solid); stroke: var(--line-strong); stroke-width: 1.5px; }
.network-graph__node text {
  fill: var(--text);
  text-anchor: middle;
  font: 8px var(--mono);
  pointer-events: none;
}
.network-graph__node.is-output circle { fill: color-mix(in srgb, var(--cyan) 18%, var(--panel-solid)); stroke: var(--cyan); }
.network-graph__node.is-bias circle { fill: color-mix(in srgb, var(--orange) 16%, var(--panel-solid)); stroke: var(--orange); }
.network-graph__weights { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.network-graph__field { align-content: start; gap: 4px; }
.network-graph__field .policy-editor__number { min-height: 34px; }
.network-graph__bias { max-width: 420px; }
@media (max-width: 420px) {
  .network-graph__overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .network-graph__layer { grid-template-columns: minmax(0, 1fr) 52px; padding: 7px; }
  .network-graph__mini { width: 52px; }
  .network-graph__weights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .network-graph__diagram { max-height: 430px; }
}
