.algoviz-wrap {
  margin: 1.5rem 0;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 8px;
  padding: 1rem;
}

.algoviz-stage {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
}

.algoviz-stage canvas {
  max-width: 100%;
}

.algoviz-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.algoviz-btn {
  cursor: pointer;
  border: 1px solid rgba(128, 128, 128, 0.6);
  background: transparent;
  color: inherit;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.algoviz-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.algoviz-counter {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  opacity: 0.7;
}

.algoviz-speed {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  opacity: 0.8;
}

.algoviz-caption {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-top: 0.6rem;
}

.algoviz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.5rem;
}

.algoviz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.algoviz-swatch {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 2px;
}
