body.page-graphs .eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.graph-kind-grid,
.graph-proof-grid,
.graph-exercises {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.graph-kind-grid article,
.graph-proof-grid article,
.graph-exercises article {
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.graph-kind-grid article > span,
.graph-proof-grid article > span,
.graph-exercises article > span {
  color: var(--accent);
  font-size: 0.79rem;
  font-weight: 750;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.graph-kind-grid h4,
.graph-proof-grid h4 {
  margin: 5px 0 7px;
}

.graph-kind-grid p,
.graph-proof-grid p,
.graph-exercises p {
  margin: 0;
}

.graph-representation-example {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.graph-representation-example pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-alt);
  font-size: 0.88rem;
  line-height: 1.55;
}

.graph-lab {
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.graph-lab button,
.graph-lab input,
.graph-lab select {
  font: inherit;
}

.graph-lab button {
  min-height: 39px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-alt);
  color: var(--text);
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 650;
}

.graph-lab button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.graph-lab button:focus-visible,
.graph-lab input:focus-visible,
.graph-lab select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.graph-lab button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.graph-lab__toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.graph-algorithm-switch {
  display: flex;
  gap: 5px;
  margin-right: auto;
}

.graph-algorithm-switch button {
  min-width: 112px;
}

.graph-algorithm-switch button span {
  display: block;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 500;
}

.graph-algorithm-switch button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.graph-start span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.graph-start select {
  min-width: 76px;
  min-height: 39px;
  padding: 6px 28px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}

.graph-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.graph-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.graph-editor {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}

.graph-editor > label,
.graph-presets > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.graph-editor > div:first-of-type {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 6px;
}

.graph-editor input[type="text"] {
  width: 100%;
  min-height: 41px;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
}

.graph-editor input[aria-invalid="true"] {
  border-color: #b63535;
}

.graph-editor small {
  display: block;
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
}

.graph-editor small.is-error {
  color: #b63535;
}

.graph-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.graph-presets > span {
  margin: 0 4px 0 0;
}

.graph-presets button {
  min-height: 33px;
  padding: 5px 9px;
  font-size: 0.79rem;
}

.graph-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(245px, 0.75fr);
  min-height: 490px;
}

.graph-canvas-wrap {
  position: relative;
  overflow-x: auto;
  border-right: 1px solid var(--line);
  background-color: var(--panel-alt);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--line) 72%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}

.graph-canvas-wrap svg {
  display: block;
  width: 100%;
  min-width: 520px;
  height: 430px;
}

.graph-edge {
  fill: none;
  stroke: color-mix(in srgb, var(--muted) 65%, var(--line));
  stroke-width: 2.2;
  transition: stroke 150ms ease, stroke-width 150ms ease;
}

.graph-edge.is-tree {
  stroke: #2e7c50;
  stroke-width: 4;
}

.graph-edge.is-inspected {
  stroke: #d18418;
  stroke-width: 5;
}

.graph-arrowhead {
  fill: color-mix(in srgb, var(--muted) 65%, var(--line));
}

.graph-arrowhead--tree {
  fill: #2e7c50;
}

.graph-arrowhead--current {
  fill: #d18418;
}

.graph-node {
  cursor: pointer;
  outline: none;
}

.graph-node circle {
  fill: var(--panel);
  stroke: var(--line);
  stroke-width: 2.5;
  transition: fill 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
}

.graph-node text {
  fill: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
  text-anchor: middle;
}

.graph-node .graph-node-value {
  fill: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
}

.graph-node:hover circle,
.graph-node:focus-visible circle {
  stroke: var(--accent);
  stroke-width: 4;
}

.graph-node.is-source circle {
  stroke-dasharray: 4 3;
}

.graph-node.is-frontier circle {
  fill: color-mix(in srgb, #dba13f 25%, var(--panel));
  stroke: #bd7712;
}

.graph-node.is-current circle {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 5;
}

.graph-node.is-finished circle {
  fill: color-mix(in srgb, #2e7c50 20%, var(--panel));
  stroke: #2e7c50;
}

.graph-node-order {
  fill: var(--panel);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.graph-node-order-text {
  fill: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
}

.graph-legend {
  display: flex;
  min-width: 510px;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 13px;
  padding: 9px 13px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 91%, transparent);
  color: var(--muted);
  font-size: 0.69rem;
}

.graph-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.graph-legend i {
  width: 11px;
  height: 11px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
}

.graph-legend .is-frontier {
  border-color: #bd7712;
  background: color-mix(in srgb, #dba13f 25%, var(--panel));
}

.graph-legend .is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.graph-legend .is-finished {
  border-color: #2e7c50;
  background: color-mix(in srgb, #2e7c50 20%, var(--panel));
}

.graph-legend b {
  width: 20px;
  border-top: 3px solid #2e7c50;
}

.graph-inspector {
  overflow: auto;
  max-height: 480px;
  background: var(--panel);
}

.graph-inspector section {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.graph-inspector h4 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.graph-frontier,
.graph-order {
  display: flex;
  min-height: 35px;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.graph-frontier span,
.graph-order span {
  display: inline-grid;
  min-width: 31px;
  min-height: 31px;
  place-items: center;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--panel-alt);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  font-weight: 700;
}

.graph-frontier span:first-child {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}

.graph-values,
.graph-adjacency {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.73rem;
}

.graph-values span,
.graph-adjacency span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-values b,
.graph-adjacency b {
  color: var(--accent);
}

.graph-status {
  display: flex;
  min-height: 67px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.graph-status p {
  margin: 0;
}

.graph-status span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.graph-transport {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
}

.graph-transport > div {
  display: flex;
  gap: 5px;
}

.graph-transport .graph-play {
  min-width: 94px;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.graph-speed {
  display: grid;
  grid-template-columns: auto minmax(80px, 125px) 25px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
}

.graph-speed input {
  width: 100%;
  accent-color: var(--accent);
}

.graph-speed output {
  font-variant-numeric: tabular-nums;
}

.graph-code-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(230px, 0.75fr);
}

.graph-code {
  overflow-x: auto;
  padding: 13px 0;
  border-right: 1px solid var(--line);
  background: var(--panel-alt);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.65;
}

.graph-code > div {
  min-width: 510px;
  padding: 1px 16px;
  white-space: pre;
}

.graph-code > div.is-active {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--accent);
  font-weight: 700;
}

.graph-code .line-number {
  display: inline-block;
  width: 26px;
  color: var(--muted);
  font-weight: 400;
  user-select: none;
}

.graph-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.graph-metrics div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.graph-metrics dt {
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.graph-metrics dd {
  margin: 3px 0 0;
  color: var(--accent);
  font-size: 1.12rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.graph-exercises {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

@media (max-width: 900px) {
  .graph-lab__toolbar {
    flex-wrap: wrap;
  }

  .graph-algorithm-switch {
    width: 100%;
  }

  .graph-stage {
    grid-template-columns: 1fr;
  }

  .graph-canvas-wrap {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .graph-inspector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .graph-code-layout {
    grid-template-columns: 1fr;
  }

  .graph-code {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 650px) {
  .graph-kind-grid,
  .graph-proof-grid,
  .graph-exercises,
  .graph-inspector {
    grid-template-columns: 1fr;
  }

  .graph-representation-example {
    grid-template-columns: 1fr;
  }

  .graph-representation-example > div {
    transform: rotate(90deg);
    text-align: center;
  }

  .graph-lab__toolbar,
  .graph-editor,
  .graph-status,
  .graph-transport {
    padding-right: 12px;
    padding-left: 12px;
  }

  .graph-algorithm-switch button {
    min-width: 0;
    flex: 1 1 0;
  }

  .graph-start {
    margin-right: auto;
  }

  .graph-editor > div:first-of-type {
    grid-template-columns: 1fr;
  }

  .graph-canvas-wrap svg {
    height: 380px;
  }

  .graph-status,
  .graph-transport {
    align-items: stretch;
    flex-direction: column;
  }

  .graph-transport > div {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
  }

  .graph-transport .graph-play {
    min-width: 0;
  }

  .graph-speed {
    grid-template-columns: auto minmax(80px, 1fr) 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .graph-edge,
  .graph-node circle {
    transition: none;
  }
}
